createOrder.vue 10 KB

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