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