123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218 |
- <template>
- <view class="module-page">
- <navbar ref="navbarRef" :config="config" backColor="#333333"></navbar>
- <template v-if="carouselArr && carouselArr.length > 0">
- <sw-swiper :list='carouselArr' :height="370" />
- </template>
- <view class="module-content">
- <template v-if="moduleList && moduleList.length > 0 && onEmptyDate(moduleList)">
- <view class="module-item" v-for="(md , mi) in moduleList">
- <template v-if="md.goodsList && md.goodsList.length > 0">
- <view class="module-title">{{md.moduleName}}</view>
- <view class="module-goods">
- <view class="goods-item" v-for="item in md.goodsList"
- @click="goProductDetails('/pages/index?pageType=1&type=1&id=' + item.goodsId)">
- <view class="goods-img lazy-img">
- <image class="service-img" :src="item.goodsCover" mode="aspectFill"></image>
- <!-- <u-image class="service-img" :src="item.goodsCover" mode="aspectFit" :lazy-load="true" /> -->
- </view>
- <view class="goods-info">
- <view class="goods-title">{{item.goodsTitle}}</view>
- <view class="goods-price">
- <rich-text :nodes="$mUtil.priceBigSmall(item.goodsSalePrice)"></rich-text>
- <!-- <text class="line-price">¥ {{ item.goodsMarketPrice }}</text> -->
- </view>
- </view>
- </view>
- </view>
- </template>
- <!-- <template v-else>
- <EmptyDate />
- </template> -->
- </view>
- </template>
- <template v-else-if="!loading">
- <EmptyDate />
- </template>
- </view>
- </view>
- </template>
- <script>
- import {
- getGoodsAggregationInfo_Api
- } from "@/api/government.js"
- import swSwiper from "@/components/sw-swiper/sw-swiper.vue"
- export default {
- components: {
- swSwiper
- },
- data() {
- return {
- config: {
- back: false,
- title: '',
- color: 'black',
- backgroundColor: [1, '#fff'],
- statusBarFontColor: 'black',
- rightSlot: true
- },
- activityAggregationId: undefined,
- loading: true,
- carouselArr: [],
- moduleList: [],
- aggregationInfo: {},
- isvisible: false
- };
- },
- onLoad(opt) {
- this.activityAggregationId = opt.activityAggregationId;
- this.getGoodsAggregationInfo()
- },
- onShow() {
- },
- watch: {
- // init
- config: {
- handler(newVal) {
- try {
- this.$refs.navbarRef.init()
- } catch (e) {
- //TODO handle the exception
- }
- },
- deep: true
- }
- },
- methods: {
- // 判断是否存在数据
- onEmptyDate(list) {
- let isData = false;
- try {
- const val = list.find(el => el && el.goodsList && el.goodsList.length > 0);
- isData = val || false;
- } catch (e) {
- isData = false
- };
- return isData
- },
- goProductDetails(path) {
- uni.navigateTo({
- url: path
- })
- },
- getGoodsAggregationInfo() {
- this.loading = true;
- getGoodsAggregationInfo_Api(this.activityAggregationId).then(res => {
- const {
- aggregationName,
- aggregationImg,
- moduleList
- } = res.data || {};
- this.aggregationInfo = res.data
- this.config.title = aggregationName;
- this.moduleList = moduleList || [];
- const imgs = aggregationImg.split(',');
- this.carouselArr = imgs || [];
- }).finally(() => {
- this.loading = false;
- })
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .module-page {
- width: 100%;
- min-height: 100vh;
- background-color: #FEFEFE;
- }
- .module-content {
- padding: 0 30rpx;
- .module-item {
- .module-title {
- font-size: 28rpx;
- font-family: PingFang SC, PingFang SC-Bold;
- font-weight: 700;
- color: #1a1a1a;
- text-align: center;
- padding: 30rpx 0;
- }
- .module-goods {
- display: flex;
- flex-wrap: wrap;
- justify-content: space-between;
- }
- }
- .goods-item {
- flex-shrink: 0;
- width: 336rpx;
- height: 512rpx;
- margin-bottom: 38rpx;
- background: #ffffff;
- border-radius: 18rpx;
- overflow: hidden;
- box-shadow: 0 2rpx 12rpx 0 rgba(0, 0, 0, 0.1);
- // &:nth-child(2n) {
- // margin-right: 0;
- // }
- .goods-img {
- width: 336rpx;
- height: 336rpx;
- border-radius: 18rpx 18rpx 0 0;
- vertical-align: middle;
- .service-img {
- width: 100%;
- height: 100%;
- }
- }
- .goods-info {
- padding: 0 20rpx 20rpx;
- padding-top: 14rpx;
- // height: calc(100% - 336rpx);
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- .goods-title {
- // height: 90rpx;
- margin-bottom: 10rpx;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- }
- .goods-price {
- display: flex;
- align-items: baseline;
- color: #FF6600;
- font-size: 36rpx;
- .line-price {
- font-size: 22rpx;
- color: #999999;
- margin-left: 16rpx;
- text-decoration: line-through;
- }
- }
- }
- }
- }
- .topRight {
- margin-right: 40rpx;
- }
- </style>
|