合并master

This commit is contained in:
lemon橪
2021-05-25 14:27:45 +08:00
21 changed files with 499 additions and 401 deletions

View File

@@ -223,7 +223,7 @@ export default {
{
title: "状态",
key: "promotionStatus",
minWidth: 100,
width: 100,
fixed: "right",
render: (h, params) => {
let text = "未知",
@@ -250,9 +250,9 @@ export default {
},
},
text
),
)
]);
},
}
},
{
title: "操作",

View File

@@ -114,9 +114,8 @@
v-if="form.scopeType == 'PORTION_GOODS'"
>
<div style="display: flex; margin-bottom: 10px">
<Button type="primary" @click="$refs.skuSelect.open('goods')"
>选择商品</Button
>
<Button type="primary" @click="openSkuList"
>选择商品</Button>
<Button
type="error"
ghost
@@ -466,6 +465,14 @@ export default {
name: "coupon",
});
},
openSkuList() { // 显示商品选择器
this.$refs.skuSelect.open("goods");
let data = JSON.parse(JSON.stringify(this.form.promotionGoodsList))
data.forEach(e => {
e.id = e.skuId
})
this.$refs.skuSelect.goodsData = data;
},
changeSelect(e) {
// 已选商品批量选择
this.selectedGoods = e;
@@ -497,15 +504,9 @@ export default {
this.form.promotionGoodsList.splice(index, 1);
},
selectedGoodsData(item) {
console.log(item);
// 回显已选商品
let ids = [];
let list = [];
this.form.promotionGoodsList.forEach((e) => {
ids.push(e.skuId);
});
item.forEach((e) => {
if (!ids.includes(e.id)) {
list.push({
goodsName: e.goodsName,
price: e.price,
@@ -515,9 +516,8 @@ export default {
sellerName: e.sellerName,
skuId: e.id,
});
}
});
this.form.promotionGoodsList.push(...list);
this.form.promotionGoodsList = list;
},
getGoodsCategory(e) {
// 获取级联选择器商品分类id

View File

@@ -140,12 +140,12 @@ export default {
{
title: "活动类型",
slot: "promotionType",
minWidth: 60,
width: 100,
},
{
title: "活动状态",
key: "promotionStatus",
minWidth: 60,
width: 100,
render: (h, params) => {
let text = "未知",
color = "default";

View File

@@ -183,7 +183,7 @@
style="display: flex; margin-bottom: 10px"
v-if="form.promotionStatus == 'NEW'"
>
<Button type="primary" @click="$refs.skuSelect.open('goods')"
<Button type="primary" @click="openSkuList"
>选择商品</Button
>
<Button
@@ -376,6 +376,14 @@ export default {
);
this.$router.go(-1);
},
openSkuList() { // 显示商品选择器
this.$refs.skuSelect.open("goods");
let data = JSON.parse(JSON.stringify(this.form.promotionGoodsList))
data.forEach(e => {
e.id = e.skuId
})
this.$refs.skuSelect.goodsData = data;
},
getDetail() {
// 获取活动详情
getFullDiscountById(this.id).then((res) => {
@@ -496,28 +504,20 @@ export default {
this.form.promotionGoodsList.splice(index, 1);
},
selectedGoodsData(item) {
console.log(item);
// 回显已选商品
let ids = [];
let list = [];
this.form.promotionGoodsList.forEach((e) => {
ids.push(e.skuId);
});
item.forEach((e) => {
if (!ids.includes(e.id)) {
list.push({
goodsName: e.goodsName,
price: e.price,
quantity: e.quantity,
storeId: e.storeId,
storeName: e.storeName,
thumbnail: e.thumbnail,
skuId: e.id,
});
}
list.push({
goodsName: e.goodsName,
price: e.price,
quantity: e.quantity,
storeId: e.storeId,
storeName: e.storeName,
thumbnail: e.thumbnail,
skuId: e.id,
});
});
console.log(list);
this.form.promotionGoodsList.push(...list);
this.form.promotionGoodsList = list;
},
getCouponList(query) {
// 优惠券列表

View File

@@ -155,17 +155,15 @@ export default {
{
title: "活动开始时间",
key: "startTime",
minWidth: 120
},
{
title: "活动结束时间",
key: "endTime",
minWidth: 120
},
{
title: "状态",
key: "promotionStatus",
minWidth: 100,
width: 100,
render: (h, params) => {
let text = "未知",
color = "default";

View File

@@ -36,7 +36,7 @@
</Row>
</Card>
<sku-select ref="skuSelect" @selectedGoodsData="selectedGoodsData"></sku-select>
<sku-select ref="skuSelect" :goodsData="goodsData" @selectedGoodsData="selectedGoodsData"></sku-select>
</div>
</template>
<script>
@@ -65,7 +65,7 @@ export default {
data: [], // 表单数据
total: 0, // 表单数据总数
status: this.$route.query.status, // 查看还是修改
columns: [
columns: [ // 活动详情表头
{
title: "活动名称",
key: "promotionName",
@@ -111,7 +111,7 @@ export default {
},
},
],
goodsColumns: [
goodsColumns: [ // 活动商品表头
{ type: "selection", width: 60, align: "center" },
{
title: "商品名称",
@@ -202,7 +202,6 @@ export default {
handleReset() {
// 重置
// this.$refs.searchForm.resetFields();
this.searchForm.pageNumber = 0;
this.searchForm.promotionName = "";
this.selectDate = null;
@@ -211,7 +210,7 @@ export default {
this.getDataList();
},
clearSelectAll() {
clearSelectAll() { // 清空所有已选项
this.$refs.table.selectAll(false);
},
changeSelect(e) {
@@ -220,7 +219,7 @@ export default {
this.selectCount = e.length;
},
getDataList() {
getDataList() { // 获取商品列表
this.loading = true;
this.searchForm.pintuanId = this.$route.query.id;
@@ -233,14 +232,12 @@ export default {
});
},
getPintuanMsg() {
// 获取拼团详情
getPintuanMsg() { // 获取拼团详情
getPintuanDetail(this.$route.query.id).then((res) => {
if (res.success) this.data.push(res.result);
});
},
delGoods(index) {
// 删除商品
delGoods(index) { // 删除商品
this.goodsData.splice(index, 1);
},
delAll() { // 批量删除商品
@@ -263,13 +260,9 @@ export default {
});
},
selectedGoodsData(item) { // 选择商品
let ids = [];
console.log(item);
let list = [];
this.goodsData.forEach((e) => {
ids.push(e.skuId);
});
item.forEach((e) => {
if (!ids.includes(e.id)) {
list.push({
goodsName: e.goodsName,
price: e.price,
@@ -281,15 +274,19 @@ export default {
skuId: e.id,
categoryPath: e.categoryPath,
});
}
});
this.goodsData.push(...list);
this.goodsData = list;
},
openSkuList() { // 显示商品选择器
this.$refs.skuSelect.open("goods");
let data = JSON.parse(JSON.stringify(this.goodsData))
data.forEach(e => {
e.id = e.skuId
})
this.$refs.skuSelect.goodsData = data;
},
},
mounted() {
mounted () {
this.init();
},
};

View File

@@ -134,6 +134,7 @@ export default {
{
title: "状态",
key: "promotionStatus",
width: 100,
render: (h, params) => {
let text = "未知",
color = "default";

View File

@@ -318,19 +318,19 @@ export default {
},
delGoods(index, id) {
// 删除商品
if (id) {
removeSeckillGoods(this.$route.query.id, id).then((res) => {
if (res.success) {
this.goodsList[this.tabIndex].list.splice(index, 1);
this.$Message.success("删除成功!");
}
});
} else {
// if (id) {
// removeSeckillGoods(this.$route.query.id, id).then((res) => {
// if (res.success) {
// this.goodsList[this.tabIndex].list.splice(index, 1);
// this.$Message.success("删除成功!");
// }
// });
// } else {
this.goodsList[this.tabIndex].list.splice(index, 1);
this.$Message.success("删除成功!");
}
// }
},
delAll() {
delAll() { // 删除当前时段全部数据
if (this.selectCount <= 0) {
this.$Message.warning("您还未选择要删除的数据");
return;
@@ -350,43 +350,46 @@ export default {
].list.filter((item) => {
return !ids.includes(item.id);
});
removeSeckillGoods(this.$route.query.id, ids).then((res) => {
if (res.success) {
this.$Message.success("删除成功!");
}
});
// removeSeckillGoods(this.$route.query.id, ids).then((res) => {
// if (res.success) {
// this.$Message.success("删除成功!");
// }
// });
},
});
},
selectedGoodsData(item) {
// 选择器添加商品
let ids = [];
let list = [];
this.goodsList[this.tabIndex].list.forEach((e) => {
ids.push(e.skuId);
});
console.log(item);
item.forEach((e) => {
if (!ids.includes(e.id)) {
list.push({
goodsName: e.goodsName,
price: e.price,
originalPrice: e.price,
promotionApplyStatus: "",
quantity: e.quantity,
seckillId: this.$route.query.id,
storeId: e.storeId,
storeName: e.storeName,
skuId: e.id,
timeLine: this.data[0].hours.split(",")[this.tabIndex],
});
}
list.push({
goodsName: e.goodsName,
price: e.price,
originalPrice: e.price,
promotionApplyStatus: e.promotionApplyStatus || '',
quantity: e.quantity,
seckillId: this.$route.query.id,
storeId: e.storeId,
storeName: e.storeName,
skuId: e.id,
timeLine: this.data[0].hours.split(",")[this.tabIndex],
});
});
this.goodsList[this.tabIndex].list.push(...list);
this.goodsList[this.tabIndex].list = list;
this.$nextTick(()=> {
this.$forceUpdate()
})
},
openSkuList() {
openSkuList() { // 显示商品选择器
this.$refs.skuSelect.open("goods");
let data = JSON.parse(JSON.stringify(this.goodsList[this.tabIndex].list))
data.forEach(e => {
e.id = e.skuId
})
this.$refs.skuSelect.goodsData = data;
},
unixDate(time) {
// 处理报名截止时间