Authored by TaoHuang

fix by huangtao

... ... @@ -40,7 +40,9 @@ export default {
name: 'BuyOrderConfirm',
props: ['productId', 'storageId'],
data() {
return {};
return {
isActive: false
};
},
components: {
ProductInfo,
... ... @@ -54,6 +56,10 @@ export default {
},
activated() {
this.init();
this.isActive = true;
},
deactivated() {
this.isActive = false;
},
beforeRouteLeave(to, from, next) {
if (to.name !== 'address') {
... ... @@ -85,7 +91,9 @@ export default {
watch: {
address: {
handler() {
this.compute();
if (this.isActive) {
this.compute();
}
},
deep: true
}
... ...
... ... @@ -7,7 +7,7 @@
</div>
<div class="num-wrapper" v-if="superSell">
<i class="iconfont iconplus-minus icon-class" @click="onMinus"></i>
<span class="icon-class count">{{count}}</span>
<span class="icon-class count">{{num}}</span>
<i class="iconfont iconi-add icon-class" @click="onAdd"></i>
</div>
</div>
... ... @@ -32,8 +32,7 @@ export default {
},
data() {
return {
val: this.value,
count: this.num
val: this.value
};
},
methods: {
... ... @@ -44,20 +43,22 @@ export default {
this.$emit('input', this.$refs.input.value);
},
onMinus() {
if (this.count > 1) {
this.count -= 1;
this.$emit('on-num-change', this.count);
if (this.num > 1) {
const count = this.num - 1;
this.$emit('on-num-change', { count, type: 'minus' });
}
},
onAdd() {
this.count += 1;
this.$emit('on-num-change', this.count);
const count = this.num + 1;
this.$emit('on-num-change', { count, type: 'add' });
}
},
watch: {
value(newVal) {
this.val = newVal;
}
},
}
};
</script>
... ...
... ... @@ -21,9 +21,6 @@ export default {
default() {
return {};
}
},
priceType: {
type: String,
}
}
};
... ...
... ... @@ -31,7 +31,7 @@ import OrderMargin from './components/confirm/order-margin';
import OrderFee from './components/confirm/order-fee';
import OrderAgree from './components/confirm/agree';
import { Types, UserType } from 'store/order/order-confirm';
import { get, inRange } from 'lodash';
import { get } from 'lodash';
import { createNamespacedHelpers, mapState } from 'vuex';
... ... @@ -56,6 +56,7 @@ export default {
agreeDesc: '有货卖家协议',
url: 'https://activity.yoho.cn/feature/6773.html?share_id=9479&title=%E9%97%B2%E9%B1%BC%E6%BD%AE%E5%8D%96%E5%AE%B6%E5%8D%8F%E8%AE%AE',
superSell: false,
addNumError: false
};
},
activated() {
... ... @@ -111,13 +112,15 @@ export default {
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', ''),
skup: get(state.product.selectedProductInfo, 'size.skup', ''),
goodPrice,
priceType,
goodBidPrice,
priceBidType,
isSuggest: suggestHighPrice && suggestLowPrice,
suggestHighPrice,
suggestLowPrice
suggestLowPrice,
bidPrice
};
}
})
... ... @@ -130,6 +133,34 @@ export default {
this.submit();
},
compute() {
if (this.productDetail.bidPrice && (Number(this.price) >= this.productDetail.bidPrice)) {
this.$createDialog({
type: 'confirm',
title: `最高求购价${this.productDetail.bidPrice}`,
content: '已有求购高于您的出价,可直接变现',
confirmBtn: {
text: '我再想想',
active: true,
disabled: false,
},
cancelBtn: {
text: '确定变现',
active: false,
disabled: false
},
onCancel: () => {
this.$router.replace({
name: 'sellAskOrder',
query: {
skup: this.productDetail.skup,
price: this.productDetail.bidPrice
}
});
}
}).show();
return;
}
return this.fetchOrderPrice({
address_id: this.address?.address_id,
num: this.num,
... ... @@ -138,14 +169,21 @@ export default {
}).then(result => {
if (result.error) {
this.error = result.error;
this.$createToast({
time: 1500,
txt: result.error,
type: 'txt'
}).show();
if (result.code === 438) {
this.addNumError = true;
}
return;
}
this.error = false;
this.addNumError = false;
});
},
changePrice(val) {
... ... @@ -276,7 +314,12 @@ export default {
}
});
},
onNumChange(count) {
onNumChange({ count, type }) {
console.log(count, type, this.addNumError);
if (type === 'add' && this.addNumError) {
return;
}
this[Types.CHANGE_SELL_NUM](count);
this.compute();
},
... ...
... ... @@ -31,6 +31,7 @@ export default function() {
return {
namespaced: true,
state: {
buyAddress: null,
address: null,
fee: {
income: '',
... ... @@ -200,6 +201,7 @@ export default function() {
if (order.code !== 200) {
return {
code: order.code,
error: order.message
};
}
... ...