feat(custom):
This commit is contained in:
@@ -51,7 +51,7 @@ const config = {
|
||||
prebundle: {enable: false},
|
||||
},
|
||||
cache: {
|
||||
enable: true, // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache
|
||||
enable: false, // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache
|
||||
},
|
||||
sass: {
|
||||
data: `@import "@nutui/nutui-taro/dist/styles/variables.scss";`,
|
||||
|
||||
@@ -1,81 +1,89 @@
|
||||
import request from "@/utils/request";
|
||||
import request from '@/utils/request';
|
||||
|
||||
// 获取用户协议
|
||||
export const getAgreement = () => request("/user/agreement", {}, "POST");
|
||||
export const getAgreement = () => request('/user/agreement', {}, 'POST');
|
||||
|
||||
// 登录
|
||||
export const login = (data: object) => request("/login", data, "POST");
|
||||
export const login = (data: object) => request('/login', data, 'POST');
|
||||
export const phoneLogin = (data: object) =>
|
||||
request("/phone/login", data, "POST");
|
||||
request('/phone/login', data, 'POST');
|
||||
|
||||
// 获取用户信息
|
||||
// export const getUserInfo = () => request("/user/detail", {}, "GET");
|
||||
|
||||
// 获取短信验证码
|
||||
export const getVerifyCode = (data: object) =>
|
||||
request("/getSmsCode", data, "POST");
|
||||
request('/getSmsCode', data, 'POST');
|
||||
|
||||
// 商家入驻申请
|
||||
export const applyMer = (data: object) =>
|
||||
request("/store/settle", data, "POST");
|
||||
request('/store/settle', data, 'POST');
|
||||
|
||||
// 获取商家类型列表
|
||||
export const getMerTypeList = () => request("/store/getOther", {}, "POST");
|
||||
export const getMerTypeList = () => request('/store/getOther', {}, 'POST');
|
||||
|
||||
// 获取个人信息
|
||||
export const getPersonalInfo = () => request("/user/info", {}, "POST");
|
||||
export const getPersonalInfo = () => request('/user/info', {}, 'POST');
|
||||
|
||||
// 获取轮播图
|
||||
export const getBanner = () => request("/rotation", {}, "POST");
|
||||
export const getBanner = () => request('/rotation', {}, 'POST');
|
||||
|
||||
// 获取积分订单列表
|
||||
export const getIntegralOrderList = (data: object) =>
|
||||
request("/user/pointOrder", data, "POST");
|
||||
request('/user/pointOrder', data, 'POST');
|
||||
|
||||
// 修改个人信息
|
||||
export const editPersonalInfo = (data: object) =>
|
||||
request("/user/editInfo", data, "POST");
|
||||
request('/user/editInfo', data, 'POST');
|
||||
|
||||
// 积分明细
|
||||
export const getIntegralDetail = (data: object) =>
|
||||
request("/user/pulseRecord", data, "POST");
|
||||
request('/user/pulseRecord', data, 'POST');
|
||||
|
||||
// 豆子明细
|
||||
export const getBeanDetail = (data: object) =>
|
||||
request("/user/pointRecord", data, "POST");
|
||||
request('/user/pointRecord', data, 'POST');
|
||||
|
||||
// 授权手机号
|
||||
export const getPhone = (data: object) =>
|
||||
request("/user/getPhone", data, "POST");
|
||||
request('/user/getPhone', data, 'POST');
|
||||
|
||||
// 获取推广积分明细
|
||||
export const getTGIntegralDetail = (data: object) =>
|
||||
request("/user/referee/point", data, "POST");
|
||||
request('/user/referee/point', data, 'POST');
|
||||
|
||||
// 获取推广用户列表
|
||||
export const getTGUserList = (data: object) =>
|
||||
request("/user/referee/list", data, "POST");
|
||||
request('/user/referee/list', data, 'POST');
|
||||
|
||||
// 绑定上级
|
||||
export const bindParent = (data: object) =>
|
||||
request("/user/bindCode", data, "POST");
|
||||
request('/user/bindCode', data, 'POST');
|
||||
|
||||
// 获取推广码
|
||||
export const getRefereeCode = () => request("/user/promotion", {}, "POST");
|
||||
export const getRefereeCode = () => request('/user/promotion', {}, 'POST');
|
||||
|
||||
// 取消订单返回积分
|
||||
export const qxOrder = (data: object) =>
|
||||
request("/user/point/off", data, "POST");
|
||||
request('/user/point/off', data, 'POST');
|
||||
|
||||
// 用户签到
|
||||
export const userSign = () => request("/sign/user", {}, "POST");
|
||||
export const userSign = () => request('/sign/user', {}, 'POST');
|
||||
|
||||
// 获取签到记录
|
||||
export const getSignRecord = () => request("/sign/pulse/count", {}, "POST");
|
||||
export const getSignRecord = () => request('/sign/pulse/count', {}, 'POST');
|
||||
|
||||
// 获取赠送总记录
|
||||
export const getGiftRecord = (data: object) =>
|
||||
request("/user/giftPulseRecord", data, "POST");
|
||||
request('/user/giftPulseRecord', data, 'POST');
|
||||
|
||||
// 修改交易密码
|
||||
export const editTradePwd = (data: object) =>
|
||||
request('/user/edit/payPassword', data, 'POST');
|
||||
|
||||
// 检查是否有交易密码
|
||||
export const isCheckTradePwd = () =>
|
||||
request('/user/find/payPassword', {}, 'POST');
|
||||
|
||||
/**
|
||||
* 用户后结订单
|
||||
@@ -83,8 +91,8 @@ export const getGiftRecord = (data: object) =>
|
||||
|
||||
// 获取用户后结订单列表
|
||||
export const getUserAfterOrderList = (data: object) =>
|
||||
request("/later/user/order", data, "POST");
|
||||
request('/later/user/order', data, 'POST');
|
||||
|
||||
// 获取用户后结订单详情
|
||||
export const getUserAfterOrderDetail = (data: object) =>
|
||||
request("/later/order/details", data, "POST");
|
||||
request('/later/order/details', data, 'POST');
|
||||
|
||||
@@ -27,6 +27,7 @@ export default defineAppConfig({
|
||||
'bindPhone/index',
|
||||
'pending_order/index',
|
||||
'pending_order/pending_order_detail/index',
|
||||
'pwd/index',
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -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