diff --git a/config/config.js b/config/config.js index 7f957d4..3392ef7 100755 --- a/config/config.js +++ b/config/config.js @@ -309,6 +309,10 @@ var config = { * 根据code查询接口 */ findByCode: "/merchant/findByCode", + /** + * 设置密码 + */ + updatePayPassword: "/couponOrder/updatePayPassword", /** * 参与砍价 */ diff --git a/pages/cardorder/cardUse/cardUse.js b/pages/cardorder/cardUse/cardUse.js index 9a9e936..25f7d80 100644 --- a/pages/cardorder/cardUse/cardUse.js +++ b/pages/cardorder/cardUse/cardUse.js @@ -162,6 +162,58 @@ Page({ }) }, + goSetSecurity() { + wx.showModal({ + title: '设置支付密码', + placeholderText: '请设置密码,不设则默认为无密码', + editable: true, + complete: (res) => { + if (res.cancel) { + console.log(res); + } + + if (res.confirm) { + const numReg = /^\d+$/ + const isNum = numReg.test(res.content) + if (res.content) { + if (!isNum || (res.content.length != 6)) { + wx.showToast({ + title: '密码只能为6位数字', + icon: 'none' + }) + return + } else { + this.setPassword(1, res.content) + } + } else { + this.setPassword(0, '') + } + } + } + }) + }, + + setPassword(payCheck, pwd) { + Http.post({ + url: config.api.updatePayPassword, + data: { + id: this.data.data.id, + payCheck: payCheck, + payPassword: pwd + } + }).then(res => { + wx.showToast({ + title: '设置成功!', + icon: 'success' + }) + }).catch(err => { + wx.showToast({ + title: err.message, + icon: 'error' + }) + }) + }, + goCheck() { wx.navigateTo({ url: `/pages/ConsumeDetail/ConsumeDetail?cardId=${this.data.data.id}`, diff --git a/pages/cardorder/cardUse/cardUse.wxml b/pages/cardorder/cardUse/cardUse.wxml index 01903d1..d571463 100644 --- a/pages/cardorder/cardUse/cardUse.wxml +++ b/pages/cardorder/cardUse/cardUse.wxml @@ -150,6 +150,7 @@ --> + diff --git a/pages/cardorder/cardUse/cardUse.wxss b/pages/cardorder/cardUse/cardUse.wxss index 36421cb..8224cf0 100644 --- a/pages/cardorder/cardUse/cardUse.wxss +++ b/pages/cardorder/cardUse/cardUse.wxss @@ -372,7 +372,7 @@ page { .bottomBtn { position: sticky; bottom: 0; - padding: 50rpx; + padding: 70rpx; z-index: 99999; } diff --git a/pages/exchangeCard/exchangeCard.js b/pages/exchangeCard/exchangeCard.js index 95c6295..d32bcf4 100644 --- a/pages/exchangeCard/exchangeCard.js +++ b/pages/exchangeCard/exchangeCard.js @@ -172,10 +172,13 @@ Page({ }, getCouponOrderByPassword(password) { + const that = this Http.post({ url: config.api.getCouponOrderByPassword, data: { password, + payCheck: that.data.pdwSwitch, + payPassword: that.data.password } }) .then(res => { @@ -217,6 +220,26 @@ Page({ }, submit() { + if (this.data.pdwSwitch) { + const password = this.data.password + const numReg = /^\d+$/ + + if (!password) { + wx.showToast({ + title: '密码不能为空!', + icon: 'none' + }) + return + } + + if (!numReg.test(password) || password.length != 6) { + wx.showToast({ + title: '密码只能为6位数字!', + icon: 'none' + }) + return + } + } const e = { detail: { value: { code: this.data.code } } } diff --git a/pages/exchangeCard/exchangeCard.wxml b/pages/exchangeCard/exchangeCard.wxml index 23bb958..30a5764 100644 --- a/pages/exchangeCard/exchangeCard.wxml +++ b/pages/exchangeCard/exchangeCard.wxml @@ -55,7 +55,7 @@ 取消 - + diff --git a/project.private.config.json b/project.private.config.json index 9a8b04a..a8033e7 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -7,7 +7,7 @@ "preloadBackgroundData": false, "useIsolateContext": true }, - "libVersion": "2.11.2", + "libVersion": "2.30.2", "condition": { "miniprogram": { "list": [