代码提交

This commit is contained in:
黄少君
2023-11-14 17:21:03 +08:00
parent d0b337c596
commit dcab74274f
567 changed files with 22414 additions and 7375 deletions

View File

@ -1,31 +1,31 @@
<template>
<view
:class="{ goods: true, 'goods-card': card, 'goods-list': list, 'goods-min': min, 'goods-fill': fill, 'goods-round': round }"
:class="{ goods: true, 'goods-card': card, 'goods-list': list, 'goods-min': min, 'goods-fill': fill, 'goods-round': round }"
@tap="toDetail"
>
<view
class="goods-header"
@tap="toDetail"
class="goods-header"
>
<view class="goods-thumb">
<image
:src="data.image"
class="goods-thumb-img"
style="object-fit: cover"
:src="data.image"
class="goods-thumb-img"
style="object-fit: cover"
/>
</view>
</view>
<view :class="['goods-content']">
<view
class="goods-storeName"
@tap="toDetail"
>{{ data.storeName }}</view>
class="goods-storeName"
>{{ data.storeName }}
</view>
<view
class="goods-list-model"
v-if="selectModel"
class="goods-list-model"
v-if="selectModel"
>
<div
class="goods-list-model-border"
@tap.stop="handleOpenSelect"
class="goods-list-model-border"
@tap.stop="handleOpenSelect"
>
<view class="goods-list-model-label">{{ data.attrInfo.sku }}</view>
<view class="goods-list-model-action icon">
@ -34,8 +34,8 @@
</div>
</view>
<view
class="goods-list-model-info"
v-if="model"
class="goods-list-model-info"
v-if="model"
>
<view class="goods-list-model-label">{{ data.attrInfo.sku }}</view>
@ -47,45 +47,54 @@
<view class="goods-info">
<view class="goods-info-left">
<view
class="goods-desc"
v-if="groupNum"
>{{ data.groupNum }}人团</view>
class="goods-desc"
v-if="groupNum"
>{{ data.groupNum }}人团
</view>
<view
class="goods-price-row"
v-if="primary"
class="goods-price-row"
v-if="primary"
>
<view class="goods-price goods-price-primary">
¥{{ data.price }}
¥{{price || data.price }}
</view>
<view
class="goods-price goods-price-original"
v-if="original"
class="goods-price goods-price-original"
v-if="original"
>
¥{{ data.original }}
</view>
</view>
<view
class="goods-price goods-price-default"
v-if="!primary"
>¥{{ data.price }}</view>
class="goods-price goods-price-default"
v-if="!primary"
>
<slot
name="price"
:row="data"
>
¥{{price || data.price }}
</slot>
</view>
</view>
<view class="goods-info-action">
<view class="goods-info-action-btn">
<slot name="action"></slot>
</view>
<view
class="goods-info-action-desc"
v-if="stock"
v-if="stock"
class="goods-info-action-desc"
>
仅剩{{ data.stock }}
<text v-if="data.stock">仅剩{{ data.stock }}</text>
<text v-else>库存不足</text>
</view>
<view
class="buy-num"
v-if="purchase"
class="buy-num"
v-if="purchase"
>
<view class="buy-num-info-desc">
{{ data.purchase }}
x{{ purchase }}
</view>
</view>
@ -95,21 +104,21 @@
<view class="buy-progress">
<view class="buy-progress-info">
<view
class="buy-progress-info-desc"
v-if="quantity"
class="buy-progress-info-desc"
v-if="quantity"
>
限量{{ data.quantity }}
</view>
<uv-line-progress
:percentage="50"
:showText="false"
:percentage="50"
:showText="false"
/>
</view>
<view class="buy-progress-action">
<uv-button
round
block
type="primary"
round
block
type="primary"
>
立即抢购
</uv-button>
@ -118,17 +127,18 @@
</view>
</view>
<good-attr-select
ref="selectAttrPanel"
:id="data.id"
@select="handleSelectAttr"
ref="selectAttrPanel"
:id="data.id"
@select="handleSelectAttr"
/>
</view>
</template>
<script setup>
import { navigateTo } from '@/utils/router';
import { ref } from 'vue'
const props = defineProps(['data', 'min', 'groupNum', 'original', 'stock', 'primary', 'card', 'list', 'buyProgress', 'quantity', 'selectModel', 'model', 'purchase', 'link', 'fill', 'round'])
import { useRouter } from "@/hooks/useRouter";
const props = defineProps(['data', 'min', 'groupNum', 'original', 'stock', 'primary', 'card', 'list', 'buyProgress', 'quantity', 'selectModel', 'model', 'purchase', 'link', 'fill', 'round','price'])
// 团购人数
const groupNum = ref(props.groupNum)
@ -150,23 +160,25 @@ const selectModel = ref(props.selectModel !== undefined)
const model = ref(props.model !== undefined)
// 购买数量
const purchase = ref(props.purchase)
// 购买价格
const price = ref(props.price)
// 原价
const original = ref(props.original)
// 小尺寸
const min = ref(props.min)
const selectAttrPanel = ref(null)
const link = ref(props.link !== undefined)
const fill = ref(props.fill !== undefined)
const round = ref(props.round !== undefined)
const {push} = useRouter()
const toDetail = () => {
if (!link.value) { return }
navigateTo({
url: '/pages/goodsDetail/goodsDetail',
query: {
id: props.data.id
}
})
if (!link.value) {
return
}
push({url: '/pages/goodsDetail/goodsDetail'}, {data: {id: props.data.id}})
}
const handleOpenSelect = () => {
@ -179,7 +191,7 @@ const handleSelectAttr = () => {
</script>
<style lang="less">
<style lang="scss">
.goods {
position: relative;
padding: 30rpx 0;
@ -188,7 +200,6 @@ const handleSelectAttr = () => {
&-card {
display: flex;
flex-direction: column;
.goods {
&-content {
padding: 0 20rpx;
@ -205,7 +216,8 @@ const handleSelectAttr = () => {
width: 100%;
&-img {
width: 100%;
width: 300rpx;
height: 300rpx;
display: block;
}
}
@ -213,43 +225,48 @@ const handleSelectAttr = () => {
}
}
&-header {}
&-header {
}
&-thumb {
background: #FAFAFA;
}
&-content {}
&-content {
}
&-storeName {
line-height: 40rpx;
font-size: 28rpx;
font-weight: 500;
color: #333333;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
&-price {
&-row {
display: flex;
align-items: center;
.goods-price {}
.goods-price {
}
}
&-primary {
line-height: 42rpx;
font-size: 30rpx;
font-weight: 500;
color: #EE6D46;
}
&-default {
line-height: 40rpx;
font-size: 28rpx;
font-weight: 500;
color: #333333;
line-height: 42rpx;
font-size: 30rpx;
color: #EE6D46;
}
&-original {
@ -274,10 +291,12 @@ const handleSelectAttr = () => {
align-items: flex-end;
justify-content: space-between;
&-left {}
&-left {
}
&-action {
&-btn {}
&-btn {
}
&-desc {
line-height: 28rpx;
@ -290,21 +309,22 @@ const handleSelectAttr = () => {
}
&-image {
&-img {}
&-img {
}
}
&-list {
display: flex;
flex-direction: row;
padding: 14rpx;
padding: 40rpx 34rpx 30rpx;
box-sizing: border-box;
width: 100%;
.goods {
&-thumb {
margin-bottom: 0;
width: 220rpx;
height: 220rpx;
width: 200rpx;
height: 200rpx;
&-img {
width: 100%;
@ -314,17 +334,16 @@ const handleSelectAttr = () => {
}
&-content {
padding-right: 40rpx;
margin-left: 30rpx;
margin-left: 40rpx;
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
width: 0;
}
}
&-model {
display: flex;
@ -341,7 +360,8 @@ const handleSelectAttr = () => {
padding: 0 10rpx;
}
&-info {}
&-info {
}
&-label {
line-height: 38rpx;
@ -466,7 +486,6 @@ const handleSelectAttr = () => {
// }
// &-desc {
// color: #999999;
// font-size: 24rpx;
@ -556,7 +575,6 @@ const handleSelectAttr = () => {
}
.buy-num {
&-info-desc {
color: #999999;
font-size: 24rpx;