Authored by TaoHuang

Merge remote-tracking branch 'origin/develop' into develop

... ... @@ -5,13 +5,7 @@
v-for="(deliveryDetail, i) in deliveryList"
:key="i"
>
<i
:class="
i === 0
? 'time-line-label iconfont iconxuanzhongduigou active'
: 'time-line-label'
"
></i>
<i :class="i === 0 ? iconClass : 'time-line-label'"></i>
<div>
<p class="content">{{ deliveryDetail.acceptRemark }}</p>
<p class="time">{{ deliveryDetail.createTimeStr }}</p>
... ... @@ -26,6 +20,17 @@ export default {
deliveryList: {
type: Array,
default: []
},
isGoingOn: {
type: Boolean,
default: false
}
},
computed: {
iconClass: function() {
return this.isGoingOn
? "iconfont iconxuanzhongduigou custom-icon active"
: "iconfont iconxuanzhongduigou custom-icon";
}
}
};
... ... @@ -52,6 +57,20 @@ export default {
margin-top: -8px;
}
.custom-icon {
width: 40px;
height: 40px;
font-size: 40px;
line-height: 1;
left: -21px;
top: -10px;
position: absolute;
&.active {
color: #000;
}
}
.time-line-label {
width: 20px;
height: 20px;
... ... @@ -60,17 +79,6 @@ export default {
display: block;
position: absolute;
left: -10px;
&.active {
width: 40px;
height: 40px;
font-size: 40px;
line-height: 1;
left: -21px;
background: #fff;
top: -10px;
color: #000;
}
}
}
}
... ...
... ... @@ -34,7 +34,10 @@
:key="i"
>
<span class="title">{{ detailInfo.title }}</span>
<time-line :deliveryList="detailInfo.detailList" />
<time-line
:isGoingOn="i === 0"
:deliveryList="detailInfo.detailList"
/>
</div>
</div>
</div>
... ...
... ... @@ -57,7 +57,7 @@
</div>
<div class="footer">
<div class="heart">
<div class="icon-fav" v-if="productDetail.isFav" @click="_toggleFav(false)">
<div class="icon-fav" v-if="isFav" @click="_toggleFav(false)">
<svg id="icon-heart" style="width: 1rem; height: 1rem;" viewBox="0 0 28 28">
<title>heart</title>
<path d="M14 26c-0.25 0-0.5-0.094-0.688-0.281l-9.75-9.406c-0.125-0.109-3.563-3.25-3.563-7 0-4.578 2.797-7.313 7.469-7.313 2.734 0 5.297 2.156 6.531 3.375 1.234-1.219 3.797-3.375 6.531-3.375 4.672 0 7.469 2.734 7.469 7.313 0 3.75-3.437 6.891-3.578 7.031l-9.734 9.375c-0.187 0.187-0.438 0.281-0.688 0.281z"></path>
... ... @@ -144,7 +144,7 @@ export default {
};
},
computed: {
...mapGetters(['productDetail', 'topList', 'imageList', 'resource', 'activity', 'recommend']),
...mapGetters(['productDetail', 'isFav', 'topList', 'imageList', 'resource', 'activity', 'recommend']),
productDec() {
const goods = get(this.productDetail, 'goods_list[0]', {});
... ... @@ -183,7 +183,7 @@ export default {
}
},
methods: {
...mapActions(['fetchProductInfo', 'fetchTop3', 'toggleFav', 'updateTradeInfo', 'getSelectedTradeProduct']),
...mapActions(['fetchProductInfo', 'fetchTop3', 'fetchFav', 'toggleFav', 'updateTradeInfo', 'getSelectedTradeProduct']),
refresh() {
this.$refs.slide.refresh();
this.headThumbnailVisible = false;
... ... @@ -205,6 +205,7 @@ export default {
loading && loading.show();
this.fetchTop3({productId});
this.fetchFav({productId});
return this.fetchProductInfo({productId}).then(() => {
loading && loading.hide();
... ... @@ -215,7 +216,9 @@ export default {
loading && loading.hide();
});
},
_toggleFav(isFav) {
async _toggleFav(isFav) {
await this.$yoho.auth();
this.toggleFav({ productId: this.productId, isFav }).then(() => {
const txt = isFav ? '收藏成功' : '取消收藏成功';
... ... @@ -260,8 +263,8 @@ export default {
onSizeSelectSheetHidden() {
this.showSizeSelectSheet = false;
},
buy() {
this.$yoho.auth();
async buy() {
await this.$yoho.auth();
this.selectSizeConfig = {
dest: 'OrderBuyConfirm',
... ... @@ -273,8 +276,8 @@ export default {
onBuyHidden() {
this.showBuySheet = false;
},
sell() {
this.$yoho.auth();
async sell() {
await this.$yoho.auth();
this.selectSizeConfig = {
dest: 'OrderSellConfirm',
... ...
import * as Types from './types';
import { get } from 'lodash';
import Vue from 'vue';
export default {
async fetchProductInfo({commit}, {productId}) {
const queryTasks = ['', '/fav', '/resource', '/activity', '/recommend'].map(path => {
let paramKey = 'product_id';
if (path === '/fav') {
paramKey = 'productId';
}
return this.$api.get(`/api/ufo/product${path}`, {[paramKey]: productId}).then(result => {
const queryTasks = ['', '/resource', '/activity', '/recommend'].map(path => {
return this.$api.get(`/api/ufo/product${path}`, {product_id: productId}).then(result => {
if (result.code === 200) {
return result.data;
} else {
... ... @@ -18,15 +14,37 @@ export default {
});
});
const [detail, isFav, resource, activity, recommend] = await Promise.all(queryTasks);
const [detail, resource, activity, recommend] = await Promise.all(queryTasks);
commit(Types.UPDATE_PRODUCT_DETAIL, Object.assign(detail.product_info, {
resource: get(resource, '[0].data[0]', null),
isFav,
activity: activity || [],
recommend: recommend && recommend.product_list || [],
}));
},
async fetchFav({commit, rootGetters}, {productId}) {
let isLogin = rootGetters.getLogin;
if (!isLogin) {
const user = await Vue.$sdk.getUser();
isLogin = user && user.uid > 1;
}
if (!isLogin) {
return false;
}
const isFav = await this.$api.get('/api/ufo/product/fav', {productId}).then(result => {
if (result.code === 200) {
return result.data;
} else {
return false;
}
});
commit(Types.UPDATE_PRODUCT_FAV, {productId, isFav});
},
async fetchTop3({commit}, {productId}) {
const result = await this.$api.get('/api/ufo/product/top', {product_id: productId});
... ...
... ... @@ -37,6 +37,7 @@ export function defaultState() {
top3: [],
},
topList: {},
fav: {},
/**
* 用户在商品详情页选择的交易信息
... ... @@ -75,6 +76,9 @@ export default function() {
activity(state) {
return state.product.activity;
},
isFav(state) {
return state.fav[state.product.product_id];
},
topList(state) {
return state.topList[state.product.product_id];
},
... ...
... ... @@ -18,15 +18,13 @@ export default {
state.product = payload;
ensureSelectedProduct(state, state.product.product_id);
},
[Types.UPDATE_PRODUCT_TOP3](state, {productId, topList}) {
state.topList[productId] = topList;
[Types.UPDATE_PRODUCT_TOP3](state, { productId, topList }) {
state.topList = {...state.topList, [productId]: topList};
},
[Types.UPDATE_PRODUCT_FAV](state, { productId, isFav}) {
if (state.product.product_id === productId) {
state.product.isFav = isFav;
}
[Types.UPDATE_PRODUCT_FAV](state, { productId, isFav }) {
state.fav = {...state.fav, [productId]: isFav};
},
[Types.UPDATE_SELECTED_PRODUCT_SIZE](state, { productId, sizeId, storageId}) {
[Types.UPDATE_SELECTED_PRODUCT_SIZE](state, { productId, sizeId, storageId }) {
ensureSelectedProduct(state, productId);
const sizeList = state.selectedProductInfo.product.goods_list[0].size_list;
... ...