Merge remote-tracking branch 'origin/develop' into develop
Showing
11 changed files
with
64 additions
and
24 deletions
1 | const config = { | 1 | const config = { |
2 | development: { | 2 | development: { |
3 | - axiosBaseUrl: 'http://m.yohobuy.com:6001/xianyu', | 3 | + axiosBaseUrl: 'http://m.yohobuy.com/xianyu', |
4 | axiosResponseType: 'json', | 4 | axiosResponseType: 'json', |
5 | reportUrl: '//badjs.yoho.cn/apm/yas2.gif', | 5 | reportUrl: '//badjs.yoho.cn/apm/yas2.gif', |
6 | }, | 6 | }, |
@@ -63,7 +63,7 @@ export default { | @@ -63,7 +63,7 @@ export default { | ||
63 | name: name[0], | 63 | name: name[0], |
64 | subName: name[1], | 64 | subName: name[1], |
65 | price, | 65 | price, |
66 | - store_id: info.storage_id, | 66 | + storage_id: info.storage_id, |
67 | available: info.storage_num > 0 && price !== '-', | 67 | available: info.storage_num > 0 && price !== '-', |
68 | }; | 68 | }; |
69 | }); | 69 | }); |
@@ -28,7 +28,7 @@ | @@ -28,7 +28,7 @@ | ||
28 | 28 | ||
29 | <script> | 29 | <script> |
30 | import { Scroll } from 'cube-ui'; | 30 | import { Scroll } from 'cube-ui'; |
31 | -import { sortby } from 'lodash'; | 31 | +import { sortBy } from 'lodash'; |
32 | 32 | ||
33 | export default { | 33 | export default { |
34 | name: 'size-list', | 34 | name: 'size-list', |
@@ -68,7 +68,7 @@ export default { | @@ -68,7 +68,7 @@ export default { | ||
68 | } | 68 | } |
69 | 69 | ||
70 | if (!this.simplePrice) { | 70 | if (!this.simplePrice) { |
71 | - const list = sortby(this.list, 'order_by').reverse(); | 71 | + const list = sortBy(this.list, 'order_by').reverse(); |
72 | 72 | ||
73 | return list.map(this.priceMap); | 73 | return list.map(this.priceMap); |
74 | } | 74 | } |
@@ -100,7 +100,7 @@ export default { | @@ -100,7 +100,7 @@ export default { | ||
100 | name: name[0], | 100 | name: name[0], |
101 | subName: name[1], | 101 | subName: name[1], |
102 | price, | 102 | price, |
103 | - store_id: info.storage_id, | 103 | + storage_id: info.storage_id, |
104 | available: info.storage_num > 0 && price !== '-', | 104 | available: info.storage_num > 0 && price !== '-', |
105 | }; | 105 | }; |
106 | }, | 106 | }, |
@@ -111,6 +111,7 @@ export default { | @@ -111,6 +111,7 @@ export default { | ||
111 | size_id: info.id, | 111 | size_id: info.id, |
112 | name: name[0], | 112 | name: name[0], |
113 | subName: name[1], | 113 | subName: name[1], |
114 | + storage_id: info.storage_id, | ||
114 | available: info.text !== '-', | 115 | available: info.text !== '-', |
115 | }; | 116 | }; |
116 | }, | 117 | }, |
@@ -2,5 +2,9 @@ export default [{ | @@ -2,5 +2,9 @@ export default [{ | ||
2 | name: 'ProductDetail', | 2 | name: 'ProductDetail', |
3 | path: '/xianyu/product/:productId.html', | 3 | path: '/xianyu/product/:productId.html', |
4 | component: () => import(/* webpackChunkName: "product" */ './product-detail'), | 4 | component: () => import(/* webpackChunkName: "product" */ './product-detail'), |
5 | - props: true, | 5 | + props({params}) { |
6 | + return { | ||
7 | + productId: parseInt(params.productId, 10), | ||
8 | + }; | ||
9 | + }, | ||
6 | }]; | 10 | }]; |
@@ -62,6 +62,9 @@ | @@ -62,6 +62,9 @@ | ||
62 | <img class="ref-img" v-lazy="prdDetailTip"/> | 62 | <img class="ref-img" v-lazy="prdDetailTip"/> |
63 | </div> | 63 | </div> |
64 | <img class="ref-img" v-lazy="prdDetailImage" /> | 64 | <img class="ref-img" v-lazy="prdDetailImage" /> |
65 | + <div class="recommend" v-if="recommend"><h2>相关推荐</h2> | ||
66 | + <product-list :list="recommend" /> | ||
67 | + </div> | ||
65 | </cube-scroll> | 68 | </cube-scroll> |
66 | </div> | 69 | </div> |
67 | <div class="footer"> | 70 | <div class="footer"> |
@@ -88,6 +91,7 @@ import { createNamespacedHelpers } from 'vuex'; | @@ -88,6 +91,7 @@ import { createNamespacedHelpers } from 'vuex'; | ||
88 | 91 | ||
89 | import ImgSize from '../../components/img-size'; | 92 | import ImgSize from '../../components/img-size'; |
90 | import { getImgUrl } from '../../common/utils'; | 93 | import { getImgUrl } from '../../common/utils'; |
94 | +import ProductList from '../list/components/productList'; | ||
91 | 95 | ||
92 | import ActivityListSheet from './components/activity-list-sheet'; | 96 | import ActivityListSheet from './components/activity-list-sheet'; |
93 | import prdDetailTip from '../../statics/image/product/prdDetailTip.png'; | 97 | import prdDetailTip from '../../statics/image/product/prdDetailTip.png'; |
@@ -106,6 +110,7 @@ export default { | @@ -106,6 +110,7 @@ export default { | ||
106 | SizeRequestSheet, | 110 | SizeRequestSheet, |
107 | BuySheet, | 111 | BuySheet, |
108 | ImgSize, | 112 | ImgSize, |
113 | + ProductList, | ||
109 | 'cube-button': Button, | 114 | 'cube-button': Button, |
110 | 'cube-slide': Slide, | 115 | 'cube-slide': Slide, |
111 | 'cube-slide-item': Slide.Item, | 116 | 'cube-slide-item': Slide.Item, |
@@ -130,7 +135,7 @@ export default { | @@ -130,7 +135,7 @@ export default { | ||
130 | }; | 135 | }; |
131 | }, | 136 | }, |
132 | computed: { | 137 | computed: { |
133 | - ...mapGetters(['productDetail', 'imageList', 'resource', 'activity']), | 138 | + ...mapGetters(['productDetail', 'imageList', 'resource', 'activity', 'recommend']), |
134 | productDec() { | 139 | productDec() { |
135 | const goods = get(this.productDetail, 'goods_list[0]', {}); | 140 | const goods = get(this.productDetail, 'goods_list[0]', {}); |
136 | 141 | ||
@@ -184,10 +189,10 @@ export default { | @@ -184,10 +189,10 @@ export default { | ||
184 | time: 0, | 189 | time: 0, |
185 | }); | 190 | }); |
186 | }, | 191 | }, |
187 | - loadData(id, loading) { | 192 | + loadData(productId = this.productId, loading) { |
188 | loading && loading.show(); | 193 | loading && loading.show(); |
189 | 194 | ||
190 | - this.fetchProductInfo({productId: this.productId}).then(() => { | 195 | + return this.fetchProductInfo({productId}).then(() => { |
191 | loading && loading.hide(); | 196 | loading && loading.hide(); |
192 | }).catch(() => { | 197 | }).catch(() => { |
193 | loading && loading.hide(); | 198 | loading && loading.hide(); |
@@ -288,7 +293,7 @@ export default { | @@ -288,7 +293,7 @@ export default { | ||
288 | } | 293 | } |
289 | 294 | ||
290 | .banner-title { | 295 | .banner-title { |
291 | - font-family: PingFang-SC-Light; | 296 | + /* font-family: PingFang-SC-Light; */ |
292 | border: 1px solid #000; | 297 | border: 1px solid #000; |
293 | font-size: 30px; | 298 | font-size: 30px; |
294 | line-height: 100px; | 299 | line-height: 100px; |
@@ -344,14 +349,14 @@ export default { | @@ -344,14 +349,14 @@ export default { | ||
344 | } | 349 | } |
345 | 350 | ||
346 | &-name { | 351 | &-name { |
347 | - font-family: PingFang-SC-Regular; | 352 | + /* font-family: PingFang-SC-Regular; */ |
348 | font-size: 28px; | 353 | font-size: 28px; |
349 | color: #999; | 354 | color: #999; |
350 | letter-spacing: 0; | 355 | letter-spacing: 0; |
351 | } | 356 | } |
352 | 357 | ||
353 | &-value { | 358 | &-value { |
354 | - font-family: SFProText-Medium; | 359 | + /* font-family: SFProText-Medium; */ |
355 | font-size: 28px; | 360 | font-size: 28px; |
356 | color: #000; | 361 | color: #000; |
357 | letter-spacing: 0; | 362 | letter-spacing: 0; |
@@ -378,6 +383,7 @@ export default { | @@ -378,6 +383,7 @@ export default { | ||
378 | flex-basis: auto; | 383 | flex-basis: auto; |
379 | border-top: 1px solid $primary-color; | 384 | border-top: 1px solid $primary-color; |
380 | line-height: 60px; | 385 | line-height: 60px; |
386 | + font-size: 28px; | ||
381 | } | 387 | } |
382 | 388 | ||
383 | .sell { | 389 | .sell { |
@@ -397,4 +403,13 @@ export default { | @@ -397,4 +403,13 @@ export default { | ||
397 | } | 403 | } |
398 | } | 404 | } |
399 | } | 405 | } |
406 | + | ||
407 | + .recommend { | ||
408 | + h2 { | ||
409 | + font-size: 40px; | ||
410 | + line-height: 56px; | ||
411 | + padding: 32px 0; | ||
412 | + text-align: center; | ||
413 | + } | ||
414 | + } | ||
400 | </style> | 415 | </style> |
@@ -30,7 +30,7 @@ export default { | @@ -30,7 +30,7 @@ export default { | ||
30 | }, | 30 | }, |
31 | async updateTradeInfo({commit, state}, {productId, sizeInfo, tradeTypeInfo}) { | 31 | async updateTradeInfo({commit, state}, {productId, sizeInfo, tradeTypeInfo}) { |
32 | if (sizeInfo) { | 32 | if (sizeInfo) { |
33 | - commit(Types.UPDATE_SELECTED_RPODUCT_SIZE, {productId, sizeId: sizeInfo.size_id}); | 33 | + commit(Types.UPDATE_SELECTED_RPODUCT_SIZE, {productId, sizeId: sizeInfo.size_id}); |
34 | } | 34 | } |
35 | 35 | ||
36 | if (tradeTypeInfo) { | 36 | if (tradeTypeInfo) { |
@@ -40,19 +40,20 @@ export default { | @@ -40,19 +40,20 @@ export default { | ||
40 | return { | 40 | return { |
41 | productId, | 41 | productId, |
42 | sizeId: state.selectedProductInfo.sizeId, | 42 | sizeId: state.selectedProductInfo.sizeId, |
43 | + storageId: state.selectedProductInfo.storageId, | ||
43 | tradeTypeId: state.selectedProductInfo.tradeTypeId, | 44 | tradeTypeId: state.selectedProductInfo.tradeTypeId, |
44 | }; | 45 | }; |
45 | }, | 46 | }, |
46 | - async getSelectedTradeProduct({state, commit, dispatch}, {productId, sizeId, tradeTypeId}) { | 47 | + async getSelectedTradeProduct({state, commit, dispatch}, {productId, storageId, tradeTypeId}) { |
47 | productId = parseInt(productId, 10); | 48 | productId = parseInt(productId, 10); |
48 | - sizeId = parseInt(sizeId, 10); | 49 | + storageId = parseInt(storageId, 10); |
49 | tradeTypeId = parseInt(tradeTypeId, 10); | 50 | tradeTypeId = parseInt(tradeTypeId, 10); |
50 | - if (!(state.selectedProductInfo && state.selectedProductInfo.productId == productId || | 51 | + if (!(state.selectedProductInfo && state.selectedProductInfo.productId === productId || |
51 | state.products.byId[productId])) { | 52 | state.products.byId[productId])) { |
52 | await dispatch('fetchProductInfo', {productId}); | 53 | await dispatch('fetchProductInfo', {productId}); |
53 | } | 54 | } |
54 | 55 | ||
55 | - commit(Types.UPDATE_SELECTED_RPODUCT_SIZE, {productId, sizeId}); | 56 | + commit(Types.UPDATE_SELECTED_RPODUCT_SIZE, {productId, storageId}); |
56 | commit(Types.UPDATE_SELECTED_TRADE_TYPE, {productId, tradeTypeId}); | 57 | commit(Types.UPDATE_SELECTED_TRADE_TYPE, {productId, tradeTypeId}); |
57 | 58 | ||
58 | return state.selectedProductInfo; | 59 | return state.selectedProductInfo; |
@@ -24,6 +24,7 @@ export default function() { | @@ -24,6 +24,7 @@ export default function() { | ||
24 | productId: null, | 24 | productId: null, |
25 | product: {}, | 25 | product: {}, |
26 | sizeId: null, | 26 | sizeId: null, |
27 | + storageId: null, | ||
27 | size: {}, | 28 | size: {}, |
28 | tradeTypeId: null, | 29 | tradeTypeId: null, |
29 | tradeType: {}, | 30 | tradeType: {}, |
@@ -44,6 +45,15 @@ export default function() { | @@ -44,6 +45,15 @@ export default function() { | ||
44 | activity(state, getters) { | 45 | activity(state, getters) { |
45 | return get(getters.productDetail, 'activity', []); | 46 | return get(getters.productDetail, 'activity', []); |
46 | }, | 47 | }, |
48 | + recommend(state, getters) { | ||
49 | + const list = get(getters.productDetail, 'recommend', []); | ||
50 | + | ||
51 | + if (list && list.length !== 0) { | ||
52 | + return list; | ||
53 | + } | ||
54 | + | ||
55 | + return null; | ||
56 | + }, | ||
47 | selectedSize(state) { | 57 | selectedSize(state) { |
48 | return state.selectedProductInfo.size; | 58 | return state.selectedProductInfo.size; |
49 | } | 59 | } |
@@ -7,6 +7,7 @@ function ensureSelectedProduct(state, productId) { | @@ -7,6 +7,7 @@ function ensureSelectedProduct(state, productId) { | ||
7 | productId, | 7 | productId, |
8 | product: state.products.byId[productId], | 8 | product: state.products.byId[productId], |
9 | sizeId: null, | 9 | sizeId: null, |
10 | + storageId: null, | ||
10 | size: {}, | 11 | size: {}, |
11 | tradeTypeId: null, | 12 | tradeTypeId: null, |
12 | tradeType: {} | 13 | tradeType: {} |
@@ -26,12 +27,22 @@ export default { | @@ -26,12 +27,22 @@ export default { | ||
26 | state.products.byId[productId].isFav = isFav; | 27 | state.products.byId[productId].isFav = isFav; |
27 | } | 28 | } |
28 | }, | 29 | }, |
29 | - [Types.UPDATE_SELECTED_RPODUCT_SIZE](state, { productId, sizeId}) { | 30 | + [Types.UPDATE_SELECTED_RPODUCT_SIZE](state, { productId, sizeId, storageId}) { |
30 | ensureSelectedProduct(state, productId); | 31 | ensureSelectedProduct(state, productId); |
31 | - state.selectedProductInfo.sizeId = sizeId; | 32 | + |
32 | const sizeList = get(state.selectedProductInfo.product, 'goods_list[0].size_list', []); | 33 | const sizeList = get(state.selectedProductInfo.product, 'goods_list[0].size_list', []); |
33 | 34 | ||
34 | - state.selectedProductInfo.size = find(sizeList, (size) => size.size_id === sizeId) || {}; | 35 | + let sizeInfo; |
36 | + | ||
37 | + if (storageId) { | ||
38 | + sizeInfo = find(sizeList, (size) => size.storage_id === storageId) || {}; | ||
39 | + } else { | ||
40 | + sizeInfo = find(sizeList, (size) => size.size_id === sizeId) || {}; | ||
41 | + } | ||
42 | + | ||
43 | + state.selectedProductInfo.sizeId = sizeInfo.size_id; | ||
44 | + state.selectedProductInfo.storageId = sizeInfo.storage_id; | ||
45 | + state.selectedProductInfo.size = sizeInfo; | ||
35 | }, | 46 | }, |
36 | [Types.UPDATE_SELECTED_TRADE_TYPE](state, { productId, tradeTypeId}) { | 47 | [Types.UPDATE_SELECTED_TRADE_TYPE](state, { productId, tradeTypeId}) { |
37 | ensureSelectedProduct(state, productId); | 48 | ensureSelectedProduct(state, productId); |
@@ -4,4 +4,3 @@ export const UPDATE_SELECTED_RPODUCT_SIZE = 'UPDATE_SELECTED_RPODUCT_SIZE'; | @@ -4,4 +4,3 @@ export const UPDATE_SELECTED_RPODUCT_SIZE = 'UPDATE_SELECTED_RPODUCT_SIZE'; | ||
4 | export const UPDATE_SELECTED_TRADE_TYPE = 'UPDATE_SELECTED_TRADE_TYPE'; | 4 | export const UPDATE_SELECTED_TRADE_TYPE = 'UPDATE_SELECTED_TRADE_TYPE'; |
5 | export const PRODUCT_REQUEST_SIZE = 'PRODUCT_REQUEST_SIZE'; | 5 | export const PRODUCT_REQUEST_SIZE = 'PRODUCT_REQUEST_SIZE'; |
6 | 6 | ||
7 | - |
@@ -3,7 +3,7 @@ module.exports = { | @@ -3,7 +3,7 @@ module.exports = { | ||
3 | '/api/ufo/product': { | 3 | '/api/ufo/product': { |
4 | ufo: true, | 4 | ufo: true, |
5 | auth: false, | 5 | auth: false, |
6 | - api: 'ufo.product.data2', | 6 | + api: 'ufo.product.data3', |
7 | params: { | 7 | params: { |
8 | product_id: {type: Number}, // 商品id | 8 | product_id: {type: Number}, // 商品id |
9 | }, | 9 | }, |
-
Please register or login to post a comment