Files
msh-system/msh_single_uniapp/pages/activity/goods_combination/index.vue

519 lines
133 KiB
Vue
Raw Normal View History

<template>
<view :data-theme="theme">
<view class="pageInfo">
<skeleton :show="showSkeleton" :isNodes="isNodes" ref="skeleton" loading="chiaroscuro" selector="skeleton">
</skeleton>
<view class="skeleton" :style="{visibility: showSkeleton ? 'hidden' : 'visible'}">
<view class="combinationBj"></view>
<view class="combinationList">
<view class='group-list'>
<!-- #ifdef H5 -->
<view class='iconfont icon-xiangzuo' @tap='goBack' :style="'top:'+ (navH/2) +'rpx'"
v-if="returnShow"></view>
<!-- #endif -->
<!-- banner -->
<view class="swiper skeleton-rect" v-if="bannerList.length">
<swiper indicator-dots="true" :autoplay="true" :circular="circular" :interval="interval"
:duration="duration" indicator-color="rgba(255,255,255,0.6)"
indicator-active-color="#fff">
<block v-for="(item,index) in bannerList" :key="index">
<swiper-item>
<navigator :url='item.value'
class='slide-navigator acea-row row-between-wrapper' hover-class='none'>
<image :src="item.value" class="slide-image" lazy-load mode="aspectFill">
</image>
</navigator>
</swiper-item>
</block>
</swiper>
</view>
<view class="nav acea-row row-between-wrapper" v-if="avatarList.length > 0">
<image :src="urlDomain+'crmebimage/perset/activityImg/zuo.png'"></image>
<view class="title acea-row row-center">
<view class="spike-bd">
<view class="activity_pic">
<view v-for="(item,index) in avatarList" :key="index" class="picture"
:style='index===6?"position: relative":"position: static"'>
<span class="avatar" :style='"background-image: url("+item+")"'></span>
<span v-if="index===6 && Number(avatarList.length) > 3" class="mengceng">
<i>···</i>
</span>
</view>
</view>
</view>
<text class="pic_count">{{totalPeople}}人参与</text>
</view>
<image :src="urlDomain+'crmebimage/perset/activityImg/you.png'"></image>
</view>
<view class='list'>
<block v-for="(item,index) in combinationList" :key='index'>
<view class='item acea-row row-between-wrapper' @tap="openSubcribe(item)" data-url=''>
<view class='pictrue skeleton-rect'>
<image :src='item.image'></image>
</view>
<view class='text'>
<view class='line2 skeleton-rect'>{{item.title}}</view>
<text class='y-money skeleton-rect'>{{item.otPrice}}</text>
<view class='bottom acea-row row-between-wrapper'>
<view class='money skeleton-rect'><text class='num'>{{item.price}}</text>
</view>
<view class="bnt acea-row row-center-wrapper" v-if="item.stock>0">
<view class="light">
<image
:src="urlDomain+'crmebimage/perset/activityImg/shandian1.png'">
</image>
</view>
<view class="num">{{item.people}}人团</view>
<view class="go">去拼团</view>
</view>
<view class="bnt gray acea-row row-center-wrapper" v-else>已售罄</view>
</view>
</view>
</view>
</block>
<view class='loadingicon acea-row row-center-wrapper' v-if='combinationList.length > 0'
style="color:#fff;">
<text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
</view>
</view>
<view v-if="combinationList.length == 0" class="no_shop flex-center">
<image :src="urlDomain+'crmebimage/perset/staticImg/noShopper.png'" mode="aspectFit"
style="width: 400rpx;"></image>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import {
getCombinationList,
combinationHeaderApi
} from '@/api/activity.js';
import {
openPinkSubscribe
} from '../../../utils/SubscribeMessage.js';
import {
setThemeColor
} from '@/utils/setTheme.js'
import animationType from '@/utils/animationType.js'
let app = getApp();
export default {
data() {
return {
urlDomain: this.$Cache.get("imgHost"),
showSkeleton: true, //骨架屏显示隐藏
isNodes: 0, //控制什么时候开始抓取元素节点,只要数值改变就重新抓取
indicatorDots: false,
circular: true,
autoplay: true,
interval: 3000,
duration: 500,
navH: '',
combinationList: [],
limit: 10,
page: 1,
loading: false,
loadend: false,
returnShow: true,
loadTitle: '',
avatarList: [],
bannerList: [],
totalPeople: 0,
theme: app.globalData.theme,
bgColor: '#e93323'
}
},
onLoad() {
let that = this;
that.bgColor = setThemeColor();
uni.setNavigationBarColor({
frontColor: '#ffffff',
backgroundColor: that.bgColor,
});
setTimeout(() => {
this.isNodes++;
}, 500);
var pages = getCurrentPages();
this.returnShow = pages.length === 1 ? false : true;
uni.setNavigationBarTitle({
title: "拼团列表"
})
// #ifdef MP
this.navH = app.globalData.navH;
// #endif
// #ifdef H5
this.navH = app.globalData.navHeight;
// #endif
this.getCombinationList();
this.getCombinationHeader();
},
methods: {
goBack: function() {
uni.navigateBack();
},
openSubcribe: function(item) {
let page = item;
// #ifndef MP
uni.navigateTo({
animationType: animationType.type,
animationDuration: animationType.duration,
url: `/pages/activity/goods_combination_details/index?id=${item.id}`
});
// #endif
// #ifdef MP
uni.showLoading({
title: '正在加载',
})
openPinkSubscribe().then(res => {
uni.hideLoading();
uni.navigateTo({
animationType: animationType.type,
animationDuration: animationType.duration,
url: `/pages/activity/goods_combination_details/index?id=${item.id}`
});
}).catch(() => {
uni.hideLoading();
});
// #endif
},
getCombinationHeader: function() {
this.bannerList = [{
value: ''
}];
combinationHeaderApi().then(res => {
this.avatarList = res.data.avatarList || [];
this.bannerList = res.data.bannerList || [];
this.totalPeople = res.data.totalPeople;
}).catch(() => {
this.loading = false;
this.loadTitle = '加载更多';
})
},
getCombinationList: function() {
var that = this;
if (that.loadend) return;
if (that.loading) return;
that.loadTitle = '';
var data = {
page: that.page,
limit: that.limit
};
this.loading = true
getCombinationList(data).then(function(res) {
let list = res.data.list;
let combinationList = that.$util.SplitArray(list, that.combinationList);
let loadend = list.length < that.limit;
that.loadend = loadend;
that.loading = false;
// #ifdef H5
that.setShare();
// #endif
that.loadTitle = loadend ? '已全部加载' : '加载更多';
that.$set(that, 'combinationList', combinationList);
that.$set(that, 'page', that.page + 1);
setTimeout(() => {
that.showSkeleton = false
}, 1000)
}).catch(() => {
that.loading = false;
that.loadTitle = '加载更多';
})
},
setShare: function() {
this.$wechat.isWeixin() &&
this.$wechat.wechatEvevt([
"updateAppMessageShareData",
"updateTimelineShareData",
"onMenuShareAppMessage",
"onMenuShareTimeline"
], {
desc: this.combinationList[0].title,
title: this.combinationList[0].title,
link: location.href,
imgUrl: this.combinationList[0].image
}).then(res => {}).catch(err => {
console.log(err);
});
},
},
onReachBottom: function() {
this.getCombinationList();
},
}
</script>
<style lang="scss">
page {
@include main_bg_color(theme);
}
</style>
<style lang="scss" scoped>
.pageInfo {
/* #ifdef MP || APP-PLUS */
@include main_bg_color(theme);
/* #endif */
}
.mengceng {
width: 40rpx;
height: 40rpx;
line-height: 36rpx;
background: rgba(51, 51, 51, 0.6);
text-align: center;
border-radius: 50%;
opacity: 1;
position: absolute;
left: -2rpx;
color: #FFF;
top: 2rpx;
i {
font-style: normal;
font-size: 20rpx;
}
}
.activity_pic {
.picture {
display: inline-table;
}
.avatar {
width: 38rpx;
height: 38rpx;
display: inline-table;
vertical-align: middle;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
border-radius: 50%;
background-repeat: no-repeat;
background-size: cover;
background-position: 0 0;
margin-right: -10rpx;
box-shadow: 0 0 0 1px #fff;
}
}
.combinationList {
width: 100%;
height: 100%;
padding: 25rpx 30rpx;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAu4AAAOiCAYAAAAv8FJpAAAAAXNSR0IArs4c6QAAIABJREFUeF7sfU2PJTlu7U3AHvg9eIDxwgvDK///H+WV4cUsPA8zsI2xgXxQdapbpZR4DinqKy4LaHRVBkVRhwrp6AQj8uMVfwKBQCAQCARMCHx+fv7N6/VK/8UfGYH/DYDuRODj4yNyd2fqIuqHIvDx0HHFsAKBQCAQmI7A5+fn303v5DkdJAKYDjkr//8c9DaPJBH4dFBd+f/NQ47uA4EjEQjifmRaIqhAIBC4AYGCuGdCmsLW/v2EoWYynWKZ8fdyjCuJuzYXI/Zb8piJdOp8xt/LQa0k7fmQkPqf/fctiYtOAwEjAkHcjcBFs0AgEHhvBJzLZErC+DRgy4NAHtsu8v40bKePpzwM7CLxswdZHgxm9xX+A4FRBLrE/UtJ+v3r9frd139/fb1e6b8/f3x8/Pdox1+n6PSYOfogwIx8ECCFSSCwEIEOcW8R8PpnPVV3YfRUVxLhrgl46bDVrtXhbvIu5SXHa7GhwJ1p1CLb9c8YGynGXer7F3f4UbKT42sR7/pnQc5nzrjwvRKBJnH//Pz8h9fr9QchkD99fHz8x0ig0QePXmDFYxWW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3luEfDJSW91LpDvjn0ir9c8JBF4b+1EkXRs8IuoafysIPBOPRNaj7p1BMGxq4v4vWkg+Pj7+VdPm8/Mz+iABC6xIoMIsEJiMgBNxz1GuJIAtZDTqbU3+mS+hTM4G5Z5V4rVkf2Xuep+PRPmTABppSwE/YsQo6Nl/r8b9tNp3pKqj6yWeob6PzK7ntA3
background-size: 100% 990rpx;
.swiper {
width: 100%;
height: 300rpx;
border-radius: 14rpx;
margin-bottom: 34rpx;
swiper,
.swiper-item,
image {
width: 100%;
height: 300rpx;
border-radius: 10rpx;
}
}
.nav {
width: 100%;
margin-bottom: 34rpx;
image {
width: 102rpx;
height: 4rpx;
}
}
.title {
width: 68%;
.pic_count {
margin-left: 30rpx;
color: $theme-color;
font-size: 22rpx;
font-weight: 500;
width: auto;
height: auto;
background-color: rgba(0, 0, 0, 0.1);
color: #FFFFFF;
border-radius: 19rpx;
padding: 4rpx 14rpx;
}
}
}
.icon-xiangzuo {
font-size: 40rpx;
color: #fff;
position: fixed;
left: 30rpx;
z-index: 99;
transform: translateY(-20%);
}
.group-list .list .item {
background-color: #fff;
border-radius: 14rpx;
padding: 22rpx;
box-sizing: border-box;
margin: 0 auto 20rpx auto;
}
.group-list .list .item .pictrue {
width: 186rpx;
height: 186rpx;
}
.group-list .list .item .pictrue image {
width: 100%;
height: 100%;
border-radius: 6rpx;
}
.group-list .list .item .text {
width: 440rpx;
font-size: 30rpx;
color: #333333;
margin-left: 20rpx;
.line2 {
height: 86rpx;
}
.bnt {
height: 58rpx;
font-size: 24rpx;
text-align: center;
position: relative;
@include main_bg_color(theme);
border-radius: 28rpx;
.light {
position: absolute;
width: 28rpx;
height: 58rpx;
top: 0;
left: 50%;
margin-left: -8rpx;
image {
width: 100%;
height: 100%;
}
}
.num {
width: 120rpx;
background-color: rgba(255, 255, 255, 0.85);
@include main_color(theme);
height: 100%;
line-height: 58rpx;
border-radius: 28rpx 0 14rpx 28rpx;
}
.go {
width: 112rpx;
height: 100%;
line-height: 58rpx;
border-radius: 0 28rpx 28rpx 0;
color: #fff;
}
&.gray {
width: 148rpx;
background-color: #cccccc;
color: #fff;
}
}
.nothing {
width: 148rpx;
height: 58rpx;
text-align: center;
line-height: 58rpx;
background: #CCCCCC;
opacity: 1;
color: #FFFFFF;
border-radius: 30rpx;
font-size: 24rpx;
}
}
.group-list .list .item .text .team {
height: 38rpx;
border-radius: 4rpx;
font-size: 22rpx;
margin-top: 20rpx;
}
.group-list .list .item .text .team .iconfont {
width: 54rpx;
background-color: #ffdcd9;
text-align: center;
color: #dd3823;
height: 100%;
}
.group-list .list .item .text .team .num {
text-align: center;
padding: 0 6rpx;
height: 100%;
}
.group-list .list .item .text .bottom .money {
font-size: 24rpx;
font-weight: bold;
@include price_color(theme);
}
.group-list .list .item .text .bottom .money .num {
font-size: 32rpx;
}
.group-list .list .item .text .y-money {
font-size: 24rpx;
color: #999;
font-weight: normal;
text-decoration: line-through;
}
.group-list .list .item .text .bottom .groupBnt {
font-size: 26rpx;
color: #fff;
width: 146rpx;
height: 54rpx;
text-align: center;
line-height: 54rpx;
border-radius: 4rpx;
}
.group-list .list .item .text .bottom .groupBnt .iconfont {
font-size: 25rpx;
vertical-align: 2rpx;
margin-left: 10rpx;
}
.flex-center {
display: flex;
justify-content: center;
align-items: center;
}
.no_shop {
width: 100%;
height: 700rpx;
border-radius: 10rpx;
background-color: #fff;
}
</style>