This commit is contained in:
zmj 2024-06-21 14:27:24 +08:00
parent c5af02d7c0
commit 4368d5965a
3 changed files with 50 additions and 34 deletions

View File

@ -24,9 +24,9 @@ export const brigadeListApi = (data) => {
} }
export const getMassageCode = (data) => { export const getMassageCode = (data) => {
return request.post('/brigade', data); return request.get('/user/user/send_sms', data);
} }
export const setPayPassword = (data) => { export const setPayPassword = (data) => {
return request.post('/brigade', data); return request.post('/user/user/set_payPassword', data);
} }

View File

@ -1,11 +1,15 @@
<template> <template>
<view class='card'> <view class='card'>
<up-input v-model="form.phone" placeholder="手机号" border="none"></up-input> <up-input v-model="form.phone" placeholder="手机号" border="none" readonly></up-input>
<up-line color="#D3E3FD" style="margin: 30rpx 0;"></up-line> <view style="margin: 30rpx 0;">
<up-line color="#D3E3FD"></up-line>
</view>
<view style="display: flex;justify-content: space-between;align-items: center;"> <view style="display: flex;justify-content: space-between;align-items: center;">
<up-input v-model="form.code" placeholder="验证码" border="none" type='number'></up-input> <up-input v-model="form.code" placeholder="验证码" border="none" type='number'></up-input>
<view class="code-btn"> <view class="code-btn">
<up-line color="grey" direction="col" length="30rpx" style="margin: 0 20rpx;"></up-line> <view style="margin: 0 20rpx;">
<up-line color="grey" direction="col" length="30rpx"></up-line>
</view>
<text class='btn-text' style="color: grey;" v-if='cutDown'>重新获取({{cutDown}})</text> <text class='btn-text' style="color: grey;" v-if='cutDown'>重新获取({{cutDown}})</text>
<text @click="getCode" class='btn-text' v-else> {{flag?'获取验证码':'重新获取' }} </text> <text @click="getCode" class='btn-text' v-else> {{flag?'获取验证码':'重新获取' }} </text>
</view> </view>
@ -17,7 +21,9 @@
<up-input style="pointer-events: none;" v-model="form.password" placeholder="请输入你的密码" border="none" <up-input style="pointer-events: none;" v-model="form.password" placeholder="请输入你的密码" border="none"
readonly></up-input> readonly></up-input>
</view> </view>
<up-line color="#D3E3FD" style="margin: 30rpx 0;"></up-line> <view style="margin: 30rpx 0;">
<up-line color="#D3E3FD"></up-line>
</view>
<view @click="showKeyBorad=true,type=2"> <view @click="showKeyBorad=true,type=2">
<up-input style="pointer-events: none;" v-model="form.rePassword" placeholder="请再次输入你的密码" border="none" <up-input style="pointer-events: none;" v-model="form.rePassword" placeholder="请再次输入你的密码" border="none"
readonly></up-input> readonly></up-input>
@ -61,7 +67,7 @@
const getCode = async () => { const getCode = async () => {
if (!checkPhone(phone.value)) return uni.$u.toast('请输入正确的手机号') if (!checkPhone(form.phone)) return uni.$u.toast('请输入正确的手机号')
await getMassageCode() await getMassageCode()
flag.value = false flag.value = false
cutDown.value = 10 cutDown.value = 10
@ -100,7 +106,9 @@
const submit = async () => { const submit = async () => {
if (!form.code) return uni.$u.toast('请输入验证码'); if (!form.code) return uni.$u.toast('请输入验证码');
if (form.password !== form.rePassword) return uni.$u.toast('两次密码不一致'); if (form.password !== form.rePassword) return uni.$u.toast('两次密码不一致');
await setPayPassword(...form) await setPayPassword({
...form
})
uni.$u.toast('设置成功') uni.$u.toast('设置成功')
setTimeout(() => { setTimeout(() => {
uni.navigateBack() uni.navigateBack()

View File

@ -154,9 +154,11 @@
@change="changeShop" @search="searchShop" /> @change="changeShop" @search="searchShop" />
<modal title="尚未设置收货地址" content="您还没有添加收货地址,请点击添加" cancleText="添加地址" confirmText="继续支付" :show="toastAddressShow" <modal title="尚未设置收货地址" content="您还没有添加收货地址,请点击添加" cancleText="添加地址" confirmText="继续支付" :show="toastAddressShow"
@close="addAddress" @change="goPay" /> @close="addAddress" @change="goPay" />
<ZyPasswordboard v-model:visible="passwordBoardVisible" v-bind="passwordBoardProps" /> <ZyPasswordboard v-if='passwordBoardVisible' v-model:visible="passwordBoardVisible" v-bind="passwordBoardProps"
<!-- <modal title="是否要拨打电话" :content="`即将拨打电话${phone}`" cancleText="取消" confirmText="拨打" :show="callShow" @close="callShow = false" @close='closeKeyBord' />
@change="onCall" /> --> <up-modal :show="showModal" title="您还没设置密码" :closeOnClickOverlay="true" zoom confirmText='去设置' showCancelButton
@close='showModal=false' @cancel='showModal=false' @confirm="navgo('/pagesOrder/setPayPassword/index')"
confirmColor='#27B52F' cancelText='取消'></up-modal>
</view> </view>
</template> </template>
@ -178,6 +180,7 @@
checkOrderApi checkOrderApi
} from "@/api/cart.js"; } from "@/api/cart.js";
import { import {
userInfoApi,
addressListsApi, addressListsApi,
merchantListApi merchantListApi
} from "@/api/user.js"; } from "@/api/user.js";
@ -298,14 +301,6 @@
const searchShop = (e) => { const searchShop = (e) => {
getMerchantList(e) getMerchantList(e)
} }
//
// const callShow = ref(false)
// const phone = ref('');
// const callphone = (e) => {
// callShow.value = true;
// phone.value = e;
// }
const onCall = (e) => { const onCall = (e) => {
uni.makePhoneCall({ uni.makePhoneCall({
phoneNumber: e, phoneNumber: e,
@ -361,30 +356,25 @@
// //
const passwordBoardVisible = ref(false); const passwordBoardVisible = ref(false);
const handleItemClick = () => {
passwordBoardVisible.value = true;
};
const passwordBoardProps = { const passwordBoardProps = {
title: '输入支付密码', title: '输入支付密码',
onComplete(value) { onComplete(value) {
console.log(value); password.value = value
passwordBoardVisible.value = false
payFn()
} }
}; };
const closeKeyBord = () => {
password.value = ''
const createOrder = () => {
if (!pay_type.value) return uni.$u.toast('请选择支付方式');
let shareInfo = uni.getStorageSync('SHARE_INFO');
if (pay_type.value == 3 || pay_type.value == 17) {
passwordBoardVisible.value = true
return
} }
const password = ref('')
const payFn = () => {
let shareInfo = uni.getStorageSync('SHARE_INFO');
createOrderApi({ createOrderApi({
password: password.value,
spread_uid: (shareInfo && shareInfo.uid) ? shareInfo.uid : '', spread_uid: (shareInfo && shareInfo.uid) ? shareInfo.uid : '',
cart_id: cartStore.cartList, cart_id: cartStore.cartList,
address_id: addressInfo.value.address_id, address_id: addressInfo.value.address_id,
@ -447,6 +437,24 @@
}) })
} }
const showModal = ref(false)
const navgo = (url) => {
showModal.value &&= false
uni.navigateTo({
url
})
}
const createOrder = async () => {
if (!pay_type.value) return uni.$u.toast('请选择支付方式');
if (pay_type.value == 3 || pay_type.value == 18) {
let res = await userInfoApi()
return res.data.pay_password ? passwordBoardVisible.value = true : showModal.value = true
}
payFn()
}
const c_price = (price, index = 0) => { const c_price = (price, index = 0) => {
price = price + ''; price = price + '';
return price.split('.')[index] || (index ? '00' : '0'); return price.split('.')[index] || (index ? '00' : '0');