瀏覽代碼

抽奖头像调整

kk.shi 3 年之前
父節點
當前提交
b9cfa5ed04
共有 3 個文件被更改,包括 34 次插入12 次删除
  1. 3 1
      pages/luckDraw/profile.wxml
  2. 2 0
      pages/luckDraw/profile.wxss
  3. 29 11
      pages/welfareMall/order/orderCompletion.js

+ 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{

+ 29 - 11
pages/welfareMall/order/orderCompletion.js

@@ -94,6 +94,12 @@ Page({
                     duration: 1500
                   });
                   this.onLoad(this.options);
+                  //获取当前页面的页面栈
+                  var page = getCurrentPages();
+                  //获取上一个页面的页面栈
+                  var lastPage = page[page.length-2];
+                  lastPage.onLoad(this.options);
+                  console.log(this.options);
                 }
                 this.data.lock = false
             }).catch(_ => {
@@ -113,9 +119,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 +131,13 @@ Page({
         success: function (res) {
           //支付成功
           console.log(res);
-          this.onLoad(this.options);
+          //刷新当前页面
+          that.onLoad(that.options);
+          //获取当前页面的页面栈
+          var page = getCurrentPages();
+          //获取上一个页面的页面栈
+          var lastPage = page[page.length-2];
+          lastPage.onLoad(that.options);
         },
         fail: function (res) {
           console.log(res);
@@ -141,7 +152,7 @@ Page({
   getMode: function(){
     this.setData({
          hidden: false,
-         inputValue: '',
+         inputValue: null,
     });
 },
 
@@ -150,7 +161,8 @@ Page({
    */
   cancel: function(){
         this.setData({
-             hidden: true,
+          hidden: true,
+          inputValue: null,
         });
     },
     /**
@@ -187,22 +199,28 @@ 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);
+          //获取当前页面的页面栈
+          var page = getCurrentPages();
+          //获取上一个页面的页面栈
+          var lastPage = page[page.length-2];
+          lastPage.onLoad(that.options);
+          const url = "../refund/refund?orderSn=" + that.data.orderSn
           wx.navigateTo({
               url
           })
         }
     }).catch(_ => {
         console.log(_)
-        this.cancel();
+        that.cancel();
     })
     
   },