Pārlūkot izejas kodu

Merge branch 'skk/feat/welfare-mall' into jeffrey/feat/coupon-center

xing.li 3 gadi atpakaļ
vecāks
revīzija
401b905ae4

+ 3 - 1
pages/luckDraw/profile.wxml

@@ -3,7 +3,9 @@
 <!-- 个人中心视图 -->
     <view class="head-bg" catchtap="turnPrize">
        <image class="image_bg" src="/images/luck-draw/per_head.png" />
-       <image class="image_portrait" src="/images/luck-draw/portrait.png" />
+       <!-- 获取用户头像 -->
+       <view wx:if="{{isLogin}}" class="image_portrait"><open-data type="userAvatarUrl"></open-data></view>
+       <image wx:if="{{!isLogin}}" class="image_portrait" src="/images/luck-draw/portrait.png" />
        <button class="luck-draw-isLogin" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber" >登录</button>
        <view class="luck-draw-pro-nickname" wx:if="{{isLogin}}">{{phone.toHide(mobileTop)}}</view>
     </view>

+ 2 - 0
pages/luckDraw/profile.wxss

@@ -25,6 +25,8 @@
   z-index: 2;
   left: 304rpx;
   top: 170rpx;
+  border-radius: 50%;
+  overflow :  hidden ;
 }
 
 .luck-draw-pro-nickname{

+ 2 - 0
pages/welfareMall/feedback/feedback.js

@@ -101,8 +101,10 @@ Page({
    /** 删除图片Banner */
   deleteImvBanner: function(e) {
     var avatarUrlShow = this.data.avatarUrlShow;
+    var avatarUrl = this.data.avatarUrl;
     var itemIndex = e.currentTarget.dataset.id;
     avatarUrlShow.splice(itemIndex, 1);
+    avatarUrl.splice(itemIndex, 1);
     this.setData({
       avatarUrlShow: avatarUrlShow
     })

+ 40 - 12
pages/welfareMall/order/orderCompletion.js

@@ -17,7 +17,7 @@ Page({
     orderSn: '',
     hidden: true,
     reason: '',
-    inputValue: null,
+    inputValue: '',
   },
 
   /**
@@ -93,7 +93,7 @@ Page({
                     icon: 'none',
                     duration: 1500
                   });
-                  this.onLoad(this.options);
+                  this.changeOrder(this.data.orderSn,4,'已取消');
                 }
                 this.data.lock = false
             }).catch(_ => {
@@ -113,9 +113,8 @@ Page({
    * 获取订单参数
    */
   async goPay() {
-    console.log(wx.getStorageSync('loginInfo').openId)
-      let result = await WelfareMall.getOrderParams(this.data.orderSn,wx.getStorageSync('loginInfo').openId);
-      console.log(res);
+      var that = this;
+      let result = await WelfareMall.getOrderParams(that.data.orderSn,wx.getStorageSync('loginInfo').openId);
       let res = result.data
       wx.requestPayment({
         timeStamp: res.wxPrePayVo.timeStamp,
@@ -126,7 +125,7 @@ Page({
         success: function (res) {
           //支付成功
           console.log(res);
-          this.onLoad(this.options);
+          that.changeOrder(that.data.orderSn,2,'已支付');
         },
         fail: function (res) {
           console.log(res);
@@ -142,6 +141,7 @@ Page({
     this.setData({
          hidden: false,
          inputValue: '',
+         reason: '',
     });
 },
 
@@ -150,7 +150,9 @@ Page({
    */
   cancel: function(){
         this.setData({
-             hidden: true,
+          hidden: true,
+          inputValue: '',
+          reason: '',
         });
     },
     /**
@@ -187,26 +189,52 @@ Page({
    * 申请退款
    */ 
   goRefund: function(reason) {
+    var that = this;
     WelfareMall.orderRefund({
       mobile: getMobileCache(),
-      orderSn: this.data.orderSn,
+      orderSn: that.data.orderSn,
       reason: reason,
     }).then(res => {
         if (res.code == 200) {
-          this.cancel();
-          this.onLoad(this.options);
-          const url = "../refund/refund?orderSn=" + this.data.orderSn
+          that.cancel();
+          that.onLoad(that.options);
+          that.changeOrder(that.data.orderSn,3,'已退款');
+          const url = "../refund/refund?orderSn=" + that.data.orderSn
           wx.navigateTo({
               url
           })
         }
     }).catch(_ => {
         console.log(_)
-        this.cancel();
+        that.cancel();
     })
     
   },
 
+  changeOrder: function(orderSn,status,showText){
+    var page = getCurrentPages();
+    //获取上一个页面的页面栈
+    var lastPage = page[page.length-2];
+    console.log(lastPage.data)
+    let oldOrderList = lastPage.data.orderList;
+    for(var i = 0;i<oldOrderList.length;i++){
+       if(orderSn == oldOrderList[i].orderSn){
+        oldOrderList[i].status.value = status
+        oldOrderList[i].status.showText = showText
+       }
+       
+    }
+    wx.navigateBack({
+      delta: 1,
+      success:function(){
+        lastPage.setData({
+          orderList:oldOrderList
+        })
+      }
+    })
+    return;
+  },
+
   /**
    * 生命周期函数--监听页面初次渲染完成
    */

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

@@ -6,7 +6,7 @@
       <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 失败  -->
+      <!-- 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>

+ 78 - 0
pages/welfareMall/personal/personal.js

@@ -70,6 +70,70 @@ Page({
     })
   },
 
+  // 授权手机号--历史订单
+  getPhoneNumberHis(e) {
+    getPhoneNumberSync(e, async () => {
+        let nums = await this.getCountNum();
+        this.setData({
+            isLogin: true,
+            mobileTop: getMobileCache(),
+            countNum: nums,
+        });
+        const url = "../historical/historical"
+        wx.navigateTo({
+            url
+        })      
+    })
+  },
+
+  // 授权手机号--意见反馈
+  getPhoneNumberFee(e) {
+    getPhoneNumberSync(e, async () => {
+        let nums = await this.getCountNum();
+        this.setData({
+            isLogin: true,
+            mobileTop: getMobileCache(),
+            countNum: nums,
+        });
+        const url = "../feedback/feedback"
+        wx.navigateTo({
+            url
+        })      
+    })
+  },
+
+  // 授权手机号--签到
+  getPhoneNumberSigin(e) {
+    getPhoneNumberSync(e, async () => {
+        let nums = await this.getCountNum();
+        this.setData({
+            isLogin: true,
+            mobileTop: getMobileCache(),
+            countNum: nums,
+        });
+        const url = "../../signIn/activity/activity"
+        wx.navigateTo({
+            url
+        })      
+    })
+  },
+
+  // 授权手机号--抽奖
+  getPhoneNumberLuck(e) {
+    getPhoneNumberSync(e, async () => {
+        let nums = await this.getCountNum();
+        this.setData({
+            isLogin: true,
+            mobileTop: getMobileCache(),
+            countNum: nums,
+        });
+        const url = "./../luckDraw/index"
+        wx.navigateTo({
+            url
+        })      
+    })
+  },
+
   toHistorical(e) {
       const url = "../historical/historical?id=" + e.currentTarget.dataset.id
       wx.navigateTo({
@@ -84,6 +148,20 @@ Page({
     })
   },
 
+  toSigIn(e) {
+    const url = "../../signIn/activity/activity?id=" + e.currentTarget.dataset.id
+    wx.navigateTo({
+        url
+    })
+  },
+
+  toLuck(e) {
+    const url = "../../luckDraw/index?id=" + e.currentTarget.dataset.id
+    wx.navigateTo({
+        url
+    })
+  },
+
   /**
    * 生命周期函数--监听页面初次渲染完成
    */

+ 8 - 8
pages/welfareMall/personal/personal.wxml

@@ -27,9 +27,9 @@
     <!-- 内容 -->
     <view class="content flex-column">
       <!-- 签到领券 -->
-      <view class="sign-in content-style flex-row">
+      <!-- <view class="sign-in content-style flex-row">
         <button class="wx-isLogin" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber"></button>
-        <view class="grant flex-row">
+        <view class="grant flex-row" catchtap="toSigIn">
           <view class="content-img-text flex-row">
             <image class="content-img" src="/images/welfareMall/sign-in.png" />
             <view class="content-text">签到领券</view>
@@ -37,11 +37,11 @@
           <image class="content-jump" src="/images/welfareMall/jump.png" />
         </view>
       </view>
-      <view class="content-lower"></view>
+      <view class="content-lower"></view> -->
       <!-- 抽奖领券 -->
-      <view class="luck-draw content-style flex-row">
+      <!-- <view class="luck-draw content-style flex-row">
         <button class="wx-isLogin" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber"></button>
-        <view class="grant flex-row">
+        <view class="grant flex-row" catchtap="toLuck">
           <view class="content-img-text flex-row">
             <image class="content-img" src="/images/welfareMall/luck-draw.png" />
             <view class="content-text">抽奖领券</view>
@@ -49,7 +49,7 @@
           <image class="content-jump" src="/images/welfareMall/jump.png" />
         </view>
       </view>
-      <view class="content-lower"></view>
+      <view class="content-lower"></view> -->
       <!-- 我的券包 -->
       <view class="coupon-bag content-style flex-row">
         <view class="grant flex-row">
@@ -73,7 +73,7 @@
       <view class="content-lower"></view>
       <!-- 历史订单 -->
       <view class="historical-order content-style flex-row">
-        <button class="wx-isLogin" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber"></button>
+        <button class="wx-isLogin" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumberHis"></button>
         <view class="grant flex-row" catchtap="toHistorical">
           <view class="content-img-text flex-row">
             <image class="content-img" src="/images/welfareMall/historical-order.png" />
@@ -85,7 +85,7 @@
       <view class="content-lower"></view>
       <!-- 意见反馈 -->
       <view class="feedback content-style flex-row">
-        <button class="wx-isLogin" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber"></button>
+        <button class="wx-isLogin" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumberFee"></button>
         <view class="grant flex-row" catchtap="toFeedback">
           <view class="content-img-text flex-row">
             <image class="content-img" src="/images/welfareMall/feedback.png" />