From 8ab8e1c421348b07036428faf4db3cd301b46741 Mon Sep 17 00:00:00 2001 From: "junwen.deng" Date: Wed, 27 Feb 2019 14:39:18 +0800 Subject: [PATCH 1/3] =?UTF-8?q?1.wxapi=E6=B7=BB=E5=8A=A0=E5=85=85=E5=80=BC?= =?UTF-8?q?=E9=80=81=E8=A7=84=E5=88=99=E7=9A=84=E7=BD=91=E7=BB=9C=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E6=96=B9=E6=B3=95=202.=E5=9C=A8=E5=85=85=E5=80=BC?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=B7=BB=E5=8A=A0=E5=85=85=E5=80=BC=E9=80=81?= =?UTF-8?q?=E5=BF=AB=E6=8D=B7=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/recharge/index.js | 61 +++++++++++++++++++++++++++++++-------- pages/recharge/index.wxml | 11 +++++++ pages/recharge/index.wxss | 29 ++++++++++++++++++- wxapi/main.js | 6 ++++ 4 files changed, 94 insertions(+), 13 deletions(-) diff --git a/pages/recharge/index.js b/pages/recharge/index.js index 3e270090..f9a97bf8 100644 --- a/pages/recharge/index.js +++ b/pages/recharge/index.js @@ -24,55 +24,92 @@ Page({ uid: wx.getStorageSync('uid'), recharge_amount_min: recharge_amount_min }); + + this.getRechargeRule(); + }, + /** + * 获得充值活动 + */ + getRechargeRule() { + var that = this; + // 获取充值活动优惠 + WXAPI.rechargeRule().then(function (res) { + if (res.code == 0) { + var arr = res.data; + that.setData({ + rechargeDic: arr, + confine: arr[0].confine, + send: arr[0].send + }); + + } else { + wx.showModal({ + title: '错误', + content: '无法获得充值优惠', + showCancel: false + }); + } + }); + }, + + /** + * 点击充值优惠的充值送 + */ + rechargeAmount: function (e) { + var confine = e.currentTarget.dataset.confine; + var amount = confine; + wxpay.wxpay(app, amount, 0, "/pages/cashier/cashier"); }, + /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { - + }, /** * 生命周期函数--监听页面显示 */ onShow: function () { - + console.log("onshow"); + this.getRechargeRule(); }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { - + }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { - + }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { - + }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { - + }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { - + }, bindSave: function (e) { WXAPI.addTempleMsgFormid({ @@ -83,7 +120,7 @@ Page({ var that = this; var amount = e.detail.value.amount; - if (amount == "" || amount*1 < 0) { + if (amount == "" || amount * 1 < 0) { wx.showModal({ title: '错误', content: '请填写正确的充值金额', @@ -91,10 +128,10 @@ Page({ }) return } - if (amount * 1 < that.data.recharge_amount_min*1) { + if (amount * 1 < that.data.recharge_amount_min * 1) { wx.showModal({ title: '错误', - content: '单次充值金额至少' + that.data.recharge_amount_min +'元', + content: '单次充值金额至少' + that.data.recharge_amount_min + '元', showCancel: false }) return @@ -127,9 +164,9 @@ Page({ _this: that }) }) - } + } }, - saveToMobile: function(){ + saveToMobile: function () { wx.canvasToTempFilePath({ canvasId: 'myQrcode', success: function (res) { diff --git a/pages/recharge/index.wxml b/pages/recharge/index.wxml index ab10b044..35bcf88b 100644 --- a/pages/recharge/index.wxml +++ b/pages/recharge/index.wxml @@ -20,6 +20,17 @@ + + + + + + + + + 保存以下二维码,使用支付宝扫码付款 diff --git a/pages/recharge/index.wxss b/pages/recharge/index.wxss index 17156776..e6bd6097 100644 --- a/pages/recharge/index.wxss +++ b/pages/recharge/index.wxss @@ -84,4 +84,31 @@ picker { } .hui{ color: #777; -} \ No newline at end of file +} + + + +.charge-rule-wrap{ + background: white; + margin-top:10rpx; + padding:10rpx +} +.charge-detail{ + width: 160rpx; + height: 80rpx; + color: rgba(46, 189, 2, 0.925); + /* padding-left: 6rpx; */ + background-color:white; + border:2rpx solid rgba(46, 189, 2, 0.925); + + display: table-cell; + line-height: 30rpx; +} +.charge-detail text{ + vertical-align:middle; + font-size: 28rpx; +} +.button-hover{ + background-color:grey; +} + diff --git a/wxapi/main.js b/wxapi/main.js index c20995e5..2cdd98fa 100644 --- a/wxapi/main.js +++ b/wxapi/main.js @@ -291,5 +291,11 @@ module.exports = { }, cashLogs: (data) => { return request('/user/cashLog', true, 'post', data) + }, + /** + * 充值送规则 + */ + rechargeRule: (data) =>{ + return request('/user/recharge/send/rule', true, 'get', data) } } \ No newline at end of file From 8daeb0ae2a6e18df859e484a209c740fb83d3e1f Mon Sep 17 00:00:00 2001 From: "junwen.deng" Date: Wed, 27 Feb 2019 15:42:45 +0800 Subject: [PATCH 2/3] Update index.wxml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 合并原作者 --- pages/recharge/index.wxml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pages/recharge/index.wxml b/pages/recharge/index.wxml index e3cd04ac..d2621782 100644 --- a/pages/recharge/index.wxml +++ b/pages/recharge/index.wxml @@ -13,7 +13,7 @@ + @@ -21,9 +21,9 @@ - + - + @@ -46,4 +46,4 @@ - \ No newline at end of file + From d4c2f5e164ced3a2630624c91943eda6011ea243 Mon Sep 17 00:00:00 2001 From: "junwen.deng" Date: Wed, 27 Feb 2019 17:45:07 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=85=E5=80=BC?= =?UTF-8?q?=E9=80=81=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改充值送样式 --- pages/recharge/index.js | 3 +++ pages/recharge/index.wxml | 15 ++++++++++---- pages/recharge/index.wxss | 41 +++++++++++++++++++++++++++------------ 3 files changed, 43 insertions(+), 16 deletions(-) diff --git a/pages/recharge/index.js b/pages/recharge/index.js index c8ad260b..851710a3 100644 --- a/pages/recharge/index.js +++ b/pages/recharge/index.js @@ -33,6 +33,9 @@ Page({ rechargeAmount: function (e) { var confine = e.currentTarget.dataset.confine; var amount = confine; + this.setData({ + amount: amount + }); wxpay.wxpay(app, amount, 0, "/pages/cashier/cashier"); }, diff --git a/pages/recharge/index.wxml b/pages/recharge/index.wxml index d2621782..881bce88 100644 --- a/pages/recharge/index.wxml +++ b/pages/recharge/index.wxml @@ -4,7 +4,7 @@ 充值金额 - + @@ -20,14 +20,21 @@ + - + + + + 充{{item.confine}} + 送{{item.send}} + + diff --git a/pages/recharge/index.wxss b/pages/recharge/index.wxss index bbe31527..309d8569 100644 --- a/pages/recharge/index.wxss +++ b/pages/recharge/index.wxss @@ -90,25 +90,42 @@ picker { width:740rpx; } + .charge-rule-wrap{ background: white; - margin-top:10rpx; - padding:10rpx + margin-top:20rpx; + padding:10rpx; + padding-left:20rpx; + display: flex; + flex-direction:row; + flex-wrap:wrap; +} +.btn{ + box-sizing: border-box; + text-align: center; + border-radius: 6rpx; + margin-left: 20rpx; } .charge-detail{ - width: 160rpx; - height: 80rpx; - color: rgba(46, 189, 2, 0.925); - /* padding-left: 6rpx; */ + width:220rpx; + height:100rpx; + color:rgba(99, 190, 133, 1); background-color:white; - border:2rpx solid rgba(46, 189, 2, 0.925); - - display: table-cell; - line-height: 30rpx; + border:3rpx solid rgba(99, 190, 133, 1); + display:table-cell; + line-height:30rpx; + font-weight:300; + font-size:30rpx; + margin:10rpx; + align-items:flex-start; } .charge-detail text{ - vertical-align:middle; - font-size: 28rpx; + vertical-align:middle; + font-size: 28rpx; + display: flex; + justify-content: center; + align-items: center; + margin-top:12rpx; } .button-hover{ background-color:grey;