Authored by TaoHuang

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

... ... @@ -21,7 +21,7 @@
<p class="name">{{ item.consignee }}</p>
<p class="mobile">{{ item.mobile }}</p>
<div v-if="item.is_default === 'Y'" class="tag-btn">默认</div>
<div v-if="item.tag_code" class="tag-btn">{{ item.tag }}</div>
<div v-if="item.tag_code && item.tag" class="tag-btn">{{ item.tag }}</div>
<div
class="option-btn"
:data-item="JSON.stringify(item)"
... ... @@ -118,7 +118,10 @@ export default {
}
this.$router.push({
name: 'addressEdit'
name: 'addressEdit',
query: {
fromPage: this.pageName
}
});
}
},
... ...
... ... @@ -317,7 +317,8 @@ export default {
activated() {
let addressInfo = this.updateAddressInfo;
this.isUpdate = addressInfo.isUpdate;
this.isUpdate =
addressInfo.isUpdate && this.$route.query.fromPage !== 'OrderSellConfirm';
this.orderCode = addressInfo.orderCode;
this.title = addressInfo.isUpdate ? '编辑地址' : '添加地址';
... ...
... ... @@ -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 {
... ...
... ... @@ -133,7 +133,10 @@ export default {
Object.assign(updateInfo, { isUpdate: true, orderCode: orderCode });
this.STORE_UPDATE_ADDRESS_INFO(updateInfo);
this.$router.push({
name: "addressEdit"
name: 'addressEdit',
query: {
fromPage: 'order-list'
}
});
break;
}
... ...
/* eslint-disable operator-linebreak */
/* eslint-disable space-before-function-paren */
import { createNamespacedHelpers } from 'vuex';
const { mapActions } = createNamespacedHelpers('order/orderList');
const { mapActions, mapState } = createNamespacedHelpers('order/orderList');
import { orderActionsMap, ownType } from 'constants/order-constants';
import DialogConfirmInfo from '../../components/dialog-confirm-info';
import DialogChangeBidPrice from '../../components/dialog-change-bid-price';
export default {
data() {
... ... @@ -12,8 +13,17 @@ export default {
isMixin: true,
};
},
computed: {
...mapState(['changePrice']),
},
methods: {
...mapActions(['cancelTradeConfirmInfo', 'cancelTrade', 'deleteOrder']),
...mapActions([
'cancelTradeConfirmInfo',
'cancelTrade',
'deleteOrder',
'computeChangePrice',
'confirmChangePrice',
]),
async onSellerOrderAction({ action, order }) {
const { owner = ownType.SELL } = this.$route.params;
const { orderCode, earnestMoney } = order;
... ... @@ -89,7 +99,12 @@ export default {
},
async onBuyerOrderAction({ action, order }) {
const { owner = ownType.SELL } = this.$route.params;
const { orderCode, priceInfo = {}, bidDepositInfo = {} } = order;
const {
orderCode,
priceInfo = {},
bidDepositInfo = {},
goodsInfo,
} = order;
switch (action.name) {
case orderActionsMap.DEL_ORDER.name: {
... ... @@ -112,6 +127,57 @@ export default {
}).show();
break;
}
case orderActionsMap.CHANGE_BID_PRICE.name: {
const { goodPrice } = goodsInfo;
const computePriceInfo = await this.computeChangePrice({
orderCode,
price: goodPrice,
});
if (typeof computePriceInfo === 'string') {
this.$createToast({
type: 'alert',
txt: computePriceInfo,
mask: true,
}).show();
return;
}
this.$createDialog(
{
type: 'prompt',
confirmBtn: { text: '调整求购价' },
cancelBtn: { active: true },
onConfirm: async () => {
if (!this.changePrice) {
return;
}
const isOk = await this.confirmChangePrice({
price: this.changePrice,
orderCode,
});
if (isOk) {
this.fetchOrderDetail(this.$route.params);
}
},
},
createElement => {
return [
createElement(DialogChangeBidPrice, {
props: {
computePriceInfo,
goodsInfo,
orderCode,
},
slot: 'content',
}),
];
},
).show();
break;
}
case orderActionsMap.CANCEL_ORDER.name: {
let confirmInfo = await this.cancelTradeConfirmInfo({
orderCode,
... ...
... ... @@ -5,19 +5,24 @@ import { createNamespacedHelpers } from 'vuex';
import DialogConfirmInfo from '../../components/dialog-confirm-info';
import DialogChangeBidPrice from '../../components/dialog-change-bid-price';
const { mapActions, mapMutations } = createNamespacedHelpers('order/orderList');
const { mapActions, mapMutations, mapState } = createNamespacedHelpers(
'order/orderList',
);
const { mapMutations: inSaleMapMutations } = createNamespacedHelpers(
'order/inSaleOrderList',
);
export default {
computed: {
...mapState(['changePrice']),
},
methods: {
...mapActions([
'cancelTradeConfirmInfo',
'cancelTrade',
'deleteOrder',
'computeChangePrice',
'changePrice',
'confirmChangePrice',
]),
...mapMutations(['filterOrderList', 'resetData']),
...inSaleMapMutations(['filterInSaleOrderList']),
... ... @@ -158,16 +163,43 @@ export default {
price: goodPrice,
});
if (typeof computePriceInfo === 'string') {
this.$createToast({
type: 'alert',
txt: computePriceInfo,
mask: true,
}).show();
return;
}
this.$createDialog(
{
type: 'prompt',
confirmBtn: { text: '调整求购价' },
cancelBtn: { active: true },
onConfirm: async () => {
if (!this.changePrice) {
return;
}
const isOk = await this.confirmChangePrice({
price: this.changePrice,
orderCode,
});
if (isOk) {
this.resetData();
this.fetchData(this.$route.params);
}
},
},
createElement => {
return [
createElement(DialogChangeBidPrice, {
props: { computePriceInfo, goodsInfo },
props: {
computePriceInfo,
goodsInfo,
orderCode,
},
slot: 'content',
}),
];
... ...
... ... @@ -35,7 +35,11 @@
</ul>
</scroll>
<empty-list class="empty-wrapper" tip="这里什么都没有..." v-show="isShowEmpty" />
<empty-list
class="empty-wrapper"
tip="这里什么都没有..."
v-show="isShowEmpty"
/>
</div>
</layout-app>
</template>
... ...
... ... @@ -10,6 +10,9 @@ const initailData = () => ({
currentStatus: null,
routeParamStatus: null,
isShowEmpty: false,
// 求购调价
changePrice: 0,
});
export default function() {
... ... @@ -49,6 +52,9 @@ export default function() {
state.pagetotal = 0;
state.pullUpLoad = true;
},
setChangePrice(state, price) {
state.changePrice = price;
},
resetData(state) {
const s = initailData();
... ... @@ -168,16 +174,19 @@ export default function() {
},
);
return res.code === 200 ? res.data : null;
return res.code === 200 ? res.data : res.message || '';
},
// 买家调价
async changePrice(_, { orderCode, price }) {
async confirmChangePrice({ commit }, { orderCode, price }) {
const res = await this.$api.post('/api/order/buyerask/changeprice', {
orderCode: `${orderCode}`,
price: +price,
});
if (res.code) {
commit('setChangePrice', 0);
}
return res.code === 200 ? res.data : null;
},
},
... ...