Authored by TaoHuang

feat(second): pay order

... ... @@ -35,10 +35,11 @@ import { get } from 'lodash';
import { createNamespacedHelpers, mapState } from 'vuex';
const { mapState: mapOrderState, mapActions: mapOrderAction, mapMutations: mapOrderMutations } = createNamespacedHelpers('order/orderConfirm');
const { mapActions: mapSecondActions } = createNamespacedHelpers('second');
export default {
name: 'BuyOrderConfirm',
props: ['productId', 'storageId'],
props: ['productId', 'storageId', 'type', 'skup'],
data() {
return {
isActive: false
... ... @@ -71,15 +72,26 @@ export default {
computed: {
...mapOrderState(['address', 'orderDetail']),
...mapState({
productDetail: state => {
return {
goodImg: get(state.product.selectedProductInfo, 'product.goods_list[0].image_list[0].image_url', ''),
productName: get(state.product.selectedProductInfo, 'product.product_name', ''),
colorName: get(state.product.selectedProductInfo, 'product.goods_list[0].color_name', ''),
sizeName: get(state.product.selectedProductInfo, 'size.size_name', ''),
goodPrice: get(state.product.selectedProductInfo, 'size.least_price', ''),
skup: get(state.product.selectedProductInfo, 'size.skup', '')
};
productDetail(state) {
if (this.type === 'second') {
return {
goodImg: get(state.second.info, 'imageList[0]', ''),
productName: get(state.second.info, 'productName', ''),
colorName: get(state.second.info, 'colorName', ''),
sizeName: get(state.second.info, 'sizeName', ''),
goodPrice: get(state.second.info, 'price', ''),
skup: this.skup
};
} else {
return {
goodImg: get(state.product.selectedProductInfo, 'product.goods_list[0].image_list[0].image_url', ''),
productName: get(state.product.selectedProductInfo, 'product.product_name', ''),
colorName: get(state.product.selectedProductInfo, 'product.goods_list[0].color_name', ''),
sizeName: get(state.product.selectedProductInfo, 'size.size_name', ''),
goodPrice: get(state.product.selectedProductInfo, 'size.least_price', ''),
skup: get(state.product.selectedProductInfo, 'size.skup', '')
};
}
}
}),
couponList() {
... ... @@ -109,6 +121,7 @@ export default {
methods: {
...mapOrderAction(['fetchOrderAddress', 'fetchUserStatus', 'fetchPayList', 'fetchPayment', 'computeOrder', 'buyPayAction']),
...mapOrderMutations([Types.CHANGE_SELECT_COUPON_LIST, Types.CHANGE_SELECT_PROMOTION, Types.CLEAR_BUY_STATUS]),
...mapSecondActions(['fetchDetailById']),
replaceBr(str) {
return str ? str.replace(/\n/g, '<br />') : '';
},
... ... @@ -273,10 +286,14 @@ export default {
async init() {
this.fetchOrderAddress({ tabType: UserType.buy });
await this.$store.dispatch('product/getSelectedTradeProduct', {
productId: this.productId,
storageId: this.storageId
});
if (this.type === 'second') {
await this.fetchDetailById({ skup: this.skup });
} else {
await this.$store.dispatch('product/getSelectedTradeProduct', {
productId: this.productId,
storageId: this.storageId
});
}
let user = await this.$sdk.getUser();
... ...
... ... @@ -30,6 +30,8 @@ export default [
props: route => ({
productId: route.query.productId,
storageId: route.query.storageId,
type: route.query.type,
skup: route.query.skup
}),
},
{
... ...
... ... @@ -104,7 +104,7 @@ export default {
if (this.selectedSize.size_id > 0) {
if (price && secondHandPrice) {
price = Math.min(this.selectedSize.least_price, secondHandPrice);
price = Math.min(price, secondHandPrice);
} else if (price <= 0 && secondHandPrice > 0) {
price = secondHandPrice;
} else if (price > 0 && secondHandPrice <= 0) {
... ...
... ... @@ -123,31 +123,13 @@ export default {
methods: {
// 购买
buy() {
// this.$refs.filtrate.show();
/**
* 数据埋点
* 商品详情页点击出售/购买/求购按钮
* event: XY_UFO_PRD_DT_SALE_C
* params: 1.TAB_ID:1-出售,2-购买,3-求购;
* 2.PRD_ID:商品ID;
*/
this.$store.dispatch('reportYas', {
params: {
appop: 'XY_UFO_PRD_DT_SALE_C',
param: {
TAB_ID: 2,
PRD_ID: this.productId
},
this.$router.push({
name: 'OrderBuyConfirm',
query: {
type: 'second',
skup: this.skup
}
});
this.resetSelectedSize();
this.selectSizeConfig = {
dest: 'OrderBuyConfirm',
type: 'buy',
title: '购买',
};
this.showSizeSelectSheet = true;
}
},
computed: {
... ...
import actions from './actions';
import mutations from './mutations';
import skupList from './skupList';
export function defaultState () {
return {
info: {
... ... @@ -12,7 +14,6 @@ export function defaultState () {
filterList: [] // 筛选列表
};
}
import skupList from './skupList';
export default function() {
return {
... ...