Authored by 李奇

vip价格管理data store归集

... ... @@ -13,7 +13,11 @@ const vipDiscount = {
export default function() {
return {
tableCols: [
batchRows: [],
submitting: false,
enableFilter: false,
categoryValue: [],
columns: [
{
type: 'selection',
width: 60,
... ... @@ -154,12 +158,12 @@ export default function() {
}
}
],
tableData: [],
pageData: {
dataList: [],
page: {
total: 0,
current: 1
},
filterFields: {
filters: {
sknCode: {
label: 'SKN编码',
model: '',
... ...
... ... @@ -60,32 +60,18 @@
<script>
import _ from 'lodash';
import ProductService from 'services/product/product-service';
import vipStore from './store';
import ProductService from 'services/product/product-service';
export default {
data() {
return {
columns: [],
dataList: {},
page: {},
filters: {},
batchRows: [],
submitting: false,
enableFilter: false,
categoryValue: []
};
return vipStore.apply(this);
},
created() {
this.productService = new ProductService();
const vip = vipStore.apply(this);
const params = this.filterValues();
this.productService = new ProductService();
this.productList(params);
this.filters = vip.filterFields;
this.columns = vip.tableCols;
this.dataList = vip.tableData;
this.page = vip.pageData;
},
methods: {
filterValues() {
... ... @@ -132,12 +118,18 @@
},
clearFilter() {
let params = {};
const store = vipStore.apply(this);
this.filters = store.filterFields;
this.reset();
this.enableFilter = false;
params = this.filterValues();
this.productList(params);
},
reset() {
_.each(this.filters, item => {
if (_.has(item, 'model')) {
item.model = '';
}
});
this.page.current = 1;
this.categoryValue = [];
},
... ...