【拼团活动列表】

1. 接入拼团列表
pull/1/MERGE
YunaiV 2023-06-16 22:43:16 +08:00
parent 96db421a2a
commit b8e61cf7a0
3 changed files with 150 additions and 148 deletions

View File

@ -1,5 +1,12 @@
import request from "@/utils/request.js";
// 获得拼团活动分页
export function getCombinationActivityPage(data) {
return request.get("app-api/promotion/combination-activity/page", data, {
noAuth: true // TODO 芋艿:后续要做调整
});
}
// 获得拼团活动明细
export function getCombinationActivity(id) {
return request.get("app-api/promotion/combination-activity/get-detail", {
@ -10,9 +17,10 @@ export function getCombinationActivity(id) {
}
// 获得最近 n 条拼团记录(团长发起的)
export function getHeadCombinationRecordList(status) {
export function getHeadCombinationRecordList(status, count) {
return request.get("app-api/promotion/combination-record/get-head-list", {
status
status,
count
}, {
noAuth: true // TODO 芋艿:后续要做调整
});

View File

@ -6,7 +6,7 @@
<!-- #ifdef H5 -->
<view class='iconfont icon-xiangzuo' @tap='goBack' :style="'top:'+ (navH/2) +'rpx'" v-if="returnShow"></view>
<!-- #endif -->
<!-- banner -->
<!-- banner TODO 芋艿banner -->
<view class="swiper" 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">
@ -20,7 +20,8 @@
</block>
</swiper>
</view>
<view class="nav acea-row row-between-wrapper">
<!-- TODO 芋艿头部 -->
<view class="nav acea-row row-between-wrapper">
<image src="../static/zuo.png"></image>
<view class="title acea-row row-center">
<view class="spike-bd">
@ -38,36 +39,35 @@
</view>
<image src="../static/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'>
<image :src='item.image'></image>
<image :src='item.picUrl'></image>
</view>
<view class='text'>
<view class='line2'>{{item.title}}</view>
<text class='y-money'>{{item.otPrice}}</text>
<view class='line2'>{{ item.name }}</view>
<text class='y-money'>{{ fen2yuan(item.marketPrice) }}</text>
<view class='bottom acea-row row-between-wrapper'>
<view class='money'><text class='num'>{{item.price}}</text></view>
<view class='money'><text class='num'>{{ fen2yuan(item.combinationPrice) }}</text></view>
<view class="btn acea-row">
<view class="num">{{item.people}}人团</view>
<view class="num">{{ item.userSize }}人团</view>
<view class="goBye">去拼团</view>
</view>
<!-- <view class="nothing">已售罄</view> -->
</view>
</view>
</view>
</block>
<view class='loadingicon acea-row row-center-wrapper' v-if='combinationList.length > 0'>
<text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
<text class='loading iconfont icon-jiazai' :hidden='!loading' /> {{loadTitle}}
</view>
</view>
</view>
<home></home>
</div>
</div>
</template>
<script>
@ -75,10 +75,11 @@
getCombinationList,
combinationHeaderApi
} from '@/api/activity.js';
import {
openPinkSubscribe
} from '../../../utils/SubscribeMessage.js';
import home from '@/components/home/index.vue'
import { openPinkSubscribe } from '../../../utils/SubscribeMessage.js';
import * as CombinationApi from '@/api/promotion/combination.js';
import * as Util from '@/utils/util.js';
import home from '@/components/home/index.vue'
import {getCombinationActivityPage} from "../../../api/promotion/combination";
let app = getApp();
export default {
components: {
@ -86,19 +87,23 @@
},
data() {
return {
//
combinationList: [],
loading: false,
loadend: false,
limit: 10,
page: 1,
loadTitle: '',
// TODO
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
@ -109,7 +114,7 @@
},
onLoad() {
var pages = getCurrentPages();
this.returnShow = pages.length===1?false:true;
this.returnShow = pages.length !== 1;
uni.setNavigationBarTitle({
title:"拼团列表"
})
@ -119,34 +124,71 @@
// #ifdef H5
this.navH = app.globalData.navHeight;
// #endif
//
this.getCombinationList();
// TODO
this.getCombinationHeader();
},
onReachBottom: function() {
this.getCombinationList();
},
methods: {
/**
* 获得拼团活动列表
*/
getCombinationList: function() {
if (this.loadend || this.loadend) {
return;
}
this.loadTitle = '';
this.loading = true
CombinationApi.getCombinationActivityPage({
pageNo: this.page,
pageSize: this.limit
}).then(res => {
let list = res.data.list;
let combinationList = this.$util.SplitArray(list, this.combinationList);
let loadend = list.length < this.limit;
this.loadend = loadend;
this.loading = false;
this.loadTitle = loadend ? '已全部加载' : '加载更多';
this.$set(this, 'combinationList', combinationList);
this.$set(this, 'page', this.page + 1);
}).catch(() => {
this.loading = false;
this.loadTitle = '加载更多';
})
},
/**
* 跳转拼团活动详情
*
* @param item 拼团活动
*/
openSubcribe: function(item) {
// #ifndef MP
uni.navigateTo({
url: `/pages/activity/goods_combination_details/index?id=${item.id}`
});
// #endif
// #ifdef MP
uni.showLoading({
title: '正在加载',
})
openPinkSubscribe().then(res => {
uni.hideLoading();
uni.navigateTo({
url: `/pages/activity/goods_combination_details/index?id=${item.id}`
});
}).catch(() => {
uni.hideLoading();
});
// #endif
},
goBack: function() {
uni.navigateBack();
},
openSubcribe: function(item) {
let page = item;
// #ifndef MP
uni.navigateTo({
url: `/pages/activity/goods_combination_details/index?id=${item.id}`
});
// #endif
// #ifdef MP
uni.showLoading({
title: '正在加载',
})
openPinkSubscribe().then(res => {
uni.hideLoading();
uni.navigateTo({
url: `/pages/activity/goods_combination_details/index?id=${item.id}`
});
}).catch(() => {
uni.hideLoading();
});
// #endif
},
getCombinationHeader: function() {
combinationHeaderApi().then(res => {
this.avatarList = res.data.avatarList || [];
@ -157,34 +199,11 @@
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;
that.loadTitle = loadend ? '已全部加载' : '加载更多';
that.$set(that, 'combinationList', combinationList);
that.$set(that, 'page', that.page + 1);
}).catch(() => {
that.loading = false;
that.loadTitle = '加载更多';
})
},
},
onReachBottom: function() {
this.getCombinationList();
},
fen2yuan(price) {
return Util.fen2yuan(price)
}
}
}
</script>

View File

@ -99,11 +99,11 @@
<div class="list acea-row row-middle">
<div class="item" v-for="(item, index) in storeCombinationHost" :key="index" @click="goDetail(item.id)">
<div class="pictrue">
<img :src="item.image" />
<div class="team" v-text="item.people + '人团'"></div>
<img :src="item.picUrl" />
<div class="team" v-text="(item.userSize - item.userCount) + '人团'"></div>
</div>
<div class="name line1" v-text="item.title"></div>
<div class="money font-color-red" v-text="'¥' + item.price"></div>
<div class="name line1" v-text="item.spuName"></div>
<div class="money font-color-red" v-text="'¥' + fen2yuan(item.combinationPrice)"></div>
</div>
</div>
</div>
@ -150,10 +150,7 @@
import { imageBase64 } from "@/api/public";
import { toLogin } from '@/libs/login.js';
import { mapGetters } from 'vuex';
import {
postCombinationRemove,
getCombinationMore
} from '@/api/activity';
import { postCombinationRemove } from '@/api/activity';
import * as ProductSpuApi from '@/api/product/spu.js';
import * as CombinationApi from '@/api/promotion/combination.js';
import * as Util from '@/utils/util.js';
@ -209,10 +206,6 @@
// ========== ==========
storeCombinationHost: [], //
limit: 10,
page: 1,
loading: false, //
loadend: false, //
// ========== ==========
qrcodeSize: 600, //
@ -257,10 +250,6 @@
//
this.getCombinationPink();
},
// TODO
mounted: function() {
this.combinationMore();
},
//#ifdef MP
/**
* 用户点击右上角分享
@ -295,6 +284,9 @@
//
this.getGoodsDetails();
})
//
this.combinationMore();
}).catch(err => {
this.$util.Tips({
title: err
@ -317,6 +309,23 @@
lookAll: function() {
this.iShidden = !this.iShidden;
},
// TODO
getCombinationRemove: function() {
var that = this;
postCombinationRemove({
id: that.pinkId
}).then(res => {
that.$util.Tips({
title: res.msg
}, {
tab: 3
});
}).catch(res => {
that.$util.Tips({
title: res
});
});
},
// ========== ==========
/**
@ -500,72 +509,31 @@
* 拼团详情
*/
goDetail: function(id) {
this.pinkId = id;
uni.navigateTo({
url: '/pages/activity/goods_combination_details/index?id=' + id
});
},
// TODO
//
listenerActionClose: function() {
this.posters = false;
this.canvasStatus = false;
},
//
combinationMore: function() {
var that = this;
if (that.loadend) return;
if (that.loading) return;
var data = {
page: that.page,
limit: that.limit,
comId: that.pinkId
};
this.loading = true
getCombinationMore(data)
.then(res => {
var storeCombinationHost = that.storeCombinationHost;
var limit = that.limit;
that.page++;
that.loadend = limit > res.data.length;
that.storeCombinationHost = storeCombinationHost.concat(res.data.list);
that.page = that.data.page;
that.loading = false;
})
.catch(res => {
that.loading = false
that.$util.Tips({
title: res
});
});
},
//
goList: function() {
uni.navigateTo({
url: '/pages/activity/goods_combination/index'
});
},
//
getCombinationRemove: function() {
var that = this;
postCombinationRemove({
id: that.pinkId
}).then(res => {
that.$util.Tips({
title: res.msg
}, {
tab: 3
});
// ========== ==========
/**
* 前往拼团列表
*/
goList: function() {
uni.navigateTo({
url: '/pages/activity/goods_combination/index'
});
},
/**
* 更多拼团
*/
combinationMore: function() {
CombinationApi.getHeadCombinationRecordList(1, 9).then(res => {
this.storeCombinationHost = res.data;
}).catch(res => {
that.$util.Tips({
this.$util.Tips({
title: res
});
});
})
},
// ========== ==========
@ -688,6 +656,13 @@
});
//#endif
},
/**
* 分享关闭
*/
listenerActionClose: function() {
this.posters = false;
this.canvasStatus = false;
},
fen2yuan(price) {
return Util.fen2yuan(price)