Authored by 陈峰

commit

... ... @@ -120,6 +120,7 @@ export default {
this.errorTip = '前后价格没有变化';
} else if (this.skc.suggestMaxPrice && price > this.skc.suggestMaxPrice) {
this.errorTip = '超出建议价将被限制展示,建议下调至合理价格区间';
valid = true;
} else {
this.errorTip = '';
valid = true;
... ...
... ... @@ -92,12 +92,12 @@ export default {
onNoSale(skc) {
this.$refs.modalUnstock.show({skc});
},
refreshProduct(skc, mergeData) {
this.MERGE_CHANGEPRICE_DATA({skc, mergeData}); //eslint-disable-line
refreshProduct() {
this.fetchProduct({
productId: this.$route.params.orderId,
page: 1,
onlyProduct: true
page: this.page,
pageSize: this.pageSize,
refresh: true
});
},
async onChangePriceSure({skc, price}) {
... ... @@ -115,9 +115,7 @@ export default {
txt: '调价成功',
type: 'success',
}).show();
this.refreshProduct(skc, {
price
});
this.refreshProduct();
} else {
this.$createToast({
txt: result.message || '调价失败',
... ... @@ -140,9 +138,7 @@ export default {
txt: '下架成功',
type: 'correct'
}).show();
this.refreshProduct(skc, {
storageNum: skc.storageNum - num
});
this.refreshProduct();
} else {
this.$createToast({
txt: result.message || '下架失败',
... ...
import * as Types from './types';
import {first, get, flatten} from 'lodash';
export default {
async fetchProduct({commit}, {productId, page = 1, refresh = false, onlyProduct = false}) {
async fetchProduct({commit}, {productId, page = 1, refresh = false}) {
commit(Types.FETCH_ORDER_PRODUCT_REQUEST);
const result = await this.$api.get('/api/ufo/seller/entryGoodsSizeList', {
productId,
page
});
let result;
if (refresh) {
const results = await Promise.all(Array.from(new Array(page)).map((v, i) => {
return this.$api.get('/api/ufo/seller/entryGoodsSizeList', {
productId,
page: i + 1
});
}));
result = {
code: 200,
data: {
productInfo: get(first(results), 'data.productInfo'),
data: flatten(results.map(r => get(r, 'data.data')))
}
};
} else {
result = await this.$api.get('/api/ufo/seller/entryGoodsSizeList', {
productId,
page
});
}
if (result && result.code === 200) {
commit(Types.FETCH_ORDER_PRODUCT_SUCCESS, {
order: result.data,
refresh,
onlyProduct
});
} else {
commit(Types.FETCH_ORDER_PRODUCT_FAILD);
... ...
... ... @@ -8,19 +8,16 @@ export default {
[Types.FETCH_ORDER_PRODUCT_FAILD](state) {
state.fetchingPro = false;
},
[Types.FETCH_ORDER_PRODUCT_SUCCESS](state, {order, refresh, onlyProduct}) {
[Types.FETCH_ORDER_PRODUCT_SUCCESS](state, {order, refresh}) {
state.fetchingPro = false;
if (onlyProduct) {
if (order.productInfo && state.productInfo.productId !== order.productInfo.productId || refresh) {
state.productInfo = order.productInfo;
} else {
if (order.productInfo && state.productInfo.productId !== order.productInfo.productId) {
state.productInfo = order.productInfo;
}
if (refresh) {
state.skcs = order.data;
} else if (order.data) {
state.skcs = state.skcs.concat(order.data);
}
}
if (refresh) {
state.skcs = order.data;
} else if (order.data) {
state.skcs = state.skcs.concat(order.data);
}
},
[Types.MERGE_CHANGEPRICE_DATA](state, {skc, mergeData}) {
... ...