feat(custom):
This commit is contained in:
@@ -27,9 +27,9 @@
|
||||
}
|
||||
|
||||
.nut-short-password {
|
||||
.nut-icon-tips {
|
||||
display: none;
|
||||
}
|
||||
// .nut-icon-tips {
|
||||
// display: none;
|
||||
// }
|
||||
|
||||
@for $i from 1 through 5 {
|
||||
.nut-short-password__item:nth-child(#{$i}) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<view class="flex flex-col items-center justify-center">
|
||||
<view class="mt-6 text-[#8C8C8C] text-[25px]"
|
||||
>交易剩余时间:{{ tStr }}</view
|
||||
>
|
||||
>交易剩余时间:{{ tStr }}
|
||||
</view>
|
||||
<view class="flex items-center mt-5 mb-5">
|
||||
<nut-price :price="orderData.price" size="large" />
|
||||
<view class="line"></view>
|
||||
@@ -31,7 +31,7 @@
|
||||
class="flex items-center"
|
||||
title="平台积分支付"
|
||||
:desc="`剩余积分:${orderData.User?.integral || 0}`"
|
||||
@click="cellClick(2, orderData.User?.integral === 0 ? true : false)">
|
||||
@click="cellClick(2, orderData.User?.integral === 0)">
|
||||
<template #icon>
|
||||
<IconFont size="30" :name="require('../../../static/pt.png')" />
|
||||
</template>
|
||||
@@ -45,7 +45,7 @@
|
||||
class="flex items-center"
|
||||
title="天才小猪积分支付"
|
||||
:desc="`剩余积分:${orderData.integral || 0}`"
|
||||
@click="cellClick(3, orderData.integral === 0 ? true : false)">
|
||||
@click="cellClick(3, orderData.integral === 0)">
|
||||
<template #icon>
|
||||
<IconFont size="30" :name="require('../../../static/jh.png')" />
|
||||
</template>
|
||||
@@ -64,13 +64,13 @@
|
||||
type="primary"
|
||||
block
|
||||
@click="pay"
|
||||
>确认支付</nut-button
|
||||
>
|
||||
>确认支付
|
||||
</nut-button>
|
||||
</view>
|
||||
|
||||
<nut-short-password
|
||||
title="请输入交易密码"
|
||||
tips=" "
|
||||
tips="忘记密码"
|
||||
desc=" "
|
||||
:error-msg="error_msg"
|
||||
v-model="shortVal"
|
||||
@@ -79,13 +79,23 @@
|
||||
:close-on-click-overlay="false"
|
||||
@focus="showKeyboard = true"
|
||||
@complete="shortComplete"
|
||||
@close="shortClose">
|
||||
@close="shortClose"
|
||||
@tips="onTips">
|
||||
</nut-short-password>
|
||||
<nut-number-keyboard
|
||||
v-model="shortVal"
|
||||
v-model:visible="showKeyboard"
|
||||
@blur="showKeyboard = false">
|
||||
</nut-number-keyboard>
|
||||
|
||||
<nut-dialog
|
||||
title="设置交易密码"
|
||||
content="您还未设置交易密码,请前往设置"
|
||||
cancel-text="选择其他支付方式"
|
||||
ok-text="设置交易密码"
|
||||
v-model:visible="visible2"
|
||||
@cancel="visible2 = false"
|
||||
@ok="onTips" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -96,6 +106,7 @@ import {onUnmounted, ref} from 'vue';
|
||||
import {getActiveOrderDetail, checkTradePwd} from '@/api/goods';
|
||||
import {getUserPoint} from '@/api/admin';
|
||||
import {payOrder} from '@/api/order';
|
||||
import {isCheckTradePwd} from '@/api/user';
|
||||
import * as dayjs from 'dayjs';
|
||||
|
||||
const payVal = ref();
|
||||
@@ -116,6 +127,8 @@ const showKeyboard = ref(false);
|
||||
|
||||
const isLoading = ref(false);
|
||||
|
||||
const visible2 = ref(false);
|
||||
|
||||
const opt = ref<any>({});
|
||||
|
||||
Taro.useLoad(e => {
|
||||
@@ -152,10 +165,16 @@ const pay = async () => {
|
||||
if (!payVal.value)
|
||||
return Taro.showToast({title: '请选择支付方式', icon: 'none'});
|
||||
if (payVal.value !== 1) {
|
||||
visible.value = true;
|
||||
showKeyboard.value = true;
|
||||
const res = await isCheckTradePwd();
|
||||
if (res.data.pay_password) {
|
||||
visible.value = true;
|
||||
showKeyboard.value = true;
|
||||
} else {
|
||||
isLoading.value = false;
|
||||
visible2.value = true;
|
||||
}
|
||||
} else {
|
||||
confirmPay();
|
||||
await confirmPay();
|
||||
}
|
||||
} catch (error) {
|
||||
isLoading.value = false;
|
||||
@@ -172,7 +191,7 @@ const shortComplete = async value => {
|
||||
pay_password: value,
|
||||
});
|
||||
shortClose(false);
|
||||
confirmPay();
|
||||
await confirmPay();
|
||||
} catch (error) {
|
||||
error_msg.value = error.msg;
|
||||
shortVal.value = '';
|
||||
@@ -208,7 +227,7 @@ const confirmPay = async () => {
|
||||
});
|
||||
},
|
||||
complete: function () {
|
||||
Taro.navigateTo({
|
||||
Taro.redirectTo({
|
||||
url: `/pages/users/order_list_detail/index?orderId=${opt.value.oid}`,
|
||||
});
|
||||
},
|
||||
@@ -226,7 +245,7 @@ const confirmPay = async () => {
|
||||
icon: 'none',
|
||||
});
|
||||
setTimeout(() => {
|
||||
Taro.navigateTo({
|
||||
Taro.redirectTo({
|
||||
url: `/pages/users/order_list_detail/index?orderId=${opt.value.oid}`,
|
||||
});
|
||||
}, 2000);
|
||||
@@ -273,6 +292,12 @@ const countdownTime = () => {
|
||||
}, 1000);
|
||||
};
|
||||
|
||||
const onTips = () => {
|
||||
Taro.redirectTo({
|
||||
url: '/pages/users/pwd/index',
|
||||
});
|
||||
};
|
||||
|
||||
Taro.useDidHide(() => {
|
||||
clearInterval(t_id.value);
|
||||
});
|
||||
|
||||
@@ -150,7 +150,7 @@ const userLocalNum = ref({
|
||||
t: 0,
|
||||
});
|
||||
|
||||
Taro.useLoad(async () => {
|
||||
Taro.useDidShow(async () => {
|
||||
Taro.getLocation({
|
||||
type: 'wgs84',
|
||||
success: res => {
|
||||
|
||||
3
src/pages/users/pwd/index.config.ts
Normal file
3
src/pages/users/pwd/index.config.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '交易密码',
|
||||
});
|
||||
29
src/pages/users/pwd/index.scss
Normal file
29
src/pages/users/pwd/index.scss
Normal file
@@ -0,0 +1,29 @@
|
||||
.form {
|
||||
background-color: #fff;
|
||||
margin-top: 20px;
|
||||
padding: 25px 0;
|
||||
|
||||
.form-item {
|
||||
display: flex;
|
||||
padding: 20px 30px;
|
||||
align-items: center;
|
||||
|
||||
.form-item-label {
|
||||
font-size: 28px;
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
.form-item-content {
|
||||
flex: 1;
|
||||
border-bottom: rgba(232, 232, 232, 1) 1px solid;
|
||||
padding: 10px 0;
|
||||
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
.nut-button {
|
||||
border-radius: 20px;
|
||||
}
|
||||
146
src/pages/users/pwd/index.vue
Normal file
146
src/pages/users/pwd/index.vue
Normal file
@@ -0,0 +1,146 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="form">
|
||||
<view class="form-item">
|
||||
<view class="form-item-label">
|
||||
<text>设置密码:</text>
|
||||
</view>
|
||||
<view class="form-item-content">
|
||||
<input
|
||||
type="password"
|
||||
maxLength="6"
|
||||
placeholder="请输入6位数交易密码"
|
||||
v-model="formVal.password"
|
||||
placeholder-style="color:rgba(176, 176, 176, 1);font-size: 20px;" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="form-item">
|
||||
<view class="form-item-label">
|
||||
<text>确认密码:</text>
|
||||
</view>
|
||||
<view class="form-item-content">
|
||||
<input
|
||||
type="password"
|
||||
maxLength="6"
|
||||
v-model="formVal.confirmPassword"
|
||||
placeholder="请再次输入6位数密码"
|
||||
placeholder-style="color:rgba(176, 176, 176, 1);font-size: 20px;" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="form-item">
|
||||
<view class="form-item-label">
|
||||
<text>手机号码:</text>
|
||||
</view>
|
||||
<view class="form-item-content">
|
||||
<input
|
||||
type="text"
|
||||
placeholder="请输入手机号码"
|
||||
:disabled="true"
|
||||
:value="userinfo.data?.phone"
|
||||
placeholder-style="color:rgba(176, 176, 176, 1);font-size: 20px;" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="form-item">
|
||||
<view class="form-item-label">
|
||||
<text>验证码:</text>
|
||||
</view>
|
||||
<view class="form-item-content">
|
||||
<input
|
||||
type="text"
|
||||
placeholder="请输入验证码"
|
||||
maxLength="6"
|
||||
v-model="formVal.code"
|
||||
placeholder-style="color:rgba(176, 176, 176, 1);font-size: 20px;" />
|
||||
<text
|
||||
:style="{
|
||||
color: !isT ? '#F83D3D' : 'rgba(176, 176, 176, 1)',
|
||||
}"
|
||||
@tap="getCode"
|
||||
>{{ codeText }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="w-[90%] mt-[80px] mx-auto">
|
||||
<nut-button shape="square" type="primary" block @click="formSubmit"
|
||||
>确认修改
|
||||
</nut-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {ref} from 'vue';
|
||||
import Taro from '@tarojs/taro';
|
||||
import {editTradePwd, getVerifyCode} from '@/api/user';
|
||||
|
||||
const userinfo = ref<any>({});
|
||||
|
||||
const codeText = ref('获取验证码');
|
||||
|
||||
const isT = ref(false);
|
||||
|
||||
const formVal = ref({
|
||||
password: '',
|
||||
confirmPassword: '',
|
||||
code: '',
|
||||
});
|
||||
|
||||
const xFormVal = ref({
|
||||
oldPassword: '',
|
||||
password: '',
|
||||
confirmPassword: '',
|
||||
code: '',
|
||||
});
|
||||
|
||||
Taro.useLoad(() => {
|
||||
userinfo.value = Taro.getStorageSync('userInfo');
|
||||
});
|
||||
|
||||
const formSubmit = async () => {
|
||||
try {
|
||||
if (!formVal.value.password)
|
||||
return Taro.showToast({title: '请输入交易密码', icon: 'none'});
|
||||
if (!formVal.value.confirmPassword)
|
||||
return Taro.showToast({title: '请再次输入交易密码', icon: 'none'});
|
||||
if (formVal.value.password !== formVal.value.confirmPassword)
|
||||
return Taro.showToast({title: '两次密码不一致', icon: 'none'});
|
||||
if (!formVal.value.code)
|
||||
return Taro.showToast({title: '请输入验证码', icon: 'none'});
|
||||
const res = await editTradePwd({
|
||||
pay_password: formVal.value.password,
|
||||
code: formVal.value.code,
|
||||
});
|
||||
Taro.showToast({title: res.msg, icon: 'none'});
|
||||
Taro.navigateBack({
|
||||
delta: 1,
|
||||
});
|
||||
} catch (err) {
|
||||
Taro.showToast({title: err.msg, icon: 'none'});
|
||||
}
|
||||
};
|
||||
|
||||
const getCode = async () => {
|
||||
if (isT.value) return;
|
||||
isT.value = true;
|
||||
await getVerifyCode({
|
||||
phone: userinfo.value.data?.phone,
|
||||
});
|
||||
// 倒计时60s
|
||||
let time = 60;
|
||||
const timer = setInterval(() => {
|
||||
if (time === 0) {
|
||||
clearInterval(timer);
|
||||
isT.value = false;
|
||||
codeText.value = '获取验证码';
|
||||
} else {
|
||||
codeText.value = `${time}s后重新获取`;
|
||||
time--;
|
||||
}
|
||||
}, 1000);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import './index.scss';
|
||||
</style>
|
||||
@@ -41,12 +41,22 @@ const clickText = (type: number, text: string) => {
|
||||
title="个人信息"
|
||||
is-link
|
||||
@click="toPage('/pages/users/user_setting/index')"></nut-cell>
|
||||
<nut-cell title="服务协议" is-link @click="clickText(1, '用户协议')"></nut-cell>
|
||||
<nut-cell title="隐私政策协议" is-link @click="clickText(2, '隐私政策')"></nut-cell>
|
||||
<nut-cell
|
||||
title="服务协议"
|
||||
is-link
|
||||
@click="clickText(1, '用户协议')"></nut-cell>
|
||||
<nut-cell
|
||||
title="隐私政策协议"
|
||||
is-link
|
||||
@click="clickText(2, '隐私政策')"></nut-cell>
|
||||
<nut-cell
|
||||
title="平台积分使用规则"
|
||||
is-link
|
||||
@click="clickText(3, '积分使用规则')"></nut-cell>
|
||||
<nut-cell
|
||||
title="修改交易密码"
|
||||
is-link
|
||||
@click="toPage('/pages/users/pwd/index')"></nut-cell>
|
||||
</nut-cell-group>
|
||||
<view class="w-[90%] m-auto">
|
||||
<nut-button
|
||||
|
||||
@@ -94,7 +94,7 @@ const subUser = async () => {
|
||||
placeholder="修改登录密码" />
|
||||
</template>
|
||||
</nut-cell> -->
|
||||
<nut-cell title="交易密码" desc="创建/修改交易密码" is-link> </nut-cell>
|
||||
<!-- <nut-cell title="交易密码" desc="创建/修改交易密码" is-link> </nut-cell> -->
|
||||
<!-- <nut-cell title="注销账号" desc="账号注销后不能恢复" is-link> </nut-cell> -->
|
||||
</nut-cell-group>
|
||||
<view class="btn">
|
||||
|
||||
Reference in New Issue
Block a user