createOrder.vue 11 KB

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