...
|
...
|
@@ -16,12 +16,12 @@ |
|
|
type="number"
|
|
|
placeholder="定价需以9结尾 例如1999"
|
|
|
:maxlength="8"
|
|
|
class="ipt-number"
|
|
|
:class="errorTip ? 'ipt-number show-error' : 'ipt-number'"
|
|
|
v-model="chgPrice"
|
|
|
>
|
|
|
<span class="prepend" slot="prepend">¥</span>
|
|
|
</InputUfo>
|
|
|
<p class="error-tip">{{ this.errorTip }}</p>
|
|
|
<p class="error-tip">{{ errorTip }}</p>
|
|
|
<p
|
|
|
:class="
|
|
|
i === computePriceList.length - 1
|
...
|
...
|
@@ -43,7 +43,7 @@ import { createNamespacedHelpers } from "vuex"; |
|
|
import InputUfo from "../price-change/components/input-ufo";
|
|
|
import { debounce } from "lodash";
|
|
|
|
|
|
const { mapActions } = createNamespacedHelpers("order/orderList");
|
|
|
const { mapActions, mapMutations } = createNamespacedHelpers("order/orderList");
|
|
|
export default {
|
|
|
components: { InputUfo },
|
|
|
props: {
|
...
|
...
|
@@ -54,18 +54,24 @@ export default { |
|
|
goodsInfo: {
|
|
|
type: Object,
|
|
|
default: () => ({})
|
|
|
},
|
|
|
orderCode: {
|
|
|
type: Number,
|
|
|
default: 0
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
chgPrice: "",
|
|
|
errorTip: ""
|
|
|
errorTip: "",
|
|
|
computePrice: null
|
|
|
};
|
|
|
},
|
|
|
|
|
|
computed: {
|
|
|
computePriceList() {
|
|
|
return this.computePriceInfo.promotionFormulaList.filter(
|
|
|
const priceInfo = this.computePrice || this.computePriceInfo;
|
|
|
return priceInfo.promotionFormulaList.filter(
|
|
|
({ promotion }) => promotion === "运费" || promotion === "实付金额"
|
|
|
);
|
|
|
}
|
...
|
...
|
@@ -76,9 +82,22 @@ export default { |
|
|
},
|
|
|
methods: {
|
|
|
...mapActions(["computeChangePrice", "changePrice"]),
|
|
|
onChange(price) {
|
|
|
...mapMutations(["setChangePrice"]),
|
|
|
async onChange(price) {
|
|
|
if (this.checkPrice(price)) {
|
|
|
this.computeChangePrice(price);
|
|
|
const res = await this.computeChangePrice({
|
|
|
price,
|
|
|
orderCode: this.orderCode
|
|
|
});
|
|
|
if (typeof res === "string") {
|
|
|
this.errorTip = res;
|
|
|
this.setChangePrice(0);
|
|
|
} else {
|
|
|
this.computePrice = res;
|
|
|
this.setChangePrice(price);
|
|
|
}
|
|
|
} else {
|
|
|
this.setChangePrice(0);
|
|
|
}
|
|
|
},
|
|
|
checkPrice(price) {
|
...
|
...
|
@@ -91,19 +110,8 @@ export default { |
|
|
this.errorTip = "价格只能为正整数";
|
|
|
} else if (!/9$/.test(price)) {
|
|
|
this.errorTip = "出售价格必须以9结尾";
|
|
|
} else if (
|
|
|
this.goodsInfo.bidHighestPrice &&
|
|
|
price > this.goodsInfo.bidHighestPrice
|
|
|
) {
|
|
|
this.errorTip = "您的出价格过高";
|
|
|
} else if (+price === this.goodsInfo.goodPrice) {
|
|
|
} else if (+price === +this.goodsInfo.goodPrice) {
|
|
|
this.errorTip = "前后价格没有变化";
|
|
|
} else if (
|
|
|
this.goodsInfo.leastPrice &&
|
|
|
price > this.goodsInfo.leastPrice
|
|
|
) {
|
|
|
this.errorTip = "您的出价高于最低售价";
|
|
|
valid = true;
|
|
|
} else {
|
|
|
this.errorTip = "";
|
|
|
valid = true;
|
...
|
...
|
@@ -128,6 +136,10 @@ export default { |
|
|
|
|
|
.ipt-number {
|
|
|
margin: 30px 0;
|
|
|
|
|
|
&.show-error {
|
|
|
margin-bottom: 0;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.error-tip {
|
...
|
...
|
|