...
|
...
|
@@ -44,14 +44,9 @@ import ImgSize from 'components/img-size'; |
|
|
import {Button} from 'cube-ui';
|
|
|
import ScrollView from 'components/scroll-view';
|
|
|
import ProductList from './components/product-list';
|
|
|
import Vue from 'vue';
|
|
|
import {Toast} from 'cube-ui';
|
|
|
import {createNamespacedHelpers} from 'vuex';
|
|
|
|
|
|
|
|
|
Vue.use(Toast);
|
|
|
|
|
|
const {mapState, mapActions} = createNamespacedHelpers('ufo/order');
|
|
|
const {mapState, mapActions, mapMutations} = createNamespacedHelpers('ufo/order');
|
|
|
|
|
|
export default {
|
|
|
name: 'OrderPage',
|
...
|
...
|
@@ -73,6 +68,7 @@ export default { |
|
|
return store.dispatch('ufo/order/fetchProduct', {productId: router.params.orderId});
|
|
|
},
|
|
|
methods: {
|
|
|
...mapMutations(['MERGE_CHANGEPRICE_DATA']),
|
|
|
...mapActions(['fetchProduct', 'postChangePrice', 'postNoSale']),
|
|
|
async onPullingUp() {
|
|
|
const beginCount = this.skcs.length;
|
...
|
...
|
@@ -95,21 +91,10 @@ export default { |
|
|
onNoSale(skc) {
|
|
|
this.$refs.modalUnstock.show({skc});
|
|
|
},
|
|
|
refreshProduct(storageId) {
|
|
|
const findInx = this.skcs.findIndex(skc => skc.goodsInfo.storageId === storageId);
|
|
|
const findPage = parseInt(findInx / this.pageSize, 10) + ((findInx % this.pageSize) ? 1 : 0);
|
|
|
|
|
|
console.log(findInx, findPage)
|
|
|
this.fetchProduct({
|
|
|
productId: this.$route.params.orderId,
|
|
|
page: findPage,
|
|
|
refresh: false,
|
|
|
storageId
|
|
|
});
|
|
|
refreshProduct(skc, mergeData) {
|
|
|
this.MERGE_CHANGEPRICE_DATA({skc, mergeData}); //eslint-disable-line
|
|
|
},
|
|
|
async onChangePriceSure({skc, price}) {
|
|
|
this.refreshProduct(skc.storageId);
|
|
|
return;
|
|
|
const result = await this.postChangePrice({
|
|
|
product_id: this.productInfo.productId,
|
|
|
storage_id: skc.storageId,
|
...
|
...
|
@@ -124,7 +109,9 @@ console.log(findInx, findPage) |
|
|
txt: '调价成功',
|
|
|
type: 'success',
|
|
|
}).show();
|
|
|
this.refreshProduct(skc.storageId);
|
|
|
this.refreshProduct(skc, {
|
|
|
price
|
|
|
});
|
|
|
} else {
|
|
|
this.$createToast({
|
|
|
txt: result.message || '调价失败',
|
...
|
...
|
@@ -147,7 +134,9 @@ console.log(findInx, findPage) |
|
|
txt: '下架成功',
|
|
|
type: 'correct'
|
|
|
}).show();
|
|
|
this.refreshProduct(skc.storageId);
|
|
|
this.refreshProduct(skc, {
|
|
|
storageNum: skc.storageNum - num
|
|
|
});
|
|
|
} else {
|
|
|
this.$createToast({
|
|
|
txt: result.message || '下架失败',
|
...
|
...
|
|