Showing
5 changed files
with
49 additions
and
22 deletions
@@ -4,6 +4,7 @@ import SelectSeason from './select-season'; | @@ -4,6 +4,7 @@ import SelectSeason from './select-season'; | ||
4 | import SelectRoom from './select-room'; | 4 | import SelectRoom from './select-room'; |
5 | import SelectExpress from './select-express'; | 5 | import SelectExpress from './select-express'; |
6 | import SelectStockStatus from './select-stock-status'; | 6 | import SelectStockStatus from './select-stock-status'; |
7 | +import SelectSellType from './select-sell-type'; | ||
7 | 8 | ||
8 | export { | 9 | export { |
9 | SelectBrand, | 10 | SelectBrand, |
@@ -11,5 +12,6 @@ export { | @@ -11,5 +12,6 @@ export { | ||
11 | SelectSeason, | 12 | SelectSeason, |
12 | SelectRoom, | 13 | SelectRoom, |
13 | SelectExpress, | 14 | SelectExpress, |
14 | - SelectStockStatus | 15 | + SelectStockStatus, |
16 | + SelectSellType | ||
15 | }; | 17 | }; |
1 | <template> | 1 | <template> |
2 | <Select :value="handleValue" @on-change="updateValue" clearable placeholder="请选择"> | 2 | <Select :value="handleValue" @on-change="updateValue" clearable placeholder="请选择"> |
3 | - <Option :value="item.value" v-for="item in list" :key="item.value">{{item.label}}</Option> | 3 | + <Option :value="item.id" v-for="item in list" :key="item.text">{{item.text}}</Option> |
4 | </Select> | 4 | </Select> |
5 | </template> | 5 | </template> |
6 | 6 | ||
7 | <script> | 7 | <script> |
8 | 8 | ||
9 | - import {SellTypeService} from 'services/product'; | 9 | + import SellTypeService from 'services/product/sell-type-service'; |
10 | 10 | ||
11 | export default { | 11 | export default { |
12 | name: 'select-sell-type', | 12 | name: 'select-sell-type', |
13 | props: { | 13 | props: { |
14 | value: { | 14 | value: { |
15 | type: String | 15 | type: String |
16 | + }, | ||
17 | + brandId: { | ||
18 | + type: String | ||
16 | } | 19 | } |
17 | }, | 20 | }, |
18 | data() { | 21 | data() { |
@@ -21,21 +24,25 @@ | @@ -21,21 +24,25 @@ | ||
21 | list: [] | 24 | list: [] |
22 | }; | 25 | }; |
23 | }, | 26 | }, |
24 | - mounted() { | ||
25 | - SellTypeService.getSellType('/platform/getSellType').then((result) => { | ||
26 | - if (result.code === 200) { | ||
27 | - this.list = result.data; | ||
28 | - } | ||
29 | - }); | 27 | + created() { |
28 | + this.sellTypeService = new SellTypeService(); | ||
30 | }, | 29 | }, |
31 | methods: { | 30 | methods: { |
32 | updateValue(newValue) { | 31 | updateValue(newValue) { |
33 | this.$emit('input', newValue); | 32 | this.$emit('input', newValue); |
33 | + this.$emit('change', newValue); | ||
34 | } | 34 | } |
35 | }, | 35 | }, |
36 | watch: { | 36 | watch: { |
37 | value(newValue) { | 37 | value(newValue) { |
38 | this.handleValue = newValue; | 38 | this.handleValue = newValue; |
39 | + }, | ||
40 | + brandId(newValue) { | ||
41 | + this.sellTypeService.getSellType({brandId: newValue}).then((result) => { | ||
42 | + if (result.code === 200) { | ||
43 | + this.list = result.data; | ||
44 | + } | ||
45 | + }); | ||
39 | } | 46 | } |
40 | } | 47 | } |
41 | 48 |
@@ -8,11 +8,16 @@ | @@ -8,11 +8,16 @@ | ||
8 | </div> | 8 | </div> |
9 | </Row> | 9 | </Row> |
10 | 10 | ||
11 | - <Form ref="formData" :model="formData" :label-width="50" :rules="ruleValidate"> | 11 | + <Form ref="formData" :model="formData" :label-width="70" :rules="ruleValidate"> |
12 | <Form-item label="品牌" prop="brandId"> | 12 | <Form-item label="品牌" prop="brandId"> |
13 | <select-brand v-model="formData.brandId" @change="selectBrand" style="width: 300px;"></select-brand> | 13 | <select-brand v-model="formData.brandId" @change="selectBrand" style="width: 300px;"></select-brand> |
14 | </Form-item> | 14 | </Form-item> |
15 | 15 | ||
16 | + <Form-item label="销售类型" prop="sellType"> | ||
17 | + <select-sell-type v-model="formData.sellType" style="width: 300px;" :brandId="formData.brandId" @change="selectSellType"> | ||
18 | + </select-sell-type> | ||
19 | + </Form-item> | ||
20 | + | ||
16 | <Form-item label="类目" prop="sortId"> | 21 | <Form-item label="类目" prop="sortId"> |
17 | <select-category :value="formData.sortId" @input="selectSort" style="width: 300px;"> | 22 | <select-category :value="formData.sortId" @input="selectSort" style="width: 300px;"> |
18 | </select-category> | 23 | </select-category> |
@@ -25,7 +30,7 @@ | @@ -25,7 +30,7 @@ | ||
25 | 30 | ||
26 | <script> | 31 | <script> |
27 | 32 | ||
28 | -import {SelectBrand, SelectCategory} from 'components/select'; | 33 | +import {SelectBrand, SelectCategory, SelectSellType} from 'components/select'; |
29 | 34 | ||
30 | export default { | 35 | export default { |
31 | props: ['step', 'product'], | 36 | props: ['step', 'product'], |
@@ -61,11 +66,15 @@ export default { | @@ -61,11 +66,15 @@ export default { | ||
61 | formData: { | 66 | formData: { |
62 | brandId: '', | 67 | brandId: '', |
63 | sortId: [], | 68 | sortId: [], |
69 | + sellType: '' | ||
64 | }, | 70 | }, |
65 | ruleValidate: { | 71 | ruleValidate: { |
66 | brandId: [ | 72 | brandId: [ |
67 | { required: true, message: '品牌不能为空', trigger: 'change', validator: validateEmpty} | 73 | { required: true, message: '品牌不能为空', trigger: 'change', validator: validateEmpty} |
68 | ], | 74 | ], |
75 | + sellType: [ | ||
76 | + { required: true, message: '销售类型不能为空', trigger: 'change', validator: validateEmpty} | ||
77 | + ], | ||
69 | sortId: [ | 78 | sortId: [ |
70 | { required: true, trigger: 'NONE', validator: validateValue}, | 79 | { required: true, trigger: 'NONE', validator: validateValue}, |
71 | ], | 80 | ], |
@@ -99,11 +108,15 @@ export default { | @@ -99,11 +108,15 @@ export default { | ||
99 | this.product.maxSortName = sorts[0].label; | 108 | this.product.maxSortName = sorts[0].label; |
100 | this.product.middleSortName = sorts[1].label; | 109 | this.product.middleSortName = sorts[1].label; |
101 | this.product.smallSortName = sorts[2].label; | 110 | this.product.smallSortName = sorts[2].label; |
111 | + }, | ||
112 | + selectSellType(sellerType) { | ||
113 | + this.product.sellType = sellerType; | ||
102 | } | 114 | } |
103 | }, | 115 | }, |
104 | components: { | 116 | components: { |
105 | SelectBrand, | 117 | SelectBrand, |
106 | - SelectCategory | 118 | + SelectCategory, |
119 | + SelectSellType | ||
107 | } | 120 | } |
108 | }; | 121 | }; |
109 | 122 |
@@ -37,6 +37,10 @@ | @@ -37,6 +37,10 @@ | ||
37 | <select-brand v-model="brandId"></select-brand> | 37 | <select-brand v-model="brandId"></select-brand> |
38 | </filter-item> | 38 | </filter-item> |
39 | 39 | ||
40 | + <filter-item label="销售类型"> | ||
41 | + <select-sell-type v-model="sellType" :brandId="brandId"></select-sell-type> | ||
42 | + </filter-item> | ||
43 | + | ||
40 | <filter-item label="上传文件"> | 44 | <filter-item label="上传文件"> |
41 | <Input v-model="xlsxFile" style="width: 300px"></Input> | 45 | <Input v-model="xlsxFile" style="width: 300px"></Input> |
42 | 46 | ||
@@ -69,7 +73,7 @@ | @@ -69,7 +73,7 @@ | ||
69 | </template> | 73 | </template> |
70 | 74 | ||
71 | <script> | 75 | <script> |
72 | - import {SelectCategory, SelectBrand} from 'components/select'; | 76 | + import {SelectCategory, SelectBrand, SelectSellType} from 'components/select'; |
73 | import _ from 'lodash'; | 77 | import _ from 'lodash'; |
74 | import LayoutList from '../../../components/global/layout/layout-list'; | 78 | import LayoutList from '../../../components/global/layout/layout-list'; |
75 | 79 | ||
@@ -96,6 +100,7 @@ | @@ -96,6 +100,7 @@ | ||
96 | }, | 100 | }, |
97 | xlsxFile: '', | 101 | xlsxFile: '', |
98 | brandId: '', | 102 | brandId: '', |
103 | + sellType: '', | ||
99 | action: '/importSeller', | 104 | action: '/importSeller', |
100 | sort: { | 105 | sort: { |
101 | first: { | 106 | first: { |
@@ -150,11 +155,12 @@ | @@ -150,11 +155,12 @@ | ||
150 | }, | 155 | }, |
151 | upload() { | 156 | upload() { |
152 | this.loading = true; | 157 | this.loading = true; |
153 | - this.$refs.xlsxUpload.upload({brandId: this.brandId}) | ||
154 | - .then(() => { | 158 | + this.$refs.xlsxUpload.upload({ |
159 | + brandId: this.brandId, | ||
160 | + sellType: this.sellType | ||
161 | + }).then(() => { | ||
155 | this.loading = false; | 162 | this.loading = false; |
156 | - }) | ||
157 | - .catch(() => { | 163 | + }).catch(() => { |
158 | this.loading = false; | 164 | this.loading = false; |
159 | }); | 165 | }); |
160 | }, | 166 | }, |
@@ -183,7 +189,8 @@ | @@ -183,7 +189,8 @@ | ||
183 | components: { | 189 | components: { |
184 | LayoutList, | 190 | LayoutList, |
185 | SelectCategory, | 191 | SelectCategory, |
186 | - SelectBrand | 192 | + SelectBrand, |
193 | + SelectSellType | ||
187 | } | 194 | } |
188 | }; | 195 | }; |
189 | </script> | 196 | </script> |
@@ -5,10 +5,8 @@ | @@ -5,10 +5,8 @@ | ||
5 | import Service from '../service'; | 5 | import Service from '../service'; |
6 | 6 | ||
7 | class SellTypeService extends Service { | 7 | class SellTypeService extends Service { |
8 | - getSellType() { | ||
9 | - return this.get('/platform/getSellType', { | ||
10 | - cache: true | ||
11 | - }); | 8 | + getSellType(params) { |
9 | + return this.post('/platform/getSellType', params); | ||
12 | } | 10 | } |
13 | } | 11 | } |
14 | 12 |
-
Please register or login to post a comment