123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- <template>
- <view class="container activity">
- <view class="activity-content" v-if="activityList.length > 0">
- <view
- class="activity-list"
- v-for="(activity, index) in activityList"
- :key="index"
- @click="NavigatorPath(activity)"
- >
- <view class="activity-list-pic">
- <image class="activity-image" :src="activity.listImage" mode=""></image>
- </view>
- <view class="activity-list-msg">
- <view class="activity-title">{{ activity.name }}</view>
- <view class="activity-numbe"
- >商品数:<text class="color">{{ activity.productCount }}</text>
- </view>
- <view class="activity-times">
- <text class="label">活动时间:</text>
- <text class="color">{{ activity.beginTime }} ~ {{ activity.endTime }}</text>
- </view>
- </view>
- </view>
- </view>
- <view v-else class="activity-content-empty">
- <view class="empty-container">
- <image
- class="empty-container-image"
- :src="StaticUrl + 'icon-empty-activity.png'"
- mode="aspectFit"
- ></image>
- <text class="error-text">您还没有活动哟~</text> <text class="error-text">可联系采美帮您设置活动~</text>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- StaticUrl: this.$Static,
- activityList: [],
- hasNextPage: false,
- listQuery: {
- userId: 0,
- pageNum: 1,
- pageSize: 10
- }
- }
- },
- onLoad() {},
- methods: {
- GetInitProductList() {
- //初始化活动列表数据
- this.ProductService.GetProductActivityAreaList(this.listQuery)
- .then(response => {
- const data = response.data
- this.hasNextPage = data.hasNextPage
- this.activityList = data.list
- })
- .catch(error => {
- this.$util.msg(error.msg, 2000)
- })
- },
- GetOnReachBottomData() {
- //上滑加载更多
- this.listQuery.pageNum += 1
- this.ProductService.GetProductActivityAreaList(this.listQuery)
- .then(response => {
- const data = response.data
- this.hasNextPage = data.hasNextPage
- this.activityList = this.activityList.concat(data.list)
- })
- .catch(error => {
- this.$util.msg(error.msg, 2000)
- })
- },
- NavigatorPath(item) {
- this.$api.navigateTo(
- `/pages/user/activity/activity?activityId=${item.activityId}&userId=${this.listQuery.userId}&name=${
- item.name
- }`
- )
- }
- },
- onPullDownRefresh() {
- //下拉刷新
- this.listQuery.pageNum = 1
- this.GetInitProductList()
- uni.stopPullDownRefresh()
- },
- onReachBottom() {
- if (this.hasNextPage) {
- this.GetOnReachBottomData()
- }
- },
- onShow() {
- this.$api.getStorage().then(resolve => {
- this.listQuery.userId = resolve.userId ? resolve.userId : ''
- this.GetInitProductList()
- })
- }
- }
- </script>
- <style lang="scss">
- page {
- height: auto !important;
- background-color: $color-system;
- }
- .activity-content {
- width: 100%;
- height: auto;
- box-sizing: border-box;
- padding: 24rpx;
- .activity-list {
- width: 100%;
- height: 228rpx;
- box-sizing: border-box;
- padding: 24rpx 20rpx;
- background-color: #ffffff;
- border-radius: 16rpx;
- margin-bottom: 24rpx;
- .activity-list-pic {
- width: 180rpx;
- height: 180rpx;
- float: left;
- box-sizing: border-box;
- border: 1px solid #e1e1e1;
- border-radius: 8rpx;
- .activity-image {
- width: 178rpx;
- height: 178rpx;
- display: block;
- border-radius: 8rpx;
- }
- }
- .activity-list-msg {
- width: 460rpx;
- height: 100%;
- float: right;
- position: relative;
- .activity-title {
- width: 100%;
- height: auto;
- line-height: 36rpx;
- text-overflow: ellipsis;
- overflow: hidden;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- line-clamp: 2;
- -webkit-box-orient: vertical;
- font-size: $font-size-26;
- color: #333333;
- text-align: justify;
- float: left;
- }
- .activity-numbe {
- width: 100%;
- height: 28rpx;
- float: left;
- margin-top: 4rpx;
- text-align: left;
- line-height: 28rpx;
- font-size: $font-size-24;
- color: #999999;
- .color {
- color: #666666;
- }
- }
- .activity-times {
- width: 100%;
- height: 44rpx;
- position: absolute;
- bottom: 0;
- left: 0;
- font-size: 18rpx;
- color: #666666;
- line-height: 44rpx;
- .label {
- display: inline-block;
- float: left;
- }
- .color {
- display: inline-block;
- float: left;
- color: $color-system;
- }
- }
- }
- }
- }
- .activity-content-empty {
- position: relative;
- }
- </style>
|