Merge branch 'release/1.0' of http://git.yoho.cn/fe/yoho-shop-manage into release/1.0
Showing
15 changed files
with
118 additions
and
462 deletions
@@ -18,6 +18,7 @@ | @@ -18,6 +18,7 @@ | ||
18 | :show-upload-list="false" | 18 | :show-upload-list="false" |
19 | :data="{bucket: 'goodsimg'}" | 19 | :data="{bucket: 'goodsimg'}" |
20 | :on-success="handleSuccess" | 20 | :on-success="handleSuccess" |
21 | + :on-error="handleError" | ||
21 | :default-file-list="defaultList" | 22 | :default-file-list="defaultList" |
22 | :format="['jpg','jpeg','png']" | 23 | :format="['jpg','jpeg','png']" |
23 | :max-size="2048" | 24 | :max-size="2048" |
@@ -69,6 +70,10 @@ export default { | @@ -69,6 +70,10 @@ export default { | ||
69 | 70 | ||
70 | this.$emit('on-success', this.id, file); | 71 | this.$emit('on-success', this.id, file); |
71 | }, | 72 | }, |
73 | + handleError(){ | ||
74 | + this.$Notice.error('上传失败'); | ||
75 | + this.$emit('on-error', this.id, error); | ||
76 | + }, | ||
72 | handleFormatError(file) { | 77 | handleFormatError(file) { |
73 | this.$Notice.warning({ | 78 | this.$Notice.warning({ |
74 | title: '文件格式不正确', | 79 | title: '文件格式不正确', |
1 | - | ||
2 | -import getProduct from './product-service'; | ||
3 | - | ||
4 | -const handleGoods = (goods) => { | ||
5 | - let newGoods = {}; | ||
6 | - | ||
7 | - newGoods.productId = goods.productId; | ||
8 | - newGoods.productSkc = goods.productSkc; | ||
9 | - newGoods.productSkn = goods.productSkn; | ||
10 | - newGoods.factoryGoodsName = goods.factoryGoodsName; | ||
11 | - newGoods.goodsName = goods.goodsName; | ||
12 | - newGoods.isDefault = goods.isDefault; | ||
13 | - | ||
14 | - // 数组的意义: | ||
15 | - // 0商品正面图 | ||
16 | - // 1商品反面图 | ||
17 | - // 2模特图 | ||
18 | - // 3男生频道封面图 | ||
19 | - // 4女生频道封面图 | ||
20 | - newGoods.goodsImage = [{ //0 | ||
21 | - angle: 0, | ||
22 | - genderCover: 0, | ||
23 | - imageUrl: goods.goodsColorImage, | ||
24 | - isDefault: 'Y', | ||
25 | - orderBy: 0, | ||
26 | - productSkn: goods.productSkn, | ||
27 | - productSkc: goods.productSkc, | ||
28 | - status: 1 | ||
29 | - }, { //1 | ||
30 | - angle: 0, | ||
31 | - genderCover: 0, | ||
32 | - imageUrl: '', | ||
33 | - isDefault: 'N', | ||
34 | - orderBy: 0, | ||
35 | - productSkn: goods.productSkn, | ||
36 | - productSkc: goods.productSkc, | ||
37 | - status: 1 | ||
38 | - }, { //2 | ||
39 | - angle: 0, | ||
40 | - genderCover: 0, | ||
41 | - imageUrl: '', | ||
42 | - isDefault: 'Y', | ||
43 | - orderBy: 0, | ||
44 | - productSkn: goods.productSkn, | ||
45 | - productSkc: goods.productSkc, | ||
46 | - status: 1 | ||
47 | - }, { //3 | ||
48 | - angle: 0, | ||
49 | - genderCover: 1, | ||
50 | - imageUrl: '', | ||
51 | - isDefault: 'Y', | ||
52 | - orderBy: 0, | ||
53 | - productSkn: goods.productSkn, | ||
54 | - productSkc: goods.productSkc, | ||
55 | - status: 1 | ||
56 | - }, { //4 | ||
57 | - angle: 0, | ||
58 | - genderCover: 2, | ||
59 | - imageUrl: '', | ||
60 | - isDefault: 'Y', | ||
61 | - orderBy: 0, | ||
62 | - productSkn: goods.productSkn, | ||
63 | - productSkc: goods.productSkc, | ||
64 | - status: 1 | ||
65 | - }]; | ||
66 | - | ||
67 | - return newGoods; | ||
68 | -}; | ||
69 | - | ||
70 | -const handleColorImage = (product) => { | ||
71 | - let colorsObj = {}; | ||
72 | - | ||
73 | - colorsObj.productSkn = product.productSkn; | ||
74 | - | ||
75 | - let findDefaultSkcIndex = product.goods.findIndex(c => c.isDefault === 'Y'); | ||
76 | - | ||
77 | - colorsObj.productSkc = findDefaultSkcIndex !== -1 ? product.goods[findDefaultSkcIndex].productSkc : ''; | ||
78 | - | ||
79 | - colorsObj.goodsImagesBoList = product.goods.reduce((total, cur) => { | ||
80 | - total = total.concat(cur.goodsImage.filter(g => g.imageUrl)); | ||
81 | - return total; | ||
82 | - }, []); | ||
83 | - | ||
84 | - return colorsObj; | ||
85 | -}; | ||
86 | - | ||
87 | -export default { | ||
88 | - handleGoods, | ||
89 | - handleColorImage, | ||
90 | - getProduct | ||
91 | -}; |
@@ -128,7 +128,12 @@ | @@ -128,7 +128,12 @@ | ||
128 | <Row> | 128 | <Row> |
129 | <div class="ivu-form-item ivu-form-item-required"> | 129 | <div class="ivu-form-item ivu-form-item-required"> |
130 | <label class="ivu-form-item-label" style="width: 70px;">尺寸</label> | 130 | <label class="ivu-form-item-label" style="width: 70px;">尺寸</label> |
131 | - <div :class="{'product-table-error': table.showValidateSize}" style="margin-left: 70px;"> | 131 | + <div :class="{ |
132 | + 'ivu-form-item-content': true, | ||
133 | + 'product-table-error': table.showValidateSize | ||
134 | + }" | ||
135 | + style="margin-left: 70px;" | ||
136 | + > | ||
132 | <Checkbox-group v-model='table.selectedSizes'> | 137 | <Checkbox-group v-model='table.selectedSizes'> |
133 | <Checkbox v-for="size in sizes" :key="size" :label="size.id" > | 138 | <Checkbox v-for="size in sizes" :key="size" :label="size.id" > |
134 | <span>{{size.sizeName}}</span> | 139 | <span>{{size.sizeName}}</span> |
@@ -183,8 +188,8 @@ | @@ -183,8 +188,8 @@ | ||
183 | 188 | ||
184 | <script> | 189 | <script> |
185 | 190 | ||
186 | -import api from '../api'; | ||
187 | -import service from '../service'; | 191 | +import api from 'product-create/api'; |
192 | +import service from 'product-create/service'; | ||
188 | const _ = require('lodash'); | 193 | const _ = require('lodash'); |
189 | 194 | ||
190 | import Age from './age'; | 195 | import Age from './age'; |
@@ -212,9 +212,9 @@ | @@ -212,9 +212,9 @@ | ||
212 | 212 | ||
213 | <script> | 213 | <script> |
214 | 214 | ||
215 | -import ProductUpload from '../../../../components/global/common/drag-file-upload'; | ||
216 | -import api from '../api'; | ||
217 | -import service from '../service'; | 215 | +import api from 'product-create/api'; |
216 | +import service from 'product-create/service'; | ||
217 | +import serial from 'product-create/serialize'; | ||
218 | 218 | ||
219 | export default { | 219 | export default { |
220 | props: ['step', 'product'], | 220 | props: ['step', 'product'], |
@@ -287,43 +287,13 @@ export default { | @@ -287,43 +287,13 @@ export default { | ||
287 | return result; | 287 | return result; |
288 | }, | 288 | }, |
289 | handleRelation: function() { | 289 | handleRelation: function() { |
290 | - return this.render.productStandardRelationStr.reduce((total, r) => { | ||
291 | - if (r.model) { | ||
292 | - total.push({ | ||
293 | - standardId: r.attributeId, | ||
294 | - standardVal: r.attributeName, | ||
295 | - parameterMakeId: r.inputType === 'checkbox' ? r.model.join(',') : r.model | ||
296 | - }); | ||
297 | - } | ||
298 | - | ||
299 | - return total; | ||
300 | - }, []); | 290 | + return serial.handleRelation(this.render.productStandardRelationStr) |
301 | }, | 291 | }, |
302 | handleOne: function() { | 292 | handleOne: function() { |
303 | - return this.render.attributeProValuesOne.reduce((total, r) => { | ||
304 | - if (r.model) { | ||
305 | - total.push({ | ||
306 | - attributeId: r.attributeId, | ||
307 | - productSkn: this.product.productSkn, | ||
308 | - attributeValueId: r.inputType === 'checkbox' ? r.model.join(',') : r.model | ||
309 | - }); | ||
310 | - } | ||
311 | - | ||
312 | - return total; | ||
313 | - }, []); | 293 | + return serial.handleOne(this.product.productSkn, this.render.attributeProValuesOne); |
314 | }, | 294 | }, |
315 | handleTwo: function() { | 295 | handleTwo: function() { |
316 | - return this.render.attributeProValuesTwo.reduce((total, r) => { | ||
317 | - if (r.model || r.model.length !== 0) { | ||
318 | - total.push({ | ||
319 | - attributeId: r.attributeId, | ||
320 | - productSkn: this.product.productSkn, | ||
321 | - attributeValueId: r.inputType === 'checkbox' ? r.model.join(',') : r.model | ||
322 | - }); | ||
323 | - } | ||
324 | - | ||
325 | - return total; | ||
326 | - }, []); | 296 | + return serial.handleTwo(this.product.productSkn, this.render.attributeProValuesTwo); |
327 | }, | 297 | }, |
328 | handleMaterial: function() { | 298 | handleMaterial: function() { |
329 | return this.render.productMaterial.model.join(','); | 299 | return this.render.productMaterial.model.join(','); |
app/pages/product/edit/api/index.js
deleted
100644 → 0
1 | - | ||
2 | -let apiUrl = { | ||
3 | - brand: '/platform/getSellerBrandInfo', | ||
4 | - sort: '/platform/getSellerSortInfo', | ||
5 | - color: '/platform/querySellerProductColors', | ||
6 | - size: '/platform/querySortSize', | ||
7 | - addProduct: '/platform/addProduct', | ||
8 | - params: '/platform/queryProductParamBySortId', | ||
9 | - attr: '/platform/selectAttributes', | ||
10 | - material: '/platform/querySellerProductMaterial', | ||
11 | - updateNetInfo: '/platform/updateSellerProductNetSaleInfo', | ||
12 | - updateProduct: '/platform/updateProduct', | ||
13 | - getProduct: '/platform/getProduct' | ||
14 | -}; | ||
15 | - | ||
16 | -const request = require('axios'); | ||
17 | - | ||
18 | -/** | ||
19 | - * 获得店铺关联品牌 | ||
20 | - */ | ||
21 | -function getBrand() { | ||
22 | - return request.get(apiUrl.brand).then((result) => result.data); | ||
23 | -} | ||
24 | - | ||
25 | -/** | ||
26 | - * 根据品牌获得品类信息 | ||
27 | - * @param brandId | ||
28 | - * @param level 可选参数:1, 2, 3 | ||
29 | - * @param sortId 父级sortId | ||
30 | - */ | ||
31 | -function getSort(brandId, level, sortId) { | ||
32 | - let opts = { | ||
33 | - brandId: brandId, | ||
34 | - level: level | ||
35 | - }; | ||
36 | - | ||
37 | - if (sortId) { | ||
38 | - Object.assign(opts, {sortId}); | ||
39 | - } | ||
40 | - | ||
41 | - return request.get(apiUrl.sort, { | ||
42 | - params: opts | ||
43 | - }).then((result) => result.data); | ||
44 | -} | ||
45 | - | ||
46 | -/** | ||
47 | - * 获得品牌所支持的所有颜色 | ||
48 | - */ | ||
49 | -function getColor() { | ||
50 | - return request.get(apiUrl.color).then((result) => result.data); | ||
51 | -} | ||
52 | - | ||
53 | -/** | ||
54 | - * 获得品类下所支持的尺码 | ||
55 | - * @param smallSortId | ||
56 | - */ | ||
57 | -function getSize(smallSortId) { | ||
58 | - return request.get(apiUrl.size, { | ||
59 | - params: { | ||
60 | - sortId: smallSortId | ||
61 | - } | ||
62 | - }).then(result => result.data); | ||
63 | -} | ||
64 | - | ||
65 | -/** | ||
66 | - * 获得品类支持的商品相关参数 | ||
67 | - * @param sortId | ||
68 | - */ | ||
69 | -function getProductParams(sortId) { | ||
70 | - return request.get(apiUrl.params, { | ||
71 | - params: { | ||
72 | - sortId | ||
73 | - } | ||
74 | - }).then(result => result.data); | ||
75 | -} | ||
76 | - | ||
77 | -/** | ||
78 | - * 获得品类的属性 | ||
79 | - * @param sorId | ||
80 | - */ | ||
81 | -function getProductAttribute(sortId) { | ||
82 | - const saleType = 2; | ||
83 | - const displayPosition = 3; | ||
84 | - | ||
85 | - return request.get(apiUrl.attr, { | ||
86 | - params: { | ||
87 | - categoryId: sortId, | ||
88 | - saleType, | ||
89 | - displayPosition | ||
90 | - } | ||
91 | - }).then(result => result.data); | ||
92 | -} | ||
93 | - | ||
94 | -/** | ||
95 | - * 获得商品风格 | ||
96 | - * @param sortId | ||
97 | - */ | ||
98 | -function getProductStyle(sortId) { | ||
99 | - const saleType = 2; | ||
100 | - const displayPosition = 2; | ||
101 | - | ||
102 | - return request.get(apiUrl.attr, { | ||
103 | - params: { | ||
104 | - categoryId: sortId, | ||
105 | - saleType, | ||
106 | - displayPosition | ||
107 | - } | ||
108 | - }).then(result => result.data); | ||
109 | -} | ||
110 | - | ||
111 | -/** | ||
112 | - * 获得品类下的所有材质 | ||
113 | - * @param sortId 第一级sort | ||
114 | - */ | ||
115 | -function getMaterial(maxSortId) { | ||
116 | - return request.get(apiUrl.material, { | ||
117 | - params: { | ||
118 | - maxSortId: maxSortId | ||
119 | - } | ||
120 | - }).then(result => result.data); | ||
121 | -} | ||
122 | - | ||
123 | -/** | ||
124 | - * 获得所有属性 | ||
125 | - * @param smallSortId | ||
126 | - * @param maxSortId | ||
127 | - */ | ||
128 | - | ||
129 | -function addModelAttr(attr) { | ||
130 | - attr.model = attr.inputType === 'checkbox' ? [] : ''; | ||
131 | - return attr; | ||
132 | -} | ||
133 | - | ||
134 | -function getAllAttr(smallSortId, maxSortId) { | ||
135 | - return Promise.all([ | ||
136 | - getProductParams(smallSortId).then(r => r.data).then(r => r.map(addModelAttr)), | ||
137 | - getProductAttribute(smallSortId).then(r => r.data).then(r => r.map(addModelAttr)), | ||
138 | - getProductStyle(smallSortId).then(r => r.data).then(r => r.map(addModelAttr)), | ||
139 | - getMaterial(maxSortId).then(r => r.data).then(r => addModelAttr(r)), | ||
140 | - ]); | ||
141 | -} | ||
142 | - | ||
143 | -/** | ||
144 | - * 更新商品网销信息 | ||
145 | - * @param info | ||
146 | - */ | ||
147 | -function updateNetInfo(info) { | ||
148 | - return request.post(apiUrl.updateNetInfo, info) | ||
149 | - .then(result => result.data); | ||
150 | -} | ||
151 | - | ||
152 | -/** | ||
153 | - * 保存商品基本信息 | ||
154 | - * @param product | ||
155 | - */ | ||
156 | -function saveBaseProductInfo(product) { | ||
157 | - return request.post(apiUrl.addProduct, product) | ||
158 | - .then(result => result.data); | ||
159 | -} | ||
160 | - | ||
161 | -/** | ||
162 | - * 查询商品所以有信息,包括网销信息 | ||
163 | - * @param skn | ||
164 | - */ | ||
165 | -function getProductAllInfo(skn) { | ||
166 | - return request.get(apiUrl.getProduct, { | ||
167 | - params: { | ||
168 | - productSkn: skn | ||
169 | - } | ||
170 | - }).then(result => result.data); | ||
171 | -} | ||
172 | - | ||
173 | -/** | ||
174 | - * 更新商品信息,包括基础信息和网销信息 | ||
175 | - * @param product | ||
176 | - */ | ||
177 | -function updateProductAllInfo(product) { | ||
178 | - return request.post(apiUrl.updateProduct, product) | ||
179 | - .then(result => result.data); | ||
180 | -} | ||
181 | - | ||
182 | -export default { | ||
183 | - getBrand, | ||
184 | - getSort, | ||
185 | - getColor, | ||
186 | - getSize, | ||
187 | - getProductParams, | ||
188 | - getProductAttribute, | ||
189 | - getMaterial, | ||
190 | - getProductStyle, | ||
191 | - getAllAttr, | ||
192 | - updateNetInfo, | ||
193 | - saveBaseProductInfo, | ||
194 | - getProductAllInfo, | ||
195 | - updateProductAllInfo | ||
196 | -}; |
@@ -341,8 +341,9 @@ import Season from './views/season'; | @@ -341,8 +341,9 @@ import Season from './views/season'; | ||
341 | import Gender from './views/gender'; | 341 | import Gender from './views/gender'; |
342 | import GoodsSeason from './views/goods-season'; | 342 | import GoodsSeason from './views/goods-season'; |
343 | 343 | ||
344 | -import service from './service'; | ||
345 | -import api from './api'; | 344 | +import service from 'product-create/service'; |
345 | +import api from 'product-create/api'; | ||
346 | +import serial from 'product-create/serialize'; | ||
346 | 347 | ||
347 | const _ = require('lodash'); | 348 | const _ = require('lodash'); |
348 | const Fn = require('lodash/fp'); | 349 | const Fn = require('lodash/fp'); |
@@ -718,7 +719,7 @@ export default { | @@ -718,7 +719,7 @@ export default { | ||
718 | newGoods.colorId = goods.colorId; | 719 | newGoods.colorId = goods.colorId; |
719 | newGoods.factoryGoodsName = goods.factoryGoodsName; | 720 | newGoods.factoryGoodsName = goods.factoryGoodsName; |
720 | newGoods.goodsColorImage = { | 721 | newGoods.goodsColorImage = { |
721 | - value: service.getAbsoluteUrl(goodsImage.goodsColorImage), | 722 | + value: goodsImage.goodsColorImage, |
722 | showValidate: false, | 723 | showValidate: false, |
723 | validate: false | 724 | validate: false |
724 | }; | 725 | }; |
@@ -1051,59 +1052,29 @@ export default { | @@ -1051,59 +1052,29 @@ export default { | ||
1051 | return newColor; | 1052 | return newColor; |
1052 | }, | 1053 | }, |
1053 | handleSize: function(color) { | 1054 | handleSize: function(color) { |
1054 | - return color.sizeId.map((s, i) => { | ||
1055 | - let sizeId = s.id; | ||
1056 | - let productSku = s.productSku; | ||
1057 | - let factoryCode = color.sizeCode[i].name; | 1055 | + return color.sizeId.reduce((total, cur, i) => { |
1056 | + if (color.sizeCode[i].name) { | ||
1057 | + let sizeId = cur.id; | ||
1058 | + let productSku = cur.productSku; | ||
1059 | + let factoryCode = color.sizeCode[i].name; | ||
1058 | 1060 | ||
1059 | - return {sizeId, factoryCode, productSku}; | ||
1060 | - }); | 1061 | + total.push({sizeId, factoryCode, productSku}); |
1062 | + } | ||
1063 | + | ||
1064 | + return total; | ||
1065 | + }, []); | ||
1061 | }, | 1066 | }, |
1062 | handleImage: function() { | 1067 | handleImage: function() { |
1063 | return service.handleEditColorImage(this.product); | 1068 | return service.handleEditColorImage(this.product); |
1064 | }, | 1069 | }, |
1065 | handleRelation: function() { | 1070 | handleRelation: function() { |
1066 | - return this.render.productStandardRelationStr.reduce((total, r) => { | ||
1067 | - if (r.model) { | ||
1068 | - total.push({ | ||
1069 | - standardId: r.attributeId, | ||
1070 | - standardVal: r.attributeName, | ||
1071 | - parameterMakeId: r.model.join(',') | ||
1072 | - }); | ||
1073 | - } | ||
1074 | - | ||
1075 | - return total; | ||
1076 | - }, []); | 1071 | + return serial.handleRelation(this.render.productStandardRelationStr); |
1077 | }, | 1072 | }, |
1078 | handleOne: function() { | 1073 | handleOne: function() { |
1079 | - return this.render.attributeProValuesOne.reduce((total, r) => { | ||
1080 | - let str = _.isArray(r.model) ? r.model.join(',') : r.model; | ||
1081 | - | ||
1082 | - if (str) { | ||
1083 | - total.push({ | ||
1084 | - attributeId: r.attributeId, | ||
1085 | - productSkn: this.product.productSkn, | ||
1086 | - attributeValueId: str | ||
1087 | - }); | ||
1088 | - } | ||
1089 | - | ||
1090 | - return total; | ||
1091 | - }, []); | 1074 | + return serial.handleOne(this.product.productSkn, this.render.attributeProValuesOne); |
1092 | }, | 1075 | }, |
1093 | handleTwo: function() { | 1076 | handleTwo: function() { |
1094 | - return this.render.attributeProValuesTwo.reduce((total, r) => { | ||
1095 | - let str = _.isArray(r.model) ? r.model.join(',') : r.model; | ||
1096 | - | ||
1097 | - if (str) { | ||
1098 | - total.push({ | ||
1099 | - attributeId: r.attributeId, | ||
1100 | - productSkn: this.product.productSkn, | ||
1101 | - attributeValueId: str | ||
1102 | - }); | ||
1103 | - } | ||
1104 | - | ||
1105 | - return total; | ||
1106 | - }, []); | 1077 | + return serial.handleTwo(this.product.productSkn, this.render.attributeProValuesTwo); |
1107 | }, | 1078 | }, |
1108 | }, | 1079 | }, |
1109 | components: { | 1080 | components: { |
@@ -214,9 +214,7 @@ let tableCols = [ | @@ -214,9 +214,7 @@ let tableCols = [ | ||
214 | render: function(row, column, index) { | 214 | render: function(row, column, index) { |
215 | return `<div class="action-btn-row"> | 215 | return `<div class="action-btn-row"> |
216 | <i-button type="primary" size="small" @click="editSize(row.productSkn)">尺码维护</i-button> | 216 | <i-button type="primary" size="small" @click="editSize(row.productSkn)">尺码维护</i-button> |
217 | - <i-button v-if="row._disabled" type="primary" size="small" | ||
218 | - @click="editProduct(${row.productSkn})" disabled>内容编辑</i-button> | ||
219 | - <i-button v-else type="primary" size="small" @click="editProduct(${row.productSkn})">内容编辑</i-button> | 217 | + <i-button type="primary" size="small" @click="editProduct(${row.productSkn})">内容编辑</i-button> |
220 | </div> | 218 | </div> |
221 | <div class="btn-row-space"> | 219 | <div class="btn-row-space"> |
222 | <i-button v-if="row._disabled" type="success" size="small" | 220 | <i-button v-if="row._disabled" type="success" size="small" |
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | <LayoutBody> | 2 | <LayoutBody> |
3 | <LayoutFilter> | 3 | <LayoutFilter> |
4 | <FilterItem :label="filters.sknCode.label"> | 4 | <FilterItem :label="filters.sknCode.label"> |
5 | - <Input v-model.trim.trim="filters.sknCode.model" | 5 | + <Input v-model.trim="filters.sknCode.model" |
6 | :placeholder="filters.sknCode.holder"></Input> | 6 | :placeholder="filters.sknCode.holder"></Input> |
7 | </FilterItem> | 7 | </FilterItem> |
8 | <FilterItem :label="filters.prodCode.label"> | 8 | <FilterItem :label="filters.prodCode.label"> |
@@ -131,7 +131,7 @@ let tableCols = [ | @@ -131,7 +131,7 @@ let tableCols = [ | ||
131 | title: '商品信息', | 131 | title: '商品信息', |
132 | key: 'info', | 132 | key: 'info', |
133 | align: 'center', | 133 | align: 'center', |
134 | - render(row, column, index) { | 134 | + render(row) { |
135 | return `<cell-info | 135 | return `<cell-info |
136 | :skn="row.productSkn" | 136 | :skn="row.productSkn" |
137 | :product-name="row.productName" | 137 | :product-name="row.productName" |
@@ -175,7 +175,7 @@ let tableCols = [ | @@ -175,7 +175,7 @@ let tableCols = [ | ||
175 | title: '审核状态', | 175 | title: '审核状态', |
176 | key: 'verify', | 176 | key: 'verify', |
177 | align: 'center', | 177 | align: 'center', |
178 | - render(row, column, index) { | 178 | + render(row) { |
179 | return `${auditStatus[row.auditStatus]}` | 179 | return `${auditStatus[row.auditStatus]}` |
180 | } | 180 | } |
181 | }, | 181 | }, |
@@ -184,12 +184,10 @@ let tableCols = [ | @@ -184,12 +184,10 @@ let tableCols = [ | ||
184 | key: 'action', | 184 | key: 'action', |
185 | width: 180, | 185 | width: 180, |
186 | align: 'center', | 186 | align: 'center', |
187 | - render: function(row, column, index) { | 187 | + render: function(row) { |
188 | return `<div class="action-btn-row"> | 188 | return `<div class="action-btn-row"> |
189 | <i-button type="primary" size="small" @click="editSize(row.productSkn)">尺码维护</i-button> | 189 | <i-button type="primary" size="small" @click="editSize(row.productSkn)">尺码维护</i-button> |
190 | - <i-button v-if="row._disabled" type="primary" size="small" | ||
191 | - @click="editProduct(${row.productSkn})" disabled>内容编辑</i-button> | ||
192 | - <i-button v-else type="primary" size="small" @click="editProduct(${row.productSkn})">内容编辑</i-button> | 190 | + <i-button type="primary" size="small" @click="editProduct(${row.productSkn})">内容编辑</i-button> |
193 | </div> | 191 | </div> |
194 | <div class="btn-row-space"> | 192 | <div class="btn-row-space"> |
195 | <i-button v-if="row._disabled" type="error" size="small" | 193 | <i-button v-if="row._disabled" type="error" size="small" |
1 | +/** | ||
2 | + * Created by TaoHuang on 2017/5/4. | ||
3 | + */ | ||
1 | 4 | ||
2 | let apiUrl = { | 5 | let apiUrl = { |
3 | brand: '/platform/getSellerBrandInfo', | 6 | brand: '/platform/getSellerBrandInfo', |
@@ -155,7 +158,7 @@ function updateNetInfo(info) { | @@ -155,7 +158,7 @@ function updateNetInfo(info) { | ||
155 | */ | 158 | */ |
156 | function saveBaseProductInfo(product) { | 159 | function saveBaseProductInfo(product) { |
157 | return request.post(apiUrl.addProduct, product) | 160 | return request.post(apiUrl.addProduct, product) |
158 | - .then(result => result.data); | 161 | + .then(result => result.data); |
159 | } | 162 | } |
160 | 163 | ||
161 | /** | 164 | /** |
@@ -193,4 +196,4 @@ export default { | @@ -193,4 +196,4 @@ export default { | ||
193 | saveBaseProductInfo, | 196 | saveBaseProductInfo, |
194 | getProductAllInfo, | 197 | getProductAllInfo, |
195 | updateProductAllInfo | 198 | updateProductAllInfo |
196 | -}; | 199 | +}; |
app/services/product-create/serialize.js
0 → 100644
1 | +/** | ||
2 | + * Created by TaoHuang on 2017/5/4. | ||
3 | + */ | ||
4 | + | ||
5 | +const _ = require('lodash'); | ||
6 | + | ||
7 | +const handleRelation = (oneValuesObj = []) => { | ||
8 | + return oneValuesObj.reduce((total, r) => { | ||
9 | + let str = _.isArray(r.model) ? r.model.join(',') : r.model; | ||
10 | + | ||
11 | + if (str) { | ||
12 | + total.push({ | ||
13 | + standardId: r.attributeId, | ||
14 | + standardVal: r.attributeName, | ||
15 | + parameterMakeId: str | ||
16 | + }); | ||
17 | + } | ||
18 | + | ||
19 | + return total; | ||
20 | + }, []); | ||
21 | +}; | ||
22 | + | ||
23 | +const handleValue = (skn, valueObj = []) => { | ||
24 | + return valueObj.reduce((total, r) => { | ||
25 | + let str = _.isArray(r.model) ? r.model.join(',') : r.model; | ||
26 | + | ||
27 | + if (str) { | ||
28 | + total.push({ | ||
29 | + attributeId: r.attributeId, | ||
30 | + productSkn: skn, | ||
31 | + attributeValueId: str | ||
32 | + }); | ||
33 | + } | ||
34 | + | ||
35 | + return total; | ||
36 | + }, []); | ||
37 | +}; | ||
38 | + | ||
39 | +export default { | ||
40 | + handleOne: handleValue, | ||
41 | + handleTwo: handleValue, | ||
42 | + handleRelation | ||
43 | +} |
1 | +/** | ||
2 | + * Created by TaoHuang on 2017/5/4. | ||
3 | + */ | ||
1 | 4 | ||
2 | -import getProduct from './product-service'; | ||
3 | - | 5 | +import api from './api'; |
4 | const _ = require('lodash'); | 6 | const _ = require('lodash'); |
5 | 7 | ||
8 | + | ||
6 | const handleGoods = (goods) => { | 9 | const handleGoods = (goods) => { |
7 | let newGoods = {}; | 10 | let newGoods = {}; |
8 | 11 | ||
12 | + newGoods.productId = goods.productId; | ||
9 | newGoods.productSkc = goods.productSkc; | 13 | newGoods.productSkc = goods.productSkc; |
10 | newGoods.productSkn = goods.productSkn; | 14 | newGoods.productSkn = goods.productSkn; |
11 | newGoods.factoryGoodsName = goods.factoryGoodsName; | 15 | newGoods.factoryGoodsName = goods.factoryGoodsName; |
@@ -40,7 +44,7 @@ const handleGoods = (goods) => { | @@ -40,7 +44,7 @@ const handleGoods = (goods) => { | ||
40 | angle: 0, | 44 | angle: 0, |
41 | genderCover: 0, | 45 | genderCover: 0, |
42 | imageUrl: '', | 46 | imageUrl: '', |
43 | - isDefault: 'N', | 47 | + isDefault: 'Y', |
44 | orderBy: 0, | 48 | orderBy: 0, |
45 | productSkn: goods.productSkn, | 49 | productSkn: goods.productSkn, |
46 | productSkc: goods.productSkc, | 50 | productSkc: goods.productSkc, |
@@ -49,7 +53,7 @@ const handleGoods = (goods) => { | @@ -49,7 +53,7 @@ const handleGoods = (goods) => { | ||
49 | angle: 0, | 53 | angle: 0, |
50 | genderCover: 1, | 54 | genderCover: 1, |
51 | imageUrl: '', | 55 | imageUrl: '', |
52 | - isDefault: 'N', | 56 | + isDefault: 'Y', |
53 | orderBy: 0, | 57 | orderBy: 0, |
54 | productSkn: goods.productSkn, | 58 | productSkn: goods.productSkn, |
55 | productSkc: goods.productSkc, | 59 | productSkc: goods.productSkc, |
@@ -58,7 +62,7 @@ const handleGoods = (goods) => { | @@ -58,7 +62,7 @@ const handleGoods = (goods) => { | ||
58 | angle: 0, | 62 | angle: 0, |
59 | genderCover: 2, | 63 | genderCover: 2, |
60 | imageUrl: '', | 64 | imageUrl: '', |
61 | - isDefault: 'N', | 65 | + isDefault: 'Y', |
62 | orderBy: 0, | 66 | orderBy: 0, |
63 | productSkn: goods.productSkn, | 67 | productSkn: goods.productSkn, |
64 | productSkc: goods.productSkc, | 68 | productSkc: goods.productSkc, |
@@ -68,6 +72,17 @@ const handleGoods = (goods) => { | @@ -68,6 +72,17 @@ const handleGoods = (goods) => { | ||
68 | return newGoods; | 72 | return newGoods; |
69 | }; | 73 | }; |
70 | 74 | ||
75 | +const handleColorImage = (product) => { | ||
76 | + let colorsObj = {}; | ||
77 | + | ||
78 | + colorsObj.goodsImagesBoList = product.goods.reduce((total, cur) => { | ||
79 | + total = total.concat(cur.goodsImage.filter(g => g.imageUrl)); | ||
80 | + return total; | ||
81 | + }, []); | ||
82 | + | ||
83 | + return colorsObj; | ||
84 | +}; | ||
85 | + | ||
71 | const handleGoodsImage = (goodsColorInfo) => { | 86 | const handleGoodsImage = (goodsColorInfo) => { |
72 | let image0 = {genderCover: 0, isDefault: 'Y'}; // 0商品正面图 | 87 | let image0 = {genderCover: 0, isDefault: 'Y'}; // 0商品正面图 |
73 | let image3 = {genderCover: 1, isDefault: 'N'}; // 3男生频道封面图 | 88 | let image3 = {genderCover: 1, isDefault: 'N'}; // 3男生频道封面图 |
@@ -96,33 +111,9 @@ const handleGoodsImage = (goodsColorInfo) => { | @@ -96,33 +111,9 @@ const handleGoodsImage = (goodsColorInfo) => { | ||
96 | return newGoods; | 111 | return newGoods; |
97 | }; | 112 | }; |
98 | 113 | ||
99 | -const handleColorImage = (product) => { | ||
100 | - let colorsObj = {}; | ||
101 | - | ||
102 | - colorsObj.productSkn = product.productSkn; | ||
103 | - | ||
104 | - let findDefaultSkcIndex = product.goods.findIndex(c => c.isDefault === 'Y'); | ||
105 | - | ||
106 | - colorsObj.productSkc = findDefaultSkcIndex !== -1 ? product.goods[findDefaultSkcIndex].productSkc : ''; | ||
107 | - | ||
108 | - colorsObj.goodsImagesBoList = product.goods.reduce((total, cur) => { | ||
109 | - total = total.concat(cur.goodsImage.filter(g => g.imageUrl)); | ||
110 | - return total; | ||
111 | - }, []); | ||
112 | - | ||
113 | - return colorsObj; | ||
114 | -}; | ||
115 | - | ||
116 | const handleEditColorImage = (product) => { | 114 | const handleEditColorImage = (product) => { |
117 | let colorsObj = {}; | 115 | let colorsObj = {}; |
118 | 116 | ||
119 | - colorsObj.productSkn = product.productSkn; | ||
120 | - | ||
121 | - let findDefaultSkcIndex = product.goods.findIndex(c => c.isDefault === 'Y'); | ||
122 | - | ||
123 | - // TODO: 新增主推还没有处理 | ||
124 | - colorsObj.productSkc = findDefaultSkcIndex !== -1 ? product.goods[findDefaultSkcIndex].productSkc : ''; | ||
125 | - | ||
126 | colorsObj.goodsImagesBoList = product.goods.reduce((total, cur) => { | 117 | colorsObj.goodsImagesBoList = product.goods.reduce((total, cur) => { |
127 | total = total.concat(cur.goodsImage.filter(g => g.imageUrl)); | 118 | total = total.concat(cur.goodsImage.filter(g => g.imageUrl)); |
128 | return total; | 119 | return total; |
@@ -131,30 +122,16 @@ const handleEditColorImage = (product) => { | @@ -131,30 +122,16 @@ const handleEditColorImage = (product) => { | ||
131 | return colorsObj; | 122 | return colorsObj; |
132 | }; | 123 | }; |
133 | 124 | ||
134 | -function getAbsoluteUrl(url) { | ||
135 | - if (!url) { | ||
136 | - return null; | ||
137 | - } | ||
138 | - | ||
139 | - let urlArr = url.split('/'), | ||
140 | - stag = urlArr[urlArr.length - 1].substr(0, 2), | ||
141 | - domain = `static.yhbimg.com/goodsimg`; | ||
142 | - | ||
143 | - url = domain + url; | ||
144 | - if (stag === '01') { | ||
145 | - return `//img11.${url}`; | ||
146 | - } else if (stag === '03') { | ||
147 | - return `//flv01.${url}`; | ||
148 | - } else { | ||
149 | - return `//img12.${url}`; | ||
150 | - } | 125 | +function getProduct(skn) { |
126 | + return api.getProductAllInfo(skn).then((result) => { | ||
127 | + return result.data; | ||
128 | + }); | ||
151 | } | 129 | } |
152 | 130 | ||
153 | export default { | 131 | export default { |
154 | handleGoods, | 132 | handleGoods, |
155 | handleColorImage, | 133 | handleColorImage, |
156 | - getProduct, | ||
157 | - getAbsoluteUrl, | ||
158 | handleGoodsImage, | 134 | handleGoodsImage, |
159 | - handleEditColorImage | ||
160 | -}; | 135 | + handleEditColorImage, |
136 | + getProduct | ||
137 | +}; |
-
Please register or login to post a comment