线上超市修改
This commit is contained in:
1 parent
4540d547bb
commit
f7cce3e5bc
4 files changed
+53
-45
No files matched your search
@@ -26,9 +26,9 @@
|
||||
<view class="text-32 ws-nowrap text-ellipsis overflow-hidden">{{ state.goodsDetail.productName }}</view>
|
||||
<view class="flex items-center">
|
||||
<view class="second-text-30 c-red!">
|
||||
促销 ¥{{ hooks.useMoney(state.selectedSku.promotionPrice) || hooks.useMoney(state.selectedSku.retailPrice) || 0 }}
|
||||
促销 ¥ {{ state.selectedSku.promotionPrice.toFixed(2) || state.selectedSku.retailPrice.toFixed(2) || 0 }}
|
||||
</view>
|
||||
<view class="m-l-20rpx second-text-28 line-through">原价 ¥{{ hooks.useMoney(state.selectedSku.retailPrice) || 0 }}</view>
|
||||
<view class="m-l-20rpx second-text-28 line-through">原价 ¥ {{ state.selectedSku.retailPrice.toFixed(2) || 0 }}</view>
|
||||
</view>
|
||||
<view class="second-text-26">库存:{{ state.selectedSku.stock || 0 }}</view>
|
||||
<view class="second-text-26">
|
||||
@@ -57,13 +57,16 @@
|
||||
<!-- 购买数量 -->
|
||||
<view class="flex-col card p-y-20rpx p-x-30rpx mb-20rpx">
|
||||
<view class="prefix_title mb-15rpx">购买数量</view>
|
||||
<view class="flex-row items-center justify-end">
|
||||
<view class="flex-row-center size-40rpx rounded-full border-1px border-solid border-color-#0094ff" @tap.stop="handleNumRemove">
|
||||
<view class="iconfont icon-a--" />
|
||||
</view>
|
||||
<view class="sub-text-28 m-x-20rpx">{{ String(state.goodsCount).padStart(2, "0") }}</view>
|
||||
<view class="flex-row-center size-40rpx rounded-full bg-#0094ff" @tap.stop="handleNumAdd">
|
||||
<view class="font-size-40rpx color-white iconfont icon-a-" />
|
||||
<view class="flex items-center justify-between">
|
||||
<view class="second-text-28">限购:{{ state.goodsDetail.limitNum }}</view>
|
||||
<view class="flex">
|
||||
<view class="flex-row-center size-40rpx rounded-full border-1px border-solid border-color-#0094ff" @tap.stop="handleNumRemove">
|
||||
<view class="iconfont icon-a--" />
|
||||
</view>
|
||||
<view class="sub-text-28 m-x-20rpx">{{ String(state.goodsCount).padStart(2, "0") }}</view>
|
||||
<view class="flex-row-center size-40rpx rounded-full bg-#0094ff" @tap.stop="handleNumAdd">
|
||||
<view class="font-size-40rpx color-white iconfont icon-a-" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -82,12 +85,10 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { shopApi } from "@/sheep/api"
|
||||
import { filePath } from "@/sheep/utils/file"
|
||||
import { reactive, watch } from "vue"
|
||||
import { usePreviewImage } from "@/sheep/hooks/use-img"
|
||||
import { isEmpty } from "radash"
|
||||
import { hooks } from "@/sheep"
|
||||
|
||||
const emit = defineEmits(["update:modelValue", "onSkuAddToCart"])
|
||||
|
||||
@@ -116,12 +117,6 @@ watch(
|
||||
() => props.modelValue,
|
||||
async (newValue) => {
|
||||
if (newValue) {
|
||||
// 获取商品详情
|
||||
// const { data } = await shopApi.getSupermarketSpuDetail({ id: props.productData.id })
|
||||
// state.goodsDetail = data
|
||||
// if (data.skuList.length > 0) {
|
||||
// state.selectedSku = state.goodsDetail.skuList[0]
|
||||
// }
|
||||
state.goodsDetail = props.productData
|
||||
if (!isEmpty(state.goodsDetail)) {
|
||||
state.selectedSku = state.goodsDetail.skuList[0]
|
||||
@@ -141,6 +136,7 @@ const onSelectSku = (skuItem: any) => {
|
||||
|
||||
// 加数量
|
||||
const handleNumAdd = () => {
|
||||
if (state.goodsCount >= state.goodsDetail.limitNum) return
|
||||
if (state.goodsCount >= state.goodsDetail.stock) return uni.showToast({ title: "库存不足", icon: "none" })
|
||||
state.goodsCount += 1
|
||||
}
|
||||
|
||||
@@ -68,40 +68,52 @@ const doCart = async () => {
|
||||
<view class="p-15rpx">
|
||||
<view class="flex-col justify-between card p-y-20rpx p-x-30rpx">
|
||||
<view class="prefix_title mb-15rpx">商品</view>
|
||||
<view class="sub-text-32">{{ state.detail?.productName }}</view>
|
||||
<view class="flex-row items-center justify-between m-t-15rpx">
|
||||
<view class="second-text-26">限购:{{ state.detail?.limitNum || 0 }}</view>
|
||||
<view class="second-text-26">已售:{{ state.detail?.salesCount || 0 }}</view>
|
||||
<view class="px-3">{{ state.detail?.productName }}</view>
|
||||
<view class="flex-row items-center justify-between m-t-15rpx px-3">
|
||||
<view class="second-text-26">限购:{{ state.detail?.limitNum || 0 }}</view>
|
||||
<view class="second-text-26">已售:{{ state.detail?.salesCount || 0 }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="h-15rpx" />
|
||||
<view class="flex-col justify-between card p-y-20rpx p-x-30rpx">
|
||||
<view class="prefix_title mb-15rpx">包装</view>
|
||||
<view class="flex flex-wrap">
|
||||
<view class="w-1/3 flex justify-center p-1" v-for="(item, index) in state.detail?.skuList" :key="index">
|
||||
<view class="p-2 w-full bg-#eeeeee77 rounded-3 flex-col items-center">
|
||||
<view class="second-text-28">{{ item.spec + " / " + item.unit }}</view>
|
||||
<view class="second-text-28">库存:{{ item?.stock || 0 }}</view>
|
||||
<view class="flex items-center">
|
||||
<view class="second-text-28 c-red!">
|
||||
¥{{ hooks.useMoney(item.promotionPrice) || hooks.useMoney(item.retailPrice) || 0 }}
|
||||
</view>
|
||||
<view class="ml-4rpx second-text-28 line-through">¥{{ hooks.useMoney(item.retailPrice) || 0 }}</view>
|
||||
<view class="flex flex-wrap px-2">
|
||||
<view class="w-1/2 flex justify-center p-1" v-for="(item, index) in state.detail?.skuList" :key="index">
|
||||
<view class="p-2 w-full bg-#eeeeee77 rounded-2 flex-col second-text-28">
|
||||
<view class="flex justify-between mt-1">
|
||||
<text>单位:</text>
|
||||
<text>{{ item.spec + " / " + item.unit }}</text>
|
||||
</view>
|
||||
<view class="flex justify-between mt-1">
|
||||
<text>口味:</text>
|
||||
<text>{{ item?.attribute || "无" }}</text>
|
||||
</view>
|
||||
<view class="flex justify-between mt-1">
|
||||
<text>库存:</text>
|
||||
<text>{{ item?.stock || 0 }}</text>
|
||||
</view>
|
||||
<view class="flex justify-between mt-1">
|
||||
<text>原价:</text>
|
||||
<text class="line-through">¥ {{ item.retailPrice.toFixed(2) || 0 }}</text>
|
||||
</view>
|
||||
<view class="flex justify-between mt-1">
|
||||
<text>促销:</text>
|
||||
<text class="c-red!">¥ {{ item.promotionPrice.toFixed(2) || item.retailPrice.toFixed(2) || 0 }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="h-15rpx" />
|
||||
<!-- <view class="h-15rpx" />
|
||||
<view class="flex-col justify-between card p-y-20rpx p-x-30rpx">
|
||||
<view class="prefix_title mb-15rpx">评价</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="h-15rpx" />
|
||||
<view class="flex-col justify-between card p-y-20rpx p-x-30rpx">
|
||||
<view class="prefix_title mb-15rpx">详情</view>
|
||||
<view class="m-t-15rpx" v-html="state.detail?.description"></view>
|
||||
<view class="second-text-28 px-3" v-html="state.detail?.description"></view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
Reference in new issue
Block a user