Commit 6368405b authored by lihui's avatar lihui

feat: 添加配送路线发送邮箱

parent f37bb5b5
<template>
<div class="YDDialog">
<el-dialog
:title="dialogTitle"
v-model="dialogVisible"
:width="dialogWidth"
:show-close="showDialogClose"
:before-close="handleClose"
:top="dialogMarginTop"
:modal="dialogModel"
:close-on-click-modal="dialogCloseOnClickModal"
:close-on-press-escape="dialogCloseOnPressEscape"
:center="dialogCenter"
>
<slot></slot>
<template #footer>
<span class="dialog-footer">
<el-button v-show="isShowCancelButton" @click="cancel">{{
cancelButtonText
}}</el-button>
<el-button
v-show="isShowConfirmButton"
type="primary"
@click="cofirm"
>{{ confirmButtonText }}</el-button
>
</span>
</template>
</el-dialog>
</div>
</template>
<script>
export default {
props: {
// 标题
dialogTitle: {
type: String,
default: "标题"
},
// dialog 显示控制
myDialogVisible: {
type: Boolean,
default: false
},
// 确认button文案
confirmButtonText: {
type: String,
default: "确 定"
},
// 取消button文案
cancelButtonText: {
type: String,
default: "取 消"
},
// 宽度
dialogWidth: {
type: String,
default: "50%"
},
// 距离顶部的margin
dialogMarginTop: {
type: String,
default: "15vh"
},
// 是否需要遮罩层
dialogModel: {
type: Boolean,
default: true
},
// 点击遮罩层是否关闭dialog
dialogCloseOnClickModal: {
type: Boolean,
default: false
},
// 是否显示关闭(右上角X)
showDialogClose: {
type: Boolean,
default: false
},
// 是否展示确定按钮
isShowConfirmButton: {
type: Boolean,
default: true
},
// 是否展示取消按钮
isShowCancelButton: {
type: Boolean,
default: true
},
// 点击esc是否关闭
dialogCloseOnPressEscape: {
type: Boolean,
default: false
},
// 底部按钮是否居中显示
dialogCenter: {
type: Boolean,
default: false
},
// cancelDialog 方法名称
cancelDialogMethodName: {
type: String,
default: "dialogCancel"
},
// confirmDialog 方法名称
confirmDialogMethodName: {
type: String,
default: "dialogConfirm"
}
},
data() {
return {
dialogVisible: this.myDialogVisible
};
},
watch: {
myDialogVisible(newVal) {
this.dialogVisible = newVal;
}
},
methods: {
cancel() {
this.$emit(this.cancelDialogMethodName);
},
cofirm() {
this.$emit(this.confirmDialogMethodName);
}
}
};
</script>
<style lang="less" scoped></style>
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
width="width" width="width"
> >
<template #default="scope"> <template #default="scope">
{{ scope.row.list.map((item) => item.deliverer_name).join("、") }} {{ scope.row.list.map(item => item.deliverer_name).join("、") }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="prop" label="操作" width="width" align="center"> <el-table-column prop="prop" label="操作" width="width" align="center">
...@@ -198,9 +198,60 @@ ...@@ -198,9 +198,60 @@
</template> </template>
</el-dialog> </el-dialog>
</el-card> </el-card>
<!-- 发送邮件的dialog -->
<YDDialog
dialogTitle="下载配送路线"
cancelButtonText="关闭"
:dialogCenter="true"
:myDialogVisible="sendEmailDialogVisible"
cancelDialogMethodName="sendEmailDialogCancel"
confirmDialogMethodName="sendEmailDialogConfirm"
@sendEmailDialogCancel="sendEmailDialogCancel"
@sendEmailDialogConfirm="sendEmailDialogConfirm"
>
<div class="emailContent">
<p>
生成配送路线大概需要两分钟,生成完毕后会发送到您的邮箱,请填写接受邮箱(一点邮箱)
</p>
<div class="emialInputWrapper">
<el-input
class="myInput"
v-model="myEmialInput"
placeholder="请输入邮箱地址"
:class="{
myInputRequire: isEmailRequire,
myInputError: emialHasError
}"
></el-input>
<span>@yidian-inc.com</span>
</div>
</div>
</YDDialog>
<!-- 显示email发送情况的列表 -->
<YDDialog
dialogTitle="发送记录"
cancelButtonText="关闭"
:dialogCenter="true"
:isShowConfirmButton="false"
:myDialogVisible="showEmailTableDialogVisible"
cancelDialogMethodName="showEmailDialogCancel"
@showEmailDialogCancel="showEmailDialogCancel"
>
<div class="emailListContent">
<el-table :data="emailListTableData" style="width: 100%">
<el-table-column prop="email" label="接收邮箱" width="180">
</el-table-column>
<el-table-column prop="sendTime" label="发送时间" width="180">
</el-table-column>
<el-table-column prop="status" label="状态"> </el-table-column>
</el-table>
</div>
</YDDialog>
</Layout> </Layout>
</template> </template>
<script> <script>
import { checkEmailName } from "../../../utils/tools.js";
import YDDialog from "../../../components/Dialog/YDDialoag.vue";
import Layout from "../layout/index.vue"; import Layout from "../layout/index.vue";
import Pagination from "../components/Pagination/index.vue"; import Pagination from "../components/Pagination/index.vue";
import { import {
...@@ -208,7 +259,7 @@ import { ...@@ -208,7 +259,7 @@ import {
getList, getList,
getSaveDeliverer, getSaveDeliverer,
getAddDeliverer, getAddDeliverer,
getMarketingList, getMarketingList
} from "../../../service/Groupmeal/groupmeal"; } from "../../../service/Groupmeal/groupmeal";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
export default { export default {
...@@ -216,18 +267,47 @@ export default { ...@@ -216,18 +267,47 @@ export default {
components: { components: {
Layout, Layout,
Pagination, Pagination,
YDDialog
}, },
data() { data() {
return { return {
sendEmailDialogVisible: false, // 发送email弹窗
myEmialInput: "", // email地址
isEmailRequire: false, // 验证emial非空
emialHasError: false, // 验证email格式
showEmailTableDialogVisible: true, // 展示email发送情况的dialog
emailListTableData: [
{
email: "2016-05-02",
sendTime: "王小虎",
status: "上海市普陀区金沙江路 1518 弄"
},
{
email: "2016-05-02",
sendTime: "王小虎",
status: "上海市普陀区金沙江路 1518 弄"
},
{
email: "2016-05-02",
sendTime: "王小虎",
status: "上海市普陀区金沙江路 1518 弄"
},
{
email: "2016-05-02",
sendTime: "王小虎",
status: "上海市普陀区金沙江路 1518 弄"
}
],
rules: { rules: {
name: [{ required: true, message: "请输入姓名", trigger: "blur" }], name: [{ required: true, message: "请输入姓名", trigger: "blur" }],
max_capacity: [ max_capacity: [
{ required: true, message: "请填写配送上限", trigger: "blur" }, { required: true, message: "请填写配送上限", trigger: "blur" }
// { type: "number", message: "请填写数值哦", trigger: "change" }, // { type: "number", message: "请填写数值哦", trigger: "change" },
], ],
min_capacity: [ min_capacity: [
{ type: "number", message: "请填写数值哦", trigger: "change" }, { type: "number", message: "请填写数值哦", trigger: "change" }
], ]
}, },
dialogFormAdd: false, dialogFormAdd: false,
// 列表 // 列表
...@@ -237,7 +317,7 @@ export default { ...@@ -237,7 +317,7 @@ export default {
name: "", name: "",
max_capacity: "", //配送上限 max_capacity: "", //配送上限
min_capacity: "", //最小配送量 min_capacity: "", //最小配送量
tool_type: [], //配送工具 tool_type: [] //配送工具
}, },
//分配配送员弹框 //分配配送员弹框
dialogFormAssign: false, dialogFormAssign: false,
...@@ -248,7 +328,7 @@ export default { ...@@ -248,7 +328,7 @@ export default {
page: 1, page: 1,
pageSize: 20, pageSize: 20,
isEdit: false, isEdit: false,
marketingList: [], marketingList: []
}; };
}, },
created() { created() {
...@@ -272,7 +352,7 @@ export default { ...@@ -272,7 +352,7 @@ export default {
name: "", name: "",
max_capacity: "", //配送上限 max_capacity: "", //配送上限
min_capacity: "", //最小配送量 min_capacity: "", //最小配送量
tool_type: [], //配送工具 tool_type: [] //配送工具
}), }),
(this.deliverer = []), (this.deliverer = []),
(this.multipleSelection = []); (this.multipleSelection = []);
...@@ -283,7 +363,7 @@ export default { ...@@ -283,7 +363,7 @@ export default {
const { page, pageSize } = this; const { page, pageSize } = this;
const params = { const params = {
page, page,
pageSize, pageSize
}; };
try { try {
const res = await getList(params); const res = await getList(params);
...@@ -306,7 +386,7 @@ export default { ...@@ -306,7 +386,7 @@ export default {
name, name,
max_capacity: +max_capacity, max_capacity: +max_capacity,
min_capacity: +min_capacity, min_capacity: +min_capacity,
tool_type: +tool_type, tool_type: +tool_type
}; };
try { try {
const { code, reason } = await getAddDeliverer(params); const { code, reason } = await getAddDeliverer(params);
...@@ -318,7 +398,7 @@ export default { ...@@ -318,7 +398,7 @@ export default {
name: "", name: "",
max_capacity: "", //配送上限 max_capacity: "", //配送上限
min_capacity: "", //最小配送量 min_capacity: "", //最小配送量
tool_type: [], //配送工具 tool_type: [] //配送工具
}; };
} catch (error) { } catch (error) {
ElMessage("请求添加配送员失败"); ElMessage("请求添加配送员失败");
...@@ -350,7 +430,7 @@ export default { ...@@ -350,7 +430,7 @@ export default {
this.getList(); this.getList();
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.multipleTable.clearSelection(); this.$refs.multipleTable.clearSelection();
this.deliverer.forEach((row) => { this.deliverer.forEach(row => {
if (row.checked) { if (row.checked) {
this.$refs.multipleTable.toggleRowSelection(row, true); this.$refs.multipleTable.toggleRowSelection(row, true);
} }
...@@ -374,13 +454,13 @@ export default { ...@@ -374,13 +454,13 @@ export default {
// 分配保存 // 分配保存
async save() { async save() {
const { selectActivity, multipleSelection } = this; const { selectActivity, multipleSelection } = this;
const uids = multipleSelection.map((item) => item.deliverer_id); const uids = multipleSelection.map(item => item.deliverer_id);
if (!selectActivity) return ElMessage("请选择活动姓名"); if (!selectActivity) return ElMessage("请选择活动姓名");
// if (!uids.length) return this.$message.info("请至少选择一名骑手"); // if (!uids.length) return this.$message.info("请至少选择一名骑手");
try { try {
const { code, reason } = await getSaveDeliverer({ const { code, reason } = await getSaveDeliverer({
code: selectActivity, code: selectActivity,
uids: uids.join(","), uids: uids.join(",")
}); });
if (code !== 0) if (code !== 0)
return this.$message.error( return this.$message.error(
...@@ -405,10 +485,10 @@ export default { ...@@ -405,10 +485,10 @@ export default {
async getMarketingList() { async getMarketingList() {
try { try {
const res = await getMarketingList(); const res = await getMarketingList();
this.marketingList = res.result.map((item) => { this.marketingList = res.result.map(item => {
return { return {
value: item.marketing_id, value: item.marketing_id,
label: item.marketing_name, label: item.marketing_name
}; };
}); });
} catch (error) { } catch (error) {
...@@ -426,8 +506,62 @@ export default { ...@@ -426,8 +506,62 @@ export default {
console.log(error); console.log(error);
} }
}, },
/* 邮箱弹窗相关操作 */
// 取消
sendEmailDialogCancel() {
this.sendEmailDialogVisible = false;
this.myEmialInput = ""; // 清空输入
this.isEmailRequire = false;
this.emialHasError = false;
},
// 确认
sendEmailDialogConfirm() {
if (this.myEmialInput.trim() === "") {
this.isEmailRequire = true;
return;
}
if (!checkEmailName(this.myEmialInput)) {
this.emialHasError = true;
return;
}
this.sendEmailDialogVisible = false;
this.myEmialInput = ""; // 清空输入
this.isEmailRequire = false;
this.emialHasError = false;
}, },
//带emailtable的dialog
showEmailDialogCancel() {
this.showEmailTableDialogVisible = false;
}
}
}; };
</script> </script>
<style lang="less" src="./index.less" scope> <style lang="less" src="./index.less" scope></style>
<style lang="less" scoped>
// 邮箱dialog
.emailContent {
.emialInputWrapper {
display: flex;
align-items: center;
margin: 15px 0;
.myInput {
width: 50%;
}
.myInputRequire::after {
content: "输入不能为空";
position: absolute;
left: 2px;
top: 35px;
color: red;
}
// 验证emial非空
.myInputError::after {
content: "输入邮箱不合法";
position: absolute;
left: 2px;
top: 35px;
color: red;
}
}
}
</style> </style>
...@@ -374,7 +374,7 @@ import { ...@@ -374,7 +374,7 @@ import {
orderItemList, orderItemList,
orderRefundReject, orderRefundReject,
refundOrder, refundOrder,
getOrderExportURL, getOrderExportURL
} from "@/service/Groupmeal/groupmeal"; } from "@/service/Groupmeal/groupmeal";
// import page from "../../components/Pagination.vue"; // import page from "../../components/Pagination.vue";
import page from "../components/Pagination/index.vue"; import page from "../components/Pagination/index.vue";
...@@ -383,7 +383,7 @@ export default { ...@@ -383,7 +383,7 @@ export default {
name: "orderManagement", name: "orderManagement",
components: { components: {
Layout, Layout,
page, page
}, },
data() { data() {
return { return {
...@@ -396,7 +396,7 @@ export default { ...@@ -396,7 +396,7 @@ export default {
goods_id: "", // 商品名称 goods_id: "", // 商品名称
cust_user: "", // 收货人 cust_user: "", // 收货人
order_id: "", // 订单编号 order_id: "", // 订单编号
sub_shop_id: "", // 自提点 sub_shop_id: "" // 自提点
}, },
// 下拉框数据 // 下拉框数据
// 活动名称 // 活动名称
...@@ -405,36 +405,36 @@ export default { ...@@ -405,36 +405,36 @@ export default {
orderStatusArr: [ orderStatusArr: [
{ {
value: "0", value: "0",
label: "全部", label: "全部"
}, },
{ {
value: "1", value: "1",
label: "未支付", label: "未支付"
}, },
{ {
value: "2", value: "2",
label: "已支付", label: "已支付"
}, },
{ {
value: "3", value: "3",
label: "待退款", label: "待退款"
}, },
{ {
value: "4", value: "4",
label: "已退款", label: "已退款"
}, },
{ {
value: "5", value: "5",
label: "退款中", label: "退款中"
}, },
{ {
value: "6", value: "6",
label: "已拒绝", label: "已拒绝"
}, },
{ {
value: "7", value: "7",
label: "售后", label: "售后"
}, }
], ],
// 商品名称 // 商品名称
tradeNameArr: [], tradeNameArr: [],
...@@ -472,9 +472,9 @@ export default { ...@@ -472,9 +472,9 @@ export default {
payment: "", // 实付 payment: "", // 实付
refundableQuantity: "", refundableQuantity: "",
refundAmount: "", refundAmount: "",
amountToRefund: "", amountToRefund: ""
}, }
], ]
}; };
}, },
...@@ -487,7 +487,7 @@ export default { ...@@ -487,7 +487,7 @@ export default {
}, },
exportURL3() { exportURL3() {
return getOrderExportURL(this.orderQueryObj.marketing_id, "3"); return getOrderExportURL(this.orderQueryObj.marketing_id, "3");
}, }
}, },
methods: { methods: {
...@@ -510,10 +510,10 @@ export default { ...@@ -510,10 +510,10 @@ export default {
async activityNameSel(val) { async activityNameSel(val) {
this.orderQueryObj.goods_id = ""; this.orderQueryObj.goods_id = "";
const params = { const params = {
marketing_id: val, marketing_id: val
}; };
const res = await getGoodsList(params); // 商品名称 const res = await getGoodsList(params); // 商品名称
this.getSubShopListMet(val) //自提点 this.getSubShopListMet(val); //自提点
// const res = await getSubShopList(params); // const res = await getSubShopList(params);
this.tradeNameArr = res.result; this.tradeNameArr = res.result;
// this.selLiftPoinArr = res.result; // this.selLiftPoinArr = res.result;
...@@ -522,11 +522,11 @@ export default { ...@@ -522,11 +522,11 @@ export default {
// 获取自提点 // 获取自提点
async getSubShopListMet(params) { async getSubShopListMet(params) {
try { try {
let marketing_id = '' let marketing_id = "";
if(params){ if (params) {
marketing_id = params marketing_id = params;
} }
const res = await getSubShopList({'marketing_id':marketing_id}); const res = await getSubShopList({ marketing_id: marketing_id });
this.selLiftPoinArr = res.result; this.selLiftPoinArr = res.result;
} catch (error) { } catch (error) {
this.$message.error("发生未知错误,请稍后再试一下吧~~~"); this.$message.error("发生未知错误,请稍后再试一下吧~~~");
...@@ -576,7 +576,7 @@ export default { ...@@ -576,7 +576,7 @@ export default {
const params = { const params = {
marketing_id: this.orderQueryObj.marketing_id, marketing_id: this.orderQueryObj.marketing_id,
// marketing_id: "1NJETU", // marketing_id: "1NJETU",
force_print: forcePrint ? "1" : "", force_print: forcePrint ? "1" : ""
}; };
const res = await orderPrint(params); const res = await orderPrint(params);
return res; return res;
...@@ -593,7 +593,7 @@ export default { ...@@ -593,7 +593,7 @@ export default {
if (res.code === 0) { if (res.code === 0) {
this.$message({ this.$message({
type: "success", type: "success",
message: "打印成功", message: "打印成功"
}); });
return; return;
} }
...@@ -611,7 +611,7 @@ export default { ...@@ -611,7 +611,7 @@ export default {
try { try {
await this.$confirm(res.reason, "打印", { await this.$confirm(res.reason, "打印", {
cancelButtonText: "取消", cancelButtonText: "取消",
confirmButtonText: "确定", confirmButtonText: "确定"
}); });
} catch (e) { } catch (e) {
// 取消 // 取消
...@@ -652,21 +652,21 @@ export default { ...@@ -652,21 +652,21 @@ export default {
try { try {
await this.$confirm("确定要拒绝退款么?", "拒绝", { await this.$confirm("确定要拒绝退款么?", "拒绝", {
cancelButtonText: "取消", cancelButtonText: "取消",
confirmButtonText: "确定", confirmButtonText: "确定"
}); });
} catch (e) { } catch (e) {
// 取消 // 取消
return; return;
} }
const params = { const params = {
order_id: val.order_id, order_id: val.order_id
}; };
const res = await orderRefundReject(params); const res = await orderRefundReject(params);
if (res.code === 0) { if (res.code === 0) {
this.$message({ this.$message({
type: "success", type: "success",
message: "订单已驳回", message: "订单已驳回"
}); });
} else { } else {
this.$message.error(res.reason); this.$message.error(res.reason);
...@@ -693,7 +693,7 @@ export default { ...@@ -693,7 +693,7 @@ export default {
this.checkAll = false; this.checkAll = false;
this.refundGoods = []; this.refundGoods = [];
const params = { const params = {
order_id: val.order_id, order_id: val.order_id
}; };
const res = await orderItemList(params); const res = await orderItemList(params);
this.refundGoods = res.result; this.refundGoods = res.result;
...@@ -720,15 +720,15 @@ export default { ...@@ -720,15 +720,15 @@ export default {
return this.refundGoods.filter(isSelected); return this.refundGoods.filter(isSelected);
}; };
const convertToNumber = (str) => { const convertToNumber = str => {
return !Number.isNaN(parseFloat(str)) ? parseFloat(str) : 0; return !Number.isNaN(parseFloat(str)) ? parseFloat(str) : 0;
}; };
const processRefundItem = (item) => { const processRefundItem = item => {
return { return {
order_item_id: item.order_item_id, order_item_id: item.order_item_id,
refund_num: item.refundableQuantity || 0, refund_num: item.refundableQuantity || 0,
refund_amount: convertToNumber(item.amountToRefund), refund_amount: convertToNumber(item.amountToRefund)
}; };
}; };
...@@ -754,23 +754,22 @@ export default { ...@@ -754,23 +754,22 @@ export default {
} }
// this.refundShow = false; // this.refundShow = false;
this.$message.error(res.reason); this.$message.error(res.reason);
}, }
}, },
created() { created() {
this.getMarketingListMet(); // 活动名称 this.getMarketingListMet(); // 活动名称
this.getSubShopListMet(); // 自提点 this.getSubShopListMet(); // 自提点
this.getOrderListMet(); // table列表 this.getOrderListMet(); // table列表
}, }
}; };
</script> </script>
<style lang="less" src="./index.less" scope></style> <style lang="less" src="./index.less" scope></style>
<style lang="less" scoped> <style lang="less" scoped>
.check-wrap{ .check-wrap {
/deep/ .el-checkbox__label { /deep/ .el-checkbox__label {
white-space: normal; white-space: normal;
word-break: break-all; word-break: break-all;
} }
} }
</style> </style>
//验证邮箱合法性 (验证头部信息)
export const checkEmailName = emailName => {
let str = /[a-zA-Z0-9_-]+/;
if (str.test(emailName)) {
return false;
} else {
return true;
}
};
const path = require('path'); const path = require("path");
const isDev = process.env.NODE_ENV === 'development'; const isDev = process.env.NODE_ENV === "development";
module.exports = { module.exports = {
outputDir: isDev outputDir: isDev ? "./dist" : path.resolve("./public/dist/"),
? './dist' publicPath: isDev ? "/" : "/dist",
: path.resolve('./public/dist/'),
publicPath: isDev ? '/' : '/dist',
configureWebpack: { configureWebpack: {
devServer: { devServer: {
proxy: 'http://localhost:8055', proxy: "http://127.0.0.1:8055",
hot: true, hot: true,
disableHostCheck: true, disableHostCheck: true
}, }
}, },
chainWebpack: config => { chainWebpack: config => {
// 默认不开启 prefetch // 默认不开启 prefetch
config.plugins.delete('prefetch'); config.plugins.delete("prefetch");
// 默认不开启 preload // 默认不开启 preload
config.plugins.delete('preload'); config.plugins.delete("preload");
// 修改页面 title // 修改页面 title
config.plugin('html').tap(args => { config.plugin("html").tap(args => {
args[0].title = '运营管理系统'; args[0].title = "运营管理系统";
return args; return args;
}); });
}, }
}; };
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