Explorar o código

【功能优化】支付:查询支付订单时,增加 sync 主动轮询,解决支付宝、微信存在延迟的问题

YunaiV hai 10 meses
pai
achega
ca1926a732

+ 1 - 1
pages/goods/comment/add.vue

@@ -121,7 +121,7 @@
     }
     state.id = options.id;
 
-    const { code, data } = await OrderApi.getOrder(state.id);
+    const { code, data } = await OrderApi.getOrderDetail(state.id);
     if (code !== 0) {
       sheep.$helper.toast('无待评价订单');
       return;

+ 1 - 1
pages/order/aftersale/apply.vue

@@ -208,7 +208,7 @@
     state.itemId = parseInt(options.itemId);
 
     // 读取订单信息
-    const { code, data } = await OrderApi.getOrder(state.orderId);
+    const { code, data } = await OrderApi.getOrderDetail(state.orderId);
     if (code !== 0) {
       return;
     }

+ 9 - 5
pages/order/detail.vue

@@ -127,7 +127,11 @@
     </view>
 
     <!--  自提核销  -->
-    <PickUpVerify :order-info="state.orderInfo" :systemStore="systemStore" ref="pickUpVerifyRef"></PickUpVerify>
+    <PickUpVerify
+      :order-info="state.orderInfo"
+      :systemStore="systemStore"
+      ref="pickUpVerifyRef"
+    ></PickUpVerify>
 
     <!-- 订单信息 -->
     <view class="notice-box">
@@ -305,7 +309,7 @@
     uni.showModal({
       title: '提示',
       content: '确定要取消订单吗?',
-      success: async function(res) {
+      success: async function (res) {
         if (!res.confirm) {
           return;
         }
@@ -394,11 +398,11 @@
     let res;
     if (state.comeinType === 'wechat') {
       // TODO 芋艿:微信场景下
-      res = await OrderApi.getOrder(id, {
+      res = await OrderApi.getOrderDetail(id, {
         merchant_trade_no: state.merchantTradeNo,
       });
     } else {
-      res = await OrderApi.getOrder(id);
+      res = await OrderApi.getOrderDetail(id);
     }
     if (res.code === 0) {
       state.orderInfo = res.data;
@@ -451,7 +455,7 @@
     color: rgba(#fff, 0.9);
     width: 100%;
     background: v-bind(headerBg) no-repeat,
-    linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
+      linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
     background-size: 750rpx 100%;
     box-sizing: border-box;
 

+ 8 - 8
pages/order/express/log.vue

@@ -13,10 +13,10 @@
         </uni-swiper-dot>
         <view class="log-card-msg">
           <!-- TODO 芋艿:【物流】优化点:展示状态 -->
-<!--          <view class="ss-flex ss-m-b-8">-->
-<!--            <view>物流状态:</view>-->
-<!--            <view class="warning-color">{{ state.info.status_text }}</view>-->
-<!--          </view>-->
+          <!--          <view class="ss-flex ss-m-b-8">-->
+          <!--            <view>物流状态:</view>-->
+          <!--            <view class="warning-color">{{ state.info.status_text }}</view>-->
+          <!--          </view>-->
           <view class="ss-m-b-8">快递单号:{{ state.info.logisticsNo }}</view>
           <view>快递公司:{{ state.info.logisticsName }}</view>
         </view>
@@ -35,9 +35,9 @@
           </view>
           <view class="log-content-msg">
             <!-- TODO 芋艿:【物流】优化点:展示状态 -->
-<!--            <view class="log-msg-title ss-m-b-20">-->
-<!--              {{ item.status_text }}-->
-<!--            </view>-->
+            <!--            <view class="log-msg-title ss-m-b-20">-->
+            <!--              {{ item.status_text }}-->
+            <!--            </view>-->
             <view class="log-msg-desc ss-m-b-16">{{ item.content }}</view>
             <view class="log-msg-date ss-m-b-40">
               {{ sheep.$helper.timeFormat(item.time, 'yyyy-mm-dd hh:MM:ss') }}
@@ -78,7 +78,7 @@
   }
 
   async function getOrderDetail(id) {
-    const { data } = await OrderApi.getOrder(id)
+    const { data } = await OrderApi.getOrderDetail(id);
     state.info = data;
   }
 

+ 4 - 1
pages/pay/result.vue

@@ -126,7 +126,10 @@
         // #endif
         // 特殊:获得商品订单信息
         if (state.orderType === 'goods') {
-          const { data, code } = await OrderApi.getOrder(state.orderInfo.merchantOrderId);
+          const { data, code } = await OrderApi.getOrderDetail(
+            state.orderInfo.merchantOrderId,
+            true,
+          );
           if (code === 0) {
             state.tradeOrder = data;
           }

+ 3 - 2
sheep/api/trade/order.js

@@ -73,13 +73,14 @@ const OrderApi = {
       data,
     });
   },
-  // 获得订单
-  getOrder: (id) => {
+  // 获得订单详细:sync 是可选参数
+  getOrderDetail: (id, sync) => {
     return request({
       url: `/trade/order/get-detail`,
       method: 'GET',
       params: {
         id,
+        sync,
       },
       custom: {
         showLoading: false,