新增global,缓存职位信息

This commit is contained in:
huangdeliang 2021-02-23 15:09:17 +08:00
parent 6b50ddcfdd
commit df52ea8f2d
20 changed files with 2333 additions and 1812 deletions

View File

@ -5,15 +5,8 @@
</template> </template>
<script> <script>
import { createNamespacedHelpers } from "vuex";
const { mapActions } = createNamespacedHelpers("global");
export default { export default {
name: "App", name: "App",
created() {
// this.init();
},
methods: {
...mapActions(["init"]),
},
}; };
</script> </script>

View File

@ -0,0 +1,8 @@
import request from "@/utils/request";
export function getOptions() {
return request({
url: "/custom/post/options",
method: "get"
});
}

View File

@ -1,69 +1,62 @@
import request from '@/utils/request' import request from "@/utils/request";
// 查询销售订单列表 // 查询销售订单列表
export function listOrder(params) { export function listOrder(params) {
return request({ return request({
url: '/custom/order/list', url: "/custom/order/list",
method: 'get', method: "get",
params: params params: params
}) });
} }
// 查询销售订单详细 // 查询销售订单详细
export function getOrder(orderId) { export function getOrder(orderId) {
return request({ return request({
url: '/custom/order/' + orderId, url: "/custom/order/" + orderId,
method: 'get' method: "get"
}) });
} }
// 新增销售订单 // 新增销售订单
export function addOrder(data) { export function addOrder(data) {
return request({ return request({
url: '/custom/order', url: "/custom/order",
method: 'post', method: "post",
data: data data: data
}) });
} }
// 修改销售订单 // 修改销售订单
export function updateOrder(data) { export function updateOrder(data) {
return request({ return request({
url: '/custom/order', url: "/custom/order",
method: 'put', method: "put",
data: data data: data
}) });
} }
// 删除销售订单 // 删除销售订单
export function delOrder(orderId) { export function delOrder(orderId) {
return request({ return request({
url: '/custom/order/' + orderId, url: "/custom/order/" + orderId,
method: 'delete' method: "delete"
}) });
} }
// 导出销售订单 // 导出销售订单
export function exportOrder(query) { export function exportOrder(query) {
return request({ return request({
url: '/custom/order/export', url: "/custom/order/export",
method: 'get', method: "get",
params: query params: query
}) });
}
export function getOptions() {
return request({
url: '/custom/post/options',
method: 'get'
})
} }
// 查询销售订单详细 // 查询销售订单详细
export function getInfoDetail(query) { export function getInfoDetail(query) {
return request({ return request({
url: '/custom/order/getInfoDetail', url: "/custom/order/getInfoDetail",
method: 'get', method: "get",
params: query params: query
}) });
} }

View File

@ -3,28 +3,51 @@
<el-dialog :title="title" :visible.sync="open" width="550px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="550px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px"> <el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="调理项目" prop="projectId"> <el-form-item label="调理项目" prop="projectId">
<el-select v-model="form.projectId" placeholder="请选择调理项目" filterable clearable size="small"> <el-select
<el-option v-for="dict in conditioningProjectIdOption" v-model="form.projectId"
:key="dict.dictValue" placeholder="请选择调理项目"
:label="dict.dictLabel" filterable
:value="parseInt(dict.dictValue)"/> clearable
size="small"
>
<el-option
v-for="dict in conditioningProjectIdOption"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<!--<el-form-item label="客户姓名" prop="name"> <!--<el-form-item label="客户姓名" prop="name">
<el-input v-model="form.name" placeholder="请输入客户姓名"/> <el-input v-model="form.name" placeholder="请输入客户姓名"/>
</el-form-item>--> </el-form-item>-->
<el-form-item label="金额" prop="amount" style="width: 300px;"> <el-form-item label="金额" prop="amount" style="width: 300px">
<el-input v-model="form.amount" placeholder="请输入金额"/> <el-input v-model="form.amount" placeholder="请输入金额" />
</el-form-item> </el-form-item>
<el-form-item label="服务承诺" prop="servePromise" v-show="form.projectId == 0" > <el-form-item
<el-input style="width: 200px;" v-model="form.servePromise" placeholder="请输入服务承诺"/><span style="margin-left: 5px;"></span> label="服务承诺"
prop="servePromise"
v-show="form.projectId == 0"
>
<el-input
style="width: 200px"
v-model="form.servePromise"
placeholder="请输入服务承诺"
/><span style="margin-left: 5px"></span>
</el-form-item> </el-form-item>
<el-form-item label="营养师" prop="nutritionistId"> <el-form-item label="营养师" prop="nutritionistId">
<el-select v-model="form.nutritionistId" placeholder="请选择营养师" clearable size="small"> <el-select
<el-option v-for="dict in nutritionistIdOptions" v-model="form.nutritionistId"
:key="dict.dictValue" placeholder="请选择营养师"
:label="dict.dictLabel" clearable
:value="parseInt(dict.dictValue)"/> size="small"
>
<el-option
v-for="dict in nutritionistIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="服务时间" prop="serveTime"> <el-form-item label="服务时间" prop="serveTime">
@ -38,7 +61,11 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"/> <el-input
v-model="form.remark"
type="textarea"
placeholder="请输入内容"
/>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@ -48,20 +75,17 @@
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { addContract } from "@/api/custom/contract";
import {addContract} from "@/api/custom/contract"; import { mapState } from "vuex";
import {getOptions} from "@/api/custom/order";
export default { export default {
name: "ContractAdd", name: "ContractAdd",
components: { components: {},
},
props: {}, props: {},
data() { data() {
const checkServePromise = (rule, value, callback) => { const checkServePromise = (rule, value, callback) => {
if (this.form.projectId == 0 && !value) { if (this.form.projectId == 0 && !value) {
return callback(new Error('请输入服务承诺')) return callback(new Error("请输入服务承诺"));
} }
callback(); callback();
}; };
@ -75,14 +99,14 @@ export default {
form: {}, form: {},
// //
rules: { rules: {
projectId:[ projectId: [
{required: true, message: "请选择调理项目", trigger: "blur"} { required: true, message: "请选择调理项目", trigger: "blur" },
], ],
/*name: [ /*name: [
{required: true, message: "请输入客户姓名", trigger: "blur"} {required: true, message: "请输入客户姓名", trigger: "blur"}
],*/ ],*/
amount: [ amount: [
{required: true, message: "请输入签订金额", trigger: "blur"}, { required: true, message: "请输入签订金额", trigger: "blur" },
{ {
required: true, required: true,
trigger: "blur", trigger: "blur",
@ -91,35 +115,31 @@ export default {
}, },
], ],
servePromise: [ servePromise: [
{required: true, trigger: "blur", validator: checkServePromise} { required: true, trigger: "blur", validator: checkServePromise },
], ],
serveTime: [ serveTime: [
{required: true, message: "请选择服务时间", trigger: "blur"} { required: true, message: "请选择服务时间", trigger: "blur" },
], ],
nutritionistId: [ nutritionistId: [
{required: true, message: "请选择营养师", trigger: "blur"} { required: true, message: "请选择营养师", trigger: "blur" },
] ],
}, },
conditioningProjectIdOption:[], conditioningProjectIdOption: [],
serveTimeOptions:[], serveTimeOptions: [],
nutritionistIdOptions:[] // nutritionistIdOptions: [],
}; };
}, },
computed: {
...mapState({
nutritionistIdOptions: (state) =>
state.global.nutritionistIdOptions.slice(1),
}),
},
created() { created() {
getOptions().then(response => { this.getDicts("cus_serve_time").then((response) => {
const options = response.data.reduce((opts, cur) => {
if (!opts[cur.postCode]) {
opts[cur.postCode] = [];
}
opts[cur.postCode].push({dictValue: cur.userId, dictLabel: cur.userName, remark: cur.remark})
return opts;
}, {})
this.nutritionistIdOptions = options['nutri'] || [];
})
this.getDicts("cus_serve_time").then(response => {
this.serveTimeOptions = response.data; this.serveTimeOptions = response.data;
}); });
this.getDicts("conditioning_project").then(response => { this.getDicts("conditioning_project").then((response) => {
this.conditioningProjectIdOption = response.data; this.conditioningProjectIdOption = response.data;
}); });
}, },
@ -127,29 +147,37 @@ export default {
showDialog(data, callback) { showDialog(data, callback) {
this.callback = callback; this.callback = callback;
this.reset(data); this.reset(data);
this.title = "新增"+`${data.customer}」客户合同`; this.title = "新增" + `${data.customer}」客户合同`;
this.open = true; this.open = true;
}, },
// //
reset(obj) { reset(obj) {
const defaultNutritionist = this.nutritionistIdOptions.find(opt => opt.dictValue === obj.nutritionistId); const defaultNutritionist = this.nutritionistIdOptions.find(
const defaultProjectIdOption = this.conditioningProjectIdOption.find(opt => opt.remark === 'default'); (opt) => opt.dictValue === obj.nutritionistId
);
const defaultProjectIdOption = this.conditioningProjectIdOption.find(
(opt) => opt.remark === "default"
);
this.form = { this.form = {
id: null, id: null,
customerId: obj.customerId, customerId: obj.customerId,
projectId: defaultProjectIdOption ? parseInt(defaultProjectIdOption.dictValue) : null, projectId: defaultProjectIdOption
? parseInt(defaultProjectIdOption.dictValue)
: null,
name: obj.customer, name: obj.customer,
phone: null, phone: null,
serveTime: null, serveTime: null,
amount: null, amount: null,
path: null, path: null,
createBy: null, createBy: null,
nutritionistId: defaultNutritionist ? parseInt(defaultNutritionist.dictValue) : null, nutritionistId: defaultNutritionist
? parseInt(defaultNutritionist.dictValue)
: null,
createTime: null, createTime: null,
updateBy: null, updateBy: null,
updateTime: null, updateTime: null,
remark: null remark: null,
}; };
this.resetForm("form"); this.resetForm("form");
}, },
@ -159,13 +187,16 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
this.form.tutor = this.selectDictLabel(this.nutritionistIdOptions, this.form.nutritionistId) this.form.tutor = this.selectDictLabel(
if(this.form.projectId != 0){ this.nutritionistIdOptions,
this.form.nutritionistId
);
if (this.form.projectId != 0) {
this.form.servePromise = null; this.form.servePromise = null;
} }
addContract(this.form).then(response => { addContract(this.form).then((response) => {
if (response.code === 200) { if (response.code === 200) {
this.msgSuccess("新增成功"); this.msgSuccess("新增成功");
this.open = false; this.open = false;
@ -174,7 +205,7 @@ export default {
}); });
} }
}); });
} },
} },
}; };
</script> </script>

View File

@ -14,15 +14,25 @@
<el-cascader <el-cascader
v-model="form.orderType" v-model="form.orderType"
:options="orderTypeOptions" :options="orderTypeOptions"
style="width: 100%"> style="width: 100%"
>
</el-cascader> </el-cascader>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="自动创建售后提成订单" prop="secondAfterSaleFlag" label-width="200px"> <el-form-item
<el-select v-model="form.secondAfterSaleFlag" :disabled="secondAfterSaleFlagShow" style="width: 100px" placeholder="请选择"> label="自动创建售后提成订单"
<el-option :key="0" label="否" :value="0"/> prop="secondAfterSaleFlag"
<el-option :key="1" label="是" :value="1"/> label-width="200px"
>
<el-select
v-model="form.secondAfterSaleFlag"
:disabled="secondAfterSaleFlagShow"
style="width: 100px"
placeholder="请选择"
>
<el-option :key="0" label="否" :value="0" />
<el-option :key="1" label="是" :value="1" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -120,7 +130,11 @@
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="主营养师" prop="nutritionistIdList"> <el-form-item label="主营养师" prop="nutritionistIdList">
<el-select v-model="form.nutritionistIdList" multiple placeholder="请选择"> <el-select
v-model="form.nutritionistIdList"
multiple
placeholder="请选择"
>
<el-option <el-option
v-for="dict in nutritionistIdOptions" v-for="dict in nutritionistIdOptions"
:key="dict.dictValue" :key="dict.dictValue"
@ -132,7 +146,11 @@
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="拆分比例" prop="nutritionistRate"> <el-form-item label="拆分比例" prop="nutritionistRate">
<el-select v-model="form.nutritionistRate" :disabled="orderRateOptionsShow" placeholder="请选择" > <el-select
v-model="form.nutritionistRate"
:disabled="orderRateOptionsShow"
placeholder="请选择"
>
<el-option <el-option
v-for="dict in orderRateOptions" v-for="dict in orderRateOptions"
:key="dict.dictValue" :key="dict.dictValue"
@ -264,9 +282,11 @@
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { addOrder, getOptions, updateOrder } from "@/api/custom/order"; import { addOrder, updateOrder } from "@/api/custom/order";
import dayjs from "dayjs"; import dayjs from "dayjs";
import * as orderTypeData from "@/utils/orderType"; import * as orderTypeData from "@/utils/orderType";
import { mapGetters } from "vuex";
export default { export default {
name: "OrderEdit", name: "OrderEdit",
props: { props: {
@ -383,16 +403,6 @@ export default {
}, },
// //
payTypeIdOptions: [], payTypeIdOptions: [],
//
preSaleIdOptions: [],
//
afterSaleIdOptions: [],
//
nutritionistIdOptions: [],
//
nutriAssisIdOptions: [],
//
plannerIdOptions: [],
// //
accountIdOptions: [], accountIdOptions: [],
// //
@ -401,54 +411,25 @@ export default {
giveTimeIdOption: [], giveTimeIdOption: [],
// //
conditioningProjectIdOption: [], conditioningProjectIdOption: [],
//
plannerAssisIdOptions: [],
//
operatorIdOptions: [],
// //
reviewStatusOptions: [], reviewStatusOptions: [],
//
operatorAssisIdOptions: [],
//() //()
orderDropdownCorrespondingOptions: [], orderDropdownCorrespondingOptions: [],
// //
orderTypeOptions: orderTypeData['orderTypeArray'], orderTypeOptions: orderTypeData["orderTypeArray"],
secondAfterSaleFlagShow: true, secondAfterSaleFlagShow: true,
// //
orderRateOptions: orderTypeData['orderRateArray'], orderRateOptions: orderTypeData["orderRateArray"],
orderRateOptionsShow: true orderRateOptionsShow: true,
}; };
}, },
created() { created() {
getOptions().then((res) => {
const options = res.data.reduce((opts, cur) => {
if (!opts[cur.postCode]) {
opts[cur.postCode] = [
{ dictValue: 0, dictLabel: "无", remark: null },
];
}
opts[cur.postCode].push({
dictValue: cur.userId,
dictLabel: cur.userName,
remark: cur.remark,
});
return opts;
}, {});
this.preSaleIdOptions = options["pre_sale"] || [];
this.afterSaleIdOptions = options["after_sale"] || [];
this.nutritionistIdOptions = options["nutri"] || [];
this.nutriAssisIdOptions = options["nutri_assis"] || [];
this.plannerIdOptions = options["planner"] || [];
this.plannerAssisIdOptions = options["planner_assis"] || [];
this.operatorIdOptions = options["operator"] || [];
this.operatorAssisIdOptions = options["operator_assis"] || [];
});
this.getDicts("cus_pay_type").then((response) => { this.getDicts("cus_pay_type").then((response) => {
this.payTypeIdOptions = response.data; this.payTypeIdOptions = response.data;
}); });
this.getDicts("cus_account").then((response) => { this.getDicts("cus_account").then((response) => {
this.accountIdOptions = response.data; this.accountIdOptions = response.data;
console.log(response.data); // console.log(response.data);
this.accountIdOptions.splice(0, 0, { this.accountIdOptions.splice(0, 0, {
dictLabel: "无", dictLabel: "无",
dictValue: "0", dictValue: "0",
@ -484,6 +465,26 @@ export default {
this.orderTypeOptions = response.data; this.orderTypeOptions = response.data;
});*/ });*/
}, },
computed: {
...mapGetters([
//
"preSaleIdOptions",
//
"afterSaleIdOptions",
//
"nutritionistIdOptions",
//
"nutriAssisIdOptions",
//
"plannerIdOptions",
//
"plannerAssisIdOptions",
//
"operatorIdOptions",
//
"operatorAssisIdOptions",
]),
},
methods: { methods: {
showDialog(data, callback) { showDialog(data, callback) {
// this.data = data; // this.data = data;
@ -554,7 +555,9 @@ export default {
(opt) => parseInt(opt.dictValue) === accountId (opt) => parseInt(opt.dictValue) === accountId
); );
const defaultOrderRate = this.orderRateOptions.find((opt) => opt.remark === "default"); const defaultOrderRate = this.orderRateOptions.find(
(opt) => opt.remark === "default"
);
const [ const [
plannerId, plannerId,
@ -590,7 +593,9 @@ export default {
updateBy: null, updateBy: null,
updateTime: null, updateTime: null,
nutritionistId: null, nutritionistId: null,
nutritionistIdList: defaultNutritionist ? [parseInt(defaultNutritionist.dictValue)] : null, nutritionistIdList: defaultNutritionist
? [parseInt(defaultNutritionist.dictValue)]
: null,
nutritionistRate: defaultOrderRate ? defaultOrderRate.dictValue : null, nutritionistRate: defaultOrderRate ? defaultOrderRate.dictValue : null,
remark: null, remark: null,
nutriAssisId: defaultNutriAssis nutriAssisId: defaultNutriAssis
@ -647,9 +652,9 @@ export default {
}; };
} }
}, },
handleOrderTypeChange(){ handleOrderTypeChange() {
console.log(this.form.orderType); console.log(this.form.orderType);
} },
}, },
watch: { watch: {
// //
@ -657,22 +662,22 @@ export default {
this.initPlanningAndOperation(); this.initPlanningAndOperation();
}, },
"form.orderType": function (newVal, oldVal) { "form.orderType": function (newVal, oldVal) {
// //
if(newVal[1] == 1){ if (newVal[1] == 1) {
this.form.secondAfterSaleFlag = 1; this.form.secondAfterSaleFlag = 1;
this.secondAfterSaleFlagShow = false; this.secondAfterSaleFlagShow = false;
}else{ } else {
this.form.secondAfterSaleFlag = 0; this.form.secondAfterSaleFlag = 0;
this.secondAfterSaleFlagShow = true; this.secondAfterSaleFlagShow = true;
} }
// //
if(newVal[0] == 1){ if (newVal[0] == 1) {
this.orderRateOptionsShow = false; this.orderRateOptionsShow = false;
this.form.nutritionistRate = "2,8"; this.form.nutritionistRate = "2,8";
}else{ } else {
this.orderRateOptionsShow = true; this.orderRateOptionsShow = true;
this.form.nutritionistRate = "0,10"; this.form.nutritionistRate = "0,10";
} }
}, },
}, },
}; };

View File

@ -235,8 +235,9 @@
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { addOrder, getOptions, updateOrder } from "@/api/custom/order"; import { addOrder, updateOrder } from "@/api/custom/order";
import dayjs from "dayjs"; import dayjs from "dayjs";
import { mapGetters } from "vuex";
export default { export default {
name: "OrderEdit", name: "OrderEdit",
@ -354,16 +355,6 @@ export default {
}, },
// //
payTypeIdOptions: [], payTypeIdOptions: [],
//
preSaleIdOptions: [],
//
afterSaleIdOptions: [],
//
nutritionistIdOptions: [],
//
nutriAssisIdOptions: [],
//
plannerIdOptions: [],
// //
accountIdOptions: [], accountIdOptions: [],
// //
@ -372,42 +363,13 @@ export default {
giveTimeIdOption: [], giveTimeIdOption: [],
// //
conditioningProjectIdOption: [], conditioningProjectIdOption: [],
//
plannerAssisIdOptions: [],
//
operatorIdOptions: [],
// //
reviewStatusOptions: [], reviewStatusOptions: [],
//
operatorAssisIdOptions: [],
//() //()
orderDropdownCorrespondingOptions: [], orderDropdownCorrespondingOptions: [],
}; };
}, },
created() { created() {
getOptions().then((res) => {
const options = res.data.reduce((opts, cur) => {
if (!opts[cur.postCode]) {
opts[cur.postCode] = [
{ dictValue: 0, dictLabel: "无", remark: null },
];
}
opts[cur.postCode].push({
dictValue: cur.userId,
dictLabel: cur.userName,
remark: cur.remark,
});
return opts;
}, {});
this.preSaleIdOptions = options["pre_sale"] || [];
this.afterSaleIdOptions = options["after_sale"] || [];
this.nutritionistIdOptions = options["nutri"] || [];
this.nutriAssisIdOptions = options["nutri_assis"] || [];
this.plannerIdOptions = options["planner"] || [];
this.plannerAssisIdOptions = options["planner_assis"] || [];
this.operatorIdOptions = options["operator"] || [];
this.operatorAssisIdOptions = options["operator_assis"] || [];
});
this.getDicts("cus_pay_type").then((response) => { this.getDicts("cus_pay_type").then((response) => {
this.payTypeIdOptions = response.data; this.payTypeIdOptions = response.data;
}); });
@ -435,6 +397,26 @@ export default {
this.orderDropdownCorrespondingOptions = response.data; this.orderDropdownCorrespondingOptions = response.data;
}); });
}, },
computed: {
...mapGetters([
//
"preSaleIdOptions",
//
"afterSaleIdOptions",
//
"nutritionistIdOptions",
//
"nutriAssisIdOptions",
//
"plannerIdOptions",
//
"plannerAssisIdOptions",
//
"operatorIdOptions",
//
"operatorAssisIdOptions",
]),
},
methods: { methods: {
showDialog(data, callback) { showDialog(data, callback) {
// this.data = data; // this.data = data;

View File

@ -1,11 +1,16 @@
<template> <template>
<div class="navbar"> <div class="navbar">
<hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" /> <hamburger
id="hamburger-container"
:is-active="sidebar.opened"
class="hamburger-container"
@toggleClick="toggleSideBar"
/>
<breadcrumb id="breadcrumb-container" class="breadcrumb-container" /> <breadcrumb id="breadcrumb-container" class="breadcrumb-container" />
<div class="right-menu"> <div class="right-menu">
<template v-if="device!=='mobile'"> <template v-if="device !== 'mobile'">
<search id="header-search" class="right-menu-item" /> <search id="header-search" class="right-menu-item" />
<!-- <el-tooltip content="源码地址" effect="dark" placement="bottom"> <!-- <el-tooltip content="源码地址" effect="dark" placement="bottom">
@ -21,12 +26,14 @@
<el-tooltip content="布局大小" effect="dark" placement="bottom"> <el-tooltip content="布局大小" effect="dark" placement="bottom">
<size-select id="size-select" class="right-menu-item hover-effect" /> <size-select id="size-select" class="right-menu-item hover-effect" />
</el-tooltip> </el-tooltip>
</template> </template>
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click"> <el-dropdown
class="avatar-container right-menu-item hover-effect"
trigger="click"
>
<div class="avatar-wrapper"> <div class="avatar-wrapper">
<img :src="avatar" class="user-avatar"> <img :src="avatar" class="user-avatar" />
<i class="el-icon-caret-bottom" /> <i class="el-icon-caret-bottom" />
</div> </div>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
@ -46,14 +53,14 @@
</template> </template>
<script> <script>
import { mapGetters } from 'vuex' import { mapGetters, mapActions } from "vuex";
import Breadcrumb from '@/components/Breadcrumb' import Breadcrumb from "@/components/Breadcrumb";
import Hamburger from '@/components/Hamburger' import Hamburger from "@/components/Hamburger";
import Screenfull from '@/components/Screenfull' import Screenfull from "@/components/Screenfull";
import SizeSelect from '@/components/SizeSelect' import SizeSelect from "@/components/SizeSelect";
import Search from '@/components/HeaderSearch' import Search from "@/components/HeaderSearch";
import RuoYiGit from '@/components/RuoYi/Git' import RuoYiGit from "@/components/RuoYi/Git";
import RuoYiDoc from '@/components/RuoYi/Doc' import RuoYiDoc from "@/components/RuoYi/Doc";
export default { export default {
components: { components: {
@ -63,43 +70,43 @@ export default {
SizeSelect, SizeSelect,
Search, Search,
RuoYiGit, RuoYiGit,
RuoYiDoc RuoYiDoc,
},
created() {
this.init();
}, },
computed: { computed: {
...mapGetters([ ...mapGetters(["sidebar", "avatar", "device"]),
'sidebar',
'avatar',
'device'
]),
setting: { setting: {
get() { get() {
return this.$store.state.settings.showSettings return this.$store.state.settings.showSettings;
}, },
set(val) { set(val) {
this.$store.dispatch('settings/changeSetting', { this.$store.dispatch("settings/changeSetting", {
key: 'showSettings', key: "showSettings",
value: val value: val,
}) });
} },
} },
}, },
methods: { methods: {
...mapActions(["init"]),
toggleSideBar() { toggleSideBar() {
this.$store.dispatch('app/toggleSideBar') this.$store.dispatch("app/toggleSideBar");
}, },
async logout() { async logout() {
this.$confirm('确定注销并退出系统吗?', '提示', { this.$confirm("确定注销并退出系统吗?", "提示", {
confirmButtonText: '确定', confirmButtonText: "确定",
cancelButtonText: '取消', cancelButtonText: "取消",
type: 'warning' type: "warning",
}).then(() => { }).then(() => {
this.$store.dispatch('LogOut').then(() => { this.$store.dispatch("LogOut").then(() => {
location.href = '/index'; location.href = "/index";
}) });
}) });
} },
} },
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -108,18 +115,18 @@ export default {
overflow: hidden; overflow: hidden;
position: relative; position: relative;
background: #fff; background: #fff;
box-shadow: 0 1px 4px rgba(0,21,41,.08); box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
.hamburger-container { .hamburger-container {
line-height: 46px; line-height: 46px;
height: 100%; height: 100%;
float: left; float: left;
cursor: pointer; cursor: pointer;
transition: background .3s; transition: background 0.3s;
-webkit-tap-highlight-color:transparent; -webkit-tap-highlight-color: transparent;
&:hover { &:hover {
background: rgba(0, 0, 0, .025) background: rgba(0, 0, 0, 0.025);
} }
} }
@ -151,10 +158,10 @@ export default {
&.hover-effect { &.hover-effect {
cursor: pointer; cursor: pointer;
transition: background .3s; transition: background 0.3s;
&:hover { &:hover {
background: rgba(0, 0, 0, .025) background: rgba(0, 0, 0, 0.025);
} }
} }
} }

View File

@ -0,0 +1,7 @@
const actions = {
async init({ dispatch }, payload) {
dispatch("global/init", payload);
}
};
export default actions;

View File

@ -11,6 +11,15 @@ const getters = {
roles: state => state.user.roles, roles: state => state.user.roles,
permissions: state => state.user.permissions, permissions: state => state.user.permissions,
userId: state => state.user.userId, userId: state => state.user.userId,
permission_routes: state => state.permission.routes permission_routes: state => state.permission.routes,
} //
export default getters nutritionistIdOptions: state => state.global.nutritionistIdOptions,
nutriAssisIdOptions: state => state.global.nutriAssisIdOptions,
preSaleIdOptions: state => state.global.preSaleIdOptions,
afterSaleIdOptions: state => state.global.afterSaleIdOptions,
plannerIdOptions: state => state.global.plannerIdOptions,
plannerAssisIdOptions: state => state.global.plannerAssisIdOptions,
operatorIdOptions: state => state.global.operatorIdOptions,
operatorAssisIdOptions: state => state.global.operatorAssisIdOptions
};
export default getters;

View File

@ -9,6 +9,7 @@ import recipes from "./modules/recipes";
import global from "./modules/global"; import global from "./modules/global";
import getters from "./getters"; import getters from "./getters";
import actions from "./actions";
Vue.use(Vuex); Vue.use(Vuex);
@ -22,7 +23,8 @@ const store = new Vuex.Store({
recipes, recipes,
global global
}, },
getters getters,
actions
}); });
export default store; export default store;

View File

@ -1,4 +1,4 @@
import { getOptions } from "@/api/custom/order"; import { getOptions } from "@/api/custom/global";
const oriState = { const oriState = {
nutritionistIdOptions: [], nutritionistIdOptions: [],
@ -8,7 +8,7 @@ const oriState = {
plannerIdOptions: [], plannerIdOptions: [],
plannerAssisIdOptions: [], plannerAssisIdOptions: [],
operatorIdOptions: [], operatorIdOptions: [],
operatorAssisIdOptions: [], operatorAssisIdOptions: []
}; };
const mutations = { const mutations = {
@ -28,9 +28,7 @@ const actions = {
const { data: optionsData } = await getOptions(); const { data: optionsData } = await getOptions();
const options = optionsData.reduce((opts, cur) => { const options = optionsData.reduce((opts, cur) => {
if (!opts[cur.postCode]) { if (!opts[cur.postCode]) {
opts[cur.postCode] = [ opts[cur.postCode] = [{ dictValue: 0, dictLabel: "无", remark: null }];
// { dictValue: null, dictLabel: "全部", remark: null }
];
} }
opts[cur.postCode].push({ opts[cur.postCode].push({
dictValue: cur.userId, dictValue: cur.userId,

View File

@ -1,8 +1,20 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form
:model="queryParams"
ref="queryForm"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="岗位" prop="postId"> <el-form-item label="岗位" prop="postId">
<el-select v-model="queryParams.postId" placeholder="请选择岗位" clearable size="small" @change="searchPostChange"> <el-select
v-model="queryParams.postId"
placeholder="请选择岗位"
clearable
size="small"
@change="searchPostChange"
>
<el-option <el-option
v-for="dict in postIdOptions" v-for="dict in postIdOptions"
:key="dict.dictValue" :key="dict.dictValue"
@ -12,7 +24,12 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="业务员" prop="userId"> <el-form-item label="业务员" prop="userId">
<el-select v-model="queryParams.userId" placeholder="请选择业务员" clearable size="small"> <el-select
v-model="queryParams.userId"
placeholder="请选择业务员"
clearable
size="small"
>
<el-option <el-option
v-for="dict in searchUserIdOptions" v-for="dict in searchUserIdOptions"
:key="dict.dictValue" :key="dict.dictValue"
@ -22,8 +39,16 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> type="cyan"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -35,7 +60,7 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['commision:config:add']" v-hasPermi="['commision:config:add']"
>新增 >新增
</el-button> </el-button>
</el-col> </el-col>
<!-- <el-col :span="1.5">--> <!-- <el-col :span="1.5">-->
@ -70,25 +95,36 @@
<!-- >导出--> <!-- >导出-->
<!-- </el-button>--> <!-- </el-button>-->
<!-- </el-col>--> <!-- </el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="commisionList" :span-method="objectSpanMethod" <el-table
@selection-change="handleSelectionChange"> v-loading="loading"
<el-table-column label="业务员" align="center" prop="userName"/> :data="commisionList"
<el-table-column label="岗位" align="center" prop="postName"/> :span-method="objectSpanMethod"
@selection-change="handleSelectionChange"
>
<el-table-column label="业务员" align="center" prop="userName" />
<el-table-column label="岗位" align="center" prop="postName" />
<el-table-column label="金额" align="center" prop="amount"> <el-table-column label="金额" align="center" prop="amount">
<template scope="scope"> <template scope="scope">
{{toThousands(scope.row.amount)}} {{ toThousands(scope.row.amount) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="比例" align="center" prop="rate"> <el-table-column label="比例" align="center" prop="rate">
<template scope="scope"> <template scope="scope">
{{scope.row.rate + '%'}} {{ scope.row.rate + "%" }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" prop="remark"/> <el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
@ -96,7 +132,7 @@
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['commision:config:edit']" v-hasPermi="['commision:config:edit']"
>修改 >修改
</el-button> </el-button>
<el-button <el-button
size="mini" size="mini"
@ -104,14 +140,14 @@
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['commision:config:remove']" v-hasPermi="['commision:config:remove']"
>删除 >删除
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total > 0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@ -124,7 +160,11 @@
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="岗位" prop="postId"> <el-form-item label="岗位" prop="postId">
<el-select v-model="form.postId" placeholder="请选择岗位" @change="postChange"> <el-select
v-model="form.postId"
placeholder="请选择岗位"
@change="postChange"
>
<el-option <el-option
v-for="dict in postIdOptions" v-for="dict in postIdOptions"
:key="dict.dictValue" :key="dict.dictValue"
@ -148,17 +188,21 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="金额" prop="amount"> <el-form-item label="金额" prop="amount">
<el-input v-model="form.amount" placeholder="请输入金额"/> <el-input v-model="form.amount" placeholder="请输入金额" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="分成比例" prop="rate"> <el-form-item label="分成比例" prop="rate">
<el-input v-model="form.rate" placeholder="请输入比例"/> <el-input v-model="form.rate" placeholder="请输入比例" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"/> <el-input
v-model="form.remark"
type="textarea"
placeholder="请输入内容"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-form> </el-form>
@ -172,282 +216,307 @@
</template> </template>
<script> <script>
import { import {
listCommision, listCommision,
getCommision, getCommision,
delCommision, delCommision,
addCommision, addCommision,
updateCommision, updateCommision,
exportCommision, exportCommision,
} from "@/api/custom/commision"; } from "@/api/custom/commision";
import {getOptions} from "@/api/custom/order"; import { getOptions } from "@/api/custom/global";
export default { export default {
name: "CommisionConfig", name: "CommisionConfig",
data() { data() {
return { return {
// //
loading: true, loading: true,
// //
ids: [], ids: [],
// //
single: true, single: true,
// //
multiple: true, multiple: true,
// //
showSearch: false, showSearch: false,
// //
total: 0, total: 0,
// //
commisionList: [], commisionList: [],
// //
title: "", title: "",
// //
open: false, open: false,
// //
userIdOptions: [], userIdOptions: [],
// //
postIdOptions: [], postIdOptions: [],
// //
totalUserIdOptions: [], totalUserIdOptions: [],
// //
searchUserIdOptions: [], searchUserIdOptions: [],
// //
options: {}, options: {},
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
userId: null, userId: null,
postId: null, postId: null,
amount: null, amount: null,
rate: null, rate: null,
}, },
// //
form: {}, form: {},
// //
rules: { rules: {
userId: [ userId: [
{required: true, message: "业务员不能为空", trigger: "change"} { required: true, message: "业务员不能为空", trigger: "change" },
], ],
postId: [ postId: [
{required: true, message: "岗位不能为空", trigger: "change"} { required: true, message: "岗位不能为空", trigger: "change" },
], ],
amount: [ amount: [{ required: true, message: "金额不能为空", trigger: "blur" }],
{required: true, message: "金额不能为空", trigger: "blur"} rate: [
], { required: true, message: "分成比例不能为空", trigger: "blur" },
rate: [ ],
{required: true, message: "分成比例不能为空", trigger: "blur"} },
], };
},
created() {
this.getList();
getOptions().then((response) => {
this.options = response.data.reduce((opts, cur) => {
// if (cur.postCode.startsWith('planner')) {
// return opts;
// }
if (!opts[cur.postId]) {
opts[cur.postId] = [];
} }
}; opts[cur.postId].push({
}, dictValue: cur.userId,
created() { dictLabel: cur.userName,
this.getList(); });
getOptions().then(response => {
this.options = response.data.reduce((opts, cur) => {
// if (cur.postCode.startsWith('planner')) {
// return opts;
// }
if (!opts[cur.postId]) {
opts[cur.postId] = [];
}
opts[cur.postId].push({dictValue: cur.userId, dictLabel: cur.userName});
if (!this.postIdOptions.some(opt => opt.dictValue === cur.postId)) { if (!this.postIdOptions.some((opt) => opt.dictValue === cur.postId)) {
this.postIdOptions.push({dictValue: cur.postId, dictLabel: cur.postName}); this.postIdOptions.push({
} dictValue: cur.postId,
if (!this.totalUserIdOptions.some(opt => opt.dictValue === cur.userId)) { dictLabel: cur.postName,
this.totalUserIdOptions.push({dictValue: cur.userId, dictLabel: cur.userName}); });
} }
return opts; if (
}, {}); !this.totalUserIdOptions.some((opt) => opt.dictValue === cur.userId)
this.searchUserIdOptions = this.totalUserIdOptions.slice(); ) {
}); this.totalUserIdOptions.push({
dictValue: cur.userId,
}, dictLabel: cur.userName,
methods: { });
/** 查询业务提成比例列表 */ }
getList() { return opts;
this.loading = true; }, {});
listCommision(this.queryParams).then(response => { this.searchUserIdOptions = this.totalUserIdOptions.slice();
this.commisionList = response.rows.reduce((arr, cur, idx, oriArr) => { });
for (let i = 0; i < arr.length; i++) { },
if (arr[i].some(e => e.userId === cur.userId && e.postId === cur.postId)) { methods: {
arr[i].push(cur); /** 查询业务提成比例列表 */
break; getList() {
} else if (i === arr.length - 1) { this.loading = true;
arr.push([cur]); listCommision(this.queryParams).then((response) => {
break; this.commisionList = response.rows.reduce((arr, cur, idx, oriArr) => {
} for (let i = 0; i < arr.length; i++) {
} if (
if (idx === 0) { arr[i].some(
(e) => e.userId === cur.userId && e.postId === cur.postId
)
) {
arr[i].push(cur);
break;
} else if (i === arr.length - 1) {
arr.push([cur]); arr.push([cur]);
} break;
if (idx === oriArr.length - 1) {
const finalArr = [];
arr.forEach(tmpArr => {
tmpArr.sort((a, b) => a.amount - b.amount)
.forEach((elm, elmIdx) => {
finalArr.push({
...elm,
userSpan: elmIdx ? {
rowspan: 0,
colspan: 0
} : {
rowspan: tmpArr.length,
colspan: 1
},
postSpan: elmIdx ? {
rowspan: 0,
colspan: 0
} : {
rowspan: tmpArr.length,
colspan: 1
}
})
})
});
return finalArr;
}
return arr;
}, []);
this.total = response.total;
this.loading = false;
});
},
//
userIdFormat(row, column) {
return this.selectDictLabel(this.userIdOptions, row.userId);
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.userIdOptions = [];
this.form = {
ruleId: null,
userId: null,
userName: null,
amount: null,
rate: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
this.searchUserIdOptions = this.totalUserIdOptions.slice();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.ruleId)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加业务提成比例";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const ruleId = row.ruleId || this.ids
getCommision(ruleId, row.postId).then(response => {
this.form = response.data;
this.userIdOptions = this.options[this.form.postId];
this.open = true;
this.title = "修改业务提成比例";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.ruleId != null) {
updateCommision(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
}
});
} else {
addCommision(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
}
});
} }
} }
}); if (idx === 0) {
}, arr.push([cur]);
/** 删除按钮操作 */ }
handleDelete(row) { if (idx === oriArr.length - 1) {
const ruleIds = row.ruleId || this.ids; const finalArr = [];
this.$confirm('是否确认删除业务提成比例编号为"' + ruleIds + '"的数据项?', "警告", { arr.forEach((tmpArr) => {
tmpArr
.sort((a, b) => a.amount - b.amount)
.forEach((elm, elmIdx) => {
finalArr.push({
...elm,
userSpan: elmIdx
? {
rowspan: 0,
colspan: 0,
}
: {
rowspan: tmpArr.length,
colspan: 1,
},
postSpan: elmIdx
? {
rowspan: 0,
colspan: 0,
}
: {
rowspan: tmpArr.length,
colspan: 1,
},
});
});
});
return finalArr;
}
return arr;
}, []);
this.total = response.total;
this.loading = false;
});
},
//
userIdFormat(row, column) {
return this.selectDictLabel(this.userIdOptions, row.userId);
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.userIdOptions = [];
this.form = {
ruleId: null,
userId: null,
userName: null,
amount: null,
rate: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
this.searchUserIdOptions = this.totalUserIdOptions.slice();
},
//
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.ruleId);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加业务提成比例";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const ruleId = row.ruleId || this.ids;
getCommision(ruleId, row.postId).then((response) => {
this.form = response.data;
this.userIdOptions = this.options[this.form.postId];
this.open = true;
this.title = "修改业务提成比例";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.ruleId != null) {
updateCommision(this.form).then((response) => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
}
});
} else {
addCommision(this.form).then((response) => {
if (response.code === 200) {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
}
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ruleIds = row.ruleId || this.ids;
this.$confirm(
'是否确认删除业务提成比例编号为"' + ruleIds + '"的数据项?',
"警告",
{
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning",
}).then(function () { }
)
.then(function () {
return delCommision(ruleIds); return delCommision(ruleIds);
}).then(() => { })
.then(() => {
this.getList(); this.getList();
this.msgSuccess("删除成功"); this.msgSuccess("删除成功");
}).catch(function () { })
}); .catch(function () {});
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
const queryParams = this.queryParams; const queryParams = this.queryParams;
this.$confirm('是否确认导出所有业务提成比例数据项?', "警告", { this.$confirm("是否确认导出所有业务提成比例数据项?", "警告", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning",
}).then(function () { })
.then(function () {
return exportCommision(queryParams); return exportCommision(queryParams);
}).then(response => { })
.then((response) => {
this.download(response.msg); this.download(response.msg);
}).catch(function () { })
}); .catch(function () {});
}, },
objectSpanMethod({row, column, rowIndex, columnIndex}) { objectSpanMethod({ row, column, rowIndex, columnIndex }) {
if (columnIndex === 0) { if (columnIndex === 0) {
return row.userSpan; return row.userSpan;
} else if (columnIndex === 1) { } else if (columnIndex === 1) {
return row.postSpan; return row.postSpan;
}
},
postChange(postId) {
this.userIdOptions = this.options[postId];
},
searchPostChange(postId) {
if (!postId) {
this.searchUserIdOptions = this.totalUserIdOptions.slice();
return;
}
this.searchUserIdOptions = this.options[postId];
this.queryParams.userId = null;
} }
} },
}; postChange(postId) {
this.userIdOptions = this.options[postId];
},
searchPostChange(postId) {
if (!postId) {
this.searchUserIdOptions = this.totalUserIdOptions.slice();
return;
}
this.searchUserIdOptions = this.options[postId];
this.queryParams.userId = null;
},
},
};
</script> </script>

View File

@ -1,8 +1,20 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form
:model="queryParams"
ref="queryForm"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="岗位" prop="postId"> <el-form-item label="岗位" prop="postId">
<el-select v-model="queryParams.postId" placeholder="请选择岗位" clearable size="small" @change="searchPostChange"> <el-select
v-model="queryParams.postId"
placeholder="请选择岗位"
clearable
size="small"
@change="searchPostChange"
>
<el-option <el-option
v-for="dict in postIdOptions" v-for="dict in postIdOptions"
:key="dict.dictValue" :key="dict.dictValue"
@ -12,7 +24,13 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="业务员" prop="userId"> <el-form-item label="业务员" prop="userId">
<el-select v-model="queryParams.userId" filterable placeholder="请选择业务员" clearable size="small"> <el-select
v-model="queryParams.userId"
filterable
placeholder="请选择业务员"
clearable
size="small"
>
<el-option <el-option
v-for="dict in searchUserIdOptions" v-for="dict in searchUserIdOptions"
:key="dict.dictValue" :key="dict.dictValue"
@ -26,12 +44,21 @@
v-model="month" v-model="month"
@change="monthRangeChange" @change="monthRangeChange"
type="month" type="month"
placeholder="选择月"> placeholder="选择月"
>
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> type="cyan"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -43,40 +70,46 @@
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['commision:detail:export']" v-hasPermi="['commision:detail:export']"
>导出 >导出
</el-button> </el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="commisionList" <el-table
@selection-change="handleSelectionChange"> v-loading="loading"
<el-table-column label="业务员" align="center" prop="userName"/> :data="commisionList"
<el-table-column label="岗位" align="center" prop="postName"/> @selection-change="handleSelectionChange"
>
<el-table-column label="业务员" align="center" prop="userName" />
<el-table-column label="岗位" align="center" prop="postName" />
<el-table-column label="总金额" align="center" prop="amount"> <el-table-column label="总金额" align="center" prop="amount">
<template scope="scope"> <template scope="scope">
{{toThousands(scope.row.amount)}} {{ toThousands(scope.row.amount) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="比例" align="center" prop="rate"> <el-table-column label="比例" align="center" prop="rate">
<template scope="scope"> <template scope="scope">
{{scope.row.rate + '%'}} {{ scope.row.rate + "%" }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="提成" align="center" prop="commision"> <el-table-column label="提成" align="center" prop="commision">
<template scope="scope"> <template scope="scope">
{{scope.row.commision.toFixed(2)}} {{ scope.row.commision.toFixed(2) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="下月应发提成" align="center" prop="commision"> <el-table-column label="下月应发提成" align="center" prop="commision">
<template scope="scope"> <template scope="scope">
{{scope.row.commision.toFixed(2)}} {{ scope.row.commision.toFixed(2) }}
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total > 0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@ -86,147 +119,163 @@
</template> </template>
<script> <script>
import { import { detailCommision, exportCommision } from "@/api/custom/commision";
detailCommision,
exportCommision,
} from "@/api/custom/commision";
import {getOptions} from "@/api/custom/order"; import { getOptions } from "@/api/custom/global";
import dayjs from 'dayjs'; import dayjs from "dayjs";
export default { export default {
name: "CommisionDetail", name: "CommisionDetail",
data() { data() {
return { return {
// //
loading: true, loading: true,
// //
ids: [], ids: [],
// //
single: true, single: true,
// //
multiple: true, multiple: true,
// //
showSearch: true, showSearch: true,
// //
total: 0, total: 0,
// //
month: dayjs(), month: dayjs(),
// //
commisionList: [], commisionList: [],
// //
open: false, open: false,
// //
userIdOptions: [], userIdOptions: [],
// //
postIdOptions: [], postIdOptions: [],
// //
totalUserIdOptions: [], totalUserIdOptions: [],
// //
searchUserIdOptions: [], searchUserIdOptions: [],
// //
options: {}, options: {},
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
userId: null, userId: null,
postId: null, postId: null,
}, },
}; };
}, },
created() { created() {
this.getList(); this.getList();
getOptions().then(response => { getOptions().then((response) => {
this.options = response.data.reduce((opts, cur) => { this.options = response.data.reduce((opts, cur) => {
// if (cur.postCode.startsWith('planner')) { // if (cur.postCode.startsWith('planner')) {
// return opts; // return opts;
// } // }
if (!opts[cur.postId]) { if (!opts[cur.postId]) {
opts[cur.postId] = []; opts[cur.postId] = [];
} }
opts[cur.postId].push({dictValue: cur.userId, dictLabel: cur.userName}); opts[cur.postId].push({
dictValue: cur.userId,
dictLabel: cur.userName,
});
if (!this.postIdOptions.some(opt => opt.dictValue === cur.postId)) { if (!this.postIdOptions.some((opt) => opt.dictValue === cur.postId)) {
this.postIdOptions.push({dictValue: cur.postId, dictLabel: cur.postName}); this.postIdOptions.push({
} dictValue: cur.postId,
if (!this.totalUserIdOptions.some(opt => opt.dictValue === cur.userId)) { dictLabel: cur.postName,
this.totalUserIdOptions.push({dictValue: cur.userId, dictLabel: cur.userName}); });
} }
return opts; if (
}, {}); !this.totalUserIdOptions.some((opt) => opt.dictValue === cur.userId)
this.postIdOptions = this.postIdOptions.sort((a, b) => a.dictValue - b.dictValue); ) {
this.searchUserIdOptions = this.totalUserIdOptions.slice(); this.totalUserIdOptions.push({
}) dictValue: cur.userId,
dictLabel: cur.userName,
}, });
methods: { }
/** 查询业务提成比例列表 */ return opts;
getList() { }, {});
this.loading = true; this.postIdOptions = this.postIdOptions.sort(
const dateRange = [dayjs(this.month).startOf('month').format('YYYY-MM-DD'), dayjs(this.month).endOf('month').format('YYYY-MM-DD')]; (a, b) => a.dictValue - b.dictValue
// console.log(dateRange) );
detailCommision(this.addDateRange(this.queryParams, dateRange)).then(response => { this.searchUserIdOptions = this.totalUserIdOptions.slice();
});
},
methods: {
/** 查询业务提成比例列表 */
getList() {
this.loading = true;
const dateRange = [
dayjs(this.month).startOf("month").format("YYYY-MM-DD"),
dayjs(this.month).endOf("month").format("YYYY-MM-DD"),
];
// console.log(dateRange)
detailCommision(this.addDateRange(this.queryParams, dateRange)).then(
(response) => {
this.commisionList = response.rows; this.commisionList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
});
},
//
userIdFormat(row, column) {
return this.selectDictLabel(this.userIdOptions, row.userId);
},
//
reset() {
this.userIdOptions = [];
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
this.searchUserIdOptions = this.totalUserIdOptions.slice();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.ruleId)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有业务提成比例数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function () {
return exportCommision(queryParams);
}).then(response => {
this.download(response.msg);
}).catch(function () {
});
},
monthRangeChange(time) {
this.month = time;
},
postChange(postId) {
this.userIdOptions = this.options[postId];
},
searchPostChange(postId) {
if (!postId) {
this.searchUserIdOptions = this.totalUserIdOptions.slice();
return;
} }
this.searchUserIdOptions = this.options[postId]; );
this.queryParams.userId = null; },
//
userIdFormat(row, column) {
return this.selectDictLabel(this.userIdOptions, row.userId);
},
//
reset() {
this.userIdOptions = [];
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
this.searchUserIdOptions = this.totalUserIdOptions.slice();
},
//
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.ruleId);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm("是否确认导出所有业务提成比例数据项?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return exportCommision(queryParams);
})
.then((response) => {
this.download(response.msg);
})
.catch(function () {});
},
monthRangeChange(time) {
this.month = time;
},
postChange(postId) {
this.userIdOptions = this.options[postId];
},
searchPostChange(postId) {
if (!postId) {
this.searchUserIdOptions = this.totalUserIdOptions.slice();
return;
} }
} this.searchUserIdOptions = this.options[postId];
}; this.queryParams.userId = null;
},
},
};
</script> </script>

View File

@ -1,8 +1,20 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form
:model="queryParams"
ref="queryForm"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="岗位" prop="postId"> <el-form-item label="岗位" prop="postId">
<el-select v-model="queryParams.postId" placeholder="请选择岗位" clearable size="small" @change="searchPostChange"> <el-select
v-model="queryParams.postId"
placeholder="请选择岗位"
clearable
size="small"
@change="searchPostChange"
>
<el-option <el-option
v-for="dict in postIdOptions" v-for="dict in postIdOptions"
:key="dict.dictValue" :key="dict.dictValue"
@ -12,7 +24,13 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="业务员" prop="userId"> <el-form-item label="业务员" prop="userId">
<el-select v-model="queryParams.userId" filterable placeholder="请选择业务员" clearable size="small"> <el-select
v-model="queryParams.userId"
filterable
placeholder="请选择业务员"
clearable
size="small"
>
<el-option <el-option
v-for="dict in searchUserIdOptions" v-for="dict in searchUserIdOptions"
:key="dict.dictValue" :key="dict.dictValue"
@ -26,20 +44,31 @@
v-model="month" v-model="month"
@change="monthRangeChange" @change="monthRangeChange"
type="month" type="month"
placeholder="选择月份"> placeholder="选择月份"
>
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> type="cyan"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div><span style="color:#E6A23C;font-family:PingFang SC"> <div>
注意事项 <span style="color: #e6a23c; font-family: PingFang SC">
<br/>12021年1月开始的订单才开始按天计算提成只计算已审核的订单 注意事项
<br/>2发工资日期定为每月15号若当前日期大于15号则认定上个月的工资已发放 <br />12021年1月开始的订单才开始按天计算提成只计算已审核的订单
</span></div> <br />2发工资日期定为每月15号若当前日期大于15号则认定上个月的工资已发放
<el-row :gutter="10" class="mb8" style="margin-top:10px;"> </span>
</div>
<el-row :gutter="10" class="mb8" style="margin-top: 10px">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="warning" type="warning"
@ -47,74 +76,116 @@
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['commisionDay:detail:export']" v-hasPermi="['commisionDay:detail:export']"
>导出 >导出
</el-button> </el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="commisionList" <el-table
@selection-change="handleSelectionChange" stripe :row-class-name="tableRowClassName"> v-loading="loading"
:data="commisionList"
@selection-change="handleSelectionChange"
stripe
:row-class-name="tableRowClassName"
>
<el-table-column label="业务员" align="center" prop="nickName"> <el-table-column label="业务员" align="center" prop="nickName">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.nickName }}</span> <span>{{ scope.row.nickName }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="岗位" align="center" prop="postName"/> <el-table-column label="岗位" align="center" prop="postName" />
<el-table-column label="总提成" align="center" prop="totalCommissionAmount"> <el-table-column
label="总提成"
align="center"
prop="totalCommissionAmount"
>
<template scope="scope"> <template scope="scope">
{{scope.row.totalCommissionAmount.toFixed(fixLength)}} {{ scope.row.totalCommissionAmount.toFixed(fixLength) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="已发放提成" align="center" prop="totalHasSentCommissionAmount"> <el-table-column
label="已发放提成"
align="center"
prop="totalHasSentCommissionAmount"
>
<template scope="scope"> <template scope="scope">
{{scope.row.totalHasSentCommissionAmount.toFixed(fixLength)}} {{ scope.row.totalHasSentCommissionAmount.toFixed(fixLength) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="未发放提成" align="center" prop="totalNotSentCommissionAmount"> <el-table-column
label="未发放提成"
align="center"
prop="totalNotSentCommissionAmount"
>
<template scope="scope"> <template scope="scope">
{{scope.row.totalNotSentCommissionAmount.toFixed(fixLength)}} {{ scope.row.totalNotSentCommissionAmount.toFixed(fixLength) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="下月应发提成" align="center" prop="nextMonthCommission"> <el-table-column
label="下月应发提成"
align="center"
prop="nextMonthCommission"
>
<template scope="scope"> <template scope="scope">
{{scope.row.nextMonthCommission.toFixed(fixLength)}} {{ scope.row.nextMonthCommission.toFixed(fixLength) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
<template scope="scope"> <template scope="scope">
<el-button type="text" @click="openFormDialog('查看发放计划', scope.row)">查看发放计划</el-button> <el-button
type="text"
@click="openFormDialog('查看发放计划', scope.row)"
>查看发放计划</el-button
>
</template> </template>
</el-table-column> </el-table-column>
<!--<el-table-column label="提成" align="center" prop="commissionTotalAmount"></el-table-column>--> <!--<el-table-column label="提成" align="center" prop="commissionTotalAmount"></el-table-column>-->
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total > 0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
<el-dialog
<el-dialog title="提成发放计划" :visible.sync="sendCommissionPlanTable" width="40%" align="center"> title="提成发放计划"
<el-table :data="sendCommissionPlan.list" show-summary :summary-method="getSummaries"> :visible.sync="sendCommissionPlanTable"
<el-table-column property="nickName" label="姓名" width="150"></el-table-column> width="40%"
align="center"
>
<el-table
:data="sendCommissionPlan.list"
show-summary
:summary-method="getSummaries"
>
<el-table-column
property="nickName"
label="姓名"
width="150"
></el-table-column>
<el-table-column property="yearMonth" label="提成月份" width="200"> <el-table-column property="yearMonth" label="提成月份" width="200">
<template scope="scope"> <template scope="scope">
{{scope.row.yearMonth.substring(0, 4)}}{{scope.row.yearMonth.substring(4)}} {{ scope.row.yearMonth.substring(0, 4) }}{{
scope.row.yearMonth.substring(4)
}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column property="yearMonthCommission" label="提成金额" width="100"> <el-table-column
property="yearMonthCommission"
label="提成金额"
width="100"
>
<template scope="scope"> <template scope="scope">
{{scope.row.yearMonthCommission.toFixed(fixLength)}} {{ scope.row.yearMonthCommission.toFixed(fixLength) }}
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -123,197 +194,215 @@
</template> </template>
<style> <style>
.el-table .warning-row { .el-table .warning-row {
background: oldlace; background: oldlace;
} }
.el-table .success-row { .el-table .success-row {
/*background: #1890FF;*/ /*background: #1890FF;*/
color: #1890FF color: #1890ff;
} }
</style> </style>
<script> <script>
import { import { detailDayCommision, exportDayCommision } from "@/api/custom/commision";
detailDayCommision, exportDayCommision} from "@/api/custom/commision";
import {getOptions} from "@/api/custom/order"; import { getOptions } from "@/api/custom/global";
import dayjs from 'dayjs'; import dayjs from "dayjs";
export default { export default {
name: "CommisionDayDetail", name: "CommisionDayDetail",
data() { data() {
return { return {
// //
loading: true, loading: true,
// //
ids: [], ids: [],
// //
single: true, single: true,
// //
multiple: true, multiple: true,
// //
showSearch: true, showSearch: true,
// //
total: 0, total: 0,
// //
month: dayjs(), month: dayjs(),
// //
commisionList: [], commisionList: [],
// //
open: false, open: false,
// //
userIdOptions: [], userIdOptions: [],
// //
postIdOptions: [], postIdOptions: [],
// //
totalUserIdOptions: [], totalUserIdOptions: [],
// //
searchUserIdOptions: [], searchUserIdOptions: [],
// //
options: {}, options: {},
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 20, pageSize: 20,
userId: null, userId: null,
postId: null, postId: null,
}, },
sendCommissionPlanTable: false, sendCommissionPlanTable: false,
sendCommissionPlan:{}, sendCommissionPlan: {},
fixLength: 2 fixLength: 2,
}; };
}, },
created() { created() {
this.getList(); this.getList();
getOptions().then(response => { getOptions().then((response) => {
this.options = response.data.reduce((opts, cur) => { this.options = response.data.reduce((opts, cur) => {
if (cur.postCode != ('after_sale') && cur.postCode != 'nutri') { if (cur.postCode != "after_sale" && cur.postCode != "nutri") {
return opts;
}
if (!opts[cur.postId]) {
opts[cur.postId] = [];
}
opts[cur.postId].push({dictValue: cur.userId, dictLabel: cur.userName});
if (!this.postIdOptions.some(opt => opt.dictValue === cur.postId)) {
this.postIdOptions.push({dictValue: cur.postId, dictLabel: cur.postName});
}
if (!this.totalUserIdOptions.some(opt => opt.dictValue === cur.userId)) {
this.totalUserIdOptions.push({dictValue: cur.userId, dictLabel: cur.userName});
}
return opts; return opts;
}, {}); }
this.postIdOptions = this.postIdOptions.sort((a, b) => a.dictValue - b.dictValue); if (!opts[cur.postId]) {
this.searchUserIdOptions = this.totalUserIdOptions.slice(); opts[cur.postId] = [];
}) }
opts[cur.postId].push({
dictValue: cur.userId,
dictLabel: cur.userName,
});
}, if (!this.postIdOptions.some((opt) => opt.dictValue === cur.postId)) {
methods: { this.postIdOptions.push({
/** 查询业务提成比例列表 */ dictValue: cur.postId,
getList() { dictLabel: cur.postName,
this.loading = true; });
const dateRange = [dayjs(this.month).startOf('month').format('YYYY-MM-DD'), dayjs(this.month).endOf('month').format('YYYY-MM-DD')]; }
// console.log(dateRange) if (
detailDayCommision(this.addDateRange(this.queryParams, dateRange)).then(response => { !this.totalUserIdOptions.some((opt) => opt.dictValue === cur.userId)
) {
this.totalUserIdOptions.push({
dictValue: cur.userId,
dictLabel: cur.userName,
});
}
return opts;
}, {});
this.postIdOptions = this.postIdOptions.sort(
(a, b) => a.dictValue - b.dictValue
);
this.searchUserIdOptions = this.totalUserIdOptions.slice();
});
},
methods: {
/** 查询业务提成比例列表 */
getList() {
this.loading = true;
const dateRange = [
dayjs(this.month).startOf("month").format("YYYY-MM-DD"),
dayjs(this.month).endOf("month").format("YYYY-MM-DD"),
];
// console.log(dateRange)
detailDayCommision(this.addDateRange(this.queryParams, dateRange)).then(
(response) => {
this.commisionList = response.rows; this.commisionList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
}); }
}, );
// },
userIdFormat(row, column) { //
return this.selectDictLabel(this.userIdOptions, row.userId); userIdFormat(row, column) {
}, return this.selectDictLabel(this.userIdOptions, row.userId);
// },
reset() { //
this.userIdOptions = []; reset() {
this.resetForm("form"); this.userIdOptions = [];
}, this.resetForm("form");
/** 搜索按钮操作 */ },
handleQuery() { /** 搜索按钮操作 */
this.queryParams.pageNum = 1; handleQuery() {
this.getList(); this.queryParams.pageNum = 1;
}, this.getList();
/** 重置按钮操作 */ },
resetQuery() { /** 重置按钮操作 */
this.resetForm("queryForm"); resetQuery() {
//this.handleQuery(); this.resetForm("queryForm");
this.searchUserIdOptions = this.totalUserIdOptions.slice(); //this.handleQuery();
}, this.searchUserIdOptions = this.totalUserIdOptions.slice();
// },
handleSelectionChange(selection) { //
this.ids = selection.map(item => item.ruleId) handleSelectionChange(selection) {
this.single = selection.length !== 1 this.ids = selection.map((item) => item.ruleId);
this.multiple = !selection.length this.single = selection.length !== 1;
}, this.multiple = !selection.length;
/** 导出按钮操作 */ },
handleExport() { /** 导出按钮操作 */
const queryParams = this.queryParams; handleExport() {
this.$confirm('是否确认导出所有业务提成比例数据项?', "警告", { const queryParams = this.queryParams;
confirmButtonText: "确定", this.$confirm("是否确认导出所有业务提成比例数据项?", "警告", {
cancelButtonText: "取消", confirmButtonText: "确定",
type: "warning" cancelButtonText: "取消",
}).then(function () { type: "warning",
})
.then(function () {
return exportDayCommision(queryParams); return exportDayCommision(queryParams);
}).then(response => { })
.then((response) => {
this.download(response.msg); this.download(response.msg);
}).catch(function () { })
.catch(function () {});
},
monthRangeChange(time) {
this.month = time;
},
postChange(postId) {
this.userIdOptions = this.options[postId];
},
searchPostChange(postId) {
if (!postId) {
this.searchUserIdOptions = this.totalUserIdOptions.slice();
return;
}
this.searchUserIdOptions = this.options[postId];
this.queryParams.userId = null;
},
openFormDialog(title, row) {
this.sendCommissionPlan = {};
var total = 0;
if (row.sendDetailList != null) {
row.sendDetailList.forEach(function (e) {
e.nickName = row.nickName;
total += e.yearMonthCommission;
}); });
}, }
monthRangeChange(time) { this.sendCommissionPlan.list = row.sendDetailList;
this.month = time; this.sendCommissionPlan.total = row.totalNotSentCommissionAmount;
}, this.sendCommissionPlanTable = true;
postChange(postId) { },
this.userIdOptions = this.options[postId]; getSummaries(param) {
}, //param columns data {columns: Array[4], data: Array[5]},
searchPostChange(postId) { const { columns, data } = param;
if (!postId) { const sums = [];
this.searchUserIdOptions = this.totalUserIdOptions.slice(); columns.forEach((column, index) => {
if (index === 0) {
sums[index] = "合计";
return; return;
} }
this.searchUserIdOptions = this.options[postId]; if (index == 1) {
this.queryParams.userId = null; sums[index] = data.length + "个月";
}, return;
openFormDialog(title, row){
this.sendCommissionPlan = {};
var total = 0;
if(row.sendDetailList != null){
row.sendDetailList.forEach(function (e) {
e.nickName = row.nickName;
total += e.yearMonthCommission;
});
}
this.sendCommissionPlan.list = row.sendDetailList;
this.sendCommissionPlan.total = row.totalNotSentCommissionAmount;
this.sendCommissionPlanTable = true;
},
getSummaries(param) {
//param columns data {columns: Array[4], data: Array[5]},
const { columns, data } = param;
const sums = [];
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '合计';
return;
}
if(index == 1){
sums[index] = data.length +"个月";
return
}
if(index == 2){
sums[index] = this.sendCommissionPlan.total;
}
});
return sums;
},
tableRowClassName({row, rowIndex}) {
if(this.commisionList.length == rowIndex+1){
return "success-row";
} }
return ''; if (index == 2) {
sums[index] = this.sendCommissionPlan.total;
}
});
return sums;
},
tableRowClassName({ row, rowIndex }) {
if (this.commisionList.length == rowIndex + 1) {
return "success-row";
} }
} return "";
}; },
},
};
</script> </script>

View File

@ -1,6 +1,12 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form
:model="queryParams"
ref="queryForm"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="合同编号" prop="id"> <el-form-item label="合同编号" prop="id">
<el-input <el-input
v-model="queryParams.id" v-model="queryParams.id"
@ -29,11 +35,18 @@
/> />
</el-form-item> </el-form-item>
<el-form-item label="主营养师" prop="nutritionistId"> <el-form-item label="主营养师" prop="nutritionistId">
<el-select v-model="queryParams.nutritionistId" placeholder="请选择主营养师" clearable size="small"> <el-select
<el-option v-for="dict in nutritionistIdOptions" v-model="queryParams.nutritionistId"
:key="dict.dictValue" placeholder="请选择主营养师"
:label="dict.dictLabel" clearable
:value="parseInt(dict.dictValue)"/> size="small"
>
<el-option
v-for="dict in nutritionistIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="合同状态" prop="status"> <el-form-item label="合同状态" prop="status">
@ -47,8 +60,16 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> type="cyan"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -92,50 +113,108 @@
<!-- v-hasPermi="['custom:contract:export']"--> <!-- v-hasPermi="['custom:contract:export']"-->
<!-- >导出</el-button>--> <!-- >导出</el-button>-->
<!-- </el-col>--> <!-- </el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="contractList" @selection-change="handleSelectionChange"> <el-table
v-loading="loading"
:data="contractList"
@selection-change="handleSelectionChange"
>
<!-- <el-table-column type="selection" width="55" align="center" />--> <!-- <el-table-column type="selection" width="55" align="center" />-->
<el-table-column label="合同编号" align="center" prop="id" fixed="left" width="150"/> <el-table-column
<el-table-column label="合同状态" align="center" prop="status" width="80" fixed="left"> label="合同编号"
align="center"
prop="id"
fixed="left"
width="150"
/>
<el-table-column
label="合同状态"
align="center"
prop="status"
width="80"
fixed="left"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag <el-tag
:type="scope.row.status === 'yes' ? 'success' : 'danger'" :type="scope.row.status === 'yes' ? 'success' : 'danger'"
disable-transitions> disable-transitions
{{scope.row.status === 'yes' ? '已签订':'未签订'}} >
{{ scope.row.status === "yes" ? "已签订" : "未签订" }}
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="客户姓名" align="center" prop="name" fixed="left" width="200"/> <el-table-column
<el-table-column label="证件号" align="center" prop="cusId" width="190"/> label="客户姓名"
<el-table-column label="电话" align="center" prop="phone" width="120"/> align="center"
<el-table-column label="服务时间" align="center" prop="serveTime" :formatter="serveTimeFormat" width="100"/> prop="name"
<el-table-column label="服务承诺" align="center" prop="servePromise" width="100"> fixed="left"
width="200"
/>
<el-table-column label="证件号" align="center" prop="cusId" width="190" />
<el-table-column label="电话" align="center" prop="phone" width="120" />
<el-table-column
label="服务时间"
align="center"
prop="serveTime"
:formatter="serveTimeFormat"
width="100"
/>
<el-table-column
label="服务承诺"
align="center"
prop="servePromise"
width="100"
>
<template slot-scope="scope"> <template slot-scope="scope">
{{scope.row.servePromise ? `${scope.row.servePromise}`: ''}} {{ scope.row.servePromise ? `${scope.row.servePromise}` : "" }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="金额" align="center" prop="amount" width="100"/> <el-table-column label="金额" align="center" prop="amount" width="100" />
<el-table-column label="调理项目" align="center" prop="projectName" width="100"/> <el-table-column
<el-table-column label="签订时间" align="center" prop="updateTime" width="180"/> label="调理项目"
align="center"
prop="projectName"
width="100"
/>
<el-table-column
label="签订时间"
align="center"
prop="updateTime"
width="180"
/>
<el-table-column label="合同地址" align="center" prop="path" width="80"> <el-table-column label="合同地址" align="center" prop="path" width="80">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" icon="el-icon-copy-document" @click="handleCopy(scope.row.path)" class="copyBtn" <el-button
:data-clipboard-text="copyValue">复制 type="text"
icon="el-icon-copy-document"
@click="handleCopy(scope.row.path)"
class="copyBtn"
:data-clipboard-text="copyValue"
>复制
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" prop="remark" width="120"/> <el-table-column label="备注" align="center" prop="remark" width="120" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="150"> <el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
fixed="right"
width="150"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
v-if="scope.row.status==='yes'" v-if="scope.row.status === 'yes'"
size="mini" size="mini"
type="text" type="text"
icon="el-icon-view" icon="el-icon-view"
@click="handleLook(scope.row.path)" @click="handleLook(scope.row.path)"
>查看 >查看
</el-button> </el-button>
<el-button <el-button
size="mini" size="mini"
@ -143,14 +222,14 @@
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['custom:contract:remove']" v-hasPermi="['custom:contract:remove']"
>删除 >删除
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total > 0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@ -161,29 +240,52 @@
<el-dialog :title="title" :visible.sync="open" width="550px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="550px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px"> <el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="调理项目" prop="projectId"> <el-form-item label="调理项目" prop="projectId">
<el-select v-model="form.projectId" placeholder="请选择调理项目" filterable clearable size="small"> <el-select
<el-option v-for="dict in conditioningProjectIdOption" v-model="form.projectId"
:key="dict.dictValue" placeholder="请选择调理项目"
:label="dict.dictLabel" filterable
:value="parseInt(dict.dictValue)"/> clearable
size="small"
>
<el-option
v-for="dict in conditioningProjectIdOption"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="客户姓名" prop="name"> <el-form-item label="客户姓名" prop="name">
<el-input v-model="form.name" placeholder="请输入客户姓名"/> <el-input v-model="form.name" placeholder="请输入客户姓名" />
</el-form-item> </el-form-item>
<el-form-item label="金额" prop="amount"> <el-form-item label="金额" prop="amount">
<el-input v-model="form.amount" placeholder="请输入金额"/> <el-input v-model="form.amount" placeholder="请输入金额" />
</el-form-item> </el-form-item>
<el-form-item label="服务承诺" prop="servePromise" v-show="form.projectId == 0"> <el-form-item
<el-input style="width: 193px; margin-right: 12px" v-model="form.servePromise" placeholder="请输入服务承诺"/> label="服务承诺"
prop="servePromise"
v-show="form.projectId == 0"
>
<el-input
style="width: 193px; margin-right: 12px"
v-model="form.servePromise"
placeholder="请输入服务承诺"
/>
</el-form-item> </el-form-item>
<el-form-item label="营养师" prop="nutritionistId"> <el-form-item label="营养师" prop="nutritionistId">
<el-select v-model="form.nutritionistId" placeholder="请选择营养师" clearable size="small"> <el-select
<el-option v-for="dict in nutritionistIdOptions" v-model="form.nutritionistId"
:key="dict.dictValue" placeholder="请选择营养师"
:label="dict.dictLabel" clearable
:value="parseInt(dict.dictValue)"/> size="small"
>
<el-option
v-for="dict in nutritionistIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="服务时间" prop="serveTime"> <el-form-item label="服务时间" prop="serveTime">
@ -197,7 +299,11 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"/> <el-input
v-model="form.remark"
type="textarea"
placeholder="请输入内容"
/>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@ -209,263 +315,271 @@
</template> </template>
<script> <script>
import {addContract, delContract, listContract} from "@/api/custom/contract"; import { addContract, delContract, listContract } from "@/api/custom/contract";
import {getOptions} from "@/api/custom/order"; import Clipboard from "clipboard";
import Clipboard from 'clipboard'; import { mapGetters } from "vuex";
export default { export default {
name: "Contract", name: "Contract",
data() { data() {
const checkServePromise = (rule, value, callback) => { const checkServePromise = (rule, value, callback) => {
if (this.form.projectId == 0 && !value) { if (this.form.projectId == 0 && !value) {
return callback(new Error('请输入服务承诺')) return callback(new Error("请输入服务承诺"));
} }
callback(); callback();
}; };
return { return {
// //
loading: true, loading: true,
// //
ids: [], ids: [],
// //
single: true, single: true,
// //
multiple: true, multiple: true,
// //
showSearch: false, showSearch: false,
// //
total: 0, total: 0,
// //
contractList: [], contractList: [],
// //
nutritionistIdOptions: [], nutritionistIdOptions: [],
// //
title: "", title: "",
// //
open: false, open: false,
// //
serveTimeOptions: [], serveTimeOptions: [],
// //
signStatusOptions: [], signStatusOptions: [],
// //
conditioningProjectIdOption:[], conditioningProjectIdOption: [],
// //
copyValue: '', copyValue: "",
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
id: null, id: null,
name: null, name: null,
phone: null, phone: null,
status: null, status: null,
}, },
// //
form: {}, form: {},
// //
rules: { rules: {
projectId:[ projectId: [
{required: true, message: "请选择调理项目", trigger: "blur"} { required: true, message: "请选择调理项目", trigger: "blur" },
], ],
name: [ name: [{ required: true, message: "请输入客户姓名", trigger: "blur" }],
{required: true, message: "请输入客户姓名", trigger: "blur"} amount: [
], { required: true, message: "请输入签订金额", trigger: "blur" },
amount: [ {
{required: true, message: "请输入签订金额", trigger: "blur"}, required: true,
{ trigger: "blur",
required: true, pattern: /^[1-9]\d*$/,
trigger: "blur", message: "签订金额格式不正确",
pattern: /^[1-9]\d*$/, },
message: "签订金额格式不正确", ],
}, servePromise: [
], { required: true, trigger: "blur", validator: checkServePromise },
servePromise: [ ],
{required: true, trigger: "blur", validator: checkServePromise} serveTime: [
], { required: true, message: "请选择服务时间", trigger: "blur" },
serveTime: [ ],
{required: true, message: "请选择服务时间", trigger: "blur"} nutritionistId: [
], { required: true, message: "请选择营养师", trigger: "blur" },
nutritionistId: [ ],
{required: true, message: "请选择营养师", trigger: "blur"} },
] };
} },
}; created() {
this.getList();
this.getDicts("cus_serve_time").then((response) => {
this.serveTimeOptions = response.data;
});
this.getDicts("cus_sign_status").then((response) => {
this.signStatusOptions = response.data;
});
this.getDicts("conditioning_project").then((response) => {
this.conditioningProjectIdOption = response.data;
});
},
computed: {
...mapGetters(["nutritionistIdOptions"]),
},
methods: {
/** 查询合同列表 */
getList() {
this.loading = true;
listContract(this.queryParams).then((response) => {
this.contractList = response.rows;
this.total = response.total;
this.loading = false;
});
}, },
created() { //
serveTimeFormat(row, column) {
return this.selectDictLabel(this.serveTimeOptions, row.serveTime);
},
signStatusFormat(row, column) {
return this.selectDictLabel(this.signStatusOptions, row.serveTime);
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
const defaultNutritionist = this.nutritionistIdOptions.find(
(opt) => opt.remark === "default"
);
const defaultProjectIdOption = this.conditioningProjectIdOption.find(
(opt) => opt.remark === "default"
);
this.form = {
id: null,
projectId: defaultProjectIdOption
? parseInt(defaultProjectIdOption.dictValue)
: null,
name: null,
phone: null,
serveTime: null,
amount: null,
path: null,
createBy: null,
nutritionistId: defaultNutritionist
? parseInt(defaultNutritionist.dictValue)
: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null,
};
this.resetForm("form");
},
//
nutritionistIdFormat(row, column) {
return this.selectDictLabel(
this.nutritionistIdOptions,
row.nutritionistId
);
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList(); this.getList();
getOptions().then(response => { },
const options = response.data.reduce((opts, cur) => { /** 重置按钮操作 */
if (!opts[cur.postCode]) { resetQuery() {
opts[cur.postCode] = [{dictValue: 0, dictLabel: ' ', remark: null}]; this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "创建合同";
},
/** 修改按钮操作 */
// handleUpdate(row) {
// this.reset();
// const id = row.id || this.ids
// getContract(id).then(response => {
// this.form = response.data;
// this.open = true;
// this.title = "";
// });
// },
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
// if (this.form.id != null) {
// updateContract(this.form).then(response => {
// if (response.code === 200) {
// this.msgSuccess("");
// this.open = false;
// this.getList();
// }
// });
// } else {
this.form.tutor = this.selectDictLabel(
this.nutritionistIdOptions,
this.form.nutritionistId
);
if (this.form.projectId != 0) {
this.form.servePromise = null;
} }
opts[cur.postCode].push({dictValue: cur.userId, dictLabel: cur.userName, remark: cur.remark}) addContract(this.form).then((response) => {
return opts; if (response.code === 200) {
}, {}) this.msgSuccess("新增成功");
this.nutritionistIdOptions = options['nutri'] || []; this.open = false;
}) this.getList();
this.getDicts("cus_serve_time").then(response => { }
this.serveTimeOptions = response.data; });
}); }
this.getDicts("cus_sign_status").then(response => { // }
this.signStatusOptions = response.data;
});
this.getDicts("conditioning_project").then(response => {
this.conditioningProjectIdOption = response.data;
}); });
}, },
methods: { /** 删除按钮操作 */
/** 查询合同列表 */ handleDelete(row) {
getList() { const ids = row.id || this.ids;
this.loading = true; this.$confirm('是否确认删除合同编号为"' + ids + '"的数据项?', "警告", {
listContract(this.queryParams).then(response => { confirmButtonText: "确定",
this.contractList = response.rows; cancelButtonText: "取消",
this.total = response.total; type: "warning",
this.loading = false; })
}); .then(function () {
},
//
serveTimeFormat(row, column) {
return this.selectDictLabel(this.serveTimeOptions, row.serveTime);
},
signStatusFormat(row, column) {
return this.selectDictLabel(this.signStatusOptions, row.serveTime);
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
const defaultNutritionist = this.nutritionistIdOptions.find(opt => opt.remark === 'default');
const defaultProjectIdOption = this.conditioningProjectIdOption.find(opt => opt.remark === 'default');
this.form = {
id: null,
projectId: defaultProjectIdOption ? parseInt(defaultProjectIdOption.dictValue) : null,
name: null,
phone: null,
serveTime: null,
amount: null,
path: null,
createBy: null,
nutritionistId: defaultNutritionist ? parseInt(defaultNutritionist.dictValue) : null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null
};
this.resetForm("form");
},
//
nutritionistIdFormat(row, column) {
return this.selectDictLabel(this.nutritionistIdOptions, row.nutritionistId);
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "创建合同";
},
/** 修改按钮操作 */
// handleUpdate(row) {
// this.reset();
// const id = row.id || this.ids
// getContract(id).then(response => {
// this.form = response.data;
// this.open = true;
// this.title = "";
// });
// },
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
// if (this.form.id != null) {
// updateContract(this.form).then(response => {
// if (response.code === 200) {
// this.msgSuccess("");
// this.open = false;
// this.getList();
// }
// });
// } else {
this.form.tutor = this.selectDictLabel(this.nutritionistIdOptions, this.form.nutritionistId)
if(this.form.projectId != 0){
this.form.servePromise = null;
}
addContract(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
}
});
}
// }
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除合同编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function () {
return delContract(ids); return delContract(ids);
}).then(() => { })
.then(() => {
this.getList(); this.getList();
this.msgSuccess("删除成功"); this.msgSuccess("删除成功");
}).catch(function () { })
}); .catch(function () {});
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
// handleExport() { // handleExport() {
// const queryParams = this.queryParams; // const queryParams = this.queryParams;
// this.$confirm('?', "", { // this.$confirm('?', "", {
// confirmButtonText: "", // confirmButtonText: "",
// cancelButtonText: "", // cancelButtonText: "",
// type: "warning" // type: "warning"
// }).then(function () { // }).then(function () {
// return exportContract(queryParams); // return exportContract(queryParams);
// }).then(response => { // }).then(response => {
// this.download(response.msg); // this.download(response.msg);
// }).catch(function () { // }).catch(function () {
// }); // });
// }, // },
handleCopy(path) { handleCopy(path) {
this.copyValue = window.location.origin.replace('manage', 'sign') + path; this.copyValue = window.location.origin.replace("manage", "sign") + path;
const btnCopy = new Clipboard('.copyBtn'); const btnCopy = new Clipboard(".copyBtn");
this.$message({ this.$message({
message: '拷贝成功', message: "拷贝成功",
type: 'success' type: "success",
}); });
// btnCopy.destroy(); // btnCopy.destroy();
}, },
handleLook(path) { handleLook(path) {
const url = window.location.origin.replace('manage', 'sign') + path; const url = window.location.origin.replace("manage", "sign") + path;
// const url = "http://stsign.busyinn.com" + path; // const url = "http://stsign.busyinn.com" + path;
window.open(url, '_blank'); window.open(url, "_blank");
} },
} },
}; };
</script> </script>

View File

@ -149,7 +149,11 @@
prop="salesman" prop="salesman"
:formatter="preSaleIdFormat" :formatter="preSaleIdFormat"
/> />
<el-table-column label="订单" align="center" v-hasPermi="['custom:order:list']"> <el-table-column
label="订单"
align="center"
v-hasPermi="['custom:order:list']"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
@ -159,7 +163,11 @@
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="合同" align="center" v-hasPermi="['custom:contract:list']"> <el-table-column
label="合同"
align="center"
v-hasPermi="['custom:contract:list']"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
@ -169,7 +177,11 @@
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="健康评估" align="center" v-hasPermi="['custom:healthy:list']"> <el-table-column
label="健康评估"
align="center"
v-hasPermi="['custom:healthy:list']"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
@ -179,17 +191,25 @@
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="外食热量统计" align="center" v-hasPermi="['custom:foodHeatStatistics:list']"> <el-table-column
label="外食热量统计"
align="center"
v-hasPermi="['custom:foodHeatStatistics:list']"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
@click="handleClickHeatStatistics(scope.row)" @click="handleClickHeatStatistics(scope.row)"
>详情 >详情
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="食谱计划" align="center" v-hasPermi="['recipes:recipesPlan:list']"> <el-table-column
label="食谱计划"
align="center"
v-hasPermi="['recipes:recipesPlan:list']"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
@ -339,13 +359,11 @@ import {
} from "@/api/custom/customer"; } from "@/api/custom/customer";
import store from "@/store"; import store from "@/store";
import { getOptions } from "@/api/custom/order";
import OrderDrawer from "@/components/OrderDrawer"; import OrderDrawer from "@/components/OrderDrawer";
import PhysicalSignsDialog from "@/components/PhysicalSignsDialog"; import PhysicalSignsDialog from "@/components/PhysicalSignsDialog";
import ContractDrawer from "@/components/ContractDrawer"; import ContractDrawer from "@/components/ContractDrawer";
import HeatStatisticsDrawer from "@/components/HeatStatisticsDrawer"; import HeatStatisticsDrawer from "@/components/HeatStatisticsDrawer";
import { mapGetters } from "vuex";
export default { export default {
name: "Customer", name: "Customer",
@ -353,7 +371,7 @@ export default {
"order-drawer": OrderDrawer, "order-drawer": OrderDrawer,
"physical-signs-dialog": PhysicalSignsDialog, "physical-signs-dialog": PhysicalSignsDialog,
"contract-drawer": ContractDrawer, "contract-drawer": ContractDrawer,
"heatStatisticsDrawer": HeatStatisticsDrawer heatStatisticsDrawer: HeatStatisticsDrawer,
}, },
data() { data() {
const userId = store.getters && store.getters.userId; const userId = store.getters && store.getters.userId;
@ -374,13 +392,13 @@ export default {
// //
customerCenterList: [], customerCenterList: [],
// //
preSaleIdOptions: [], // preSaleIdOptions: [],
// //
afterSaleIdOptions: [], // afterSaleIdOptions: [],
// //
nutritionistIdOptions: [], // nutritionistIdOptions: [],
// //
nutriAssisIdOptions: [], // nutriAssisIdOptions: [],
// //
title: "", title: "",
// //
@ -437,25 +455,14 @@ export default {
}, },
created() { created() {
this.getList(); this.getList();
getOptions().then((response) => { },
const options = response.data.reduce((opts, cur) => { computed: {
if (!opts[cur.postCode]) { ...mapGetters([
opts[cur.postCode] = [ "preSaleIdOptions",
{ dictValue: 0, dictLabel: "无", remark: null }, "afterSaleIdOptions",
]; "nutritionistIdOptions",
} "nutriAssisIdOptions",
opts[cur.postCode].push({ ]),
dictValue: cur.userId,
dictLabel: cur.userName,
remark: cur.remark,
});
return opts;
}, {});
this.preSaleIdOptions = options["pre_sale"] || [];
this.afterSaleIdOptions = options["after_sale"] || [];
this.nutritionistIdOptions = options["nutri"] || [];
this.nutriAssisIdOptions = options["nutri_assis"] || [];
});
}, },
methods: { methods: {
/** 查询客户档案列表 */ /** 查询客户档案列表 */
@ -504,7 +511,7 @@ export default {
handleOnMenuClick(row) { handleOnMenuClick(row) {
// console.log(row); // console.log(row);
}, },
handleClickHeatStatistics(row){ handleClickHeatStatistics(row) {
this.$refs["heatStatisticsRef"].showDrawer(row); this.$refs["heatStatisticsRef"].showDrawer(row);
}, },
// //

View File

@ -1,16 +1,30 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form
:model="queryParams"
ref="queryForm"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="进粉日期" prop="fanTime"> <el-form-item label="进粉日期" prop="fanTime">
<el-date-picker clearable style="width: 200px" <el-date-picker
v-model="queryParams.fanTime" clearable
type="date" style="width: 200px"
value-format="yyyy-MM-dd" v-model="queryParams.fanTime"
placeholder="选择日期"> type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期"
>
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="销售" prop="userId" label-width="68px"> <el-form-item label="销售" prop="userId" label-width="68px">
<el-select v-model="queryParams.userId" placeholder="请选择销售" filterable clearable> <el-select
v-model="queryParams.userId"
placeholder="请选择销售"
filterable
clearable
>
<el-option <el-option
v-for="dict in preSaleIdOptions" v-for="dict in preSaleIdOptions"
:key="dict.dictValue" :key="dict.dictValue"
@ -20,7 +34,12 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="进粉渠道" prop="accountId" label-width="88px"> <el-form-item label="进粉渠道" prop="accountId" label-width="88px">
<el-select v-model="queryParams.accountId" filterable placeholder="请选择渠道" clearable> <el-select
v-model="queryParams.accountId"
filterable
placeholder="请选择渠道"
clearable
>
<el-option <el-option
v-for="dict in accountIdOptions" v-for="dict in accountIdOptions"
:key="dict.dictValue" :key="dict.dictValue"
@ -30,8 +49,16 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item style="margin-left: 20px"> <el-form-item style="margin-left: 20px">
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> type="cyan"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -43,7 +70,8 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['custom:fanStatistics:add']" v-hasPermi="['custom:fanStatistics:add']"
>新增</el-button> >新增</el-button
>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -53,7 +81,8 @@
:disabled="single" :disabled="single"
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['custom:fanStatistics:edit']" v-hasPermi="['custom:fanStatistics:edit']"
>修改</el-button> >修改</el-button
>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -63,7 +92,8 @@
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['custom:fanStatistics:remove']" v-hasPermi="['custom:fanStatistics:remove']"
>删除</el-button> >删除</el-button
>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -72,16 +102,30 @@
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['custom:fanStatistics:export']" v-hasPermi="['custom:fanStatistics:export']"
>导出</el-button> >导出</el-button
>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="fanStatisticsList" stripe @selection-change="handleSelectionChange"> <el-table
v-loading="loading"
:data="fanStatisticsList"
stripe
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="进粉日期" align="center" prop="fanTime" width="180"> <el-table-column
label="进粉日期"
align="center"
prop="fanTime"
width="180"
>
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.fanTime, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.fanTime, "{y}-{m}-{d}") }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="销售" align="center" prop="userName" /> <el-table-column label="销售" align="center" prop="userName" />
@ -94,7 +138,11 @@
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column>--> </el-table-column>-->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
@ -102,43 +150,55 @@
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['custom:fanStatistics:edit']" v-hasPermi="['custom:fanStatistics:edit']"
>修改</el-button> >修改</el-button
>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['custom:fanStatistics:remove']" v-hasPermi="['custom:fanStatistics:remove']"
>删除</el-button> >删除</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total > 0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
layout="total, slot, sizes, prev, pager, next, jumper" layout="total, slot, sizes, prev, pager, next, jumper"
@pagination="getList" @pagination="getList"
> >
<span style="margin-right: 12px;font-size:13px;color:rgb(134 136 140)">总计进粉量 {{totalFanNum}}</span> <span style="margin-right: 12px; font-size: 13px; color: rgb(134 136 140)"
>总计进粉量 {{ totalFanNum }}</span
>
</pagination> </pagination>
<!-- 添加进粉统计对话框 --> <!-- 添加进粉统计对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="进粉日期" prop="fanTime"> <el-form-item label="进粉日期" prop="fanTime">
<el-date-picker clearable style="width: 200px" <el-date-picker
v-model="form.fanTime" clearable
type="date" style="width: 200px"
value-format="yyyy-MM-dd" v-model="form.fanTime"
placeholder="选择日期"> type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期"
>
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="销售" prop="userId"> <el-form-item label="销售" prop="userId">
<el-select v-model="form.userId" placeholder="请选择销售" filterable clearable size="small"> <el-select
v-model="form.userId"
placeholder="请选择销售"
filterable
clearable
size="small"
>
<el-option <el-option
v-for="dict in preSaleIdOptions" v-for="dict in preSaleIdOptions"
:key="dict.dictValue" :key="dict.dictValue"
@ -147,326 +207,355 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<p style="margin: 20px auto 20px 40px;font-size: 16px;">请先选择销售再填写每个微信号对应进粉数量</p> <p style="margin: 20px auto 20px 40px; font-size: 16px">
请先选择销售再填写每个微信号对应进粉数量
</p>
<div v-if="showWxFlag"> <div v-if="showWxFlag">
<div v-for="(item, index) in wxList" style="margin: 10px auto auto 40px;"> <div
<span>{{item.wxAccount}}</span><el-input-number controls-position="right" v-model="form.fanNum[index]" style="width: 150px;margin-left: 10px" :min="0" :max="1000000000"></el-input-number> v-for="(item, index) in wxList"
style="margin: 10px auto auto 40px"
>
<span>{{ item.wxAccount }}</span
><el-input-number
controls-position="right"
v-model="form.fanNum[index]"
style="width: 150px; margin-left: 10px"
:min="0"
:max="1000000000"
></el-input-number>
</div> </div>
</div> </div>
</el-form> </el-form>
<div slot="footer" class="dialog-footer" > <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<!-- 修改进粉统计对话框 --> <!-- 修改进粉统计对话框 -->
<el-dialog :title="title" :visible.sync="editOpen" width="500px" append-to-body> <el-dialog
:title="title"
:visible.sync="editOpen"
width="500px"
append-to-body
>
<el-form ref="editForm" :model="editForm" :rules="editRules"> <el-form ref="editForm" :model="editForm" :rules="editRules">
<el-form-item label="进粉日期" prop="fanTime"> <el-form-item label="进粉日期" prop="fanTime">
<el-date-picker clearable style="width: 200px" <el-date-picker
v-model="editForm.fanTime" clearable
type="date" style="width: 200px"
value-format="yyyy-MM-dd" v-model="editForm.fanTime"
placeholder="选择日期"> type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期"
>
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="进粉数量" prop="fanNum"> <el-form-item label="进粉数量" prop="fanNum">
<el-input-number controls-position="right" v-model="editForm.fanNum" :min="0" :max="1000000000"></el-input-number> <el-input-number
controls-position="right"
v-model="editForm.fanNum"
:min="0"
:max="1000000000"
></el-input-number>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer" > <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="editSubmit"> </el-button> <el-button type="primary" @click="editSubmit"> </el-button>
<el-button @click="editCancel"> </el-button> <el-button @click="editCancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { listFanStatistics, getFanStatistics, delFanStatistics, addFanStatistics, updateFanStatistics, exportFanStatistics, getWxByUserId } from "@/api/custom/fanStatistics"; import {
import { getOptions } from "@/api/custom/order"; listFanStatistics,
import store from "@/store"; getFanStatistics,
import dayjs from "dayjs"; delFanStatistics,
const loginUserId = store.getters && store.getters.userId; addFanStatistics,
const nowDate = dayjs().subtract(1, 'day').format("YYYY-MM-DD"); updateFanStatistics,
export default { exportFanStatistics,
name: "FanStatistics", getWxByUserId,
data() { } from "@/api/custom/fanStatistics";
const checkOrderTime = (rule, value, callback) => { import store from "@/store";
if (!value) { import dayjs from "dayjs";
return callback(new Error("成交时间不能为空")); import { mapState } from "vuex";
const loginUserId = store.getters && store.getters.userId;
const nowDate = dayjs().subtract(1, "day").format("YYYY-MM-DD");
export default {
name: "FanStatistics",
data() {
const checkOrderTime = (rule, value, callback) => {
if (!value) {
return callback(new Error("成交时间不能为空"));
}
callback();
};
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
totalFanNum: 0,
//
fanStatisticsList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
fanTime: nowDate,
userId: null,
accountId: null,
},
//
form: {},
//
rules: {
fanTime: [{ required: true, trigger: "blur", message: "请选择日期" }],
userId: [{ required: true, trigger: "blur", message: "请选择销售" }],
},
showWxFlag: false,
//
wxList: [],
//
accountIdOptions: [],
editOpen: false,
editForm: {},
//
editRules: {
fanTime: [{ required: true, trigger: "blur", message: "请选择日期" }],
fanNum: [
{ required: true, trigger: "blur", message: "请输入进粉数量" },
],
},
};
},
created() {
this.getList();
this.getDicts("fan_channel").then((response) => {
this.accountIdOptions = response.data;
});
},
computed: {
...mapState({
//
preSaleIdOptions: (state) => state.global.preSaleIdOptions.slice(1),
}),
},
methods: {
/** 查询进粉统计列表 */
getList() {
this.loading = true;
listFanStatistics(this.queryParams).then((response) => {
this.fanStatisticsList = response.rows;
this.totalFanNum = 0;
if (
this.fanStatisticsList != null &&
this.fanStatisticsList.length > 0
) {
this.totalFanNum = this.fanStatisticsList[0].totalFanNum;
} }
callback(); this.total = response.total;
}; this.loading = false;
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
totalFanNum: 0,
//
fanStatisticsList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
fanTime: nowDate,
userId: null,
accountId: null
},
//
form: {},
//
rules: {
fanTime: [{ required: true, trigger: "blur", message: "请选择日期" }],
userId: [{ required: true, trigger: "blur", message: "请选择销售" }]
},
showWxFlag:false,
//
wxList:[],
//
preSaleIdOptions:[],
//
accountIdOptions:[],
editOpen: false,
editForm:{},
//
editRules: {
fanTime: [{ required: true, trigger: "blur", message: "请选择日期" }],
fanNum: [{ required: true, trigger: "blur", message: "请输入进粉数量" }],
},
};
},
created() {
this.getList();
this.getSaleUserList();
this.getDicts("fan_channel").then((response) => {
this.accountIdOptions = response.data;
}); });
}, },
methods: { //
/** 查询进粉统计列表 */ cancel() {
getList() { this.open = false;
this.loading = true; this.reset();
listFanStatistics(this.queryParams).then(response => { },
this.fanStatisticsList = response.rows; //
this.totalFanNum = 0; editCancel() {
if(this.fanStatisticsList != null && this.fanStatisticsList.length > 0){ this.editOpen = false;
this.totalFanNum = this.fanStatisticsList[0].totalFanNum; this.editFormReset();
},
//
reset() {
this.form = {
userId: null,
fanTime: nowDate,
wxId: [],
fanNum: [],
};
this.wxList = [];
this.showWxFlag = false;
this.resetForm("form");
},
editFormReset() {
this.editForm = {
id: null,
wxId: null,
fanTime: null,
fanNum: 0,
};
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
//
const defaultUserId = this.preSaleIdOptions.find(
(opt) => opt.dictValue === loginUserId
);
if (defaultUserId) {
this.form.userId = defaultUserId.dictValue;
}
this.open = true;
this.title = "添加进粉统计";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.editFormReset();
const id = row.id || this.ids;
getFanStatistics(id).then((response) => {
this.editForm.id = response.data.id;
this.editForm.wxId = response.data.wxId;
this.editForm.fanTime = response.data.fanTime;
this.editForm.fanNum = response.data.fanNum;
this.editOpen = true;
this.title = "修改「" + row.wxAccount + "」的进粉统计";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.wxId.length == 0) {
this.msgError("该销售未被分配微信");
return;
} }
this.total = response.total; let flag = true;
this.loading = false; this.form.fanNum.forEach((value, index) => {
}); if (value == null || value == undefined) {
}, this.msgError("请填写进粉数量");
// flag = false;
cancel() { return;
this.open = false;
this.reset();
},
//
editCancel() {
this.editOpen = false;
this.editFormReset();
},
//
reset() {
this.form = {
userId: null,
fanTime: nowDate,
wxId: [],
fanNum: []
};
this.wxList = [];
this.showWxFlag = false;
this.resetForm("form");
},
editFormReset(){
this.editForm = {
id: null,
wxId: null,
fanTime: null,
fanNum: 0
};
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
//
const defaultUserId = this.preSaleIdOptions.find(
(opt) => opt.dictValue === loginUserId
);
if (defaultUserId){
this.form.userId = defaultUserId.dictValue;
}
this.open = true;
this.title = "添加进粉统计";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.editFormReset();
const id = row.id || this.ids
getFanStatistics(id).then(response => {
this.editForm.id = response.data.id;
this.editForm.wxId = response.data.wxId;
this.editForm.fanTime = response.data.fanTime;
this.editForm.fanNum = response.data.fanNum;
this.editOpen = true;
this.title = "修改「"+row.wxAccount+"」的进粉统计";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if(this.form.wxId.length == 0){
this.msgError("该销售未被分配微信");
return;
} }
let flag = true; });
this.form.fanNum.forEach( (value, index) => { if (flag) {
if(value == null || value == undefined){ addFanStatistics(this.form).then((response) => {
this.msgError("请填写进粉数量");
flag = false;
return;
}
});
if(flag){
addFanStatistics(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("新增成功");
this.open = false;
this.reset();
this.getList();
}
});
}
}else{
this.msgError("数据未填写完整");
}
});
},
editSubmit(){
this.$refs["editForm"].validate(valid => {
if (valid) {
updateFanStatistics(this.editForm).then(response => {
if (response.code === 200) { if (response.code === 200) {
this.msgSuccess("修改成功"); this.msgSuccess("新增成功");
this.editOpen = false; this.open = false;
this.reset();
this.getList(); this.getList();
} }
}); });
}else{
this.msgError("数据未填写完整");
} }
}); } else {
}, this.msgError("数据未填写完整");
/** 删除按钮操作 */ }
handleDelete(row) { });
const ids = row.id || this.ids; },
this.$confirm('是否确认删除进粉统计编号为"' + ids + '"的数据项?', "警告", { editSubmit() {
this.$refs["editForm"].validate((valid) => {
if (valid) {
updateFanStatistics(this.editForm).then((response) => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.editOpen = false;
this.getList();
}
});
} else {
this.msgError("数据未填写完整");
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm(
'是否确认删除进粉统计编号为"' + ids + '"的数据项?',
"警告",
{
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning",
}).then(function() { }
)
.then(function () {
return delFanStatistics(ids); return delFanStatistics(ids);
}).then(() => { })
.then(() => {
this.getList(); this.getList();
this.msgSuccess("删除成功"); this.msgSuccess("删除成功");
}).catch(function() {}); })
}, .catch(function () {});
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有进粉统计数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return exportFanStatistics(queryParams);
}).then(response => {
this.download(response.msg);
}).catch(function() {});
},
//
getSaleUserList(){
getOptions().then((response) => {
const options = response.data.reduce((opts, cur) => {
if (!opts[cur.postCode]) {
opts[cur.postCode] = [];
}
opts[cur.postCode].push({
dictValue: cur.userId,
dictLabel: cur.userName,
remark: cur.remark,
});
return opts;
}, {});
this.preSaleIdOptions = options["pre_sale"] || [];
});
},
//ID
getWxByUserId(userId){
this.showWxFlag = false;
this.form.wxId = [];
this.form.fanNum = [];
this.wxList = [];
if(userId == null || userId == undefined || userId == ""){
return;
}
getWxByUserId(userId).then(response => {
if (response.code === 200) {
this.wxList = response.data ? response.data : [];
if(this.wxList.length > 0){
for(let i=0; i < this.wxList.length; i++){
this.form.wxId[i] = this.wxList[i].wechatAccount;
this.form.fanNum[i] = 0;
}
this.showWxFlag = true;
}
}
});
},
}, },
watch: { /** 导出按钮操作 */
// ID handleExport() {
"form.userId": function (newVal, oldVal) { const queryParams = this.queryParams;
this.getWxByUserId(newVal); this.$confirm("是否确认导出所有进粉统计数据项?", "警告", {
}, confirmButtonText: "确定",
} cancelButtonText: "取消",
}; type: "warning",
})
.then(function () {
return exportFanStatistics(queryParams);
})
.then((response) => {
this.download(response.msg);
})
.catch(function () {});
},
//ID
getWxByUserId(userId) {
this.showWxFlag = false;
this.form.wxId = [];
this.form.fanNum = [];
this.wxList = [];
if (userId == null || userId == undefined || userId == "") {
return;
}
getWxByUserId(userId).then((response) => {
if (response.code === 200) {
this.wxList = response.data ? response.data : [];
if (this.wxList.length > 0) {
for (let i = 0; i < this.wxList.length; i++) {
this.form.wxId[i] = this.wxList[i].wechatAccount;
this.form.fanNum[i] = 0;
}
this.showWxFlag = true;
}
}
});
},
},
watch: {
// ID
"form.userId": function (newVal, oldVal) {
this.getWxByUserId(newVal);
},
},
};
</script> </script>

View File

@ -335,7 +335,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="客户姓名" align="center" prop="customer" /> <el-table-column label="客户姓名" align="center" prop="customer" />
<el-table-column label="手机号" align="center" prop="phone" width="100" /> <!-- <el-table-column label="手机号" align="center" prop="phone" width="100" /> -->
<el-table-column label="成交金额" align="center" prop="amount"> <el-table-column label="成交金额" align="center" prop="amount">
<template slot-scope="scope"> <template slot-scope="scope">
{{ toThousands(scope.row.amount) }} {{ toThousands(scope.row.amount) }}
@ -386,7 +386,7 @@
v-hasPermi="['custom:order:edit']" v-hasPermi="['custom:order:edit']"
>修改 >修改
</el-button> </el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-s-data" icon="el-icon-s-data"
@ -455,6 +455,7 @@ import orderPause from "./orderPause";
import OrderDetail from "@/components/OrderDetail"; import OrderDetail from "@/components/OrderDetail";
import OrderEdit from "@/components/OrderEdit"; import OrderEdit from "@/components/OrderEdit";
import AutoHideMessage from "@/components/AutoHideMessage"; import AutoHideMessage from "@/components/AutoHideMessage";
import { mapGetters } from "vuex";
const beginTime = dayjs().startOf("month").format("YYYY-MM-DD"); const beginTime = dayjs().startOf("month").format("YYYY-MM-DD");
const endTime = dayjs().format("YYYY-MM-DD"); const endTime = dayjs().format("YYYY-MM-DD");
@ -492,16 +493,6 @@ export default {
daterange: [beginTime, endTime], daterange: [beginTime, endTime],
// //
payTypeIdOptions: [], payTypeIdOptions: [],
//
preSaleIdOptions: [],
//
afterSaleIdOptions: [],
//
nutritionistIdOptions: [],
//
nutriAssisIdOptions: [],
//
plannerIdOptions: [],
// //
accountIdOptions: [], accountIdOptions: [],
// //
@ -510,12 +501,6 @@ export default {
conditioningProjectIdOption: [], conditioningProjectIdOption: [],
// //
reviewStatusOptions: [], reviewStatusOptions: [],
//
plannerAssisIdOptions: [],
//
operatorIdOptions: [],
//
operatorAssisIdOptions: [],
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
@ -539,32 +524,28 @@ export default {
}, },
}; };
}, },
computed: {
...mapGetters([
//
"preSaleIdOptions",
//
"afterSaleIdOptions",
//
"nutritionistIdOptions",
//
"nutriAssisIdOptions",
//
"plannerIdOptions",
//
"plannerAssisIdOptions",
//
"operatorIdOptions",
//
"operatorAssisIdOptions",
]),
},
created() { created() {
this.getList(); this.getList();
getOptions().then((response) => {
const options = response.data.reduce((opts, cur) => {
if (!opts[cur.postCode]) {
opts[cur.postCode] = [
// { dictValue: 0, dictLabel: "", remark: null },
];
}
opts[cur.postCode].push({
dictValue: cur.userId,
dictLabel: cur.userName,
remark: cur.remark,
});
return opts;
}, {});
this.preSaleIdOptions = options["pre_sale"] || [];
this.afterSaleIdOptions = options["after_sale"] || [];
this.nutritionistIdOptions = options["nutri"] || [];
this.nutriAssisIdOptions = options["nutri_assis"] || [];
this.plannerIdOptions = options["planner"] || [];
this.plannerAssisIdOptions = options["planner_assis"] || [];
this.operatorIdOptions = options["operator"] || [];
this.operatorAssisIdOptions = options["operator_assis"] || [];
});
this.getDicts("cus_pay_type").then((response) => { this.getDicts("cus_pay_type").then((response) => {
this.payTypeIdOptions = response.data; this.payTypeIdOptions = response.data;
}); });

View File

@ -330,6 +330,7 @@ import { getOptions } from "@/api/custom/order";
// import BodySignDetail from "@/components/BodySignDetail"; // import BodySignDetail from "@/components/BodySignDetail";
import dayjs from "dayjs"; import dayjs from "dayjs";
import store from "@/store"; import store from "@/store";
import { mapState } from "vuex";
const nextDate = dayjs().add(1, "day").format("YYYY-MM-DD"); const nextDate = dayjs().add(1, "day").format("YYYY-MM-DD");
const weekDate = dayjs().add(6, "day").format("YYYY-MM-DD"); const weekDate = dayjs().add(6, "day").format("YYYY-MM-DD");
@ -377,7 +378,7 @@ export default {
allRecipesPlanList: [], allRecipesPlanList: [],
// //
allRecipesPlanOpen: false, allRecipesPlanOpen: false,
allRecipesPlanTitle: '', allRecipesPlanTitle: "",
// //
allRecipesPlanQueryParam: { allRecipesPlanQueryParam: {
pageNum: 1, pageNum: 1,
@ -387,47 +388,41 @@ export default {
}, },
// //
allRecipesPlanTotal: 0, allRecipesPlanTotal: 0,
//
nutritionistIdOptions: [],
//
nutriAssisIdOptions: [],
}; };
}, },
components: { components: {
// "order-dialog": OrderDetail, // "order-dialog": OrderDetail,
// body_sign_dialog: BodySignDetail, // body_sign_dialog: BodySignDetail,
}, },
created() { computed: {
getOptions().then((response) => { ...mapState({
const options = response.data.reduce((opts, cur) => { //
if (!opts[cur.postCode]) { nutritionistIdOptions: (state) =>
opts[cur.postCode] = [ state.global.nutritionistIdOptions.slice(1),
{ dictValue: null, dictLabel: "全部", remark: null }, //
]; nutriAssisIdOptions: (state) => state.global.nutriAssisIdOptions.slice(1),
}),
},
watch: {
nutritionistIdOptions: function (val, oldVal) {
if (val.length && !oldVal.length) {
const tarObj = val.find((opt) => opt.dictValue == userId);
if (tarObj) {
this.queryParams.nutritionistId = userId;
} }
opts[cur.postCode].push({
dictValue: cur.userId,
dictLabel: cur.userName,
remark: cur.remark,
});
return opts;
}, {});
this.nutritionistIdOptions = options["nutri"] || [];
this.nutriAssisIdOptions = options["nutri_assis"] || [];
const defaultNutritionist = this.nutritionistIdOptions.find(
(opt) => opt.dictValue == userId
);
const defaultNutriAssisId = this.nutriAssisIdOptions.find(
(opt) => opt.dictValue == userId
);
if (defaultNutritionist) {
this.queryParams.nutritionistId = userId;
} }
if (defaultNutriAssisId) { },
this.queryParams.nutritionistAssisId = userId; nutriAssisIdOptions: function (val, oldVal) {
if (val.length && !oldVal.length) {
const tarObj = val.find((opt) => opt.dictValue == userId);
if (tarObj) {
this.queryParams.nutritionistAssisId = userId;
}
} }
this.getList(); },
}); },
created() {
this.getList();
}, },
methods: { methods: {
/** 查询食谱计划列表 */ /** 查询食谱计划列表 */
@ -476,7 +471,7 @@ export default {
dayjs(item.endDate).format("YYYY-MM-DD"); dayjs(item.endDate).format("YYYY-MM-DD");
}); });
this.allRecipesPlanOpen = true; this.allRecipesPlanOpen = true;
this.allRecipesPlanTitle = `${this.allRecipesPlanList[0].customer}」食谱计划表` this.allRecipesPlanTitle = `${this.allRecipesPlanList[0].customer}」食谱计划表`;
this.allRecipesPlanTotal = response.total; this.allRecipesPlanTotal = response.total;
}); });
}, },

View File

@ -1,8 +1,20 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form
:model="queryParams"
ref="queryForm"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="销售" prop="userId"> <el-form-item label="销售" prop="userId">
<el-select v-model="queryParams.userId" placeholder="请选择销售" filterable clearable size="small"> <el-select
v-model="queryParams.userId"
placeholder="请选择销售"
filterable
clearable
size="small"
>
<el-option <el-option
v-for="dict in preSaleIdOptions" v-for="dict in preSaleIdOptions"
:key="dict.dictValue" :key="dict.dictValue"
@ -12,7 +24,13 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="销售组别" prop="saleGroupId"> <el-form-item label="销售组别" prop="saleGroupId">
<el-select v-model="queryParams.saleGroupId" placeholder="请选择组别" filterable clearable size="small"> <el-select
v-model="queryParams.saleGroupId"
placeholder="请选择组别"
filterable
clearable
size="small"
>
<el-option <el-option
v-for="dict in saleGroupOptions" v-for="dict in saleGroupOptions"
:key="dict.dictValue" :key="dict.dictValue"
@ -22,7 +40,13 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="进粉渠道" prop="accountId"> <el-form-item label="进粉渠道" prop="accountId">
<el-select v-model="queryParams.accountId" filterable placeholder="请选择渠道" clearable size="small"> <el-select
v-model="queryParams.accountId"
filterable
placeholder="请选择渠道"
clearable
size="small"
>
<el-option <el-option
v-for="dict in accountIdOptions" v-for="dict in accountIdOptions"
:key="dict.dictValue" :key="dict.dictValue"
@ -41,8 +65,16 @@
/> />
</el-form-item>--> </el-form-item>-->
<el-form-item> <el-form-item>
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> type="cyan"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -54,7 +86,8 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['custom:wxDistribution:add']" v-hasPermi="['custom:wxDistribution:add']"
>新增</el-button> >新增</el-button
>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -64,7 +97,8 @@
:disabled="single" :disabled="single"
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['custom:wxDistribution:edit']" v-hasPermi="['custom:wxDistribution:edit']"
>修改</el-button> >修改</el-button
>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -74,7 +108,8 @@
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['custom:wxDistribution:remove']" v-hasPermi="['custom:wxDistribution:remove']"
>删除</el-button> >删除</el-button
>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -83,24 +118,42 @@
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['custom:wxDistribution:export']" v-hasPermi="['custom:wxDistribution:export']"
>导出</el-button> >导出</el-button
>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="wxDistributionList" stripe @selection-change="handleSelectionChange"> <el-table
v-loading="loading"
:data="wxDistributionList"
stripe
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="销售姓名" align="center" prop="userName" /> <el-table-column label="销售姓名" align="center" prop="userName" />
<el-table-column label="微信昵称" align="center" prop="wxNickName" /> <el-table-column label="微信昵称" align="center" prop="wxNickName" />
<el-table-column label="微信号" align="center" prop="wxAccount" /> <el-table-column label="微信号" align="center" prop="wxAccount" />
<el-table-column label="进粉渠道" align="center" prop="account" /> <el-table-column label="进粉渠道" align="center" prop="account" />
<el-table-column label="销售组别" align="center" prop="saleGroup" /> <el-table-column label="销售组别" align="center" prop="saleGroup" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> <el-table-column
label="创建时间"
align="center"
prop="createTime"
width="180"
>
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.createTime, "{y}-{m}-{d}") }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
@ -108,20 +161,22 @@
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['custom:wxDistribution:edit']" v-hasPermi="['custom:wxDistribution:edit']"
>修改</el-button> >修改</el-button
>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['custom:wxDistribution:remove']" v-hasPermi="['custom:wxDistribution:remove']"
>删除</el-button> >删除</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total > 0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@ -132,7 +187,13 @@
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="销售" prop="userId"> <el-form-item label="销售" prop="userId">
<el-select v-model="form.userId" placeholder="请选择销售" filterable clearable size="small"> <el-select
v-model="form.userId"
placeholder="请选择销售"
filterable
clearable
size="small"
>
<el-option <el-option
v-for="dict in preSaleIdOptions" v-for="dict in preSaleIdOptions"
:key="dict.dictValue" :key="dict.dictValue"
@ -142,7 +203,13 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="销售组别" prop="saleGroupId"> <el-form-item label="销售组别" prop="saleGroupId">
<el-select v-model="form.saleGroupId" placeholder="请选择组别" filterable clearable size="small"> <el-select
v-model="form.saleGroupId"
placeholder="请选择组别"
filterable
clearable
size="small"
>
<el-option <el-option
v-for="dict in saleGroupOptions" v-for="dict in saleGroupOptions"
:key="dict.dictValue" :key="dict.dictValue"
@ -152,7 +219,13 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="进粉渠道" prop="accountId"> <el-form-item label="进粉渠道" prop="accountId">
<el-select v-model="form.accountId" filterable placeholder="请选择渠道" clearable size="small"> <el-select
v-model="form.accountId"
filterable
placeholder="请选择渠道"
clearable
size="small"
>
<el-option <el-option
v-for="dict in accountIdOptions" v-for="dict in accountIdOptions"
:key="dict.dictValue" :key="dict.dictValue"
@ -162,7 +235,13 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="微信号" prop="wechatAccount"> <el-form-item label="微信号" prop="wechatAccount">
<el-select v-model="form.wechatAccount" filterable placeholder="请选择微信号" clearable size="small"> <el-select
v-model="form.wechatAccount"
filterable
placeholder="请选择微信号"
clearable
size="small"
>
<el-option <el-option
v-for="dict in wxAccountList" v-for="dict in wxAccountList"
:key="dict.id" :key="dict.id"
@ -181,196 +260,210 @@
</template> </template>
<script> <script>
import { listWxDistribution, getWxDistribution, delWxDistribution, addWxDistribution, updateWxDistribution, exportWxDistribution } from "@/api/custom/wxDistribution"; import {
import {getOptions} from "@/api/custom/order"; listWxDistribution,
import { listWxAccount } from "@/api/custom/wxAccount"; getWxDistribution,
export default { delWxDistribution,
name: "WxDistribution", addWxDistribution,
data() { updateWxDistribution,
return { exportWxDistribution,
// } from "@/api/custom/wxDistribution";
loading: true, import { getOptions } from "@/api/custom/order";
// import { listWxAccount } from "@/api/custom/wxAccount";
ids: [], import { mapState } from "vuex";
// export default {
single: true, name: "WxDistribution",
// data() {
multiple: true, return {
// //
showSearch: true, loading: true,
// //
total: 0, ids: [],
// //
wxDistributionList: [], single: true,
// //
title: "", multiple: true,
// //
open: false, showSearch: true,
// //
queryParams: { total: 0,
pageNum: 1, //
pageSize: 10, wxDistributionList: [],
userId: null, //
saleGroupId: null, title: "",
accountId: null, //
wechatAccount: null, open: false,
}, //
// queryParams: {
form: {}, pageNum: 1,
// pageSize: 10,
rules: { userId: null,
userId: [{ required: true, trigger: "blur", message: "请选择销售" }], saleGroupId: null,
saleGroupId: [{ required: true, trigger: "blur", message: "请选择组别" }], accountId: null,
accountId: [{ required: true, trigger: "blur", message: "请选择进粉账号" }], wechatAccount: null,
wechatAccount: [{ required: true, trigger: "blur", message: "请选择微信号" }] },
}, //
// form: {},
preSaleIdOptions:[], //
// rules: {
accountIdOptions:[], userId: [{ required: true, trigger: "blur", message: "请选择销售" }],
// saleGroupId: [
saleGroupOptions:[], { required: true, trigger: "blur", message: "请选择组别" },
// ],
wxAccountList:[] accountId: [
}; { required: true, trigger: "blur", message: "请选择进粉账号" },
}, ],
created() { wechatAccount: [
this.getList(); { required: true, trigger: "blur", message: "请选择微信号" },
getOptions().then((response) => { ],
const options = response.data.reduce((opts, cur) => { },
if (!opts[cur.postCode]) { //
opts[cur.postCode] = []; accountIdOptions: [],
} //
opts[cur.postCode].push({ saleGroupOptions: [],
dictValue: cur.userId, //
dictLabel: cur.userName, wxAccountList: [],
remark: cur.remark, };
}); },
return opts; created() {
}, {}); this.getList();
this.preSaleIdOptions = options["pre_sale"] || []; this.getDicts("fan_channel").then((response) => {
}); this.accountIdOptions = response.data;
this.getDicts("fan_channel").then((response) => { });
this.accountIdOptions = response.data; this.getDicts("sale_group").then((response) => {
}); this.saleGroupOptions = response.data;
this.getDicts("sale_group").then((response) => { });
this.saleGroupOptions = response.data; this.getListWxAccount();
}); },
this.getListWxAccount(); computed: {
}, ...mapState({
methods: { //
/** 查询微信分配管理列表 */ preSaleIdOptions: (state) => state.global.preSaleIdOptions.slice(1),
getList() { }),
this.loading = true; },
listWxDistribution(this.queryParams).then(response => { methods: {
this.wxDistributionList = response.rows; /** 查询微信分配管理列表 */
getList() {
this.loading = true;
listWxDistribution(this.queryParams).then((response) => {
this.wxDistributionList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
}); });
}, },
// //
cancel() { cancel() {
this.open = false; this.open = false;
this.reset(); this.reset();
}, },
// //
reset() { reset() {
this.form = { this.form = {
userId: null, userId: null,
saleGroupId: null, saleGroupId: null,
accountId: null, accountId: null,
wechatAccount: null wechatAccount: null,
}; };
this.resetForm("form"); this.resetForm("form");
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
this.getList(); this.getList();
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm("queryForm"); this.resetForm("queryForm");
this.handleQuery(); this.handleQuery();
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id) this.ids = selection.map((item) => item.id);
this.single = selection.length!==1 this.single = selection.length !== 1;
this.multiple = !selection.length this.multiple = !selection.length;
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = "添加微信分配"; this.title = "添加微信分配";
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
const id = row.id || this.ids const id = row.id || this.ids;
getWxDistribution(id).then(response => { getWxDistribution(id).then((response) => {
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
this.title = "修改微信分配"; this.title = "修改微信分配";
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
if (this.form.id != null) { if (this.form.id != null) {
updateWxDistribution(this.form).then(response => { updateWxDistribution(this.form).then((response) => {
if (response.code === 200) { if (response.code === 200) {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
} }
}); });
} else { } else {
addWxDistribution(this.form).then(response => { addWxDistribution(this.form).then((response) => {
if (response.code === 200) { if (response.code === 200) {
this.msgSuccess("新增成功"); this.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
} }
}); });
}
} }
}); }
}, });
/** 删除按钮操作 */ },
handleDelete(row) { /** 删除按钮操作 */
const ids = row.id || this.ids; handleDelete(row) {
this.$confirm('是否确认删除微信号为"' + row.wxNickName + '"的数据项?', "警告", { const ids = row.id || this.ids;
this.$confirm(
'是否确认删除微信号为"' + row.wxNickName + '"的数据项?',
"警告",
{
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning",
}).then(function() { }
)
.then(function () {
return delWxDistribution(ids); return delWxDistribution(ids);
}).then(() => { })
.then(() => {
this.getList(); this.getList();
this.msgSuccess("删除成功"); this.msgSuccess("删除成功");
}).catch(function() {}); })
}, .catch(function () {});
/** 导出按钮操作 */ },
handleExport() { /** 导出按钮操作 */
const queryParams = this.queryParams; handleExport() {
this.$confirm('是否确认导出所有微信分配数据项?', "警告", { const queryParams = this.queryParams;
confirmButtonText: "确定", this.$confirm("是否确认导出所有微信分配数据项?", "警告", {
cancelButtonText: "取消", confirmButtonText: "确定",
type: "warning" cancelButtonText: "取消",
}).then(function() { type: "warning",
})
.then(function () {
return exportWxDistribution(queryParams); return exportWxDistribution(queryParams);
}).then(response => { })
.then((response) => {
this.download(response.msg); this.download(response.msg);
}).catch(function() {}); })
}, .catch(function () {});
getListWxAccount() { },
listWxAccount(this.queryParams).then(response => { getListWxAccount() {
this.wxAccountList = response.rows; listWxAccount(this.queryParams).then((response) => {
}); this.wxAccountList = response.rows;
} });
} },
}; },
};
</script> </script>