Commit 2a2387bb0db4237a6d92d499f47e1e492a2b50c5

Authored by pengye
1 parent 6da27e09

我的页面新增余额

@@ -22,7 +22,6 @@ Page({ @@ -22,7 +22,6 @@ Page({
22 type 22 type
23 }) 23 })
24 } 24 }
25 - if(type == 1) this.getInfo()  
26 }, 25 },
27 // 获取用户消费金商家余额列表 26 // 获取用户消费金商家余额列表
28 getInfo() { 27 getInfo() {
@@ -38,6 +37,20 @@ Page({ @@ -38,6 +37,20 @@ Page({
38 }) 37 })
39 }) 38 })
40 }, 39 },
  40 + // 获取用户在商家的账户余额
  41 + getConsumeSellerList() {
  42 + App.Activity.GetRechargeBalanceByOpenid({
  43 + openid: getApp().openid,
  44 + }).then(res => {
  45 + let sellerList = res.data;
  46 + sellerList.forEach(i => {
  47 + i.balance = (i.recharge_balance * 1).toFixed(2)
  48 + })
  49 + this.setData({
  50 + sellerList
  51 + })
  52 + })
  53 + },
41 // 跳转用户商家消费金消费记录 54 // 跳转用户商家消费金消费记录
42 getSeller(event) { 55 getSeller(event) {
43 if (this.data.type == '1') { 56 if (this.data.type == '1') {
@@ -74,7 +87,9 @@ Page({ @@ -74,7 +87,9 @@ Page({
74 * 生命周期函数--监听页面显示 87 * 生命周期函数--监听页面显示
75 */ 88 */
76 onShow() { 89 onShow() {
77 - 90 + let type = this.data.type;
  91 + if (type == 1) this.getInfo()
  92 + if (type == 2) this.getConsumeSellerList()
78 }, 93 },
79 94
80 /** 95 /**
@@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
17 </block> 17 </block>
18 <block wx:else> 18 <block wx:else>
19 <image class="noDataImg" src="https://qn.colorcun.com/noConsumeData.png" mode="aspectFit" /> 19 <image class="noDataImg" src="https://qn.colorcun.com/noConsumeData.png" mode="aspectFit" />
20 - <view class="font28r noDataText">暂无消费金</view> 20 + <view class="font28r noDataText">暂无{{type == '1' ? '消费金' : '余额'}}</view>
21 <view class="btn font28r" bind:tap="switchAccount">换号查看</view> 21 <view class="btn font28r" bind:tap="switchAccount">换号查看</view>
22 </block> 22 </block>
23 </view> 23 </view>
@@ -24,7 +24,6 @@ Page({ @@ -24,7 +24,6 @@ Page({
24 sellerid: options.sellerid 24 sellerid: options.sellerid
25 }) 25 })
26 } 26 }
27 - if (type == 1) this.getInfo(options.sellerid)  
28 }, 27 },
29 getSeller() { 28 getSeller() {
30 let type = this.data.type; 29 let type = this.data.type;
@@ -36,6 +35,7 @@ Page({ @@ -36,6 +35,7 @@ Page({
36 }, '/pages/me/myBalance') 35 }, '/pages/me/myBalance')
37 }) 36 })
38 }, 37 },
  38 + // 获取消费金明细
39 getInfo(sellerid) { 39 getInfo(sellerid) {
40 App.Activity.GetConsumeListByOpenid({ 40 App.Activity.GetConsumeListByOpenid({
41 openid: getApp().openid, 41 openid: getApp().openid,
@@ -47,6 +47,25 @@ Page({ @@ -47,6 +47,25 @@ Page({
47 i.balance = (i.balance * 1).toFixed(2) 47 i.balance = (i.balance * 1).toFixed(2)
48 i.cdateInfo = i.cdate ? util.unixtoTime(i.cdate, 'YYYY-MM-DD HH:II') : ''; 48 i.cdateInfo = i.cdate ? util.unixtoTime(i.cdate, 'YYYY-MM-DD HH:II') : '';
49 }) 49 })
  50 + consumeList.sort((a, b) => (b.cdate * 1) - (a.cdate * 1));
  51 + this.setData({
  52 + consumeList
  53 + })
  54 + })
  55 + },
  56 + // 获取余额明细
  57 + getBalanceList(sellerid) {
  58 + App.Activity.GetBalanceListByOpenid({
  59 + openid: getApp().openid,
  60 + sellerid
  61 + }).then(res => {
  62 + let consumeList = res.data;
  63 + consumeList.forEach(i => {
  64 + i.price = (i.price * 1).toFixed(2)
  65 + i.balance = (i.balance * 1).toFixed(2)
  66 + i.cdateInfo = i.cdate ? util.unixtoTime(i.cdate, 'YYYY-MM-DD HH:II') : '';
  67 + })
  68 + consumeList.sort((a, b) => (b.cdate * 1) - (a.cdate * 1));
50 this.setData({ 69 this.setData({
51 consumeList 70 consumeList
52 }) 71 })
@@ -63,7 +82,8 @@ Page({ @@ -63,7 +82,8 @@ Page({
63 * 生命周期函数--监听页面显示 82 * 生命周期函数--监听页面显示
64 */ 83 */
65 onShow() { 84 onShow() {
66 - 85 + if (this.data.type == 1) this.getInfo(this.data.sellerid)
  86 + if (this.data.type == 2) this.getBalanceList(this.data.sellerid)
67 }, 87 },
68 88
69 /** 89 /**
@@ -3,14 +3,17 @@ @@ -3,14 +3,17 @@
3 <nav hasHome>{{type == '1'?'消费金':'余额'}}明细</nav> 3 <nav hasHome>{{type == '1'?'消费金':'余额'}}明细</nav>
4 <view class="box"> 4 <view class="box">
5 <view class="items" wx:for="{{consumeList}}" bind:tap="getSeller" data-id="{{item.sellerid}}"> 5 <view class="items" wx:for="{{consumeList}}" bind:tap="getSeller" data-id="{{item.sellerid}}">
6 - <view class="topInfo">  
7 - <view class="types font28r" wx:if="{{type == '1'}}">{{item.type=='1'?'消耗':'获取'}}</view>  
8 - <view class="types font28r" wx:else>{{item.type=='1'?'消费':'充值'}}</view> 6 + <view class="topInfo" wx:if="{{type == '1'}}">
  7 + <view class="types font28r">{{item.type=='1'?'消耗':'获取'}}</view>
9 <view class="priceInfo font40r {{item.type=='1'?'colors1':'colors2'}}">{{item.type=='1'?'-':'+'}}¥{{item.price}}</view> 8 <view class="priceInfo font40r {{item.type=='1'?'colors1':'colors2'}}">{{item.type=='1'?'-':'+'}}¥{{item.price}}</view>
10 </view> 9 </view>
  10 + <view class="topInfo" wx:if="{{type == '2'}}">
  11 + <view class="types font28r">{{item.type=='1'?'充值':'消费'}}</view>
  12 + <view class="priceInfo font40r {{item.type=='1'?'colors2':'colors1'}}">{{item.type=='1'?'+':'-'}}¥{{item.price}}</view>
  13 + </view>
11 <view class="bottomInfo"> 14 <view class="bottomInfo">
12 <view class="text1 font28r">{{item.cdateInfo}}</view> 15 <view class="text1 font28r">{{item.cdateInfo}}</view>
13 - <view class="text1 font28r">本店消费金余额 ¥{{item.balance}}</view> 16 + <view class="text1 font28r">本店{{type == '1'?'消费金余额':'余额'}} ¥{{item.balance}}</view>
14 </view> 17 </view>
15 </view> 18 </view>
16 </view> 19 </view>
@@ -20,6 +20,7 @@ Page({ @@ -20,6 +20,7 @@ Page({
20 nickname: '', //昵称 20 nickname: '', //昵称
21 headimgurl: '', //头像 21 headimgurl: '', //头像
22 price: '', //消费金 22 price: '', //消费金
  23 + recharge_balance: '',//余额
23 }, 24 },
24 /** 25 /**
25 * 生命周期函数--监听页面加载 26 * 生命周期函数--监听页面加载
@@ -104,10 +105,12 @@ Page({ @@ -104,10 +105,12 @@ Page({
104 let obj = data[0] 105 let obj = data[0]
105 this.setData({ 106 this.setData({
106 price: obj.balance ? (obj.balance * 1).toFixed(2) : '0.00', 107 price: obj.balance ? (obj.balance * 1).toFixed(2) : '0.00',
  108 + recharge_balance: obj.recharge_balance ? (obj.recharge_balance * 1).toFixed(2) : '0.00',
107 }) 109 })
108 } else { 110 } else {
109 this.setData({ 111 this.setData({
110 price: '0.00', 112 price: '0.00',
  113 + recharge_balance: '0.00',
111 }) 114 })
112 } 115 }
113 } 116 }
@@ -42,12 +42,12 @@ @@ -42,12 +42,12 @@
42 <view class="money-title">消费金</view> 42 <view class="money-title">消费金</view>
43 </view> 43 </view>
44 </navigator> 44 </navigator>
45 - <!-- <navigator url="/pages/me/consumeAmount?type=2" class="money-item"> 45 + <navigator url="/pages/me/consumeAmount?type=2" class="money-item">
46 <view class="flex-vc"> 46 <view class="flex-vc">
47 - <view class="money-value">¥{{user.balance.price||0}}</view> 47 + <view class="money-value">¥{{recharge_balance?recharge_balance:'0.00'}}</view>
48 <view class="money-title">余额</view> 48 <view class="money-title">余额</view>
49 </view> 49 </view>
50 - </navigator> --> 50 + </navigator>
51 </view> 51 </view>
52 <view class="block-rev"> 52 <view class="block-rev">
53 <navigator url="/pages/me/list" open-type="redirect"> 53 <navigator url="/pages/me/list" open-type="redirect">
@@ -186,7 +186,8 @@ image{ @@ -186,7 +186,8 @@ image{
186 } 186 }
187 .block-rev.money{ 187 .block-rev.money{
188 height: 160rpx; 188 height: 160rpx;
189 - 189 + padding: 0 14rpx 0 4rpx;
  190 + box-sizing: border-box;
190 } 191 }
191 .money-title{ 192 .money-title{
192 height:40rpx; 193 height:40rpx;
@@ -20,8 +20,6 @@ Page({ @@ -20,8 +20,6 @@ Page({
20 this.setData({ 20 this.setData({
21 sellerid: options.sellerid 21 sellerid: options.sellerid
22 }) 22 })
23 - this.getSellerDetailFun(options.sellerid)  
24 - this.getRechargeDetail(options.sellerid)  
25 }, 23 },
26 // 获取店铺名称 24 // 获取店铺名称
27 getSellerDetailFun(sid) { 25 getSellerDetailFun(sid) {
@@ -78,6 +76,27 @@ Page({ @@ -78,6 +76,27 @@ Page({
78 } 76 }
79 }) 77 })
80 }, 78 },
  79 + // 获取用户在商家&所有余额
  80 + getUserInfo(sellerid) {
  81 + App.Activity.GetConsumeBySeller({
  82 + openid: getApp().openid,
  83 + sellerid
  84 + }).then((json) => {
  85 + if (json.ret == 200) {
  86 + let data = json.data;
  87 + if (data && data.length > 0) {
  88 + let obj = data[0]
  89 + this.setData({
  90 + recharge_balance: obj.recharge_balance ? (obj.recharge_balance * 1).toFixed(2) : '0.00',
  91 + })
  92 + } else {
  93 + this.setData({
  94 + recharge_balance: '0.00',
  95 + })
  96 + }
  97 + }
  98 + })
  99 + },
81 // 跳转用户商家消费金消费记录 100 // 跳转用户商家消费金消费记录
82 getSeller() { 101 getSeller() {
83 wx.navigateTo({ 102 wx.navigateTo({
@@ -95,7 +114,8 @@ Page({ @@ -95,7 +114,8 @@ Page({
95 id, 114 id,
96 name: this.data.seller.sellername, 115 name: this.data.seller.sellername,
97 sid: this.data.sellerid, 116 sid: this.data.sellerid,
98 - types: '5' 117 + types: '5',
  118 + isFree:'0'
99 }, '/pack-activity/pack/vipRecharge') 119 }, '/pack-activity/pack/vipRecharge')
100 }) 120 })
101 }, 121 },
@@ -110,7 +130,9 @@ Page({ @@ -110,7 +130,9 @@ Page({
110 * 生命周期函数--监听页面显示 130 * 生命周期函数--监听页面显示
111 */ 131 */
112 onShow() { 132 onShow() {
113 - 133 + this.getSellerDetailFun(this.data.sellerid)
  134 + this.getRechargeDetail(this.data.sellerid)
  135 + this.getUserInfo(this.data.sellerid)
114 }, 136 },
115 137
116 /** 138 /**
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 <view class="balance"> 8 <view class="balance">
9 <view class="info font28r">我的余额</view> 9 <view class="info font28r">我的余额</view>
10 <view class="news"> 10 <view class="news">
11 - <view class="priceInfo">¥500.00</view> 11 + <view class="priceInfo">¥{{recharge_balance ? recharge_balance : '0.00'}}</view>
12 <view class="details font24r" bind:tap="getSeller">余额明细</view> 12 <view class="details font24r" bind:tap="getSeller">余额明细</view>
13 </view> 13 </view>
14 </view> 14 </view>
@@ -21,11 +21,11 @@ @@ -21,11 +21,11 @@
21 <view class="font24r" wx:if="{{item.recharge_list.price && item.recharge_list.price*1 > 0}}">送{{item.recharge_list.price}}元</view> 21 <view class="font24r" wx:if="{{item.recharge_list.price && item.recharge_list.price*1 > 0}}">送{{item.recharge_list.price}}元</view>
22 </view> 22 </view>
23 </view> 23 </view>
24 - <view class="rechargeItems rechargeItems1"> 24 + <!-- <view class="rechargeItems rechargeItems1">
25 <text class="font36r">¥</text><input class="font28r" maxlength="5" type="number" placeholder="输入自定义金额" /> 25 <text class="font36r">¥</text><input class="font28r" maxlength="5" type="number" placeholder="输入自定义金额" />
26 - </view> 26 + </view> -->
27 <!-- <view class="infoAgreement font24r">充值即代表同意<text>《用户协议》</text>及<text>《会员充值协议》</text></view> --> 27 <!-- <view class="infoAgreement font24r">充值即代表同意<text>《用户协议》</text>及<text>《会员充值协议》</text></view> -->
28 </view> 28 </view>
29 -<view class="payBtnBox"> 29 +<!-- <view class="payBtnBox">
30 <view class="payBtn font32r" bindtap="confirmPayment">提交充值</view> 30 <view class="payBtn font32r" bindtap="confirmPayment">提交充值</view>
31 -</view>  
  31 +</view> -->
@@ -947,4 +947,9 @@ export default { @@ -947,4 +947,9 @@ export default {
947 'App.Seller.GetVoiceWelcomeConfig':{ 947 'App.Seller.GetVoiceWelcomeConfig':{
948 hasDisabledRMT:true, 948 hasDisabledRMT:true,
949 }, 949 },
  950 +
  951 + //获取用户余额明细记录
  952 + 'App.Activity.GetBalanceListByOpenid':{
  953 + hasDisabledRMT:true,
  954 + },
950 } 955 }