parent
96db421a2a
commit
b8e61cf7a0
|
@ -1,5 +1,12 @@
|
||||||
import request from "@/utils/request.js";
|
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) {
|
export function getCombinationActivity(id) {
|
||||||
return request.get("app-api/promotion/combination-activity/get-detail", {
|
return request.get("app-api/promotion/combination-activity/get-detail", {
|
||||||
|
@ -10,9 +17,10 @@ export function getCombinationActivity(id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获得最近 n 条拼团记录(团长发起的)
|
// 获得最近 n 条拼团记录(团长发起的)
|
||||||
export function getHeadCombinationRecordList(status) {
|
export function getHeadCombinationRecordList(status, count) {
|
||||||
return request.get("app-api/promotion/combination-record/get-head-list", {
|
return request.get("app-api/promotion/combination-record/get-head-list", {
|
||||||
status
|
status,
|
||||||
|
count
|
||||||
}, {
|
}, {
|
||||||
noAuth: true // TODO 芋艿:后续要做调整
|
noAuth: true // TODO 芋艿:后续要做调整
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<!-- #ifdef H5 -->
|
<!-- #ifdef H5 -->
|
||||||
<view class='iconfont icon-xiangzuo' @tap='goBack' :style="'top:'+ (navH/2) +'rpx'" v-if="returnShow"></view>
|
<view class='iconfont icon-xiangzuo' @tap='goBack' :style="'top:'+ (navH/2) +'rpx'" v-if="returnShow"></view>
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
<!-- banner -->
|
<!-- banner TODO 芋艿:banner -->
|
||||||
<view class="swiper" v-if="bannerList.length">
|
<view class="swiper" v-if="bannerList.length">
|
||||||
<swiper indicator-dots="true" :autoplay="true" :circular="circular" :interval="interval"
|
<swiper indicator-dots="true" :autoplay="true" :circular="circular" :interval="interval"
|
||||||
:duration="duration" indicator-color="rgba(255,255,255,0.6)" indicator-active-color="#fff">
|
:duration="duration" indicator-color="rgba(255,255,255,0.6)" indicator-active-color="#fff">
|
||||||
|
@ -20,7 +20,8 @@
|
||||||
</block>
|
</block>
|
||||||
</swiper>
|
</swiper>
|
||||||
</view>
|
</view>
|
||||||
<view class="nav acea-row row-between-wrapper">
|
<!-- TODO 芋艿:头部 -->
|
||||||
|
<view class="nav acea-row row-between-wrapper">
|
||||||
<image src="../static/zuo.png"></image>
|
<image src="../static/zuo.png"></image>
|
||||||
<view class="title acea-row row-center">
|
<view class="title acea-row row-center">
|
||||||
<view class="spike-bd">
|
<view class="spike-bd">
|
||||||
|
@ -38,36 +39,35 @@
|
||||||
</view>
|
</view>
|
||||||
<image src="../static/you.png"></image>
|
<image src="../static/you.png"></image>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- 拼团活动 -->
|
||||||
<view class='list'>
|
<view class='list'>
|
||||||
<block v-for="(item,index) in combinationList" :key='index'>
|
<block v-for="(item,index) in combinationList" :key='index'>
|
||||||
<view class='item acea-row row-between-wrapper' @tap="openSubcribe(item)"
|
<view class='item acea-row row-between-wrapper' @tap="openSubcribe(item)"
|
||||||
data-url=''>
|
data-url=''>
|
||||||
<view class='pictrue'>
|
<view class='pictrue'>
|
||||||
<image :src='item.image'></image>
|
<image :src='item.picUrl'></image>
|
||||||
</view>
|
</view>
|
||||||
<view class='text'>
|
<view class='text'>
|
||||||
<view class='line2'>{{item.title}}</view>
|
<view class='line2'>{{ item.name }}</view>
|
||||||
<text class='y-money'>¥{{item.otPrice}}</text>
|
<text class='y-money'>¥{{ fen2yuan(item.marketPrice) }}</text>
|
||||||
<view class='bottom acea-row row-between-wrapper'>
|
<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="btn acea-row">
|
||||||
<view class="num">{{item.people}}人团</view>
|
<view class="num">{{ item.userSize }}人团</view>
|
||||||
<view class="goBye">去拼团</view>
|
<view class="goBye">去拼团</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="nothing">已售罄</view> -->
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
<view class='loadingicon acea-row row-center-wrapper' v-if='combinationList.length > 0'>
|
<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>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<home></home>
|
<home></home>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -75,10 +75,11 @@
|
||||||
getCombinationList,
|
getCombinationList,
|
||||||
combinationHeaderApi
|
combinationHeaderApi
|
||||||
} from '@/api/activity.js';
|
} from '@/api/activity.js';
|
||||||
import {
|
import { openPinkSubscribe } from '../../../utils/SubscribeMessage.js';
|
||||||
openPinkSubscribe
|
import * as CombinationApi from '@/api/promotion/combination.js';
|
||||||
} from '../../../utils/SubscribeMessage.js';
|
import * as Util from '@/utils/util.js';
|
||||||
import home from '@/components/home/index.vue'
|
import home from '@/components/home/index.vue'
|
||||||
|
import {getCombinationActivityPage} from "../../../api/promotion/combination";
|
||||||
let app = getApp();
|
let app = getApp();
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
@ -86,19 +87,23 @@
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
// 拼团活动列表
|
||||||
|
combinationList: [],
|
||||||
|
loading: false,
|
||||||
|
loadend: false,
|
||||||
|
limit: 10,
|
||||||
|
page: 1,
|
||||||
|
loadTitle: '',
|
||||||
|
|
||||||
|
// TODO 芋艿:未整理
|
||||||
indicatorDots: false,
|
indicatorDots: false,
|
||||||
circular: true,
|
circular: true,
|
||||||
autoplay: true,
|
autoplay: true,
|
||||||
interval: 3000,
|
interval: 3000,
|
||||||
duration: 500,
|
duration: 500,
|
||||||
navH: '',
|
navH: '',
|
||||||
combinationList: [],
|
|
||||||
limit: 10,
|
|
||||||
page: 1,
|
|
||||||
loading: false,
|
|
||||||
loadend: false,
|
|
||||||
returnShow: true,
|
returnShow: true,
|
||||||
loadTitle: '',
|
|
||||||
avatarList: [],
|
avatarList: [],
|
||||||
bannerList: [],
|
bannerList: [],
|
||||||
totalPeople: 0
|
totalPeople: 0
|
||||||
|
@ -109,7 +114,7 @@
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
var pages = getCurrentPages();
|
var pages = getCurrentPages();
|
||||||
this.returnShow = pages.length===1?false:true;
|
this.returnShow = pages.length !== 1;
|
||||||
uni.setNavigationBarTitle({
|
uni.setNavigationBarTitle({
|
||||||
title:"拼团列表"
|
title:"拼团列表"
|
||||||
})
|
})
|
||||||
|
@ -119,34 +124,71 @@
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
this.navH = app.globalData.navHeight;
|
this.navH = app.globalData.navHeight;
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
// 获得拼团活动列表
|
||||||
this.getCombinationList();
|
this.getCombinationList();
|
||||||
|
// TODO 芋艿:
|
||||||
this.getCombinationHeader();
|
this.getCombinationHeader();
|
||||||
},
|
},
|
||||||
|
onReachBottom: function() {
|
||||||
|
this.getCombinationList();
|
||||||
|
},
|
||||||
methods: {
|
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() {
|
goBack: function() {
|
||||||
uni.navigateBack();
|
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() {
|
getCombinationHeader: function() {
|
||||||
combinationHeaderApi().then(res => {
|
combinationHeaderApi().then(res => {
|
||||||
this.avatarList = res.data.avatarList || [];
|
this.avatarList = res.data.avatarList || [];
|
||||||
|
@ -157,34 +199,11 @@
|
||||||
this.loadTitle = '加载更多';
|
this.loadTitle = '加载更多';
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getCombinationList: function() {
|
|
||||||
var that = this;
|
fen2yuan(price) {
|
||||||
if (that.loadend) return;
|
return Util.fen2yuan(price)
|
||||||
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();
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -219,11 +238,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.activity_pic {
|
.activity_pic {
|
||||||
|
|
||||||
.picture {
|
.picture {
|
||||||
display: inline-table;
|
display: inline-table;
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar {
|
.avatar {
|
||||||
width: 38rpx;
|
width: 38rpx;
|
||||||
height: 38rpx;
|
height: 38rpx;
|
||||||
|
|
|
@ -99,11 +99,11 @@
|
||||||
<div class="list acea-row row-middle">
|
<div class="list acea-row row-middle">
|
||||||
<div class="item" v-for="(item, index) in storeCombinationHost" :key="index" @click="goDetail(item.id)">
|
<div class="item" v-for="(item, index) in storeCombinationHost" :key="index" @click="goDetail(item.id)">
|
||||||
<div class="pictrue">
|
<div class="pictrue">
|
||||||
<img :src="item.image" />
|
<img :src="item.picUrl" />
|
||||||
<div class="team" v-text="item.people + '人团'"></div>
|
<div class="team" v-text="(item.userSize - item.userCount) + '人团'"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="name line1" v-text="item.title"></div>
|
<div class="name line1" v-text="item.spuName"></div>
|
||||||
<div class="money font-color-red" v-text="'¥' + item.price"></div>
|
<div class="money font-color-red" v-text="'¥' + fen2yuan(item.combinationPrice)"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -150,10 +150,7 @@
|
||||||
import { imageBase64 } from "@/api/public";
|
import { imageBase64 } from "@/api/public";
|
||||||
import { toLogin } from '@/libs/login.js';
|
import { toLogin } from '@/libs/login.js';
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import {
|
import { postCombinationRemove } from '@/api/activity';
|
||||||
postCombinationRemove,
|
|
||||||
getCombinationMore
|
|
||||||
} from '@/api/activity';
|
|
||||||
import * as ProductSpuApi from '@/api/product/spu.js';
|
import * as ProductSpuApi from '@/api/product/spu.js';
|
||||||
import * as CombinationApi from '@/api/promotion/combination.js';
|
import * as CombinationApi from '@/api/promotion/combination.js';
|
||||||
import * as Util from '@/utils/util.js';
|
import * as Util from '@/utils/util.js';
|
||||||
|
@ -209,10 +206,6 @@
|
||||||
|
|
||||||
// ========== 拼团推荐相关变量 ==========
|
// ========== 拼团推荐相关变量 ==========
|
||||||
storeCombinationHost: [], // 拼团推荐
|
storeCombinationHost: [], // 拼团推荐
|
||||||
limit: 10,
|
|
||||||
page: 1,
|
|
||||||
loading: false, // 是否加载中
|
|
||||||
loadend: false, // 是否到底
|
|
||||||
|
|
||||||
// ========== 分销相关的变量 ==========
|
// ========== 分销相关的变量 ==========
|
||||||
qrcodeSize: 600, // 二维码的大小
|
qrcodeSize: 600, // 二维码的大小
|
||||||
|
@ -257,10 +250,6 @@
|
||||||
// 加载拼团信息
|
// 加载拼团信息
|
||||||
this.getCombinationPink();
|
this.getCombinationPink();
|
||||||
},
|
},
|
||||||
// TODO 芋艿:还没搞好
|
|
||||||
mounted: function() {
|
|
||||||
this.combinationMore();
|
|
||||||
},
|
|
||||||
//#ifdef MP
|
//#ifdef MP
|
||||||
/**
|
/**
|
||||||
* 用户点击右上角分享
|
* 用户点击右上角分享
|
||||||
|
@ -295,6 +284,9 @@
|
||||||
// 获得商品详情
|
// 获得商品详情
|
||||||
this.getGoodsDetails();
|
this.getGoodsDetails();
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 加载更多拼团记录
|
||||||
|
this.combinationMore();
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
this.$util.Tips({
|
this.$util.Tips({
|
||||||
title: err
|
title: err
|
||||||
|
@ -317,6 +309,23 @@
|
||||||
lookAll: function() {
|
lookAll: function() {
|
||||||
this.iShidden = !this.iShidden;
|
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) {
|
goDetail: function(id) {
|
||||||
this.pinkId = id;
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/activity/goods_combination_details/index?id=' + id
|
url: '/pages/activity/goods_combination_details/index?id=' + id
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
// TODO 芋艿:
|
// ========== 拼团推荐 ==========
|
||||||
|
/**
|
||||||
|
* 前往拼团列表
|
||||||
// 分享关闭
|
*/
|
||||||
listenerActionClose: function() {
|
goList: function() {
|
||||||
this.posters = false;
|
uni.navigateTo({
|
||||||
this.canvasStatus = false;
|
url: '/pages/activity/goods_combination/index'
|
||||||
},
|
});
|
||||||
// 更多拼团
|
},
|
||||||
combinationMore: function() {
|
/**
|
||||||
var that = this;
|
* 更多拼团
|
||||||
if (that.loadend) return;
|
*/
|
||||||
if (that.loading) return;
|
combinationMore: function() {
|
||||||
var data = {
|
CombinationApi.getHeadCombinationRecordList(1, 9).then(res => {
|
||||||
page: that.page,
|
this.storeCombinationHost = res.data;
|
||||||
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
|
|
||||||
});
|
|
||||||
}).catch(res => {
|
}).catch(res => {
|
||||||
that.$util.Tips({
|
this.$util.Tips({
|
||||||
title: res
|
title: res
|
||||||
});
|
});
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// ========== 分销相关的方法 ==========
|
// ========== 分销相关的方法 ==========
|
||||||
|
@ -688,6 +656,13 @@
|
||||||
});
|
});
|
||||||
//#endif
|
//#endif
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* 分享关闭
|
||||||
|
*/
|
||||||
|
listenerActionClose: function() {
|
||||||
|
this.posters = false;
|
||||||
|
this.canvasStatus = false;
|
||||||
|
},
|
||||||
|
|
||||||
fen2yuan(price) {
|
fen2yuan(price) {
|
||||||
return Util.fen2yuan(price)
|
return Util.fen2yuan(price)
|
||||||
|
|
Loading…
Reference in New Issue