Authored by 李奇

vip价格管理页面修改

... ... @@ -5,9 +5,9 @@
*/
const auditStatus = {
0: '无状态',
1: '下架待审核',
2: '下架驳回',
3: '已上架'
1: '上架待审核',
2: '上架驳回',
3: '已下架'
};
let filterFields = {
... ... @@ -68,14 +68,14 @@ let filterFields = {
label: '选择品牌',
labelSpan: 6,
fieldSpan: 18,
model: ''
model: -1
},
verifyStatus: {
label: '审核状态',
labelSpan: 6,
fieldSpan: 18,
model: '',
model: -1,
options: [
{
value: -1,
... ... @@ -83,11 +83,11 @@ let filterFields = {
},
{
value: 1,
label: '架待审核'
label: '架待审核'
},
{
value: 2,
label: '架驳回'
label: '架驳回'
}
]
},
... ... @@ -111,6 +111,27 @@ let filterFields = {
label: '无库存'
}
]
},
publishStatus: {
label: '商品状态',
labelSpan: 6,
fieldSpan: 18,
model: -1,
options: [
{
value: -1,
label: '全部'
},
{
value: 0,
label: '从未发布'
},
{
value: 1,
label: '我下架的'
}
]
}
};
... ... @@ -127,7 +148,7 @@ let tableCols = [
key: 'image',
align: 'center',
render (row, column, index) {
return `<img src="${row.picImgUrl}">`;
return `<img class="prd-img" src="${row.picImgUrl}">`;
}
},
{
... ... @@ -149,12 +170,7 @@ let tableCols = [
render(row, column, index) {
row.lineIndex = index;
return `<p>吊牌价:${row.retailPrice}</p>
<p v-if="!row.changePrice">销售价:${row.salesPrice}
<i-button type="info" size="small" @click="changePrice(row)"></i-button>
</p>
<p v-else>销售价:<Input v-model="row.salesPrice" size="4"></Input>
<i-button type="warning" size="small" @click="updatePrice(row)"></i-button>
</p>`;
<p v-if="!row.changePrice">销售价:${row.salesPrice}</p>`;
}
},
{
... ... @@ -163,8 +179,8 @@ let tableCols = [
align: 'center',
},
{
title: '上架时间',
key: 'shelveTime',
title: '下架时间',
key: 'offshelveTime',
align: 'center'
},
{
... ... @@ -180,11 +196,7 @@ let tableCols = [
key: 'action',
align: 'center',
render: function(row, column, index) {
return `<div class="">
<i-button type="primary" size="small">尺码维护</i-button>
<i-button type="primary" size="small" @click="editProduct(${row.productSkn})">内容编辑</i-button>
</div>
<i-button type="error" size="small" @click="setOffSale(${row.productSkn})">下架</i-button>`;
return `<div class="action-btn-row"><i-button type="primary" size="small" @click="setOnSale(${row.productSkn})">启用</i-button></div>`;
}
}
];
... ...
... ... @@ -58,7 +58,7 @@
<label class="field-label">{{filters.verifyStatus.label}}:</label>
</Col>
<Col :span="filters.verifyStatus.fieldSpan">
<Select v-model="filters.verifyStatus.model">
<Select v-model="filters.verifyStatus.model" clearable>
<Option v-for="option in filters.verifyStatus.options" :value="option.value" :key="option.value">{{option.label}}</Option>
</Select>
</Col>
... ... @@ -70,12 +70,24 @@
<label class="field-label">{{filters.stockStatus.label}}:</label>
</Col>
<Col :span="filters.stockStatus.fieldSpan">
<Select v-model="filters.stockStatus.model">
<Select v-model="filters.stockStatus.model" clearable>
<Option v-for="option in filters.stockStatus.options" :value="option.value" :key="option.value">{{option.label}}</Option>
</Select>
</Col>
</Row>
</Col>
<Col span="6">
<Row>
<Col :span="filters.publishStatus.labelSpan">
<label class="field-label">{{filters.publishStatus.label}}:</label>
</Col>
<Col :span="filters.publishStatus.fieldSpan">
<Select v-model="filters.publishStatus.model" clearable>
<Option v-for="option in filters.publishStatus.options" :value="option.value" :key="option.value">{{option.label}}</Option>
</Select>
</Col>
</Row>
</Col>
</Row>
<div class="filter-row">
<Category :field-sort="filters.sort" @on-change="sortChange"></Category>
... ... @@ -86,7 +98,8 @@
</Row>
<div class="hr"></div>
<div class="batch-row">
<Button type="error" @click="batchSetOffSale">下架</Button>
<Button type="primary" @click="batchSetOnSale">启用</Button>
<Button type="error" @click="batchSetOnSale">禁用</Button>
</div>
<Table border :columns="tableCols" :data="tableData" @on-selection-change="selectChange"></Table>
<div class="list-page">
... ... @@ -104,7 +117,6 @@
import {filterFields, initialFields, tableCols, tableData, pageData} from './store';
export default {
name: 'vips',
data() {
return {
tableCols,
... ... @@ -121,71 +133,83 @@
this.initialFilters = JSON.stringify(filterFields);
},
methods: {
filterSearch() {
const params = {
productSkn: this.filters.sknCode.model,
factoryCode: this.filters.prodCode.model,
productName: this.filters.prodName.model,
skuFactoryCode: this.filters.prodBarCode.model,
maxSortId: this.filters.sort.first.model,
middleSortId: this.filters.sort.second.model,
smallSortId: this.filters.sort.third.model,
brandId: this.filters.brand.model,
auditStatus: this.filters.verifyStatus.model,
stock: this.filters.stockStatus.model != -1 ? this.filters.stockStatus.model : null
filterParams() {
const fts = this.filters;
const data = {
productSkn: fts.sknCode.model,
factoryCode: fts.prodCode.model,
skuFactoryCode: fts.prodBarCode.model,
maxSortId: fts.sort.first.model,
middleSortId: fts.sort.second.model,
smallSortId: fts.sort.third.model,
isPublished: fts.publishStatus.model,
brandId: fts.brand.model != -1 ? fts.brand.model : null,
auditStatus: fts.verifyStatus.model != -1 ? fts.verifyStatus.model : null,
stock: fts.stockStatus.model != -1 ? this.filters.stockStatus.model : null
};
return data;
},
filterSearch() {
const params = this.filterParams();
this.useFilterSign = true;
this.productList(params);
},
clearFilter() {
this.filters = JSON.parse(this.initialFilters);
this.productList();
this.useFilterSign = false;
this.filters = JSON.parse(this.initialFilters);
},
productList(params) {
service.productList(
_.merge(params || {}, {
shelfStatus: 1,
shelfStatus: 0,
size: 20
}))
.then(res => {
let code = _.get(res, 'data.code');
let code = _.get(res, 'data.code');
if(code === 200) {
this.updateStore(res.data.data);
}
});
if(code === 200) {
this.updateStore(res.data.data);
}
});
},
updateStore(data) {
_.each(data.list, (item) => {
item.changePrice = false;
});
});
this.tableData = data.list;
this.pageData.total = data.total;
this.pageData.current = 1;
},
sortChange(sort) {
this.filters.sort.first.model = sort.first || null;
this.filters.sort.second.model = sort.second || null;
this.filters.sort.third.model = sort.third || null;
this.filters.sort.first.model = sort.first;
this.filters.sort.second.model = sort.second;
this.filters.sort.third.model = sort.third;
},
brandChange(val) {
_.set(this.filters, 'brand.model', val);
},
pageChange(page) {
let params = {
let params = {};
if(this.useFilterSign) {
params = this.filterParams();
}
_.merge(params, {
page,
size: 20,
productStatusStr: 1
};
});
this.productList(params);
},
setOffSale(skns) {
setOnSale(skns) {
const params = {
targetStatus: 0
targetStatus: 1
};
if(_.isArray(skns)) {
... ... @@ -194,15 +218,15 @@
params['productSkns'] = `[${skns}]`
}
service.setOffSale(params)
service.setOnSale(params)
.then(res => {
this.$Message.success(res.data.message);
});
this.$Message.success(res.data.message);
});
},
batchSetOffSale() {
batchSetOnSale() {
if(!this.batchOffSale.length) {
return this.$Message.error('请选择要架的商品');
return this.$Message.error('请选择要架的商品');
}
let skns = [];
... ... @@ -211,7 +235,7 @@
skns.push(item.productSkn);
});
this.setOffSale(skns);
this.setOnSale(skns);
},
changePrice(row) {
row.changePrice = true;
... ... @@ -253,7 +277,7 @@
}
</script>
<style lang="scss" scoped>
<style lang="scss">
.filter-row {
margin-bottom: 20px;
... ... @@ -275,4 +299,12 @@
float: right;
margin-top: 20px;
}
.prd-img {
max-height: 200px;
}
.action-btn-row {
margin-top: 10px;
}
</style>
... ...