|
|
@ -43,6 +43,11 @@ |
|
|
|
<text>商品信息</text> |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- 空状态提示 --> |
|
|
|
<view v-if="!productInfo.commonShop || productInfo.commonShop.length === 0" class="empty-state"> |
|
|
|
<view class="empty-text">暂无商品信息</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="product-card" v-for="(info, index) in productInfo.commonShop" |
|
|
|
:key="index"> |
|
|
|
|
|
|
@ -74,6 +79,11 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- 未选择商品提示 --> |
|
|
|
<view v-if="productInfo.commonShop && productInfo.commonShop.length > 0 && checkboxValue.length === 0" class="empty-state"> |
|
|
|
<view class="empty-text">请选择至少一件商品</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
</uv-checkbox-group> |
|
|
@ -119,7 +129,7 @@ |
|
|
|
<!-- 底部按钮 --> |
|
|
|
<view class="order-submit" v-if="productInfo.isPay != 'Y'"> |
|
|
|
<button class="submit-btn-close" @click="cancelOrderFast">取消</button> |
|
|
|
<button class="submit-btn" @click="submitOrder">快捷下单(¥{{ totalPrice }})</button> |
|
|
|
<button class="submit-btn" :disabled="!hasSelectedProducts" :class="{'submit-btn-disabled': !hasSelectedProducts}" @click="submitOrder">快捷下单(¥{{ totalPrice }})</button> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="order-submit" v-else> |
|
|
@ -182,8 +192,14 @@ |
|
|
|
price += n.price * (n.selectNum || 1) |
|
|
|
} |
|
|
|
}) |
|
|
|
return Number(price).toFixed(3) |
|
|
|
return Number(price).toFixed(2) |
|
|
|
}, |
|
|
|
// 是否有选中的商品 |
|
|
|
hasSelectedProducts() { |
|
|
|
return this.productInfo.commonShop && |
|
|
|
this.productInfo.commonShop.length > 0 && |
|
|
|
this.checkboxValue.length > 0; |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad(options) { |
|
|
|
// 获取订单ID |
|
|
@ -321,6 +337,24 @@ |
|
|
|
|
|
|
|
// 提交订单 |
|
|
|
submitOrder(skipAddressCheck = false) { |
|
|
|
// 检查是否有选中的商品 |
|
|
|
if (!this.hasSelectedProducts) { |
|
|
|
uni.showToast({ |
|
|
|
title: '请选择至少一件商品', |
|
|
|
icon: 'none' |
|
|
|
}); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
// 检查是否有商品 |
|
|
|
if (!this.productInfo.commonShop || this.productInfo.commonShop.length === 0) { |
|
|
|
uni.showToast({ |
|
|
|
title: '暂无商品信息', |
|
|
|
icon: 'none' |
|
|
|
}); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if (!this.address.id) { |
|
|
|
const addressForm = this.$refs.addressForm; |
|
|
|
// 验证地址表单 |
|
|
@ -357,22 +391,22 @@ |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
// 如果没有选中商品,不创建订单 |
|
|
|
if (list.length === 0) { |
|
|
|
uni.hideLoading(); |
|
|
|
uni.showToast({ |
|
|
|
title: '请选择至少一件商品', |
|
|
|
icon: 'none' |
|
|
|
}); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
let data = { |
|
|
|
addressId: this.address.id, |
|
|
|
payType: 1, // 默认微信支付 |
|
|
|
orderId: this.orderId, |
|
|
|
list: JSON.stringify(list), |
|
|
|
} |
|
|
|
|
|
|
|
/* |
|
|
|
{ |
|
|
|
addressId: this.address.id, |
|
|
|
productId: this.productInfo.id, |
|
|
|
num : 1, |
|
|
|
payType: 1, // 默认微信支付 |
|
|
|
orderId: this.orderId |
|
|
|
} |
|
|
|
*/ |
|
|
|
|
|
|
|
// 创建订单 |
|
|
|
this.$api('createSumOrder', data, res => { |
|
|
@ -701,5 +735,26 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 空状态样式 |
|
|
|
.empty-state { |
|
|
|
padding: 60rpx 30rpx; |
|
|
|
text-align: center; |
|
|
|
|
|
|
|
.empty-icon { |
|
|
|
margin-bottom: 20rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.empty-text { |
|
|
|
font-size: 28rpx; |
|
|
|
color: #999; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 禁用按钮样式 |
|
|
|
.submit-btn-disabled { |
|
|
|
background-color: #cccccc !important; |
|
|
|
color: #ffffff !important; |
|
|
|
} |
|
|
|
} |
|
|
|
</style> |