Authored by lea guo

订单列表删除

... ... @@ -12,23 +12,38 @@
<script>
import { orderActionsMap } from "../../../../constants/order-constants";
import { createNamespacedHelpers } from "vuex";
const { mapActions } = createNamespacedHelpers("order/orderList");
export default {
props: {
actionList: {
type: Array,
default: () => []
},
code: {
type: Number,
default: 0
}
},
methods: {
...mapActions(["deleteOrder"]),
onAction(action) {
const { owner } = this.$route.params;
if (action.name === orderActionsMap.DEL_ORDER.name) {
this.createDialog({
this.$createDialog({
type: "confirm",
content: "确认删除订单?",
confirmBtn: { text: "确定" },
cancelBtn: { text: "取消" }
onConfirm: async () => {
const isOk = await this.deleteOrder({
orderCode: this.code,
owner
});
const txt = isOk ? "删除成功" : "删除失败";
this.$createToast({ txt, type: "txt" }).show();
}
}).show();
}
},
createDialog(options) {
... ...
... ... @@ -11,7 +11,7 @@
<li v-for="order in orderList" :key="order.orderCode">
<order-list-item :order="order" />
<!-- 订单操作 -->
<order-actions :actionList="order.buttons" />
<order-actions :actionList="order.buttons" :code="order.orderCode" />
</li>
</ul>
<Modal v-model="isShowModal" @on-sure="() => {}"></Modal>
... ...
... ... @@ -28,6 +28,11 @@ export default function() {
state.pullUpLoad = false;
}
},
filterOrderList(state, orderCode) {
state.orderList = state.orderList.filter(
order => order.orderCode !== orderCode,
);
},
setOrderStatus(state, currentStatus) {
state.page = 1;
state.orderList = [];
... ... @@ -65,6 +70,29 @@ export default function() {
commit('setOrderList', res.data);
}
},
/**
* 买家删除订单
* @param {
* orderCode: 订单编码
* owner: 订单来源
* } param1
*/
async deleteOrder({ commit }, { orderCode, owner }) {
// owner: ownType
const res = await this.$api.get(`/api/${owner}/order/delete`, {
orderCode,
});
const { code, data } = res;
// data 为true时删除成功
if (code === 200) {
if (data) {
commit('filterOrderList', orderCode);
}
}
return data;
},
},
getters: {},
};
... ...
... ... @@ -116,7 +116,7 @@ module.exports = {
},
// 确认收货
'/api/buyer/confirm/receipt': {
'/api/buy/confirm/receipt': {
ufo: true,
auth: true,
api: 'ufo.buyer.confirm',
... ... @@ -126,7 +126,7 @@ module.exports = {
},
// 不卖了 确认提示信息
'/api/seller/trade/cancle/confirm/info': {
'/api/sell/trade/cancle/confirm/info': {
auth: true,
ufo: true,
api: 'ufo.sellerOrder.cancelConfirm',
... ... @@ -136,7 +136,7 @@ module.exports = {
},
// 不卖了
'/api/seller/trade/cancel': {
'/api/sell/trade/cancel': {
auth: true,
ufo: true,
api: 'ufo.sellerOrder.cancel',
... ... @@ -146,7 +146,7 @@ module.exports = {
},
// 取消订单
'/api/buyer/trade/cancel': {
'/api/buy/trade/cancel': {
auth: true,
ufo: true,
api: 'ufo.buyer.cancel',
... ... @@ -155,31 +155,31 @@ module.exports = {
},
},
// 买家删除订单
'/api/buyer/order/delete': {
// 买家取消订单预信息
'/api/buy/trade/cancel/confirm/info': {
auth: true,
ufo: true,
api: 'ufo.buyer.delete',
api: 'ufo.buyer.cancelCompute',
params: {
orderCode: { type: Number, require: true }, // 订单编号
},
},
// 卖家删除订单
'/api/seller/order/delete': {
// 买家删除订单
'/api/buy/order/delete': {
auth: true,
ufo: true,
api: 'ufo.sellerOrder.delete',
api: 'ufo.buyer.delete',
params: {
orderCode: { type: Number, require: true }, // 订单编号
},
},
// 买家取消订单预信息
'/pai/buyer/trade/cancel/info': {
// 卖家删除订单
'/api/sell/order/delete': {
auth: true,
ufo: true,
api: 'ufo.buyer.cancelCompute',
api: 'ufo.sellerOrder.delete',
params: {
orderCode: { type: Number, require: true }, // 订单编号
},
... ... @@ -239,7 +239,7 @@ module.exports = {
auth: true,
api: 'ufo.order.compute',
params: {
skup: { type: Number, require: true }
skup: { type: Number, require: true },
},
},
... ... @@ -250,7 +250,7 @@ module.exports = {
path: 'shopping',
api: 'ufo.order.payment',
params: {
skup: { type: Number, require: true }
skup: { type: Number, require: true },
},
},
... ... @@ -261,7 +261,7 @@ module.exports = {
path: 'shopping',
api: 'ufo.order.selectCoupon',
params: {
skup: { type: Number, require: true }
skup: { type: Number, require: true },
},
},
... ...