Commit 021a2365 authored by pengyunqian's avatar pengyunqian

Merge branch 'feature/distribution'

parents 1d7cb5b9 ba86c82f
const GROUPMEAL_URI = require("../config.js").GROUPMEAL_URI;
const req = require("../utils/request").httpReq;
// 获取订单管理列表
exports.getOrderList = async ctx => {
const url = `${GROUPMEAL_URI}/order/background/order_list`;
const opts = {
url,
method: "GET"
};
ctx.body = await req(ctx, opts);
};
// 获取主页配送列表
exports.getList = async ctx => {
const opts = {
......@@ -51,9 +41,20 @@ exports.getSaveDeliverer = async ctx => {
};
ctx.body = await req(ctx, opts);
};
// 获取订单管理列表
exports.getOrderList = async ctx => {
const url = `${GROUPMEAL_URI}/order/oldbackground/order_list`;
const opts = {
url,
method: "GET"
};
ctx.body = await req(ctx, opts);
};
// 获取活动名称
exports.getMarketingList = async ctx => {
const url = `${GROUPMEAL_URI}/order/background/marketing_list`;
const url = `${GROUPMEAL_URI}/order/oldbackground/marketing_list`;
const opts = {
url,
method: "GET"
......@@ -63,7 +64,7 @@ exports.getMarketingList = async ctx => {
// 获取商品名称
exports.getGoodsList = async ctx => {
const url = `${GROUPMEAL_URI}/order/background/goods_list`;
const url = `${GROUPMEAL_URI}/order/oldbackground/goods_list`;
const opts = {
url,
method: "GET"
......@@ -73,7 +74,7 @@ exports.getGoodsList = async ctx => {
// 获取自提点
exports.getSubShopList = async ctx => {
const url = `${GROUPMEAL_URI}/order/background/sub_shop_list`;
const url = `${GROUPMEAL_URI}/order/oldbackground/sub_shop_list`;
const opts = {
url,
method: "GET"
......@@ -83,7 +84,7 @@ exports.getSubShopList = async ctx => {
// 导出订单
exports.orderExport = async ctx => {
const url = `${GROUPMEAL_URI}/order/background/order_export`;
const url = `${GROUPMEAL_URI}/order/oldbackground/order_export`;
const opts = {
url,
method: "GET"
......@@ -93,7 +94,7 @@ exports.orderExport = async ctx => {
// 打印订单
exports.orderPrint = async ctx => {
const url = `${GROUPMEAL_URI}/order/background/order_print`;
const url = `${GROUPMEAL_URI}/order/oldbackground/order_print`;
const opts = {
url,
method: "GET"
......@@ -103,7 +104,7 @@ exports.orderPrint = async ctx => {
// 订单退款列表
exports.orderItemList = async ctx => {
const url = `${GROUPMEAL_URI}/order/background/order_item_list`;
const url = `${GROUPMEAL_URI}/order/oldbackground/order_item_list`;
const opts = {
url,
method: "GET"
......@@ -113,7 +114,7 @@ exports.orderItemList = async ctx => {
// 订单退款列表
exports.orderRefund = async ctx => {
const url = `${GROUPMEAL_URI}/order/background/order_refund`;
const url = `${GROUPMEAL_URI}/order/oldbackground/order_refund`;
const opts = {
url,
method: "POST",
......@@ -125,7 +126,7 @@ exports.orderRefund = async ctx => {
// 订单驳回
exports.orderRefundReject = async ctx => {
const url = `${GROUPMEAL_URI}/order/background/order_refund_reject`;
const url = `${GROUPMEAL_URI}/order/oldbackground/order_refund_reject`;
const opts = {
url,
method: "GET"
......
......@@ -70,16 +70,15 @@ router.post(`${API_VERSION}/order/deliverer/add_deliverer`, groupmeal.getAddDeli
router.post(`${API_VERSION}/order/deliverer/save_day_deliverer`, groupmeal.getSaveDeliverer)
// 订单管理
router.get(`${API_VERSION}/order/background/order_list`, groupmeal.getOrderList);
router.get(`${API_VERSION}/order/background/marketing_list`, groupmeal.getMarketingList);
router.get(`${API_VERSION}/order/background/goods_list`, groupmeal.getGoodsList);
router.get(`${API_VERSION}/order/background/sub_shop_list`, groupmeal.getSubShopList);
router.get(`${API_VERSION}/order/background/order_export`, groupmeal.orderExport);
router.get(`${API_VERSION}/order/background/order_export`, groupmeal.orderExport);
router.get(`${API_VERSION}/order/background/order_print`, groupmeal.orderPrint);
router.get(`${API_VERSION}/order/background/order_item_list`, groupmeal.orderItemList);
router.get(`${API_VERSION}/order/background/order_refund_reject`, groupmeal.orderRefundReject);
router.post(`${API_VERSION}/order/background/order_refund`, groupmeal.orderRefund);
router.get(`${API_VERSION}/order/oldbackground/order_list`, groupmeal.getOrderList);
router.get(`${API_VERSION}/order/oldbackground/marketing_list`, groupmeal.getMarketingList);
router.get(`${API_VERSION}/order/oldbackground/goods_list`, groupmeal.getGoodsList);
router.get(`${API_VERSION}/order/oldbackground/sub_shop_list`, groupmeal.getSubShopList);
router.get(`${API_VERSION}/order/oldbackground/order_export`, groupmeal.orderExport);
router.get(`${API_VERSION}/order/oldbackground/order_print`, groupmeal.orderPrint);
router.get(`${API_VERSION}/order/oldbackground/order_item_list`, groupmeal.orderItemList);
router.get(`${API_VERSION}/order/oldbackground/order_refund_reject`, groupmeal.orderRefundReject);
router.post(`${API_VERSION}/order/oldbackground/order_refund`, groupmeal.orderRefund);
// 钱包提现审核 wallet/background/apply_detail
router.get(`${API_VERSION}/get_withdrawal_apply_list`, withdrawal.getApplyList)
......
......@@ -34,12 +34,12 @@
</el-table-column>
<el-table-column prop="prop" label="操作" width="width" align="center">
<template #default="scope">
<el-button type="primary" @click="handleModify(scope.row)"
<el-button type="primary" @click="handleModify(scope.row)"
>修改</el-button
>
<el-button
type="primary"
v-show=scope.row.url
v-show="scope.row.url"
@click="handleDownload(scope.row.url)"
>下载配送路线</el-button
>
......@@ -48,10 +48,10 @@
</el-table>
<!-- 页码区 -->
<Pagination
@current-change="handleCurrentChange"
v-model:current-page="page"
:page-size="pageSize"
:total="total"
@current-change="handleCurrentChange"
v-model:current-page="page"
:page-size="pageSize"
:total="total"
></Pagination>
<!-- 添加配送员弹框 -->
<el-dialog
......@@ -127,7 +127,7 @@
<el-dialog
title="分配配送员"
v-model="dialogFormAssign"
width="70%"
width="70%"
:show-close="false"
>
<el-form class="dioFor">
......@@ -138,7 +138,12 @@
clearable
filterable
>
<el-option :label="item.label" :value="item.value" v-for="item in marketingList" :key="item.value"></el-option>
<el-option
:label="item.label"
:value="item.value"
v-for="item in marketingList"
:key="item.value"
></el-option>
</el-select>
</el-form-item>
<span class="dioFor">已选:{{ multipleSelection.length }}人</span>
......@@ -153,11 +158,7 @@
style="width: 100%"
@selection-change="selectGoodsChange"
>
<el-table-column
width="60"
align="center"
type="selection"
>
<el-table-column width="60" align="center" type="selection">
</el-table-column>
<el-table-column
align="center"
......@@ -183,9 +184,9 @@
prop="deliverer_tool_type"
label="配送工具"
>
<template #default="scope">
{{scope.row.deliverer_tool_type==0 ? "电动车" : "摩托车"}}
</template>
<template #default="scope">
{{ scope.row.deliverer_tool_type == 0 ? "电动车" : "摩托车" }}
</template>
</el-table-column>
</el-table>
</el-form>
......@@ -207,14 +208,14 @@ import {
getList,
getSaveDeliverer,
getAddDeliverer,
getMarketingList
getMarketingList,
} from "../../../service/Groupmeal/groupmeal";
import { ElMessage } from "element-plus";
export default {
name: "Distrib",
components: {
Layout,
Pagination
Pagination,
},
data() {
return {
......@@ -247,13 +248,13 @@ export default {
page: 1,
pageSize: 20,
isEdit: false,
marketingList:[]
marketingList: [],
};
},
created() {
this.getList();
this.getDelivererList();
this.getMarketingList()
this.getMarketingList();
},
methods: {
selectGoodsChange(val) {
......@@ -273,17 +274,17 @@ export default {
min_capacity: "", //最小配送量
tool_type: [], //配送工具
}),
this.deliverer= [],
this.multipleSelection = [];
(this.deliverer = []),
(this.multipleSelection = []);
this.selectActivity = ""; //活动下拉框
},
// 获取主页列表
async getList() {
const {page, pageSize} = this
const params={
const { page, pageSize } = this;
const params = {
page,
pageSize
}
pageSize,
};
try {
const res = await getList(params);
this.distribList = res.response.list;
......@@ -297,7 +298,8 @@ export default {
const { name, max_capacity, min_capacity, tool_type } = this.addDeliverer;
if (!name) return ElMessage("请填写配送员姓名");
if (!max_capacity) return ElMessage("请填写配送上限");
if (min_capacity !== '' && min_capacity <= 0) return ElMessage("最小配送量不能为0或小于0");
if (min_capacity !== "" && min_capacity <= 0)
return ElMessage("最小配送量不能为0或小于0");
if (!min_capacity) return ElMessage("请填写最小配送量");
if (!tool_type) return ElMessage("请选择配送工具");
const params = {
......@@ -307,8 +309,8 @@ export default {
tool_type: +tool_type,
};
try {
const {code, reason} = await getAddDeliverer(params);
if(code !== 0) return this.$message.error(reason || "添加配送员失败")
const { code, reason } = await getAddDeliverer(params);
if (code !== 0) return this.$message.error(reason || "添加配送员失败");
ElMessage("添加配送员成功");
this.getDelivererList();
this.dialogFormAdd = false;
......@@ -323,17 +325,17 @@ export default {
}
},
// 添加的取消
addCancel(){
this.dialogFormAdd = false
this.resetDate()
addCancel() {
this.dialogFormAdd = false;
this.resetDate();
},
// 分配配送员
assignDeliverer() {
this.dialogFormAssign = true;
this.getDelivererList();
this.multipleSelection = [];
this.deliverer = []
this.isEdit = false
this.deliverer = [];
this.isEdit = false;
},
// 修改
async handleModify(row) {
......@@ -342,7 +344,7 @@ export default {
this.selectActivity = code;
console.log(code);
try {
const res = await getDelivererList({ code});
const res = await getDelivererList({ code });
this.deliverer = res.response;
this.isEdit = true;
this.getList();
......@@ -360,8 +362,14 @@ export default {
},
// 下载路线
handleDownload(url) {
url && window.open("http://bp-dev.ini.yidian-inc.com" + url)
console.log(url)
// url && window.open("http://bp-dev.ini.yidian-inc.com" + url);
var ENV;
if (process.env.NODE_ENV == "development") {
ENV = "http://bp-dev.ini.yidian-inc.com/";
} else {
ENV = "http://bp-test.ini.yidian-inc.com/";
}
url && window.open(ENV + url);
},
// 分配保存
async save() {
......@@ -370,9 +378,15 @@ export default {
if (!selectActivity) return ElMessage("请选择活动姓名");
// if (!uids.length) return this.$message.info("请至少选择一名骑手");
try {
const {code, reason} = await getSaveDeliverer({ code: selectActivity, uids: uids.join(",") });
if(code !== 0) return this.$message.error(reason || (this.isEdit ? "修改配送员失败":"分配配送员失败"))
ElMessage(this.isEdit ? "修改配送员成功":"分配配送员成功");
const { code, reason } = await getSaveDeliverer({
code: selectActivity,
uids: uids.join(","),
});
if (code !== 0)
return this.$message.error(
reason || (this.isEdit ? "修改配送员失败" : "分配配送员失败")
);
ElMessage(this.isEdit ? "修改配送员成功" : "分配配送员成功");
this.dialogFormAssign = false;
this.isEdit = false;
this.getList();
......@@ -382,23 +396,23 @@ export default {
}
},
// 分配取消
assignCancel(){
this.dialogFormAssign = false
this.getDelivererList()
this.resetDate()
assignCancel() {
this.dialogFormAssign = false;
this.getDelivererList();
this.resetDate();
},
// 活动名称列表
async getMarketingList() {
try {
const res = await getMarketingList();
this.marketingList = res.result.map(item => {
this.marketingList = res.result.map((item) => {
return {
value: item.marketing_id,
label: item.marketing_name
}
})
label: item.marketing_name,
};
});
} catch (error) {
console.log(error)
console.log(error);
}
},
// 分配配送员列表
......
......@@ -29,7 +29,7 @@ export async function getSaveDeliverer(params) {
// 获取订单列表
export async function getOrderList(params) {
const res = await axios.get("/api/v1/order/background/order_list", {
const res = await axios.get("/api/v1/order/oldbackground/order_list", {
params
});
return res;
......@@ -37,13 +37,13 @@ export async function getOrderList(params) {
// 获取活动名称
export async function getMarketingList() {
const res = await axios.get("/api/v1/order/background/marketing_list");
const res = await axios.get("/api/v1/order/oldbackground/marketing_list");
return res;
}
// 获取商品名称
export async function getGoodsList(params) {
const res = await axios.get("/api/v1/order/background/goods_list", {
const res = await axios.get("/api/v1/order/oldbackground/goods_list", {
params
});
return res;
......@@ -51,15 +51,7 @@ export async function getGoodsList(params) {
// 获取自提点
export async function getSubShopList(params) {
const res = await axios.get("/api/v1/order/background/sub_shop_list",{
params
});
return res;
}
// 导出订单
export async function orderExport(params) {
const res = await axios.get("/api/v1/order/background/order_export", {
const res = await axios.get("/api/v1/order/oldbackground/sub_shop_list",{
params
});
return res;
......@@ -67,7 +59,7 @@ export async function orderExport(params) {
// 打印订单
export async function orderPrint(params) {
const res = await axios.get("/api/v1/order/background/order_print", {
const res = await axios.get("/api/v1/order/oldbackground/order_print", {
params
});
return res;
......@@ -75,7 +67,7 @@ export async function orderPrint(params) {
// 订单退款列表
export async function orderItemList(params) {
const res = await axios.get("/api/v1/order/background/order_item_list", {
const res = await axios.get("/api/v1/order/oldbackground/order_item_list", {
params
});
return res;
......@@ -87,7 +79,7 @@ export async function refundOrder(orderId, itemsToRefund) {
// order_id: orderId,
// refund_list: itemsToRefund
// };
const res = await axios.post("/api/v1/order/background/order_refund", {
const res = await axios.post("/api/v1/order/oldbackground/order_refund", {
order_id: orderId,
refund_list: itemsToRefund
});
......@@ -96,7 +88,7 @@ export async function refundOrder(orderId, itemsToRefund) {
// 订单驳回
export async function orderRefundReject(params) {
const res = await axios.get("/api/v1/order/background/order_refund_reject", {
const res = await axios.get("/api/v1/order/oldbackground/order_refund_reject", {
params
});
return res;
......@@ -110,5 +102,5 @@ export function getOrderExportURL(eventId, type) {
}else{
ENV = "http://bp-test.ini.yidian-inc.com/"
}
return `${ENV}order/background/order_export?marketing_id=${eventId}&type=${type}`;
return `${ENV}order/oldbackground/order_export?marketing_id=${eventId}&type=${type}`;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment