shish 2 miesięcy temu
rodzic
commit
9d492e7274
2 zmienionych plików z 20 dodań i 13 usunięć
  1. 15 8
      ghsApp/src/admin/billing/affirm.vue
  2. 5 5
      ghsApp/src/api/order/index.js

+ 15 - 8
ghsApp/src/admin/billing/affirm.vue

@@ -1116,10 +1116,14 @@ export default {
         }
         params = { ...params, treeData: JSON.stringify(treeData) };
 
+        let pendingMsg = '';
         uni.showLoading({ mask: true });
         try {
-          const res = await Fn(params);
-          if (res.code == 1) {
+          // hideError:避免 luch-request 在 showLoading 期间 showToast 被挡住;错误在 finally hideLoading 后统一提示
+          const res = await Fn(params, { hideError: true });
+          if (!res || typeof res !== 'object') {
+            pendingMsg = '提交失败,请重试';
+          } else if (res.code == 1) {
             if (res.data.respondType && res.data.respondType == 'priceError') {
               that.diffPriceList = res.data.diff;
               that.$refs.diffPriceRef.open('bottom');
@@ -1138,17 +1142,20 @@ export default {
                 this.$util.pageTo({ url: '/admin/billing/result', type: 2, query: { orderId: id, orderSn: orderSn, title: '开单成功' } });
               }
             } else {
-              this.$msg('提交失败');
+              pendingMsg = '提交失败';
             }
+          } else if (res.msg) {
+            pendingMsg = res.msg;
+          } else {
+            pendingMsg = '提交失败';
           }
         } catch (err) {
-          // luch-request:code==0 等已在封装里 showToast,并 reject(response.data),此处不再重复提示
-          if (err != null && Object.prototype.hasOwnProperty.call(err, 'code')) {
-            return;
-          }
-          this.$msg('提交失败,请重试');
+          pendingMsg = '提交失败,请重试';
         } finally {
           uni.hideLoading();
+          if (pendingMsg) {
+            this.$msg(pendingMsg);
+          }
         }
       } finally {
         this.formSubmitting = false;

+ 5 - 5
ghsApp/src/api/order/index.js

@@ -105,14 +105,14 @@ export const comment = data => {
 	return https.post("/order/comment", data);
 };
 
-//添加订单
-export const createOrder = data => {
-	return https.post("/order/create-order", data);
+//添加订单(config 可选,如 hideError: true 由页面自行在关 loading 后提示)
+export const createOrder = (data, config = {}) => {
+	return https.post("/order/create-order", data, {}, config);
 };
 
 //修改订单
-export const updateOrder = data => {
-	return https.post("/order/update-order", data);
+export const updateOrder = (data, config = {}) => {
+	return https.post("/order/update-order", data, {}, config);
 };
 
 //取消订单