From c43448f96141d29d65e8c026e090a8d6ed54816b Mon Sep 17 00:00:00 2001 From: pplokijuhyg <1162963624@qq.com> Date: Sat, 28 Dec 2019 16:31:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=85=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/yue/yuetitle/yuetitle.wxml | 2 +- components/yue/yuetop/yuetop.js | 5 +- components/yue/yuetop/yuetop.wxml | 2 +- pages/personal/personal.js | 6 +- pages/personal/personal.wxml | 2 +- pages/yue/yue.js | 87 +++++++++++++++++++++++---- pages/yue/yue.json | 3 +- pages/yue/yue.scss | 37 ++++++++++-- pages/yue/yue.wxml | 9 ++- pages/yue/yue.wxss | 8 +-- 10 files changed, 130 insertions(+), 31 deletions(-) diff --git a/components/yue/yuetitle/yuetitle.wxml b/components/yue/yuetitle/yuetitle.wxml index b70a4e1..d246373 100644 --- a/components/yue/yuetitle/yuetitle.wxml +++ b/components/yue/yuetitle/yuetitle.wxml @@ -1,3 +1,3 @@ - 累计消费 + 资产记录 \ No newline at end of file diff --git a/components/yue/yuetop/yuetop.js b/components/yue/yuetop/yuetop.js index 610e633..31cc0c2 100644 --- a/components/yue/yuetop/yuetop.js +++ b/components/yue/yuetop/yuetop.js @@ -18,6 +18,9 @@ Component({ * 组件的方法列表 */ methods: { - + recharge(){ + console.log(234) + this.triggerEvent('recharge') + } } }) diff --git a/components/yue/yuetop/yuetop.wxml b/components/yue/yuetop/yuetop.wxml index f1d4125..011f4d3 100644 --- a/components/yue/yuetop/yuetop.wxml +++ b/components/yue/yuetop/yuetop.wxml @@ -2,6 +2,6 @@ 总资产 {{money}} - 充值 + 充值 \ No newline at end of file diff --git a/pages/personal/personal.js b/pages/personal/personal.js index ae05190..3d82caa 100644 --- a/pages/personal/personal.js +++ b/pages/personal/personal.js @@ -9,7 +9,8 @@ Page({ openid:"", username:"", img:"", - frozen_money:"" + frozen_money:"", + level:1 }, /** @@ -93,7 +94,8 @@ Page({ this.setData({ username:res.data.data.nick_name, img:res.data.data.head_pic, - frozen_money:res.data.data.frozen_money + frozen_money:res.data.data.frozen_money, + level:res.data.data.level }) } diff --git a/pages/personal/personal.wxml b/pages/personal/personal.wxml index a9afa83..b307192 100644 --- a/pages/personal/personal.wxml +++ b/pages/personal/personal.wxml @@ -24,7 +24,7 @@ 会员中心 - 非会员 > + {{level == 2 ? "会员":"非会员"}} > 我的余额 diff --git a/pages/yue/yue.js b/pages/yue/yue.js index d824eba..34a2fd2 100644 --- a/pages/yue/yue.js +++ b/pages/yue/yue.js @@ -1,17 +1,19 @@ import bin from "../../utils/bin" Page({ data: { - money:"", - list:[] + money: "", + list: [], + number: 0, + show:false }, onLoad(a) { bin.request({ - url:"User/validateOpenid" - }).then((res)=>{ + url: "User/validateOpenid" + }).then((res) => { console.log(res) - if(res.data.code == 200){ + if (res.data.code == 200) { this.setData({ - money : res.data.data.user_money + money: res.data.data.user_money }) } }) @@ -19,20 +21,83 @@ Page({ bin.request({ url: "User/account", urldata: { - user_id : userid, - page:0 + user_id: userid, + page: 0 } - }).then((res)=>{ + }).then((res) => { console.log(res) - for(let i in res.data.result){ + for (let i in res.data.result) { let linshi = res.data.result[i].change_time.split(" ") res.data.result[i].date = linshi[0] res.data.result[i].time = linshi[1] } this.setData({ - list:res.data.result + list: res.data.result }) }) }) + }, + number(a) { + console.log(a) + this.setData({ + number: a.detail.value + }) + }, + recharge(){ + if(this.data.number == 0){ + wx.showToast({ + title:"请输入充值金额", + icon:"none" + }) + }else{ + bin.getuserid().then((id)=>{ + bin.request({ + url:"User/user_recharge", + data:{ + user_id:id, + account:this.data.number + } + }).then((res)=>{ + let t =this; + console.log(res); + wx.requestPayment({ + timeStamp:res.data.result.wdata.timeStamp + "", + nonceStr:res.data.result.wdata.nonceStr, + package:res.data.result.wdata.package, + signType: res.data.result.wdata.signType, + paySign:res.data.result.wdata.sign, + success(res){ + // console.log(res) + wx.showToast({ + title:"充值成功", + icon:"none" + }) + t.setData({ + show:false + }) + t.onLoad() + }, + fail(err){ + wx.showToast({ + title:"充值失败", + icon:"none" + }) + } + }) + }) + }) + + } + }, + showrecharge(){ + console.log(123) + this.setData({ + show:true + }) + }, + onClose(){ + this.setData({ + show:false + }) } }) \ No newline at end of file diff --git a/pages/yue/yue.json b/pages/yue/yue.json index 88c96da..997209b 100644 --- a/pages/yue/yue.json +++ b/pages/yue/yue.json @@ -3,6 +3,7 @@ "usingComponents": { "yuetop": "/components/yue/yuetop/yuetop", "yuetitle": "/components/yue/yuetitle/yuetitle", - "yuedetail": "/components/yue/yuedetail/yuedetail" + "yuedetail": "/components/yue/yuedetail/yuedetail", + "van-popup": "/utils/dist/popup/index" } } \ No newline at end of file diff --git a/pages/yue/yue.scss b/pages/yue/yue.scss index d0e748b..33f0df1 100644 --- a/pages/yue/yue.scss +++ b/pages/yue/yue.scss @@ -1,8 +1,35 @@ .yue { - .title { - margin-top: 40rpx + .title { + margin-top: 40rpx; + } + .detail { + margin-top: 41rpx; + } + .recharge { + width: 617rpx; + height: 115rpx; + display: flex; + align-items: center; + justify-content: center; + >text{ + margin-right: 20rpx; + } - .detail { - margin-top: 41rpx; + >view{ + padding-left: 25rpx; + height: 52rpx; + border-left: #eaeaea solid 1rpx; + font-size: 26rpx; + color: #09bb07; + line-height: 52rpx; + + } -} \ No newline at end of file + >input{ + width: 398rpx; + height: 50rpx; + font-size: 26rpx; + + } + } +} diff --git a/pages/yue/yue.wxml b/pages/yue/yue.wxml index 307b7fd..e8beb72 100644 --- a/pages/yue/yue.wxml +++ b/pages/yue/yue.wxml @@ -1,11 +1,18 @@ - + + + + + + 确定 + +