123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409 |
- <template>
- <view class="goods-list">
- <view v-if="type == 'waterfall'" class="goods-waterfall">
- <router-link v-for="(item, index) in list" :key="index"
- :to="{ path: '/pages/goods_details/goods_details', query: { id: item.goods_id || item.id } }">
- <view :style="{ width: width }" class="item bg-white m-t-20">
- <view class="goods-img"><u-image :width="width" :height="width" :border-radius="10"
- :src="item.image"></u-image></view>
- <view class="goods-info">
- <view class="goods-name line-2">{{ item.name }}</view>
- <view class="price mt10 row">
- <price-format :color="colorConfig.primary" class="m-r-10" :first-size="34" :second-size="36"
- :subscript-size="26" :price="item.min_price" :weight="600"></price-format>
- <!-- <price-format class="muted" :firstSize="24" :secondSize="24" :subscript-size="24"
- line-through :price="item.market_price || item.price"></price-format> -->
- <!-- <text >售{{item.sales_actual+item.sales_virtual}}件</text> -->
- </view>
- <view class="tags d-flex align-items-center">
- <view class="item text-center jf"
- v-if="item.max_give_integral != 0 || item.min_give_integral != 0">
- 赠送:{{ item.min_give_integral == item.max_give_integral ? item.min_give_integral : item.min_give_integral + '~' + item.max_give_integral }}券
- </view>
- <view v-if="item.max_give_integral == 0 && item.min_give_integral == 0">
- <view class="item text-center jf"
- v-show="item.given_integral && item.given_integral > 0">
- 赠送:{{ item.given_integral }}券</view>
- </view>
- <text class="item text-center other">七天包换</text>
- </view>
- <view class="power-tags" v-show="item.use_energy > 0">
- 可用{{ ((item.min_price * item.use_energy) / 100 / appConfig.energyprice).toFixed(6) }}抵用券抵扣¥{{
- ((item.min_price * item.use_energy) / 100).toFixed(2)
- }}
- </view>
- </view>
- </view>
- </router-link>
- </view>
- <view v-if="type == 'double'" class="goods-double double flex flex-wrap row-between col-stretch p-l-20 p-r-20">
- <router-link class="m-t-20" v-for="(item, index) in list" :key="index"
- :to="{ path: '/pages/goods_details/goods_details', query: { id: item.goods_id || item.id } }">
- <view class="item bg-white" :style="{ width: width, height: '100%' }">
- <view class="goods-img"><u-image :width="width" :height="width" :border-radius="10"
- :src="item.image"></u-image></view>
- <view class="goods-info">
- <view class="goods-name line-2">{{ item.name }}</view>
- <view class="price mt10 row">
- <price-format :color="colorConfig.primary" class="m-r-10" :first-size="34" :second-size="26"
- :subscript-size="26" :price="item.activity_price || item.min_price"
- :weight="500"></price-format>
- <price-format class="muted" :firstSize="24" :secondSize="24" :subscript-size="24"
- line-through :price="item.market_price || item.price"></price-format>
- </view>
- <view class="tags d-flex align-items-center">
- <view class="item text-center jf"
- v-if="item.max_give_integral != 0 || item.min_give_integral != 0">
- 赠送:{{ item.min_give_integral == item.max_give_integral ? item.min_give_integral : item.min_give_integral + '~' + item.max_give_integral }}券
- </view>
- <view v-if="item.max_give_integral == 0 && item.min_give_integral == 0">
- <view class="item text-center jf"
- v-show="item.given_integral && item.given_integral > 0">
- 赠送:{{ item.given_integral }}券</view>
- </view>
- <text class="item text-center other">七天包换</text>
- </view>
- <view class="power-tags" v-show="item.use_energy > 0">
- 可用{{ ((item.min_price * item.use_energy) / 100 / appConfig.energyprice).toFixed(6) }}抵用券抵扣¥{{
- ((item.min_price * item.use_energy) / 100).toFixed(2)
- }}
- </view>
- </view>
- </view>
- </router-link>
- </view>
- <view v-if="type === 'one' && list.length" class="goods-one m-t-20">
- <router-link v-for="(item, index) in list" :key="index"
- :to="{ path: '/pages/goods_details/goods_details', query: { id: item.goods_id || item.id } }">
- <view class="item bg-white flex">
- <view class="goods-img"><u-image width="120rpx" height="120rpx" :border-radius="10"
- :src="item.image"></u-image></view>
- <view class="goods-info m-l-20 flex-1">
- <view class="goods-name line-2 m-b-10">{{ item.name }}</view>
- <view class="flex row-between m-t-10">
- <view class="price m-t-10 flex">
- <price-format :color="colorConfig.primary" class="m-r-10" :first-size="34"
- :second-size="26" :subscript-size="26" :price="item.min_price || item.price"
- :weight="500"></price-format>
- <price-format class="muted" :firstSize="24" :secondSize="24" :subscript-size="24"
- line-through :price="item.market_price || item.price"></price-format>
- </view>
- </view>
- <view class="power-tags" v-show="item.use_energy > 0">
- 可用{{ ((item.min_price * item.use_energy) / 100 / appConfig.energyprice).toFixed(6) }}抵用券抵扣¥{{
- ((item.min_price * item.use_energy) / 100).toFixed(2)
- }}
- </view>
- </view>
- </view>
- </router-link>
- </view>
- <view v-if="type.includes('row')" class="goods-row flex">
- <router-link class="item" v-for="(item, index) in list" :key="index"
- :to="{ path: '/pages/goods_details/goods_details', query: { id: item.goods_id || item.id } }">
- <view :class="[{ 'bg-white': showBg }]">
- <view class="goods-img"><u-image width="120rpx" height="120rpx" :border-radius="10"
- :src="item.image"></u-image></view>
- <view class="goods-info">
- <view class="goods-name line-1 sm">{{ item.name }}</view>
- <view class="price m-t-10 row">
- <price-format :color="colorConfig.primary" class="m-r-10" :first-size="28" :second-size="22"
- :subscript-size="22" :price="item.min_price" :weight="500"></price-format>
- <price-format class="muted" :firstSize="22" :secondSize="22" :subscript-size="22"
- line-through :price="item.market_price || item.price"></price-format>
- </view>
- <view class="power-tags" v-show="item.use_energy > 0">
- 可用{{ ((item.min_price * item.use_energy) / 100 / appConfig.energyprice).toFixed(6) }}抵用券抵扣¥{{
- ((item.min_price * item.use_energy) / 100).toFixed(2)
- }}
- </view>
- </view>
- <image v-if="index < 3 && type == 'row-hot'" class="paixu"
- :src="'/static/images/No.' + index + '.png'"></image>
- </view>
- </router-link>
- </view>
- <view v-if="type == 'new'" class="goods-new">
- <router-link v-for="(item, index) in list" :key="index"
- :to="{ path: '/pages/goods_details/goods_details', query: { id: item.goods_id || item.id } }">
- <view class="item flex" :class="[{ 'bg-white': showBg }]">
- <view class="goods-img"><u-image width="107rpx" height="107rpx" :border-radius="10"
- :src="item.image"></u-image></view>
- <view class="goods-info flex-1 m-l-20 flex-1">
- <view class="goods-name line-2">{{ item.name }}</view>
- <view class="price m-t-20 flex row-between">
- <view class="muted xxs">
- 原价
- <price-format :first-size="24" :second-size="24" :subscript-size="24"
- :price="item.market_price"></price-format>
- </view>
- <view class="muted xxs"></view>
- <!-- <view class="muted xxs">{{ item.sales_total }}人购买</view> -->
- </view>
- <view class="btn flex row-between m-t-20">
- <price-format :color="colorConfig.primary" class="m-r-10" :first-size="34" :second-size="26"
- :subscript-size="26" :price="item.min_price" :weight="500"></price-format>
- <button class="bg-primary br60 white btn" size="xs">去购买</button>
- </view>
- </view>
- </view>
- </router-link>
- </view>
- <view v-if="type == 'hot'" class="goods-hot">
- <router-link v-for="(item, index) in list" :key="index"
- :to="{ path: '/pages/goods_details/goods_details', query: { id: item.goods_id || item.id } }">
- <view class="item flex bg-white m-t-20">
- <view class="goods-img"><u-image :lazy-load="true" width="90rpx" height="90rpx" border-radius="6rpx"
- :src="item.image" /></view>
- <view class="goods-info m-l-20 flex-1">
- <view class="goods-name line-2 m-b-10">{{ item.name }}</view>
- <!-- <text class="sale br60 xxs">已有{{ item.sales_total }}人购买</text> -->
- <view class="row-between flex m-t-10">
- <view class="price m-t-10 flex">
- <price-format :color="colorConfig.primary" class="m-r-10" :first-size="34"
- :second-size="26" :subscript-size="26" :price="item.min_price"
- :weight="500"></price-format>
- <price-format class="muted" :firstSize="24" :secondSize="24" :subscript-size="24"
- line-through :price="item.market_price"></price-format>
- </view>
- <button class="bg-primary br60 white btn" size="xs">立即抢购</button>
- </view>
- </view>
- <image v-if="index < 3" class="paixu" :src="'/static/images/No.' + index + '.png'"></image>
- </view>
- </router-link>
- </view>
- <view v-if="type == 'activity'" class="goods-hot">
- <router-link v-for="(item, index) in list" :key="index"
- :to="{ path: '/pages/goods_details/goods_details', query: { id: item.goods_id || item.id } }">
- <view class="item flex bg-white m-t-20">
- <view class="goods-img"><u-image :lazy-load="true" width="90rpx" height="90rpx" border-radius="6rpx"
- :src="item.image" /></view>
- <view class="goods-info m-l-20 flex-1">
- <view class="goods-name line-2 m-b-10">{{ item.name }}</view>
- <text class="views br60 xxs">{{ item.views }}浏览量</text>
- <view class="row-between flex m-t-10">
- <view class="price m-t-10 flex">
- <price-format :color="colorConfig.primary" class="m-r-10" :first-size="34"
- :second-size="26" :subscript-size="26" :price="item.price"
- :weight="500"></price-format>
- <price-format class="muted" :firstSize="24" :secondSize="24" :subscript-size="24"
- line-through :price="item.market_price"></price-format>
- </view>
- <button class="bg-primary br60 white btn" size="xs">立即抢购</button>
- </view>
- </view>
- </view>
- </router-link>
- </view>
- </view>
- </template>
- <script>
- import {
- mapGetters
- } from 'vuex';
- export default {
- props: {
- type: {
- type: String,
- default: 'double'
- },
- list: {
- type: Array,
- default: () => []
- },
- isBargain: {
- type: Boolean,
- default: false
- },
- // 两行时有效
- width: {
- type: String,
- default: '347rpx'
- },
- showBg: {
- type: Boolean,
- default: true
- }
- },
- data() {
- return {};
- },
- computed: {
- ...mapGetters(['appConfig'])
- }
- };
- </script>
- <style lang="scss" scoped>
- .goods-list {
- .power-tags {
- font-size: 20rpx;
- color: #0eb5f1;
- margin: 20rpx auto 0;
- text-align: center;
- border-radius: 8rpx;
- background-color: #ddf6ff;
- height: 36rpx;
- line-height: 36rpx;
- white-space: nowrap;
- }
- .goods-waterfall {
- .item {
- width: 347rpx;
- border-radius: 10rpx;
- overflow: hidden;
- .goods-info {
- padding: 20rpx 10rpx;
- }
- .goods-name {
- color: #040404;
- font-weight: 600;
- font-size: 28rpx;
- }
- .price {
- margin: 6rpx auto;
- }
- .tags {
- font-size: 20upx;
- .item {
- width: auto;
- }
- .jf {
- border: 1px solid #ff0b0b;
- color: #ff0b0b;
- border-radius: 4rpx;
- padding: 0 6rpx;
- }
- .other {
- border: 1px solid #616161;
- color: #616161;
- border-radius: 4rpx;
- padding: 0 6rpx;
- margin-left: 10rpx;
- }
- }
- }
- }
- .goods-double {
- .item {
- width: 347rpx;
- border-radius: 10rpx;
- overflow: hidden;
- .goods-info {
- padding: 10rpx;
- .goods-name {
- font-weight: 600;
- line-height: 40rpx;
- }
- }
- }
- .tags {
- font-size: 20upx;
- .item {
- width: auto;
- }
- .jf {
- border: 1px solid #ff0b0b;
- color: #ff0b0b;
- border-radius: 4rpx;
- padding: 0 6rpx;
- }
- .other {
- border: 1px solid #616161;
- color: #616161;
- border-radius: 4rpx;
- padding: 0 6rpx;
- margin-left: 10rpx;
- }
- }
- }
- .goods-one .item {
- padding: 20rpx;
- &:not(:last-of-type) {
- margin-bottom: 20rpx;
- }
- }
- .goods-seckill .item {
- padding: 20rpx;
- }
- .goods-new .item {
- padding: 0 20rpx 20rpx;
- border-radius: 10rpx;
- }
- .goods-row {
- .item {
- position: relative;
- width: 120rpx;
- border-radius: 16rpx;
- overflow: hidden;
- &:not(:last-of-type) {
- margin-right: 20rpx;
- }
- .goods-info {
- padding: 10rpx;
- }
- }
- }
- .goods-hot {
- .item {
- position: relative;
- padding: 30rpx 20rpx;
- border-radius: 10rpx;
- .goods-info {
- width: 450rpx;
- .sale {
- padding: 4rpx 18rpx;
- color: #f79c0c;
- background-color: rgba(247, 156, 12, 0.1);
- }
- .views {
- padding: 4rpx 18rpx;
- color: #ff2c3c;
- background-color: rgba(237, 83, 73, 0.1);
- }
- }
- }
- }
- .goods-row,
- .goods-hot {
- .paixu {
- position: absolute;
- top: 0;
- left: 20rpx;
- width: 48rpx;
- height: 60rpx;
- }
- }
- }
- </style>
|