瀏覽代碼

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

xing.li 3 年之前
父節點
當前提交
26c4ba48ca

+ 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
+  }
+
    /**
    * 获取首页信息
    */

+ 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;
-  }
   },
 
   

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

@@ -1,5 +1,6 @@
 // pages/welfareMall/personal/personal.js
 import WelfareMall from '../../../api/welfareMall'
+import activity from '../../../api/activity'
 import {getMobileCache, getPhoneNumber as getPhoneNumberSync} from '../../../utils/user'
 Page({
 
@@ -16,6 +17,7 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: async function (options) {
+    await this.getUserPhone();
     this.setData({
       isLogin: getMobileCache() != '',
       mobileTop: getMobileCache(),
@@ -30,6 +32,17 @@ Page({
 
   },
 
+  /**
+   * 获取用户信息
+   */
+  getUserPhone: async function(){
+    await WelfareMall.getUser({
+      openid: activity.getOpenId(),
+      source:'FREE_MINI_APP',
+    });
+
+  },
+
   getCountNum: async function(){
   /**
    * 福利社

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

@@ -3,8 +3,14 @@
   <!-- 首部个人信息 -->
   <view class="head flex-column">
     <view class="head-personal flex-row">
-      <image class="head-personal-logo" src="/images/welfareMall/head-portrait.png" />
-      <view class="head-personal-login" wx:if="{{isLogin}}">{{phone.toHide(mobileTop)}}</view>
+      <image wx:if="{{!isLogin}}" class="head-personal-logo" src="/images/welfareMall/head-portrait.png" />
+      <!-- 获取用户头像 -->
+      <open-data wx:if="{{isLogin}}" class="head-personal-logo" type="userAvatarUrl"></open-data>
+      <view class="head-personal-nl flex-column" wx:if="{{isLogin}}">
+        <!-- 获取用户微信昵称 -->
+        <open-data class="head-personal-name" type="userNickName" lang="zh_CN"></open-data>
+        <view class="head-personal-login">{{phone.toHide(mobileTop)}}</view>
+      </view>
       <button class="personal-isLogin" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">登录/注册</button>
     </view>
     <view class="head-card flex-row">

+ 15 - 2
pages/welfareMall/personal/personal.wxss

@@ -39,6 +39,8 @@
 .head-personal-logo{
   width: 136rpx;
   height: 136rpx;
+  border-radius: 50%;
+  overflow :  hidden ;
 }
 
 .personal-isLogin {
@@ -52,13 +54,24 @@
   margin-right: 0rpx !important;
 }
 
-.head-personal-login{
+.head-personal-nl{
   margin-left: 33rpx;
-  font-size: 38rpx;
+  align-items: flex-start;
+}
+
+.head-personal-name{
+  font-size: 30rpx;
   font-weight: 500;
   color: #303030;
 }
 
+.head-personal-login{
+  margin-top: 18rpx;
+  font-size: 24rpx;
+  font-weight: 400;
+  color: #303030;
+}
+
 .head-card{
   width: 666rpx;
   height: 286rpx;

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

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

@@ -3,14 +3,17 @@
   <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}}" 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" />
+        <image class="refund-log-adopt" wx:if="{{orderStatus.status != 0 && orderStatus.status != 1}}" src="/images/welfareMall/submit.png" />
         <view class="refund-text">审核通过</view>
       </view>
     </view>
@@ -22,19 +25,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>