This commit is contained in:
weiwei committed 2025-06-06 11:12:07 +08:00
1 parent bab4a4383b
commit 01b5f47f5c
3 files changed
+201 -225

No files matched your search

+5 -10
View File
@@ -2,9 +2,7 @@
<view
:class="[props.mode == 'car' ? 'car_border' : '']"
class="flex-row items-start card p-x-15rpx p-y-25rpx m-b-20rpx"
@tap="
props.productId && props.mode === 'default' && router.jump('/pages/shop/product-detail', { id: props.productId })
"
@tap="props.productId && props.mode === 'default' && router.jump('/pages/shop/product-detail', { id: props.productId })"
>
<image class="size-140rpx rounded-12rpx" :src="props.picUrl" mode="aspectFill" />
<view class="flex-1 m-l-20rpx">
@@ -32,10 +30,7 @@
</view>
<view v-if="mode === 'car'" class="flex-row items-center justify-end m-t-20rpx">
<view
class="flex-row-center size-40rpx rounded-full border-1px border-solid border-color-#0094ff"
@tap.stop="remove"
>
<view class="flex-row-center size-40rpx rounded-full border-1px border-solid border-color-#0094ff" @tap.stop="remove">
<view class="iconfont icon-a--" />
</view>
<view class="sub-text-28 m-x-20rpx">{{ productCount }}</view>
@@ -50,7 +45,7 @@
<script setup lang="ts">
import { hooks, router } from "@@/index"
const emit = defineEmits(["onClickAddToCar", "add", "remove"])
const emit = defineEmits(["onClickAddToCart", "add", "remove"])
export type Props = {
mode?: "default" | "car"
@@ -65,7 +60,7 @@ export type Props = {
stock?: number
spec?: string
unit?: string
onClickAddToCar?: () => void
onClickAddToCart?: () => void
}
const props = withDefaults(defineProps<Props>(), {
mode: "default",
@@ -84,7 +79,7 @@ const props = withDefaults(defineProps<Props>(), {
const handleClickAddToCar = () => {
if (props.productId) {
emit("onClickAddToCar", { ...props })
emit("onClickAddToCart", { ...props })
}
}
+4 -4
View File
@@ -100,7 +100,7 @@
:productName="goodsItem.productName"
:salesCount="goodsItem.salesCount"
:stock="goodsItem.stock"
@onClickAddToCar="onClickAddToCar"
@onClickAddToCart="onClickAddToCart(goodsItem)"
/>
</view>
</scroll-view>
@@ -130,7 +130,7 @@
</template>
<script setup lang="ts">
import { reactive, nextTick, ref } from "vue"
import { reactive, nextTick } from "vue"
import { onLoad, onShow } from "@dcloudio/uni-app"
import { isEmpty } from "radash"
import { router } from "@@/index"
@@ -247,9 +247,9 @@ const doClassify = async (i: any) => {
}
// 点击添加到购物车
const onClickAddToCar = (productData: any) => {
const onClickAddToCart = (goodsItem: any) => {
state.curProductData = goodsItem
state.showSkuDialog = true
state.curProductData = productData
}
// 加入到购物车时