소스 검색

修改会员中心以及错误提示

zhuliu 1 년 전
부모
커밋
be46781172
7개의 변경된 파일44개의 추가작업 그리고 16개의 파일을 삭제
  1. 5 1
      myComponents/navBar/navBar.js
  2. 2 1
      myComponents/pay/pay.js
  3. 18 2
      pages/memberCenter/menberCenter2.js
  4. 3 3
      pages/memberCenter/menberCenter2.wxml
  5. 2 2
      pages/voucher/voucher.js
  6. 7 3
      utils/request.js
  7. 7 4
      utils/upload.js

+ 5 - 1
myComponents/navBar/navBar.js

@@ -28,8 +28,12 @@ Component({
     menuWidth: app.globalData.menuWidth,
   },
   attached: function () {
- 
+    wx.setStorageSync('isComponent', true)
   },
+  detached: function () {  
+    // 清理工作  
+    wx.setStorageSync('isComponent', false)  
+  }, 
   methods: {
     //返回
     clickBack(){

+ 2 - 1
myComponents/pay/pay.js

@@ -139,13 +139,14 @@ Component({
     //支付
     payMoney(){
       var params = {
+        goodType:this.data.data.type,
         goods:this.data.data.goods,
         servicePrice:this.data.data.servicePrice,
         price:this.data.data.price,
         discount:this.data.data.discount,
         personVoucherIds:this.data.data.personVoucherIds,
         // usedVouchers:this.data.data.servicePrice,
-        finalPrice:this.data.data.discount
+        finalPrice:this.data.data.finalPrice
       }
       wx.showLoading({
         title: '加载中',

+ 18 - 2
pages/memberCenter/menberCenter2.js

@@ -55,6 +55,7 @@ Page({
    */
   onLoad(options) {
     this.getUserinfo()
+    this.queryAllVip()
     this.getVipRights()
   },
 
@@ -75,6 +76,19 @@ Page({
   /**
    * 页面功能
    */
+   //获取所有会员
+   queryAllVip(){
+    var that = this
+    api.queryAllVip().then(res=>{
+      if(res.code == 200){
+       this.setData(
+         {
+          vipType:res.data.data
+         }
+       )
+      }
+    })
+  },
    //获取会员权益
    getVipRights(){
     var that = this
@@ -156,12 +170,14 @@ Page({
       type:'-1',
       goods:[
         {
-          ...this.data.chooseVip,
+          id:this.data.chooseVip.vipUuid,
+          name:this.data.chooseVip.name,
+          price:this.data.chooseVip.finalPrice,
           num:1
         }
       ],
       servicePrice:0.00,
-      price:this.data.chooseVip.price,
+      price:this.data.chooseVip.finalPrice,
       discount:'',
     }
     pay.openPay(data)

+ 3 - 3
pages/memberCenter/menberCenter2.wxml

@@ -21,8 +21,8 @@
       <view class="vipType">
         <view  wx:for="{{vipType}}" class="vipType_item {{chooseVip.name == item.name?'checked':''}}" data-item="{{item}}" bind:tap="chooseVip">
           <view class="vipType_item_title">{{item.name}}</view>
-          <view class="vipType_item_price"><span wx:if="{{item.price || item.price == 0}}" style="font-size: 12px;">¥</span>{{item.price}}</view>
-          <view class="vipType_item_currentPrice"><span wx:if="{{item.currentPrice || item.currentPrice == 0}}">¥</span>{{item.currentPrice}}</view>
+          <view class="vipType_item_price"><span wx:if="{{item.finalPrice || item.finalPrice == 0}}" style="font-size: 12px;">¥</span>{{item.finalPrice}}</view>
+          <view class="vipType_item_currentPrice"><span wx:if="{{item.price || item.price == 0}}">¥</span>{{item.price}}</view>
         </view>
       </view>
     </scroll-view>
@@ -50,7 +50,7 @@
     </view>
     <!-- 开通会员按钮 -->
     <view class="payBtn {{!chooseVip?'noPay':''}}" bind:tap="openVip">
-      <view wx:if="{{chooseVip.price || chooseVip.price == 0}}" class="payBtn_price">¥{{chooseVip.price}}</view>
+      <view wx:if="{{chooseVip.finalPrice || chooseVip.finalPrice == 0}}" class="payBtn_price">¥{{chooseVip.finalPrice}}</view>
       <view>确认开通</view>
     </view>
     <!-- 会员权益 -->

+ 2 - 2
pages/voucher/voucher.js

@@ -82,10 +82,10 @@ Page({
       if(res.code == 200){
         var data = res.data.data
         var data2 = data.filter(item=>{
-          if(item.threshold < Number(this.data.totalPrice)){
+          if(item.threshold < Number(this.data.totalPrice) || this.data.all){
             item.useScopesText = this.getUseScopeText(item.useScopes)
+            return item
           }
-          return item
         })
         this.setData(
           {

+ 7 - 3
utils/request.js

@@ -25,9 +25,13 @@ function getPages(){
   var obj = {
     type: 'danger'
   }
-  var pages = getCurrentPages()
-  var route = pages[pages.length - 1]?.route
-  if(route && config.tabbar.indexOf(route)==-1){
+  // var pages = getCurrentPages()
+  // var route = pages[pages.length - 1]?.route
+  // console.log(wx.getStorageSync('isComponent'))
+  // if(route && config.tabbar.indexOf(route)==-1){
+  //   obj.top = wx.getStorageSync('height')
+  // }
+  if(wx.getStorageSync('isComponent')){
     obj.top = wx.getStorageSync('height')
   }
   return obj

+ 7 - 4
utils/upload.js

@@ -25,10 +25,13 @@ function getPages(){
   var obj = {
     type: 'danger'
   }
-  var pages = getCurrentPages()
-  var route = pages[pages.length - 1]?.route
-  console.log(config.tabbar,route)
-  if(route && config.tabbar.indexOf(route)==-1){
+  // var pages = getCurrentPages()
+  // var route = pages[pages.length - 1]?.route
+  // console.log(config.tabbar,route)
+  // if(route && config.tabbar.indexOf(route)==-1){
+  //   obj.top = wx.getStorageSync('height')
+  // }
+  if(wx.getStorageSync('isComponent')){
     obj.top = wx.getStorageSync('height')
   }
   return obj