wangfukang 2 days ago
parent
commit
0a20809e8f
  1. 10
      src/api/index.js
  2. 2
      src/views/app/business/deliverytruck/deliveryTruck.vue
  3. 2
      src/views/app/business/expressCompany/expressCompany.vue
  4. 201
      src/views/app/business/logistics/logistics.vue
  5. 1
      src/views/app/shop/shop.vue
  6. 4
      src/views/sys/order-manage/orderManage.vue

10
src/api/index.js

@ -774,6 +774,16 @@ export const runshOrder = (params) => {
return postRequest('/mall/delivery/reassignWorker', params)
}
// 指派/接取中转配送单
export const transferAccept = (params) => {
return postRequest('/mall/delivery/transferAccept', params)
}
// 改派中转配送单
export const transferReassign = (params) => {
return postRequest('/mall/delivery/transferReassign', params)
}
// 配送单转单记录
export const getDeliveryReassignRecords = (params) => {
return getRequest('/mall/delivery/reassignRecords', params)

2
src/views/app/business/deliverytruck/deliveryTruck.vue

@ -298,7 +298,7 @@ export default {
{ title: '发布人', key: 'userName', width: 130 },
{ title: '类型', width: 120, render: (h, p) => h('Tag', p.row.postType === 'partner' ? this.partnerText(p.row.partnerType) : '校园墙') },
{ title: '分类', key: 'categoryName', width: 120 },
{ title: '审核', key: 'auditStatus', width: 90, render: (h, p) => h('Tag', { props: { color: this.auditColor(p.row.auditStatus) } }, this.auditText(p.row.auditStatus)) },
{ title: '审核', key: 'auditStatus', width: 110, render: (h, p) => h('Tag', { props: { color: this.auditColor(p.row.auditStatus) } }, this.auditText(p.row.auditStatus)) },
{ title: '热度', key: 'hotScore', width: 90, sortable: true },
{ title: '赞/评/举报', width: 120, render: (h, p) => h('span', `${p.row.likeCount || 0}/${p.row.commentCount || 0}/${p.row.complaintCount || 0}`) },
{ title: '浏览', key: 'browseCount', width: 80 },

2
src/views/app/business/expressCompany/expressCompany.vue

@ -299,7 +299,7 @@ export default {
{ title: "发布人", key: "userName", width: 130 },
{ title: "分类", key: "categoryName", width: 100 },
{ title: "价格", key: "price", width: 90 },
{ title: "审核", key: "auditStatus", width: 90, render: (h, p) => h("Tag", { props: { color: this.auditColor(p.row.auditStatus) } }, this.auditText(p.row.auditStatus)) },
{ title: "审核", key: "auditStatus", width: 110, render: (h, p) => h("Tag", { props: { color: this.auditColor(p.row.auditStatus) } }, this.auditText(p.row.auditStatus)) },
{ title: "状态", key: "status", width: 100, render: (h, p) => h("Tag", { props: { color: this.goodsStatusColor(p.row.status) } }, this.goodsStatusText(p.row.status)) },
{ title: "举报", key: "complaintCount", width: 80 },
{ title: "浏览", key: "browseCount", width: 80 },

201
src/views/app/business/logistics/logistics.vue

@ -99,6 +99,8 @@
<Tabs v-else v-model="deliveryTab" :animated="false" @on-click="changeDeliveryTab">
<TabPane :label="'待取货(' + deliveryCounts.daiqu + ')'" name="daiqu"></TabPane>
<TabPane :label="'待送达(' + deliveryCounts.daisong + ')'" name="daisong"></TabPane>
<TabPane :label="'中转未接单(' + deliveryCounts.transferUnaccepted + ')'" name="transferUnaccepted"></TabPane>
<TabPane :label="'中转待送达(' + deliveryCounts.transferPendingArrive + ')'" name="transferPendingArrive"></TabPane>
<TabPane label="已完成" name="wancheng"></TabPane>
<TabPane label="已取消" name="quxiao"></TabPane>
</Tabs>
@ -127,9 +129,9 @@
<div v-else-if="tabName === 'baseDeliveryFee'" style="padding: 20px 0;">
<Form ref="baseDeliveryFeeForm" :model="baseDeliveryFeeForm" :label-width="130" style="width: 460px;">
<FormItem label="基础配送费">
<InputNumber v-model="baseDeliveryFeeForm.baseDeliveryFee" :min="0" :precision="2" style="width: 220px" />
<InputNumber v-model="baseDeliveryFeeForm.baseDeliveryFee" :min="0.01" :precision="2" style="width: 220px" />
<span style="margin-left: 8px;"></span>
<div style="color: #999; font-size: 12px; line-height: 22px;">可设置为0最多保留2位小数</div>
<div style="color: #999; font-size: 12px; line-height: 22px;">最小0.01最多保留2位小数</div>
</FormItem>
<FormItem>
<Button type="primary" :loading="baseDeliveryFeeLoading" @click="saveBaseDeliveryFeeSetting">保存</Button>
@ -269,6 +271,8 @@
orderSchedulingAdmin,
getMatchingWorkerListData,
runshOrder,
transferAccept,
transferReassign,
getDeliveryTimeSetting,
saveDeliveryTimeSetting,
getCustomerPhoneSetting,
@ -291,6 +295,8 @@
const DELIVERY_STATUS_MAP = {
daiqu: 1,
daisong: 2,
transferUnaccepted: 1,
transferPendingArrive: null,
wancheng: 3,
quxiao: 4
};
@ -337,6 +343,7 @@
sortField: "avgTime",
regionId: regionId,
fromAdmin: true,
transferWorkerOnly: false,
pageNum: 1,
pageSize: 10
},
@ -397,7 +404,9 @@
},
deliveryCounts: {
daiqu: 0,
daisong: 0
daisong: 0,
transferUnaccepted: 0,
transferPendingArrive: 0
},
workerOrderCounts: {
daiqu: 0,
@ -534,6 +543,53 @@
}
}];
},
buildTransferWorkerColumns() {
return [ {
title: "配送人员",
key: "workerName",
minWidth: 200,
align: "center",
render: (h, params) => {
const isFullTime = params.row.isFullTime == 1;
return h("div", [
h("div", params.row.workerName || "-"),
h("Tag", {
props: {
color: isFullTime ? "green" : "orange"
},
style: {
marginTop: "4px"
}
}, isFullTime ? "全职配送员" : "兼职配送员")
]);
}
}, {
title: "联系电话",
key: "mobile",
minWidth: 160,
align: "center",
}, {
title: "待送达中转点订单",
key: "orderTransferPendingCount",
width: 160,
align: "center",
render: (h, params) => h("span", this.toNumber(params.row.orderTransferPendingCount))
}, {
title: "操作",
key: "action",
width: 120,
align: "center",
fixed: "right",
render: (h, params) => {
if (this.isCurrentTransferWorker(params.row)) return h("span", "当前中转员");
return h("a", {
on: {
click: () => this.goTransferOrder(params.row)
}
}, this.transferActionType === "transferReassign" ? "改派" : "指派");
}
}];
},
buildOrderColumns(clickableWorker = true) {
return [{
title: "订单时间",
@ -775,18 +831,39 @@
},
getDeliveryOrders(silent = false) {
if (!silent) this.loading = true;
const params = this.cleanParams(this.deliverySearchForm);
const params = this.buildDeliveryOrderParams();
delete params.workerId;
return orderSchedulingAdmin(params).then((res) => {
if (this.isSuccess(res)) {
const result = res.result || {};
this.data = this.normalizeRecords(result.records);
this.total = Number(result.total) || 0;
this.setTransferUnacceptedCount(result);
}
}).finally(() => {
if (!silent) this.loading = false;
});
},
buildDeliveryOrderParams() {
const params = this.cleanParams(this.deliverySearchForm);
if (this.isTransferUnacceptedTab()) {
params.status = DELIVERY_STATUS_MAP.transferUnaccepted;
params.transferDelivery = 1;
params.transferWorkerEmpty = true;
} else if (this.isTransferPendingArriveTab()) {
delete params.status;
params.transferDelivery = 1;
params.transferArriveEmpty = true;
params.transferWorkerNotEmpty = true;
}
return params;
},
isTransferUnacceptedTab() {
return this.tabName === "delivery" && this.deliveryTab === "transferUnaccepted";
},
isTransferPendingArriveTab() {
return this.tabName === "delivery" && this.deliveryTab === "transferPendingArrive";
},
openWorkerOrders(row) {
if (!row || !row.workerId) {
this.$Message.warning("该订单暂无配送员");
@ -960,13 +1037,26 @@
};
return Promise.all([orderSchedulingAdmin(buildParams(1)), orderSchedulingAdmin(buildParams(2))]).then(([daiqu, daisong]) => {
if (this.isSuccess(daiqu)) {
this.deliveryCounts.daiqu = Number((daiqu.result || {}).total) || 0;
const result = daiqu.result || {};
this.deliveryCounts.daiqu = Number(result.total) || 0;
this.setTransferCounts(result);
}
if (this.isSuccess(daisong)) {
this.deliveryCounts.daisong = Number((daisong.result || {}).total) || 0;
}
});
},
setTransferUnacceptedCount(result) {
this.setTransferCounts(result);
},
setTransferCounts(result) {
if (result && result.transferUnacceptedCount !== undefined) {
this.deliveryCounts.transferUnaccepted = Number(result.transferUnacceptedCount) || 0;
}
if (result && result.transferPendingArriveCount !== undefined) {
this.deliveryCounts.transferPendingArrive = Number(result.transferPendingArriveCount) || 0;
}
},
setHallCounts(result) {
this.hallCounts = {
waimai: 0,
@ -1056,7 +1146,7 @@
regionId: this.baseDeliveryFeeForm.regionId
}).then((res) => {
if (res.success) {
this.baseDeliveryFeeForm.baseDeliveryFee = res.result == null ? 0 : Number(res.result);
this.baseDeliveryFeeForm.baseDeliveryFee = res.result == null ? 0.01 : Number(res.result);
}
});
},
@ -1066,8 +1156,8 @@
this.$Message.warning("请输入基础配送费");
return;
}
if (Number(fee) < 0) {
this.$Message.warning("基础配送费不能小于0");
if (Number(fee) < 0.01) {
this.$Message.warning("基础配送费不能小于0.01元");
return;
}
if (!/^\d+(\.\d{1,2})?$/.test(String(fee))) {
@ -1113,24 +1203,40 @@
this.$Message.warning("请选择配送员");
return;
}
const actionText = this.transferActionType === "reassign" ? "改派" : "指派";
const isTransferAssign = this.transferActionType === "transferAssign";
const isTransferReassign = this.transferActionType === "transferReassign";
const actionText = isTransferAssign ? "指派中转配送员" : (isTransferReassign ? "改派中转配送员" : (this.transferActionType === "reassign" ? "改派" : "指派"));
this.$Modal.confirm({
title: actionText + "配送员",
title: actionText,
content: `是否选取配送员「${item.workerName || "未知"}」?`,
onOk: () => {
runshOrder({
deliveryId: this.orderId,
newWorkerId: item.workerId,
newWorkerName: item.workerName,
newWorkerPhone: item.mobile,
fromWhere: "admin",
}).then((res) => {
const request = isTransferAssign
? transferAccept({
deliveryId: this.orderId,
workerId: item.workerId,
workerName: item.workerName,
workerMobile: item.mobile
})
: (isTransferReassign ? transferReassign({
deliveryId: this.orderId,
workerId: item.workerId,
workerName: item.workerName,
workerMobile: item.mobile
}) : runshOrder({
deliveryId: this.orderId,
newWorkerId: item.workerId,
newWorkerName: item.workerName,
newWorkerPhone: item.mobile,
fromWhere: "admin",
}));
request.then((res) => {
if (this.isSuccess(res)) {
this.$Message.success(actionText + "配送员成功");
this.$Message.success(actionText + "成功");
this.transferOrder = false;
this.workerOrderVisible = false;
this.updateHallCountsAfterReassign();
this.getLogisticsInfo();
this.refreshOrderCounts();
}
});
}
@ -1154,6 +1260,7 @@
this.$Message.warning("订单缺少取货或送达区域,无法匹配配送员");
return;
}
this.workerList = this.buildWorkerColumns();
this.transferOrder = true;
this.searchWorker.pageNum = 1;
this.searchWorker.keyword = "";
@ -1161,6 +1268,7 @@
this.searchWorker.xiangtong = false;
this.searchWorker.sortField = "avgTime";
this.searchWorker.regionId = this.currentRegionId;
this.searchWorker.transferWorkerOnly = false;
this.searchWorker.getAreaId = v.getAreaId;
this.searchWorker.shopAreaId = v.getAreaId;
this.searchWorker.putAreaId = v.putAreaId;
@ -1173,6 +1281,33 @@
this.transferActionTitle = v.workerId ? "改派配送员" : "指派配送员";
this.getWorker();
},
openTransferAssign(v) {
const isPendingArrive = this.isTransferPendingArriveOrder(v);
if (!this.isTransferUnacceptedOrder(v) && !isPendingArrive) {
this.$Message.warning("只有中转未接单或中转待送达支持指派/改派中转配送员");
return;
}
this.workerList = this.buildTransferWorkerColumns();
this.transferOrder = true;
this.searchWorker.pageNum = 1;
this.searchWorker.keyword = "";
this.searchWorker.baozhang = false;
this.searchWorker.xiangtong = false;
this.searchWorker.sortField = "avgTime";
this.searchWorker.regionId = this.currentRegionId;
this.searchWorker.transferWorkerOnly = true;
this.searchWorker.getAreaId = "";
this.searchWorker.shopAreaId = "";
this.searchWorker.putAreaId = "";
this.searchWorker.orderType = 0;
this.orderId = v.id;
this.currentTransferWorkerId = v.transferWorkerId || "";
this.currentTransferOrder = v;
this.currentTransferHallTab = "";
this.transferActionType = isPendingArrive ? "transferReassign" : "transferAssign";
this.transferActionTitle = isPendingArrive ? "改派中转配送员" : "指派中转配送员";
this.getWorker();
},
updateHallCountsAfterReassign() {
if (this.transferActionType !== "reassign") return;
if (["waimai", "kuaidi", "paotui"].indexOf(this.currentTransferHallTab) === -1) return;
@ -1334,7 +1469,21 @@
click: () => this.orderDetail(row)
}
}, "订单详情")];
if (this.canAssignWorker(row)) {
if (this.isTransferUnacceptedOrder(row)) {
actions.push(h("Divider", { props: { type: "vertical" } }));
actions.push(h("a", {
on: {
click: () => this.openTransferAssign(row)
}
}, "指派订单"));
} else if (this.isTransferPendingArriveOrder(row)) {
actions.push(h("Divider", { props: { type: "vertical" } }));
actions.push(h("a", {
on: {
click: () => this.openTransferAssign(row)
}
}, "改派订单"));
} else if (this.canAssignWorker(row)) {
actions.push(h("Divider", { props: { type: "vertical" } }));
actions.push(h("a", {
on: {
@ -1351,6 +1500,20 @@
children.push(h("div", actions));
return h("div", children);
},
isTransferUnacceptedOrder(row) {
return this.isTransferUnacceptedTab()
&& row
&& row.transferDelivery == 1
&& Number(row.status) === DELIVERY_STATUS_MAP.transferUnaccepted
&& !row.transferWorkerId;
},
isTransferPendingArriveOrder(row) {
return this.isTransferPendingArriveTab()
&& row
&& row.transferDelivery == 1
&& row.transferWorkerId
&& !row.transferArriveTime;
},
canAssignWorker(row) {
return row && [0, 1, 2].indexOf(Number(row.status)) > -1;
},

1
src/views/app/shop/shop.vue

@ -201,7 +201,6 @@
key: "shoprank",
minWidth: 90,
sortable: true,
sortType: "desc",
fixed: "left",
},
{

4
src/views/sys/order-manage/orderManage.vue

@ -534,9 +534,11 @@
re = "待取货";
} else if (params.row.otherOrder == null && params.row.status == 3 && params.row.deliveryType == 1 && params.row.shopMakeTime == null) {
re = "待出餐";
} else if (params.row.otherOrder == null && params.row.status == 3 && params.row.deliveryType == 2 && params.row.userRequireMake != null) {
re = "待出餐";
} else if (params.row.otherOrder != null && params.row.status == 3 && params.row.deliveryType == 1) {
re = "待取货";
} else if (params.row.status == 3 && params.row.deliveryType == 2) {
} else if (params.row.status == 3 && params.row.deliveryType == 2 && params.row.userRequireMake == null) {
re = "待消费";
} else if (params.row.status == 4) {
re = "待送达";

Loading…
Cancel
Save