Merge remote-tracking branch 'origin/release/2.0' into release/2.0
Showing
21 changed files
with
122 additions
and
304 deletions
@@ -20,16 +20,9 @@ | @@ -20,16 +20,9 @@ | ||
20 | }, | 20 | }, |
21 | created() { | 21 | created() { |
22 | this.brandService = new BrandService(); | 22 | this.brandService = new BrandService(); |
23 | - const err_msg = '获取品牌列表失败。'; | ||
24 | 23 | ||
25 | this.brandService.getBrand().then((res) => { | 24 | this.brandService.getBrand().then((res) => { |
26 | - let code = _.get(res, 'data.code'); | ||
27 | - | ||
28 | - if (code === 200) { | ||
29 | - this.optionList = res.data.data; | ||
30 | - return; | ||
31 | - } | ||
32 | - return this.$Message.error(err_msg); | 25 | + this.optionList = res.data; |
33 | }); | 26 | }); |
34 | }, | 27 | }, |
35 | data() { | 28 | data() { |
@@ -128,7 +128,7 @@ import { ImageGoodsMain } from 'components/image'; | @@ -128,7 +128,7 @@ import { ImageGoodsMain } from 'components/image'; | ||
128 | import {ModalExample} from 'components/modal'; | 128 | import {ModalExample} from 'components/modal'; |
129 | import {ExamplePop} from 'components/pop'; | 129 | import {ExamplePop} from 'components/pop'; |
130 | 130 | ||
131 | -import {ProductCreateService} from 'services/product'; | 131 | +import {ProductCreateService, ProductService} from 'services/product'; |
132 | 132 | ||
133 | export default { | 133 | export default { |
134 | props: { | 134 | props: { |
@@ -178,28 +178,30 @@ export default { | @@ -178,28 +178,30 @@ export default { | ||
178 | }; | 178 | }; |
179 | }, | 179 | }, |
180 | created() { | 180 | created() { |
181 | + this.productService = new ProductService(); | ||
181 | this.productCreateService = new ProductCreateService(); | 182 | this.productCreateService = new ProductCreateService(); |
182 | this.from = this.$route.query.from || this.from; | 183 | this.from = this.$route.query.from || this.from; |
183 | 184 | ||
184 | - this.productCreateService.getProduct(this.$route.params.id).then((result) => { | ||
185 | - _.update(result, 'goodsSeason', (s) => `${s}`); | ||
186 | - if (!_.has(result, 'materialList')) { | ||
187 | - result.materialList = []; | 185 | + this.productService.getProduct(this.$route.params.id).then((result) => { |
186 | + if (result.code === 200) { | ||
187 | + this.product = result.data; | ||
188 | + _.update(this.product, 'goodsSeason', (s) => `${s}`); | ||
189 | + if (!_.has(this.product, 'materialList')) { | ||
190 | + this.product.materialList = []; | ||
188 | } | 191 | } |
189 | 192 | ||
190 | - if (!_.has(result, 'expectSaleTimeStr')) { | ||
191 | - result.expectSaleTimeStr = ''; | 193 | + if (!_.has(this.product, 'expectSaleTimeStr')) { |
194 | + this.product.expectSaleTimeStr = ''; | ||
192 | } | 195 | } |
193 | 196 | ||
194 | - if (!_.has(result, 'seasons')) { | ||
195 | - result.seasons = ''; | 197 | + if (!_.has(this.product, 'seasons')) { |
198 | + this.product.seasons = ''; | ||
196 | } | 199 | } |
197 | 200 | ||
198 | - if (!_.has(result, 'ageLevel')) { | ||
199 | - result.ageLevel = ''; | 201 | + if (!_.has(this.product, 'ageLevel')) { |
202 | + this.product.ageLevel = ''; | ||
203 | + } | ||
200 | } | 204 | } |
201 | - | ||
202 | - this.product = result; | ||
203 | }).then(() => { | 205 | }).then(() => { |
204 | return this.getAllAttr(this.product.smallSortId, this.product.maxSortId); | 206 | return this.getAllAttr(this.product.smallSortId, this.product.maxSortId); |
205 | }).then(() => { | 207 | }).then(() => { |
@@ -243,7 +243,7 @@ | @@ -243,7 +243,7 @@ | ||
243 | 243 | ||
244 | this.productService.setOnSale(params) | 244 | this.productService.setOnSale(params) |
245 | .then(res => { | 245 | .then(res => { |
246 | - this.$Message.success(res.data.message); | 246 | + this.$Message.success(res.message); |
247 | this.reloadList(); | 247 | this.reloadList(); |
248 | }); | 248 | }); |
249 | }, | 249 | }, |
@@ -287,16 +287,13 @@ | @@ -287,16 +287,13 @@ | ||
287 | 287 | ||
288 | this.productService.updateSalesPrice(params) | 288 | this.productService.updateSalesPrice(params) |
289 | .then(res => { | 289 | .then(res => { |
290 | - const data = res.data; | ||
291 | - const code = data.code; | ||
292 | - | ||
293 | - if (code === 200) { | 290 | + if (res.code === 200) { |
294 | this.tableData[index].salesPrice = salesPrice; | 291 | this.tableData[index].salesPrice = salesPrice; |
295 | row.changePrice = false; | 292 | row.changePrice = false; |
296 | - this.$Message.success(data.message); | 293 | + this.$Message.success(res.message); |
297 | } else { | 294 | } else { |
298 | row.changePrice = false; | 295 | row.changePrice = false; |
299 | - this.$Message.error(data.message); | 296 | + this.$Message.error(res.message); |
300 | } | 297 | } |
301 | }); | 298 | }); |
302 | }, | 299 | }, |
@@ -214,7 +214,7 @@ | @@ -214,7 +214,7 @@ | ||
214 | 214 | ||
215 | this.productService.setOffSale(params) | 215 | this.productService.setOffSale(params) |
216 | .then(res => { | 216 | .then(res => { |
217 | - this.$Message.success(res.data.message); | 217 | + this.$Message.success(res.message); |
218 | this.reloadList(); | 218 | this.reloadList(); |
219 | }); | 219 | }); |
220 | }, | 220 | }, |
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | <layout-filter> | 3 | <layout-filter> |
4 | <filter-item :label="filters.orderNo.label"> | 4 | <filter-item :label="filters.orderNo.label"> |
5 | <Input v-model.trim="filters.orderNo.model" | 5 | <Input v-model.trim="filters.orderNo.model" |
6 | - :placeholder="filters.orderNo.holder"></Input> | 6 | + :placeholder="filters.orderNo.holder" :maxlength="9"></Input> |
7 | </filter-item> | 7 | </filter-item> |
8 | <filter-item :label="filters.orderTime.label"> | 8 | <filter-item :label="filters.orderTime.label"> |
9 | <Date-picker type="daterange" | 9 | <Date-picker type="daterange" |
@@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
18 | </filter-item> | 18 | </filter-item> |
19 | </layout-filter> | 19 | </layout-filter> |
20 | <layout-list> | 20 | <layout-list> |
21 | - <Table border :context="self" :columns="tableCols" :data="tableData"></Table> | 21 | + <Table border :columns="columns" :data="dataList"></Table> |
22 | <Page :total="page.total" :current="page.current" | 22 | <Page :total="page.total" :current="page.current" |
23 | @on-change="pageChange" :page-size="20" show-total></Page> | 23 | @on-change="pageChange" :page-size="20" show-total></Page> |
24 | </layout-list> | 24 | </layout-list> |
@@ -27,28 +27,15 @@ | @@ -27,28 +27,15 @@ | ||
27 | <script> | 27 | <script> |
28 | import _ from 'lodash'; | 28 | import _ from 'lodash'; |
29 | import moment from 'moment'; | 29 | import moment from 'moment'; |
30 | - import {TradeService} from 'services/trade'; | ||
31 | import allotStore from './store'; | 30 | import allotStore from './store'; |
31 | + import {TradeService} from 'services/trade'; | ||
32 | 32 | ||
33 | export default { | 33 | export default { |
34 | data() { | 34 | data() { |
35 | - return { | ||
36 | - self: this, | ||
37 | - tableCols: [], | ||
38 | - tableData: {}, | ||
39 | - page: {}, | ||
40 | - filters: {}, | ||
41 | - enableFilter: false | ||
42 | - }; | 35 | + return allotStore.apply(this); |
43 | }, | 36 | }, |
44 | created() { | 37 | created() { |
45 | this.tradeService = new TradeService(); | 38 | this.tradeService = new TradeService(); |
46 | - const allot = allotStore.apply(this); | ||
47 | - | ||
48 | - this.page = allot.page; | ||
49 | - this.tableData = allot.list; | ||
50 | - this.filters = allot.fields; | ||
51 | - this.tableCols = allot.columns; | ||
52 | this.allotList(this.filterValues()); | 39 | this.allotList(this.filterValues()); |
53 | }, | 40 | }, |
54 | methods: { | 41 | methods: { |
@@ -94,11 +81,12 @@ | @@ -94,11 +81,12 @@ | ||
94 | this.allotList(this.filterValues()); | 81 | this.allotList(this.filterValues()); |
95 | }, | 82 | }, |
96 | clearFilter() { | 83 | clearFilter() { |
97 | - const allot = allotStore.apply(this); | ||
98 | - | ||
99 | this.page.current = 1; | 84 | this.page.current = 1; |
100 | this.enableFilter = false; | 85 | this.enableFilter = false; |
101 | - this.filters = allot.fields; | 86 | + this.filters.orderNo.model = ''; |
87 | + this.filters.orderTime.model = ''; | ||
88 | + this.filters.startTime.model = ''; | ||
89 | + this.filters.endTime.model = ''; | ||
102 | this.allotList(this.filterValues()); | 90 | this.allotList(this.filterValues()); |
103 | }, | 91 | }, |
104 | allotList(params) { | 92 | allotList(params) { |
@@ -125,7 +113,7 @@ | @@ -125,7 +113,7 @@ | ||
125 | this.page.current = 1; | 113 | this.page.current = 1; |
126 | }, | 114 | }, |
127 | resolveData(data) { | 115 | resolveData(data) { |
128 | - this.tableData = data.records; | 116 | + this.dataList = data.records; |
129 | this.page.total = data.totalCount; | 117 | this.page.total = data.totalCount; |
130 | }, | 118 | }, |
131 | pageChange(page) { | 119 | pageChange(page) { |
@@ -7,6 +7,7 @@ import timeFormat from 'filters/time-format'; | @@ -7,6 +7,7 @@ import timeFormat from 'filters/time-format'; | ||
7 | 7 | ||
8 | export default function() { | 8 | export default function() { |
9 | return { | 9 | return { |
10 | + enableFilter: false, | ||
10 | columns: [ | 11 | columns: [ |
11 | { | 12 | { |
12 | title: '调拨单号', | 13 | title: '调拨单号', |
@@ -133,12 +134,12 @@ export default function() { | @@ -133,12 +134,12 @@ export default function() { | ||
133 | } | 134 | } |
134 | } | 135 | } |
135 | ], | 136 | ], |
136 | - list: [], | 137 | + dataList: [], |
137 | page: { | 138 | page: { |
138 | total: 0, | 139 | total: 0, |
139 | current: 1 | 140 | current: 1 |
140 | }, | 141 | }, |
141 | - fields: { | 142 | + filters: { |
142 | orderNo: { | 143 | orderNo: { |
143 | label: '调拨单号', | 144 | label: '调拨单号', |
144 | model: '' | 145 | model: '' |
@@ -7,11 +7,6 @@ class FinanceService extends Service { | @@ -7,11 +7,6 @@ class FinanceService extends Service { | ||
7 | productList(params) { | 7 | productList(params) { |
8 | return this.get('/platform', { | 8 | return this.get('/platform', { |
9 | params | 9 | params |
10 | - }).then(res => { | ||
11 | - if (res.status === 200) { | ||
12 | - return res.data; | ||
13 | - } | ||
14 | - return {}; | ||
15 | }); | 10 | }); |
16 | } | 11 | } |
17 | } | 12 | } |
@@ -4,7 +4,7 @@ class ColorService extends Service { | @@ -4,7 +4,7 @@ class ColorService extends Service { | ||
4 | getColor() { | 4 | getColor() { |
5 | return this.get('/platform/querySellerProductColors', { | 5 | return this.get('/platform/querySellerProductColors', { |
6 | cache: true | 6 | cache: true |
7 | - }).then((result) => result.data); | 7 | + }); |
8 | } | 8 | } |
9 | } | 9 | } |
10 | 10 |
@@ -2,44 +2,15 @@ import Service from '../service'; | @@ -2,44 +2,15 @@ import Service from '../service'; | ||
2 | import _ from 'lodash'; | 2 | import _ from 'lodash'; |
3 | 3 | ||
4 | let apiUrl = { | 4 | let apiUrl = { |
5 | - brand: '/platform/getSellerBrandInfo', | ||
6 | - sort: '/platform/getSellerSortInfo', | ||
7 | - color: '/platform/querySellerProductColors', | ||
8 | - size: '/platform/querySortSize', | ||
9 | addProduct: '/platform/addProduct', | 5 | addProduct: '/platform/addProduct', |
10 | params: '/platform/queryProductParamBySortId', | 6 | params: '/platform/queryProductParamBySortId', |
11 | attr: '/platform/selectAttributes', | 7 | attr: '/platform/selectAttributes', |
12 | material: '/platform/querySellerProductMaterial', | 8 | material: '/platform/querySellerProductMaterial', |
13 | updateNetInfo: '/platform/updateSellerProductNetSaleInfo', | 9 | updateNetInfo: '/platform/updateSellerProductNetSaleInfo', |
14 | - updateProduct: '/platform/updateProduct', | ||
15 | - getProduct: '/platform/getProduct' | 10 | + updateProduct: '/platform/updateProduct' |
16 | }; | 11 | }; |
17 | 12 | ||
18 | class ProductCreateService extends Service { | 13 | class ProductCreateService extends Service { |
19 | - | ||
20 | - | ||
21 | - /** | ||
22 | - * 获得品牌所支持的所有颜色 | ||
23 | - */ | ||
24 | - getColor() { | ||
25 | - return this.get(apiUrl.color, { | ||
26 | - cache: true | ||
27 | - }).then((result) => result.data); | ||
28 | - } | ||
29 | - | ||
30 | - /** | ||
31 | - * 获得品类下所支持的尺码 | ||
32 | - * @param smallSortId | ||
33 | - */ | ||
34 | - getSize(smallSortId) { | ||
35 | - return this.get(apiUrl.size, { | ||
36 | - params: { | ||
37 | - sortId: smallSortId | ||
38 | - }, | ||
39 | - cache: true | ||
40 | - }).then(result => result.data); | ||
41 | - } | ||
42 | - | ||
43 | /** | 14 | /** |
44 | * 获得品类支持的商品相关参数 | 15 | * 获得品类支持的商品相关参数 |
45 | * @param sortId | 16 | * @param sortId |
@@ -50,7 +21,7 @@ class ProductCreateService extends Service { | @@ -50,7 +21,7 @@ class ProductCreateService extends Service { | ||
50 | sortId | 21 | sortId |
51 | }, | 22 | }, |
52 | cache: true | 23 | cache: true |
53 | - }).then(result => result.data); | 24 | + }); |
54 | } | 25 | } |
55 | 26 | ||
56 | /** | 27 | /** |
@@ -68,7 +39,7 @@ class ProductCreateService extends Service { | @@ -68,7 +39,7 @@ class ProductCreateService extends Service { | ||
68 | displayPosition | 39 | displayPosition |
69 | }, | 40 | }, |
70 | cache: true | 41 | cache: true |
71 | - }).then(result => result.data); | 42 | + }); |
72 | } | 43 | } |
73 | 44 | ||
74 | /** | 45 | /** |
@@ -86,7 +57,7 @@ class ProductCreateService extends Service { | @@ -86,7 +57,7 @@ class ProductCreateService extends Service { | ||
86 | displayPosition | 57 | displayPosition |
87 | }, | 58 | }, |
88 | cache: true | 59 | cache: true |
89 | - }).then(result => result.data); | 60 | + }); |
90 | } | 61 | } |
91 | 62 | ||
92 | /** | 63 | /** |
@@ -99,7 +70,7 @@ class ProductCreateService extends Service { | @@ -99,7 +70,7 @@ class ProductCreateService extends Service { | ||
99 | maxSortId: maxSortId | 70 | maxSortId: maxSortId |
100 | }, | 71 | }, |
101 | cache: true | 72 | cache: true |
102 | - }).then(result => result.data); | 73 | + }); |
103 | } | 74 | } |
104 | 75 | ||
105 | /** | 76 | /** |
@@ -115,10 +86,10 @@ class ProductCreateService extends Service { | @@ -115,10 +86,10 @@ class ProductCreateService extends Service { | ||
115 | 86 | ||
116 | getAllAttr(smallSortId, maxSortId) { | 87 | getAllAttr(smallSortId, maxSortId) { |
117 | return Promise.all([ | 88 | return Promise.all([ |
118 | - this.getProductParams(smallSortId).then(r => r.data).then(r => r.map(this.addModelAttr)), | ||
119 | - this.getProductAttribute(smallSortId).then(r => r.data).then(r => r.map(this.addModelAttr)), | ||
120 | - this.getProductStyle(smallSortId).then(r => r.data).then(r => r.map(this.addModelAttr)), | ||
121 | - this.getMaterial(maxSortId).then(r => r.data).then(r => this.addModelAttr(r)), | 89 | + this.getProductParams(smallSortId).then(r => r.data.map(this.addModelAttr)), |
90 | + this.getProductAttribute(smallSortId).then(r => r.data.map(this.addModelAttr)), | ||
91 | + this.getProductStyle(smallSortId).then(r => r.data.map(this.addModelAttr)), | ||
92 | + this.getMaterial(maxSortId).then(r => this.addModelAttr(r.data)), | ||
122 | ]); | 93 | ]); |
123 | } | 94 | } |
124 | 95 | ||
@@ -127,8 +98,7 @@ class ProductCreateService extends Service { | @@ -127,8 +98,7 @@ class ProductCreateService extends Service { | ||
127 | * @param info | 98 | * @param info |
128 | */ | 99 | */ |
129 | updateNetInfo(info) { | 100 | updateNetInfo(info) { |
130 | - return this.post(apiUrl.updateNetInfo, info) | ||
131 | - .then(result => result.data); | 101 | + return this.post(apiUrl.updateNetInfo, info); |
132 | } | 102 | } |
133 | 103 | ||
134 | /** | 104 | /** |
@@ -136,29 +106,16 @@ class ProductCreateService extends Service { | @@ -136,29 +106,16 @@ class ProductCreateService extends Service { | ||
136 | * @param product | 106 | * @param product |
137 | */ | 107 | */ |
138 | saveBaseProductInfo(product) { | 108 | saveBaseProductInfo(product) { |
139 | - return this.post(apiUrl.addProduct, product) | ||
140 | - .then(result => result.data); | 109 | + return this.post(apiUrl.addProduct, product); |
141 | } | 110 | } |
142 | 111 | ||
143 | - /** | ||
144 | - * 查询商品所以有信息,包括网销信息 | ||
145 | - * @param skn | ||
146 | - */ | ||
147 | - getProductAllInfo(skn) { | ||
148 | - return this.get(apiUrl.getProduct, { | ||
149 | - params: { | ||
150 | - productSkn: skn | ||
151 | - } | ||
152 | - }).then(result => result.data); | ||
153 | - } | ||
154 | 112 | ||
155 | /** | 113 | /** |
156 | * 更新商品信息,包括基础信息和网销信息 | 114 | * 更新商品信息,包括基础信息和网销信息 |
157 | * @param product | 115 | * @param product |
158 | */ | 116 | */ |
159 | updateProductAllInfo(product) { | 117 | updateProductAllInfo(product) { |
160 | - return this.post(apiUrl.updateProduct, product) | ||
161 | - .then(result => result.data); | 118 | + return this.post(apiUrl.updateProduct, product); |
162 | } | 119 | } |
163 | 120 | ||
164 | handleRelation(oneValuesObj = []) { | 121 | handleRelation(oneValuesObj = []) { |
@@ -327,12 +284,6 @@ class ProductCreateService extends Service { | @@ -327,12 +284,6 @@ class ProductCreateService extends Service { | ||
327 | return colorsObj; | 284 | return colorsObj; |
328 | } | 285 | } |
329 | 286 | ||
330 | - getProduct(skn) { | ||
331 | - return this.getProductAllInfo(skn).then((result) => { | ||
332 | - return result.data; | ||
333 | - }); | ||
334 | - } | ||
335 | - | ||
336 | addNoneItem(objArray) { | 287 | addNoneItem(objArray) { |
337 | const objArrayClone = _.cloneDeep(objArray); | 288 | const objArrayClone = _.cloneDeep(objArray); |
338 | 289 |
@@ -17,7 +17,8 @@ const apiUrl = { | @@ -17,7 +17,8 @@ const apiUrl = { | ||
17 | queryProdSizeList: '/platform/queryProdSizeList', | 17 | queryProdSizeList: '/platform/queryProdSizeList', |
18 | saveProdSizeInfo: '/platform/saveProdSizeInfo', | 18 | saveProdSizeInfo: '/platform/saveProdSizeInfo', |
19 | exportSellerProductList: '/platform/exportSellerProductList', | 19 | exportSellerProductList: '/platform/exportSellerProductList', |
20 | - getSellerAllSortInfo: '/platform/getSellerAllSortInfo' | 20 | + getSellerAllSortInfo: '/platform/getSellerAllSortInfo', |
21 | + getProduct: '/platform/getProduct' | ||
21 | }; | 22 | }; |
22 | 23 | ||
23 | class ProductService extends Service { | 24 | class ProductService extends Service { |
@@ -25,33 +26,15 @@ class ProductService extends Service { | @@ -25,33 +26,15 @@ class ProductService extends Service { | ||
25 | productList(params) { | 26 | productList(params) { |
26 | return this.get(apiUrl.productList, { | 27 | return this.get(apiUrl.productList, { |
27 | params | 28 | params |
28 | - }) | ||
29 | - .then(res => { | ||
30 | - if (res.status === 200) { | ||
31 | - return res.data; | ||
32 | - } | ||
33 | - return {}; | ||
34 | }); | 29 | }); |
35 | } | 30 | } |
36 | 31 | ||
37 | vipProductList(params) { | 32 | vipProductList(params) { |
38 | - return this.post(apiUrl.vipProductList, params) | ||
39 | - .then(res => { | ||
40 | - if (res.status === 200) { | ||
41 | - return res.data; | ||
42 | - } | ||
43 | - return {}; | ||
44 | - }); | 33 | + return this.post(apiUrl.vipProductList, params); |
45 | } | 34 | } |
46 | 35 | ||
47 | setVipPriceStatus(params) { | 36 | setVipPriceStatus(params) { |
48 | - return this.post(apiUrl.setVipPriceStatus, params) | ||
49 | - .then(res => { | ||
50 | - if (res.status === 200) { | ||
51 | - return res.data; | ||
52 | - } | ||
53 | - return {}; | ||
54 | - }); | 37 | + return this.post(apiUrl.setVipPriceStatus, params); |
55 | } | 38 | } |
56 | 39 | ||
57 | setOffSale(params) { | 40 | setOffSale(params) { |
@@ -68,8 +51,8 @@ class ProductService extends Service { | @@ -68,8 +51,8 @@ class ProductService extends Service { | ||
68 | 51 | ||
69 | queryProdSize(skn) { | 52 | queryProdSize(skn) { |
70 | return this.post(apiUrl.queryProdSizeList, {productSkn: skn}).then(result => { | 53 | return this.post(apiUrl.queryProdSizeList, {productSkn: skn}).then(result => { |
71 | - if (result.status === 200 && _.get(result, 'data.data.list.length', 0)) { | ||
72 | - let sizeInfo = result.data.data.list[0]; | 54 | + if (result.code === 200 && _.get(result, 'data.list.length', 0)) { |
55 | + let sizeInfo = result.data.list[0]; | ||
73 | 56 | ||
74 | _.each(sizeInfo.sizeRelationsList, rela => { | 57 | _.each(sizeInfo.sizeRelationsList, rela => { |
75 | let references = _.split(rela.referenceName, '/'); | 58 | let references = _.split(rela.referenceName, '/'); |
@@ -77,27 +60,29 @@ class ProductService extends Service { | @@ -77,27 +60,29 @@ class ProductService extends Service { | ||
77 | rela.referenceNameA = references[0] || ''; | 60 | rela.referenceNameA = references[0] || ''; |
78 | rela.referenceNameB = references[1] || ''; | 61 | rela.referenceNameB = references[1] || ''; |
79 | }); | 62 | }); |
80 | - return result.data.data.list[0]; | 63 | + return result.data.list[0]; |
81 | } | 64 | } |
82 | return {}; | 65 | return {}; |
83 | }); | 66 | }); |
84 | } | 67 | } |
85 | 68 | ||
86 | saveProdSizeInfo(params) { | 69 | saveProdSizeInfo(params) { |
87 | - return this.post(apiUrl.saveProdSizeInfo, params).then(result => { | ||
88 | - if (result.status === 200) { | ||
89 | - return result.data; | ||
90 | - } | ||
91 | - return {}; | ||
92 | - }); | 70 | + return this.post(apiUrl.saveProdSizeInfo, params); |
93 | } | 71 | } |
94 | 72 | ||
95 | exportProductFile(params) { | 73 | exportProductFile(params) { |
96 | - return this.get(apiUrl.exportSellerProductList, {params}).then(result => { | ||
97 | - if (result.status === 200) { | ||
98 | - return result.data; | 74 | + return this.get(apiUrl.exportSellerProductList, {params}); |
75 | + } | ||
76 | + | ||
77 | + /** | ||
78 | + * 查询商品所以有信息,包括网销信息 | ||
79 | + * @param skn | ||
80 | + */ | ||
81 | + getProduct(skn) { | ||
82 | + return this.get(apiUrl.getProduct, { | ||
83 | + params: { | ||
84 | + productSkn: skn | ||
99 | } | 85 | } |
100 | - return {}; | ||
101 | }); | 86 | }); |
102 | } | 87 | } |
103 | } | 88 | } |
@@ -5,11 +5,6 @@ class SortService extends Service { | @@ -5,11 +5,6 @@ class SortService extends Service { | ||
5 | return this.get('/platform/getSellerAllSortInfo', { | 5 | return this.get('/platform/getSellerAllSortInfo', { |
6 | params, | 6 | params, |
7 | cache: true | 7 | cache: true |
8 | - }).then(res => { | ||
9 | - if (res.status === 200) { | ||
10 | - return res.data; | ||
11 | - } | ||
12 | - return {}; | ||
13 | }); | 8 | }); |
14 | } | 9 | } |
15 | } | 10 | } |
@@ -11,13 +11,11 @@ const apiUrl = { | @@ -11,13 +11,11 @@ const apiUrl = { | ||
11 | 11 | ||
12 | class ExpressService extends Service { | 12 | class ExpressService extends Service { |
13 | list(params) { | 13 | list(params) { |
14 | - return this.post(apiUrl.listExpress, params) | ||
15 | - .then(res => res.data); | 14 | + return this.post(apiUrl.listExpress, params); |
16 | } | 15 | } |
17 | 16 | ||
18 | show(params) { | 17 | show(params) { |
19 | - return this.post(apiUrl.showExpress, params) | ||
20 | - .then(res => res.data); | 18 | + return this.post(apiUrl.showExpress, params); |
21 | } | 19 | } |
22 | 20 | ||
23 | exportList() { | 21 | exportList() { |
@@ -27,92 +27,83 @@ class InvoiceService extends Service { | @@ -27,92 +27,83 @@ class InvoiceService extends Service { | ||
27 | return this.post(apiUrl.listOrder, Object.assign({ | 27 | return this.post(apiUrl.listOrder, Object.assign({ |
28 | authLevel: true, | 28 | authLevel: true, |
29 | allowedSellTypes: [2, 5, 6] | 29 | allowedSellTypes: [2, 5, 6] |
30 | - }, params)).then(res => res.data); | 30 | + }, params)); |
31 | } | 31 | } |
32 | 32 | ||
33 | listProduct(params) { | 33 | listProduct(params) { |
34 | - return this.post(apiUrl.listProduct, params) | ||
35 | - .then(res => res.data); | 34 | + return this.post(apiUrl.listProduct, params); |
36 | } | 35 | } |
37 | 36 | ||
38 | orderInfo(orderId) { | 37 | orderInfo(orderId) { |
39 | return this.post(apiUrl.infoOrder, { | 38 | return this.post(apiUrl.infoOrder, { |
40 | proRequisitionFormId: orderId | 39 | proRequisitionFormId: orderId |
41 | - }).then(res => res.data); | 40 | + }); |
42 | } | 41 | } |
43 | 42 | ||
44 | getStorageList() { | 43 | getStorageList() { |
45 | - return this.post(apiUrl.storageList, {}) | ||
46 | - .then(res => res.data); | 44 | + return this.post(apiUrl.storageList, {}); |
47 | } | 45 | } |
48 | 46 | ||
49 | createOrder(storeroomId, predictArrivalTime, brandId) { | 47 | createOrder(storeroomId, predictArrivalTime, brandId) { |
50 | return this.post(apiUrl.createOrder, { | 48 | return this.post(apiUrl.createOrder, { |
51 | storeroomId, predictArrivalTime, brandId | 49 | storeroomId, predictArrivalTime, brandId |
52 | - }).then(res => res.data); | 50 | + }); |
53 | } | 51 | } |
54 | 52 | ||
55 | updateOrder(params) { | 53 | updateOrder(params) { |
56 | - return this.post(apiUrl.updateOrder, params) | ||
57 | - .then(res => res.data); | 54 | + return this.post(apiUrl.updateOrder, params); |
58 | } | 55 | } |
59 | 56 | ||
60 | deleteOrder(storeId) { | 57 | deleteOrder(storeId) { |
61 | return this.post(apiUrl.deleteOrder, { | 58 | return this.post(apiUrl.deleteOrder, { |
62 | ids: [storeId] | 59 | ids: [storeId] |
63 | - }).then(res => res.data); | 60 | + }); |
64 | } | 61 | } |
65 | 62 | ||
66 | commitOrder(storeId) { | 63 | commitOrder(storeId) { |
67 | return this.post(apiUrl.commitOrder, { | 64 | return this.post(apiUrl.commitOrder, { |
68 | id: storeId | 65 | id: storeId |
69 | - }).then(res => res.data); | 66 | + }); |
70 | } | 67 | } |
71 | 68 | ||
72 | listExpress() { | 69 | listExpress() { |
73 | - return this.get(apiUrl.listExpress, {}) | ||
74 | - .then(res => res.data); | 70 | + return this.get(apiUrl.listExpress, {}); |
75 | } | 71 | } |
76 | 72 | ||
77 | /** | 73 | /** |
78 | * 发货 | 74 | * 发货 |
79 | */ | 75 | */ |
80 | sendOrder(params) { | 76 | sendOrder(params) { |
81 | - return this.post(apiUrl.sendOrder, params) | ||
82 | - .then(res => res.data); | 77 | + return this.post(apiUrl.sendOrder, params); |
83 | } | 78 | } |
84 | 79 | ||
85 | listAvailableProduct(params) { | 80 | listAvailableProduct(params) { |
86 | - return this.post(apiUrl.listAvailableProduct, params) | ||
87 | - .then(res => res.data); | 81 | + return this.post(apiUrl.listAvailableProduct, params); |
88 | } | 82 | } |
89 | 83 | ||
90 | addGoods(params) { | 84 | addGoods(params) { |
91 | - return this.post(apiUrl.addGoods, params) | ||
92 | - .then(res => res.data); | 85 | + return this.post(apiUrl.addGoods, params); |
93 | } | 86 | } |
94 | 87 | ||
95 | updateGoods(params) { | 88 | updateGoods(params) { |
96 | - return this.post(apiUrl.updateGoods, params) | ||
97 | - .then(res => res.data); | 89 | + return this.post(apiUrl.updateGoods, params); |
98 | } | 90 | } |
99 | 91 | ||
100 | deleteGoods(params) { | 92 | deleteGoods(params) { |
101 | - return this.post(apiUrl.deleteGoods, params) | ||
102 | - .then(res => res.data); | 93 | + return this.post(apiUrl.deleteGoods, params); |
103 | } | 94 | } |
104 | 95 | ||
105 | supplementProductList(params) { | 96 | supplementProductList(params) { |
106 | return this.post(apiUrl.supplementProductList, params) | 97 | return this.post(apiUrl.supplementProductList, params) |
107 | .then(res => { | 98 | .then(res => { |
108 | - if (res.data.code === 200) { | ||
109 | - let records = _.get(res, 'data.data.records', []); | 99 | + if (res.code === 200) { |
100 | + let records = _.get(res, 'data.records', []); | ||
110 | 101 | ||
111 | _.each(records, item => { | 102 | _.each(records, item => { |
112 | item.num = 0; | 103 | item.num = 0; |
113 | item._checked = false; | 104 | item._checked = false; |
114 | }); | 105 | }); |
115 | - return res.data.data; | 106 | + return res.data; |
116 | } | 107 | } |
117 | return {}; | 108 | return {}; |
118 | }); | 109 | }); |
@@ -11,13 +11,11 @@ const apiUrl = { | @@ -11,13 +11,11 @@ const apiUrl = { | ||
11 | 11 | ||
12 | class JitService extends Service { | 12 | class JitService extends Service { |
13 | listProduct(params) { | 13 | listProduct(params) { |
14 | - return this.post(apiUrl.listProduct, params) | ||
15 | - .then(res => res.data); | 14 | + return this.post(apiUrl.listProduct, params); |
16 | } | 15 | } |
17 | 16 | ||
18 | getStorageBySkn(productSkn, brandId) { | 17 | getStorageBySkn(productSkn, brandId) { |
19 | - return this.post(apiUrl.getStorageBySkn, { productSkn, brandId }) | ||
20 | - .then(res => res.data); | 18 | + return this.post(apiUrl.getStorageBySkn, { productSkn, brandId }); |
21 | } | 19 | } |
22 | 20 | ||
23 | updateStorage(params) { | 21 | updateStorage(params) { |
@@ -28,8 +26,7 @@ class JitService extends Service { | @@ -28,8 +26,7 @@ class JitService extends Service { | ||
28 | virtualInventoryBos: params | 26 | virtualInventoryBos: params |
29 | }; | 27 | }; |
30 | 28 | ||
31 | - return this.post(apiUrl.importJitStorage, data) | ||
32 | - .then(res => res.data); | 29 | + return this.post(apiUrl.importJitStorage, data); |
33 | } | 30 | } |
34 | } | 31 | } |
35 | export default JitService; | 32 | export default JitService; |
@@ -11,13 +11,11 @@ const apiUrl = { | @@ -11,13 +11,11 @@ const apiUrl = { | ||
11 | 11 | ||
12 | class ReturnService extends Service { | 12 | class ReturnService extends Service { |
13 | list(params) { | 13 | list(params) { |
14 | - return this.post(apiUrl.list, params) | ||
15 | - .then(res => res.data); | 14 | + return this.post(apiUrl.list, params); |
16 | } | 15 | } |
17 | 16 | ||
18 | detail(params) { | 17 | detail(params) { |
19 | - return this.post(apiUrl.detail, params) | ||
20 | - .then(res => res.data); | 18 | + return this.post(apiUrl.detail, params); |
21 | } | 19 | } |
22 | } | 20 | } |
23 | export default ReturnService; | 21 | export default ReturnService; |
@@ -2,10 +2,20 @@ import axios from 'axios'; | @@ -2,10 +2,20 @@ import axios from 'axios'; | ||
2 | 2 | ||
3 | class Service { | 3 | class Service { |
4 | get(url, options) { | 4 | get(url, options) { |
5 | - return axios.get(url, options); | 5 | + return axios.get(url, options).then(res => { |
6 | + if (res.status === 200) { | ||
7 | + return res.data; | ||
8 | + } | ||
9 | + return {}; | ||
10 | + }); | ||
6 | } | 11 | } |
7 | post(url, data) { | 12 | post(url, data) { |
8 | - return axios.post(url, data); | 13 | + return axios.post(url, data).then(res => { |
14 | + if (res.status === 200) { | ||
15 | + return res.data; | ||
16 | + } | ||
17 | + return {}; | ||
18 | + }); | ||
9 | } | 19 | } |
10 | } | 20 | } |
11 | export default Service; | 21 | export default Service; |
@@ -27,7 +27,7 @@ class ShopCategoryService extends Service { | @@ -27,7 +27,7 @@ class ShopCategoryService extends Service { | ||
27 | page, | 27 | page, |
28 | size | 28 | size |
29 | } | 29 | } |
30 | - }).then(res => res.data); | 30 | + }); |
31 | } | 31 | } |
32 | 32 | ||
33 | /** | 33 | /** |
@@ -44,7 +44,7 @@ class ShopCategoryService extends Service { | @@ -44,7 +44,7 @@ class ShopCategoryService extends Service { | ||
44 | data.categoryId = id; | 44 | data.categoryId = id; |
45 | } | 45 | } |
46 | 46 | ||
47 | - return this.post(apiUrl.updateCategory, data).then(res => res.data); | 47 | + return this.post(apiUrl.updateCategory, data); |
48 | } | 48 | } |
49 | 49 | ||
50 | /** | 50 | /** |
@@ -54,7 +54,7 @@ class ShopCategoryService extends Service { | @@ -54,7 +54,7 @@ class ShopCategoryService extends Service { | ||
54 | deleteCategory(id) { | 54 | deleteCategory(id) { |
55 | return this.post(apiUrl.deleteCategory, { | 55 | return this.post(apiUrl.deleteCategory, { |
56 | categoryId: id | 56 | categoryId: id |
57 | - }).then(res => res.data); | 57 | + }); |
58 | } | 58 | } |
59 | 59 | ||
60 | /** | 60 | /** |
@@ -64,8 +64,7 @@ class ShopCategoryService extends Service { | @@ -64,8 +64,7 @@ class ShopCategoryService extends Service { | ||
64 | * @param size | 64 | * @param size |
65 | */ | 65 | */ |
66 | listProduct(params) { | 66 | listProduct(params) { |
67 | - return this.post(apiUrl.listProduct, params) | ||
68 | - .then(res => res.data); | 67 | + return this.post(apiUrl.listProduct, params); |
69 | } | 68 | } |
70 | 69 | ||
71 | /** | 70 | /** |
@@ -75,8 +74,7 @@ class ShopCategoryService extends Service { | @@ -75,8 +74,7 @@ class ShopCategoryService extends Service { | ||
75 | * @param size | 74 | * @param size |
76 | */ | 75 | */ |
77 | listBindProduct(params) { | 76 | listBindProduct(params) { |
78 | - return this.post(apiUrl.listBindProduct, params) | ||
79 | - .then(res => res.data); | 77 | + return this.post(apiUrl.listBindProduct, params); |
80 | } | 78 | } |
81 | 79 | ||
82 | /** | 80 | /** |
@@ -84,8 +82,7 @@ class ShopCategoryService extends Service { | @@ -84,8 +82,7 @@ class ShopCategoryService extends Service { | ||
84 | * @param categoryId | 82 | * @param categoryId |
85 | */ | 83 | */ |
86 | countBindProduct(categoryId) { | 84 | countBindProduct(categoryId) { |
87 | - return this.post(apiUrl.countBindProduct, { categoryId }) | ||
88 | - .then(res => res.data); | 85 | + return this.post(apiUrl.countBindProduct, { categoryId }); |
89 | } | 86 | } |
90 | 87 | ||
91 | 88 | ||
@@ -97,7 +94,7 @@ class ShopCategoryService extends Service { | @@ -97,7 +94,7 @@ class ShopCategoryService extends Service { | ||
97 | createBindProduct(categoryId, productSKN) { | 94 | createBindProduct(categoryId, productSKN) { |
98 | return this.post(apiUrl.createBindProduct, { | 95 | return this.post(apiUrl.createBindProduct, { |
99 | categoryId, productSKN: _.isArray(productSKN) ? productSKN : [productSKN] | 96 | categoryId, productSKN: _.isArray(productSKN) ? productSKN : [productSKN] |
100 | - }).then(res => res.data); | 97 | + }); |
101 | } | 98 | } |
102 | 99 | ||
103 | /** | 100 | /** |
@@ -108,7 +105,7 @@ class ShopCategoryService extends Service { | @@ -108,7 +105,7 @@ class ShopCategoryService extends Service { | ||
108 | deleteBindProduct(categoryId, productSKN) { | 105 | deleteBindProduct(categoryId, productSKN) { |
109 | return this.post(apiUrl.deleteBindProduct, { | 106 | return this.post(apiUrl.deleteBindProduct, { |
110 | categoryId, productSKN: _.isArray(productSKN) ? productSKN : [productSKN] | 107 | categoryId, productSKN: _.isArray(productSKN) ? productSKN : [productSKN] |
111 | - }).then(res => res.data); | 108 | + }); |
112 | } | 109 | } |
113 | } | 110 | } |
114 | export default ShopCategoryService; | 111 | export default ShopCategoryService; |
@@ -4,13 +4,6 @@ class ShopService extends Service { | @@ -4,13 +4,6 @@ class ShopService extends Service { | ||
4 | getShop(params) { | 4 | getShop(params) { |
5 | return this.get('/platform/getShopDetailById', { | 5 | return this.get('/platform/getShopDetailById', { |
6 | params | 6 | params |
7 | - }) | ||
8 | - .then(res => { | ||
9 | - if (res.status === 200) { | ||
10 | - return res.data; | ||
11 | - } | ||
12 | - | ||
13 | - return {}; | ||
14 | }); | 7 | }); |
15 | } | 8 | } |
16 | 9 | ||
@@ -20,13 +13,12 @@ class ShopService extends Service { | @@ -20,13 +13,12 @@ class ShopService extends Service { | ||
20 | */ | 13 | */ |
21 | saveBaseShopInfo(shop) { | 14 | saveBaseShopInfo(shop) { |
22 | 15 | ||
23 | - return this.post('/platform/updateShopBaseInfoById', shop) | ||
24 | - .then(result => result.data); | 16 | + return this.post('/platform/updateShopBaseInfoById', shop); |
25 | 17 | ||
26 | } | 18 | } |
27 | 19 | ||
28 | findShopsDecorator() { | 20 | findShopsDecorator() { |
29 | - return this.post('/platform/findBusinessShopsDecorator').then(result => result.data); | 21 | + return this.post('/platform/findBusinessShopsDecorator'); |
30 | } | 22 | } |
31 | } | 23 | } |
32 | export default ShopService; | 24 | export default ShopService; |
@@ -19,105 +19,37 @@ const apiUrl = { | @@ -19,105 +19,37 @@ const apiUrl = { | ||
19 | 19 | ||
20 | class TradeService extends Service { | 20 | class TradeService extends Service { |
21 | allotPurchaseList(params) { | 21 | allotPurchaseList(params) { |
22 | - return this.post(apiUrl.allotPurchaseList, params) | ||
23 | - .then(res => { | ||
24 | - if (res.status === 200) { | ||
25 | - return res.data; | ||
26 | - } | ||
27 | - | ||
28 | - return {}; | ||
29 | - }); | 22 | + return this.post(apiUrl.allotPurchaseList, params); |
30 | } | 23 | } |
31 | allotDelivery(params) { | 24 | allotDelivery(params) { |
32 | - return this.post(apiUrl.allotDelivery, params) | ||
33 | - .then(res => { | ||
34 | - if (res.status === 200) { | ||
35 | - return res.data; | ||
36 | - } | ||
37 | - | ||
38 | - return {}; | ||
39 | - }); | 25 | + return this.post(apiUrl.allotDelivery, params); |
40 | } | 26 | } |
41 | allotExpressList(params) { | 27 | allotExpressList(params) { |
42 | - return this.post(apiUrl.allotExpressList, params) | ||
43 | - .then(res => { | ||
44 | - if (res.status === 200) { | ||
45 | - return res.data; | ||
46 | - } | ||
47 | - | ||
48 | - return {}; | ||
49 | - }); | 28 | + return this.post(apiUrl.allotExpressList, params); |
50 | } | 29 | } |
51 | allotExpressDetail(no) { | 30 | allotExpressDetail(no) { |
52 | return this.post(apiUrl.allotExpressDetail, { | 31 | return this.post(apiUrl.allotExpressDetail, { |
53 | expressNumber: no | 32 | expressNumber: no |
54 | - }) | ||
55 | - .then(res => { | ||
56 | - if (res.status === 200) { | ||
57 | - return res.data; | ||
58 | - } | ||
59 | - return {}; | ||
60 | }); | 33 | }); |
61 | } | 34 | } |
62 | allotWarehouseInfo() { | 35 | allotWarehouseInfo() { |
63 | - return this.post(apiUrl.allotWarehouseInfo) | ||
64 | - .then(res => { | ||
65 | - if (res.status === 200) { | ||
66 | - return res.data; | ||
67 | - } | ||
68 | - | ||
69 | - return {}; | ||
70 | - }); | 36 | + return this.post(apiUrl.allotWarehouseInfo); |
71 | } | 37 | } |
72 | allotStockOut(params) { | 38 | allotStockOut(params) { |
73 | - return this.post(apiUrl.allotStockOut, params) | ||
74 | - .then(res => { | ||
75 | - if (res.status === 200) { | ||
76 | - return res.data; | ||
77 | - } | ||
78 | - | ||
79 | - return {}; | ||
80 | - }); | 39 | + return this.post(apiUrl.allotStockOut, params); |
81 | } | 40 | } |
82 | allotExpressNumList(params) { | 41 | allotExpressNumList(params) { |
83 | - return this.post(apiUrl.allotExpressNumList, params) | ||
84 | - .then(res => { | ||
85 | - if (res.status === 200) { | ||
86 | - return res.data; | ||
87 | - } | ||
88 | - | ||
89 | - return {}; | ||
90 | - }); | 42 | + return this.post(apiUrl.allotExpressNumList, params); |
91 | } | 43 | } |
92 | allotExpressCompList() { | 44 | allotExpressCompList() { |
93 | - return this.get(apiUrl.allotExpressCompList) | ||
94 | - .then(res => { | ||
95 | - if (res.status === 200) { | ||
96 | - return res.data; | ||
97 | - } | ||
98 | - | ||
99 | - return {}; | ||
100 | - }); | 45 | + return this.get(apiUrl.allotExpressCompList); |
101 | } | 46 | } |
102 | allotList(params) { | 47 | allotList(params) { |
103 | - return this.post(apiUrl.allotList, params) | ||
104 | - .then(res => { | ||
105 | - if (res.status === 200) { | ||
106 | - return res.data; | ||
107 | - } | ||
108 | - | ||
109 | - return {}; | ||
110 | - }); | 48 | + return this.post(apiUrl.allotList, params); |
111 | } | 49 | } |
112 | allotPrintExpressDetail(no) { | 50 | allotPrintExpressDetail(no) { |
113 | return this.post(apiUrl.allotPrintExpressDetail, { | 51 | return this.post(apiUrl.allotPrintExpressDetail, { |
114 | expressNumber: no | 52 | expressNumber: no |
115 | - }) | ||
116 | - .then(res => { | ||
117 | - if (res.status === 200) { | ||
118 | - return res.data; | ||
119 | - } | ||
120 | - return {}; | ||
121 | }); | 53 | }); |
122 | } | 54 | } |
123 | } | 55 | } |
@@ -3,15 +3,13 @@ import Service from '../service'; | @@ -3,15 +3,13 @@ import Service from '../service'; | ||
3 | 3 | ||
4 | class UserService extends Service { | 4 | class UserService extends Service { |
5 | login(username, password) { | 5 | login(username, password) { |
6 | - return this.post('/login', {username, password}).then(res => { | ||
7 | - return res.data; | ||
8 | - }); | 6 | + return this.post('/login', {username, password}); |
9 | } | 7 | } |
10 | purviews() { | 8 | purviews() { |
11 | return this.post('/erp/getPurview', { | 9 | return this.post('/erp/getPurview', { |
12 | platform_id: 4 | 10 | platform_id: 4 |
13 | }).then(res => { | 11 | }).then(res => { |
14 | - return {ori: res.data.data, deep: this.deepList(res.data.data)}; | 12 | + return {ori: res.data, deep: this.deepList(res.data)}; |
15 | }); | 13 | }); |
16 | } | 14 | } |
17 | deepList(purviews) { | 15 | deepList(purviews) { |
@@ -35,8 +33,6 @@ class UserService extends Service { | @@ -35,8 +33,6 @@ class UserService extends Service { | ||
35 | switchShop(shopId) { | 33 | switchShop(shopId) { |
36 | return this.post('/switchShop', { | 34 | return this.post('/switchShop', { |
37 | shopId | 35 | shopId |
38 | - }).then(res => { | ||
39 | - return res.data; | ||
40 | }); | 36 | }); |
41 | } | 37 | } |
42 | } | 38 | } |
-
Please register or login to post a comment