mall-uniapp/pages/activity/goods_bargain/index.vue

373 lines
321 KiB
Vue
Raw Normal View History

2020-08-13 08:12:57 +00:00
<template>
<view>
<view class='bargain-list'>
<!-- #ifdef H5 -->
<view class='iconfont icon-xiangzuo' @tap='goBack' :style="'top:'+ (navH/2) +'rpx'" v-if="returnShow">
</view>
<!-- #endif -->
2023-06-19 12:36:58 +00:00
<!-- 砍价记录的概要 -->
<view class='header'>
<view class="pic">
<view class='swipers'>
<swiper :indicator-dots="indicatorDots" :autoplay="autoplay" interval="2500" duration="500" vertical="true"
circular="true">
<block v-for="(item,index) in bargainSuccessList" :key='index'>
<swiper-item >
<view class="acea-row row-middle">
<image :src="item.avatar" class="mr9"></image>
2023-06-19 12:36:58 +00:00
<view class='mr9 nickName'>{{ item.nickname }}</view>
<text class='mr9'>拿了</text>
2023-06-19 12:36:58 +00:00
<view class='line1'>{{ item.activityName }}</view>
</view>
</swiper-item>
</block>
</swiper>
</view>
</view>
2023-06-19 12:36:58 +00:00
<view class="tit">已有{{ bargainTotal }}人砍成功</view>
</view>
2023-06-19 12:36:58 +00:00
<!-- 砍价活动列表 -->
2020-08-13 08:12:57 +00:00
<view class='list'>
<block v-for="(item,index) in bargainList" :key="index">
<view class='item acea-row row-between-wrapper'
@tap="openSubscribe('/pages/activity/goods_bargain_details/index?id='+ item.id +'&startBargainUid='+ uid)">
2020-08-13 08:12:57 +00:00
<view class='pictrue'>
<image :src='item.picUrl'></image>
2020-08-13 08:12:57 +00:00
</view>
<view class='text acea-row row-column-around'>
<view class='name line2'>{{ item.name }}</view>
<view class="acea-row" style="margin-bottom: 14rpx;">
2023-06-19 12:36:58 +00:00
<countDown :tipText="' '" :bgColor="bgColor" :dayText="':'" :hourText="':'" :minuteText="':'" :secondText="' '"
:datatime="item.endTime / 1000" :isDay="true" />
<text class="txt">后结束</text>
</view>
<view v-if="item.stock === 0">
<view style="font-size: 22rpx;" @tap="openSubscribe('/pages/activity/goods_bargain_details/index?id='+ item.id +'&startBargainUid='+ uid)">已售罄</view>
</view>
<view class='money font-color'>最低: <text class='price'>{{ fen2yuan(item.bargainPrice) }}</text></view>
2020-08-13 08:12:57 +00:00
</view>
<view v-if="item.stock > 0" class='cutBnt bg-color'>参与砍价</view>
<view v-if="item.stock === 0" class='cutBnt bg-color-hui'>已售罄</view>
2020-08-13 08:12:57 +00:00
</view>
</block>
<view class='loadingicon acea-row row-center-wrapper' v-if='bargainList.length > 0'>
2023-06-19 12:36:58 +00:00
<text class='loading iconfont icon-jiazai' :hidden='!loading'></text>{{loadTitle}}
</view>
2020-08-13 08:12:57 +00:00
</view>
</view>
<home></home>
</view>
</template>
<script>
2023-06-19 12:36:58 +00:00
let app = getApp();
import { openBargainSubscribe } from '@/utils/SubscribeMessage.js';
2020-08-13 08:12:57 +00:00
import home from '@/components/home';
import countDown from '@/components/countDown';
2023-06-19 12:36:58 +00:00
import { mapGetters } from "vuex";
import * as BargainApi from '@/api/promotion/bargain.js';
import * as Util from '@/utils/util.js';
2023-06-19 12:36:58 +00:00
export default {
2020-08-13 08:12:57 +00:00
components: {
countDown,
2020-08-13 08:12:57 +00:00
home,
},
data() {
return {
2023-06-19 12:36:58 +00:00
navH: '',
returnShow: true,
// ========== 砍价记录概要的相关变量 ==========
bargainTotal: 0,
bargainSuccessList: [],
autoplay: true,
indicatorDots: false,
// ========== 砍价活动的相关变量 ==========
bargainList: [],
page: 1,
limit: 10,
loading: false,
loadend: false,
bgColor: {
'bgColor': '#E93323',
'Color': '#fff',
'width': '44rpx',
'timeTxtwidth': '16rpx',
'isDay': true
},
loadTitle: '加载更多',
2020-08-13 08:12:57 +00:00
};
},
computed: mapGetters(['isLogin', 'uid']),
watch: {
isLogin: {
handler: function(newV, oldV) {
if (newV) {
this.getBargainList();
this.getBargainHeader();
}
},
deep: true
}
},
2023-06-19 12:36:58 +00:00
onLoad: function() {
const pages = getCurrentPages();
this.returnShow = pages.length !== 1;
2020-08-13 08:12:57 +00:00
uni.setNavigationBarTitle({
title: "砍价列表"
2020-08-13 08:12:57 +00:00
})
this.navH = app.globalData.navHeight;
2023-06-19 12:36:58 +00:00
// 获得砍价信息
this.getBargainList();
this.getBargainHeader();
2020-08-13 08:12:57 +00:00
},
methods: {
/**
* 获得砍价记录的概要
*/
getBargainHeader: function() {
2023-06-19 12:36:58 +00:00
BargainApi.getBargainRecordSummary().then(res => {
this.bargainTotal = res.data.userCount;
this.bargainSuccessList = res.data.successRecords;
}).catch(err => {
return this.$util.Tips({
title: err
});
})
2020-08-13 08:12:57 +00:00
},
/**
* 获得砍价活动列表
*/
getBargainList: function() {
if (this.loadend || this.loading) {
return;
}
this.loading = true;
this.loadTitle = '';
BargainApi.getBargainActivityPage({
pageNo: this.page,
pageSize: this.limit
}).then(res => {
const list = res.data.list;
const bargainList = this.$util.SplitArray(list, this.bargainList);
const loadend = list.length < this.limit;
this.loadend = loadend;
this.loading = false;
this.loadTitle = loadend ? '已全部加载' : '加载更多';
this.$set(this, 'bargainList', bargainList);
this.$set(this, 'page', this.page + 1);
}).catch(res => {
this.loading = false;
this.loadTitle = '加载更多';
});
},
/**
* 跳转到砍价详情
*
* @param e 跳转的地址
*/
2020-08-13 08:12:57 +00:00
openSubscribe: function(e) {
let page = e;
// #ifndef MP
uni.navigateTo({
url: page
});
// #endif
// #ifdef MP
uni.showLoading({
title: '正在加载',
})
openBargainSubscribe().then(res => {
uni.hideLoading();
uni.navigateTo({
url: page,
});
}).catch((err) => {
uni.hideLoading();
});
// #endif
},
goBack: function() {
uni.navigateBack({
delta: 1
});
},
fen2yuan(price) {
return Util.fen2yuan(price)
}
2020-08-13 08:12:57 +00:00
},
onReachBottom: function() {
this.getBargainList();
}
2020-08-13 08:12:57 +00:00
}
</script>
<style lang="scss">
page {
background-color: #E93323 !important;
}
</style>
<style lang="scss" scoped>
.mr9{
margin-right: 9rpx;
}
.swipers {
height: 100%;
width: 76%;
margin: auto;
overflow: hidden;
font-size: 22rpx;
color: #fff;
image{
width: 24rpx;
height: 24rpx;
border-radius: 50%;
overflow: hidden;
}
swiper {
height: 100%;
width: 100%;
overflow: hidden;
}
.line1{
width: 195rpx;
}
2020-08-13 08:12:57 +00:00
}
.bargain-list .icon-xiangzuo {
font-size: 40rpx;
color: #fff;
position: fixed;
left: 30rpx;
z-index: 99;
transform: translateY(-20%);
}
.bargain-list .header {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAu4AAAGkCAYAAABuNqBdAAAgAElEQVR4Xuy9y68nyZImZOeRz3reV/W9d2730ECrR5oVmm7EAgRCQj1bBonNiH8A8ZBgyWMBe1ZsEGv+ASTEDiQEEkgwLNHQ9EzTt7ld99H1yqzKzPNEn4V9nl9YmHt4nJNZVd1TRzo65/cLD3dzM3Ozzy3MLU5u/+W/c2unJ2Y3t7b9OTGz6vuiKZpp8wO3Fr29/qo3PMdDSx1Lvx92HBcxb59/fD61+D8G9s8HJrMa/8TsdpJ/M7TmNqAZ9OFH6eeQ/vfE7KSggV9havg5yjfSwnH5ufEvaMvX7zLP5Z4re/nef2Ff/PB/Nju7ey9v/U7Qdr2McvHwxj794v88+eq//cVbH/a7Ab7jwHcc+I4DXyMHbn//X/upPbj95+z09NQuZOCHsH0zhKChG0oz4/8z9921zZnZDz/5F+3xi//AzM67vVR+tWxcOM3b8Lf4u/php+qoc6c3Arcqx144U8cmxc/pbeAWXtvBMG8MpgjmUWwBMhoJB/AU7qtY96ZwxRubt8ggY0nFRHdV3XTfye0f/cFC+oYRopQY+NGp2UlHSWaIOSgr7/LsdhE2fjLQ9O9AU2dwfH9281pZOP4MUAXQ1QW4Ab4hidbnqQBfXfU92qR/n4dMogLZWfBc0+x+YsgZEXmbGf7kzmZBv27ufBy5MfehCwptH+BX+JSvq370FmNXB5XB0Qi67puuCYZs+g3jfXa93E59mhFCr+3R712WoWejcalvG0cjN3kb8GNmAm+xTZ4PdWhE+ywfemRXPJzh61tkw27Xe7oyQ/9Mm11CvoEGvhY7BnF2TrPt3sr04LOw1iZ97dukdcY2wCZEnGKKHbM4YNan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faQXozn1eKP3VDoyq+tHQF7Ws9kxhFYH7/icnvBqZL1Fe9mOADLxOMMET21JhzgJ1tSV+P8hj5wbjUsNy56aIee9meE0YPMzufNBAJJdOJAMkIwUIcy/gXqmfPEcX7VLSc6kFRCpggeqw7quM35KIF6xTguQ5fVV9R1jZODu/dFHS2qs83fk1ygUeQLTVEEG2Yx3JOIuuuWAO/jb0mFVr4rc/Qo3HQHuDc7emH11VYN2jZdlc/Mgzsy1iHsPi9KgYQeoqTIug+AgGeAyQaoMOytmuWoTAsai2uySYvfXgFAlLSpCuqbDIjeogboCWDpjuLhFof2Ra3BtpWsl4n3N3p3LrxuKcchpMSVw72xySj+Ctoxm5IVSpcoocNQFL7xp44wASQG8KG+/Xx1P0Lj5Loz4OXLagxE0wJSjR9cFhOvTg42Rp3PWRagOm08eJNqwsmvymNXJEYPWFmGsf9/09YBztRqz8VV+VyB2D6xkOY76qOgslUktXSeJdNax5zFHvNqjJcliOjKv+l2BaJXT3uYpAynl/8y9pKXiS7UOM217fM/Xq3We+TE7p9HYM3LO8qs+qw7M8HbUpgIiIx7nzavSkjdweW1n2WfQnPuu1qnyY7RWVYdVn7K9rWxH1r+85nrgbbQ2gx4AQPzbfJkYyxVwFWDr1c9op6P9yO1trglftWiFt6vWggR70AagGFHX5qtknpr6URYsUGJ0E8An6eF3eQCTZ7l44F9jcxjWPwcAWUXv2ffsRj/LKoGL1aaEB6J7upL1WPmT1gBobufZQi4b3mp/iLDKfMv0ow54x9dIlSGkKANnhc66qEPhEHF3losNQX8gncOqv+etq7MCExiNTaBrL+R09IC1K8qBuSNlZom4Z+DelEcADyLu+cej7mEkmAO9cGCbKOSyle8r3MKDr1xoLS86cdH5nbRdN5a85En9MdBKoB3n4uBLAGOzqZSeoDrvQpRJD3MoadX/ojObCG0F/p1tcVhkY9yE
babackground-repeat: no-repeat;
2020-08-13 08:12:57 +00:00
background-size: 100% 100%;
width: 750rpx;
height: 420rpx;
.acea-row{
height: 50rpx;
line-height: 50rpx;
left: 50rpx;
.nickName{
width: 65rpx;
overflow: hidden;
white-space: nowrap;
}
}
.pic {
width: 478rpx;
height: 50rpx;
margin: 0 auto;
background-image: url('../static/lun.png');
babackground-repeat: no-repeat;
background-size: 100% 100%;
}
.tit {
color: #FFFFFF;
font-size: 24rpx;
font-weight: 400;
text-align: center;
margin-top: 304rpx;
}
2020-08-13 08:12:57 +00:00
}
.bargain-list .list {
padding: 0 30rpx;
2020-08-13 08:12:57 +00:00
}
.bargain-list .list .item {
position: relative;
height: 250rpx;
background-color: #fff;
border-radius: 14rpx;
margin-bottom: 20rpx;
padding: 30rpx 25rpx;
2020-08-13 08:12:57 +00:00
}
.bargain-list .list .item .pictrue {
width: 190rpx;
height: 190rpx;
2020-08-13 08:12:57 +00:00
}
.bargain-list .list .item .pictrue image {
width: 100%;
height: 100%;
border-radius: 14rpx;
2020-08-13 08:12:57 +00:00
}
.bargain-list .list .item .text {
width: 432rpx;
font-size: 28rpx;
color: #333333;
2023-06-19 12:36:58 +00:00
.txt{
font-size: 22rpx;
margin-left: 4rpx;
color: #666666;
line-height: 36rpx;
}
2020-08-13 08:12:57 +00:00
}
.bargain-list .list .item .text .name {
width: 100%;
height: 68rpx;
line-height: 36rpx;
font-size: 28rpx;
margin-bottom: 26rpx;
2020-08-13 08:12:57 +00:00
}
.bargain-list .list .item .text .num {
font-size: 26rpx;
color: #999;
}
.bargain-list .list .item .text .num .iconfont {
font-size: 35rpx;
margin-right: 7rpx;
}
.bargain-list .list .item .text .money {
font-size: 24rpx;
font-weight: bold;
}
.bargain-list .list .item .text .money .price {
font-size: 38rpx;
2020-08-13 08:12:57 +00:00
}
.bargain-list .list .item .cutBnt {
position: absolute;
width: 162rpx;
height: 52rpx;
2020-08-13 08:12:57 +00:00
border-radius: 50rpx;
font-size: 24rpx;
color: #fff;
text-align: center;
line-height: 52rpx;
2020-08-13 08:12:57 +00:00
right: 24rpx;
bottom: 30rpx;
background: linear-gradient(90deg, #FF7931 0%, #E93323 100%);
2020-08-13 08:12:57 +00:00
}
.bargain-list .list .item .cutBnt .iconfont {
margin-right: 8rpx;
font-size: 30rpx;
}
.bargain-list .list .load {
font-size: 24rpx;
height: 85rpx;
text-align: center;
line-height: 85rpx;
}
</style>