Authored by htoooth

add

... ... @@ -4,6 +4,7 @@ import SelectSeason from './select-season';
import SelectRoom from './select-room';
import SelectExpress from './select-express';
import SelectStockStatus from './select-stock-status';
import SelectSellType from './select-sell-type';
export {
SelectBrand,
... ... @@ -11,5 +12,6 @@ export {
SelectSeason,
SelectRoom,
SelectExpress,
SelectStockStatus
SelectStockStatus,
SelectSellType
};
... ...
<template>
<Select :value="handleValue" @on-change="updateValue" clearable placeholder="请选择">
<Option :value="item.value" v-for="item in list" :key="item.value">{{item.label}}</Option>
<Option :value="item.id" v-for="item in list" :key="item.text">{{item.text}}</Option>
</Select>
</template>
<script>
import {SellTypeService} from 'services/product';
import SellTypeService from 'services/product/sell-type-service';
export default {
name: 'select-sell-type',
props: {
value: {
type: String
},
brandId: {
type: String
}
},
data() {
... ... @@ -21,21 +24,25 @@
list: []
};
},
mounted() {
SellTypeService.getSellType('/platform/getSellType').then((result) => {
if (result.code === 200) {
this.list = result.data;
}
});
created() {
this.sellTypeService = new SellTypeService();
},
methods: {
updateValue(newValue) {
this.$emit('input', newValue);
this.$emit('change', newValue);
}
},
watch: {
value(newValue) {
this.handleValue = newValue;
},
brandId(newValue) {
this.sellTypeService.getSellType({brandId: newValue}).then((result) => {
if (result.code === 200) {
this.list = result.data;
}
});
}
}
... ...
... ... @@ -8,11 +8,16 @@
</div>
</Row>
<Form ref="formData" :model="formData" :label-width="50" :rules="ruleValidate">
<Form ref="formData" :model="formData" :label-width="70" :rules="ruleValidate">
<Form-item label="品牌" prop="brandId">
<select-brand v-model="formData.brandId" @change="selectBrand" style="width: 300px;"></select-brand>
</Form-item>
<Form-item label="销售类型" prop="sellType">
<select-sell-type v-model="formData.sellType" style="width: 300px;" :brandId="formData.brandId" @change="selectSellType">
</select-sell-type>
</Form-item>
<Form-item label="类目" prop="sortId">
<select-category :value="formData.sortId" @input="selectSort" style="width: 300px;">
</select-category>
... ... @@ -25,7 +30,7 @@
<script>
import {SelectBrand, SelectCategory} from 'components/select';
import {SelectBrand, SelectCategory, SelectSellType} from 'components/select';
export default {
props: ['step', 'product'],
... ... @@ -61,11 +66,15 @@ export default {
formData: {
brandId: '',
sortId: [],
sellType: ''
},
ruleValidate: {
brandId: [
{ required: true, message: '品牌不能为空', trigger: 'change', validator: validateEmpty}
],
sellType: [
{ required: true, message: '销售类型不能为空', trigger: 'change', validator: validateEmpty}
],
sortId: [
{ required: true, trigger: 'NONE', validator: validateValue},
],
... ... @@ -99,11 +108,15 @@ export default {
this.product.maxSortName = sorts[0].label;
this.product.middleSortName = sorts[1].label;
this.product.smallSortName = sorts[2].label;
},
selectSellType(sellerType) {
this.product.sellType = sellerType;
}
},
components: {
SelectBrand,
SelectCategory
SelectCategory,
SelectSellType
}
};
... ...
... ... @@ -37,6 +37,10 @@
<select-brand v-model="brandId"></select-brand>
</filter-item>
<filter-item label="销售类型">
<select-sell-type v-model="sellType" :brandId="brandId"></select-sell-type>
</filter-item>
<filter-item label="上传文件">
<Input v-model="xlsxFile" style="width: 300px"></Input>
... ... @@ -69,7 +73,7 @@
</template>
<script>
import {SelectCategory, SelectBrand} from 'components/select';
import {SelectCategory, SelectBrand, SelectSellType} from 'components/select';
import _ from 'lodash';
import LayoutList from '../../../components/global/layout/layout-list';
... ... @@ -96,6 +100,7 @@
},
xlsxFile: '',
brandId: '',
sellType: '',
action: '/importSeller',
sort: {
first: {
... ... @@ -150,13 +155,14 @@
},
upload() {
this.loading = true;
this.$refs.xlsxUpload.upload({brandId: this.brandId})
.then(() => {
this.loading = false;
})
.catch(() => {
this.loading = false;
});
this.$refs.xlsxUpload.upload({
brandId: this.brandId,
sellType: this.sellType
}).then(() => {
this.loading = false;
}).catch(() => {
this.loading = false;
});
},
onSuccess(data) {
if (data.code === 200) {
... ... @@ -183,7 +189,8 @@
components: {
LayoutList,
SelectCategory,
SelectBrand
SelectBrand,
SelectSellType
}
};
</script>
... ...
... ... @@ -5,10 +5,8 @@
import Service from '../service';
class SellTypeService extends Service {
getSellType() {
return this.get('/platform/getSellType', {
cache: true
});
getSellType(params) {
return this.post('/platform/getSellType', params);
}
}
... ...