scanning_drug.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. <template>
  2. <view class="pharmacyDetails" v-show="drugsBagDto.id">
  3. <view class="pharmacyDetails_title">请领信息</view>
  4. <view class="page_item_wrap">
  5. <view class="page_item">
  6. <view class="page_item_top">
  7. <view class="page_item_top-inner">
  8. <view class="page_item_top_L">
  9. <text class="L_text">请领单:{{ drugsBagDto.packid }}</text>
  10. </view>
  11. <view class="page_item_top_R">
  12. <text class="L_iocn">{{
  13. drugsBagDto.drugsState ? drugsBagDto.drugsState.name : ""
  14. }}</text>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="page_item_cont">
  19. <view class="page_item_cont_B">
  20. <view class="page_item_cont_title">
  21. <text>记账时间</text>
  22. <text class="text_big">
  23. <text>{{ drugsBagDto.creatTime }}</text>
  24. </text>
  25. </view>
  26. </view>
  27. <view class="page_item_cont_C">
  28. <view class="page_item_cont_title_C">
  29. <text>请领科室</text>
  30. <text class="text_big">
  31. <text>{{
  32. drugsBagDto.target ? drugsBagDto.target.dept : ""
  33. }}</text>
  34. </text>
  35. </view>
  36. </view>
  37. <view class="page_item_cont_C" v-show="workOrder.id">
  38. <view class="page_item_cont_title_C">
  39. <text>单号</text>
  40. <text class="text_big">
  41. <text>{{ workOrder.gdcode }}</text>
  42. </text>
  43. </view>
  44. </view>
  45. <view class="page_item_cont_C" v-show="workOrder.id">
  46. <view class="page_item_cont_title_C">
  47. <text>状态</text>
  48. <text class="text_big">
  49. <text>{{
  50. workOrder.gdState ? workOrder.gdState.name : ""
  51. }}</text>
  52. </text>
  53. </view>
  54. </view>
  55. <view class="page_item_cont_C" v-show="workOrder.id">
  56. <view class="page_item_cont_title_C">
  57. <text>服务人员</text>
  58. <text class="text_big">
  59. <text>{{ workOrder.worker ? workOrder.worker.name : "" }}</text>
  60. </text>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="L"></view>
  65. <view class="R"></view>
  66. </view>
  67. <view class="L-l"></view>
  68. <view class="R-l"></view>
  69. </view>
  70. <button
  71. class="cube-toolbar-item"
  72. v-show="isShowBtn"
  73. @click="buildOrderAndSign()"
  74. >
  75. 接单并签到
  76. </button>
  77. <button class="cube-toolbar-item" v-show="!isShowBtn" @click="goBack()">
  78. 知道了
  79. </button>
  80. <!-- 弹窗 -->
  81. <showModel
  82. :title="models.title"
  83. :icon="models.icon"
  84. :disjunctor="models.disjunctor"
  85. :content="models.content"
  86. @ok="ok"
  87. @cancel="cancel"
  88. :operate="models.operate"
  89. ></showModel>
  90. <!-- 填写交接人账号弹窗 -->
  91. <selectAccount
  92. v-if="hosModels.disjunctor"
  93. :title="hosModels.title"
  94. :disjunctor="hosModels.disjunctor"
  95. @ok="hosOk"
  96. @cancel="hosCancel"
  97. >
  98. </selectAccount>
  99. </view>
  100. </template>
  101. <script>
  102. import selectAccount from "@/components/selectAccount/selectAccount";
  103. import { webHandle, post } from "../../http/http.js";
  104. export default {
  105. data() {
  106. return {
  107. // 弹窗model
  108. models: {
  109. disjunctor: false,
  110. },
  111. drugsBagDto: {}, //药包信息
  112. workOrder: {}, //药包关联的工单信息
  113. currentCode: "", //当前小扫描的科室二维码
  114. currentData: {}, //当前小扫描的工单对象
  115. // 填写交接人账号弹窗model
  116. hosModels: {
  117. disjunctor: false,
  118. },
  119. grabOrders: null,
  120. gotoFlag: true,
  121. };
  122. },
  123. components: {
  124. selectAccount,
  125. },
  126. computed: {
  127. isShowBtn() {
  128. if (this.workOrder.gdState) {
  129. let state = this.workOrder.gdState.value;
  130. // 待抢单,待接单,待到达,待送达
  131. return state == 2 || state == 3 || state == 4 || state == 5;
  132. } else {
  133. return false;
  134. }
  135. },
  136. },
  137. methods: {
  138. goBack() {
  139. uni.navigateTo({
  140. url: "../receiptpage/receiptpage",
  141. });
  142. },
  143. // 如果不是患者陪检或患者转运或其他
  144. // 科室签到
  145. nextDeptOrder_s(data, accountObj) {
  146. console.log(data, accountObj);
  147. let ids = [];
  148. let id = data.id;
  149. ids.push(id);
  150. let code = "";
  151. let postData = {
  152. ids,
  153. };
  154. if (accountObj) {
  155. postData.handover = [accountObj.accountId];
  156. }
  157. if (this.grabOrders) {
  158. postData.grabOrders = this.grabOrders;
  159. }
  160. if (this.currentCode) {
  161. code = this.currentCode;
  162. // 科室签到
  163. post("/workerOrder/orderSign/" + code, postData).then((res) => {
  164. uni.hideLoading();
  165. if (res.status == 200) {
  166. // 跳转到扫描科室
  167. // type1: res.type, //type类型
  168. // id: data.id, //工单ID
  169. // deptCode: code, //二维码
  170. // dept: res.dept //科室名称
  171. let urlObj = {
  172. url: `/pages/scanning_code/scanning_code?type=${
  173. data.taskType.associationType.value
  174. }&type1=${res.type}&id=${data.id}&deptCode=${code}&dept=${
  175. res.dept
  176. }&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}`,
  177. };
  178. if (this.grabOrders) {
  179. urlObj.url += `&grabOrders=666`;
  180. }
  181. uni.navigateTo(urlObj);
  182. } else {
  183. uni.navigateTo({
  184. url: `/pages/scanning_Result/scanning_Result?type=${data.taskType.associationType.value}&type1=${res.type}&id=${data.id}&status=600&msg=${res.msg}&isKs=1&qrcode=${this.currentCode}`,
  185. });
  186. }
  187. });
  188. }
  189. },
  190. // 签到
  191. orderSign(data, type, ress1) {
  192. this.currentData = data;
  193. console.log(data, "data");
  194. uni.showLoading({
  195. title: "加载中",
  196. mask: true,
  197. });
  198. //检验二维码的有效性
  199. post("/dept/scanning", {
  200. content: ress1,
  201. taskTypeId: data.taskType.id,
  202. gdState: data.gdState.id,
  203. }).then((result) => {
  204. this.currentCode = result.code;
  205. if (result.state == 200 || result.state == 201) {
  206. if (result.account) {
  207. if (type == 2) {
  208. this.nextDeptOrder_s(this.currentData, {
  209. account: result.account,
  210. accountName: result.name,
  211. accountId: result.id,
  212. });
  213. }
  214. } else {
  215. if (type == 2) {
  216. this.nextDeptOrder_s(this.currentData);
  217. }
  218. }
  219. } else if (result.state == "0000") {
  220. uni.hideLoading();
  221. this.showSelectAccount();
  222. } else {
  223. uni.hideLoading();
  224. uni.showToast({
  225. icon: "none",
  226. title: "请求失败!",
  227. });
  228. }
  229. });
  230. },
  231. // 填写交接人账号-确认
  232. hosOk(data) {
  233. console.log(data);
  234. const { accountName, account, accountId } = data;
  235. if (!accountName && !account) {
  236. //没有填写交接人
  237. uni.showModal({
  238. title: "提示",
  239. content: "请填写交接人账号!",
  240. showCancel: false,
  241. success: function (res) {
  242. if (res.confirm) {
  243. console.log("用户点击确定");
  244. } else if (res.cancel) {
  245. console.log("用户点击取消");
  246. }
  247. },
  248. });
  249. return;
  250. } else if ((!accountName && account) || (accountName && !account)) {
  251. //没有填写交接人
  252. uni.showModal({
  253. title: "提示",
  254. content: "请填写正确的交接人账号!",
  255. showCancel: false,
  256. success: function (res) {
  257. if (res.confirm) {
  258. console.log("用户点击确定");
  259. } else if (res.cancel) {
  260. console.log("用户点击取消");
  261. }
  262. },
  263. });
  264. return;
  265. }
  266. this.hosModels.disjunctor = false;
  267. this.commonBuild(data);
  268. },
  269. // 填写交接人账号-取消
  270. hosCancel() {
  271. this.hosModels.disjunctor = false;
  272. this.gotoFlag = true;
  273. },
  274. // 填写交接人账号弹窗
  275. showSelectAccount() {
  276. this.hosModels = {
  277. title: "填写交接人账号",
  278. disjunctor: true,
  279. };
  280. },
  281. // 接单---data就是交接人信息
  282. commonBuild(data) {
  283. let postData = {
  284. packId: this.workOrder.drugs.packid,
  285. orderId: this.workOrder.id,
  286. };
  287. if (data) {
  288. //有交接人
  289. postData.handover = data.accountId;
  290. }
  291. uni.showLoading({
  292. title: "加载中",
  293. mask: true,
  294. });
  295. post("/workerOrder/drugBagReceiving", postData).then((ress) => {
  296. uni.hideLoading();
  297. if (ress.status == 200) {
  298. this.grabOrders = ress.grabOrders ? ["666"] : null;
  299. // this.orderSign(ress.workOrder, 2, ress.content);
  300. let info = {
  301. targetDept: ress.data.target.dept, //所属科室
  302. packid: ress.data.packid, //药包编码
  303. status: ress.status,
  304. msg: ress.msg,
  305. };
  306. if (data) {
  307. //有交接人
  308. info.accountName = data.accountName; //交接人姓名
  309. info.account = data.account; //交接人账号
  310. }
  311. uni.navigateTo({
  312. url: `../scanning_result_seimin/scanning_result_seimin?info=${encodeURIComponent(
  313. JSON.stringify(info)
  314. )}`,
  315. });
  316. } else if (ress.status == "0000") {
  317. uni.hideLoading();
  318. this.showSelectAccount();
  319. } else {
  320. uni.showToast({
  321. icon: "none",
  322. title: "请求失败!",
  323. });
  324. }
  325. });
  326. },
  327. ok() {
  328. this.models.disjunctor = false;
  329. this.commonBuild();
  330. },
  331. // 取消
  332. cancel() {
  333. this.models.disjunctor = false;
  334. this.gotoFlag = true;
  335. },
  336. // 接单并签到
  337. buildOrderAndSign() {
  338. if (!this.gotoFlag) {
  339. return;
  340. }
  341. this.gotoFlag = false;
  342. if (this.workOrder.gdState) {
  343. let state = this.workOrder.gdState.value;
  344. if (state == 4 || state == 5) {
  345. //待到达,待送达
  346. this.models = {
  347. disjunctor: true,
  348. title: "提示",
  349. content: "您想接单的药品,工单正在执行中。请确认是否继续接单签到?",
  350. icon: "warn",
  351. operate: {
  352. ok: "确定",
  353. cancel: "取消",
  354. },
  355. };
  356. } else {
  357. // 待接单 待抢单
  358. this.commonBuild();
  359. }
  360. }
  361. },
  362. //获取药包信息及其关联的工单信息
  363. queryDrugsBagForId(drugsBagId) {
  364. uni.showLoading({
  365. title: "加载中",
  366. mask: true,
  367. });
  368. post("/workerOrder/queryDrugsBagForId", {
  369. drugsBagId,
  370. }).then((res) => {
  371. uni.hideLoading();
  372. if (res.status == 200) {
  373. this.drugsBagDto = res.drugsBagDto || {};
  374. this.workOrder = res.workOrder || {};
  375. } else {
  376. uni.showToast({
  377. icon: "none",
  378. title: "请求失败",
  379. });
  380. }
  381. });
  382. },
  383. },
  384. onShow() {
  385. this.gotoFlag = true;
  386. },
  387. onLoad(options) {
  388. console.log(options);
  389. let { drugsBagId } = options;
  390. if (drugsBagId) {
  391. this.queryDrugsBagForId(drugsBagId);
  392. }
  393. // this.infoDATA = JSON.parse(options.infoDATA); //详细信息
  394. // console.log(this.infoDATA)
  395. // this.res["status"] = options.status; //状态码
  396. // this.res["msg"] = options.msg; //返回的信息
  397. // #ifdef APP-PLUS
  398. webHandle("no", "app");
  399. // #endif
  400. // #ifdef H5
  401. webHandle("no", "wx");
  402. // #endif
  403. },
  404. };
  405. </script>
  406. <style lang="less" scoped>
  407. .pharmacyDetails {
  408. background-color: rgb(249, 250, 251);
  409. padding-top: 10%;
  410. .pharmacyDetails_title {
  411. font-size: 46rpx;
  412. font-weight: 550;
  413. text-align: center;
  414. }
  415. .page_item_wrap {
  416. position: relative;
  417. margin-top: 32rpx;
  418. .page_item {
  419. margin-top: 16rpx;
  420. margin-bottom: 124rpx;
  421. background: #fff;
  422. border-radius: 8rpx;
  423. margin: 0 20rpx;
  424. border: 2rpx solid #e5e9ed;
  425. position: relative;
  426. overflow: hidden;
  427. padding: 0 16rpx;
  428. .L {
  429. width: 40rpx;
  430. height: 40rpx;
  431. border-radius: 50%;
  432. background: #f9fafb;
  433. position: absolute;
  434. left: -20rpx;
  435. top: 68rpx;
  436. border: 2rpx solid #e5e9ed;
  437. }
  438. .R {
  439. width: 40rpx;
  440. height: 40rpx;
  441. border-radius: 50%;
  442. background: #f9fafb;
  443. position: absolute;
  444. float: right;
  445. right: -20rpx;
  446. top: 68rpx;
  447. border: 2rpx solid #e5e9ed;
  448. }
  449. .page_item_top {
  450. height: 88rpx;
  451. border-bottom: 2rpx dashed #e5e9ed;
  452. padding: 0 16rpx;
  453. .page_item_top-inner {
  454. display: flex;
  455. justify-content: space-between;
  456. align-items: center;
  457. height: 100%;
  458. .page_item_top_L {
  459. .L_text {
  460. font-size: 32rpx;
  461. font-weight: 700;
  462. }
  463. }
  464. .page_item_top_R {
  465. font-size: 32rpx;
  466. .L_iocn {
  467. color: rgb(7, 134, 60);
  468. font-size: 36rpx;
  469. font-weight: 700;
  470. }
  471. }
  472. }
  473. }
  474. .page_item_cont {
  475. min-height: 180rpx;
  476. max-height: 424rpx;
  477. padding: 0 16rpx;
  478. text-align: left;
  479. position: relative;
  480. .text_big {
  481. font-size: 32rpx;
  482. font-weight: 700;
  483. text {
  484. font-weight: 700;
  485. line-height: 1.5;
  486. }
  487. }
  488. .line {
  489. height: 20rpx;
  490. width: 2rpx;
  491. border-left: 2rpx solid #e5e9ed;
  492. position: absolute;
  493. top: 82rpx;
  494. left: 40rpx;
  495. }
  496. .page_item_cont_T {
  497. padding-top: 28rpx;
  498. font-size: 28rpx;
  499. .page_item_cont_title {
  500. height: 100%;
  501. font-size: 32rpx;
  502. display: flex;
  503. justify-content: space-between;
  504. }
  505. }
  506. .page_item_cont_B {
  507. padding-top: 28rpx;
  508. margin-bottom: 28rpx;
  509. .page_item_cont_title {
  510. font-size: 32rpx;
  511. display: flex;
  512. justify-content: space-between;
  513. align-items: center;
  514. }
  515. }
  516. .page_item_cont_C {
  517. margin-bottom: 28rpx;
  518. .page_item_cont_title_C {
  519. font-size: 32rpx;
  520. display: flex;
  521. justify-content: space-between;
  522. align-items: center;
  523. }
  524. }
  525. #infos {
  526. display: none;
  527. }
  528. }
  529. }
  530. .L-l {
  531. width: 2rpx;
  532. height: 40rpx;
  533. background: #f9fafb;
  534. position: absolute;
  535. left: 20rpx;
  536. top: 72rpx;
  537. }
  538. .R-l {
  539. width: 2rpx;
  540. height: 40rpx;
  541. background: #f9fafb;
  542. position: absolute;
  543. right: 20rpx;
  544. top: 72rpx;
  545. }
  546. }
  547. .cube-toolbar-item {
  548. width: 710rpx;
  549. height: 68rpx;
  550. line-height: 68rpx;
  551. position: fixed;
  552. left: 20rpx;
  553. bottom: 160rpx;
  554. border-radius: 8rpx;
  555. background: linear-gradient(to right, #72c172, #3bb197);
  556. font-size: 36rpx;
  557. color: #fff;
  558. text-align: center;
  559. }
  560. .btn-wrap {
  561. display: flex;
  562. justify-content: space-between;
  563. position: fixed;
  564. left: 20rpx;
  565. bottom: 160rpx;
  566. }
  567. .cube-toolbar-item1 {
  568. width: 350rpx;
  569. height: 68rpx;
  570. line-height: 68rpx;
  571. border-radius: 8rpx;
  572. margin: 0 5rpx;
  573. background: linear-gradient(to right, #72c172, #3bb197);
  574. font-size: 36rpx;
  575. color: #fff;
  576. text-align: center;
  577. }
  578. }
  579. </style>