kk.shi 3 rokov pred
rodič
commit
09e6e19995

+ 42 - 0
pages/welfareMall/order/orderCompletion.js

@@ -15,6 +15,7 @@ Page({
     noMore: false,
     isLogin: false,
     orderDetail: null,
+    orderSn: '',
   },
 
   /**
@@ -25,9 +26,11 @@ Page({
     that.orderSn = options.ordersn
     this.setData({
       isLogin: getMobileCache() != '',
+      orderSn: options.ordersn,
   })
   if(this.data.isLogin){
       this.getOrder(that.orderSn);
+      this.data.orderSn = options.ordersn;
   }
   },
 
@@ -60,6 +63,45 @@ Page({
     })
   }, 
 
+  // 取消订单
+  toCancelOrder(e) {
+    wx.showModal({
+      title: '取消订单',
+      content: '',
+      showCancel: true,//是否显示取消按钮
+      cancelText:"取消",//默认是“取消”
+      cancelColor:'black',//取消文字的颜色
+      confirmText:"确定",//默认是“确定”
+      confirmColor: 'black',//确定文字的颜色
+      success: res => {if (res.cancel) {
+            //点击取消,默认隐藏弹框
+        } else {
+            //点击确定 
+            WelfareMall.cancelOrder({
+              mobile: getMobileCache(),
+              orderSn: this.data.orderSn,
+            }).then(res => {
+                if (res.code == 200) {
+                  wx.showToast({
+                    title: '取消订单成功',
+                    icon: 'none',
+                    duration: 1500
+                  })
+                }
+                this.data.lock = false
+            }).catch(_ => {
+                console.log(_)
+                this.data.lock = false
+            })
+        }
+      },
+      fail: function (res) {
+        console.log(res)
+       },//接口调用失败的回调函数 
+    })
+    
+},
+
   /**
    * 生命周期函数--监听页面初次渲染完成
    */

+ 12 - 1
pages/welfareMall/order/orderCompletion.wxml

@@ -2,10 +2,15 @@
 <view class="order flex-column">
   <view class="order-style flex-column">
     <view class="order-state flex-column">
+      <!-- 1 待支付  -->
       <view class="order-state-title" wx:if="{{orderDetail.status.value == 1}}">订单{{orderDetail.status.showText}}</view>
+      <!-- 2 已支付  -->
       <view class="order-state-title" wx:if="{{orderDetail.status.value == 2}}">订单{{orderDetail.status.showText}}</view>
+      <!-- 3 失败  -->
       <view class="order-state-title" wx:if="{{orderDetail.status.value == 3}}">订单{{orderDetail.status.showText}}</view>
+      <!-- 4 已取消  -->
       <view class="order-state-title" wx:if="{{orderDetail.status.value == 4}}">订单{{orderDetail.status.showText}}</view>
+      <!-- 5 已完成  -->
       <view class="order-state-title" wx:if="{{orderDetail.status.value == 5}}">订单{{orderDetail.status.showText}}</view>
       <view class="order-state-text">感谢您对沪上阿姨的喜爱与支持,欢迎再度光临</view>
     </view>
@@ -45,7 +50,13 @@
       </view>
     </view>
     <view class="order-rt flex-row">
-      <view class="order-refund flex-row">
+      <view class="order-refund flex-row" wx:if="{{orderDetail.status.value == 1}}" catchtap="toCancelOrder">
+        <view class="lower-order-text">取消订单</view>
+      </view>
+      <view class="order-refund flex-row" wx:if="{{orderDetail.status.value == 1}}">
+        <view class="lower-order-text">去支付</view>
+      </view>
+      <view class="order-refund flex-row" wx:if="{{orderDetail.status.value == 2 || orderDetail.status.value == 5}}">
         <view class="lower-order-text">申请退款</view>
       </view>
     </view>

+ 1 - 0
pages/welfareMall/order/orderCompletion.wxss

@@ -183,6 +183,7 @@
   background: #FFFFFF;
   border: 1rpx solid #B01717;
   border-radius: 10rpx;
+  margin-left: 10rpx;
 }
 
 .lower-order-text{

+ 0 - 6
project.private.config.json

@@ -71,12 +71,6 @@
           "pathName": "pages/welfareMall/activityInfo/activityInfo",
           "query": "",
           "scene": null
-        },
-        {
-          "name": "pages/welfareMall/order/orderCompletion",
-          "pathName": "pages/welfareMall/order/orderCompletion",
-          "query": "ordersn=162787680070366",
-          "scene": null
         }
       ]
     }