Quellcode durchsuchen

添加重复点击

lex-xin vor 4 Monaten
Ursprung
Commit
2f6b5b249a

+ 5 - 0
miniprogram/pages/orders/order-result.less

@@ -353,6 +353,11 @@ page {
     font-size: 32rpx;
     color: #FBEAC9;
     line-height: 44rpx;
+    &[disabled][type=primary] {
+      color: #fff;
+      background: linear-gradient( 90deg, #544F4A 0%, #302F2B 100%);
+      opacity: 0.7;
+    }
   }
 }
 

+ 20 - 15
miniprogram/pages/orders/order-result.ts

@@ -50,6 +50,7 @@ Page({
     showCanvas: false, // 是否显示二维码
     canvasImg: "" as string,
     refoundStatus: false,
+    cancelRefoundStatus: false,
   },
 
   /**
@@ -220,21 +221,25 @@ Page({
   },
   /** 申请退款 */
   async cancelRefound() {
-    try {
-      const {data} = await api_userPaymentCancelRefund(this.data.goodsInfo.refundOrderId)
-      // console.log(data, 'data')
-      if(data.code == 200) {
-        wx.showToast({ title: '取消退款成功', icon: 'none' })
-        // setTimeout(() => {
-        //   wx.navigateBack({
-        //     delta: 1
-        //   })
-        // }, 1000);
-        this.getDetail()
-      } else {
-        wx.showToast({ title: data.message, icon: 'none' })
-      }
-    } catch {}
+    this.setData({
+      cancelRefoundStatus: true
+    }, async () => {
+      try {
+        const {data} = await api_userPaymentCancelRefund(this.data.goodsInfo.refundOrderId)
+        // console.log(data, 'data')
+        if(data.code == 200) {
+          wx.showToast({ title: '取消退款成功', icon: 'none' })
+          this.getDetail()
+        } else {
+          wx.showToast({ title: data.message, icon: 'none' })
+        }
+        setTimeout(() => {
+          this.setData({
+            cancelRefoundStatus: false
+          })
+        }, 500);
+      } catch {}
+    })
   },
   /** 申请退款 */
   useRefound() {

+ 1 - 1
miniprogram/pages/orders/order-result.wxml

@@ -77,7 +77,7 @@
   <view class="order-btn" wx:if="{{ goodsInfo.wechatStatus != 'WAIT_PAY' }}">
     <button type="primary" bind:tap="useRefound" wx:if="{{ goodsInfo.wechatStatus == 'WAIT_USE' && tabIdx == 5 }}">申请退款</button>
     <block wx:else>
-      <button type="primary" bind:tap="cancelRefound" wx:if="{{ goodsInfo.wechatStatus == 'REFUNDING' }}">取消退款</button>
+      <button type="primary" bind:tap="cancelRefound" wx:if="{{ goodsInfo.wechatStatus == 'REFUNDING' }}" disabled="{{cancelRefoundStatus}}">取消退款</button>
       <button type="primary" wx:else bind:tap="onSubmit">再次购买</button>
     </block>
   </view>