This commit is contained in:
messi
2024-08-27 18:03:10 +08:00
parent dbd2d70005
commit bdd78601de
3 changed files with 29 additions and 29 deletions

View File

@@ -111,7 +111,8 @@
<u-input v-model="dealerPhone" :disabled="disabled" placeholder="请输入推荐人手机号" />
</view>
<view class="submit">
<image style="width: 7rem;margin: 0 auto;" @click="onBuy" src="@/static/zhimamianya.png" mode="widthFix"></image>
<image style="width: 7rem;margin: 0 auto;" @click="onBuy" src="@/static/zhimamianya.png" mode="widthFix">
</image>
<!-- <u-button type="primary" :disabled="!agree" @click="onBuy">立即下单</u-button> -->
</view>
<!-- <view class="submit">
@@ -258,7 +259,7 @@
},
async onBuy() {
const app = this
if(!this.agree){
if (!this.agree) {
app.$error("请先同意租赁合同和隐私协议!")
return
}
@@ -267,8 +268,7 @@
dealerPhone
} = this
let total = 0.0
uni.showLoading({
})
uni.showLoading({})
// 未登录状态
if (!uni.getStorageSync('userId')) {
app.$error('请先登录', function() {
@@ -278,13 +278,18 @@
}
const userRes = await getUser()
const user = userRes.data
if(user.phone==dealerPhone&&dealerPhone!=''){
app.$error('不可以填写自己的手机号')
uni.hideLoading({})
return false;
}
if(record.equipmentCategory == 10) {
if (record.equipmentCategory == 10) {
total = record.batteryPrice
}else if(record.equipmentCategory == 20) {
} else if (record.equipmentCategory == 20) {
total = record.downPayment + record.serviceCharges
}else if(record.equipmentCategory == 30 || record.equipmentCategory == 40){
} else if (record.equipmentCategory == 30 || record.equipmentCategory == 40) {
total = record.batteryRent
}
total = total.toFixed(2)
@@ -293,7 +298,7 @@
var time = new Date().getTime() + 60 * 60 * 1000 * 24
const expirationTime = dateFormat('YYYY-mm-dd HH:MM:SS', new Date(time))
app.expirationTime = expirationTime
addOrder({
orderNo: createOrderNo(),
merchantCode: record.merchantCode,
@@ -325,20 +330,17 @@
complete: () => {
checkFreeze(orderId).then((res) => {
console.log(record.equipmentCategory + ": " + res)
if(res.code == 0){
if (res.code == 0) {
app.$success("下单成功")
setTimeout(() => {
uni.hideLoading({
})
uni.hideLoading({})
uni.redirectTo({
url: '/pages/order/index'
})
}, 100)
}
else {
} else {
app.$error(res.errMsg)
uni.hideLoading({
})
uni.hideLoading({})
}
})
@@ -346,19 +348,16 @@
});
} else {
checkFreeze(orderId).then((res) => {
if(res.code == 0){
if (res.code == 0) {
app.$success("下单成功")
setTimeout(() => {
uni.hideLoading({
})
uni.hideLoading({})
uni.redirectTo({
url: '/pages/order/index'
})
}, 100)
}
else {
uni.hideLoading({
})
} else {
uni.hideLoading({})
app.$error(res.errMsg)
}
})