修改申请租赁页面能够一次租赁n台设备
This commit is contained in:
parent
8c16aef2a4
commit
50adb93820
|
|
@ -58,6 +58,7 @@ export function getPeriodPackages(suitIds) {
|
||||||
* @param {string} orderData.appId - 应用ID
|
* @param {string} orderData.appId - 应用ID
|
||||||
* @param {string} orderData.payAmount - 支付金额
|
* @param {string} orderData.payAmount - 支付金额
|
||||||
* @param {string} orderData.channelId - 渠道ID
|
* @param {string} orderData.channelId - 渠道ID
|
||||||
|
* @param {string} orderData.quantity - 设备数量
|
||||||
* @returns {Promise} 返回订单创建结果
|
* @returns {Promise} 返回订单创建结果
|
||||||
*/
|
*/
|
||||||
export function createLeaseOrder(orderData) {
|
export function createLeaseOrder(orderData) {
|
||||||
|
|
|
||||||
|
|
@ -68,11 +68,15 @@
|
||||||
<!-- 租赁设备 -->
|
<!-- 租赁设备 -->
|
||||||
<view class="form-item">
|
<view class="form-item">
|
||||||
<text class="field-label">租赁设备</text>
|
<text class="field-label">租赁设备</text>
|
||||||
<view class="selector" @click="selectEquipment">
|
<view class="selector">
|
||||||
<text :class="['selector-text', { placeholder: !formData.equipment }]">
|
<text
|
||||||
|
:class="['selector-text', { placeholder: !formData.equipment }]"
|
||||||
|
@click="selectEquipment"
|
||||||
|
>
|
||||||
{{ formData.equipment || '选择设备类型' }}
|
{{ formData.equipment || '选择设备类型' }}
|
||||||
</text>
|
</text>
|
||||||
<text class="arrow-icon">></text>
|
<text class="arrow-icon" @click="selectEquipment">></text>
|
||||||
|
<uv-number-box v-model="formData.quantity"></uv-number-box>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
@ -92,7 +96,7 @@
|
||||||
<!-- 支付区域 -->
|
<!-- 支付区域 -->
|
||||||
<view class="payment-section">
|
<view class="payment-section">
|
||||||
<button :class="['pay-button']" @click="handlePayment">
|
<button :class="['pay-button']" @click="handlePayment">
|
||||||
{{ `立即支付 ¥${totalAmount}` }}
|
{{ `立即支付 ¥${payAmount}` }}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<view class="agreement">
|
<view class="agreement">
|
||||||
|
|
@ -116,6 +120,10 @@
|
||||||
<text class="detail-label">设备类型</text>
|
<text class="detail-label">设备类型</text>
|
||||||
<text class="detail-value">{{ selectedDevice.name }}</text>
|
<text class="detail-value">{{ selectedDevice.name }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="detail-item">
|
||||||
|
<text class="detail-label">设备数量</text>
|
||||||
|
<text class="detail-value">{{ formData.quantity }}</text>
|
||||||
|
</view>
|
||||||
<view v-if="selectedPackage" class="detail-item">
|
<view v-if="selectedPackage" class="detail-item">
|
||||||
<text class="detail-label">租赁周期</text>
|
<text class="detail-label">租赁周期</text>
|
||||||
<text class="detail-value">{{ selectedPackage.name }}</text>
|
<text class="detail-value">{{ selectedPackage.name }}</text>
|
||||||
|
|
@ -126,7 +134,7 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="detail-item">
|
<view class="detail-item">
|
||||||
<text class="detail-label">租金</text>
|
<text class="detail-label">租金</text>
|
||||||
<text class="detail-value">¥{{ totalAmount }}</text>
|
<text class="detail-value">¥{{ payAmount }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -184,7 +192,10 @@ export default {
|
||||||
commonEnum() {
|
commonEnum() {
|
||||||
return commonEnum
|
return commonEnum
|
||||||
},
|
},
|
||||||
// 检查是否可以支付 - 直接验证,不依赖formData默认值
|
// 计算总金额
|
||||||
|
payAmount() {
|
||||||
|
return this.formData.amount * this.formData.quantity
|
||||||
|
},
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
if (!this.hasAgreed) {
|
if (!this.hasAgreed) {
|
||||||
|
|
@ -205,6 +216,7 @@ export default {
|
||||||
return {
|
return {
|
||||||
hasAgreed: false,
|
hasAgreed: false,
|
||||||
formData: {
|
formData: {
|
||||||
|
quantity: 1,
|
||||||
name: '',
|
name: '',
|
||||||
phone: '',
|
phone: '',
|
||||||
address: '',
|
address: '',
|
||||||
|
|
@ -214,10 +226,11 @@ export default {
|
||||||
period: '',
|
period: '',
|
||||||
suitId: '', // 租赁周期ID
|
suitId: '', // 租赁周期ID
|
||||||
channelId: '3', //渠道id
|
channelId: '3', //渠道id
|
||||||
|
amount: 0,
|
||||||
payAmount: 0,
|
payAmount: 0,
|
||||||
},
|
},
|
||||||
showDetails: false,
|
showDetails: false,
|
||||||
totalAmount: '0.00',
|
|
||||||
deviceTypes: [], // 设备类型列表
|
deviceTypes: [], // 设备类型列表
|
||||||
periodPackages: [], // 租赁周期套餐列表
|
periodPackages: [], // 租赁周期套餐列表
|
||||||
selectedDevice: null, // 选中的设备
|
selectedDevice: null, // 选中的设备
|
||||||
|
|
@ -330,7 +343,7 @@ export default {
|
||||||
this.formData.suitId = ''
|
this.formData.suitId = ''
|
||||||
|
|
||||||
this.selectedPackage = null
|
this.selectedPackage = null
|
||||||
this.totalAmount = '0.00'
|
this.payAmount = '0.00'
|
||||||
|
|
||||||
// 根据选中的设备类型获取租赁套餐
|
// 根据选中的设备类型获取租赁套餐
|
||||||
this.getPeriodPackages(selectedDevice.suitId)
|
this.getPeriodPackages(selectedDevice.suitId)
|
||||||
|
|
@ -368,8 +381,7 @@ export default {
|
||||||
this.selectedPackage = selectedPackage
|
this.selectedPackage = selectedPackage
|
||||||
this.formData.period = selectedPackage.name
|
this.formData.period = selectedPackage.name
|
||||||
this.formData.suitId = selectedPackage.id
|
this.formData.suitId = selectedPackage.id
|
||||||
this.formData.payAmount = selectedPackage.amount
|
this.formData.amount = selectedPackage.amount
|
||||||
this.totalAmount = selectedPackage.amount.toFixed(2)
|
|
||||||
console.log('选中套餐:', selectedPackage)
|
console.log('选中套餐:', selectedPackage)
|
||||||
console.log('选中租赁周期id:', this.formData.suitId)
|
console.log('选中租赁周期id:', this.formData.suitId)
|
||||||
},
|
},
|
||||||
|
|
@ -379,6 +391,7 @@ export default {
|
||||||
this.showDetails = !this.showDetails
|
this.showDetails = !this.showDetails
|
||||||
},
|
},
|
||||||
handlePayment() {
|
handlePayment() {
|
||||||
|
this.formData.payAmount = this.payAmount
|
||||||
if (checkLoginStatus()) {
|
if (checkLoginStatus()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -440,7 +453,7 @@ export default {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parseFloat(this.totalAmount) <= 0) {
|
if (parseFloat(this.payAmount) <= 0) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '金额无效',
|
title: '金额无效',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
|
|
@ -460,7 +473,7 @@ export default {
|
||||||
// 支付逻辑
|
// 支付逻辑
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '确认支付',
|
title: '确认支付',
|
||||||
content: `确认支付 ¥${this.totalAmount} 吗?\n\n设备:${this.formData.equipment}\n周期:${this.formData.period}`,
|
content: `确认支付 ¥${this.payAmount} 吗?\n\n${this.formData.quantity}台${this.formData.equipment}\n周期:${this.formData.period}`,
|
||||||
success: async res => {
|
success: async res => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
// 这里可以调用支付API
|
// 这里可以调用支付API
|
||||||
|
|
@ -517,7 +530,7 @@ export default {
|
||||||
|
|
||||||
console.log('支付信息:', {
|
console.log('支付信息:', {
|
||||||
...this.formData,
|
...this.formData,
|
||||||
amount: this.totalAmount,
|
amount: this.payAmount,
|
||||||
selectedDevice: this.selectedDevice,
|
selectedDevice: this.selectedDevice,
|
||||||
selectedPackage: this.selectedPackage,
|
selectedPackage: this.selectedPackage,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user