fix(second): fix order
Showing
2 changed files
with
55 additions
and
72 deletions
@@ -29,10 +29,10 @@ | @@ -29,10 +29,10 @@ | ||
29 | <transition name="slide-up"> | 29 | <transition name="slide-up"> |
30 | <div class="footer" v-if="isAvailable"> | 30 | <div class="footer" v-if="isAvailable"> |
31 | <cube-button v-if="isMarketable" @click="convertToCash" :class="{active: isMarketable}">变现<span> <i>¥</i>{{cashPrice}}</span></cube-button> | 31 | <cube-button v-if="isMarketable" @click="convertToCash" :class="{active: isMarketable}">变现<span> <i>¥</i>{{cashPrice}}</span></cube-button> |
32 | - <cube-button v-if="config.type === 'sell'" @click="select" :class="{active: isTradable}">{{config.btnTitle}}</cube-button> | 32 | + <cube-button v-if="config.type === 'sell'" @click="select('sell')" :class="{active: isTradable}">{{config.btnTitle}}</cube-button> |
33 | 33 | ||
34 | - <cube-button v-if="config.type === 'buy' && isUsed" @click="convertToUsed">二手<span> <i>¥</i>{{usedPrice}}</span></cube-button> | ||
35 | - <cube-button v-if="config.type === 'buy' && isTradable" @click="select" class="active">{{config.btnTitle}}<span> <i>¥</i>{{latestPrice}}</span></cube-button> | 34 | + <cube-button v-if="config.type === 'buy' && isUsed" @click="select('second')">二手<span> <i>¥</i>{{usedPrice}}</span></cube-button> |
35 | + <cube-button v-if="config.type === 'buy' && isTradable" @click="select('buy')" class="active">{{config.btnTitle}}<span> <i>¥</i>{{latestPrice}}</span></cube-button> | ||
36 | </div> | 36 | </div> |
37 | </transition> | 37 | </transition> |
38 | </div> | 38 | </div> |
@@ -216,17 +216,23 @@ export default { | @@ -216,17 +216,23 @@ export default { | ||
216 | onAdd() { | 216 | onAdd() { |
217 | this.$emit('add'); | 217 | this.$emit('add'); |
218 | }, | 218 | }, |
219 | - select() { | 219 | + select(type) { |
220 | if (!this.isTradable) { | 220 | if (!this.isTradable) { |
221 | return; | 221 | return; |
222 | } | 222 | } |
223 | + | ||
224 | + const isSecond = type === 'second'; | ||
225 | + const secondSkup = get(this.selectedSize, 'second_hand_skup', 0); | ||
226 | + | ||
223 | this.$emit('select', { | 227 | this.$emit('select', { |
224 | size_name: this.selectedSize.size_name, | 228 | size_name: this.selectedSize.size_name, |
225 | size_id: this.selectedSize.size_id, | 229 | size_id: this.selectedSize.size_id, |
226 | productId: this.product.product_id, | 230 | productId: this.product.product_id, |
227 | storageId: this.selectedSize.storage_id, | 231 | storageId: this.selectedSize.storage_id, |
228 | - skup: this.selectedSize.skup, | 232 | + skup: isSecond ? secondSkup : this.selectedSize.skup, |
229 | bid_skup: this.selectedSize.bid_skup, | 233 | bid_skup: this.selectedSize.bid_skup, |
234 | + second_hand_skup: secondSkup, | ||
235 | + type | ||
230 | }); | 236 | }); |
231 | }, | 237 | }, |
232 | convertToCash() { | 238 | convertToCash() { |
@@ -287,59 +293,6 @@ export default { | @@ -287,59 +293,6 @@ export default { | ||
287 | } | 293 | } |
288 | }); | 294 | }); |
289 | }, | 295 | }, |
290 | - | ||
291 | - async convertToUsed() { | ||
292 | - if (!this.isUsed) { | ||
293 | - return; | ||
294 | - } | ||
295 | - | ||
296 | - this.hide(); | ||
297 | - | ||
298 | - if (!get(this.selectedSize, 'second_hand_skup', 0)) { | ||
299 | - return; | ||
300 | - } | ||
301 | - | ||
302 | - const storageId = get(this.selectedSize, 'storage_id', 0); | ||
303 | - | ||
304 | - if (!storageId) { | ||
305 | - return; | ||
306 | - } | ||
307 | - | ||
308 | - const { data: count } = await this.fetchStorageCount({ storageId }); | ||
309 | - | ||
310 | - this.$store.dispatch('reportYas', { | ||
311 | - params: { | ||
312 | - appop: 'XY_UFO_PRD_DT_BUY_SEL_C', | ||
313 | - param: { | ||
314 | - PRD_ID: this.product.product_id, | ||
315 | - PRD_SKU: get(this.selectedSize, 'second_hand_skup', 0), | ||
316 | - PRD_SIZE: get(this.selectedSize, 'size_id', 0), | ||
317 | - ORD_TYPE: 5, | ||
318 | - }, | ||
319 | - }, | ||
320 | - }); | ||
321 | - | ||
322 | - if (count === 1) { | ||
323 | - // 跳转详情 | ||
324 | - this.$router.push({ | ||
325 | - name: 'SecondProductDetail', | ||
326 | - params: { | ||
327 | - skup: get(this.selectedSize, 'second_hand_skup', 0) | ||
328 | - } | ||
329 | - }); | ||
330 | - } else if (count > 1) { | ||
331 | - // 跳转列表 | ||
332 | - this.$router.push({ | ||
333 | - name: 'SecondSellList', | ||
334 | - params: { | ||
335 | - id: storageId, | ||
336 | - }, | ||
337 | - query: { | ||
338 | - pid: this.selectedProductInfo.productId | ||
339 | - } | ||
340 | - }); | ||
341 | - } | ||
342 | - } | ||
343 | }, | 296 | }, |
344 | }; | 297 | }; |
345 | </script> | 298 | </script> |
@@ -53,12 +53,12 @@ | @@ -53,12 +53,12 @@ | ||
53 | </div> | 53 | </div> |
54 | 54 | ||
55 | <!-- 视频资源位 --> | 55 | <!-- 视频资源位 --> |
56 | - <a | ||
57 | - class="banner video-resource" | ||
58 | - ref="videoResourceImg" | 56 | + <a |
57 | + class="banner video-resource" | ||
58 | + ref="videoResourceImg" | ||
59 | v-if="videoResource.src"> | 59 | v-if="videoResource.src"> |
60 | - <div | ||
61 | - class="video-mask" | 60 | + <div |
61 | + class="video-mask" | ||
62 | @click="onVideoPlay"></div> | 62 | @click="onVideoPlay"></div> |
63 | <VideoPlayer | 63 | <VideoPlayer |
64 | ref="videoPlayer" | 64 | ref="videoPlayer" |
@@ -116,9 +116,10 @@ import stateShortCutsMixins from './mixins'; | @@ -116,9 +116,10 @@ import stateShortCutsMixins from './mixins'; | ||
116 | import trackingMixins from './tracking-mixins'; | 116 | import trackingMixins from './tracking-mixins'; |
117 | import DetailUseageTips from './components/detail-useage-tips'; | 117 | import DetailUseageTips from './components/detail-useage-tips'; |
118 | 118 | ||
119 | -import VideoPlayer from "@/components/video-player"; | 119 | +import VideoPlayer from '@/components/video-player'; |
120 | 120 | ||
121 | const { mapActions, mapState } = createNamespacedHelpers('product'); | 121 | const { mapActions, mapState } = createNamespacedHelpers('product'); |
122 | +const { mapActions: mapSecondActions } = createNamespacedHelpers('second'); | ||
122 | 123 | ||
123 | export default { | 124 | export default { |
124 | name: 'ProductDetail', | 125 | name: 'ProductDetail', |
@@ -355,6 +356,7 @@ export default { | @@ -355,6 +356,7 @@ export default { | ||
355 | methods: { | 356 | methods: { |
356 | ...mapActions(['fetchProductInfo', 'fetchBrandTop', 'fetchFav', 'setupInitialProductInfo', | 357 | ...mapActions(['fetchProductInfo', 'fetchBrandTop', 'fetchFav', 'setupInitialProductInfo', |
357 | 'toggleFav', 'updateTradeInfo', 'getSelectedTradeProduct', 'payment', 'resetSelectedSize']), | 358 | 'toggleFav', 'updateTradeInfo', 'getSelectedTradeProduct', 'payment', 'resetSelectedSize']), |
359 | + ...mapSecondActions(['fetchStorageCount']), | ||
358 | historyBackGuard() { | 360 | historyBackGuard() { |
359 | for (let key of Object.keys(this.actionSheetCloseMap)) { | 361 | for (let key of Object.keys(this.actionSheetCloseMap)) { |
360 | if (this[key]) { | 362 | if (this[key]) { |
@@ -622,8 +624,11 @@ export default { | @@ -622,8 +624,11 @@ export default { | ||
622 | * 2.PRD_SKU:商品SKU; | 624 | * 2.PRD_SKU:商品SKU; |
623 | * 3.PRD_SIZE:尺码; | 625 | * 3.PRD_SIZE:尺码; |
624 | * 新增字段: | 626 | * 新增字段: |
625 | - * 4.ORD_TYPE:订单类型;1-出售,2-购买,3-求购,4-变现; | 627 | + * 4.ORD_TYPE:订单类型;1-出售,2-购买,3-求购,4-变现, 5-二手 |
626 | */ | 628 | */ |
629 | + | ||
630 | + const isSecond = tradeProduct.type === 'second'; | ||
631 | + | ||
627 | this.$store.dispatch('reportYas', { | 632 | this.$store.dispatch('reportYas', { |
628 | params: { | 633 | params: { |
629 | appop: 'XY_UFO_PRD_DT_BUY_SEL_C', | 634 | appop: 'XY_UFO_PRD_DT_BUY_SEL_C', |
@@ -631,7 +636,7 @@ export default { | @@ -631,7 +636,7 @@ export default { | ||
631 | PRD_ID: tradeProduct.productId, | 636 | PRD_ID: tradeProduct.productId, |
632 | PRD_SKU: tradeProduct.skup, | 637 | PRD_SKU: tradeProduct.skup, |
633 | PRD_SIZE: tradeProduct.size_id, | 638 | PRD_SIZE: tradeProduct.size_id, |
634 | - ORD_TYPE: this.selectSizeConfig.type === 'buy' ? 2 : 1 | 639 | + ORD_TYPE: this.selectSizeConfig.type === 'buy' ? (isSecond ? 5 : 2) : 1 |
635 | }, | 640 | }, |
636 | } | 641 | } |
637 | }); | 642 | }); |
@@ -683,10 +688,35 @@ export default { | @@ -683,10 +688,35 @@ export default { | ||
683 | 688 | ||
684 | this.showSizeSelectSheet = false; | 689 | this.showSizeSelectSheet = false; |
685 | 690 | ||
686 | - this.$router.push({ | ||
687 | - name: this.selectSizeConfig.dest, | ||
688 | - query: tradeProduct | ||
689 | - }); | 691 | + if (isSecond) { |
692 | + const { data: count } = await this.fetchStorageCount({ storageId: tradeProduct.storageId }); | ||
693 | + | ||
694 | + if (count === 1) { | ||
695 | + // 跳转详情 | ||
696 | + this.$router.push({ | ||
697 | + name: 'SecondProductDetail', | ||
698 | + params: { | ||
699 | + skup: tradeProduct.skup | ||
700 | + } | ||
701 | + }); | ||
702 | + } else if (count > 1) { | ||
703 | + // 跳转列表 | ||
704 | + this.$router.push({ | ||
705 | + name: 'SecondSellList', | ||
706 | + params: { | ||
707 | + id: tradeProduct.storageId, | ||
708 | + }, | ||
709 | + query: { | ||
710 | + pid: tradeProduct.productId | ||
711 | + } | ||
712 | + }); | ||
713 | + } | ||
714 | + } else { | ||
715 | + this.$router.push({ | ||
716 | + name: this.selectSizeConfig.dest, | ||
717 | + query: tradeProduct | ||
718 | + }); | ||
719 | + } | ||
690 | }, | 720 | }, |
691 | 721 | ||
692 | // 添加尺寸 | 722 | // 添加尺寸 |
@@ -815,10 +845,10 @@ export default { | @@ -815,10 +845,10 @@ export default { | ||
815 | }, yasReportHandler); | 845 | }, yasReportHandler); |
816 | }, | 846 | }, |
817 | onVideoPlay() { | 847 | onVideoPlay() { |
818 | - this.$refs.videoPlayer.parentHandleclick() | 848 | + this.$refs.videoPlayer.parentHandleclick(); |
819 | } | 849 | } |
820 | }, | 850 | }, |
821 | - | 851 | + |
822 | }; | 852 | }; |
823 | </script> | 853 | </script> |
824 | 854 |
-
Please register or login to post a comment