diff --git a/api/api.js b/api/api.js index 19a2953..a65e7cf 100644 --- a/api/api.js +++ b/api/api.js @@ -206,6 +206,13 @@ export function modifyPhone(data) { export function modifyPassword(data) { return request.post('user/change/password', data); } + +/** 设置支付密码 */ +export function setPayPwd(data) { + return request.post('User/set/withdrawal_pwd', data); +} + + /** 退出登錄 */ export function logout() { return request.get('logout'); diff --git a/components/payment/index.vue b/components/payment/index.vue index a27272f..c4e609c 100644 --- a/components/payment/index.vue +++ b/components/payment/index.vue @@ -5,7 +5,7 @@ 选择付款方式 + v-for="(item,index) in payMode" v-if="item.payStatus==1" :key="index"> @@ -20,6 +20,12 @@ + + + + + + @@ -27,7 +33,7 @@ // +---------------------------------------------------------------------- // | CRMEB [ CRMEB赋能开发者,助力企业发展 ] // +---------------------------------------------------------------------- - // | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved. + // | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved. // +---------------------------------------------------------------------- // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 // +---------------------------------------------------------------------- @@ -35,9 +41,17 @@ // +---------------------------------------------------------------------- import { orderPay, - presellOrderPay + integralOrderPay, + presellOrderPay, + verifyPwd } from '@/api/order.js'; + import payPwd from "@/components/payPwd/index.vue"; + import popups from "@/components/popups/index.vue"; export default { + components: { + payPwd, + popups + }, props: { payMode: { type: Array, @@ -64,13 +78,18 @@ isCall: { type: Boolean, default: false + }, + returnUrl: { + type: String, + default: '' } }, data() { return { - + type: '' }; }, + methods: { close: function() { this.$emit('onChangeFun', { @@ -78,7 +97,6 @@ }); }, goPay: function(number, paytype) { - if (this.isCall) { return this.$emit('onChangeFun', { action: 'payCheck', @@ -99,7 +117,6 @@ // #endif } else if (paytype == 'balance') { type = 'balance'; - console.log('123'); } else if (paytype == 'alipay') { // #ifndef MP type = 'alipay'; @@ -107,9 +124,8 @@ // #ifdef MP type = 'alipayQr'; // #endif - } else if (paytype == 'creditBuy') { - console.log('123123'); - type = 'creditBuy' + } else if (paytype == 'public') { + type = 'public'; } if (!that.order_id) return that.$util.Tips({ title: '请选择要支付的订单' @@ -117,29 +133,79 @@ if (paytype == 'balance' && parseFloat(number) < parseFloat(that.totalPrice)) return that.$util.Tips({ title: '余额不足!' }); - uni.showLoading({ - title: '支付中' + + this.type = type; + + if (paytype == 'balance' || paytype == 'merBalance') { + this.$refs.popups.handleOpen(); + } else { + uni.showLoading({ + title: '订单支付中' + }); + this.trueOrderPay(); + } + }, + + // 输入密码回调 + handleConfirm(e) { + // 验证密码是否正确 + verifyPwd({ + withdrawal_pwd: e + }).then(res => { + // 密码是否有效 状态码判断 + const code = res.data.code; + + if (code == 100) { //密码正确 + uni.showLoading({ + title: '订单支付中', + mask: true + }); + this.trueOrderPay(); + } else { + this.$refs.payPwd.handleOpen(code); + } + }).catch(err => { + console.log(err) + }) + }, + + handleClear() {}, + handleChange() {}, + + // 弹框左边按钮 101 未设置密码 102 忘记密码 都去设置密码 + handleLeft(code) { + uni.navigateTo({ + url: "/pages/users/user_modify_pwd/index?type=payPwd" }); - let orderApi = that.order_type === 1 ? presellOrderPay : orderPay + this.$refs.payPwd.handleClose(); + }, + + // 弹框右边按钮 取消 重试 + handleRight(code) { + if (code == 101) { //取消 + this.$refs.payPwd.handleClose(code); + } else { + this.$refs.payPwd.handleClose(); + this.$refs.popups.handleOpen(); + } + }, + + trueOrderPay() { + let that = this; + let orderApi = that.order_type === 1 ? presellOrderPay : that.order_type === 2 ? integralOrderPay : + orderPay orderApi(that.order_id, { - type: type, + type: that.type, // #ifdef H5 - - return_url: this.order_type == 98 ? 'http://' + window.location.host + - '/pages/users/order_list/indexCopy' : 'http://' + window.location.host + - '/pages/users/order_list/index', - - + return_url: that.returnUrl !== '' ? 'http://' + window.location.host + that.returnUrl : + 'http://' + window.location.host + '/pages/users/order_list/index', // #endif - }).then(res => { let status = res.data.status, orderId = res.data.result.order_id, jsConfig = res.data.result.config, callback_key = res.data.result.pay_key, - - goPages = this.order_type == 98 ? '/pages/users/order_list/indexCopy' : - '/pages/users/order_list/index' + goPages = that.returnUrl ? that.returnUrl : '/pages/users/order_list/index'; switch (status) { case 'ORDER_EXIST': case 'EXTEND_ORDER': @@ -163,7 +229,7 @@ icon: 'success' }, { tab: 5, - url: goPages + '?status=2' + url: goPages + '?status=1' }); break; case 'alipay': @@ -185,7 +251,7 @@ jsConfig.timeStamp = jsConfig.timestamp; // #ifndef APP-PLUS that.$wechat.pay(jsConfig).then(res => { - // console.log('测试支付数据无效的success:'+res.data) + console.log('测试支付数据无效的success:' + res.data) this.$emit('onChangeFun', { action: 'payClose' }); @@ -195,10 +261,10 @@ icon: 'success' }, { tab: 5, - url: goPages + 'status=2' + url: goPages + 'status=1' }); }).catch(res => { - // console.log('测试支付数据无效的catch:'+res.data) + console.log('测试支付数据无效的catch:' + res.data) if (res.errMsg == 'chooseWXPay:cancel') { if (that.isCall) { return that.$util.Tips({ @@ -209,7 +275,7 @@ title: '取消支付' }, { tab: 5, - url: goPages + '?status=1' + url: goPages + '?status=0' }); } } @@ -222,7 +288,6 @@ } else { mp_pay_name = 'requestPayment' } - console.log(mp_pay_name, jsConfig) uni[mp_pay_name]({ provider: 'wxpay', orderInfo: jsConfig, @@ -235,11 +300,10 @@ icon: 'success' }, { tab: 5, - url: goPages + 'status=2' + url: goPages + 'status=1' }); }, fail: (e) => { - console.log(e) if (that.isCall) { return that.$util.Tips({ title: '取消支付' @@ -249,7 +313,7 @@ title: '取消支付' }, { tab: 5, - url: goPages + '?status=1' + url: goPages + '?status=0' }); } }, @@ -284,7 +348,7 @@ icon: 'success' }, { tab: 5, - url: goPages + '?status=2' + url: goPages + '?status=1' }); return that.$util.Tips({ @@ -292,7 +356,7 @@ icon: 'success' }, { tab: 5, - url: goPages + '?status=2' + url: goPages + '?status=1' }); }, fail: function(e) { @@ -307,10 +371,9 @@ complete: function(e) { uni.hideLoading(); //关闭当前页面跳转至订单状态 - if (res.errMsg == 'requestPayment:cancel') return that.$util - .Tips({ - title: '取消支付' - }); + if (res.errMsg == 'requestPayment:cancel') return that.$util.Tips({ + title: '取消支付' + }); that.$emit('onChangeFun', { action: 'payClose' }); @@ -329,6 +392,16 @@ }); break; // #ifdef H5 + case "public": + uni.hideLoading(); + that.$emit('onChangeFun', { + action: 'payClose' + }); + //余额不足 + return that.$util.Tips({ + title: "下单成功,请上传付款凭证!" + }); + break; case 'h5': let host = window.location.protocol + "//" + window.location.host; let url = `${host}/pages/order_pay_status/index?order_id=${orderId}` @@ -355,7 +428,7 @@ icon: 'success' }, { tab: 5, - url: goPages + 'status=2' + url: goPages + 'status=1' }); }, @@ -392,7 +465,7 @@ border-radius: 16rpx 16rpx 0 0; background-color: #fff; padding-bottom: 60rpx; - z-index: 99999; + z-index: 99; transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9); transform: translate3d(0, 100%, 0); } diff --git a/components/popups/index.vue b/components/popups/index.vue index 4b9b696..1c18754 100644 --- a/components/popups/index.vue +++ b/components/popups/index.vue @@ -6,7 +6,7 @@ - 请输入支付密码 + {{title}} @@ -56,7 +56,11 @@ isPay: { //区分支付密码还是输入数字 type: Boolean, default: false - } + }, + title: { + type: String, + default: '请输入支付密码' + } }, data() { return { diff --git a/pages/index/index.vue b/pages/index/index.vue index 4ba3c6e..2cf9ad8 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -620,7 +620,7 @@ }, { name: '商户类型', type: 23, - image: require('@/static/images/index14.png') + image: require('@/static/images/index26.png') }, @@ -702,7 +702,7 @@ }, { name: '商户类型', type: 23, - image: require('@/static/images/index14.png') + image: require('@/static/images/index26.png') }, // { // name: '全部', @@ -752,7 +752,7 @@ }, { name: '商户类型', type: 23, - image: require('@/static/images/index14.png') + image: require('@/static/images/index26.png') }, { name: '扫码付款', diff --git a/pages/users/user_modify_pwd/index.vue b/pages/users/user_modify_pwd/index.vue index ca81fce..2e0ff8b 100644 --- a/pages/users/user_modify_pwd/index.vue +++ b/pages/users/user_modify_pwd/index.vue @@ -7,29 +7,43 @@ {{userInfo.phone}} - - - - - - - - - - + + + + + + + + + + + + + + + + - - - + + @@ -37,70 +51,75 @@ // +---------------------------------------------------------------------- // | CRMEB [ CRMEB赋能开发者,助力企业发展 ] // +---------------------------------------------------------------------- - // | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved. + // | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved. // +---------------------------------------------------------------------- // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 // +---------------------------------------------------------------------- // | Author: CRMEB Team // +---------------------------------------------------------------------- import sendVerifyCode from "@/mixins/SendVerifyCode"; - import { modifyPassword, verifyCode, appletsDecrypt } from '@/api/api.js'; - import { getUserInfo } from '@/api/user.js'; - import { registerVerify } from '@/api/user.js' + import { + modifyPassword, + verifyCode, + appletsDecrypt, + setPayPwd + } from '@/api/api.js'; + import { + getUserInfo + } from '@/api/user.js'; + import { + registerVerify + } from '@/api/user.js' import { mapGetters } from "vuex"; - import authorize from '@/components/Authorize'; - import Verify from '@/components/verify/verify.vue'; + import { + toLogin + } from '@/libs/login.js'; + import Verify from '@/components/verify/verify.vue'; + import popups from "@/components/popups/index.vue"; export default { mixins: [sendVerifyCode], components: { - authorize, - Verify + Verify, + popups }, data() { return { userInfo: {}, - phone:'', + phone: '', repassword: '', password: '', - captcha:'', - isAuto: false, //没有授权的不会自动授权 - isShowAuth: false, //是否隐藏授权 + captcha: '', key: '', codeVal: '', disabled: false, + type: '', + set_type: '', }; }, computed: mapGetters(['isLogin', 'viewColor']), - onLoad() { + onLoad(opt) { let that = this + this.type = opt.type; if (this.isLogin) { this.getUserInfo() } else { - this.isAuto = true; - this.isShowAuth = true + toLogin() } // #ifdef MP wx.login({ - success (res) { - if (res.code) { - that.codeVal = res.code - } else { - // console.log('登录失败!' + res.errMsg) - } - } + success(res) { + if (res.code) { + that.codeVal = res.code + } else { + console.log('登录失败!' + res.errMsg) + } + } }) // #endif }, methods: { - onLoadFun:function(){ - this.isShowAuth = false; - }, - // 授权关闭 - authColse: function(e) { - this.isShowAuth = e - }, /** * 获取个人用户信息 */ @@ -110,6 +129,19 @@ that.userInfo = res.data }); }, + showPopup(type){ + this.set_type = type; + this.$refs.popups.handleOpen(); + }, + // 输入密码回调 + handleConfirm(e) { + if(this.set_type==1)this.password = e; + else this.repassword = e; + }, + + handleClear() {}, + handleChange() {}, + confirmSubmit: function() { let that = this; if (!that.password) return that.$util.Tips({ @@ -124,23 +156,40 @@ if (!that.captcha) return that.$util.Tips({ title: '请填写验证码' }); - modifyPassword({ - password: that.password, - repassword: that.repassword, - sms_code: that.captcha - }).then(res => { - return that.$util.Tips({ - title: '修改成功!', - icon: 'success' - }, { - tab: 5, - url: '/pages/users/user_info/index' - }); - }).catch(err => { - return that.$util.Tips({ - title: err - }); - }) + + if (this.type == 'payPwd') { //支付提现密码 + setPayPwd({ + password: that.password, + repassword: that.repassword, + sms_code: that.captcha + }).then(res => { + that.$util.Tips({ + title: '修改成功!', + icon: 'success' + }) + this.$nextTick((res=>{ + uni.navigateBack(); + })) + }) + } else { // 登录密码 + modifyPassword({ + password: that.password, + repassword: that.repassword, + sms_code: that.captcha + }).then(res => { + return that.$util.Tips({ + title: '修改成功!', + icon: 'success' + }, { + tab: 5, + url: '/pages/users/user_info/index' + }); + }).catch(err => { + return that.$util.Tips({ + title: err + }); + }) + } }, /** * 发送验证码 @@ -153,10 +202,10 @@ // }); this.disabled = true await registerVerify({ - phone:that.userInfo.phone, - code:that.captcha, + phone: that.userInfo.phone, + code: that.captcha, type: 'change_pwd', - captchaType: 'blockPuzzle', + captchaType: 'blockPuzzle', captchaVerification: data.captchaVerification }).then(res => { this.disabled = false @@ -171,7 +220,7 @@ }); }); }, - success(data) { + success(data) { this.$refs.verify.hide(); this.code(data); }, @@ -183,10 +232,11 @@ + \ No newline at end of file diff --git a/static/images/index26.png b/static/images/index26.png new file mode 100644 index 0000000..1e847c9 Binary files /dev/null and b/static/images/index26.png differ