guangchao.xu | 070005a | 2020-12-07 09:56:40 +0800 | [diff] [blame] | 1 | <template> |
| 2 | <view class="changePayPwd"> |
| 3 | <view class="changePayPwd-list"> |
| 4 | <u-field v-model="pwd" label="支付密码" :field-style="fieldStyle" placeholder="请设置6-12位密码" |
| 5 | label-width="160" :password="true" maxlength="12" clear-size="40"></u-field> |
| 6 | <u-field v-model="repwd" label="确认密码" :field-style="fieldStyle" placeholder="请确认新密码" |
| 7 | label-width="160" :password="true" maxlength="12" clear-size="40"></u-field> |
| 8 | </view> |
| 9 | <view class="changePayPwd-forget"> |
| 10 | <text @click="toForgetPwd">忘记密码?</text> |
| 11 | </view> |
| 12 | <u-button @click="changePayPwd" :custom-style="changePayPwdBtn">确认修改</u-button> |
| 13 | </view> |
| 14 | </template> |
| 15 | |
| 16 | <script> |
| 17 | export default { |
| 18 | data() { |
| 19 | return { |
| 20 | pwd: "", |
| 21 | repwd: "", |
| 22 | fieldStyle:{'font-size':'30rpx','color':'#999999'}, |
| 23 | changePayPwdBtn:{ |
| 24 | width: '600rpx', |
| 25 | backgroundColor: '#2FA8E1', |
| 26 | color: '#FFFFFF', |
| 27 | fontFamily: "PingFang-SC-Medium", |
| 28 | fontSize: '30rpx', |
| 29 | marginTop: '100rpx', |
| 30 | padding: '50rpx 0' |
| 31 | } |
| 32 | } |
| 33 | }, |
| 34 | methods: { |
| 35 | toForgetPwd() { |
| 36 | uni.navigateTo({ |
guangchao.xu | 6cdd45e | 2021-04-16 17:44:30 +0800 | [diff] [blame^] | 37 | url: "/pages/sub_mine/findPayPwd" |
guangchao.xu | 070005a | 2020-12-07 09:56:40 +0800 | [diff] [blame] | 38 | }) |
| 39 | }, |
| 40 | changePayPwd() { |
| 41 | let that = this |
| 42 | let { |
| 43 | pwd, |
| 44 | repwd |
| 45 | } = that |
| 46 | if (pwd == "") { |
| 47 | uni.showToast({ |
| 48 | title: "请输入支付密码", |
| 49 | duration: 800, |
| 50 | icon: "none" |
| 51 | }) |
| 52 | return false |
| 53 | } |
| 54 | if (repwd != pwd) { |
| 55 | uni.showToast({ |
| 56 | title: "两次支付密码不一致,请确认后重新输入", |
| 57 | duration: 800, |
| 58 | icon: "none" |
| 59 | }) |
| 60 | return false |
| 61 | } |
| 62 | let paypwdtype = uni.getStorageSync("paypwdtype"); |
| 63 | if (paypwdtype == "") { |
| 64 | paypwdtype = "new" |
| 65 | } |
| 66 | var randomcode = uni.getStorageSync("randomcode"); |
| 67 | if (randomcode == "") { |
| 68 | randomcode = "" |
| 69 | } |
| 70 | let param = { |
| 71 | "pwd": pwd, |
| 72 | "repwd": repwd, |
| 73 | "type": paypwdtype, |
| 74 | "randcode": randomcode |
| 75 | } |
| 76 | that.$u.post("/v1/paypwd", param).then((res) => { |
| 77 | uni.showToast({ |
| 78 | title: "设置支付密码成功", |
| 79 | icon: "none", |
| 80 | duration: 800, |
| 81 | complete(res) { |
| 82 | setTimeout(() => { |
| 83 | uni.switchTab({ |
| 84 | url: "/pages/sub_tabbar/index" |
| 85 | }) |
| 86 | }, 1500) |
| 87 | } |
| 88 | }) |
| 89 | }) |
| 90 | } |
| 91 | }, |
| 92 | } |
| 93 | </script> |
| 94 | |
| 95 | <style lang="scss" scoped> |
| 96 | .changePayPwd { |
| 97 | width: 100vw; |
| 98 | // height: 100vh; |
| 99 | background-color: #F3F3F3; |
| 100 | overflow: hidden; |
| 101 | padding-bottom: 30rpx; |
| 102 | |
| 103 | &-list { |
| 104 | background-color: #FFFFFF; |
| 105 | margin-top: 30rpx; |
| 106 | } |
| 107 | |
| 108 | &-forget { |
| 109 | font-size: 24rpx; |
| 110 | font-family: "PingFang-SC-Regular"; |
| 111 | display: flex; |
| 112 | padding: 30rpx 30rpx 0; |
| 113 | color: #666666; |
| 114 | justify-content: flex-end; |
| 115 | } |
| 116 | |
| 117 | &-btn { |
| 118 | width: 600rpx; |
| 119 | background-color: #2FA8E1; |
| 120 | color: #FFFFFF; |
| 121 | font-family: "PingFang-SC-Medium"; |
| 122 | font-size: 30rpx; |
| 123 | margin-top: 50rpx; |
| 124 | padding: 50rpx 0; |
| 125 | } |
| 126 | } |
| 127 | </style> |