【首页】

1. 砍价活动组件
pull/1/MERGE
YunaiV 2023-06-19 20:36:58 +08:00
parent 7f976681e4
commit b88b260ac2
5 changed files with 92 additions and 190 deletions

View File

@ -96,31 +96,6 @@ export function postBargainHelpList(params,data) {
return request.get("bargain/help/list?limit="+params.limit+"&page="+params.page, data,{}); return request.get("bargain/help/list?limit="+params.limit+"&page="+params.page, data,{});
} }
/**
* 秒杀产品时间区间
*
*/
export function getSeckillIndexTime(){
return request.get('seckill/index',{},{noAuth:true});
}
/**
* 秒杀产品列表
* @param int time
* @param object data
*/
export function getSeckillList(time,data){
return request.get('seckill/list/'+time,data,{noAuth:true});
}
/**
* 秒杀产品详情
* @param int id
*/
export function getSeckillDetail(id){
return request.get('seckill/detail/'+id);
}
/** /**
* 砍价海报 * 砍价海报
* @param object data * @param object data
@ -160,46 +135,9 @@ export function scombinationCode(id) {
return request.get("combination/code/"+id); return request.get("combination/code/"+id);
} }
/**
* 秒杀产品时间区间
* @param int id
*/
export function getSeckillHeaderApi(){
return request.get('seckill/header',{},{noAuth:true});
}
/**
* 首页秒杀产品列表
*/
export function getSeckillIndexApi(){
return request.get('seckill/index',{},{noAuth:true});
}
/**
* 首页拼团产品列表
*/
export function getCombinationIndexApi(){
return request.get('combination/index',{},{noAuth:true});
}
/**
* 首页砍价产品列表
*/
export function getBargainIndexApi(){
return request.get('bargain/index',{},{noAuth:true});
}
/** /**
* 首页砍价产品列表 * 首页砍价产品列表
*/ */
export function bargainHeaderApi(){ export function bargainHeaderApi(){
return request.get('bargain/header'); return request.get('bargain/header');
} }
/**
* 拼图列表头部
*/
export function combinationHeaderApi(){
return request.get('combination/header');
}

17
api/promotion/bargain.js Normal file
View File

@ -0,0 +1,17 @@
import request from "@/utils/request.js";
// 获得砍价活动列表
export function getBargainActivityList(count) {
return request.get("app-api/promotion/bargain-activity/list", {
count
}, {
noAuth: true // TODO 芋艿:后续要做调整
});
}
// 获得砍价记录的概要信息
export function getBargainRecordSummary() {
return request.get("app-api/promotion/bargain-record/get-summary", {}, {
noAuth: true // TODO 芋艿:后续要做调整
});
}

View File

@ -5,6 +5,7 @@
<view class='iconfont icon-xiangzuo' @tap='goBack' :style="'top:'+ (navH/2) +'rpx'" v-if="returnShow"> <view class='iconfont icon-xiangzuo' @tap='goBack' :style="'top:'+ (navH/2) +'rpx'" v-if="returnShow">
</view> </view>
<!-- #endif --> <!-- #endif -->
<!-- 砍价记录的概要 -->
<view class='header'> <view class='header'>
<view class="pic"> <view class="pic">
<view class='swipers'> <view class='swipers'>
@ -14,17 +15,19 @@
<swiper-item > <swiper-item >
<view class="acea-row row-middle"> <view class="acea-row row-middle">
<image :src="item.avatar" class="mr9"></image> <image :src="item.avatar" class="mr9"></image>
<view class='mr9 nickName'>{{$util.formatName(item.nickName)}}</view> <view class='mr9 nickName'>{{ item.nickname }}</view>
<text class='mr9'>拿了</text> <text class='mr9'>拿了</text>
<view class='line1'>{{item.title}}</view> <view class='line1'>{{ item.activityName }}</view>
</view> </view>
</swiper-item> </swiper-item>
</block> </block>
</swiper> </swiper>
</view> </view>
</view> </view>
<view class="tit">已有{{bargainTotal}}人砍成功</view> <view class="tit">已有{{ bargainTotal }}人砍成功</view>
</view> </view>
<!-- TODO 芋艿 -->
<view class='list'> <view class='list'>
<block v-for="(item,index) in bargainList" :key="index"> <block v-for="(item,index) in bargainList" :key="index">
<view class='item acea-row row-between-wrapper' <view class='item acea-row row-between-wrapper'
@ -35,9 +38,8 @@
<view class='text acea-row row-column-around'> <view class='text acea-row row-column-around'>
<view class='name line2'>{{item.title}}</view> <view class='name line2'>{{item.title}}</view>
<view v-if="item.quota>0" class="acea-row" style="margin-bottom: 14rpx;"> <view v-if="item.quota>0" class="acea-row" style="margin-bottom: 14rpx;">
<countDown :tipText="' '" :bgColor="bgColor" :dayText="':'" :hourText="':'" <countDown :tipText="' '" :bgColor="bgColor" :dayText="':'" :hourText="':'" :minuteText="':'" :secondText="' '"
:minuteText="':'" :secondText="' '" :datatime="item.stopTime/1000" :isDay="true" :datatime="item.stopTime/1000" :isDay="true" />
></countDown>
<text class="txt">后结束</text> <text class="txt">后结束</text>
</view> </view>
<view v-if="new Date().getTime()- item.stopTime >=0"> <view v-if="new Date().getTime()- item.stopTime >=0">
@ -46,55 +48,55 @@
<view v-if="item.quota==0"> <view v-if="item.quota==0">
<view style="font-size: 22rpx;" @tap='currentBargainUser'>已售罄</view> <view style="font-size: 22rpx;" @tap='currentBargainUser'>已售罄</view>
</view> </view>
<!-- <view class='num'><text class='iconfont icon-pintuan'></text>{{item.countPeopleAll}}人正在参与
</view> -->
<view class='money font-color'>最低: <text class='price'>{{item.minPrice}}</text></view> <view class='money font-color'>最低: <text class='price'>{{item.minPrice}}</text></view>
</view> </view>
<view v-if="item.quota>0" class='cutBnt bg-color'>参与砍价</view> <view v-if="item.quota > 0" class='cutBnt bg-color'>参与砍价</view>
<view v-if="item.quota==0" class='cutBnt bg-color-hui'>已售罄</view> <view v-if="item.quota === 0" class='cutBnt bg-color-hui'>已售罄</view>
</view> </view>
</block> </block>
<view class='loadingicon acea-row row-center-wrapper' v-if='bargainList.length > 0'> <view class='loadingicon acea-row row-center-wrapper' v-if='bargainList.length > 0'>
<text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}} <text class='loading iconfont icon-jiazai' :hidden='!loading'></text>{{loadTitle}}
</view> </view>
</view> </view>
</view> </view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
<home></home> <home></home>
</view> </view>
</template> </template>
<script> <script>
import {getBargainRecordSummary} from "../../../api/promotion/bargain";
let app = getApp(); let app = getApp();
import { import {
getBargainList, getBargainList,
bargainHeaderApi bargainHeaderApi
} from '@/api/activity.js'; } from '@/api/activity.js';
import { import { openBargainSubscribe } from '@/utils/SubscribeMessage.js';
openBargainSubscribe
} from '@/utils/SubscribeMessage.js';
import home from '@/components/home'; import home from '@/components/home';
import countDown from '@/components/countDown'; import countDown from '@/components/countDown';
import { import { mapGetters } from "vuex";
toLogin import * as BargainApi from '@/api/promotion/bargain.js';
} from '@/libs/login.js';
import {
mapGetters
} from "vuex";
// #ifdef MP
import authorize from '@/components/Authorize';
// #endif
export default { export default {
components: { components: {
countDown, countDown,
home, home,
// #ifdef MP
authorize
// #endif
}, },
data() { data() {
return { return {
navH: '',
returnShow: true,
// ========== ==========
bargainTotal: 0,
bargainSuccessList: [],
autoplay: true,
indicatorDots: false,
// ========== ==========
bargainList: [],
page: 1,
limit: 10,
loading: false,
loadend: false,
bgColor: { bgColor: {
'bgColor': '#E93323', 'bgColor': '#E93323',
'Color': '#fff', 'Color': '#fff',
@ -102,20 +104,7 @@
'timeTxtwidth': '16rpx', 'timeTxtwidth': '16rpx',
'isDay': true 'isDay': true
}, },
bargainList: [],
page: 1,
limit: 10,
loading: false,
loadend: false,
navH: '',
isAuto: false, //
isShowAuth: false, //
returnShow: true,
loadTitle: '加载更多', loadTitle: '加载更多',
bargainSuccessList: [],
bargainTotal: 0,
indicatorDots: false,
autoplay: true,
}; };
}, },
computed: mapGetters(['isLogin', 'uid']), computed: mapGetters(['isLogin', 'uid']),
@ -130,44 +119,34 @@
deep: true deep: true
} }
}, },
onLoad: function(options) { onLoad: function() {
var pages = getCurrentPages(); const pages = getCurrentPages();
this.returnShow = pages.length === 1 ? false : true; this.returnShow = pages.length !== 1;
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: "砍价列表" title: "砍价列表"
}) })
this.navH = app.globalData.navHeight; this.navH = app.globalData.navHeight;
if (this.isLogin) {
//
this.getBargainList(); this.getBargainList();
this.getBargainHeader(); this.getBargainHeader();
} else {
toLogin();
}
}, },
methods: { methods: {
getBargainHeader: function() { getBargainHeader: function() {
bargainHeaderApi().then(res => { BargainApi.getBargainRecordSummary().then(res => {
this.bargainTotal = res.data.bargainTotal; this.bargainTotal = res.data.userCount;
this.bargainSuccessList = res.data.bargainSuccessList; this.bargainSuccessList = res.data.successRecords;
}).catch(err => { }).catch(err => {
return this.$util.Tips({ return this.$util.Tips({
title: err title: err
}); });
}) })
}, },
//
authColse: function(e) {
this.isShowAuth = e
},
goBack: function() { goBack: function() {
uni.navigateBack({ uni.navigateBack({
delta: 1 delta: 1
}); });
}, },
onLoadFun: function(e) {
this.getBargainList();
},
openSubscribe: function(e) { openSubscribe: function(e) {
let page = e; let page = e;
// #ifndef MP // #ifndef MP
@ -218,7 +197,6 @@
}, },
} }
</script> </script>
<style lang="scss"> <style lang="scss">
page { page {
background-color: #E93323 !important; background-color: #E93323 !important;

View File

@ -290,7 +290,6 @@
<script> <script>
import { import {
getBargainDetail, getBargainDetail,
postBargainStartUser,
postBargainStart, postBargainStart,
postBargainHelp, postBargainHelp,
getBargainUser getBargainUser
@ -299,9 +298,6 @@
imageBase64 imageBase64
} from "@/api/public"; } from "@/api/public";
import uQRCode from '@/js_sdk/Sansnn-uQRCode/uqrcode.js'; import uQRCode from '@/js_sdk/Sansnn-uQRCode/uqrcode.js';
import {
postCartAdd
} from '../../../api/store.js';
import util from '../../../utils/util.js'; import util from '../../../utils/util.js';
import { import {
toLogin toLogin
@ -741,13 +737,6 @@
this.$set(this, 'canvasStatus', false); this.$set(this, 'canvasStatus', false);
} }
}, },
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
@ -768,21 +757,6 @@
onUnload: function() { onUnload: function() {
if (this.interval !== null) clearInterval(this.interval); if (this.interval !== null) clearInterval(this.interval);
}, },
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
//#ifdef MP //#ifdef MP
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
@ -801,7 +775,6 @@
//#endif //#endif
} }
</script> </script>
<style lang="scss"> <style lang="scss">
page { page {
background-color: $theme-color !important; background-color: $theme-color !important;

View File

@ -12,11 +12,11 @@
<view class="itemCon" v-for="(item, index) in bargList" :key="index" @click="bargDetail(item)"> <view class="itemCon" v-for="(item, index) in bargList" :key="index" @click="bargDetail(item)">
<view class="item"> <view class="item">
<view class="pictrue"> <view class="pictrue">
<image :src="item.image"></image> <image :src="item.picUrl"></image>
</view> </view>
<view class="text lines1"> <view class="text lines1">
<view class="name line1">{{item.title}}</view> <view class="name line1">{{ item.name }}</view>
<view class="money">¥<text class="num">{{item.minPrice}}</text></view> <view class="money">¥<text class="num">{{ fen2yuan(item.bargainPrice) }}</text></view>
<view class="btn">参与砍价</view> <view class="btn">参与砍价</view>
</view> </view>
</view> </view>
@ -26,44 +26,40 @@
</view> </view>
</view> </view>
</template> </template>
<script> <script>
let app = getApp(); let app = getApp();
import { import * as BargainApi from '@/api/promotion/bargain.js';
toLogin import * as Util from '@/utils/util.js';
} from '@/libs/login.js';
import {
getBargainIndexApi
} from '@/api/activity.js';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
export default { export default {
name: 'c_bargain', name: 'c_bargain',
computed: mapGetters({ computed: mapGetters({'uid': 'uid'}),
'userData': 'userInfo',
'uid': 'uid'
}),
data() { data() {
return { return {
bargList: [], bargList: [],
isBorader:false isBorader: false
}; };
}, },
created() { created() {
this.getBargainList(); this.getBargainList();
}, },
mounted() {
},
methods: { methods: {
// /**
* 砍价列表
*/
getBargainList() { getBargainList() {
getBargainIndexApi().then(res => { BargainApi.getBargainActivityList().then(res => {
this.bargList = res.data ? res.data.productList : []; this.bargList = res.data ? res.data : [];
}) })
}, },
bargDetail(item){ bargDetail(item){
uni.navigateTo({ uni.navigateTo({
url: `/pages/activity/goods_bargain_details/index?id=${item.id}&startBargainUid=${this.uid}` url: `/pages/activity/goods_bargain_details/index?id=${item.id}&startBargainUid=${this.uid}`
}); });
},
fen2yuan(price) {
return Util.fen2yuan(price)
} }
} }
} }