Commit 2a2387bb0db4237a6d92d499f47e1e492a2b50c5

Authored by pengye
1 parent 6da27e09

我的页面新增余额

... ... @@ -22,7 +22,6 @@ Page({
type
})
}
if(type == 1) this.getInfo()
},
// 获取用户消费金商家余额列表
getInfo() {
... ... @@ -38,6 +37,20 @@ Page({
})
})
},
// 获取用户在商家的账户余额
getConsumeSellerList() {
App.Activity.GetRechargeBalanceByOpenid({
openid: getApp().openid,
}).then(res => {
let sellerList = res.data;
sellerList.forEach(i => {
i.balance = (i.recharge_balance * 1).toFixed(2)
})
this.setData({
sellerList
})
})
},
// 跳转用户商家消费金消费记录
getSeller(event) {
if (this.data.type == '1') {
... ... @@ -74,7 +87,9 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {
let type = this.data.type;
if (type == 1) this.getInfo()
if (type == 2) this.getConsumeSellerList()
},
/**
... ...
... ... @@ -17,7 +17,7 @@
</block>
<block wx:else>
<image class="noDataImg" src="https://qn.colorcun.com/noConsumeData.png" mode="aspectFit" />
<view class="font28r noDataText">暂无消费金</view>
<view class="font28r noDataText">暂无{{type == '1' ? '消费金' : '余额'}}</view>
<view class="btn font28r" bind:tap="switchAccount">换号查看</view>
</block>
</view>
\ No newline at end of file
... ...
... ... @@ -24,7 +24,6 @@ Page({
sellerid: options.sellerid
})
}
if (type == 1) this.getInfo(options.sellerid)
},
getSeller() {
let type = this.data.type;
... ... @@ -36,6 +35,7 @@ Page({
}, '/pages/me/myBalance')
})
},
// 获取消费金明细
getInfo(sellerid) {
App.Activity.GetConsumeListByOpenid({
openid: getApp().openid,
... ... @@ -47,6 +47,25 @@ Page({
i.balance = (i.balance * 1).toFixed(2)
i.cdateInfo = i.cdate ? util.unixtoTime(i.cdate, 'YYYY-MM-DD HH:II') : '';
})
consumeList.sort((a, b) => (b.cdate * 1) - (a.cdate * 1));
this.setData({
consumeList
})
})
},
// 获取余额明细
getBalanceList(sellerid) {
App.Activity.GetBalanceListByOpenid({
openid: getApp().openid,
sellerid
}).then(res => {
let consumeList = res.data;
consumeList.forEach(i => {
i.price = (i.price * 1).toFixed(2)
i.balance = (i.balance * 1).toFixed(2)
i.cdateInfo = i.cdate ? util.unixtoTime(i.cdate, 'YYYY-MM-DD HH:II') : '';
})
consumeList.sort((a, b) => (b.cdate * 1) - (a.cdate * 1));
this.setData({
consumeList
})
... ... @@ -63,7 +82,8 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {
if (this.data.type == 1) this.getInfo(this.data.sellerid)
if (this.data.type == 2) this.getBalanceList(this.data.sellerid)
},
/**
... ...
... ... @@ -3,14 +3,17 @@
<nav hasHome>{{type == '1'?'消费金':'余额'}}明细</nav>
<view class="box">
<view class="items" wx:for="{{consumeList}}" bind:tap="getSeller" data-id="{{item.sellerid}}">
<view class="topInfo">
<view class="types font28r" wx:if="{{type == '1'}}">{{item.type=='1'?'消耗':'获取'}}</view>
<view class="types font28r" wx:else>{{item.type=='1'?'消费':'充值'}}</view>
<view class="topInfo" wx:if="{{type == '1'}}">
<view class="types font28r">{{item.type=='1'?'消耗':'获取'}}</view>
<view class="priceInfo font40r {{item.type=='1'?'colors1':'colors2'}}">{{item.type=='1'?'-':'+'}}¥{{item.price}}</view>
</view>
<view class="topInfo" wx:if="{{type == '2'}}">
<view class="types font28r">{{item.type=='1'?'充值':'消费'}}</view>
<view class="priceInfo font40r {{item.type=='1'?'colors2':'colors1'}}">{{item.type=='1'?'+':'-'}}¥{{item.price}}</view>
</view>
<view class="bottomInfo">
<view class="text1 font28r">{{item.cdateInfo}}</view>
<view class="text1 font28r">本店消费金余额 ¥{{item.balance}}</view>
<view class="text1 font28r">本店{{type == '1'?'消费金余额':'余额'}} ¥{{item.balance}}</view>
</view>
</view>
</view>
\ No newline at end of file
... ...
... ... @@ -20,6 +20,7 @@ Page({
nickname: '', //昵称
headimgurl: '', //头像
price: '', //消费金
recharge_balance: '',//余额
},
/**
* 生命周期函数--监听页面加载
... ... @@ -104,10 +105,12 @@ Page({
let obj = data[0]
this.setData({
price: obj.balance ? (obj.balance * 1).toFixed(2) : '0.00',
recharge_balance: obj.recharge_balance ? (obj.recharge_balance * 1).toFixed(2) : '0.00',
})
} else {
this.setData({
price: '0.00',
recharge_balance: '0.00',
})
}
}
... ...
... ... @@ -42,12 +42,12 @@
<view class="money-title">消费金</view>
</view>
</navigator>
<!-- <navigator url="/pages/me/consumeAmount?type=2" class="money-item">
<navigator url="/pages/me/consumeAmount?type=2" class="money-item">
<view class="flex-vc">
<view class="money-value">¥{{user.balance.price||0}}</view>
<view class="money-value">¥{{recharge_balance?recharge_balance:'0.00'}}</view>
<view class="money-title">余额</view>
</view>
</navigator> -->
</navigator>
</view>
<view class="block-rev">
<navigator url="/pages/me/list" open-type="redirect">
... ...
... ... @@ -186,7 +186,8 @@ image{
}
.block-rev.money{
height: 160rpx;
padding: 0 14rpx 0 4rpx;
box-sizing: border-box;
}
.money-title{
height:40rpx;
... ...
... ... @@ -20,8 +20,6 @@ Page({
this.setData({
sellerid: options.sellerid
})
this.getSellerDetailFun(options.sellerid)
this.getRechargeDetail(options.sellerid)
},
// 获取店铺名称
getSellerDetailFun(sid) {
... ... @@ -78,6 +76,27 @@ Page({
}
})
},
// 获取用户在商家&所有余额
getUserInfo(sellerid) {
App.Activity.GetConsumeBySeller({
openid: getApp().openid,
sellerid
}).then((json) => {
if (json.ret == 200) {
let data = json.data;
if (data && data.length > 0) {
let obj = data[0]
this.setData({
recharge_balance: obj.recharge_balance ? (obj.recharge_balance * 1).toFixed(2) : '0.00',
})
} else {
this.setData({
recharge_balance: '0.00',
})
}
}
})
},
// 跳转用户商家消费金消费记录
getSeller() {
wx.navigateTo({
... ... @@ -95,7 +114,8 @@ Page({
id,
name: this.data.seller.sellername,
sid: this.data.sellerid,
types: '5'
types: '5',
isFree:'0'
}, '/pack-activity/pack/vipRecharge')
})
},
... ... @@ -110,7 +130,9 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {
this.getSellerDetailFun(this.data.sellerid)
this.getRechargeDetail(this.data.sellerid)
this.getUserInfo(this.data.sellerid)
},
/**
... ...
... ... @@ -8,7 +8,7 @@
<view class="balance">
<view class="info font28r">我的余额</view>
<view class="news">
<view class="priceInfo">¥500.00</view>
<view class="priceInfo">¥{{recharge_balance ? recharge_balance : '0.00'}}</view>
<view class="details font24r" bind:tap="getSeller">余额明细</view>
</view>
</view>
... ... @@ -21,11 +21,11 @@
<view class="font24r" wx:if="{{item.recharge_list.price && item.recharge_list.price*1 > 0}}">送{{item.recharge_list.price}}元</view>
</view>
</view>
<view class="rechargeItems rechargeItems1">
<!-- <view class="rechargeItems rechargeItems1">
<text class="font36r">¥</text><input class="font28r" maxlength="5" type="number" placeholder="输入自定义金额" />
</view>
</view> -->
<!-- <view class="infoAgreement font24r">充值即代表同意<text>《用户协议》</text>及<text>《会员充值协议》</text></view> -->
</view>
<view class="payBtnBox">
<!-- <view class="payBtnBox">
<view class="payBtn font32r" bindtap="confirmPayment">提交充值</view>
</view>
\ No newline at end of file
</view> -->
\ No newline at end of file
... ...
... ... @@ -947,4 +947,9 @@ export default {
'App.Seller.GetVoiceWelcomeConfig':{
hasDisabledRMT:true,
},
//获取用户余额明细记录
'App.Activity.GetBalanceListByOpenid':{
hasDisabledRMT:true,
},
}
\ No newline at end of file
... ...