管理端,商品回显修改
parent
a36946de1a
commit
7e668cc6d5
|
@ -45,8 +45,6 @@ export default {
|
||||||
type: "multiple", //单选或者多选 single multiple
|
type: "multiple", //单选或者多选 single multiple
|
||||||
|
|
||||||
skuList: [], // 商品sku列表
|
skuList: [], // 商品sku列表
|
||||||
|
|
||||||
selectedWay: [], //选中商品集合
|
|
||||||
total: "", // 商品总数
|
total: "", // 商品总数
|
||||||
goodsParams: { // 商品请求参数
|
goodsParams: { // 商品请求参数
|
||||||
pageNumber: 1,
|
pageNumber: 1,
|
||||||
|
@ -64,7 +62,12 @@ export default {
|
||||||
loading: false, // 加载状态
|
loading: false, // 加载状态
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
props: ["clearFlag"],
|
props: {
|
||||||
|
selectedWay: {
|
||||||
|
type: Array,
|
||||||
|
default: new Array()
|
||||||
|
}
|
||||||
|
},
|
||||||
watch: {
|
watch: {
|
||||||
category(val) {
|
category(val) {
|
||||||
this.goodsParams.categoryPath = val[0];
|
this.goodsParams.categoryPath = val[0];
|
||||||
|
@ -74,6 +77,7 @@ export default {
|
||||||
this.$emit("selected", this.selectedWay);
|
this.$emit("selected", this.selectedWay);
|
||||||
},
|
},
|
||||||
deep: true,
|
deep: true,
|
||||||
|
immediate: true
|
||||||
},
|
},
|
||||||
|
|
||||||
"goodsParams.categoryPath": {
|
"goodsParams.categoryPath": {
|
||||||
|
@ -110,6 +114,11 @@ export default {
|
||||||
res.result.records.forEach((item) => {
|
res.result.records.forEach((item) => {
|
||||||
item.selected = false;
|
item.selected = false;
|
||||||
item.___type = "goods"; //设置为goods让pc wap知道标识
|
item.___type = "goods"; //设置为goods让pc wap知道标识
|
||||||
|
this.selectedWay.forEach(e => {
|
||||||
|
if (e.id === item.id) {
|
||||||
|
item.selected = true
|
||||||
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
/**
|
/**
|
||||||
* 解决数据请求中,滚动栏会一直上下跳动
|
* 解决数据请求中,滚动栏会一直上下跳动
|
||||||
|
@ -117,7 +126,6 @@ export default {
|
||||||
this.total = res.result.total;
|
this.total = res.result.total;
|
||||||
this.goodsData.push(...res.result.records);
|
this.goodsData.push(...res.result.records);
|
||||||
|
|
||||||
// console.log(this.goodsData);
|
|
||||||
} else {
|
} else {
|
||||||
this.empty = true;
|
this.empty = true;
|
||||||
}
|
}
|
||||||
|
@ -193,9 +201,13 @@ export default {
|
||||||
this.selectedWay.push(val);
|
this.selectedWay.push(val);
|
||||||
} else {
|
} else {
|
||||||
val.selected = false;
|
val.selected = false;
|
||||||
this.selectedWay.splice(index, 1);
|
for (let i = 0; i<this.selectedWay.length; i++ ) {
|
||||||
|
if (this.selectedWay[i].id===val.id) {
|
||||||
|
this.selectedWay.splice(i,1)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// console.log(this.selectedWay);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<Modal :styles="{ top: '120px' }" width="1160" @on-cancel="clickClose" @on-ok="clickOK" v-model="flag" :mask-closable="false" scrollable>
|
<Modal :styles="{ top: '120px' }" width="1160" @on-cancel="clickClose" @on-ok="clickOK" v-model="flag" :mask-closable="false" scrollable>
|
||||||
<goodsDialog @selected="
|
<goodsDialog @selected="(val) => {goodsData = val;}"
|
||||||
(val) => {
|
v-if="goodsFlag" ref="goodsDialog" :selectedWay='goodsData'/>
|
||||||
goodsData = val;
|
|
||||||
}
|
|
||||||
" v-if="goodsFlag" ref="goodsDialog" />
|
|
||||||
<linkDialog @selectedLink="
|
<linkDialog @selectedLink="
|
||||||
(val) => {
|
(val) => {
|
||||||
linkData = val;
|
linkData = val;
|
||||||
|
@ -23,7 +20,7 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
goodsFlag: false, // 是否商品选择器
|
goodsFlag: false, // 是否商品选择器
|
||||||
goodsData: "", //选择的商品
|
goodsData: [], //选择的商品
|
||||||
linkData: "", //选择的链接
|
linkData: "", //选择的链接
|
||||||
flag: false, // modal显隐
|
flag: false, // modal显隐
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,9 +7,7 @@
|
||||||
<div class="form-item-view">
|
<div class="form-item-view">
|
||||||
<FormItem astyle="width: 100%">
|
<FormItem astyle="width: 100%">
|
||||||
<div style="display: flex; margin-bottom: 10px">
|
<div style="display: flex; margin-bottom: 10px">
|
||||||
<Button type="primary" @click="$refs.skuSelect.open('goods')"
|
<Button type="primary" @click="openSkuList">选择商品</Button>
|
||||||
>选择商品</Button
|
|
||||||
>
|
|
||||||
<Button
|
<Button
|
||||||
type="error"
|
type="error"
|
||||||
ghost
|
ghost
|
||||||
|
@ -20,22 +18,19 @@
|
||||||
</div>
|
</div>
|
||||||
<Table
|
<Table
|
||||||
border
|
border
|
||||||
|
v-if="showTable"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:data="form.promotionGoodsList"
|
:data="promotionGoodsList"
|
||||||
@on-selection-change="changeSelect"
|
@on-selection-change="changeSelect"
|
||||||
>
|
>
|
||||||
<template slot-scope="{ row }" slot="skuId">
|
<template slot-scope="{ row }" slot="skuId">
|
||||||
<div>{{ row.skuId }}</div>
|
<div>{{ row.skuId }}</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template slot-scope="{ row, index }" slot="settlementPrice">
|
<template slot-scope="{ index }" slot="settlementPrice">
|
||||||
<Input
|
<Input
|
||||||
type="number"
|
type="number"
|
||||||
v-model="row.settlementPrice"
|
v-model="promotionGoodsList[index].settlementPrice"
|
||||||
@input="
|
|
||||||
pointsGoodsList[index].settlementPrice =
|
|
||||||
row.settlementPrice
|
|
||||||
"
|
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -44,7 +39,7 @@
|
||||||
slot="pointsGoodsCategory"
|
slot="pointsGoodsCategory"
|
||||||
>
|
>
|
||||||
<Select
|
<Select
|
||||||
v-model="pointsGoodsList[index].pointsGoodsCategoryId"
|
v-model="promotionGoodsList[index].pointsGoodsCategoryId"
|
||||||
transfer="true"
|
transfer="true"
|
||||||
label-in-value="true"
|
label-in-value="true"
|
||||||
@on-change="
|
@on-change="
|
||||||
|
@ -62,21 +57,17 @@
|
||||||
</Select>
|
</Select>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template slot-scope="{ row, index }" slot="activeStock">
|
<template slot-scope="{ index }" slot="activeStock">
|
||||||
<Input
|
<Input
|
||||||
type="number"
|
type="number"
|
||||||
v-model="row.activeStock"
|
v-model="promotionGoodsList[index].activeStock"
|
||||||
@input="
|
|
||||||
pointsGoodsList[index].activeStock = row.activeStock
|
|
||||||
"
|
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template slot-scope="{ row, index }" slot="points">
|
<template slot-scope="{ index }" slot="points">
|
||||||
<Input
|
<Input
|
||||||
type="number"
|
type="number"
|
||||||
v-model="row.points"
|
v-model="promotionGoodsList[index].points"
|
||||||
@input="pointsGoodsList[index].points = row.points"
|
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</Table>
|
</Table>
|
||||||
|
@ -151,22 +142,10 @@ export default {
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
form: {
|
form: {
|
||||||
/** 店铺承担比例 */
|
promotionGoodsList: [], // 活动商品列表
|
||||||
sellerCommission: 0,
|
|
||||||
/** 发行数量 */
|
|
||||||
publishNum: 1,
|
|
||||||
/** 运费承担者 */
|
|
||||||
scopeType: "ALL",
|
|
||||||
/** 限领数量 */
|
|
||||||
couponLimitNum: 1,
|
|
||||||
/** 活动类型 */
|
|
||||||
couponType: "PRICE",
|
|
||||||
/** 优惠券名称 */
|
|
||||||
couponName: "",
|
|
||||||
getType: "FREE",
|
|
||||||
promotionGoodsList: [],
|
|
||||||
},
|
},
|
||||||
pointsGoodsList: [], // 积分商品列表
|
showTable: true,
|
||||||
|
promotionGoodsList: [], // 活动商品列表
|
||||||
categoryList: [], // 分类列表
|
categoryList: [], // 分类列表
|
||||||
submitLoading: false, // 添加或编辑提交状态
|
submitLoading: false, // 添加或编辑提交状态
|
||||||
selectedGoods: [], // 已选商品列表,便于删除
|
selectedGoods: [], // 已选商品列表,便于删除
|
||||||
|
@ -226,6 +205,12 @@ export default {
|
||||||
title: "商品名称",
|
title: "商品名称",
|
||||||
key: "goodsName",
|
key: "goodsName",
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
|
render: (h, params) => {
|
||||||
|
return h(
|
||||||
|
"div",
|
||||||
|
params.row.goodsSku.goodsName
|
||||||
|
);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "SKU编码",
|
title: "SKU编码",
|
||||||
|
@ -236,6 +221,12 @@ export default {
|
||||||
title: "店铺名称",
|
title: "店铺名称",
|
||||||
key: "storeName",
|
key: "storeName",
|
||||||
minWidth: 60,
|
minWidth: 60,
|
||||||
|
render: (h, params) => {
|
||||||
|
return h(
|
||||||
|
"div",
|
||||||
|
params.row.goodsSku.storeName
|
||||||
|
);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "商品价格",
|
title: "商品价格",
|
||||||
|
@ -244,7 +235,7 @@ export default {
|
||||||
render: (h, params) => {
|
render: (h, params) => {
|
||||||
return h(
|
return h(
|
||||||
"div",
|
"div",
|
||||||
this.$options.filters.unitPrice(params.row.price, "¥")
|
this.$options.filters.unitPrice(params.row.goodsSku.price, "¥")
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -252,6 +243,12 @@ export default {
|
||||||
title: "库存",
|
title: "库存",
|
||||||
key: "quantity",
|
key: "quantity",
|
||||||
minWidth: 20,
|
minWidth: 20,
|
||||||
|
render: (h, params) => {
|
||||||
|
return h(
|
||||||
|
"div",
|
||||||
|
params.row.goodsSku.quantity
|
||||||
|
);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "结算价格",
|
title: "结算价格",
|
||||||
|
@ -313,11 +310,11 @@ export default {
|
||||||
let res = await getPointsGoodsCategoryList();
|
let res = await getPointsGoodsCategoryList();
|
||||||
this.categoryList = res.result.records;
|
this.categoryList = res.result.records;
|
||||||
},
|
},
|
||||||
/** 保存平台优惠券 */
|
/** 保存积分商品 */
|
||||||
handleSubmit() {
|
handleSubmit() {
|
||||||
this.$refs.form.validate((valid) => {
|
this.$refs.form.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
let params = this.pointsGoodsList;
|
let params = this.promotionGoodsList;
|
||||||
const start = this.$options.filters.unixToDate(
|
const start = this.$options.filters.unixToDate(
|
||||||
this.form.startTime / 1000
|
this.form.startTime / 1000
|
||||||
);
|
);
|
||||||
|
@ -355,7 +352,8 @@ export default {
|
||||||
this.$router.go(-1);
|
this.$router.go(-1);
|
||||||
},
|
},
|
||||||
changeCategory(val, index) {
|
changeCategory(val, index) {
|
||||||
this.pointsGoodsList[index].pointsGoodsCategoryName = val.label;
|
this.promotionGoodsList[index].pointsGoodsCategoryName = val.label;
|
||||||
|
console.log(this.promotionGoodsList);
|
||||||
},
|
},
|
||||||
changeSelect(e) {
|
changeSelect(e) {
|
||||||
// 已选商品批量选择
|
// 已选商品批量选择
|
||||||
|
@ -363,7 +361,7 @@ export default {
|
||||||
},
|
},
|
||||||
delSelectGoods() {
|
delSelectGoods() {
|
||||||
// 多选删除商品
|
// 多选删除商品
|
||||||
if (this.pointsGoodsList.length <= 0) {
|
if (this.selectedGoods.length <= 0) {
|
||||||
this.$Message.warning("您还未选择要删除的数据");
|
this.$Message.warning("您还未选择要删除的数据");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -375,55 +373,42 @@ export default {
|
||||||
this.selectedGoods.forEach(function (e) {
|
this.selectedGoods.forEach(function (e) {
|
||||||
ids.push(e.id);
|
ids.push(e.id);
|
||||||
});
|
});
|
||||||
this.form.promotionGoodsList = this.form.promotionGoodsList.filter(
|
this.promotionGoodsList = this.promotionGoodsList.filter(
|
||||||
(item) => {
|
(item) => {
|
||||||
return !ids.includes(item.id);
|
return !ids.includes(item.id);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
this.pointsGoodsList = this.pointsGoodsList.filter((item) => {
|
|
||||||
return !ids.includes(item.id);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
delGoods(index) {
|
delGoods(index) {
|
||||||
// 删除商品
|
// 删除商品
|
||||||
this.form.promotionGoodsList.splice(index, 1);
|
this.promotionGoodsList.splice(index, 1);
|
||||||
this.pointsGoodsList.splice(index, 1);
|
},
|
||||||
|
openSkuList() { // 显示商品选择器
|
||||||
|
this.$refs.skuSelect.open("goods");
|
||||||
|
let data = JSON.parse(JSON.stringify(this.promotionGoodsList))
|
||||||
|
data.forEach(e => {
|
||||||
|
e.id = e.skuId
|
||||||
|
})
|
||||||
|
this.$refs.skuSelect.goodsData = data;
|
||||||
},
|
},
|
||||||
selectedGoodsData(item) {
|
selectedGoodsData(item) {
|
||||||
// 回显已选商品
|
// 回显已选商品
|
||||||
let ids = [];
|
|
||||||
let list = [];
|
let list = [];
|
||||||
this.form.promotionGoodsList.forEach((e) => {
|
|
||||||
ids.push(e.skuId);
|
|
||||||
});
|
|
||||||
item.forEach((e) => {
|
item.forEach((e) => {
|
||||||
if (!ids.includes(e.id)) {
|
const obj = {
|
||||||
list.push({
|
settlementPrice: e.settlementPrice || 0,
|
||||||
goodsName: e.goodsName,
|
pointsGoodsCategoryId: e.pointsGoodsCategoryId || 0,
|
||||||
price: e.price,
|
pointsGoodsCategoryName:e.pointsGoodsCategoryName || "",
|
||||||
originalPrice: e.price,
|
activeStock:e.activeStock || 0,
|
||||||
quantity: e.quantity,
|
points:e.points || 0,
|
||||||
storeId: e.storeId,
|
|
||||||
storeName: e.storeName,
|
|
||||||
skuId: e.id,
|
skuId: e.id,
|
||||||
...e,
|
goodsSku: e.goodsSku || e
|
||||||
});
|
|
||||||
this.pointsGoodsList.push({
|
|
||||||
settlementPrice: 0,
|
|
||||||
pointsGoodsCategoryId: 0,
|
|
||||||
pointsGoodsCategoryName: "",
|
|
||||||
activeStock: 0,
|
|
||||||
points: 0,
|
|
||||||
goodsSku: {
|
|
||||||
...e,
|
|
||||||
},
|
|
||||||
skuId: e.id,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
list.push(obj);
|
||||||
});
|
});
|
||||||
this.form.promotionGoodsList.push(...list);
|
this.promotionGoodsList = list;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -127,7 +127,7 @@
|
||||||
</Row>
|
</Row>
|
||||||
<Row type="flex" justify="end" class="page">
|
<Row type="flex" justify="end" class="page">
|
||||||
<Page
|
<Page
|
||||||
:current="searchForm.pageNumber + 1"
|
:current="searchForm.pageNumber"
|
||||||
:total="total"
|
:total="total"
|
||||||
:page-size="searchForm.pageSize"
|
:page-size="searchForm.pageSize"
|
||||||
@on-change="changePage"
|
@on-change="changePage"
|
||||||
|
@ -157,7 +157,7 @@ export default {
|
||||||
loading: true, // 表单加载状态
|
loading: true, // 表单加载状态
|
||||||
searchForm: {
|
searchForm: {
|
||||||
// 搜索框初始化对象
|
// 搜索框初始化对象
|
||||||
pageNumber: 0, // 当前页数
|
pageNumber: 1, // 当前页数
|
||||||
pageSize: 10, // 页面大小
|
pageSize: 10, // 页面大小
|
||||||
order: "desc", // 默认排序方式
|
order: "desc", // 默认排序方式
|
||||||
},
|
},
|
||||||
|
@ -248,18 +248,17 @@ export default {
|
||||||
this.$router.push({ name: "add-points-goods" });
|
this.$router.push({ name: "add-points-goods" });
|
||||||
},
|
},
|
||||||
changePage(v) {
|
changePage(v) {
|
||||||
this.searchForm.pageNumber = v - 1;
|
this.searchForm.pageNumber = v;
|
||||||
this.getDataList();
|
this.getDataList();
|
||||||
this.clearSelectAll();
|
|
||||||
},
|
},
|
||||||
changePageSize(v) {
|
changePageSize(v) {
|
||||||
this.searchForm.pageSize = v;
|
this.searchForm.pageSize = v;
|
||||||
this.getDataList();
|
this.getDataList();
|
||||||
},
|
},
|
||||||
handleSearch() {
|
handleSearch() {
|
||||||
this.searchForm.pageNumber = 0;
|
this.searchForm.pageNumber = 1;
|
||||||
this.searchForm.pageSize = 10;
|
this.searchForm.pageSize = 10;
|
||||||
if (this.searchForm.pointsS !== "") {
|
if (this.searchForm.pointsS) {
|
||||||
this.searchForm.points =
|
this.searchForm.points =
|
||||||
this.searchForm.pointsS +
|
this.searchForm.pointsS +
|
||||||
"_" +
|
"_" +
|
||||||
|
|
|
@ -330,7 +330,7 @@ export default {
|
||||||
this.$Message.success("删除成功!");
|
this.$Message.success("删除成功!");
|
||||||
// }
|
// }
|
||||||
},
|
},
|
||||||
delAll() {
|
delAll() { // 删除当前时段全部数据
|
||||||
if (this.selectCount <= 0) {
|
if (this.selectCount <= 0) {
|
||||||
this.$Message.warning("您还未选择要删除的数据");
|
this.$Message.warning("您还未选择要删除的数据");
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue