Procházet zdrojové kódy

退款状态修改

kk.shi před 3 roky
rodič
revize
8fc089fbe6

+ 0 - 10
api/activity.js

@@ -170,16 +170,6 @@ class activity extends request {
   }
 
   /**
-   * 获取用户信息
-   * @param {*} openId  
-   */
-  static async getUser(params) {
-    const res = await this.postRequest(`${this.BASE_URL}open/activity/get-user`, params)
-    return res.data
-   
-  }
-
-  /**
    * 设置手机缓存
    * @param {*} mobile 
    */

+ 11 - 2
api/welfareMall.js

@@ -13,7 +13,7 @@ class WelfareMall extends request {
    * 取消订单
    */
   static cancelOrder(params) {
-    return this.postRequest(`${this.BASE_URL}open/welfare-mall/order/cancel`, params);
+    return this.postRequest(`${this.BASE_URL}open/activity/order-cancel`, params);
   }
 
   /**
@@ -27,7 +27,7 @@ class WelfareMall extends request {
    * 订单退款
    */
   static orderRefund(params) {
-    return this.postRequest(`${this.BASE_URL}open/welfare-mall/order/refund`, params);
+    return this.postRequest(`${this.BASE_URL}open/activity/order-refund`, params);
   }
 
    /**
@@ -82,6 +82,15 @@ class WelfareMall extends request {
     return this.postRequest(`${this.BASE_URL}open/luck-draw/user-draw-coupon-num`, params);
   }
 
+  /**
+   * 获取用户信息
+   * @param {*} openId  
+   */
+  static async getUser(params) {
+    const res = await this.postRequest(`${this.BASE_URL}open/activity/get-user`, params)
+    return res.data
+  }
+
 }
 
 export default WelfareMall

+ 1 - 5
pages/welfareMall/order/orderCompletion.js

@@ -13,7 +13,6 @@ Page({
     lock: false,
     noResult: false,
     noMore: false,
-    isLogin: false,
     orderDetail: null,
     orderSn: '',
     hidden: true,
@@ -28,13 +27,10 @@ Page({
     var that = this;
     that.orderSn = options.ordersn
     this.setData({
-      isLogin: getMobileCache() != '',
       orderSn: options.ordersn,
-  })
-  if(this.data.isLogin){
+    })
       this.getOrder(that.orderSn);
       this.data.orderSn = options.ordersn;
-  }
   },
 
   

+ 3 - 3
pages/welfareMall/personal/personal.js

@@ -17,7 +17,7 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: async function (options) {
-    // await this.getUserPhone();
+    await this.getUserPhone();
     this.setData({
       isLogin: getMobileCache() != '',
       mobileTop: getMobileCache(),
@@ -36,8 +36,8 @@ Page({
    * 获取用户信息
    */
   getUserPhone: async function(){
-    await activity.getUser({
-      openId: activity.getOpenId(),
+    await WelfareMall.getUser({
+      openid: activity.getOpenId(),
       source:'FREE_MINI_APP',
     });
 

+ 73 - 1
pages/welfareMall/refund/refund.js

@@ -1,11 +1,15 @@
 // pages/welfareMall/refund/refund.js
+import WelfareMall from '../../../api/welfareMall'
+import {getMobileCache, getPhoneNumber as getPhoneNumberSync} from '../../../utils/user'
 Page({
 
   /**
    * 页面的初始数据
    */
   data: {
-
+    orderSn: '',
+    orderStatus: null,
+    orderDetail: null,
   },
 
   getModal() {
@@ -31,10 +35,78 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
+    var that = this;
+    that.orderSn = options.ordersn;
+    this.setData({
+      orderSn: options.ordersn,
+    })
+      this.getRefundOrderStatus(that.orderSn);
+      this.getOrder(that.orderSn);
+      this.data.orderSn = options.ordersn;
+  },
+
+  /**
+   * 获取订单的退款单状态
+   */
+  getRefundOrderStatus: function(data) {
+    WelfareMall.getRefundOrderStatus({
+      mobile: getMobileCache(),
+      orderSn: data,
+    }).then(res => {
+        if (res.code == 200) {
+            this.userOrderStatusView(res.data)
+        }
+    }).catch(err => {
+        console.log(err)
+    })
+  },
 
+  userOrderStatusView: function(data) {
+    if (!data) {
+        console.log("订单状态详情数据为空");
+        return
+    }
+    //对象转换
+    this.data.orderStatus = data
+    this.setData({
+        mobileTop:getMobileCache(),
+        orderStatus: this.data.orderStatus
+    })
   },
 
   /**
+   * 
+   * 订单数据
+   */
+  getOrder: function(data) {
+    WelfareMall.getOrder({
+      mobile: getMobileCache(),
+      orderSn: data,
+    }).then(res => {
+        if (res.code == 200) {
+            this.userOrderistView(res.data)
+        }
+        this.data.lock = false
+    }).catch(_ => {
+        console.log(_)
+        this.data.lock = false
+    })
+  },
+
+  userOrderistView: function(data) {
+    if (!data) {
+        console.log("订单详情数据为空");
+        return
+    }
+    //对象转换
+    this.data.orderDetail = data
+    this.setData({
+        mobileTop:getMobileCache(),
+        orderDetail: this.data.orderDetail
+    })
+  }, 
+
+  /**
    * 生命周期函数--监听页面初次渲染完成
    */
   onReady: function () {

+ 12 - 6
pages/welfareMall/refund/refund.wxml

@@ -3,14 +3,16 @@
   <view class="refund-style flex-column">
     <view class="refund-speed flex-row">
       <view class="refund-speed-submit flex-column">
-        <image class="refund-log-submit" src="/images/welfareMall/submit.png" />
+        <image class="refund-log-submit" wx:if="{{orderStatus.status == 0 || orderStatus.status == 1}}" src="/images/welfareMall/adopt.png" />
+        <image class="refund-log-submit" wx:if="{{orderStatus.status != 0 && orderStatus.status != 1 && orderStatus.status != 2}}" src="/images/welfareMall/submit.png" />
         <view class="refund-text">提交申请</view>
       </view>
       <view class="refund-line">
         <view class="refund-log-line"></view>
       </view>
       <view class="refund-speed-adopt flex-column">
-        <image class="refund-log-adopt" src="/images/welfareMall/submit.png" />
+        <image class="refund-log-adopt" wx:if="{{orderStatus.status == 1}}" src="/images/welfareMall/adopt.png" />
+        <image class="refund-log-adopt" wx:if="{{orderStatus.status == 0}}" src="/images/welfareMall/submit.png" />
         <view class="refund-text">审核通过</view>
       </view>
     </view>
@@ -22,19 +24,23 @@
         </view>
         <view class="content-middle flex-row">
           <view class="middle-it flex-row">
-            <image class="middle-img" src="/images/welfareMall/middle_img.png" />
+            <image class="middle-img" src="{{orderDetail.goodsList[0].fullCoverImg}}" />
             <view class="middle-nt">
-              <view class="middle-num">退款金额 ¥9.9</view>
-              <view class="middle-text">圣诞优惠券包</view>
+              <view class="middle-num">退款金额 ¥{{orderDetail.payPriceFormatter}}</view>
+              <view class="middle-text">{{orderDetail.goodsList[0].activityName}}</view>
             </view>
           </view>
         </view>
       </view>
       <view class="content-line"></view>
-      <view class="content-lower flex-column">
+      <view class="content-lower flex-column" wx:if="{{orderStatus.status == 0}}">
         <view class="lower-total-state">退款申请审核中</view>
         <view class="lower-total-text">系统正在审核您是否符合退款条件,请耐心等待</view>
       </view>
+      <view class="content-lower flex-column" wx:if="{{orderStatus.status == 1}}">
+        <view class="lower-total-state">退款申请已通过</view>
+        <view class="lower-total-text">退款金额将在五个工作日内退至您的支付账号</view>
+      </view>
     </view>
     <view class="refund-ex flex-row" catchtap="getModal">
       <view class="refund-explain">查看退款说明</view>