Compare commits
3 Commits
222dd08ee9
...
f4e040e0a8
Author | SHA1 | Date | |
---|---|---|---|
![]() |
f4e040e0a8 | ||
![]() |
7f13e6cbcb | ||
![]() |
ca98b5c60e |
@ -30,8 +30,14 @@
|
||||
<view class="bm-page-info-title">
|
||||
选择教练
|
||||
</view>
|
||||
<view class="d-s" @click="!jlId && (showjl = true)"
|
||||
:style="{color: jlId ? '#999' : '', pointerEvents: jlId ? 'none' : ''}">
|
||||
<view class="d-s" v-if="localCoachId"
|
||||
:style="{color: localCoachId ? '#999' : '', pointerEvents: localCoachId ? 'none' : ''}">
|
||||
<view class="" v-if="!jlName">请选择</view>
|
||||
<view class="" v-else>{{ jlName }}</view>
|
||||
<u-icon name="arrow-right" size="16" :color="jlId ? '#999' : ''"></u-icon>
|
||||
</view>
|
||||
<view class="d-s" @click="showjl = true" v-else
|
||||
:style="{color: localCoachId ? '#999' : '', pointerEvents: localCoachId ? 'none' : ''}">
|
||||
<view class="" v-if="!jlName">请选择</view>
|
||||
<view class="" v-else>{{ jlName }}</view>
|
||||
<u-icon name="arrow-right" size="16" :color="jlId ? '#999' : ''"></u-icon>
|
||||
@ -155,7 +161,12 @@ import headers from '../../components/header/headers.vue'
|
||||
import request from '@/utils/request.js'
|
||||
import tabbar from '../../components/tabbar/tabbar.vue'
|
||||
import upload from '@/utils/upload.js'
|
||||
import {getCoachId, getLocalUserInfo,getStaffType,getToken} from '../../utils/auth'
|
||||
import {
|
||||
getCoachId,
|
||||
getLocalUserInfo,
|
||||
getStaffType,
|
||||
getToken
|
||||
} from '../../utils/auth'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@ -238,6 +249,7 @@ export default {
|
||||
this.userinfo = getLocalUserInfo()
|
||||
this.localStaffType = getStaffType()
|
||||
this.localCoachId = getCoachId()
|
||||
console.log('localCoachId', this.localCoachId);
|
||||
},
|
||||
onShow() {
|
||||
this.getListAll()
|
||||
@ -277,9 +289,9 @@ export default {
|
||||
methods: {
|
||||
// 定金价格 or 全款价格
|
||||
updateDisplayPrice() {
|
||||
this.currentPrice = this.selectedPayType === 1
|
||||
? this.rightInfoList.reserveMoney
|
||||
: this.rightInfoList.price;
|
||||
this.currentPrice = this.selectedPayType === 1 ?
|
||||
this.rightInfoList.reserveMoney :
|
||||
this.rightInfoList.price;
|
||||
},
|
||||
|
||||
// 教练信息
|
||||
@ -329,6 +341,8 @@ export default {
|
||||
if (defaultCoach) {
|
||||
this.jlName = defaultCoach.coachName;
|
||||
this.jlId = defaultCoach.coachId;
|
||||
} else {
|
||||
this.localCoachId = null
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -452,19 +466,31 @@ export default {
|
||||
// 表单校验
|
||||
async validateForm() {
|
||||
if (!this.sfzimg) {
|
||||
uni.showToast({title: '请上传身份证照片', icon: 'error'});
|
||||
uni.showToast({
|
||||
title: '请上传身份证照片',
|
||||
icon: 'error'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if (!this.phone || !this.name || !this.identity) {
|
||||
uni.showToast({title: '请输入完整信息', icon: 'error'});
|
||||
uni.showToast({
|
||||
title: '请输入完整信息',
|
||||
icon: 'error'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if (!this.isValidPhoneNumber(this.phone)) {
|
||||
uni.showToast({title: '手机号不规范', icon: 'error'});
|
||||
uni.showToast({
|
||||
title: '手机号不规范',
|
||||
icon: 'error'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if (!this.isValidIDNumber(this.identity)) {
|
||||
uni.showToast({title: '身份证不规范', icon: 'error'});
|
||||
uni.showToast({
|
||||
title: '身份证不规范',
|
||||
icon: 'error'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -478,7 +504,9 @@ export default {
|
||||
try {
|
||||
// 1. 基础校验
|
||||
if (!this.checkLogin()) {
|
||||
uni.navigateTo({url: '/pages/login/login'});
|
||||
uni.navigateTo({
|
||||
url: '/pages/login/login'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!await this.validateForm()) return;
|
||||
@ -500,7 +528,10 @@ export default {
|
||||
await this.createNewOrder();
|
||||
} catch (error) {
|
||||
if (!error.message.includes('cancel')) {
|
||||
uni.showToast({title: error.message || '操作失败', icon: 'none'});
|
||||
uni.showToast({
|
||||
title: error.message || '操作失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
} finally {
|
||||
this.loading = false;
|
||||
@ -647,17 +678,20 @@ export default {
|
||||
}, */
|
||||
|
||||
async processExistingOrder() {
|
||||
uni.showLoading({title: '准备支付...', mask: true});
|
||||
uni.showLoading({
|
||||
title: '准备支付...',
|
||||
mask: true
|
||||
});
|
||||
|
||||
try {
|
||||
// 1. 准备当前数据
|
||||
const payType = this.selectedPayType;
|
||||
const reserveMoney = payType === 1
|
||||
? this.rightInfoList.reserveMoney
|
||||
: this.rightInfoList.price;
|
||||
const restMoney = payType === 1
|
||||
? this.rightInfoList.price - reserveMoney
|
||||
: 0;
|
||||
const reserveMoney = payType === 1 ?
|
||||
this.rightInfoList.reserveMoney :
|
||||
this.rightInfoList.price;
|
||||
const restMoney = payType === 1 ?
|
||||
this.rightInfoList.price - reserveMoney :
|
||||
0;
|
||||
|
||||
// 2. 获取并对比订单数据
|
||||
const orderDetail = await this.getOrderDetail(this.orderId);
|
||||
@ -789,7 +823,8 @@ export default {
|
||||
resolve(res.errMsg === 'requestPayment:ok' ? 'success' : 'fail');
|
||||
},
|
||||
fail: (err) => {
|
||||
resolve(err.errMsg === 'requestPayment:fail cancel' ? 'cancelled' : 'fail');
|
||||
resolve(err.errMsg === 'requestPayment:fail cancel' ? 'cancelled' :
|
||||
'fail');
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -797,13 +832,16 @@ export default {
|
||||
|
||||
// 创建新订单
|
||||
async createNewOrder() {
|
||||
uni.showLoading({title: '创建订单中...', mask: true});
|
||||
uni.showLoading({
|
||||
title: '创建订单中...',
|
||||
mask: true
|
||||
});
|
||||
try {
|
||||
if (this.startPay === 1) {
|
||||
const payType = this.selectedPayType;
|
||||
const reserveMoney = payType === 1
|
||||
? this.rightInfoList.reserveMoney
|
||||
: this.rightInfoList.price;
|
||||
const reserveMoney = payType === 1 ?
|
||||
this.rightInfoList.reserveMoney :
|
||||
this.rightInfoList.price;
|
||||
this.payPrice = reserveMoney
|
||||
await this.wxPayClick(
|
||||
this.name,
|
||||
@ -977,7 +1015,10 @@ export default {
|
||||
checkLogin() {
|
||||
const token = uni.getStorageSync('App-Token');
|
||||
if (!token) {
|
||||
uni.showToast({title: '请先登录', icon: 'none'});
|
||||
uni.showToast({
|
||||
title: '请先登录',
|
||||
icon: 'none'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user