【首页】

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,{});
}
/**
* 秒杀产品时间区间
*
*/
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
@ -160,46 +135,9 @@ export function scombinationCode(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(){
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>
<!-- #endif -->
<!-- 砍价记录的概要 -->
<view class='header'>
<view class="pic">
<view class='swipers'>
@ -14,17 +15,19 @@
<swiper-item >
<view class="acea-row row-middle">
<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>
<view class='line1'>{{item.title}}</view>
<view class='line1'>{{ item.activityName }}</view>
</view>
</swiper-item>
</block>
</swiper>
</view>
</view>
<view class="tit">已有{{bargainTotal}}人砍成功</view>
<view class="tit">已有{{ bargainTotal }}人砍成功</view>
</view>
<!-- TODO 芋艿 -->
<view class='list'>
<block v-for="(item,index) in bargainList" :key="index">
<view class='item acea-row row-between-wrapper'
@ -35,9 +38,8 @@
<view class='text acea-row row-column-around'>
<view class='name line2'>{{item.title}}</view>
<view v-if="item.quota>0" class="acea-row" style="margin-bottom: 14rpx;">
<countDown :tipText="' '" :bgColor="bgColor" :dayText="':'" :hourText="':'"
:minuteText="':'" :secondText="' '" :datatime="item.stopTime/1000" :isDay="true"
></countDown>
<countDown :tipText="' '" :bgColor="bgColor" :dayText="':'" :hourText="':'" :minuteText="':'" :secondText="' '"
:datatime="item.stopTime/1000" :isDay="true" />
<text class="txt">后结束</text>
</view>
<view v-if="new Date().getTime()- item.stopTime >=0">
@ -46,76 +48,63 @@
<view v-if="item.quota==0">
<view style="font-size: 22rpx;" @tap='currentBargainUser'>已售罄</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>
<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'>参与砍价</view>
<view v-if="item.quota === 0" class='cutBnt bg-color-hui'>已售罄</view>
</view>
</block>
<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>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
<home></home>
</view>
</template>
<script>
let app = getApp();
import {getBargainRecordSummary} from "../../../api/promotion/bargain";
let app = getApp();
import {
getBargainList,
bargainHeaderApi
} from '@/api/activity.js';
import {
openBargainSubscribe
} from '@/utils/SubscribeMessage.js';
import { openBargainSubscribe } from '@/utils/SubscribeMessage.js';
import home from '@/components/home';
import countDown from '@/components/countDown';
import {
toLogin
} from '@/libs/login.js';
import {
mapGetters
} from "vuex";
// #ifdef MP
import authorize from '@/components/Authorize';
// #endif
export default {
import { mapGetters } from "vuex";
import * as BargainApi from '@/api/promotion/bargain.js';
export default {
components: {
countDown,
home,
// #ifdef MP
authorize
// #endif
},
data() {
return {
bgColor: {
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
},
bargainList: [],
page: 1,
limit: 10,
loading: false,
loadend: false,
navH: '',
isAuto: false, //
isShowAuth: false, //
returnShow: true,
loadTitle: '加载更多',
bargainSuccessList: [],
bargainTotal: 0,
indicatorDots: false,
autoplay: true,
};
},
computed: mapGetters(['isLogin', 'uid']),
@ -130,44 +119,34 @@
deep: true
}
},
onLoad: function(options) {
var pages = getCurrentPages();
this.returnShow = pages.length === 1 ? false : true;
onLoad: function() {
const pages = getCurrentPages();
this.returnShow = pages.length !== 1;
uni.setNavigationBarTitle({
title: "砍价列表"
})
this.navH = app.globalData.navHeight;
if (this.isLogin) {
this.getBargainList();
this.getBargainHeader();
} else {
toLogin();
}
//
this.getBargainList();
this.getBargainHeader();
},
methods: {
getBargainHeader: function() {
bargainHeaderApi().then(res => {
this.bargainTotal = res.data.bargainTotal;
this.bargainSuccessList = res.data.bargainSuccessList;
}).catch(err => {
return this.$util.Tips({
title: err
});
})
},
//
authColse: function(e) {
this.isShowAuth = e
BargainApi.getBargainRecordSummary().then(res => {
this.bargainTotal = res.data.userCount;
this.bargainSuccessList = res.data.successRecords;
}).catch(err => {
return this.$util.Tips({
title: err
});
})
},
goBack: function() {
uni.navigateBack({
delta: 1
});
},
onLoadFun: function(e) {
this.getBargainList();
},
openSubscribe: function(e) {
let page = e;
// #ifndef MP
@ -218,7 +197,6 @@
},
}
</script>
<style lang="scss">
page {
background-color: #E93323 !important;
@ -322,7 +300,7 @@
width: 432rpx;
font-size: 28rpx;
color: #333333;
.txt{
font-size: 22rpx;
margin-left: 4rpx;

View File

@ -290,7 +290,6 @@
<script>
import {
getBargainDetail,
postBargainStartUser,
postBargainStart,
postBargainHelp,
getBargainUser
@ -299,9 +298,6 @@
imageBase64
} from "@/api/public";
import uQRCode from '@/js_sdk/Sansnn-uQRCode/uqrcode.js';
import {
postCartAdd
} from '../../../api/store.js';
import util from '../../../utils/util.js';
import {
toLogin
@ -342,7 +338,7 @@
/**
* 页面的初始数据
*/
data() {
return {
bgColor: {
@ -741,13 +737,6 @@
this.$set(this, 'canvasStatus', false);
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
@ -768,21 +757,6 @@
onUnload: function() {
if (this.interval !== null) clearInterval(this.interval);
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
//#ifdef MP
/**
* 用户点击右上角分享
@ -801,7 +775,6 @@
//#endif
}
</script>
<style lang="scss">
page {
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="item">
<view class="pictrue">
<image :src="item.image"></image>
<image :src="item.picUrl"></image>
</view>
<view class="text lines1">
<view class="name line1">{{item.title}}</view>
<view class="money">¥<text class="num">{{item.minPrice}}</text></view>
<view class="name line1">{{ item.name }}</view>
<view class="money">¥<text class="num">{{ fen2yuan(item.bargainPrice) }}</text></view>
<view class="btn">参与砍价</view>
</view>
</view>
@ -26,45 +26,41 @@
</view>
</view>
</template>
<script>
let app = getApp();
import {
toLogin
} from '@/libs/login.js';
import {
getBargainIndexApi
} from '@/api/activity.js';
import { mapGetters } from 'vuex';
let app = getApp();
import * as BargainApi from '@/api/promotion/bargain.js';
import * as Util from '@/utils/util.js';
import { mapGetters } from 'vuex';
export default {
name: 'c_bargain',
computed: mapGetters({
'userData': 'userInfo',
'uid': 'uid'
}),
computed: mapGetters({'uid': 'uid'}),
data() {
return {
bargList: [],
isBorader:false
isBorader: false
};
},
created() {
this.getBargainList();
},
mounted() {
},
methods: {
//
/**
* 砍价列表
*/
getBargainList() {
getBargainIndexApi().then(res => {
this.bargList = res.data ? res.data.productList : [];
})
BargainApi.getBargainActivityList().then(res => {
this.bargList = res.data ? res.data : [];
})
},
bargDetail(item){
uni.navigateTo({
url: `/pages/activity/goods_bargain_details/index?id=${item.id}&startBargainUid=${this.uid}`
});
}
},
fen2yuan(price) {
return Util.fen2yuan(price)
}
}
}
</script>
@ -95,7 +91,7 @@
border-radius: 14rpx;
margin: 30rpx auto 0 auto;
padding: 25rpx 20rpx 25rpx 20rpx;
.title {
.sign {
font-size: 32rpx;
@ -104,16 +100,16 @@
font-weight: bold;
margin-bottom: 10rpx;
}
.name {
text {
color: #333333;
font-size: 26rpx;
font-weight: 400;
}
}
.more {
width: 86rpx;
height: 40rpx;