|
|
<template>
|
|
|
<div class="onsale-list">
|
|
|
</div>
|
|
|
<LayoutBody>
|
|
|
<LayoutFilter>
|
|
|
<FilterItem :label="filters.sknCode.label">
|
|
|
<Input v-model.trim="filters.sknCode.model"
|
|
|
:placeholder="filters.sknCode.holder"></Input>
|
|
|
</FilterItem>
|
|
|
<FilterItem :label="filters.prodCode.label">
|
|
|
<Input v-model.trim="filters.prodCode.model"
|
|
|
:placeholder="filters.prodCode.holder"></Input>
|
|
|
</FilterItem>
|
|
|
<FilterItem :label="filters.prodBarCode.label">
|
|
|
<Input v-model.trim="filters.prodBarCode.model"
|
|
|
:placeholder="filters.prodBarCode.holder"></Input>
|
|
|
</FilterItem>
|
|
|
<FilterItem :label="filters.priceStatus.label">
|
|
|
<Select v-model.trim="filters.priceStatus.model">
|
|
|
<Option v-for="option in filters.priceStatus.options"
|
|
|
:value="option.value"
|
|
|
:key="option.value">{{option.label}}</Option>
|
|
|
</Select>
|
|
|
</FilterItem>
|
|
|
<FilterItem :label="filters.saleStatus.label">
|
|
|
<Select v-model.trim="filters.saleStatus.model">
|
|
|
<Option v-for="option in filters.saleStatus.options"
|
|
|
:value="option.value"
|
|
|
:key="option.value">{{option.label}}</Option>
|
|
|
</Select>
|
|
|
</FilterItem>
|
|
|
<FilterItem :label="filters.stockStatus.label">
|
|
|
<Select v-model.trim="filters.stockStatus.model">
|
|
|
<Option v-for="option in filters.stockStatus.options"
|
|
|
:value="option.value"
|
|
|
:key="option.value">{{option.label}}</Option>
|
|
|
</Select>
|
|
|
</FilterItem>
|
|
|
<FilterItem label="选择类目">
|
|
|
<SelectCategory :value="categoryValue"
|
|
|
@select-change="sortChange"></SelectCategory>
|
|
|
</FilterItem>
|
|
|
<FilterItem>
|
|
|
<Button type="primary" @click="filterSearch">筛选</Button>
|
|
|
<Button @click="clearFilter">清空条件</Button>
|
|
|
</FilterItem>
|
|
|
</LayoutFilter>
|
|
|
|
|
|
<LayoutAction>
|
|
|
<Button type="primary" @click="batchEnable">启用</Button>
|
|
|
<Button type="error" @click="batchDisable">禁用</Button>
|
|
|
</LayoutAction>
|
|
|
|
|
|
<LayoutList>
|
|
|
<Table border :context="self" :columns="tableCols"
|
|
|
:data="tableData" @on-selection-change="selectChange"></Table>
|
|
|
<Page :total="pageData.total" :current="pageData.current"
|
|
|
@on-change="pageChange" :page-size="20" show-total></Page>
|
|
|
</LayoutList>
|
|
|
</LayoutBody>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import _ from 'lodash';
|
|
|
import service from 'product-service';
|
|
|
import {ModalSizeEdit} from 'components/modal';
|
|
|
import {SelectBrand, SelectCategory} from 'components/select';
|
|
|
import {CellImage, CellInfo, CellPrice} from 'components/cell';
|
|
|
import onSaleStore from './store';
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
self: this,
|
|
|
showSizeEdit: false,
|
|
|
tableCols: [],
|
|
|
tableData: {},
|
|
|
pageData: {},
|
|
|
filters: {},
|
|
|
batchOffSale: [],
|
|
|
useFilterSign: false,
|
|
|
categoryValue: []
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
const store = onSaleStore();
|
|
|
|
|
|
this.productList();
|
|
|
this.filters = store.filterFields;
|
|
|
this.tableCols = store.tableCols;
|
|
|
this.tableData = store.tableData;
|
|
|
this.pageData = store.pageData;
|
|
|
|
|
|
},
|
|
|
methods: {
|
|
|
filterParams() {
|
|
|
const fts = this.filters;
|
|
|
const data = {};
|
|
|
|
|
|
return data;
|
|
|
},
|
|
|
filterSearch() {
|
|
|
const params = this.filterParams();
|
|
|
|
|
|
this.useFilterSign = true;
|
|
|
this.productList(params);
|
|
|
this.pageData.current = 1;
|
|
|
|
|
|
},
|
|
|
clearFilter() {
|
|
|
const store = onSaleStore();
|
|
|
|
|
|
this.filters = store.filterFields;
|
|
|
this.productList();
|
|
|
this.useFilterSign = false;
|
|
|
this.pageData.current = 1;
|
|
|
this.categoryValue = [];
|
|
|
},
|
|
|
enablePrice(){
|
|
|
|
|
|
},
|
|
|
disablePrice(){
|
|
|
|
|
|
},
|
|
|
batchEnable(){
|
|
|
},
|
|
|
batchDisable(){
|
|
|
},
|
|
|
productList(params) {
|
|
|
|
|
|
// if (_.isObject(params) &&
|
|
|
// typeof params.productSkn !== 'undefined' &&
|
|
|
// !_.isFinite(+params.productSkn)) {
|
|
|
// this.$Message.error('SKN编码只能是数字', 3);
|
|
|
// return;
|
|
|
// }
|
|
|
|
|
|
this.$Loading.start();
|
|
|
service.vipProductList({size: 20, page: 1})
|
|
|
.then(res => {
|
|
|
this.$Loading.finish();
|
|
|
if (res.code === 200) {
|
|
|
this.updateStore(res.data);
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
reloadList() {
|
|
|
let params = {};
|
|
|
|
|
|
if (this.useFilterSign) {
|
|
|
params = this.filterParams();
|
|
|
}
|
|
|
|
|
|
_.merge(params, {
|
|
|
page: 1,
|
|
|
size: 20,
|
|
|
productStatusStr: 1
|
|
|
});
|
|
|
|
|
|
this.productList(params);
|
|
|
this.pageData.current = 1;
|
|
|
},
|
|
|
updateStore(data) {
|
|
|
_.each(data.list, item => {
|
|
|
item.changePrice = false;
|
|
|
item.stock = item.stock || 0;
|
|
|
item._disabled = item.auditStatus === 1;
|
|
|
item.shelveTime = item.shelveTime || '-';
|
|
|
});
|
|
|
|
|
|
this.tableData = data.list;
|
|
|
this.pageData.total = data.total;
|
|
|
},
|
|
|
sortChange(sort) {
|
|
|
this.filters.sort.first.model = sort.max;
|
|
|
this.filters.sort.second.model = sort.mid;
|
|
|
this.filters.sort.third.model = sort.min;
|
|
|
},
|
|
|
brandChange(val) {
|
|
|
_.set(this.filters, 'brand.model', val);
|
|
|
},
|
|
|
pageChange(page) {
|
|
|
this.pageData.current = page;
|
|
|
|
|
|
let params = {};
|
|
|
|
|
|
if (this.useFilterSign) {
|
|
|
params = this.filterParams();
|
|
|
}
|
|
|
|
|
|
_.merge(params, {
|
|
|
page,
|
|
|
size: 20,
|
|
|
productStatusStr: 1
|
|
|
});
|
|
|
|
|
|
this.productList(params);
|
|
|
},
|
|
|
selectChange(selection) {
|
|
|
this.batchOffSale = selection;
|
|
|
}
|
|
|
},
|
|
|
components: {
|
|
|
SelectBrand,
|
|
|
SelectCategory,
|
|
|
CellImage,
|
|
|
CellInfo,
|
|
|
CellPrice
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
|
|
</style> |
...
|
...
|
|