Authored by lea guo

求购

<template>
<div class="change-bid-price-wrapper"></div>
<div class="change-bid-price-wrapper">
<p class="price-item">
<span>我的求购价:</span>
<span>¥{{ goodsInfo.goodPrice }}</span>
</p>
<p class="price-item">
<span>当前最高求购价:</span>
<span>¥{{ goodsInfo.goodPrice }}</span>
</p>
<p class="price-item">
<span>最低现货价:</span>
<span>¥{{ goodsInfo.leastPrice }}</span>
</p>
<p v-for="(priceInfo, i) in computePriceList" :key="i">
<span>{{ priceInfo.promotion }}:</span>
<span>{{ priceInfo.promotionAmount }}</span>
</p>
<p class="a-tip">Tip: 调整求购价成功后,当前的求购将被关闭</p>
</div>
</template>
<script>
export default {};
import { createNamespacedHelpers } from "vuex";
const { mapActions } = createNamespacedHelpers("order/orderList");
export default {
props: {
computePriceInfo: {
type: Object,
default: () => ({})
},
goodsInfo: {
type: Object,
default: () => ({})
}
},
computed: {
computePriceList() {
return this.computePriceInfo.promotionFormulaList.filter(
({ promotion }) => promotion === "运费" || promotion === "实付金额"
);
}
},
methods: {
...mapActions(["computeChangePrice", "changePrice"])
}
};
</script>
<style scoped>
<style lang="scss" scoped>
.change-bid-price-wrapper {
font-size: 12px;
color: #000;
padding: 0 38px;
letter-spacing: 0;
.tip {
color: #999;
}
}
</style>
\ No newline at end of file
... ...
... ... @@ -3,6 +3,7 @@
import { orderActionsMap, ownType } from 'constants/order-constants';
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 { mapMutations: inSaleMapMutations } = createNamespacedHelpers(
... ... @@ -11,14 +12,25 @@ const { mapMutations: inSaleMapMutations } = createNamespacedHelpers(
export default {
methods: {
...mapActions(['cancelTradeConfirmInfo', 'cancelTrade', 'deleteOrder']),
...mapActions([
'cancelTradeConfirmInfo',
'cancelTrade',
'deleteOrder',
'computeChangePrice',
'changePrice',
]),
...mapMutations(['filterOrderList', 'resetData']),
...inSaleMapMutations(['filterInSaleOrderList']),
// 订单列表
async onAction({ action, order }) {
const { owner = ownType.SELL } = this.$route.params;
const { orderCode, realPrice = '', bidDepositInfo = {} } = order;
const {
orderCode,
realPrice = '',
bidDepositInfo = {},
goodsInfo = {},
} = order;
switch (action.name) {
case orderActionsMap.DEL_ORDER.name:
... ... @@ -140,7 +152,27 @@ export default {
}
case orderActionsMap.CHANGE_BID_PRICE.name: {
this.$createDialog({ type: 'prompt' }).show();
const { goodPrice } = goodsInfo;
const computePriceInfo = await this.computeChangePrice({
orderCode,
price: goodPrice,
});
this.$createDialog(
{
type: 'prompt',
confirmBtn: { text: '调整求购价' },
cancelBtn: { active: true },
},
createElement => {
return [
createElement(DialogChangeBidPrice, {
props: { computePriceInfo, goodsInfo },
slot: 'content',
}),
];
},
).show();
break;
}
case orderActionsMap.NOT_SOLD.name: {
... ...
... ... @@ -157,6 +157,29 @@ export default function() {
return res.code === 200 ? res.data : null;
},
// 买家调价计算
async computeChangePrice(_, { orderCode, price }) {
const res = await this.$api.get(
'/api/order/buyerask/computechangeprice',
{
orderCode: `${orderCode}`,
price: +price,
},
);
return res.code === 200 ? res.data : null;
},
// 买家调价
async changePrice(_, { orderCode, price }) {
const res = await this.$api.post('/api/order/buyerask/changeprice', {
orderCode: `${orderCode}`,
price: +price,
});
return res.code === 200 ? res.data : null;
},
},
getters: {},
};
... ...
/* eslint-disable lines-around-comment */
/* eslint-disable spaced-comment */
// 查询订单数量
const ORDER_COUNT = 'ufo.order.getAllCnt';
... ... @@ -21,7 +23,6 @@ const SELLER_ASK_PRE_COMPUTE = 'ufo.seller.bid.compute';
//变现
const SELLER_ASK_PUBLISH = 'ufo.seller.bid.publish';
module.exports = {
ORDER_COUNT,
BUYER_ASK_CONFIG,
... ...
... ... @@ -13,7 +13,7 @@ module.exports = {
auth: true,
path: 'shopping/bid',
api: API.BUYER_ASK_CONFIG,
params: {}
params: {},
},
'/api/order/buyeraskcompute': {
ufo: true,
... ... @@ -21,9 +21,9 @@ module.exports = {
path: 'shopping/bid',
api: API.BUYER_ASK_COMPUTE,
params: {
price: {type: Number, required: true},
storage_id: {type: Number, required: true},
}
price: { type: Number, required: true },
storage_id: { type: Number, required: true },
},
},
'/api/order/buyeraskprepublish': {
ufo: true,
... ... @@ -31,10 +31,10 @@ module.exports = {
path: 'shopping/bid',
api: API.BUYER_ASK_TIPS,
params: {
price: {type: Number, required: true},
storage_id: {type: Number, required: true},
address_id: {type: String, required: true},
}
price: { type: Number, required: true },
storage_id: { type: Number, required: true },
address_id: { type: String, required: true },
},
},
'/api/order/buyeraskpublish': {
... ... @@ -43,11 +43,11 @@ module.exports = {
path: 'shopping/bid',
api: API.BUYER_ASK_PUBLISH,
params: {
price: {type: Number, required: true},
storage_id: {type: Number, required: true},
address_id: {type: String, required: true},
time_limit_id: {type: Number, required: true}, // 有效期
}
price: { type: Number, required: true },
storage_id: { type: Number, required: true },
address_id: { type: String, required: true },
time_limit_id: { type: Number, required: true }, // 有效期
},
},
'/api/order/buyerask/computechangeprice': {
... ... @@ -56,9 +56,9 @@ module.exports = {
path: 'shopping/bid',
api: API.BUYER_ASK_COMPUTE_CHANGE_PRICE,
params: {
price: {type: Number, required: true},
orderCode: {type: String, required: true},
}
price: { type: Number, required: true },
orderCode: { type: String, required: true },
},
},
'/api/order/buyerask/prechangeprice': {
ufo: true,
... ... @@ -66,9 +66,9 @@ module.exports = {
path: 'shopping/bid',
api: API.BUYER_ASK_PRE_CHANGE_PRICE,
params: {
price: {type: Number, required: true},
orderCode: {type: String, required: true},
}
price: { type: Number, required: true },
orderCode: { type: String, required: true },
},
},
'/api/order/buyerask/changeprice': {
... ... @@ -77,9 +77,8 @@ module.exports = {
path: 'shopping/bid',
api: API.BUYER_ASK_CHANGE_PRICE,
params: {
price: {type: Number, required: true},
orderCode: {type: String, required: true},
}
}
price: { type: Number, required: true },
orderCode: { type: String, required: true },
},
},
};
... ...
... ... @@ -226,7 +226,6 @@ module.exports = {
auth: true,
ufo: true,
api: 'ufo.sellerOrder.computePublishPrd',
},
'/api/order/ordercount': {
... ... @@ -235,7 +234,7 @@ module.exports = {
api: API.ORDER_COUNT,
params: {
tabType: { type: String, require: true }, // 订单来源
}
},
},
// 判断用户状态
... ... @@ -310,7 +309,7 @@ module.exports = {
auth: true,
path: 'payment',
api: 'ufo.order.pay',
params: {}
params: {},
},
// 定单商品详情
... ... @@ -318,14 +317,14 @@ module.exports = {
ufo: true,
auth: true,
api: 'ufo.order.goodsDetail',
params: {}
params: {},
},
'/api/order/status': {
ufo: true,
auth: true,
api: 'ufo.order.payDetail',
params: {}
params: {},
},
// 订单物流信息
... ... @@ -372,22 +371,24 @@ module.exports = {
depotNum: { type: Number, require: true }, // 鉴定中心id
},
},
//瑕疵接受
// 瑕疵接受
'/api/order/flawaccept': {
ufo: true,
auth: true,
api: 'ufo.buyer.miniFaultAccept',
params: {
orderCode: { type: String, require: true }, // 订单编号
}
},
},
//瑕疵拒绝
// 瑕疵拒绝
'/api/order/flawreject': {
ufo: true,
auth: true,
api: 'ufo.buyer.miniFaultReject',
params: {
orderCode: { type: String, require: true }, // 订单编号
}
}
},
},
};
... ...