createOrder.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. <template>
  2. <view class="Scanning_Result">
  3. <view class="Scanning_top">
  4. <view class="Scanning_top_icon">
  5. <text class="cubeic-ok newicon newicon-duigou"></text>
  6. </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" v-if="config.showDrugsBagTypeCount == 1">
  23. <view class="name">种类数:</view>
  24. <view class="value">{{drugsBag.drugsTypeCount}}</view>
  25. </view>
  26. <view class="column" v-if="config.showDrugsBagTypeCount == 1">
  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="goIndex()">返回</view>
  35. <view class="btn" @click="createOrBuildOrder('build')" v-if="queryObj.type === 'build' && config.drugsCreateSign === 1">建单并签到</view>
  36. <view class="btn" @click="createOrBuildOrder('receive')" v-if="queryObj.type === 'receive' && config.drugsReceiveSign === 1">接单并签到</view>
  37. <view class="btn" @click="createOrBuildOrder('merge')" v-if="queryObj.type === 'merge'">合并工单配送</view>
  38. <view class="btn" @click="createOrBuildOrder('build')" v-if="workOrder.gdState && (workOrder.gdState.value == 4 || workOrder.gdState.value == 5) && config.urgentCreateOrder == 1">紧急配送建单</view>
  39. </view>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. import {
  45. get,
  46. post,
  47. SM,
  48. webHandle
  49. } from "@/http/http.js";
  50. export default {
  51. data() {
  52. return {
  53. queryObj: {}, //路由传递过来的数据
  54. drugsBag: {}, //药包信息
  55. config: {}, //药品的业务流程配置
  56. orderId: undefined, //根据药包查询到的工单ID
  57. workOrder: {}, //工单
  58. };
  59. },
  60. methods: {
  61. // 返回
  62. goIndex(){
  63. uni.redirectTo({
  64. url: `/pages/receiptpage/receiptpage`,
  65. });
  66. },
  67. // 根据配置跳转页面
  68. pageNavigateByConfig(config, responseData, queryObj){
  69. let drugsBagType = queryObj.drugsBagType;
  70. let orderId = responseData.orderId;
  71. let drugsBagId = queryObj.drugsBagId;
  72. let orderStateValue = responseData.orderStateValue;
  73. if(config.drugsModel === 1){
  74. // 一单一码
  75. if(responseData.orderStateValue == 4){
  76. // 待到达
  77. if(config.drugsStartCheck === 1){
  78. // 起点科室支持核对
  79. uni.navigateTo({
  80. url: `/pages/newDrug/checkPage/checkPage?drugsBagType=${drugsBagType}&orderId=${orderId}`,
  81. });
  82. }else{
  83. // 起点科室不支持核对
  84. if(config.drugsStartPhoto === 1){
  85. // 起点科室支持拍照留存
  86. uni.navigateTo({
  87. url: `/pages/newDrug/photoRetention/photoRetention?drugsBagType=${drugsBagType}&orderId=${orderId}`,
  88. });
  89. }else{
  90. // 起点科室不支持拍照留存
  91. this.completeOrder(responseData, queryObj);
  92. }
  93. }
  94. }else if(responseData.orderStateValue == 5){
  95. // 待送达
  96. if(config.drugsEndCheck === 1){
  97. // 起点科室支持核对
  98. uni.navigateTo({
  99. url: `/pages/newDrug/checkPage/checkPage?drugsBagType=${drugsBagType}&orderId=${orderId}`,
  100. });
  101. }else{
  102. // 起点科室不支持核对
  103. if(config.drugsEndPhoto === 1){
  104. // 起点科室支持拍照留存
  105. uni.navigateTo({
  106. url: `/pages/newDrug/photoRetention/photoRetention?drugsBagType=${drugsBagType}&orderId=${orderId}`,
  107. });
  108. }else{
  109. // 起点科室不支持拍照留存
  110. this.completeOrder(responseData, queryObj);
  111. }
  112. }
  113. }
  114. }else if(config.drugsModel === 2){
  115. // 一单多码
  116. uni.navigateTo({
  117. url: `/pages/newDrug/continueScanning/continueScanning?drugsBagType=${drugsBagType}&orderId=${orderId}&drugsBagId=${drugsBagId}&orderStateValue=${orderStateValue}`,
  118. });
  119. }
  120. },
  121. // 工单完成
  122. completeOrder(responseData, queryObj){
  123. uni.showLoading({
  124. title: "加载中",
  125. mask: true,
  126. });
  127. let postData = {
  128. "type": queryObj.drugsBagType,
  129. "orderId": responseData.orderId,
  130. };
  131. post('/transflow/checkComplete', postData).then(res => {
  132. uni.hideLoading();
  133. if(res.state == 200){
  134. uni.showToast({
  135. icon: "none",
  136. title: responseData.orderStateValue == 4 ? "交接成功,请尽快送达科室!" : (responseData.orderStateValue == 5 ? "交接成功,完成配送!" : ""),
  137. duration: 60000,
  138. mask: true,
  139. complete(){
  140. setTimeout(() => {
  141. uni.hideToast();
  142. uni.redirectTo({
  143. url: `/pages/receiptpage/receiptpage`,
  144. });
  145. }, 2000)
  146. }
  147. });
  148. }else{
  149. uni.showToast({
  150. icon: "none",
  151. title: res.msg || "接口获取数据失败!",
  152. });
  153. }
  154. })
  155. },
  156. // 建单并签到/接单并签到
  157. createOrBuildOrder(type){
  158. let content = '';
  159. if(type === 'build'){
  160. content = `请确认是否建单并签到?`;
  161. }else if(type === 'receive'){
  162. content = `请确认是否接单并签到?`;
  163. }else if(type === 'merge'){
  164. content = `您确认要合并工单进行配送吗?`;
  165. }
  166. uni.showModal({
  167. title: "提示",
  168. content,
  169. success: (result) => {
  170. if (result.confirm) {
  171. console.log("用户点击确定");
  172. let postData = {
  173. type: this.queryObj.drugsBagType,
  174. id: +this.queryObj.drugsBagId,
  175. };
  176. if(type === 'receive'){
  177. postData.orderId = this.orderId;
  178. }else if(type === 'merge'){
  179. postData.orderId = this.queryObj.newOrderId || undefined;
  180. postData.oldOrderId = this.queryObj.orderId || undefined;
  181. }
  182. uni.showLoading({
  183. title: "加载中",
  184. mask: true,
  185. });
  186. post(`/transflow/createOrTakeOrder`, postData).then((ress) => {
  187. uni.hideLoading();
  188. if (ress.state == 200) {
  189. if(ress.data.msg){
  190. uni.showToast({
  191. icon: "none",
  192. title: ress.data.msg || "接口获取数据失败!",
  193. });
  194. }else{
  195. this.pageNavigateByConfig(this.config, ress.data, this.queryObj);
  196. }
  197. } else {
  198. uni.showToast({
  199. icon: "none",
  200. title: ress.msg || "接口获取数据失败!",
  201. });
  202. }
  203. });
  204. } else if (result.cancel) {
  205. console.log("用户点击取消");
  206. }
  207. },
  208. });
  209. },
  210. //获取页面信息
  211. getInfo(){
  212. uni.showLoading({
  213. title: "加载中",
  214. mask: true,
  215. });
  216. post(`/transflow/scanInfo`, {type: this.queryObj.drugsBagType, id: +this.queryObj.drugsBagId, orderStateValue: '4'}).then(res => {
  217. uni.hideLoading();
  218. if(res.state == 200){
  219. if(res.data){
  220. this.drugsBag = res.data.dto || {};
  221. this.orderId = this.queryObj.orderId;
  222. this.config = res.data.taskTypeConfig || {};
  223. this.workOrder = res.data.workOrder || {};
  224. }
  225. }else{
  226. uni.showToast({
  227. icon: "none",
  228. title: res.msg || "接口获取数据失败!",
  229. });
  230. }
  231. })
  232. },
  233. },
  234. onLoad(options) {
  235. console.log(options, "options");
  236. this.queryObj = options;
  237. this.getInfo();
  238. // #ifdef APP-PLUS
  239. webHandle("no", "app");
  240. // #endif
  241. // #ifdef H5
  242. webHandle("no", "wx");
  243. // #endif
  244. },
  245. };
  246. </script>
  247. <style lang="less" scoped>
  248. .Scanning_Result {
  249. background: #FAFBFD;
  250. padding: 0 24rpx;
  251. display: flex;
  252. flex-direction: column;
  253. height: 100vh;
  254. .Scanning_top {
  255. margin: 50rpx auto 64rpx;
  256. .Scanning_top_icon {
  257. width: 128rpx;
  258. height: 128rpx;
  259. border-radius: 50%;
  260. .cubeic-ok {
  261. font-size: 128rpx;
  262. color: #35b34a;
  263. }
  264. }
  265. }
  266. .Scanning_cont {
  267. flex: 1;
  268. min-height: 0;
  269. display: flex;
  270. flex-direction: column;
  271. .scrollContent{
  272. flex: 1;
  273. min-height: 0;
  274. }
  275. .column{
  276. display: flex;
  277. justify-content: center;
  278. align-items: center;
  279. font-size: 30rpx;
  280. margin-bottom: 32rpx;
  281. .name{
  282. font-weight: bold;
  283. word-break: break-all;
  284. flex-shrink: 0;
  285. }
  286. .value{
  287. word-break: break-all;
  288. }
  289. }
  290. }
  291. .foot_btn_spe {
  292. margin: 24rpx 0;
  293. display: flex;
  294. flex-direction: column;
  295. align-items: center;
  296. gap: 24rpx;
  297. font-weight: bold;
  298. .column{
  299. width: 100%;
  300. height: 78rpx;
  301. display: flex;
  302. align-items: center;
  303. justify-content: space-between;
  304. gap: 24rpx;
  305. .btn {
  306. height: 100%;
  307. flex: 1;
  308. background: linear-gradient( 90deg, #6FC073 0%, #3DB197 100%);
  309. color: #fff;
  310. border-radius: 4rpx;
  311. font-size: 30rpx;
  312. display: flex;
  313. justify-content: center;
  314. align-items: center;
  315. }
  316. }
  317. }
  318. }
  319. </style>