Commit bc4b5c19 by chenwq

```

refactor(order): 移除冗余属性并优化优惠券选择逻辑

- 在OrderCouponSheetPopup组件中移除isNoneCouponSelected prop,
  改为通过computed属性判断是否选择"不使用优惠券"
- 添加COUPON_SELECT_NONE常量用于标识未选择状态
- 更新样式以正确显示"不使用优惠券"选项的选中状态
- 从OrderPaymentInfoPanel中移除对应的prop传递和计算属性
```
1 parent 9512e0f1
......@@ -111,6 +111,8 @@ import {
type CouponFacePresent,
} from "@/common/couponFaceAmount";
const COUPON_SELECT_NONE = "__none__";
@Component({})
export default class OrderCouponSheetPopup extends Vue {
@Prop({ type: Array, required: true })
......@@ -129,9 +131,6 @@ export default class OrderCouponSheetPopup extends Vue {
selectedCouponId: string | null;
@Prop({ type: Boolean, required: true })
isNoneCouponSelected: boolean;
@Prop({ type: Boolean, required: true })
showUnavailableSection: boolean;
@Ref
......@@ -145,6 +144,10 @@ export default class OrderCouponSheetPopup extends Vue {
this.popup?.close?.();
}
get isNoneCouponSelected(): boolean {
return this.selectedCouponId === COUPON_SELECT_NONE;
}
formatCouponDeductionCaption(amount: number): string {
return formatCouponCaptionWithMoneySymbol(amount);
}
......@@ -265,6 +268,11 @@ export default class OrderCouponSheetPopup extends Vue {
background-color: #fff;
}
.coupon-sheet__no-use .coupon-radio--on {
border: 1px solid #ff6010;
background-color: #ff6010;
}
.coupon-radio--lg {
width: 22px;
height: 22px;
......
......@@ -94,7 +94,7 @@
<order-coupon-sheet-popup ref="couponSheetPopup" :order-coupon-list="orderCouponList"
:order-coupons-loaded="orderCouponsLoaded" :available-coupons-for-sheet="availableCouponsForSheet"
:unavailable-coupons="unavailableCoupons" :selected-coupon-id="selectedCouponId"
:is-none-coupon-selected="isNoneCouponSelected" :show-unavailable-section="showUnavailableSection"
:show-unavailable-section="showUnavailableSection"
@close="closeCouponSheet" @choose-no-coupon="chooseNoCoupon" @choose-coupon="chooseCoupon"
@toggle-unavailable="toggleUnavailableSection" @change="onCouponSheetChange"></order-coupon-sheet-popup>
......@@ -417,10 +417,6 @@ export default class OrderPaymentInfoPanel extends Vue {
return cid != null && cid !== COUPON_SELECT_NONE && !!this.findCouponById(cid);
}
get isNoneCouponSelected(): boolean {
return this.selectedCouponId === COUPON_SELECT_NONE;
}
pickBestCouponId(pool: OrderCouponItem[]): string {
const sorted = [...pool].sort((a, b) => {
if (b.actualDeduction !== a.actualDeduction) return b.actualDeduction - a.actualDeduction;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!