【拼团状态详情】

1. 接入拼团记录、活动、商品信息等
pull/1/MERGE
YunaiV 2023-06-16 19:44:57 +08:00
parent 31ead800b1
commit 96db421a2a
3 changed files with 602 additions and 563 deletions

View File

@ -8,3 +8,21 @@ export function getCombinationActivity(id) {
noAuth: true // TODO 芋艿:后续要做调整
});
}
// 获得最近 n 条拼团记录(团长发起的)
export function getHeadCombinationRecordList(status) {
return request.get("app-api/promotion/combination-record/get-head-list", {
status
}, {
noAuth: true // TODO 芋艿:后续要做调整
});
}
// 获得拼团记录明细
export function getCombinationRecordDetail(id) {
return request.get("app-api/promotion/combination-record/get-detail", {
id
}, {
noAuth: true // TODO 芋艿:后续要做调整
});
}

View File

@ -275,7 +275,7 @@
import * as ProductSpuApi from '@/api/product/spu.js';
import * as ProductFavoriteApi from '@/api/product/favorite.js';
import * as ProductCommentApi from '@/api/product/comment.js';
import * as CombinationActivityApi from '@/api/promotion/combination.js';
import * as CombinationApi from '@/api/promotion/combination.js';
import * as Util from '@/utils/util.js';
import * as ProductUtil from '@/utils/product.js';
export default {
@ -450,7 +450,7 @@
methods: {
// ========== ==========
combinationDetail() {
CombinationActivityApi.getCombinationActivity(this.id).then(res => {
CombinationApi.getCombinationActivity(this.id).then(res => {
this.activity = res.data;
uni.setNavigationBarTitle({
title: this.activity.name.substring(0, 16)
@ -473,8 +473,12 @@
this.status = 0;
}
//
this.successRecords = res.data.runningRecords;
this.runningRecords = res.data.runningRecords;
CombinationApi.getHeadCombinationRecordList(1).then(res => {
this.runningRecords = res.data;
})
CombinationApi.getHeadCombinationRecordList(2).then(res => {
this.successRecords = res.data;
})
//
this.getGoodsDetails();
@ -636,6 +640,55 @@
this.attr.properties[propertyIndex].values[valueIndex].name);
this.$set(this, "attrValue", newSkuKey);
},
/**
* 购物车数量加和数量减
*
* @param changeValue true 增加false 减少
*/
ChangeCartNum: function(changeValue) {
// sku
let sku = this.attr.productSelect;
if (!sku) {
return;
}
//
let stock = sku.stock || 0;
let quota = sku.quota || 0;
let limitCount = sku.limitCount;
if (changeValue) {
sku.cart_num++;
if (limitCount !== undefined && sku.cart_num > limitCount) {
this.$set(this.attr.productSelect, "cart_num", limitCount);
this.$util.Tips({
title: `该商品每次限购 ${sku.limitCount} ${this.spu.unitName}`
});
} else if (sku.cart_num > stock || sku.cart_num > quota) {
this.$set(this.attr.productSelect, "cart_num", Math.min(stock, quota));
}
} else {
sku.cart_num--;
if (sku.cart_num < 1) {
this.$set(this.attr.productSelect, "cart_num", 1);
}
}
},
/**
* 购物车手动填写
*
*/
iptCartNum: function(number) {
this.$set(this.attr.productSelect, 'cart_num', number ? number : 1);
//
let sku = this.attr.productSelect;
let limitCount = sku.limitCount;
if (limitCount !== undefined && number > limitCount) {
this.$set(this.attr.productSelect, "cart_num", limitCount);
this.$util.Tips({
title: `该商品每次限购 ${sku.limitCount} ${this.spu.unitName}`
});
}
},
/**
* 跳转到客服
*/
@ -696,55 +749,6 @@
})
}
},
/**
* 购物车数量加和数量减
*
* @param changeValue true 增加false 减少
*/
ChangeCartNum: function(changeValue) {
// sku
let sku = this.attr.productSelect;
if (!sku) {
return;
}
//
let stock = sku.stock || 0;
let quota = sku.quota || 0;
let limitCount = sku.limitCount;
if (changeValue) {
sku.cart_num++;
if (limitCount !== undefined && sku.cart_num > limitCount) {
this.$set(this.attr.productSelect, "cart_num", limitCount);
this.$util.Tips({
title: `该商品每次限购 ${sku.limitCount} ${this.spu.unitName}`
});
} else if (sku.cart_num > stock || sku.cart_num > quota) {
this.$set(this.attr.productSelect, "cart_num", Math.min(stock, quota));
}
} else {
sku.cart_num--;
if (sku.cart_num < 1) {
this.$set(this.attr.productSelect, "cart_num", 1);
}
}
},
/**
* 购物车手动填写
*
*/
iptCartNum: function(number) {
this.$set(this.attr.productSelect, 'cart_num', number ? number : 1);
//
let sku = this.attr.productSelect;
let limitCount = sku.limitCount;
if (limitCount !== undefined && number > limitCount) {
this.$set(this.attr.productSelect, "cart_num", limitCount);
this.$util.Tips({
title: `该商品每次限购 ${sku.limitCount} ${this.spu.unitName}`
});
}
},
/**
* 单独购买
*/

File diff suppressed because it is too large Load Diff