diff --git a/components/m-buy/goods.vue b/components/m-buy/goods.vue index 23debb1..e15ab39 100644 --- a/components/m-buy/goods.vue +++ b/components/m-buy/goods.vue @@ -27,8 +27,8 @@ - -
+ +
¥ @@ -56,7 +56,7 @@ 库存 - {{ goodsDetail.quantity }} + {{ availableStock }} @@ -93,18 +93,18 @@ -
+
- + 数量 - + - - 加入购物车 + + 加入购物车 立即购买 @@ -113,11 +113,17 @@ + + diff --git a/pages/order/fillorder.vue b/pages/order/fillorder.vue index 20fff28..022bb45 100644 --- a/pages/order/fillorder.vue +++ b/pages/order/fillorder.vue @@ -4,7 +4,7 @@
@@ -45,7 +45,7 @@
-
+
@@ -201,14 +201,14 @@ 配送
- 运费 -
+
优惠金额 0.00
-
+
活动优惠 @@ -400,6 +401,7 @@ import { secrecyMobile, isLogin, } from '@/utils/filters.js' +import { hasECouponInCheckout } from '@/utils/goodsType.js' const store = useStore() const { proxy } = getCurrentInstance()! @@ -424,8 +426,6 @@ const shippingText = ref('LOGISTICS') const shippingFlag = ref(false) const shippingMethod = ref([]) const isAssemble = ref(false) -const remarkFlag = ref(false) -const selectAddressId = ref('') const routerVal = ref>({}) const params = ref>({}) const couponList = ref('') @@ -445,6 +445,13 @@ const notSupportFreightNoticeText = ref('') const storeAddress = ref('') const originOrderData = ref('') +// E_COUPON 结算:免地址、无运费/优惠券/促销(O-11);与 VIRTUAL 共用 hidePhysicalCheckout +const isECouponCheckout = computed(() => hasECouponInCheckout(orderMessage.value)) +const isVirtualCheckout = computed(() => orderMessage.value?.cartTypeEnum === 'VIRTUAL') +const hidePhysicalCheckout = computed( + () => isVirtualCheckout.value || isECouponCheckout.value +) + watch( remarkVal, (val) => { @@ -477,15 +484,15 @@ onBackPress((e) => { }) onShow(async () => { - if (remark.value && remark.value.length > 0) { - remarkFlag.value = true - } uni.showLoading({ mask: true, }) try { await getOrderList() - await getDistribution() + // E_COUPON 不需要配送方式 + if (!isECouponCheckout.value) { + await getDistribution() + } if (routerVal.value.way == 'PINTUAN') { isAssemble.value = true routerVal.value.parentOrder = JSON.parse( @@ -507,17 +514,16 @@ function getShippingLabel() { async function callbackInvoice(val: any) { invoiceFlag.value = false + if (!val) return receiptList.value = val - if (val) { - const submit = { - way: routerVal.value.way, - ...receiptList.value, - } - const receipt = await API_Order.getReceipt(submit) - if (receipt.data.success) { - shippingFlag.value = false - getOrderList() - } + const submit = { + way: routerVal.value.way, + ...receiptList.value, + } + const receipt = await API_Order.getReceipt(submit) + if (receipt.data.success) { + shippingFlag.value = false + getOrderList() } } @@ -614,7 +620,7 @@ function createTradeFun() { } } else if ( shippingText.value === 'LOGISTICS' && - orderMessage.value.cartTypeEnum !== 'VIRTUAL' + !hidePhysicalCheckout.value ) { if (!address.value.id) { uni.showToast({ @@ -737,6 +743,22 @@ async function confirmDistribution(val: any) { } } +function getSavedRemark(storeId: string, index: number, fallback = '') { + const localAtIndex = remarkVal.value[index] + if (localAtIndex?.storeId === storeId) { + return localAtIndex.remark ?? '' + } + const localByStore = remarkVal.value.find((r) => r?.storeId === storeId) + if (localByStore) { + return localByStore.remark ?? '' + } + const fromStore = (remark.value || []).find((r: any) => r.storeId === storeId) + if (fromStore) { + return fromStore.remark ?? '' + } + return fallback ?? '' +} + function getOrderList() { notSupportFreight.value = [] notSupportFreightNoticeText.value = '' @@ -766,11 +788,7 @@ function getOrderList() { let repeatData res.data.result.cartList.forEach((item: any, index: number) => { repeatData = { - remark: remarkFlag.value - ? remark.value[index].storeId == item.storeId - ? remark.value[index].remark - : item.remark - : item.remark, + remark: getSavedRemark(item.storeId, index, item.remark), storeId: item.storeId, } @@ -781,12 +799,15 @@ function getOrderList() { ;(store.state as any).canUseCoupons = res.data.result.canUseCoupons ;(store.state as any).cantUseCoupons = res.data.result.cantUseCoupons - if (!res.data.result.memberAddress) { - getUserAddress() - } else { - address.value = res.data.result.memberAddress - res.data.result.memberAddress.consigneeAddressPath = - res.data.result.memberAddress.consigneeAddressPath.split(',') + // E_COUPON 免地址,不自动回填 memberAddress + if (!hasECouponInCheckout(res.data.result)) { + if (!res.data.result.memberAddress) { + getUserAddress() + } else { + address.value = res.data.result.memberAddress + res.data.result.memberAddress.consigneeAddressPath = + res.data.result.memberAddress.consigneeAddressPath.split(',') + } } if (res.data.result.storeAddress) { storeAddress.value = res.data.result.storeAddress diff --git a/pages/order/invoice/setInvoice.vue b/pages/order/invoice/setInvoice.vue index ec3b87e..c03ee47 100644 --- a/pages/order/invoice/setInvoice.vue +++ b/pages/order/invoice/setInvoice.vue @@ -1,5 +1,5 @@