continueScanning.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. <template>
  2. <view class="Scanning_Result">
  3. <view class="Scanning_top">
  4. <view class="Scanning_top_icon">{{scanCount}}</view>
  5. <view class="tips" v-if="workOrder.gdState && workOrder.gdState.value == 4">您已到达<text class="red">起点科室-{{workOrder.startDept.dept}},</text>请扫描核对药包码。</view>
  6. <view class="tips" v-if="workOrder.gdState && workOrder.gdState.value == 5">您已到达<text class="red">终点科室-{{workOrder.endDeptNames}}</text>,请扫描核对药包码。</view>
  7. </view>
  8. <view class="Scanning_cont">
  9. <scroll-view scroll-y class="scrollContent">
  10. <view class="column">
  11. <view class="name">单号:</view>
  12. <view class="value">{{drugsBag.packid}}</view>
  13. </view>
  14. <view class="column">
  15. <view class="name">申请科室:</view>
  16. <view class="value">{{drugsBag.target ? drugsBag.target.dept : ''}}</view>
  17. </view>
  18. <view class="column">
  19. <view class="name">发药科室:</view>
  20. <view class="value">{{drugsBag.launch ? drugsBag.launch.dept : ''}}</view>
  21. </view>
  22. <view class="column">
  23. <view class="name">种类数:</view>
  24. <view class="value">{{drugsBag.drugsTypeCount}}</view>
  25. </view>
  26. <view class="column">
  27. <view class="name">药品数:</view>
  28. <view class="value">{{drugsBag.drugsCount}}</view>
  29. </view>
  30. </scroll-view>
  31. </view>
  32. <view class="foot_btn_spe">
  33. <view class="column">
  34. <view class="btn" @click="Scanning_again()">继续扫描</view>
  35. <view class="btn" @click="hand_again()">手动录入</view>
  36. </view>
  37. <view class="column">
  38. <view class="btn" @click="checkHandover()">核对交接</view>
  39. </view>
  40. </view>
  41. <!-- 手动查询药品弹窗 -->
  42. <handViewDrugsBag v-if="drugbagModels.disjunctor" :title="drugbagModels.title"
  43. :disjunctor="drugbagModels.disjunctor" @ok="drugbagOk" @cancel="drugbagCancel">
  44. </handViewDrugsBag>
  45. </view>
  46. </template>
  47. <script>
  48. import {
  49. get,
  50. post,
  51. SM,
  52. webHandle
  53. } from "@/http/http.js";
  54. export default {
  55. data() {
  56. return {
  57. workOrder: {}, //工单信息
  58. drugsBag: {}, //药包信息
  59. queryObj: {}, //路由传递过来的数据
  60. scanCount: '', //已扫描数量
  61. SMFlag: true,
  62. // 手动查询弹窗model
  63. drugbagModels: {
  64. disjunctor: false,
  65. },
  66. };
  67. },
  68. onShow() {
  69. this.SMFlag = true;
  70. },
  71. methods: {
  72. // 手动查询药品-确认
  73. drugbagOk(data) {
  74. console.log(data);
  75. if (!data.id) {
  76. //没有查询到药品
  77. uni.showModal({
  78. title: '提示',
  79. content: "没有查询到发药单号!",
  80. showCancel: false,
  81. success: function(res) {
  82. if (res.confirm) {
  83. console.log('用户点击确定');
  84. } else if (res.cancel) {
  85. console.log('用户点击取消');
  86. }
  87. }
  88. });
  89. return;
  90. }
  91. this.drugbagModels.disjunctor = false;
  92. this.hand_scanning_common(data.packid, 'hand');
  93. },
  94. // 手动查询药品-取消
  95. drugbagCancel() {
  96. this.drugbagModels.disjunctor = false;
  97. },
  98. // 手动查询药品弹窗
  99. showHandViewDrugsbag() {
  100. this.drugbagModels = {
  101. title: '填写发药单号',
  102. disjunctor: true,
  103. }
  104. },
  105. // 手动录入
  106. hand_again() {
  107. this.showHandViewDrugsbag();
  108. },
  109. // 核对交接
  110. checkHandover(){
  111. uni.navigateTo({
  112. url: `/pages/newDrug/checkPage/checkPage?drugsBagType=${this.queryObj.drugsBagType}&orderId=${this.queryObj.orderId}`,
  113. });
  114. },
  115. // 继续扫描
  116. Scanning_again(isFlag = false) {
  117. if (!this.SMFlag) {
  118. return;
  119. }
  120. this.SMFlag = false;
  121. SM().then((ress1) => {
  122. this.hand_scanning_common(ress1, 'scan', isFlag);
  123. }).catch(err => {
  124. this.SMFlag = true;
  125. });
  126. },
  127. // 手动输入和扫码公共方法
  128. hand_scanning_common(ress1, type, isFlag = false) {
  129. // ----------------
  130. uni.showLoading({
  131. title: "加载中",
  132. mask: true,
  133. });
  134. //检验二维码的有效性
  135. post("/dept/scanning", {
  136. content: ress1,
  137. }).then((result) => {
  138. this.SMFlag = true;
  139. if (result.state == 200 || result.state == 201) {
  140. let codes = result.code;
  141. if (codes) {
  142. this.input_common(ress1, type, isFlag);
  143. } else {
  144. uni.hideLoading();
  145. }
  146. } else {
  147. uni.hideLoading();
  148. uni.showToast({
  149. icon: "none",
  150. title: result.info || "接口获取数据失败!",
  151. });
  152. }
  153. });
  154. // ------------------------------
  155. },
  156. // 录入到工单
  157. input_common(ress1, type, isFlag = false){
  158. uni.showLoading({
  159. title: "加载中",
  160. mask: true,
  161. });
  162. post("/transflow/scanBind", { type: this.queryObj.drugsBagType, orderId: this.queryObj.orderId, code: ress1 }).then((ress) => {
  163. uni.hideLoading();
  164. if (ress.state == 200) {
  165. if(ress.data.msg){
  166. uni.showToast({
  167. icon: "none",
  168. title: ress.data.msg || "接口获取数据失败!",
  169. });
  170. }else{
  171. uni.redirectTo({
  172. url: `/pages/newDrug/continueScanning/continueScanning?drugsBagType=${this.queryObj.drugsBagType}&orderId=${this.queryObj.orderId}&scanOrHand=${type}&drugsBagId=${ress.data.dto.id}&orderStateValue=${this.queryObj.orderStateValue}`,
  173. });
  174. }
  175. } else {
  176. uni.showToast({
  177. icon: "none",
  178. title: ress.msg || "接口获取数据失败!",
  179. });
  180. }
  181. });
  182. },
  183. //获取页面信息
  184. getInfo(){
  185. uni.showLoading({
  186. title: "加载中",
  187. mask: true,
  188. });
  189. post(`/transflow/scanInfo`, {type: this.queryObj.drugsBagType, id: +this.queryObj.drugsBagId, orderStateValue: this.queryObj.orderStateValue, orderId: +this.queryObj.orderId}).then(res => {
  190. uni.hideLoading();
  191. if(res.state == 200){
  192. if(res.data){
  193. this.scanCount = res.data.scanCount;
  194. this.drugsBag = res.data.dto || {};
  195. let workOrder = res.data.workOrder || {};
  196. workOrder.endDeptNames = workOrder.endDepts.map(v=>v.dept).toString();
  197. this.workOrder = workOrder;
  198. }
  199. }else{
  200. uni.showToast({
  201. icon: "none",
  202. title: res.msg || "接口获取数据失败!",
  203. });
  204. }
  205. })
  206. },
  207. },
  208. onLoad(options) {
  209. console.log(options, "options");
  210. this.queryObj = options;
  211. this.getInfo();
  212. // #ifdef APP-PLUS
  213. webHandle("no", "app");
  214. // #endif
  215. // #ifdef H5
  216. webHandle("no", "wx");
  217. // #endif
  218. },
  219. };
  220. </script>
  221. <style lang="less" scoped>
  222. .Scanning_Result {
  223. background: #FAFBFD;
  224. padding: 0 24rpx;
  225. display: flex;
  226. flex-direction: column;
  227. height: 100vh;
  228. .Scanning_top {
  229. display: flex;
  230. flex-direction: column;
  231. align-items: center;
  232. .tips{
  233. margin: 24rpx 0 40rpx;
  234. text-align: justify;
  235. font-weight: bold;
  236. font-size: 30rpx;
  237. }
  238. .Scanning_top_icon {
  239. font-size: 140rpx;
  240. color: #FF0000;
  241. font-weight: bold;
  242. }
  243. }
  244. .Scanning_cont {
  245. flex: 1;
  246. min-height: 0;
  247. display: flex;
  248. flex-direction: column;
  249. .scrollContent{
  250. flex: 1;
  251. min-height: 0;
  252. }
  253. .column{
  254. display: flex;
  255. justify-content: center;
  256. align-items: center;
  257. font-size: 30rpx;
  258. margin-bottom: 32rpx;
  259. .name{
  260. font-weight: bold;
  261. word-break: break-all;
  262. flex-shrink: 0;
  263. }
  264. .value{
  265. word-break: break-all;
  266. }
  267. }
  268. }
  269. .foot_btn_spe {
  270. margin: 24rpx 0;
  271. display: flex;
  272. flex-direction: column;
  273. align-items: center;
  274. gap: 24rpx;
  275. font-weight: bold;
  276. .column{
  277. width: 100%;
  278. height: 78rpx;
  279. display: flex;
  280. align-items: center;
  281. justify-content: space-between;
  282. gap: 24rpx;
  283. .btn {
  284. height: 100%;
  285. flex: 1;
  286. background: linear-gradient( 90deg, #6FC073 0%, #3DB197 100%);
  287. color: #fff;
  288. border-radius: 4rpx;
  289. font-size: 30rpx;
  290. display: flex;
  291. justify-content: center;
  292. align-items: center;
  293. }
  294. }
  295. }
  296. }
  297. </style>