From 23af4c25e32a3cbbedaa00c1dc16c16eb1de8e5b Mon Sep 17 00:00:00 2001 From: Waiting Date: Sat, 13 Apr 2024 17:20:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/order/types.ts | 4 ++ src/components/sku-dialog.vue | 36 ++++++++---- src/components/tabbar/tabbar.vue | 11 +++- src/pages/common/groupbuy/order-confirm.vue | 20 +++---- src/pages/home/index.vue | 9 ++- src/pages/mall/index.vue | 23 ++++++-- src/pages/mall/subs/order/order-confirm.vue | 21 ++++--- src/pages/mine/index.vue | 12 ++-- .../mine/subs/order/components/order-item.vue | 14 +++-- src/pages/mine/subs/order/detail.vue | 56 +++++++++++++----- src/pages/mine/subs/order/index.vue | 34 +++++++++-- src/pages/mine/subs/recharge/index.vue | 12 ++-- src/store/modules/user/index.ts | 10 ++-- src/utils/common/index.ts | 23 ++++++-- src/utils/order/index.ts | 58 +++++++++++++++++++ 15 files changed, 253 insertions(+), 90 deletions(-) create mode 100644 src/utils/order/index.ts diff --git a/src/api/order/types.ts b/src/api/order/types.ts index f7df99a..11a6336 100644 --- a/src/api/order/types.ts +++ b/src/api/order/types.ts @@ -4,6 +4,7 @@ export interface OrderBean { allowIntegral: boolean; bizId: string; classify: number; + address: any, companyId: string; consignTime: string; consumerId: string; @@ -71,4 +72,7 @@ export interface OrderBean { updated: boolean; useGold: number; wholePrice: number; + + //extra field + countdown: number; } diff --git a/src/components/sku-dialog.vue b/src/components/sku-dialog.vue index f8e1f64..8c3fc95 100644 --- a/src/components/sku-dialog.vue +++ b/src/components/sku-dialog.vue @@ -12,7 +12,8 @@ 颜色 - {{ item }} @@ -22,11 +23,13 @@ 尺码 {{ item.sizeName }} + 暂无库存 @@ -41,7 +44,9 @@ - + @@ -65,7 +70,7 @@ const popupRef = ref(); const goodsDetailBean = ref(); const skuColorList = ref([]); const currentColorIndex = ref(0); -const currentSizeIndex = ref(0); +const currentSizeIndex = ref(-1); const goodsCount = ref(1); let callback: Function; @@ -96,25 +101,31 @@ const show = async (goodsId: string, fn: Function) => { sizeChange(sizeIndex || 0); goodsCount.value = props.exists?.count; } + + if(skuSizeList) { + // skuSizeList.value![2].existingNumber = 2; + } }; const skuSizeList = computed(() => { const currentColorName = skuColorList.value[currentColorIndex.value]; - return goodsDetailBean.value?.stocks?.filter((res: { colorName: string }) => { + let sizeList = goodsDetailBean.value?.stocks?.filter((res: { colorName: string }) => { return res.colorName === currentColorName; }); + currentSizeIndex.value = sizeList?.findIndex(res => res.existingNumber > 0) || 0; + return sizeList; }); -const close = () => { - popupRef.value.close(); -}; - const colorChange = (index: number) => { currentColorIndex.value = index; }; const sizeChange = (index: number) => { - currentSizeIndex.value = index; + if((skuSizeList.value![index].existingNumber || 0) <= 0) { + showToast('库存不足'); + } else { + currentSizeIndex.value = index; + } }; const countChange = (isPlus: boolean) => { @@ -140,6 +151,10 @@ const confirm = () => { popupRef.value.close(); }; +const close = () => { + popupRef.value.close(); +}; + defineExpose({ show }); @@ -262,6 +277,7 @@ defineExpose({ .primary-button { width: 100%; margin-top: 50rpx; + border: none; } } } diff --git a/src/components/tabbar/tabbar.vue b/src/components/tabbar/tabbar.vue index 8468c84..17dce39 100644 --- a/src/components/tabbar/tabbar.vue +++ b/src/components/tabbar/tabbar.vue @@ -14,12 +14,17 @@