diff --git a/CoreCms.Net.Uni-App/CoreShop/components/coreshop-button/coreshop-button.vue b/CoreCms.Net.Uni-App/CoreShop/components/coreshop-button/coreshop-button.vue index dde49887..371e8807 100644 --- a/CoreCms.Net.Uni-App/CoreShop/components/coreshop-button/coreshop-button.vue +++ b/CoreCms.Net.Uni-App/CoreShop/components/coreshop-button/coreshop-button.vue @@ -1,7 +1,7 @@ \ No newline at end of file diff --git a/CoreCms.Net.Uni-App/CoreShop/pages/cart/cart.vue b/CoreCms.Net.Uni-App/CoreShop/pages/cart/cart.vue index dc720aa7..4a9e7d1f 100644 --- a/CoreCms.Net.Uni-App/CoreShop/pages/cart/cart.vue +++ b/CoreCms.Net.Uni-App/CoreShop/pages/cart/cart.vue @@ -101,9 +101,6 @@ - - - @@ -313,12 +310,8 @@ /** 去购买 */ const handleGoToBuy = () => { - let ids : Array = []; - state.cartList.forEach((item : CartListType) => { - if (item.select) { - ids.push(item.id) - } - }) + const ids : Array= state.cartList.filter(x=>x.select).map(x=>x.id); + if (ids.length > 0) { handleRouteNavigateTo(`/pages/order/submit/submit?cartIds=${ids.join(',')}`) } else { diff --git a/CoreCms.Net.Uni-App/CoreShop/pages/classify/classify-page/classify-five/classify-five.vue b/CoreCms.Net.Uni-App/CoreShop/pages/classify/classify-page/classify-five/classify-five.vue index e83abaa4..9456ba2f 100644 --- a/CoreCms.Net.Uni-App/CoreShop/pages/classify/classify-page/classify-five/classify-five.vue +++ b/CoreCms.Net.Uni-App/CoreShop/pages/classify/classify-page/classify-five/classify-five.vue @@ -96,8 +96,8 @@ + :safeAreaInsetBottom="false" :buyNowNowloading="buyNowLoading" :addCartloading="addCartLoading" + @handleChangePopup="handleChangePopup" @handleAddCart="handleAddCart" @handleBuyNow="handleBuyNow"> @@ -131,6 +131,7 @@ import { getDomInfo, handleStaticResources, handleRouteNavigateTo, handleShowToast, handleRouteSwitchTab } from '@/core/utils'; import { AddCartEnum, PaymentTypeEnum, RouteSwitchTabEnum } from '@/core/enum'; import GoodsDetailSkuPopup from '@/pages/components/goods-detail/components/goods-detail-sku/goods-detail-sku.vue'; + import { useLoadingFn } from '@/core/hooks'; const instance = getCurrentInstance(); @@ -185,6 +186,13 @@ goodsDetailData: {}, }); + const buyNowLoading = ref(false); + const addCartLoading = ref(false); + + const handleBuyNow = useLoadingFn(onBuyNow, buyNowLoading); + const handleAddCart = useLoadingFn(onAddCart, addCartLoading) + + watch(() => props.data, (newVal : Array) => { if (newVal) { state.classifyData = newVal.map((item : CategoriesType) => { @@ -277,7 +285,7 @@ } /** 添加购物车 */ - const handleAddCart = async ({ productId, nums } : any) => { + async function onAddCart({ productId, nums } : any) { const addCart : Response = await queryAddCart({ productId, nums, @@ -295,7 +303,7 @@ } /** 立即购买 */ - const handleBuyNow = async ({ productId, nums } : any) => { + async function onBuyNow({ productId, nums } : any) { const addCart : Response = await queryAddCart({ productId, nums, diff --git a/CoreCms.Net.Uni-App/CoreShop/pages/classify/classify-page/classify-four/classify-four.vue b/CoreCms.Net.Uni-App/CoreShop/pages/classify/classify-page/classify-four/classify-four.vue index 10c26825..f4b92642 100644 --- a/CoreCms.Net.Uni-App/CoreShop/pages/classify/classify-page/classify-four/classify-four.vue +++ b/CoreCms.Net.Uni-App/CoreShop/pages/classify/classify-page/classify-four/classify-four.vue @@ -67,15 +67,15 @@ + :safeAreaInsetBottom="false" :buyNowNowloading="buyNowLoading" :addCartloading="addCartLoading" + @handleChangePopup="handleChangePopup" @handleAddCart="handleAddCart" @handleBuyNow="handleBuyNow">