|
@@ -50,9 +50,18 @@
|
|
|
<view class="info-item-label">餐具费</view>
|
|
<view class="info-item-label">餐具费</view>
|
|
|
<view class="info-item-value">¥{{ priceDetail.tablewareFee }}</view>
|
|
<view class="info-item-value">¥{{ priceDetail.tablewareFee }}</view>
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="info-item">
|
|
|
|
|
|
|
+ <view class="info-item info-item--coupon">
|
|
|
<view class="info-item-label">优惠券</view>
|
|
<view class="info-item-label">优惠券</view>
|
|
|
- <view class="info-item-value">¥{{ priceDetail.couponDiscount }}</view>
|
|
|
|
|
|
|
+ <view class="info-item-value coupon-value">
|
|
|
|
|
+ <text v-if="priceDetail.discountRate != null && priceDetail.discountRate !== ''" class="coupon-amount">{{ priceDetail.discountRate }}折</text>
|
|
|
|
|
+ <text v-else class="coupon-placeholder">—</text>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view v-if="(priceDetail.discountAmount ?? 0) > 0" class="info-item info-item--coupon">
|
|
|
|
|
+ <view class="info-item-label">优惠金额</view>
|
|
|
|
|
+ <view class="info-item-value coupon-value">
|
|
|
|
|
+ <text class="coupon-amount">-¥{{ formatPrice(priceDetail.discountAmount) }}</text>
|
|
|
|
|
+ </view>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="price-line">
|
|
<view class="price-line">
|
|
|
<view class="price-line-label">合计</view>
|
|
<view class="price-line-label">合计</view>
|
|
@@ -78,7 +87,7 @@
|
|
|
</view>
|
|
</view>
|
|
|
<view class="info-item">
|
|
<view class="info-item">
|
|
|
<view class="info-item-label">用餐人数</view>
|
|
<view class="info-item-label">用餐人数</view>
|
|
|
- <view class="info-item-value">{{ orderDetail.dinerCount ?? '—' }}</view>
|
|
|
|
|
|
|
+ <view class="info-item-value">{{ orderDetail.dinerCount != null && orderDetail.dinerCount !== '' ? orderDetail.dinerCount + '人' : '—' }}</view>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="info-item">
|
|
<view class="info-item">
|
|
|
<view class="info-item-label">下单时间</view>
|
|
<view class="info-item-label">下单时间</view>
|
|
@@ -133,9 +142,31 @@ const priceDetail = ref({
|
|
|
dishTotal: '0.00',
|
|
dishTotal: '0.00',
|
|
|
tablewareFee: '0.00',
|
|
tablewareFee: '0.00',
|
|
|
couponDiscount: '0.00',
|
|
couponDiscount: '0.00',
|
|
|
|
|
+ discountAmount: 0,
|
|
|
|
|
+ couponName: '',
|
|
|
|
|
+ couponType: null,
|
|
|
|
|
+ nominalValue: null,
|
|
|
|
|
+ discountRate: null,
|
|
|
total: '0.00'
|
|
total: '0.00'
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+// 优惠券展示:满减券显示 nominalValue+元,折扣券显示 discountRate+折,否则显示 couponName 或 已使用优惠券(与 checkout 一致)
|
|
|
|
|
+const couponDisplayText = computed(() => {
|
|
|
|
|
+ const p = priceDetail.value;
|
|
|
|
|
+ const amount = Number(p.discountAmount ?? p.couponDiscount ?? 0) || 0;
|
|
|
|
|
+ if (amount <= 0) return '—';
|
|
|
|
|
+ const type = Number(p.couponType);
|
|
|
|
|
+ if (type === 1 && (p.nominalValue != null && p.nominalValue !== '')) {
|
|
|
|
|
+ const val = Number(p.nominalValue);
|
|
|
|
|
+ return Number.isNaN(val) ? (p.couponName || '已使用优惠券') : val + '元';
|
|
|
|
|
+ }
|
|
|
|
|
+ if (type === 2 && (p.discountRate != null && p.discountRate !== '')) {
|
|
|
|
|
+ const rate = Number(p.discountRate);
|
|
|
|
|
+ return Number.isNaN(rate) ? (p.couponName || '已使用优惠券') : rate + '折';
|
|
|
|
|
+ }
|
|
|
|
|
+ return p.couponName || '已使用优惠券';
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
// 菜品列表(接口订单明细)
|
|
// 菜品列表(接口订单明细)
|
|
|
const foodList = ref([]);
|
|
const foodList = ref([]);
|
|
|
|
|
|
|
@@ -209,11 +240,19 @@ function applyOrderData(data) {
|
|
|
const dishTotal = raw?.totalAmount ?? raw?.dishTotal ?? raw?.orderAmount ?? raw?.foodAmount ?? 0;
|
|
const dishTotal = raw?.totalAmount ?? raw?.dishTotal ?? raw?.orderAmount ?? raw?.foodAmount ?? 0;
|
|
|
const tablewareFee = raw?.tablewareFee ?? raw?.tablewareAmount ?? 0;
|
|
const tablewareFee = raw?.tablewareFee ?? raw?.tablewareAmount ?? 0;
|
|
|
const couponDiscount = raw?.couponAmount ?? raw?.couponDiscount ?? 0;
|
|
const couponDiscount = raw?.couponAmount ?? raw?.couponDiscount ?? 0;
|
|
|
|
|
+ const discountAmountVal = Number(raw?.discountAmount ?? raw?.couponAmount ?? raw?.couponDiscount ?? 0) || 0;
|
|
|
const total = raw?.payAmount ?? raw?.totalAmount ?? raw?.totalPrice ?? 0;
|
|
const total = raw?.payAmount ?? raw?.totalAmount ?? raw?.totalPrice ?? 0;
|
|
|
|
|
+ const rawDiscountRate = raw?.discountRate ?? raw?.couponInfo?.discountRate ?? raw?.coupon?.discountRate;
|
|
|
|
|
+ const discountRateVal = rawDiscountRate != null && rawDiscountRate !== '' ? (Number(rawDiscountRate) || 0) / 10 : null;
|
|
|
priceDetail.value = {
|
|
priceDetail.value = {
|
|
|
dishTotal: formatPrice(dishTotal),
|
|
dishTotal: formatPrice(dishTotal),
|
|
|
tablewareFee: formatPrice(tablewareFee),
|
|
tablewareFee: formatPrice(tablewareFee),
|
|
|
couponDiscount: formatPrice(couponDiscount),
|
|
couponDiscount: formatPrice(couponDiscount),
|
|
|
|
|
+ discountAmount: discountAmountVal,
|
|
|
|
|
+ couponName: raw?.couponName ?? '',
|
|
|
|
|
+ couponType: raw?.couponType ?? null,
|
|
|
|
|
+ nominalValue: raw?.nominalValue ?? null,
|
|
|
|
|
+ discountRate: discountRateVal,
|
|
|
total: formatPrice(total)
|
|
total: formatPrice(total)
|
|
|
};
|
|
};
|
|
|
const list = raw?.orderItemList ?? raw?.orderItems ?? raw?.items ?? raw?.detailList ?? [];
|
|
const list = raw?.orderItemList ?? raw?.orderItems ?? raw?.items ?? raw?.detailList ?? [];
|
|
@@ -325,6 +364,18 @@ onLoad(async (e) => {
|
|
|
.info-item-value {
|
|
.info-item-value {
|
|
|
color: #151515;
|
|
color: #151515;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ &--coupon .coupon-value {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ gap: 8rpx;
|
|
|
|
|
+ }
|
|
|
|
|
+ .coupon-amount {
|
|
|
|
|
+ color: #E61F19;
|
|
|
|
|
+ }
|
|
|
|
|
+ .coupon-placeholder {
|
|
|
|
|
+ color: #999999;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.info-item-textarea {
|
|
.info-item-textarea {
|