Authored by TaoHuang

fix(second): fix order

... ... @@ -29,10 +29,10 @@
<transition name="slide-up">
<div class="footer" v-if="isAvailable">
<cube-button v-if="isMarketable" @click="convertToCash" :class="{active: isMarketable}">变现<span> <i>¥</i>{{cashPrice}}</span></cube-button>
<cube-button v-if="config.type === 'sell'" @click="select" :class="{active: isTradable}">{{config.btnTitle}}</cube-button>
<cube-button v-if="config.type === 'sell'" @click="select('sell')" :class="{active: isTradable}">{{config.btnTitle}}</cube-button>
<cube-button v-if="config.type === 'buy' && isUsed" @click="convertToUsed">二手<span> <i>¥</i>{{usedPrice}}</span></cube-button>
<cube-button v-if="config.type === 'buy' && isTradable" @click="select" class="active">{{config.btnTitle}}<span> <i>¥</i>{{latestPrice}}</span></cube-button>
<cube-button v-if="config.type === 'buy' && isUsed" @click="select('second')">二手<span> <i>¥</i>{{usedPrice}}</span></cube-button>
<cube-button v-if="config.type === 'buy' && isTradable" @click="select('buy')" class="active">{{config.btnTitle}}<span> <i>¥</i>{{latestPrice}}</span></cube-button>
</div>
</transition>
</div>
... ... @@ -216,17 +216,23 @@ export default {
onAdd() {
this.$emit('add');
},
select() {
select(type) {
if (!this.isTradable) {
return;
}
const isSecond = type === 'second';
const secondSkup = get(this.selectedSize, 'second_hand_skup', 0);
this.$emit('select', {
size_name: this.selectedSize.size_name,
size_id: this.selectedSize.size_id,
productId: this.product.product_id,
storageId: this.selectedSize.storage_id,
skup: this.selectedSize.skup,
skup: isSecond ? secondSkup : this.selectedSize.skup,
bid_skup: this.selectedSize.bid_skup,
second_hand_skup: secondSkup,
type
});
},
convertToCash() {
... ... @@ -287,59 +293,6 @@ export default {
}
});
},
async convertToUsed() {
if (!this.isUsed) {
return;
}
this.hide();
if (!get(this.selectedSize, 'second_hand_skup', 0)) {
return;
}
const storageId = get(this.selectedSize, 'storage_id', 0);
if (!storageId) {
return;
}
const { data: count } = await this.fetchStorageCount({ storageId });
this.$store.dispatch('reportYas', {
params: {
appop: 'XY_UFO_PRD_DT_BUY_SEL_C',
param: {
PRD_ID: this.product.product_id,
PRD_SKU: get(this.selectedSize, 'second_hand_skup', 0),
PRD_SIZE: get(this.selectedSize, 'size_id', 0),
ORD_TYPE: 5,
},
},
});
if (count === 1) {
// 跳转详情
this.$router.push({
name: 'SecondProductDetail',
params: {
skup: get(this.selectedSize, 'second_hand_skup', 0)
}
});
} else if (count > 1) {
// 跳转列表
this.$router.push({
name: 'SecondSellList',
params: {
id: storageId,
},
query: {
pid: this.selectedProductInfo.productId
}
});
}
}
},
};
</script>
... ...
... ... @@ -53,12 +53,12 @@
</div>
<!-- 视频资源位 -->
<a
class="banner video-resource"
ref="videoResourceImg"
<a
class="banner video-resource"
ref="videoResourceImg"
v-if="videoResource.src">
<div
class="video-mask"
<div
class="video-mask"
@click="onVideoPlay"></div>
<VideoPlayer
ref="videoPlayer"
... ... @@ -116,9 +116,10 @@ import stateShortCutsMixins from './mixins';
import trackingMixins from './tracking-mixins';
import DetailUseageTips from './components/detail-useage-tips';
import VideoPlayer from "@/components/video-player";
import VideoPlayer from '@/components/video-player';
const { mapActions, mapState } = createNamespacedHelpers('product');
const { mapActions: mapSecondActions } = createNamespacedHelpers('second');
export default {
name: 'ProductDetail',
... ... @@ -355,6 +356,7 @@ export default {
methods: {
...mapActions(['fetchProductInfo', 'fetchBrandTop', 'fetchFav', 'setupInitialProductInfo',
'toggleFav', 'updateTradeInfo', 'getSelectedTradeProduct', 'payment', 'resetSelectedSize']),
...mapSecondActions(['fetchStorageCount']),
historyBackGuard() {
for (let key of Object.keys(this.actionSheetCloseMap)) {
if (this[key]) {
... ... @@ -622,8 +624,11 @@ export default {
* 2.PRD_SKU:商品SKU;
* 3.PRD_SIZE:尺码;
* 新增字段:
* 4.ORD_TYPE:订单类型;1-出售,2-购买,3-求购,4-变现
* 4.ORD_TYPE:订单类型;1-出售,2-购买,3-求购,4-变现, 5-二手
*/
const isSecond = tradeProduct.type === 'second';
this.$store.dispatch('reportYas', {
params: {
appop: 'XY_UFO_PRD_DT_BUY_SEL_C',
... ... @@ -631,7 +636,7 @@ export default {
PRD_ID: tradeProduct.productId,
PRD_SKU: tradeProduct.skup,
PRD_SIZE: tradeProduct.size_id,
ORD_TYPE: this.selectSizeConfig.type === 'buy' ? 2 : 1
ORD_TYPE: this.selectSizeConfig.type === 'buy' ? (isSecond ? 5 : 2) : 1
},
}
});
... ... @@ -683,10 +688,35 @@ export default {
this.showSizeSelectSheet = false;
this.$router.push({
name: this.selectSizeConfig.dest,
query: tradeProduct
});
if (isSecond) {
const { data: count } = await this.fetchStorageCount({ storageId: tradeProduct.storageId });
if (count === 1) {
// 跳转详情
this.$router.push({
name: 'SecondProductDetail',
params: {
skup: tradeProduct.skup
}
});
} else if (count > 1) {
// 跳转列表
this.$router.push({
name: 'SecondSellList',
params: {
id: tradeProduct.storageId,
},
query: {
pid: tradeProduct.productId
}
});
}
} else {
this.$router.push({
name: this.selectSizeConfig.dest,
query: tradeProduct
});
}
},
// 添加尺寸
... ... @@ -815,10 +845,10 @@ export default {
}, yasReportHandler);
},
onVideoPlay() {
this.$refs.videoPlayer.parentHandleclick()
this.$refs.videoPlayer.parentHandleclick();
}
},
};
</script>
... ...