前端小程序
这个提交包含在:
@@ -0,0 +1,174 @@
|
||||
<template>
|
||||
<view class="adv-box u-m-y-10 u-m-x-20">
|
||||
<!-- 模板1-->
|
||||
<view class="u-flex" v-if="advType === 1">
|
||||
<image style="width:710rpx;height:220rpx;border-radius: 10rpx;" @tap="jump(advList[0].path)" :src="advList[0].image" mode="aspectFill"></image>
|
||||
</view>
|
||||
<!-- 模板2-->
|
||||
<view class="type1 u-flex" v-if="advType === 2">
|
||||
<image class="type1-img u-m-r-10" @tap="jump(advList[0].path)" :src="advList[0].image" mode="aspectFill"></image>
|
||||
<image class="type1-img" @tap="jump(advList[1].path)" :src="advList[1].image" mode="aspectFill"></image>
|
||||
</view>
|
||||
<!-- 模板3-->
|
||||
<view class="type2 u-flex" v-if="advType === 3">
|
||||
<view class="type2-img1 u-m-r-10"><image class="type2-img1 " @tap="jump(advList[0].path)" :src="advList[0].image" mode="aspectFill"></image></view>
|
||||
<view class="type2-box">
|
||||
<image class="type2-img2" @tap="jump(advList[1].path)" :src="advList[1].image" mode="aspectFill"></image>
|
||||
<image class="type2-img2" @tap="jump(advList[2].path)" :src="advList[2].image" mode="aspectFill"></image>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 模板4-->
|
||||
<view class="type3 u-flex" v-if="advType === 4">
|
||||
<view class="type3-box">
|
||||
<image class="type3-img1" @tap="jump(advList[0].path)" :src="advList[0].image" mode="aspectFill"></image>
|
||||
<image class="type3-img1" @tap="jump(advList[1].path)" :src="advList[1].image" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="type3-img2 u-m-l-10"><image class="type3-img2" @tap="jump(advList[2].path)" :src="advList[2].image" mode="aspectFill"></image></view>
|
||||
</view>
|
||||
<!-- 模板5-->
|
||||
<view class="type4 " v-if="advType === 5">
|
||||
<view class="type4-box u-flex">
|
||||
<image class="type4-img1 u-m-r-10" @tap="jump(advList[0].path)" :src="advList[0].image" mode="aspectFill"></image>
|
||||
<image class="type4-img1" @tap="jump(advList[1].path)" :src="advList[1].image" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="type4-img2 u-m-t-10"><image class="type4-img2" @tap="jump(advList[2].path)" :src="advList[2].image" mode="aspectFill"></image></view>
|
||||
</view>
|
||||
<!-- 模板6-->
|
||||
<view class="type5" v-if="advType === 6">
|
||||
<view class="type5-img1 u-m-b-10"><image class="type5-img1" @tap="jump(advList[0].path)" :src="advList[0].image" mode="aspectFill"></image></view>
|
||||
<view class="type5-box u-flex">
|
||||
<image class="type5-img2 u-m-r-10" @tap="jump(advList[1].path)" :src="advList[1].image" mode="aspectFill"></image>
|
||||
<image class="type5-img2" @tap="jump(advList[2].path)" :src="advList[2].image" mode="aspectFill"></image>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 模板7-->
|
||||
<view class="type6" v-if="advType === 7">
|
||||
<view class="u-flex type6-box1 u-m-b-10">
|
||||
<image class="type6-img1 u-m-r-10" @tap="jump(advList[0].path)" :src="advList[0].image" mode="aspectFill"></image>
|
||||
<image class="type6-img1" @tap="jump(advList[1].path)" :src="advList[1].image" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="u-flex type6-box2">
|
||||
<image class="type6-img2 u-m-r-10" @tap="jump(advList[2].path)" :src="advList[2].image" mode="aspectFill"></image>
|
||||
<image class="type6-img2 u-m-r-10" @tap="jump(advList[3].path)" :src="advList[3].image" mode="aspectFill"></image>
|
||||
<image class="type6-img2" @tap="jump(advList[4].path)" :src="advList[4].image" mode="aspectFill"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/**
|
||||
* 自定义之广告魔方
|
||||
* @property {Object} detail -广告魔方信息
|
||||
*/
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
advType: this.detail.style ,// 模板样式
|
||||
advList:this.detail.list // adv数据
|
||||
};
|
||||
},
|
||||
props: {
|
||||
detail: {}
|
||||
},
|
||||
computed: {},
|
||||
created() {},
|
||||
methods: {
|
||||
// 路由跳转
|
||||
jump(path) {
|
||||
this.$tools.routerTo(path);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@mixin grid($row: 1) {
|
||||
width: calc((710 - ($row - 1) * 10) / $row) + rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
.adv-box {
|
||||
.type1 {
|
||||
.type1-img {
|
||||
@include grid(2);
|
||||
height: 220rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.type2 {
|
||||
.type2-img1 {
|
||||
height: 350rpx;
|
||||
@include grid(2);
|
||||
}
|
||||
.type2-box {
|
||||
height: 350rpx;
|
||||
@include grid(2);
|
||||
.type2-img2 {
|
||||
height: 170rpx;
|
||||
@include grid(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.type3 {
|
||||
.type3-box {
|
||||
height: 350rpx;
|
||||
@include grid(2);
|
||||
.type3-img1 {
|
||||
height: 170rpx;
|
||||
@include grid(2);
|
||||
}
|
||||
}
|
||||
|
||||
.type3-img2 {
|
||||
height: 350rpx;
|
||||
@include grid(2);
|
||||
}
|
||||
}
|
||||
|
||||
.type4 {
|
||||
.type4-box {
|
||||
.type4-img1 {
|
||||
height: 170rpx;
|
||||
@include grid(2);
|
||||
}
|
||||
}
|
||||
|
||||
.type4-img2 {
|
||||
@include grid(1);
|
||||
height: 220rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.type5 {
|
||||
.type5-img1 {
|
||||
@include grid(1);
|
||||
height: 220rpx;
|
||||
}
|
||||
|
||||
.type5-box {
|
||||
.type5-img2 {
|
||||
height: 170rpx;
|
||||
@include grid(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.type6 {
|
||||
.type6-box1 {
|
||||
.type6-img1 {
|
||||
height: 170rpx;
|
||||
@include grid(2);
|
||||
}
|
||||
}
|
||||
|
||||
.type6-box2 {
|
||||
.type6-img2 {
|
||||
height: 170rpx;
|
||||
@include grid(3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,109 @@
|
||||
<template>
|
||||
<!-- 轮播 -->
|
||||
<view class="banner-swiper-wrap u-m-b-10" :style="{ padding: `${Py}rpx ${Px}rpx` }">
|
||||
<swiper
|
||||
:key="swiperKey"
|
||||
:style="bannerBoxStyle"
|
||||
class="banner-swiper square-dot"
|
||||
:indicator-dots="list.length > 1"
|
||||
:circular="list.length > 1"
|
||||
:autoplay="list.length > 1"
|
||||
interval="5000"
|
||||
duration="500"
|
||||
>
|
||||
<swiper-item
|
||||
v-for="(item, index) in list"
|
||||
:key="item.image || index"
|
||||
class="banner-swiper-item"
|
||||
:style="{ borderRadius: borderRadius + 'rpx' }"
|
||||
@tap="onSwiper(index)"
|
||||
>
|
||||
<image
|
||||
class="banner-swiper__img"
|
||||
:style="imageStyle"
|
||||
:src="item.image"
|
||||
mode="aspectFill"
|
||||
:lazy-load="false"
|
||||
></image>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/**
|
||||
* shBanner-轮播卡片
|
||||
* @property {Array} list 轮播图数据,
|
||||
* @property {String Number} height 轮播图组件高度,单位rpx(默认250)
|
||||
* @property {String} borderRadius 圆角值
|
||||
* @event {Function} click 点击轮播图时触发
|
||||
*/
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
props: {
|
||||
Px: {
|
||||
type: [Number, String],
|
||||
default: 0
|
||||
},
|
||||
Py: {
|
||||
type: [Number, String],
|
||||
default: 0
|
||||
},
|
||||
list: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
borderRadius: {
|
||||
type: [Number, String],
|
||||
default: 0
|
||||
},
|
||||
height: {
|
||||
type: [Number, String],
|
||||
default: 250
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
bannerBoxStyle() {
|
||||
return {
|
||||
width: '100%',
|
||||
height: `${this.height}rpx`
|
||||
};
|
||||
},
|
||||
imageStyle() {
|
||||
return {
|
||||
width: '100%',
|
||||
height: `${this.height}rpx`,
|
||||
borderRadius: `${this.borderRadius}rpx`
|
||||
};
|
||||
},
|
||||
swiperKey() {
|
||||
return `${this.height}-${this.list.map(item => item.image || '').join('|')}`;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onSwiper(e) {
|
||||
this.$tools.routerTo(this.list[e].path);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.banner-swiper {
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.banner-swiper-item {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.banner-swiper__img {
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,391 @@
|
||||
<template>
|
||||
<!-- 分类选项卡 -->
|
||||
<view class="category-tabs-wrap" :class="{ 'category-tabs-wrap--home': homeMode }">
|
||||
<!-- 吸顶分类 Tab(首页预览模式隐藏) -->
|
||||
<view v-if="!homeMode" class="u-sticky-wrap" :class="[elClass]" :style="{ height: fixed ? height + 'px' : 'auto', backgroundColor: isSticky ? '#fff' : '#F5F7FA' }">
|
||||
<view
|
||||
class="u-sticky"
|
||||
:style="{ position: fixed ? 'fixed' : 'static', top: stickyTop + 'px', left: left + 'px', width: width == 'auto' ? 'auto' : width + 'px', zIndex: 1109 }"
|
||||
>
|
||||
<view class="tabs-wrap u-p-y-20" :style="isSticky ? 'border-bottom:1px solid #eee;background-color:#fff' : ''">
|
||||
<scroll-view scroll-x class="tabs-content" enable-flex scroll-with-animation :scroll-left="scrollLeft">
|
||||
<view class="u-flex u-row-cetner u-flex-1 u-col-center">
|
||||
<view class="tab-item u-flex-col u-col-center u-row-center" v-for="(item, index) in tabsList" :key="index" @tap="tabChange(index)">
|
||||
<view class="tab-title u-m-y-6" :class="{ 'title-active': tabCur == index }">{{ item.name }}</view>
|
||||
<view class="tab-des" :class="{ 'des-active': tabCur == index }">{{ item.description }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 首页:紧凑双列商品 -->
|
||||
<view class="home-compact-grid" v-if="homeMode">
|
||||
<view class="home-compact-item" v-for="item in goodsList" :key="item.id">
|
||||
<shopro-goods-card
|
||||
layout="compact"
|
||||
:detail="item"
|
||||
:type="item.activity_type || ''"
|
||||
:image="item.image"
|
||||
:title="item.title"
|
||||
:subtitle="item.subtitle"
|
||||
:price="item.price"
|
||||
:originPrice="item.original_price"
|
||||
:tagTextList="item.activity_discounts_tags"
|
||||
@click="$Router.push({ path: '/pages/goods/detail', query: { id: item.id } })"
|
||||
></shopro-goods-card>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 瀑布流 -->
|
||||
<view class="u-waterfall u-p-16" v-else-if="styleType == 1">
|
||||
<view id="u-left-column" class="u-column">
|
||||
<view class="goods-item u-m-b-16 u-flex u-row-center u-col-center" v-for="leftGoods in leftList" :key="leftGoods.id">
|
||||
<shopro-goods-card
|
||||
:detail="leftGoods"
|
||||
:type="leftGoods.activity_type || ''"
|
||||
:image="leftGoods.image"
|
||||
:title="leftGoods.title"
|
||||
:subtitle="leftGoods.subtitle"
|
||||
:price="leftGoods.price"
|
||||
:originPrice="leftGoods.original_price"
|
||||
:tagTextList="leftGoods.activity_discounts_tags"
|
||||
@click="$Router.push({ path: '/pages/goods/detail', query: { id: leftGoods.id } })"
|
||||
></shopro-goods-card>
|
||||
</view>
|
||||
</view>
|
||||
<view id="u-right-column" class="u-column">
|
||||
<view class="goods-item u-m-b-16 u-flex u-row-center u-col-center" v-for="rightGoods in rightList" :key="rightGoods.id">
|
||||
<shopro-goods-card
|
||||
:detail="rightGoods"
|
||||
:type="rightGoods.activity_type || ''"
|
||||
:image="rightGoods.image"
|
||||
:title="rightGoods.title"
|
||||
:subtitle="rightGoods.subtitle"
|
||||
:price="rightGoods.price"
|
||||
:originPrice="rightGoods.original_price"
|
||||
:tagTextList="rightGoods.activity_discounts_tags"
|
||||
@click="$Router.push({ path: '/pages/goods/detail', query: { id: rightGoods.id } })"
|
||||
></shopro-goods-card>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- m -->
|
||||
<view class="big-card-wrap u-p-10" v-else-if="styleType == 2">
|
||||
<block v-for="item in goodsList" :key="item.id">
|
||||
<sh-goods-card
|
||||
:detail="item"
|
||||
:type="item.activity_type || ''"
|
||||
:image="item.image"
|
||||
:title="item.title"
|
||||
:subtitle="item.subtitle"
|
||||
:price="item.price"
|
||||
:originPrice="item.original_price"
|
||||
:sales="item.sales"
|
||||
:tagTextList="item.activity_discounts_tags"
|
||||
@click="$Router.push({ path: '/pages/goods/detail', query: { id: item.id } })"
|
||||
></sh-goods-card>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<view class="x-c" style="width: 100%;">
|
||||
<!-- 缺省页 -->
|
||||
<shopro-empty v-if="isEmpty" marginTop="200rpx" :image="$IMG_URL + '/imgs/empty/empty_goods.png'" tipText="暂无该商品,还有更多好货等着你噢~"></shopro-empty>
|
||||
|
||||
<!-- 更多 -->
|
||||
<u-loadmore v-show="!isEmpty" height="80rpx" :status="loadStatus" icon-type="flower" color="#ccc" />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/**
|
||||
* category-tabs
|
||||
* @description 一个可以吸顶的分类列表
|
||||
* @property {Boolean} enable = false - 是否吸顶,tabbar项中,组件不会自动销毁,需要自行开关
|
||||
* @property {Array} tabsList - 分类列表
|
||||
* @property {Array | Number} styleType - 卡片类型
|
||||
*/
|
||||
let systemInfo = uni.getSystemInfoSync();
|
||||
// #ifdef MP-WEIXIN || MP-BAIDU || MP-TOUTIAO || MP-QQ
|
||||
let menuButtonInfo = uni.getMenuButtonBoundingClientRect();
|
||||
// #endif
|
||||
import shGoodsCard from '../components/sh-goods-card.vue';
|
||||
export default {
|
||||
components: {
|
||||
shGoodsCard
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 吸顶相关
|
||||
fixed: false,
|
||||
height: 'auto',
|
||||
elClass: this.$u.guid(),
|
||||
left: 0,
|
||||
width: 'auto',
|
||||
stickyTop: 0,
|
||||
isSticky: false, //是否吸顶
|
||||
|
||||
// 瀑布流 350-330
|
||||
addTime: 100, //排序间隙时间
|
||||
leftHeight: 0,
|
||||
rightHeight: 0,
|
||||
leftList: [],
|
||||
rightList: [],
|
||||
tempList: [],
|
||||
|
||||
tabCur: 0,
|
||||
scrollLeft: 0,
|
||||
isEmpty: true,
|
||||
categoryId: this.tabsList[0]?.id,
|
||||
goodsList: [],
|
||||
tabCurrent: 0,
|
||||
loadStatus: 'loadmore', //loadmore-加载前的状态,loading-加载中的状态,nomore-没有更多的状态
|
||||
currentPage: 1,
|
||||
lastPage: 1
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
enable(val) {
|
||||
if (val == false) {
|
||||
this.fixed = false;
|
||||
this.disconnectObserver('contentObserver');
|
||||
} else {
|
||||
this.initObserver();
|
||||
}
|
||||
}
|
||||
},
|
||||
props: {
|
||||
tabsList: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
styleType: {
|
||||
type: [String, Number],
|
||||
default: 1
|
||||
},
|
||||
enable: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
homeMode: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getGoodsList();
|
||||
// 触底监听
|
||||
uni.$on('uOnReachBottom', data => {
|
||||
if (this.currentPage < this.lastPage) {
|
||||
this.currentPage += 1;
|
||||
this.getGoodsList();
|
||||
}
|
||||
});
|
||||
},
|
||||
mounted() {
|
||||
this.initObserver();
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.disconnectObserver('contentObserver');
|
||||
},
|
||||
methods: {
|
||||
// 瀑布流相关
|
||||
async splitData() {
|
||||
if (!this.tempList.length) return;
|
||||
let item = this.tempList[0];
|
||||
if (!item) return;
|
||||
|
||||
// 分左右
|
||||
if (this.leftHeight < this.rightHeight) {
|
||||
this.leftHeight += item.activity_discounts_tags.length ? 350 : 330;
|
||||
this.leftList.push(item);
|
||||
} else if (this.leftHeight > this.rightHeight) {
|
||||
this.rightHeight += item.activity_discounts_tags.length ? 350 : 330;
|
||||
this.rightList.push(item);
|
||||
} else {
|
||||
this.leftHeight += item.activity_discounts_tags.length ? 350 : 330;
|
||||
this.leftList.push(item);
|
||||
}
|
||||
|
||||
// 移除临时列表的第一项,如果临时数组还有数据,继续循环
|
||||
this.tempList.splice(0, 1);
|
||||
if (this.tempList.length) {
|
||||
setTimeout(() => {
|
||||
this.splitData();
|
||||
}, this.addTime);
|
||||
}
|
||||
},
|
||||
clear() {
|
||||
this.leftList = [];
|
||||
this.rightList = [];
|
||||
this.leftHeight = 0;
|
||||
this.rightHeight = 0;
|
||||
this.tempList = [];
|
||||
},
|
||||
|
||||
// 吸顶相关
|
||||
initObserver() {
|
||||
if (!this.enable) return;
|
||||
// #ifdef APP-PLUS || H5
|
||||
this.stickyTop = systemInfo.statusBarHeight + 44;
|
||||
// #endif
|
||||
// #ifdef MP
|
||||
let height = systemInfo.platform == 'ios' ? 44 : 48;
|
||||
let top = systemInfo.statusBarHeight + height;
|
||||
this.stickyTop = systemInfo.statusBarHeight + height;
|
||||
// #endif
|
||||
this.disconnectObserver('contentObserver');
|
||||
|
||||
this.$uGetRect('.' + this.elClass).then(res => {
|
||||
this.height = res.height;
|
||||
this.left = res.left;
|
||||
this.width = res.width;
|
||||
this.$nextTick(() => {
|
||||
this.observeContent();
|
||||
});
|
||||
});
|
||||
},
|
||||
observeContent() {
|
||||
this.disconnectObserver('contentObserver');
|
||||
const contentObserver = this.createIntersectionObserver({
|
||||
thresholds: [0.95, 0.98, 1]
|
||||
});
|
||||
contentObserver.relativeToViewport({
|
||||
top: -this.stickyTop
|
||||
});
|
||||
contentObserver.observe('.' + this.elClass, res => {
|
||||
if (!this.enable) return;
|
||||
this.setFixed(res.boundingClientRect.top);
|
||||
});
|
||||
this.contentObserver = contentObserver;
|
||||
},
|
||||
setFixed(top) {
|
||||
const fixed = top < this.stickyTop;
|
||||
if (fixed) {
|
||||
this.isSticky = true;
|
||||
} else if (this.fixed) {
|
||||
this.isSticky = false;
|
||||
}
|
||||
this.fixed = fixed;
|
||||
},
|
||||
disconnectObserver(observerName) {
|
||||
const observer = this[observerName];
|
||||
observer && observer.disconnect();
|
||||
},
|
||||
|
||||
// 商品列表
|
||||
getGoodsList() {
|
||||
let that = this;
|
||||
that.$http('goods.lists', {
|
||||
category_id: that.categoryId,
|
||||
page: that.currentPage
|
||||
}).then(res => {
|
||||
if (res.code === 1) {
|
||||
that.goodsList = [...that.goodsList, ...res.data.data];
|
||||
that.tempList = res.data.data;
|
||||
that.isEmpty = !that.goodsList.length;
|
||||
that.lastPage = res.data.last_page;
|
||||
that.loadStatus = that.currentPage < res.data.last_page ? 'loadmore' : 'nomore';
|
||||
if (that.homeMode) {
|
||||
return;
|
||||
}
|
||||
that.splitData();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// tabs
|
||||
tabChange(index) {
|
||||
this.tabCur = index;
|
||||
this.scrollLeft = (index - 1) * 60;
|
||||
this.categoryId = this.tabsList[index].id;
|
||||
this.styleType === 1 && this.clear();
|
||||
this.goodsList = [];
|
||||
this.currentPage = 1;
|
||||
this.lastPage = 1;
|
||||
this.loadStatus = 'loadmore';
|
||||
this.getGoodsList();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@mixin vue-flex($direction: row) {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
flex-direction: $direction;
|
||||
/* #endif */
|
||||
}
|
||||
.category-tabs-wrap {
|
||||
min-height: 1000rpx;
|
||||
// 吸顶
|
||||
.u-sticky-wrap {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
&--home {
|
||||
min-height: auto;
|
||||
}
|
||||
// 瀑布流
|
||||
.u-waterfall {
|
||||
@include vue-flex;
|
||||
flex-direction: row;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.u-column {
|
||||
@include vue-flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
height: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.home-compact-grid {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
padding: 0 $brand-page-gutter 24rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.home-compact-item {
|
||||
width: calc(50% - 10rpx);
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
// 滑动分类
|
||||
.tabs-content {
|
||||
white-space: nowrap;
|
||||
.tab-item {
|
||||
min-height: 90rpx;
|
||||
display: inline-block;
|
||||
margin: 0 10rpx;
|
||||
padding: 0 20rpx;
|
||||
.tab-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: #333333;
|
||||
}
|
||||
.title-active {
|
||||
color: $brand-gold;
|
||||
}
|
||||
.tab-des {
|
||||
font-size: 22rpx;
|
||||
font-weight: 400;
|
||||
color: #999999;
|
||||
text-align: center;
|
||||
}
|
||||
.des-active {
|
||||
background: $brand-gold-gradient;
|
||||
border-radius: 15rpx;
|
||||
padding: 2rpx 10rpx;
|
||||
color: $brand-primary;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,66 @@
|
||||
<template>
|
||||
<view class="sh-user-menu-box u-m-b-10">
|
||||
<view class="menu-item u-flex u-row-between u-border-bottom" hover-stay-time="150" hover-class="u-cell-hover" v-for="(item, index) in displayList" :key="index" @tap="jump(item)">
|
||||
<view class="menu-head u-flex u-col-center">
|
||||
<image class="menu-img u-m-r-10" :src="item.image" mode=""></image>
|
||||
<view class="menu-title ">{{ item.name }}</view>
|
||||
</view>
|
||||
<view class="u-iconfont uicon-arrow-right" style="color: #969799;font-size: 28rpx;"></view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { isHiddenTool } from '@/shopro/utils/hidden-tools';
|
||||
|
||||
/**
|
||||
*shCell-功能列表
|
||||
* @property {Array} list - 列表信息
|
||||
*/
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
props: {
|
||||
list: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
displayList() {
|
||||
return (this.list || []).filter(item => !isHiddenTool(item));
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
jump(data) {
|
||||
if (isHiddenTool(data)) {
|
||||
uni.showToast({ title: '功能已关闭', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
this.$tools.routerTo(data.path);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.menu-item {
|
||||
background-color: #fff;
|
||||
width: 100%;
|
||||
padding: 26rpx 32rpx;
|
||||
font-size: 28rpx;
|
||||
line-height: 54rpx;
|
||||
.menu-img {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
}
|
||||
.menu-title {
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,295 @@
|
||||
<template>
|
||||
<!-- 首页优惠券卡片 -->
|
||||
<view class="coupon-box u-m-b-10 u-p-20" v-if="detail.ids && couponList.length">
|
||||
<view class="head-box u-flex u-row-between u-m-b-20">
|
||||
<view class="head-title u-ellipsis-1">领券专区</view>
|
||||
<view class="head-more u-flex u-col-center" @tap="$Router.push('/pages/app/coupon/list')">
|
||||
<text class="more-text u-m-r-10">查看更多</text>
|
||||
<text class="iconfont icon-youjiantou-tianchong more-icon"></text>
|
||||
</view>
|
||||
</view>
|
||||
<scroll-view class="groupon-scroll" enable-flex scroll-anchoring scroll-x scroll-with-animation>
|
||||
<view class="groupon-card-wrap u-flex ">
|
||||
<view :class="{ 'gray-wrap': item.status_code === 'cannot_get' }" v-for="(item, index) in couponList"
|
||||
:key="item.id">
|
||||
<!-- mini -->
|
||||
<view class="coupon-card u-flex u-row-between u-m-r-16" v-if="couponType === 2"
|
||||
:style="{ background: `linear-gradient(to right, ${bgColor1}, ${bgColor2})` }">
|
||||
<view class="card-left u-flex-col u-row-center u-p-l-30">
|
||||
<view class="price u-m-b-10" :style="{ color: priceColor }">{{ item.amount }}</view>
|
||||
<view class="notice" :style="{ color: color }">满{{ item.enough }}元可用</view>
|
||||
<view class="notice u-m-b-10" :style="{ color: color }">仅剩{{ item.stock }}张</view>
|
||||
</view>
|
||||
<view class="card-right u-p-y-20 u-p-r-10 u-flex-col u-row-center u-col-center">
|
||||
<button class="u-reset-button get-btn u-m-b-10" :style="{ color: color }"
|
||||
@tap="getCoupon(item.id, index)">
|
||||
{{ item.status_code === 'cannot_get' ? '不可领取' : '领券购买' }}
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
<!-- big -->
|
||||
<view v-if="couponType === 1" class="u-p-r-16">
|
||||
<view class="coupon-wrap "
|
||||
:style="{ background: `linear-gradient(to right, ${bgColor1}, ${bgColor2})` }">
|
||||
<view class="coupon-item u-flex u-row-between">
|
||||
<view class="coupon-left u-flex-col ">
|
||||
<view class="sum-box">
|
||||
<text class="unit " :style="{ color: priceColor }">¥</text>
|
||||
<text class="sum " :style="{ color: priceColor }">{{ item.amount }}</text>
|
||||
<text class="sub " :style="{ color: priceColor }">{{ item.name }}</text>
|
||||
</view>
|
||||
<view class="notice " :style="{ color: color }">满{{ item.enough }}元可用</view>
|
||||
<view class="notice" :style="{ color: color }">
|
||||
有效期:{{ $u.timeFormat(item.usetime.start, 'yyyy-mm-dd') }} 至
|
||||
{{ $u.timeFormat(item.usetime.end, 'yyyy-mm-dd') }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="coupon-right u-flex-col">
|
||||
<button class="get-btn" :style="{ color: bgColor1 }"
|
||||
@tap.stop="getCoupon(item.id, index)">
|
||||
{{ item.status_code === 'cannot_get' ? '不可领取' : '立即领取' }}
|
||||
</button>
|
||||
<view class="surplus-num" :style="{ color: color }">仅剩{{ item.stock }}张</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/**
|
||||
* 自定义之优惠券卡片
|
||||
* @property {Object} detail - 优惠券信息
|
||||
*/
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
currentIndex: 0,
|
||||
couponList: [],
|
||||
couponType: this.detail.style,
|
||||
priceColor: this.detail.pricecolor,
|
||||
color: this.detail.color,
|
||||
bgColor1: this.detail.bgcolor1,
|
||||
bgColor2: this.detail.bgcolor2
|
||||
};
|
||||
},
|
||||
props: {
|
||||
detail: {}
|
||||
},
|
||||
computed: {},
|
||||
created() {
|
||||
this.detail.ids && this.getCouponsList();
|
||||
},
|
||||
methods: {
|
||||
jump(path, parmas) {
|
||||
this.$Router.push({
|
||||
path: path,
|
||||
query: parmas
|
||||
});
|
||||
},
|
||||
// 优惠券列表
|
||||
getCouponsList() {
|
||||
let that = this;
|
||||
that.$http('coupons.templateList', {
|
||||
ids: that.detail.ids
|
||||
}).then(res => {
|
||||
if (res.code === 1) {
|
||||
that.couponList = res.data;
|
||||
}
|
||||
});
|
||||
},
|
||||
// 领取
|
||||
getCoupon(id, index) {
|
||||
let that = this;
|
||||
uni.showLoading({
|
||||
title: '领取中'
|
||||
});
|
||||
that.$http('coupons.get', {
|
||||
id: id
|
||||
}).then(res => {
|
||||
uni.hideLoading();
|
||||
if (res.code === 1) {
|
||||
that.couponList[index].stock -= 1;
|
||||
this.$u.toast('领取成功');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 失效
|
||||
.gray-wrap {
|
||||
filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1) !important;
|
||||
-webkit-filter: grayscale(100%) !important;
|
||||
-moz-filter: grayscale(100%) !important;
|
||||
-ms-filter: grayscale(100%) !important;
|
||||
-o-filter: grayscale(100%) !important;
|
||||
filter: grayscale(100%) !important;
|
||||
filter: gray !important;
|
||||
}
|
||||
|
||||
.groupon-scroll {
|
||||
height: 170rpx;
|
||||
width: 730rpx;
|
||||
|
||||
.groupon-card-wrap {
|
||||
height: 170rpx;
|
||||
width: 730rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.coupon-box {
|
||||
background-color: #fff;
|
||||
|
||||
.head-box {
|
||||
.head-title {
|
||||
width: 300rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.head-more {
|
||||
.more-text {
|
||||
font-size: 22rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.more-icon {
|
||||
color: #333333;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.coupon-card {
|
||||
width: 343rpx;
|
||||
height: 170rpx;
|
||||
background: $brand-primary-gradient;
|
||||
border-radius: 10rpx;
|
||||
// mask: url($IMG_URL+'/imgs/coupon_mini_bg.png');
|
||||
-webkit-mask-box-image: url($IMG_URL+'/imgs/coupon_mini_bg.png');
|
||||
// mask-size: 100% 100%;
|
||||
|
||||
.card-left {
|
||||
height: 100%;
|
||||
width: 260rpx;
|
||||
|
||||
.price {
|
||||
color: #4f3a1e;
|
||||
font-size: 30rpx;
|
||||
font-weight: bold;
|
||||
|
||||
&::before {
|
||||
content: '¥';
|
||||
font-size: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.notice {
|
||||
font-size: 22rpx;
|
||||
font-weight: 500;
|
||||
color: $brand-gold;
|
||||
}
|
||||
}
|
||||
|
||||
.card-right {
|
||||
height: 100%;
|
||||
width: 60rpx;
|
||||
|
||||
.get-btn {
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
text-align: right;
|
||||
color: $brand-gold;
|
||||
writing-mode: vertical-lr;
|
||||
/*从左向右 从右向左是 writing-mode: vertical-rl;*/
|
||||
writing-mode: tb-lr;
|
||||
/*IE浏览器的从左向右 从右向左是 writing-mode: tb-rl;*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 未领取,已领取
|
||||
.coupon-wrap {
|
||||
mask: url($IMG_URL+'/imgs/coupon_bg1.png');
|
||||
-webkit-mask-box-image: url($IMG_URL+'/imgs/coupon_bg1.png');
|
||||
mask-size: 100% 100%;
|
||||
position: relative;
|
||||
border-radius: 10rpx;
|
||||
width: 710rpx;
|
||||
height: 170rpx;
|
||||
background: linear-gradient(to right, $u-type-warning-disabled, $u-type-warning);
|
||||
|
||||
.coupon-item {
|
||||
width: 100%;
|
||||
height: 168rpx;
|
||||
border-radius: 10rpx;
|
||||
|
||||
.coupon-left {
|
||||
height: 100%;
|
||||
justify-content: center;
|
||||
padding-left: 40rpx;
|
||||
|
||||
.unit {
|
||||
font-size: 24rpx;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.sum {
|
||||
font-size: 55rpx;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
line-height: 55rpx;
|
||||
padding-right: 10rpx;
|
||||
}
|
||||
|
||||
.sub {
|
||||
font-size: 26rpx;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.notice {
|
||||
font-size: 22rpx;
|
||||
color: rgba(#fff, 0.7);
|
||||
margin-top: 6rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.coupon-right {
|
||||
height: 100%;
|
||||
width: 220rpx;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
.get-btn {
|
||||
width: 142rpx;
|
||||
height: 54rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 27rpx;
|
||||
padding: 0;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: $u-type-warning;
|
||||
}
|
||||
|
||||
.surplus-num {
|
||||
font-size: 22rpx;
|
||||
|
||||
font-weight: 500;
|
||||
color: #fff;
|
||||
margin-top: 14rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,377 @@
|
||||
<!-- 横版大图,商品卡片 -->
|
||||
<template>
|
||||
<view class="big-goods u-flex u-p-20 u-col-top u-m-b-16" @tap="click"
|
||||
:style="type ? 'background-image: url(' + $IMG_URL + typeMap[type].goodsBg + ')' : ''">
|
||||
<image class="goods-img" lazy-load fade-show :src="image" mode="aspectFill"></image>
|
||||
<view class=" card-right u-m-l-20 u-flex-col u-row-between">
|
||||
<view class="">
|
||||
<view class="goods-title u-ellipsis-1 u-m-t-10 u-m-b-10">
|
||||
<view v-if="type" class=" sm cu-tag radius title-tag u-m-r-10"
|
||||
:style="{ backgroundColor: typeMap[type].tagBg, color: '#fff' }">{{ typeMap[type].text }}</view>
|
||||
{{ title }}
|
||||
</view>
|
||||
<view v-show="subtitle" class="subtitle-text u-m-b-10 u-ellipsis-1">{{ subtitle }}</view>
|
||||
</view>
|
||||
|
||||
<view class="u-m-b-20" v-if="tagTextList.length">
|
||||
<view class="tag-box u-m-r-10" v-for="(item, index) in tagTextList" :key="index">{{ item }}</view>
|
||||
</view>
|
||||
|
||||
<view class=" u-flex u-row-between u-col-center">
|
||||
<view class="font-OPPOSANS">
|
||||
<view class="price">{{ price }}</view>
|
||||
<view class="origin-price">{{ originPrice }}</view>
|
||||
</view>
|
||||
|
||||
<!-- 加入购物车 -->
|
||||
<view class="cart-box">
|
||||
<!-- 单规格 -->
|
||||
<view class="" v-if="!detail.is_sku">
|
||||
<button v-if="!isCart(detail.id)" @tap.stop="addCart(detail.sku_price[0])"
|
||||
class="u-reset-button buy-btn u-flex u-row-center u-col-center"
|
||||
:style="type ? typeMap[type].btnBg : ''">
|
||||
{{ type ? typeMap[type].btnText : '去购买' }}
|
||||
</button>
|
||||
<view class="num-step" @tap.stop v-else>
|
||||
<u-number-box :value="checkCart[detail.id].num" :min="0" :step="1" :long-press="false"
|
||||
:max="detail.sku_price[0].stock > 999 ? 999 : detail.sku_price[0].stock" @min="onMin"
|
||||
@plus="plus($event, detail.sku_price[0])"
|
||||
@change="onChangeNum($event, detail.sku_price[0])"></u-number-box>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 多规格 -->
|
||||
<button class="u-reset-button item-btn buy-btn" :style="type ? typeMap[type].btnBg : ''"
|
||||
@tap.stop="selSku(detail)" v-else>
|
||||
{{ type ? typeMap[type].btnText : '去购买' }}
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 规格弹窗 -->
|
||||
<shopro-sku v-if="showSku && goodsInfo.id" v-model="showSku" :goodsInfo="goodsInfo" buyType="cart"></shopro-sku>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/**
|
||||
*shoproGoodsCard - 商品列表卡片
|
||||
* @property {Object} detail - 商品详情
|
||||
* @property {String} type - 商品类型
|
||||
* @property {String} image - 商品图片
|
||||
* @property {String} title - 商品标题
|
||||
* @property {String} subtitle - 商品副标题
|
||||
* @property {String | Number} price - 商品价格
|
||||
* @property {String | Number} originPrice - 商品原价
|
||||
* @property {String | Number} sales - 商品销量
|
||||
* @property {Array} tagTextList - 活动标签
|
||||
* @event {Function} click 商品被点击
|
||||
*/
|
||||
import { mapMutations, mapActions, mapState, mapGetters } from 'vuex';
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
showSku: false,
|
||||
goodsInfo: {}, //商品详情
|
||||
typeMap: {
|
||||
seckill: {
|
||||
text: '秒杀',
|
||||
tagBg: '#FF5854',
|
||||
goodsBg: '/imgs/tag/seckill_x_bg.png',
|
||||
btnText: '去抢购',
|
||||
btnBg: 'background: linear-gradient(90deg, #1677FF, #4096FF);'
|
||||
},
|
||||
timer: {
|
||||
text: '限时秒杀',
|
||||
tagBg: '#FF5854',
|
||||
goodsBg: '/imgs/tag/seckill_x_bg.png',
|
||||
btnText: '去抢购',
|
||||
btnBg: 'background: linear-gradient(90deg, #1677FF, #4096FF);'
|
||||
},
|
||||
robbuy: {
|
||||
text: '预约抢购',
|
||||
tagBg: '#FF5854',
|
||||
goodsBg: '/imgs/tag/seckill_x_bg.png',
|
||||
btnText: '去抢购',
|
||||
btnBg: 'background: linear-gradient(90deg, #1677FF, #4096FF);'
|
||||
},
|
||||
promote: {
|
||||
text: '限时促销',
|
||||
tagBg: '#f1ab50',
|
||||
goodsBg: '/imgs/tag/promote_x_bg.png',
|
||||
btnText: '去抢购',
|
||||
btnBg: 'background: linear-gradient(90deg, #f1ab50, #FCE3E0);'
|
||||
},
|
||||
groupon: {
|
||||
text: '拼团',
|
||||
tagBg: '#FE832A',
|
||||
goodsBg: '/imgs/tag/groupon_x_bg.png',
|
||||
btnText: '马上拼',
|
||||
btnBg: 'background: linear-gradient(90deg, #FF6600 0%, #FE832A 100%);'
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['cartList', 'checkCart'])
|
||||
},
|
||||
props: {
|
||||
detail: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
type: {
|
||||
type: [String, null],
|
||||
default: ''
|
||||
},
|
||||
image: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
subtitle: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
price: {
|
||||
type: [String, Number],
|
||||
default: ''
|
||||
},
|
||||
originPrice: {
|
||||
type: [String, Number],
|
||||
default: ''
|
||||
},
|
||||
sales: {
|
||||
type: [String, Number],
|
||||
default: ''
|
||||
},
|
||||
tagTextList: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
...mapActions(['getCartList', 'changeCartList', 'addCartGoods']),
|
||||
//点击商品
|
||||
click() {
|
||||
this.$emit('click');
|
||||
},
|
||||
|
||||
// 检测是否为购物车商品
|
||||
isCart(id) {
|
||||
return Object.keys(this.checkCart).includes(id + '');
|
||||
},
|
||||
|
||||
// 检测商品在购物车中的下标
|
||||
checkGoodsIndex(id) {
|
||||
let cIndex = 0;
|
||||
this.cartList.forEach((item, index) => {
|
||||
if (id == item.goods_id) {
|
||||
cIndex = index;
|
||||
}
|
||||
});
|
||||
return cIndex;
|
||||
},
|
||||
|
||||
// 更改商品数
|
||||
async onChangeNum(e, sku) {
|
||||
let gIndex = this.checkGoodsIndex(sku.goods_id);
|
||||
if (e.value != this.checkCart[sku.goods_id].num) {
|
||||
uni.showLoading({
|
||||
mask: true
|
||||
});
|
||||
this.$set(this.cartList[gIndex], 'goods_num', +e.value);
|
||||
await this.changeCartList({
|
||||
ids: [this.checkCart[sku.goods_id].cartOrderId],
|
||||
goodsNum: +e.value,
|
||||
art: 'change'
|
||||
});
|
||||
await uni.hideLoading();
|
||||
}
|
||||
},
|
||||
|
||||
// 到达最小值
|
||||
onMin() {
|
||||
const that = this;
|
||||
let cartGoodId = 0;
|
||||
cartGoodId = this.cartList.filter(item => item.goods_id === that.detail.id)[0].id;
|
||||
uni.showModal({
|
||||
title: '删除提示',
|
||||
confirmColor: '#1677FF',
|
||||
content: `是否确认从购物车中删除此商品?`,
|
||||
success: res => {
|
||||
res.confirm && this.changeCartList({ ids: [cartGoodId], art: 'delete' });
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 增加
|
||||
plus(e, sku) {
|
||||
if (e.value >= sku.stock) {
|
||||
this.$u.toast('库存不足');
|
||||
return;
|
||||
}
|
||||
if (this.detail.activity_type === 'seckill' || this.detail.activity_type === 'time_seckill' || this.detail.activity_type === 'groupon') {
|
||||
let rules = this.detail.activity.rules;
|
||||
if (rules.limit_buy != 0 && e.value >= rules.limit_buy) {
|
||||
this.$u.toast('本次活动最多购买' + rules.limit_buy + '件');
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// 添加购物车,多规格
|
||||
async selSku(info) {
|
||||
if (this.detail.activity_type) {
|
||||
this.$Router.push({ path: '/pages/goods/detail', query: { id: this.detail.id } });
|
||||
return;
|
||||
}
|
||||
this.goodsInfo = {};
|
||||
this.getGoodsDetail(info.id);
|
||||
this.showSku = true;
|
||||
},
|
||||
|
||||
// 商品详情
|
||||
getGoodsDetail(id) {
|
||||
let that = this;
|
||||
that.$http('goods.detail', {
|
||||
id: id
|
||||
}).then(res => {
|
||||
if (res.code === 1) {
|
||||
that.goodsInfo = res.data;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 加入购物车
|
||||
addCart(sku) {
|
||||
if (sku.stock <= 0) {
|
||||
this.$u.toast('库存不足');
|
||||
return;
|
||||
}
|
||||
if (this.detail.activity_type) {
|
||||
this.$Router.push({ path: '/pages/goods/detail', query: { id: this.detail.id } });
|
||||
return;
|
||||
}
|
||||
let confirmGoodsList = {
|
||||
list: [{
|
||||
goods_id: sku.goods_id,
|
||||
goods_num: 1,
|
||||
sku_price_id: sku.id,
|
||||
goods_price: sku.price
|
||||
}],
|
||||
from: 'goods'
|
||||
};
|
||||
this.addCartGoods(confirmGoodsList).then(res => {
|
||||
if (res.code === 1) {
|
||||
this.$u.toast(res.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
// 大商品卡片
|
||||
.big-goods {
|
||||
width: 710rpx;
|
||||
min-height: 260rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 20rpx;
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% 100%;
|
||||
|
||||
.goods-img {
|
||||
width: 260rpx;
|
||||
height: 260rpx;
|
||||
background-color: $brand-page-bg;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
|
||||
.card-right {
|
||||
width: 430rpx;
|
||||
height: 220rpx;
|
||||
}
|
||||
|
||||
.goods-title {
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
width: 400rpx;
|
||||
color: #000000;
|
||||
padding-top: 6rpx;
|
||||
|
||||
.title-tag {
|
||||
transform: scale(0.9);
|
||||
position: relative;
|
||||
top: -6rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.subtitle-text {
|
||||
font-size: 22rpx;
|
||||
width: 400rpx;
|
||||
font-weight: 500;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.tag-box {
|
||||
border: 1rpx solid $brand-price;
|
||||
display: inline-block;
|
||||
font-size: 20rpx;
|
||||
line-height: 30rpx;
|
||||
padding: 0 10rpx;
|
||||
color: $brand-price;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
// 购物车
|
||||
.cart-box {
|
||||
.cart-btn {
|
||||
width: 54rpx;
|
||||
height: 54rpx;
|
||||
border-radius: 50%;
|
||||
padding: 0;
|
||||
background: $brand-gold-gradient;
|
||||
}
|
||||
|
||||
.buy-btn {
|
||||
width: 120rpx;
|
||||
line-height: 50rpx;
|
||||
background: $brand-gold-gradient;
|
||||
border-radius: 25rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: $brand-primary;
|
||||
}
|
||||
}
|
||||
|
||||
// 价格
|
||||
.price {
|
||||
color: $brand-price;
|
||||
font-weight: 600;
|
||||
|
||||
&::before {
|
||||
content: '¥';
|
||||
font-size: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.origin-price {
|
||||
color: #c4c4c4;
|
||||
font-size: 24rpx;
|
||||
text-decoration: line-through;
|
||||
|
||||
&::before {
|
||||
content: '¥';
|
||||
font-size: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,260 @@
|
||||
<template>
|
||||
<!-- 分类导航:统一蓝色圆形图标 -->
|
||||
<view class="wrap" v-if="displayList.length">
|
||||
<view class="category-grid" :class="{ 'category-grid--scroll': needScroll, 'category-grid--colorful': colorful }">
|
||||
<scroll-view v-if="needScroll" class="category-scroll" scroll-x :show-scrollbar="false" enable-flex>
|
||||
<view class="category-row">
|
||||
<view
|
||||
class="category-item u-flex-col u-col-center u-row-center"
|
||||
v-for="(item, index) in displayList"
|
||||
:key="index"
|
||||
@tap="$tools.routerTo(item.path)"
|
||||
>
|
||||
<view
|
||||
class="category-icon-wrap u-flex u-row-center u-col-center"
|
||||
:class="colorful ? 'category-icon-wrap--colorful category-icon-wrap--c' + item.colorIndex : ''"
|
||||
>
|
||||
<text class="u-iconfont" :class="item.iconClass"></text>
|
||||
</view>
|
||||
<text class="category-name u-ellipsis-1">{{ item.name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view v-else class="category-row category-row--even">
|
||||
<view
|
||||
class="category-item category-item--even u-flex-col u-col-center u-row-center"
|
||||
v-for="(item, index) in displayList"
|
||||
:key="index"
|
||||
@tap="$tools.routerTo(item.path)"
|
||||
>
|
||||
<view
|
||||
class="category-icon-wrap u-flex u-row-center u-col-center"
|
||||
:class="colorful ? 'category-icon-wrap--colorful category-icon-wrap--c' + item.colorIndex : ''"
|
||||
>
|
||||
<text class="u-iconfont" :class="item.iconClass"></text>
|
||||
</view>
|
||||
<text class="category-name u-ellipsis-1">{{ item.name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const CATEGORY_ICON_MAP = {
|
||||
'雄戈系列': 'uicon-gift-fill',
|
||||
'白酒': 'uicon-bag-fill',
|
||||
'礼盒装': 'uicon-gift',
|
||||
'单瓶装': 'uicon-bag',
|
||||
'品鉴装': 'uicon-coupon-fill',
|
||||
'热销': 'uicon-star-fill',
|
||||
'热销推荐': 'uicon-star-fill',
|
||||
'新品上市': 'uicon-tags-fill',
|
||||
'商务宴请': 'uicon-calendar-fill',
|
||||
'酱香型': 'uicon-map-fill',
|
||||
'浓香型': 'uicon-map',
|
||||
'中秋月饼': 'uicon-grid-fill',
|
||||
'复购专区': 'uicon-reload',
|
||||
'兑换专区': 'uicon-coupon-fill',
|
||||
'平台商城': 'uicon-shopping-cart-fill'
|
||||
};
|
||||
|
||||
function resolveCategoryIcon(name) {
|
||||
if (name && CATEGORY_ICON_MAP[name]) {
|
||||
return CATEGORY_ICON_MAP[name];
|
||||
}
|
||||
return 'uicon-grid';
|
||||
}
|
||||
|
||||
function withCategoryIcon(list) {
|
||||
return (list || []).map(item => ({
|
||||
...item,
|
||||
iconClass: resolveCategoryIcon(item.name)
|
||||
}));
|
||||
}
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
fallbackList: []
|
||||
};
|
||||
},
|
||||
props: {
|
||||
list: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
oneRowNum: {
|
||||
type: [Number, String],
|
||||
default: 5
|
||||
},
|
||||
colorful: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
displayList() {
|
||||
const source = this.list && this.list.length ? this.list : this.fallbackList;
|
||||
return withCategoryIcon(source).map((item, index) => ({
|
||||
...item,
|
||||
colorIndex: index % 5
|
||||
}));
|
||||
},
|
||||
needScroll() {
|
||||
const max = Number(this.oneRowNum) || 5;
|
||||
return this.displayList.length > max;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (!this.list || !this.list.length) {
|
||||
this.loadCategoryMenu();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
loadCategoryMenu() {
|
||||
this.$http('category.info').then(res => {
|
||||
if (res.code !== 1 || !res.data || !res.data.id) {
|
||||
return;
|
||||
}
|
||||
return this.$http('category.detail', { id: res.data.id });
|
||||
}).then(res => {
|
||||
if (res && res.code === 1 && res.data && res.data.children && res.data.children.length) {
|
||||
this.fallbackList = res.data.children.map(item => ({
|
||||
name: item.name,
|
||||
image: item.image,
|
||||
path: `/pages/goods/list?id=${item.id}`,
|
||||
path_name: item.name,
|
||||
path_type: 1
|
||||
}));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.wrap {
|
||||
margin: 8rpx $brand-page-gutter 16rpx;
|
||||
}
|
||||
|
||||
.category-grid {
|
||||
background: #ffffff;
|
||||
border-radius: 20rpx;
|
||||
box-shadow: $brand-shadow;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.category-grid--colorful {
|
||||
background: transparent;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.category-scroll {
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.category-row {
|
||||
display: inline-flex;
|
||||
flex-direction: row;
|
||||
padding: 28rpx 8rpx 24rpx;
|
||||
}
|
||||
|
||||
.category-row--even {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
flex-direction: row;
|
||||
justify-content: space-around;
|
||||
padding: 16rpx 12rpx 8rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.category-grid--colorful .category-row,
|
||||
.category-grid--colorful .category-row--even {
|
||||
padding-top: 16rpx;
|
||||
padding-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.category-item {
|
||||
flex-shrink: 0;
|
||||
width: 140rpx;
|
||||
padding: 0 4rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.category-item--even {
|
||||
flex: 1;
|
||||
width: auto;
|
||||
min-width: 0;
|
||||
max-width: 150rpx;
|
||||
}
|
||||
|
||||
.category-icon-wrap {
|
||||
width: 96rpx;
|
||||
height: 96rpx;
|
||||
border-radius: 50%;
|
||||
background: $brand-primary-light;
|
||||
margin-bottom: 12rpx;
|
||||
box-shadow: inset 0 0 0 1rpx rgba(22, 119, 255, 0.08);
|
||||
|
||||
.u-iconfont {
|
||||
font-size: 44rpx;
|
||||
color: $brand-primary;
|
||||
}
|
||||
}
|
||||
|
||||
.category-icon-wrap--colorful {
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.category-icon-wrap--c0 {
|
||||
background: $home-icon-bg-green;
|
||||
|
||||
.u-iconfont {
|
||||
color: $home-icon-color-green;
|
||||
}
|
||||
}
|
||||
|
||||
.category-icon-wrap--c1 {
|
||||
background: $home-icon-bg-orange;
|
||||
|
||||
.u-iconfont {
|
||||
color: $home-icon-color-orange;
|
||||
}
|
||||
}
|
||||
|
||||
.category-icon-wrap--c2 {
|
||||
background: $home-icon-bg-blue;
|
||||
|
||||
.u-iconfont {
|
||||
color: $home-icon-color-blue;
|
||||
}
|
||||
}
|
||||
|
||||
.category-icon-wrap--c3 {
|
||||
background: $home-icon-bg-purple;
|
||||
|
||||
.u-iconfont {
|
||||
color: $home-icon-color-purple;
|
||||
}
|
||||
}
|
||||
|
||||
.category-icon-wrap--c4 {
|
||||
background: $home-icon-bg-gold;
|
||||
|
||||
.u-iconfont {
|
||||
color: $home-icon-color-gold;
|
||||
}
|
||||
}
|
||||
|
||||
.category-name {
|
||||
width: 100%;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: $brand-text;
|
||||
text-align: center;
|
||||
line-height: 1.3;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,250 @@
|
||||
<template>
|
||||
<view class="user-tools-wrap brand-card" v-if="mergedTools.length">
|
||||
<view class="section-head u-flex u-row-between u-col-center">
|
||||
<text class="section-title">我的服务</text>
|
||||
</view>
|
||||
<view class="service-grid">
|
||||
<view
|
||||
class="service-item u-flex-col u-col-center"
|
||||
v-for="menu in mergedTools"
|
||||
:key="menu.name"
|
||||
@tap="handleTap(menu)"
|
||||
>
|
||||
<view class="service-icon-wrap u-flex u-row-center u-col-center">
|
||||
<text class="u-iconfont" :class="menu.icon"></text>
|
||||
</view>
|
||||
<text class="service-name u-ellipsis-1">{{ menu.name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import { isHiddenTool } from '@/shopro/utils/hidden-tools';
|
||||
|
||||
const DEFAULT_TOOLS = [{
|
||||
name: '分销中心',
|
||||
path: '/pages/app/commission/index',
|
||||
icon: 'uicon-share',
|
||||
group: 'member',
|
||||
desc: '推广赚差价'
|
||||
}, {
|
||||
name: '区域服务商',
|
||||
path: '/pages/app/regional-agent/index',
|
||||
icon: 'uicon-map',
|
||||
group: 'member',
|
||||
desc: '申请区域服务商'
|
||||
}, {
|
||||
name: '积分商城',
|
||||
path: '/pages/app/score/list',
|
||||
icon: 'uicon-gift',
|
||||
group: 'member',
|
||||
desc: '积分兑好礼'
|
||||
}, {
|
||||
name: '浏览足迹',
|
||||
path: '/pages/user/view-log',
|
||||
icon: 'uicon-map',
|
||||
group: 'record',
|
||||
desc: '最近浏览记录'
|
||||
}, {
|
||||
name: '我的收藏',
|
||||
path: '/pages/user/favorite',
|
||||
icon: 'uicon-star',
|
||||
group: 'record',
|
||||
desc: '收藏的心仪好物'
|
||||
}, {
|
||||
name: '地址管理',
|
||||
path: '/pages/user/address/list',
|
||||
icon: 'uicon-map-fill',
|
||||
group: 'service',
|
||||
desc: '管理收货地址'
|
||||
}, {
|
||||
name: '常见问题',
|
||||
path: '/pages/public/faq',
|
||||
icon: 'uicon-question',
|
||||
group: 'help',
|
||||
desc: '快速了解使用帮助'
|
||||
}, {
|
||||
name: '问题反馈',
|
||||
path: '/pages/public/feedback',
|
||||
icon: 'uicon-chat',
|
||||
group: 'help',
|
||||
desc: '提交意见与建议'
|
||||
}, {
|
||||
name: '系统设置',
|
||||
path: '/pages/user/set',
|
||||
icon: 'uicon-setting',
|
||||
group: 'help',
|
||||
desc: '账号与隐私设置'
|
||||
}];
|
||||
|
||||
const TOOL_NAME_ALIAS = {
|
||||
'区域代理': '区域服务商'
|
||||
};
|
||||
|
||||
const EXTRA_ICON_MAP = {
|
||||
'在线客服': 'uicon-server-man',
|
||||
'开启直播': 'uicon-play-circle',
|
||||
'我的预约': 'uicon-calendar'
|
||||
};
|
||||
|
||||
export default {
|
||||
props: {
|
||||
list: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['userInfo']),
|
||||
mergedTools() {
|
||||
const apiMap = {};
|
||||
(this.list || []).forEach(item => {
|
||||
if (item?.name) {
|
||||
const key = TOOL_NAME_ALIAS[item.name] || item.name;
|
||||
apiMap[key] = { ...item, name: key };
|
||||
}
|
||||
});
|
||||
|
||||
const catalogNames = DEFAULT_TOOLS.map(item => item.name);
|
||||
const merged = DEFAULT_TOOLS.map(def => {
|
||||
const remote = apiMap[def.name] || {};
|
||||
return {
|
||||
...def,
|
||||
...remote,
|
||||
path: remote.path || def.path,
|
||||
icon: def.icon,
|
||||
group: def.group,
|
||||
desc: def.desc
|
||||
};
|
||||
});
|
||||
|
||||
Object.keys(apiMap).forEach(name => {
|
||||
if (catalogNames.includes(name)) return;
|
||||
if (name === '开启直播' && this.userInfo?.is_live != 1) return;
|
||||
const remote = apiMap[name];
|
||||
merged.push({
|
||||
name,
|
||||
path: remote.path || '',
|
||||
icon: EXTRA_ICON_MAP[name] || 'uicon-list',
|
||||
group: 'service',
|
||||
desc: remote.path_name || '点击进入'
|
||||
});
|
||||
});
|
||||
|
||||
return merged.filter(item => {
|
||||
if (isHiddenTool(item)) return false;
|
||||
return item.name !== '开启直播' || this.userInfo?.is_live == 1;
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleTap(menu) {
|
||||
if (menu.name === '在线客服') {
|
||||
this.openService();
|
||||
return;
|
||||
}
|
||||
this.jump(menu);
|
||||
},
|
||||
jump(data) {
|
||||
if (isHiddenTool(data)) {
|
||||
uni.showToast({ title: '功能已关闭', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (data.name === '我的预约' && !data.path) {
|
||||
data.path = '/pages/user/rob-order';
|
||||
}
|
||||
if (data.name === '开启直播' && !data.path) {
|
||||
data.path = '/pages/user/live';
|
||||
}
|
||||
if (!data.path) {
|
||||
uni.showToast({ title: '功能暂未开放', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
this.$tools.routerTo(data.path);
|
||||
},
|
||||
openService() {
|
||||
// #ifdef MP-WEIXIN
|
||||
wx.openCustomerServiceChat({
|
||||
extInfo: {
|
||||
url: 'https://work.weixin.qq.com/kfid/kfc5aec53d2111b588a'
|
||||
},
|
||||
corpId: 'wwc5f08e271cf73fb2',
|
||||
success() {},
|
||||
fail() {}
|
||||
});
|
||||
// #endif
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
plus.share.getServices(res => {
|
||||
const wechat = res.find(v => v.id === 'weixin');
|
||||
if (wechat) {
|
||||
wechat.openCustomerServiceChat({
|
||||
corpid: 'wwc5f08e271cf73fb2',
|
||||
url: 'https://work.weixin.qq.com/kfid/kfc5aec53d2111b588a'
|
||||
}, () => {}, () => {});
|
||||
} else {
|
||||
uni.showToast({ title: '当前环境不支持微信操作', icon: 'none' });
|
||||
}
|
||||
}, () => {
|
||||
uni.showToast({ title: '获取服务失败', icon: 'none' });
|
||||
});
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.user-tools-wrap {
|
||||
padding: 24rpx 16rpx 20rpx;
|
||||
}
|
||||
|
||||
.section-head {
|
||||
padding: 0 12rpx 20rpx;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: $brand-text;
|
||||
}
|
||||
|
||||
.service-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.service-item {
|
||||
width: 25%;
|
||||
padding: 16rpx 8rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.service-icon-wrap {
|
||||
width: 88rpx;
|
||||
height: 88rpx;
|
||||
border-radius: 50%;
|
||||
background: $brand-primary-light;
|
||||
margin-bottom: 12rpx;
|
||||
|
||||
.u-iconfont {
|
||||
font-size: 40rpx;
|
||||
color: $brand-primary;
|
||||
}
|
||||
}
|
||||
|
||||
.service-icon-img {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
}
|
||||
|
||||
.service-name {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
font-size: 22rpx;
|
||||
color: $brand-text;
|
||||
line-height: 1.3;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,319 @@
|
||||
<template>
|
||||
<!-- 活动商品 -->
|
||||
<view class="activity-wrap u-p-x-20 u-p-b-20 u-m-b-10 groupon-card" v-if="showActivity">
|
||||
<!-- 标题栏 -->
|
||||
<view class="title-box u-flex u-row-between u-p-y-20 groupon-title">
|
||||
<view class="u-flex u-col-center">
|
||||
<view class="title-text u-m-r-20 u-ellipsis-1">{{ detail.name }}</view>
|
||||
</view>
|
||||
<view class="more-box u-flex" @tap="$Router.push('/pages/activity/groupon/list')">
|
||||
<text class="more-text u-m-r-10">更多拼团</text>
|
||||
<text class="iconfont icon-youjiantou-tianchong more-icon"></text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 活动商品 -->
|
||||
<!-- m -->
|
||||
<scroll-view v-if="grouponType === 1" class="scroll-box" scroll-x scroll-anchoring>
|
||||
<view class="goods-box u-flex">
|
||||
<view class="min-goods u-m-r-14" v-for="mgoods in goodsList" :key="mgoods.id" @tap="jump('/pages/goods/detail', { id: mgoods.id })">
|
||||
<view class="img-box"><image class="img" :src="mgoods.image" mode=""></image></view>
|
||||
<view class="mgoods-card-bottom u-p-20">
|
||||
<view class="goods-title u-m-b-10 u-ellipsis-1">{{ mgoods.title }}</view>
|
||||
<view class="price u-m-b-10">{{ mgoods.groupon_price }}</view>
|
||||
<view class="groupon-num-box u-flex u-col-center" v-if="mgoods.buyers.length">
|
||||
<view class="avatar-box"><image class="avatar-img u-m-r-10" :src="mgoods.buyers[0].avatar" mode=""></image></view>
|
||||
<view class="groupon-num-text">{{ mgoods.sales }}人正在拼</view>
|
||||
</view>
|
||||
<view class="original-price" v-else>¥{{ mgoods.original_price }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<!--b-->
|
||||
<view
|
||||
v-if="grouponType === 2"
|
||||
class="big-goods u-flex u-p-20 u-col-top u-m-b-16"
|
||||
v-for="item in goodsList"
|
||||
:key="item.id"
|
||||
@tap="jump('/pages/goods/detail', { id: item.id })"
|
||||
>
|
||||
<image class="goods-img" :src="item.image" mode="aspectFill"></image>
|
||||
<view class=" card-right u-m-l-20 u-flex-col u-row-between">
|
||||
<view class="">
|
||||
<view class="goods-title u-ellipsis-1 u-m-t-10 u-m-b-10">
|
||||
<view class=" sm cu-tag radius title-tag u-m-r-10" style="{ backgroundColor: #FF6600, color: '#fff' }">拼团</view>
|
||||
{{ item.title }}
|
||||
</view>
|
||||
<view v-show="item.subtitle" class="subtitle-text u-m-b-10 u-ellipsis-1">{{ item.subtitle }}</view>
|
||||
</view>
|
||||
|
||||
<view class="u-flex u-m-y-20">
|
||||
<view class="sell-box">
|
||||
<text class=" hot-icon iconfont icon-icon-test"></text>
|
||||
<text class="sell-num">已拼{{ item.sales }}件</text>
|
||||
</view>
|
||||
<text class="group-num">{{ item.activity.rules.team_num || 0 }}人团</text>
|
||||
</view>
|
||||
|
||||
<view class=" u-flex u-row-between u-col-center">
|
||||
<view class="u-flex u-col-bottom font-OPPOSANS">
|
||||
<view class="price u-m-r-10">{{ item.groupon_price }}</view>
|
||||
<view class="origin-price">{{ item.original_price }}</view>
|
||||
</view>
|
||||
<button class="u-reset-button buy-btn" @tap.stop="$Router.push({ path: '/pages/goods/detail', query: { id: item.id } })">马上拼</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/**
|
||||
* 自定义之拼团样式组件
|
||||
* @property {Object} detail - 秒杀商品信息
|
||||
*/
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
timestamp: 0, //倒计时
|
||||
goodsList: [],
|
||||
showActivity: false, // 拼团功能已暂时关闭
|
||||
grouponType: this.detail.style
|
||||
};
|
||||
},
|
||||
props: {
|
||||
detail: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {},
|
||||
computed: {},
|
||||
created() {
|
||||
// 拼团功能已关闭
|
||||
},
|
||||
methods: {
|
||||
// 路由跳转
|
||||
jump(path, parmas) {
|
||||
this.$Router.push({
|
||||
path: path,
|
||||
query: parmas
|
||||
});
|
||||
},
|
||||
|
||||
// 获取拼团商品
|
||||
getActivityGoodsList() {
|
||||
let that = this;
|
||||
that.$http('goods.activity', {
|
||||
activity_id: that.detail.id,
|
||||
need_buyer: 1
|
||||
}).then(res => {
|
||||
if (res.code === 1) {
|
||||
that.goodsList = res.data.goods.data;
|
||||
that.showActivity = that.goodsList.length;
|
||||
} else {
|
||||
that.showActivity = false;
|
||||
console.log(`%cerr:拼团活动已结束`, 'color:green;background:yellow');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.groupon-card {
|
||||
background: linear-gradient(#faecca 20%, #ffffff 30%, #ffffff 100%);
|
||||
}
|
||||
|
||||
.groupon-title {
|
||||
background: url($IMG_URL+'/imgs/tag/groupon_title_bg.png') no-repeat;
|
||||
background-position: center top;
|
||||
background-size: 100% auto;
|
||||
}
|
||||
.activity-wrap {
|
||||
background-color: #fff;
|
||||
min-height: 300rpx;
|
||||
.title-box {
|
||||
.title-text {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #333333;
|
||||
}
|
||||
.more-box {
|
||||
.more-text {
|
||||
font-size: 22rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
}
|
||||
.more-icon {
|
||||
font-size: 24rpx;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.scroll-box,
|
||||
.goods-box {
|
||||
height: 380rpx;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
// 小商品卡片
|
||||
.min-goods {
|
||||
width: 220rpx;
|
||||
height: 380rpx;
|
||||
background: #fffaef;
|
||||
box-shadow: 0px 7rpx 8rpx 1rpx rgba(162, 117, 27, 0.24);
|
||||
border-radius: 10rpx;
|
||||
.img-box {
|
||||
width: 220rpx;
|
||||
height: 220rpx;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
border-radius: 10rpx 10rpx 0 0;
|
||||
.img {
|
||||
width: 220rpx;
|
||||
height: 220rpx;
|
||||
background-color: #ccc;
|
||||
}
|
||||
}
|
||||
.mgoods-card-bottom {
|
||||
height: 160rpx;
|
||||
background: url($IMG_URL+'/imgs/tag/groupon_goods_bg.png') no-repeat;
|
||||
background-position: bottom center;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
.goods-title {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #000000;
|
||||
width: 180rpx;
|
||||
line-height: 26rpx;
|
||||
}
|
||||
|
||||
.price {
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
color: $brand-price;
|
||||
&::before {
|
||||
content: '¥';
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
.original-price {
|
||||
font-size: 20rpx;
|
||||
font-weight: 500;
|
||||
text-decoration: line-through;
|
||||
color: #c4c4c4;
|
||||
}
|
||||
.groupon-num-box {
|
||||
.avatar-box {
|
||||
direction: rtl;
|
||||
unicode-bidi: bidi-override;
|
||||
height: 30rpx;
|
||||
.avatar-img {
|
||||
width: 30rpx;
|
||||
height: 30rpx;
|
||||
border-radius: 50%;
|
||||
background-color: $brand-page-bg;
|
||||
}
|
||||
}
|
||||
.groupon-num-text {
|
||||
font-size: 18rpx;
|
||||
font-weight: 500;
|
||||
color: $brand-price;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 大商品卡片
|
||||
.big-goods {
|
||||
width: 710rpx;
|
||||
min-height: 260rpx;
|
||||
background: #ffffff;
|
||||
box-shadow: 0px 7rpx 8rpx 1rpx #fffaef;
|
||||
border-radius: 20rpx;
|
||||
.goods-img {
|
||||
width: 220rpx;
|
||||
height: 220rpx;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
.card-right {
|
||||
width: 430rpx;
|
||||
height: 100%;
|
||||
}
|
||||
.goods-title {
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
width: 400rpx;
|
||||
color: #000000;
|
||||
vertical-align: middle;
|
||||
.title-tag {
|
||||
transform: scale(0.9);
|
||||
}
|
||||
}
|
||||
.subtitle-text {
|
||||
font-size: 22rpx;
|
||||
width: 400rpx;
|
||||
font-weight: 500;
|
||||
color: #666666;
|
||||
}
|
||||
.buy-btn {
|
||||
width: 120rpx;
|
||||
line-height: 50rpx;
|
||||
background: linear-gradient(90deg, #1677FF 0%, #4096FF 100%);
|
||||
border-radius: 25rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
}
|
||||
// 拼团
|
||||
.sell-box {
|
||||
background: rgba(#f9efd6, 0.3);
|
||||
border-radius: 16rpx;
|
||||
line-height: 32rpx;
|
||||
.sell-num {
|
||||
font-size: 20rpx;
|
||||
|
||||
font-weight: 400;
|
||||
color: #ff6904;
|
||||
}
|
||||
|
||||
.hot-icon {
|
||||
font-size: 26rpx;
|
||||
color: #ff6904;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
}
|
||||
.group-num {
|
||||
font-size: 20rpx;
|
||||
|
||||
font-weight: 500;
|
||||
color: rgba(153, 153, 153, 1);
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
// 价格
|
||||
.price {
|
||||
color: $brand-price;
|
||||
font-weight: 600;
|
||||
&::before {
|
||||
content: '¥';
|
||||
font-size: 20rpx;
|
||||
}
|
||||
}
|
||||
.origin-price {
|
||||
color: #c4c4c4;
|
||||
font-size: 24rpx;
|
||||
text-decoration: line-through;
|
||||
&::before {
|
||||
content: '¥';
|
||||
font-size: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,585 @@
|
||||
<template>
|
||||
|
||||
<!-- 为你推荐 -->
|
||||
|
||||
<view class="hot-goods" :class="{ 'hot-goods--compact': compactMode }">
|
||||
|
||||
<view class="home-goods-grid" v-if="compactMode">
|
||||
|
||||
<view class="home-goods-item" v-for="item in goodsList" :key="item.id">
|
||||
|
||||
<shopro-goods-card
|
||||
|
||||
layout="grid"
|
||||
|
||||
:detail="item"
|
||||
|
||||
:type="item.activity_type || ''"
|
||||
|
||||
:image="item.image"
|
||||
|
||||
:title="item.title"
|
||||
|
||||
:subtitle="item.subtitle"
|
||||
|
||||
:price="item.price"
|
||||
|
||||
:originPrice="item.original_price"
|
||||
|
||||
:tagTextList="item.activity_discounts_tags"
|
||||
|
||||
@click="$Router.push({ path: '/pages/goods/detail', query: { id: item.id } })"
|
||||
|
||||
></shopro-goods-card>
|
||||
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
<view class="u-waterfall" v-else-if="goodsType === 1">
|
||||
|
||||
<view id="u-left-column" class="u-column">
|
||||
|
||||
<view class="goods-item u-m-b-16 u-flex u-row-center u-col-center" v-for="leftGoods in leftList" :key="leftGoods.id">
|
||||
|
||||
<shopro-goods-card
|
||||
|
||||
:detail="leftGoods"
|
||||
|
||||
:type="leftGoods.activity_type"
|
||||
|
||||
:image="leftGoods.image"
|
||||
|
||||
:title="leftGoods.title"
|
||||
|
||||
:subtitle="leftGoods.subtitle"
|
||||
|
||||
:price="leftGoods.price"
|
||||
|
||||
:originPrice="leftGoods.original_price"
|
||||
|
||||
:sales="leftGoods.sales"
|
||||
|
||||
:tagTextList="leftGoods.activity_discounts_tags"
|
||||
|
||||
@click="$Router.push({ path: '/pages/goods/detail', query: { id: leftGoods.id } })"
|
||||
|
||||
></shopro-goods-card>
|
||||
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<view id="u-right-column" class="u-column">
|
||||
|
||||
<view class="goods-item u-m-b-16 u-flex u-row-center u-col-center" v-for="rightGoods in rightList" :key="rightGoods.id">
|
||||
|
||||
<shopro-goods-card
|
||||
|
||||
:detail="rightGoods"
|
||||
|
||||
:type="rightGoods.activity_type"
|
||||
|
||||
:image="rightGoods.image"
|
||||
|
||||
:title="rightGoods.title"
|
||||
|
||||
:subtitle="rightGoods.subtitle"
|
||||
|
||||
:price="rightGoods.price"
|
||||
|
||||
:originPrice="rightGoods.original_price"
|
||||
|
||||
:sales="rightGoods.sales"
|
||||
|
||||
:tagTextList="rightGoods.activity_discounts_tags"
|
||||
|
||||
@click="$Router.push({ path: '/pages/goods/detail', query: { id: rightGoods.id } })"
|
||||
|
||||
></shopro-goods-card>
|
||||
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<!-- m -->
|
||||
|
||||
<view class="big-card-wrap u-p-10" v-else-if="goodsType === 2">
|
||||
|
||||
<block v-for="item in goodsList" :key="item.id">
|
||||
|
||||
<sh-goods-card
|
||||
|
||||
:detail="item"
|
||||
|
||||
:type="item.activity_type"
|
||||
|
||||
:image="item.image"
|
||||
|
||||
:title="item.title"
|
||||
|
||||
:subtitle="item.subtitle"
|
||||
|
||||
:price="item.price"
|
||||
|
||||
:originPrice="item.original_price"
|
||||
|
||||
:sales="item.sales"
|
||||
|
||||
:tagTextList="item.activity_discounts_tags"
|
||||
|
||||
@click="$Router.push({ path: '/pages/goods/detail', query: { id: item.id } })"
|
||||
|
||||
></sh-goods-card>
|
||||
|
||||
</block>
|
||||
|
||||
</view>
|
||||
|
||||
<button v-show="!compactMode && total > perPage" class="u-reset-button refresh-btn u-m-y-20 u-flex u-col-center u-row-center" @tap.stop="loadMore">
|
||||
|
||||
<text class="u-m-r-6 u-iconfont uicon-reload" style="font-size: 28rpx;color: #999" :class="{ 'refresh-active': isRefresh }"></text>
|
||||
|
||||
{{ listParams.page >= lastPage ? '收起' : '加载更多' }}
|
||||
|
||||
</button>
|
||||
|
||||
<view class="x-c" v-if="compactMode && goodsList.length">
|
||||
|
||||
<u-loadmore height="80rpx" :status="loadStatus" icon-type="flower" color="#ccc" />
|
||||
|
||||
</view>
|
||||
|
||||
<shopro-empty
|
||||
v-if="compactMode && !goodsList.length && loadStatus !== 'loading'"
|
||||
marginTop="80rpx"
|
||||
:image="$IMG_URL + '/imgs/empty/empty_goods.png'"
|
||||
tipText="暂无商品"
|
||||
></shopro-empty>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
/**
|
||||
|
||||
* 自定义之为你推荐
|
||||
|
||||
* @property {Object} detail - 推荐商品信息
|
||||
|
||||
*/
|
||||
|
||||
import shGoodsCard from './sh-goods-card.vue';
|
||||
|
||||
export default {
|
||||
|
||||
components: {
|
||||
|
||||
shGoodsCard
|
||||
|
||||
},
|
||||
|
||||
data() {
|
||||
|
||||
return {
|
||||
|
||||
listParams: {
|
||||
|
||||
page: 1
|
||||
|
||||
},
|
||||
|
||||
lastPage: 1,
|
||||
|
||||
total: 0,
|
||||
|
||||
perPage: 0,
|
||||
|
||||
goodsList: [],
|
||||
|
||||
isRefresh: false,
|
||||
|
||||
loadStatus: 'loadmore',
|
||||
|
||||
addTime: 100,
|
||||
|
||||
leftHeight: 0,
|
||||
|
||||
rightHeight: 0,
|
||||
|
||||
leftList: [],
|
||||
|
||||
rightList: [],
|
||||
|
||||
tempList: [],
|
||||
|
||||
goodsType: this.detail?.style || 1
|
||||
|
||||
};
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
props: {
|
||||
|
||||
detail: {
|
||||
|
||||
type: Object,
|
||||
|
||||
default: () => ({})
|
||||
|
||||
},
|
||||
|
||||
compactMode: {
|
||||
|
||||
type: Boolean,
|
||||
|
||||
default: false
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
created() {
|
||||
|
||||
this.initGoodsList();
|
||||
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
initGoodsList() {
|
||||
|
||||
if (this.detail?.id) {
|
||||
|
||||
this.listParams.category_id = this.detail.id;
|
||||
|
||||
this.getGoodsList();
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (this.detail?.ids) {
|
||||
|
||||
this.listParams.goods_ids = this.detail.ids;
|
||||
|
||||
this.getGoodsList();
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (this.compactMode) {
|
||||
|
||||
this.getGoodsList();
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
async splitData() {
|
||||
|
||||
if (!this.tempList.length) return;
|
||||
|
||||
let item = this.tempList[0];
|
||||
|
||||
if (!item) return;
|
||||
|
||||
|
||||
|
||||
if (this.leftHeight < this.rightHeight) {
|
||||
|
||||
this.leftHeight += item.activity_discounts_tags?.length ? 350 : 330;
|
||||
|
||||
this.leftList.push(item);
|
||||
|
||||
} else if (this.leftHeight > this.rightHeight) {
|
||||
|
||||
this.rightHeight += item.activity_discounts_tags?.length ? 350 : 330;
|
||||
|
||||
this.rightList.push(item);
|
||||
|
||||
} else {
|
||||
|
||||
this.leftHeight += item.activity_discounts_tags?.length ? 350 : 330;
|
||||
|
||||
this.leftList.push(item);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.tempList.splice(0, 1);
|
||||
|
||||
if (this.tempList.length) {
|
||||
|
||||
setTimeout(() => {
|
||||
|
||||
this.splitData();
|
||||
|
||||
}, this.addTime);
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
clear() {
|
||||
|
||||
this.leftList = [];
|
||||
|
||||
this.rightList = [];
|
||||
|
||||
this.leftHeight = 0;
|
||||
|
||||
this.rightHeight = 0;
|
||||
|
||||
this.tempList = [];
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
getGoodsList() {
|
||||
|
||||
let that = this;
|
||||
|
||||
if (this.compactMode) {
|
||||
|
||||
this.loadStatus = 'loading';
|
||||
|
||||
}
|
||||
|
||||
that.$http('goods.lists', this.listParams).then(res => {
|
||||
|
||||
if (res.code === 1) {
|
||||
|
||||
this.lastPage = res.data.last_page;
|
||||
|
||||
this.total = res.data.total;
|
||||
|
||||
this.perPage = res.data.per_page;
|
||||
|
||||
this.isRefresh = false;
|
||||
|
||||
that.goodsList = [...that.goodsList, ...res.data.data];
|
||||
|
||||
if (this.compactMode) {
|
||||
|
||||
this.loadStatus = this.listParams.page < res.data.last_page ? 'loadmore' : 'nomore';
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
that.tempList = res.data.data;
|
||||
|
||||
that.goodsList.length && that.splitData();
|
||||
|
||||
} else if (this.compactMode) {
|
||||
|
||||
this.loadStatus = 'nomore';
|
||||
|
||||
}
|
||||
|
||||
}).catch(() => {
|
||||
|
||||
if (this.compactMode) {
|
||||
|
||||
this.loadStatus = 'nomore';
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
loadMore() {
|
||||
|
||||
if (!this.isRefresh) {
|
||||
|
||||
if (this.listParams.page < this.lastPage) {
|
||||
|
||||
this.isRefresh = true;
|
||||
|
||||
this.listParams.page += 1;
|
||||
|
||||
this.getGoodsList();
|
||||
|
||||
} else {
|
||||
|
||||
this.listParams.page = 1;
|
||||
|
||||
this.lastPage = 1;
|
||||
|
||||
this.goodsList = [];
|
||||
|
||||
this.clear();
|
||||
|
||||
this.getGoodsList();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
@mixin vue-flex($direction: row) {
|
||||
|
||||
/* #ifndef APP-NVUE */
|
||||
|
||||
display: flex;
|
||||
|
||||
flex-direction: $direction;
|
||||
|
||||
/* #endif */
|
||||
|
||||
}
|
||||
|
||||
.u-waterfall {
|
||||
|
||||
@include vue-flex;
|
||||
|
||||
flex-direction: row;
|
||||
|
||||
align-items: flex-start;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
.u-column {
|
||||
|
||||
@include vue-flex;
|
||||
|
||||
flex: 1;
|
||||
|
||||
flex-direction: column;
|
||||
|
||||
height: auto;
|
||||
|
||||
min-width: 0;
|
||||
|
||||
|
||||
|
||||
& + & {
|
||||
|
||||
margin-left: $brand-page-gutter;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
.hot-goods {
|
||||
|
||||
background: none;
|
||||
|
||||
padding: 0 $brand-page-gutter;
|
||||
|
||||
box-sizing: border-box;
|
||||
|
||||
|
||||
|
||||
.goods-item {
|
||||
|
||||
width: 100%;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
.refresh-btn {
|
||||
|
||||
margin-left: 50%;
|
||||
|
||||
transform: translateX(-50%);
|
||||
|
||||
width: 156rpx;
|
||||
|
||||
line-height: 50rpx;
|
||||
|
||||
background: #ffffff;
|
||||
|
||||
border-radius: 25rpx;
|
||||
|
||||
font-size: 22rpx;
|
||||
|
||||
font-weight: 500;
|
||||
|
||||
color: #999999;
|
||||
|
||||
white-space: nowrap;
|
||||
|
||||
}
|
||||
|
||||
.refresh-active {
|
||||
|
||||
transform: rotate(360deg);
|
||||
|
||||
transition: all linear 0.5s;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
.hot-goods--compact {
|
||||
|
||||
padding: 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
.home-goods-grid {
|
||||
|
||||
display: flex;
|
||||
|
||||
flex-direction: row;
|
||||
|
||||
flex-wrap: wrap;
|
||||
|
||||
justify-content: space-between;
|
||||
|
||||
padding: 0 $brand-page-gutter 24rpx;
|
||||
|
||||
box-sizing: border-box;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
.home-goods-item {
|
||||
|
||||
width: calc(50% - 10rpx);
|
||||
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
<template>
|
||||
<view class="image-goods-box">
|
||||
<image @tap="handleToGoodsDetail" v-if="image" :src="image" mode="widthFix" class="img"></image>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/**
|
||||
* 图片商品
|
||||
* @property {String} image -图片
|
||||
* @property {Object} goods -商品信息
|
||||
*/
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
},
|
||||
props: {
|
||||
image: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
goods: {
|
||||
type: Object,
|
||||
default: {
|
||||
id: 0,
|
||||
title: '',
|
||||
image: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
created() {},
|
||||
methods: {
|
||||
// 跳转商品详情
|
||||
handleToGoodsDetail() {
|
||||
if (this.goods.id) {
|
||||
this.$tools.routerTo(`/pages/goods/detail?id=${this.goods.id}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.image-goods-box {
|
||||
.img {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,108 @@
|
||||
<template>
|
||||
<view class="live-el u-m-p-20 u-m-b-10" v-if="showLive">
|
||||
<view class="head">
|
||||
<text class="head-title">{{ detail.name }}</text>
|
||||
<view class="head-more u-flex u-col-center" @tap="$Router.push('/pages/app/live/list')">
|
||||
<text class="u-m-r-10 more-text">更多直播</text>
|
||||
<text class="iconfont icon-youjiantou-tianchong more-icon"></text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 大图 -->
|
||||
<view v-if="liveType == 1" v-for="live in liveList" :key="live.id"><shopro-live-card :type="1" :detail="live"></shopro-live-card></view>
|
||||
|
||||
<!-- 小图 -->
|
||||
<view class="content-two" v-if="liveType == 2">
|
||||
<view class="content-two__item" v-for="live in liveList" :key="live.id">
|
||||
<shopro-live-card :type="2" :detail="live" :wh="345">
|
||||
<block slot="liveGoods"><text></text></block>
|
||||
</shopro-live-card>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/**
|
||||
* 自定义之直播卡片
|
||||
* @property {Object} detail - 直播信息
|
||||
*/
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
liveList: [],
|
||||
showLive: this.detail.ids,
|
||||
liveType: this.detail.style
|
||||
};
|
||||
},
|
||||
props: {
|
||||
detail: {}
|
||||
},
|
||||
created() {
|
||||
this.showLive && this.getLiveList();
|
||||
},
|
||||
computed: {},
|
||||
methods: {
|
||||
// 直播列表
|
||||
getLiveList() {
|
||||
let that = this;
|
||||
that.$http('common.live', {
|
||||
type: 'all',
|
||||
ids: that.detail.ids
|
||||
}).then(res => {
|
||||
if (res.code === 1) {
|
||||
that.liveList = res.data;
|
||||
}
|
||||
});
|
||||
},
|
||||
goRoom(live) {
|
||||
wx.navigateTo({
|
||||
url: `plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=${live.room_id}`
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.live-el {
|
||||
background: #fff;
|
||||
padding: 30rpx 20rpx;
|
||||
.head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
&-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: rgba(51, 51, 51, 1);
|
||||
}
|
||||
&-more {
|
||||
.more-text {
|
||||
font-size: 22rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
}
|
||||
.more-icon {
|
||||
font-size: 24rpx;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 双图直播
|
||||
.content-two {
|
||||
width: 710rpx;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
&__item {
|
||||
margin-right: 20rpx;
|
||||
margin-top: 20rpx;
|
||||
width: 345rpx;
|
||||
&:nth-child(2n) {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,155 @@
|
||||
<template>
|
||||
<view class="sh-order-card brand-card">
|
||||
<view class="card-head u-flex u-row-between u-col-center" @tap="jump('/pages/order/list', { type: 'all' })">
|
||||
<text class="card-title">商城订单</text>
|
||||
<view class="card-more u-flex u-col-center">
|
||||
<text>全部订单</text>
|
||||
<text class="u-iconfont uicon-arrow-right"></text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="order-grid u-flex">
|
||||
<view
|
||||
class="order-item u-flex-col u-col-center"
|
||||
v-for="order in orderNav"
|
||||
:key="order.id"
|
||||
@tap="jump(order.path, order.query)"
|
||||
>
|
||||
<view class="order-icon-box u-flex u-row-center u-col-center">
|
||||
<text class="u-iconfont" :class="order.icon"></text>
|
||||
<view class="badge" v-if="order.type && orderNum && orderNum[order.type]">{{ orderNum[order.type] }}</view>
|
||||
</view>
|
||||
<text class="order-label">{{ order.title }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
orderNav: [{
|
||||
id: 1,
|
||||
title: '待付款',
|
||||
icon: 'uicon-rmb-circle',
|
||||
type: 'nopay',
|
||||
path: '/pages/order/list',
|
||||
query: { type: 'nopay' }
|
||||
}, {
|
||||
id: 2,
|
||||
title: '待发货',
|
||||
icon: 'uicon-bag',
|
||||
type: 'nosend',
|
||||
path: '/pages/order/list',
|
||||
query: { type: 'nosend' }
|
||||
}, {
|
||||
id: 3,
|
||||
title: '待收货',
|
||||
icon: 'uicon-car',
|
||||
type: 'noget',
|
||||
path: '/pages/order/list',
|
||||
query: { type: 'noget' }
|
||||
}, {
|
||||
id: 4,
|
||||
title: '待评价',
|
||||
icon: 'uicon-chat',
|
||||
type: 'nocomment',
|
||||
path: '/pages/order/list',
|
||||
query: { type: 'nocomment' }
|
||||
}, {
|
||||
id: 5,
|
||||
title: '售后',
|
||||
icon: 'uicon-reload',
|
||||
type: '',
|
||||
path: '/pages/order/after-sale/list',
|
||||
query: {}
|
||||
}]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['userOtherData']),
|
||||
orderNum() {
|
||||
return this.userOtherData.order_num || 0;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
jump(path, query) {
|
||||
this.$Router.push({ path, query });
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.sh-order-card {
|
||||
padding: 24rpx 24rpx 28rpx;
|
||||
}
|
||||
|
||||
.card-head {
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: $brand-text;
|
||||
}
|
||||
|
||||
.card-more {
|
||||
font-size: 24rpx;
|
||||
color: $brand-text-muted;
|
||||
|
||||
.uicon-arrow-right {
|
||||
font-size: 22rpx;
|
||||
margin-left: 4rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.order-grid {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.order-item {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.order-icon-box {
|
||||
position: relative;
|
||||
width: 88rpx;
|
||||
height: 88rpx;
|
||||
border-radius: 50%;
|
||||
background: $brand-primary-light;
|
||||
margin-bottom: 12rpx;
|
||||
|
||||
.u-iconfont {
|
||||
font-size: 40rpx;
|
||||
color: $brand-primary;
|
||||
}
|
||||
}
|
||||
|
||||
.order-label {
|
||||
font-size: 22rpx;
|
||||
color: $brand-text-muted;
|
||||
line-height: 1.3;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.badge {
|
||||
position: absolute;
|
||||
top: -6rpx;
|
||||
right: -6rpx;
|
||||
min-width: 32rpx;
|
||||
height: 32rpx;
|
||||
padding: 0 8rpx;
|
||||
border-radius: 100rpx;
|
||||
background: $brand-price;
|
||||
color: #fff;
|
||||
font-size: 20rpx;
|
||||
line-height: 32rpx;
|
||||
text-align: center;
|
||||
z-index: 2;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,65 @@
|
||||
<template>
|
||||
<view class="pic-box">
|
||||
<image class="pic-img" :src="$IMG_URL + image" mode="widthFix"></image>
|
||||
<view
|
||||
@click="jump(item.path)"
|
||||
v-if="list.length"
|
||||
v-for="(item, index) of list" :key="index"
|
||||
class="hotspot"
|
||||
:style="{width: `${item.width}rpx`, height: `${item.height}rpx`, left: `${item.left}rpx`, top: `${item.top}rpx`}"
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
/**
|
||||
* shPicAds图文广告
|
||||
* @property {Array} list 热点数据列表,
|
||||
* @property {String} image 广告图片
|
||||
*/
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
props: {
|
||||
// 热点列表
|
||||
list: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
// 图片
|
||||
image: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
methods: {
|
||||
jump(path) {
|
||||
this.$tools.routerTo(path);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.pic-box {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
|
||||
.pic-img {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.hotspot {
|
||||
position: absolute;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,46 @@
|
||||
<template>
|
||||
<view class="sh-richtext-box u-m-b-10" v-if="richText.content"><u-parse :html="richText.content"></u-parse></view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/**
|
||||
* 自定义之富文本卡片
|
||||
* @property {Number|String} id - 富文本id
|
||||
*/
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
richText: ''
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
props: {
|
||||
richId: {
|
||||
type: [Number, String],
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.richId && this.getRichText();
|
||||
},
|
||||
methods: {
|
||||
getRichText() {
|
||||
this.$http('common.richText', {
|
||||
id: this.richId
|
||||
}).then(res => {
|
||||
if (res.code === 1) {
|
||||
this.richText = res.data;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.sh-richtext-box {
|
||||
background: #fff;
|
||||
padding: 30rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,46 @@
|
||||
<template>
|
||||
<view class="search u-flex u-row-center u-col-center u-m-b-10 u-p-x-20" @tap="$Router.push('/pages/public/search')">
|
||||
<view class="search-content u-flex u-col-center">
|
||||
<text class="u-iconfont uicon-search search-icon"></text>
|
||||
<view class="pl-text">搜索</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/**
|
||||
* 自定义之搜索样式卡片
|
||||
* @property {Object} detail - 搜索信息
|
||||
*/
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
computed: {},
|
||||
methods: {}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.search {
|
||||
height: 100rpx;
|
||||
width: 750rpx;
|
||||
background: #fff;
|
||||
.search-content {
|
||||
width: 710rpx;
|
||||
padding: 0 18rpx;
|
||||
background-color: #f2f2f2;
|
||||
border-radius: 100rpx;
|
||||
height: 64rpx;
|
||||
.search-icon {
|
||||
color: #606266;
|
||||
size: 34rpx;
|
||||
}
|
||||
.pl-text {
|
||||
color: $u-tips-color;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,300 @@
|
||||
<template>
|
||||
<!-- 活动商品 -->
|
||||
<view class="activity-wrap u-p-x-20 u-p-b-20 u-m-b-10 seckill-card" v-if="showActivity">
|
||||
<!-- 标题栏 -->
|
||||
<view class="title-box u-flex u-row-between u-p-y-20 seckill-title">
|
||||
<view class="u-flex u-col-center">
|
||||
<view class="title-text u-m-r-20 u-ellipsis-1">{{ detail.name }}</view>
|
||||
<u-count-down
|
||||
class="count-down-demo"
|
||||
:timestamp="timestamp"
|
||||
separator-color="#ffbbbb "
|
||||
bg-color="#ffbbbb "
|
||||
ref="uCountDown"
|
||||
color="#fff"
|
||||
@end="seckillEnd"
|
||||
autoplay
|
||||
></u-count-down>
|
||||
</view>
|
||||
<view class="more-box u-flex" @tap="$Router.push('/pages/activity/seckill/list')">
|
||||
<text class="more-text u-m-r-10">更多抢购</text>
|
||||
<text class="iconfont icon-youjiantou-tianchong more-icon"></text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 活动商品 -->
|
||||
<!-- m -->
|
||||
<scroll-view v-if="seckillType === 1" class="scroll-box" scroll-x scroll-anchoring>
|
||||
<view class="goods-box u-flex">
|
||||
<view class="min-goods u-m-r-14" v-for="mgoods in goodsList" :key="mgoods.id" @tap="jump('/pages/goods/detail', { id: mgoods.id })">
|
||||
<view class="img-box"><image class="img" :src="mgoods.image" mode=""></image></view>
|
||||
<view class="mgoods-card-bottom u-p-20">
|
||||
<view class="goods-title u-m-b-10 u-ellipsis-1">{{ mgoods.title }}</view>
|
||||
<view class="price-box font-OPPOSANS">
|
||||
<view class="price u-m-b-10">{{ mgoods.price }}</view>
|
||||
<view class="original-price">¥{{ mgoods.original_price }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<!--b-->
|
||||
<view
|
||||
v-if="seckillType === 2"
|
||||
class="big-goods u-flex u-p-20 u-col-top u-m-b-16"
|
||||
v-for="item in goodsList"
|
||||
:key="item.id"
|
||||
@tap="jump('/pages/goods/detail', { id: item.id })"
|
||||
>
|
||||
<image class="goods-img" :src="item.image" mode="aspectFill"></u-image>
|
||||
<view class=" card-right u-m-l-20 u-flex-col u-row-between">
|
||||
<view class="">
|
||||
<view class="goods-title u-ellipsis-1 u-m-t-10 u-m-b-10">
|
||||
<view class=" sm cu-tag bg-red radius title-tag u-m-r-10" >秒杀</view>
|
||||
{{ item.title }}
|
||||
</view>
|
||||
<view v-show="item.subtitle" class="subtitle-text u-m-b-10 u-ellipsis-1">{{ item.subtitle }}</view>
|
||||
</view>
|
||||
|
||||
<view class="u-flex u-m-y-20">
|
||||
<u-line-progress
|
||||
style="width:210rpx;"
|
||||
height="18"
|
||||
:show-percent="false"
|
||||
:percent="Number(item.percent)"
|
||||
inactive-color=" #e7e7e7"
|
||||
active-color="#ffbbbb "
|
||||
></u-line-progress>
|
||||
|
||||
<view class="progress-text">已售出{{ item.sales }}件</view>
|
||||
</view>
|
||||
|
||||
<view class=" u-flex u-row-between u-col-center">
|
||||
<view class="u-flex u-col-bottom">
|
||||
<view class="price u-m-r-10">{{ item.price }}</view>
|
||||
<view class="origin-price">{{ item.original_price }}</view>
|
||||
</view>
|
||||
<button class="u-reset-button buy-btn">去抢购</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/**
|
||||
* 自定义之秒杀样式组件
|
||||
* @property {Object} detail - 秒杀商品信息
|
||||
*/
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
timestamp: 0, //倒计时
|
||||
goodsList: [],
|
||||
showActivity: true, //是否显示活动。
|
||||
seckillType: this.detail.style
|
||||
};
|
||||
},
|
||||
props: {
|
||||
detail: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {},
|
||||
computed: {},
|
||||
created() {
|
||||
this.getActivityGoodsList();
|
||||
},
|
||||
methods: {
|
||||
// 路由跳转
|
||||
jump(path, parmas) {
|
||||
this.$Router.push({
|
||||
path: path,
|
||||
query: parmas
|
||||
});
|
||||
},
|
||||
|
||||
// 秒杀计时结束
|
||||
seckillEnd() {
|
||||
this.showActivity = false;
|
||||
},
|
||||
|
||||
// 获取秒杀商品
|
||||
getActivityGoodsList() {
|
||||
let that = this;
|
||||
that.$http('goods.activity', {
|
||||
activity_id: that.detail.id
|
||||
}).then(res => {
|
||||
if (res.code === 1) {
|
||||
that.goodsList = res.data.goods.data;
|
||||
that.goodsList.map(item => {
|
||||
item.percent = item.stock + item.sales > 0 ? ((item.sales / (item.sales + item.stock)) * 100).toFixed(2) : 0;
|
||||
});
|
||||
let nowTime = new Date().getTime();
|
||||
let endTime = res.data.endtime * 1000;
|
||||
that.timestamp = (endTime - nowTime) / 1000;
|
||||
that.timestamp > 0 ? that.$refs.uCountDown.start() : (that.showActivity = false);
|
||||
} else {
|
||||
that.showActivity = false;
|
||||
console.log(`%cerr:秒杀活动已结束`, 'color:green;background:yellow');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.seckill-card {
|
||||
background: linear-gradient(#ffebec 20%, #fff 30%, #fff 100%);
|
||||
}
|
||||
|
||||
.seckill-title {
|
||||
background: url($IMG_URL+'/imgs/tag/seckill_title_bg.png') no-repeat;
|
||||
background-position: center top;
|
||||
background-size: 100% auto;
|
||||
}
|
||||
.activity-wrap {
|
||||
background-color: #fff;
|
||||
min-height: 300rpx;
|
||||
.title-box {
|
||||
.title-text {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #333333;
|
||||
}
|
||||
.more-box {
|
||||
.more-text {
|
||||
font-size: 22rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
}
|
||||
.more-icon {
|
||||
font-size: 24rpx;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.scroll-box,
|
||||
.goods-box {
|
||||
height: 380rpx;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
// 小商品卡片
|
||||
.min-goods {
|
||||
width: 220rpx;
|
||||
height: 380rpx;
|
||||
background: #fff7f7;
|
||||
box-shadow: 0px 7rpx 7rpx 0px rgba(255, 80, 94, 0.32);
|
||||
border-radius: 10rpx;
|
||||
.img-box {
|
||||
width: 220rpx;
|
||||
height: 220rpx;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
border-radius: 10rpx 10rpx 0 0;
|
||||
.img {
|
||||
width: 220rpx;
|
||||
height: 220rpx;
|
||||
background-color: #ccc;
|
||||
}
|
||||
}
|
||||
.mgoods-card-bottom {
|
||||
height: 160rpx;
|
||||
background: url($IMG_URL+'/imgs/tag/seckill_goods_bg.png') no-repeat;
|
||||
background-position: bottom center;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
.goods-title {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #000000;
|
||||
line-height: 26rpx;
|
||||
}
|
||||
.price-box {
|
||||
.price {
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
color: $brand-price;
|
||||
&::before {
|
||||
content: '¥';
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
.original-price {
|
||||
font-size: 20rpx;
|
||||
font-weight: 500;
|
||||
text-decoration: line-through;
|
||||
color: #c4c4c4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 大商品卡片
|
||||
.big-goods {
|
||||
width: 710rpx;
|
||||
min-height: 260rpx;
|
||||
background: #ffffff;
|
||||
box-shadow: 0px 7rpx 8rpx 1rpx rgba(254, 76, 29, 0.05);
|
||||
border-radius: 20rpx;
|
||||
.goods-img{
|
||||
width: 220rpx;
|
||||
height: 220rpx;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
.card-right {
|
||||
width: 430rpx;
|
||||
height: 100%;
|
||||
}
|
||||
.goods-title {
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
width: 400rpx;
|
||||
color: #000000;
|
||||
}
|
||||
.subtitle-text {
|
||||
font-size: 22rpx;
|
||||
width: 400rpx;
|
||||
font-weight: 500;
|
||||
color: #666666;
|
||||
}
|
||||
.buy-btn {
|
||||
width: 120rpx;
|
||||
line-height: 50rpx;
|
||||
background: linear-gradient(90deg, #1677FF, #4096FF);
|
||||
border-radius: 25rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
}
|
||||
.progress-text {
|
||||
color: #c4c4c4;
|
||||
font-size: 20rpx;
|
||||
margin-left: 25rpx;
|
||||
}
|
||||
// 价格
|
||||
.price {
|
||||
color: $brand-price;
|
||||
font-weight: 600;
|
||||
&::before {
|
||||
content: '¥';
|
||||
font-size: 20rpx;
|
||||
}
|
||||
}
|
||||
.origin-price {
|
||||
color: #c4c4c4;
|
||||
font-size: 24rpx;
|
||||
text-decoration: line-through;
|
||||
&::before {
|
||||
content: '¥';
|
||||
font-size: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,123 @@
|
||||
<template>
|
||||
<view class="sh-title-card" :class="'sh-title-card--' + variant">
|
||||
<view class="section-head u-flex u-row-between u-col-center">
|
||||
<view class="section-head__main u-flex u-col-center">
|
||||
<view class="section-head__line" v-if="variant === 'center'"></view>
|
||||
<text class="section-head__title" :style="{ color: titleColor || '' }">{{ title }}</text>
|
||||
<view class="section-head__line" v-if="variant === 'center'"></view>
|
||||
</view>
|
||||
<text v-if="variant === 'section' && showMore" class="section-head__more" @tap="onMore">查看更多</text>
|
||||
</view>
|
||||
<text class="section-head__sub" v-if="subtitle">{{ subtitle }}</text>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
bgImage: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
titleColor: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
subtitle: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
variant: {
|
||||
type: String,
|
||||
default: 'center'
|
||||
},
|
||||
showMore: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onMore() {
|
||||
this.$Router.push('/pages/goods/list');
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.sh-title-card {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.sh-title-card--center {
|
||||
padding: 32rpx $brand-page-gutter 8rpx;
|
||||
}
|
||||
|
||||
.sh-title-card--section {
|
||||
padding: 24rpx $brand-page-gutter 20rpx;
|
||||
}
|
||||
|
||||
.section-head {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.section-head__main {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.sh-title-card--center .section-head__main {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.sh-title-card--section .section-head__main {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.section-head__more {
|
||||
flex-shrink: 0;
|
||||
margin-left: 16rpx;
|
||||
font-size: 24rpx;
|
||||
color: $brand-text-muted;
|
||||
}
|
||||
|
||||
.section-head__line {
|
||||
flex: 1;
|
||||
max-width: 120rpx;
|
||||
height: 1rpx;
|
||||
background: linear-gradient(90deg, transparent, rgba(5, 150, 105, 0.45), transparent);
|
||||
}
|
||||
|
||||
.section-head__title {
|
||||
font-size: 34rpx;
|
||||
font-weight: 700;
|
||||
color: $brand-text;
|
||||
letter-spacing: 1rpx;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.sh-title-card--center .section-head__title {
|
||||
margin: 0 24rpx;
|
||||
}
|
||||
|
||||
.section-head__sub {
|
||||
display: block;
|
||||
margin-top: 8rpx;
|
||||
text-align: center;
|
||||
font-size: 20rpx;
|
||||
color: $brand-text-muted;
|
||||
letter-spacing: 6rpx;
|
||||
opacity: 0.75;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,129 @@
|
||||
<template>
|
||||
<view class="sh-wallet-card brand-card">
|
||||
<view class="card-head u-flex u-row-between u-col-center">
|
||||
<view class="head-left u-flex u-col-center">
|
||||
<view class="section-dot"></view>
|
||||
<text class="card-title">我的资产</text>
|
||||
</view>
|
||||
<view class="head-link u-flex u-col-center" @tap="jump('/pages/user/wallet/index')">
|
||||
<text>进入钱包</text>
|
||||
<text class="u-iconfont uicon-arrow-right"></text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="wallet-grid u-flex">
|
||||
<view
|
||||
class="wallet-item u-flex-col u-col-center"
|
||||
v-for="item in walletItems"
|
||||
:key="item.key"
|
||||
@tap="jump(item.path)"
|
||||
>
|
||||
<text class="wallet-value u-ellipsis-1">{{ item.displayValue }}</text>
|
||||
<text class="wallet-label">{{ item.label }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
|
||||
export default {
|
||||
computed: {
|
||||
...mapGetters(['userInfo', 'userOtherData']),
|
||||
walletItems() {
|
||||
return [{
|
||||
key: 'money',
|
||||
label: '余额(元)',
|
||||
displayValue: this.userInfo.money || '0',
|
||||
path: '/pages/user/wallet/index'
|
||||
}, {
|
||||
key: 'score',
|
||||
label: '积分',
|
||||
displayValue: this.userInfo.score || '0',
|
||||
path: '/pages/user/wallet/score-balance'
|
||||
}, {
|
||||
key: 'coupon',
|
||||
label: '优惠券',
|
||||
displayValue: this.userOtherData.coupons_num || '0',
|
||||
path: '/pages/app/coupon/list'
|
||||
}, {
|
||||
key: 'wallet',
|
||||
label: '钱包',
|
||||
displayValue: '查看',
|
||||
path: '/pages/user/wallet/index'
|
||||
}];
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
jump(path) {
|
||||
this.$Router.push({ path });
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.sh-wallet-card {
|
||||
padding: 24rpx 24rpx 28rpx;
|
||||
}
|
||||
|
||||
.card-head {
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.head-left {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.section-dot {
|
||||
width: 8rpx;
|
||||
height: 28rpx;
|
||||
border-radius: 4rpx;
|
||||
background: $brand-gold-gradient;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: $brand-text;
|
||||
}
|
||||
|
||||
.head-link {
|
||||
font-size: 24rpx;
|
||||
color: $brand-text-muted;
|
||||
|
||||
.uicon-arrow-right {
|
||||
font-size: 22rpx;
|
||||
margin-left: 4rpx;
|
||||
color: rgba(22, 119, 255, 0.85);
|
||||
}
|
||||
}
|
||||
|
||||
.wallet-grid {
|
||||
width: 100%;
|
||||
background: linear-gradient(180deg, rgba(245, 239, 228, 0.45) 0%, rgba(255, 255, 255, 0) 100%);
|
||||
border-radius: 16rpx;
|
||||
padding: 20rpx 8rpx 8rpx;
|
||||
}
|
||||
|
||||
.wallet-item {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.wallet-value {
|
||||
font-size: 32rpx;
|
||||
font-weight: 700;
|
||||
color: $brand-gold;
|
||||
line-height: 1.2;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.wallet-label {
|
||||
margin-top: 10rpx;
|
||||
font-size: 22rpx;
|
||||
color: $brand-text-muted;
|
||||
line-height: 1.3;
|
||||
}
|
||||
</style>
|
||||
在新工单中引用
屏蔽一个用户