This commit is contained in:
weipengfei 2024-03-22 16:02:41 +08:00
parent 57b2bc9b59
commit dd2396275a
6 changed files with 256 additions and 115 deletions

View File

@ -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');

View File

@ -5,7 +5,7 @@
选择付款方式<text class="iconfont icon-guanbi" @click='close'></text>
</view>
<view class="item acea-row row-between-wrapper" @click='goPay(item.number || 0 , item.value)'
v-for="(item,index) in payMode" :key="index" v-if="item.payStatus == 1">
v-for="(item,index) in payMode" v-if="item.payStatus==1" :key="index">
<view class="left acea-row row-between-wrapper">
<view class="iconfont" :class="item.icon"></view>
<view class="text">
@ -20,6 +20,12 @@
</view>
</view>
<view class="mask" ref="close" @click='close' v-if="pay_close"></view>
<!-- 支付密码 键盘 -->
<popups ref="popups" :isPay="true" @confirm="handleConfirm" @clear="handleClear" @change="handleChange" />
<!-- 密码错误事件处理 -->
<payPwd ref="payPwd" @left="handleLeft" @right="handleRight"></payPwd>
</view>
</template>
@ -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 CRMEBCRMEB
// +----------------------------------------------------------------------
@ -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);
}

View File

@ -6,7 +6,7 @@
<view class="paybox" v-if="isPay">
<view class="paybox-title">
<view class="paybox-title-left"></view>
<view class="paybox-title-middle">请输入支付密码</view>
<view class="paybox-title-middle">{{title}}</view>
<view class="paybox-titler-right" @click="handleClose">
<u-icon name="close" size="18" color="#666" />
</view>
@ -56,7 +56,11 @@
isPay: { //
type: Boolean,
default: false
}
},
title: {
type: String,
default: '请输入支付密码'
}
},
data() {
return {

View File

@ -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: '扫码付款',

View File

@ -7,29 +7,43 @@
<view class="item">
<text class="phone">{{userInfo.phone}}</text>
</view>
<view class="item acea-row row-between-wrapper codeVal">
<input type='number' placeholder='验证码' placeholder-class='placeholder' class="codeIput" v-model="captcha"></input>
<button class="code" :class="disabled === true ? 'on' : ''" :disabled='disabled' @click="handleVerify">
<input type='number' maxlength="4" placeholder='验证码' placeholder-class='placeholder' class="codeIput"
v-model="captcha"></input>
<button class="code" :class="disabled === true ? 'on' : ''" :disabled='disabled'
@click="handleVerify">
{{ text }}
</button>
</view>
<view class="border"></view>
<view class="item">
<input type='password' placeholder='新密码' placeholder-class='placeholder' v-model="password" autocomplete="off"></input>
</view>
<view class="item">
<input type='password' placeholder='确认新密码' placeholder-class='placeholder' v-model="repassword" autocomplete="off"></input>
</view>
<block v-if="type == 'payPwd'">
<view class="item" @click="showPopup(1)">
<input style="pointer-events: none;" type='password' placeholder="请设置支付密码"
placeholder-class='placeholder' v-model="password" autocomplete="off"></input>
</view>
<view class="item" @click="showPopup(2)">
<input style="pointer-events: none;" type='password' placeholder="请再次设置支付密码"
placeholder-class='placeholder' v-model="repassword" autocomplete="off"></input>
</view>
</block>
<block v-else>
<view class="item">
<input type='password' placeholder="请设置密码"
placeholder-class='placeholder' v-model="password" autocomplete="off"></input>
</view>
<view class="item">
<input type='password' placeholder="请再次设置密码"
placeholder-class='placeholder' v-model="repassword" autocomplete="off"></input>
</view>
</block>
</view>
</view>
<button form-type="submit" @click="confirmSubmit" class="confirmBnt">确认</button>
</view>
</form>
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<Verify @success="success" :captchaType="'blockPuzzle'" :imgSize="{ width: '330px', height: '155px' }" ref="verify"></Verify>
<Verify @success="success" :captchaType="'blockPuzzle'" :imgSize="{ width: '330px', height: '155px' }"
ref="verify"></Verify>
<popups ref="popups" isPay title="请设置支付密码" @confirm="handleConfirm" @clear="handleClear" @change="handleChange"></popups>
</view>
</template>
@ -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 CRMEBCRMEB
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
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 @@
</script>
<style lang="scss" scoped>
.ChangePassword{
.ChangePassword {
background: #fff;
padding-top: 53rpx;
}
.ChangePassword .phone {
font-size: 32rpx;
}
@ -205,7 +255,8 @@
font-size: 32rpx;
}
/deep/.uni-input-input{
/deep/.uni-input-input {
// box-shadow: inset 0 0 0 0 #fff;
}
@ -222,7 +273,8 @@
position: relative;
padding-left: 26rpx;
color: var(--view-theme);
&::before{
&::before {
content: "";
width: 1rpx;
height: 30rpx;
@ -233,14 +285,17 @@
display: inline-block;
}
}
.ChangePassword .list .item .code.on {
color: #b9b9bc !important;
}
.ChangePassword .list .border{
.ChangePassword .list .border {
width: 100%;
height: 21rpx;
background: #F5F5F5;
}
.confirmBnt {
font-size: 32rpx;
width: 580rpx;
@ -252,7 +307,8 @@
line-height: 90rpx;
background-color: var(--view-theme);
}
.getPhoneBtn{
.getPhoneBtn {
font-size: 32rpx;
width: 580rpx;
height: 90rpx;
@ -262,7 +318,8 @@
margin: 40rpx auto 0 auto;
text-align: center;
line-height: 90rpx;
.iconfont{
.iconfont {
font-size: 32rpx;
margin-right: 12rpx;
}

BIN
static/images/index26.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB