新增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
stdiet-ui/src
App.vue
api/custom
components
ContractAdd
OrderAdd
OrderEdit
layout/components
store
views/custom
commision
config
detail
detail_day
contract
customer
fanStatistics
order
recipesPlan
wxDistribution

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

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

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

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

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

@ -235,8 +235,9 @@
</el-dialog>
</template>
<script>
import { addOrder, getOptions, updateOrder } from "@/api/custom/order";
import { addOrder, updateOrder } from "@/api/custom/order";
import dayjs from "dayjs";
import { mapGetters } from "vuex";
export default {
name: "OrderEdit",
@ -354,16 +355,6 @@ export default {
},
//
payTypeIdOptions: [],
//
preSaleIdOptions: [],
//
afterSaleIdOptions: [],
//
nutritionistIdOptions: [],
//
nutriAssisIdOptions: [],
//
plannerIdOptions: [],
//
accountIdOptions: [],
//
@ -372,42 +363,13 @@ export default {
giveTimeIdOption: [],
//
conditioningProjectIdOption: [],
//
plannerAssisIdOptions: [],
//
operatorIdOptions: [],
//
reviewStatusOptions: [],
//
operatorAssisIdOptions: [],
//()
orderDropdownCorrespondingOptions: [],
};
},
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.payTypeIdOptions = response.data;
});
@ -435,6 +397,26 @@ export default {
this.orderDropdownCorrespondingOptions = response.data;
});
},
computed: {
...mapGetters([
//
"preSaleIdOptions",
//
"afterSaleIdOptions",
//
"nutritionistIdOptions",
//
"nutriAssisIdOptions",
//
"plannerIdOptions",
//
"plannerAssisIdOptions",
//
"operatorIdOptions",
//
"operatorAssisIdOptions",
]),
},
methods: {
showDialog(data, callback) {
// this.data = data;

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

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

@ -11,6 +11,15 @@ const getters = {
roles: state => state.user.roles,
permissions: state => state.user.permissions,
userId: state => state.user.userId,
permission_routes: state => state.permission.routes
}
export default getters
permission_routes: state => state.permission.routes,
//
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;

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

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

@ -1,8 +1,20 @@
<template>
<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-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
v-for="dict in postIdOptions"
:key="dict.dictValue"
@ -12,7 +24,12 @@
</el-select>
</el-form-item>
<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
v-for="dict in searchUserIdOptions"
:key="dict.dictValue"
@ -22,8 +39,16 @@
</el-select>
</el-form-item>
<el-form-item>
<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-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>
@ -35,7 +60,7 @@
size="mini"
@click="handleAdd"
v-hasPermi="['commision:config:add']"
>新增
>新增
</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
@ -70,25 +95,36 @@
<!-- >导出-->
<!-- </el-button>-->
<!-- </el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="commisionList" :span-method="objectSpanMethod"
@selection-change="handleSelectionChange">
<el-table-column label="业务员" align="center" prop="userName"/>
<el-table-column label="岗位" align="center" prop="postName"/>
<el-table
v-loading="loading"
:data="commisionList"
: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">
<template scope="scope">
{{toThousands(scope.row.amount)}}
{{ toThousands(scope.row.amount) }}
</template>
</el-table-column>
<el-table-column label="比例" align="center" prop="rate">
<template scope="scope">
{{scope.row.rate + '%'}}
{{ scope.row.rate + "%" }}
</template>
</el-table-column>
<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" prop="remark" />
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
@ -96,7 +132,7 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['commision:config:edit']"
>修改
>修改
</el-button>
<el-button
size="mini"
@ -104,14 +140,14 @@
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['commision:config:remove']"
>删除
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@ -124,7 +160,11 @@
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-col :span="12">
<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
v-for="dict in postIdOptions"
:key="dict.dictValue"
@ -148,17 +188,21 @@
</el-col>
<el-col :span="12">
<el-form-item label="金额" prop="amount">
<el-input v-model="form.amount" placeholder="请输入金额"/>
<el-input v-model="form.amount" placeholder="请输入金额" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="分成比例" prop="rate">
<el-input v-model="form.rate" placeholder="请输入比例"/>
<el-input v-model="form.rate" placeholder="请输入比例" />
</el-form-item>
</el-col>
<el-col :span="24">
<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-col>
</el-form>
@ -172,282 +216,307 @@
</template>
<script>
import {
listCommision,
getCommision,
delCommision,
addCommision,
updateCommision,
exportCommision,
} from "@/api/custom/commision";
import {
listCommision,
getCommision,
delCommision,
addCommision,
updateCommision,
exportCommision,
} from "@/api/custom/commision";
import {getOptions} from "@/api/custom/order";
import { getOptions } from "@/api/custom/global";
export default {
name: "CommisionConfig",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: false,
//
total: 0,
//
commisionList: [],
//
title: "",
//
open: false,
//
userIdOptions: [],
//
postIdOptions: [],
//
totalUserIdOptions: [],
//
searchUserIdOptions: [],
//
options: {},
//
queryParams: {
pageNum: 1,
pageSize: 10,
userId: null,
postId: null,
amount: null,
rate: null,
},
//
form: {},
//
rules: {
userId: [
{required: true, message: "业务员不能为空", trigger: "change"}
],
postId: [
{required: true, message: "岗位不能为空", trigger: "change"}
],
amount: [
{required: true, message: "金额不能为空", trigger: "blur"}
],
rate: [
{required: true, message: "分成比例不能为空", trigger: "blur"}
],
export default {
name: "CommisionConfig",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: false,
//
total: 0,
//
commisionList: [],
//
title: "",
//
open: false,
//
userIdOptions: [],
//
postIdOptions: [],
//
totalUserIdOptions: [],
//
searchUserIdOptions: [],
//
options: {},
//
queryParams: {
pageNum: 1,
pageSize: 10,
userId: null,
postId: null,
amount: null,
rate: null,
},
//
form: {},
//
rules: {
userId: [
{ required: true, message: "业务员不能为空", trigger: "change" },
],
postId: [
{ required: true, message: "岗位不能为空", trigger: "change" },
],
amount: [{ 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] = [];
}
};
},
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, dictLabel: cur.userName});
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;
}, {});
this.searchUserIdOptions = this.totalUserIdOptions.slice();
});
},
methods: {
/** 查询业务提成比例列表 */
getList() {
this.loading = true;
listCommision(this.queryParams).then(response => {
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)) {
arr[i].push(cur);
break;
} else if (i === arr.length - 1) {
arr.push([cur]);
break;
}
}
if (idx === 0) {
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;
}, {});
this.searchUserIdOptions = this.totalUserIdOptions.slice();
});
},
methods: {
/** 查询业务提成比例列表 */
getList() {
this.loading = true;
listCommision(this.queryParams).then((response) => {
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
)
) {
arr[i].push(cur);
break;
} else if (i === arr.length - 1) {
arr.push([cur]);
}
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();
}
});
break;
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ruleIds = row.ruleId || this.ids;
this.$confirm('是否确认删除业务提成比例编号为"' + ruleIds + '"的数据项?', "警告", {
if (idx === 0) {
arr.push([cur]);
}
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();
}
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ruleIds = row.ruleId || this.ids;
this.$confirm(
'是否确认删除业务提成比例编号为"' + ruleIds + '"的数据项?',
"警告",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function () {
type: "warning",
}
)
.then(function () {
return delCommision(ruleIds);
}).then(() => {
})
.then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(function () {
});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有业务提成比例数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function () {
})
.catch(function () {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm("是否确认导出所有业务提成比例数据项?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return exportCommision(queryParams);
}).then(response => {
})
.then((response) => {
this.download(response.msg);
}).catch(function () {
});
},
objectSpanMethod({row, column, rowIndex, columnIndex}) {
if (columnIndex === 0) {
return row.userSpan;
} else if (columnIndex === 1) {
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;
})
.catch(function () {});
},
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
if (columnIndex === 0) {
return row.userSpan;
} else if (columnIndex === 1) {
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;
},
},
};
</script>

@ -1,8 +1,20 @@
<template>
<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-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
v-for="dict in postIdOptions"
:key="dict.dictValue"
@ -12,7 +24,13 @@
</el-select>
</el-form-item>
<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
v-for="dict in searchUserIdOptions"
:key="dict.dictValue"
@ -26,12 +44,21 @@
v-model="month"
@change="monthRangeChange"
type="month"
placeholder="选择月">
placeholder="选择月"
>
</el-date-picker>
</el-form-item>
<el-form-item>
<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-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>
@ -43,40 +70,46 @@
size="mini"
@click="handleExport"
v-hasPermi="['commision:detail:export']"
>导出
>导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="commisionList"
@selection-change="handleSelectionChange">
<el-table-column label="业务员" align="center" prop="userName"/>
<el-table-column label="岗位" align="center" prop="postName"/>
<el-table
v-loading="loading"
:data="commisionList"
@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">
<template scope="scope">
{{toThousands(scope.row.amount)}}
{{ toThousands(scope.row.amount) }}
</template>
</el-table-column>
<el-table-column label="比例" align="center" prop="rate">
<template scope="scope">
{{scope.row.rate + '%'}}
{{ scope.row.rate + "%" }}
</template>
</el-table-column>
<el-table-column label="提成" align="center" prop="commision">
<template scope="scope">
{{scope.row.commision.toFixed(2)}}
{{ scope.row.commision.toFixed(2) }}
</template>
</el-table-column>
<el-table-column label="下月应发提成" align="center" prop="commision">
<template scope="scope">
{{scope.row.commision.toFixed(2)}}
{{ scope.row.commision.toFixed(2) }}
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@ -86,147 +119,163 @@
</template>
<script>
import {
detailCommision,
exportCommision,
} from "@/api/custom/commision";
import { 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 {
name: "CommisionDetail",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
month: dayjs(),
//
commisionList: [],
//
open: false,
//
userIdOptions: [],
//
postIdOptions: [],
//
totalUserIdOptions: [],
//
searchUserIdOptions: [],
//
options: {},
//
queryParams: {
pageNum: 1,
pageSize: 10,
userId: null,
postId: null,
},
};
},
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, dictLabel: cur.userName});
export default {
name: "CommisionDetail",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
month: dayjs(),
//
commisionList: [],
//
open: false,
//
userIdOptions: [],
//
postIdOptions: [],
//
totalUserIdOptions: [],
//
searchUserIdOptions: [],
//
options: {},
//
queryParams: {
pageNum: 1,
pageSize: 10,
userId: null,
postId: null,
},
};
},
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,
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;
}, {});
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)
detailCommision(this.addDateRange(this.queryParams, dateRange)).then(response => {
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;
}, {});
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)
detailCommision(this.addDateRange(this.queryParams, dateRange)).then(
(response) => {
this.commisionList = response.rows;
this.total = response.total;
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>

@ -1,8 +1,20 @@
<template>
<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-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
v-for="dict in postIdOptions"
:key="dict.dictValue"
@ -12,7 +24,13 @@
</el-select>
</el-form-item>
<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
v-for="dict in searchUserIdOptions"
:key="dict.dictValue"
@ -26,20 +44,31 @@
v-model="month"
@change="monthRangeChange"
type="month"
placeholder="选择月份">
placeholder="选择月份"
>
</el-date-picker>
</el-form-item>
<el-form-item>
<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-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>
<div><span style="color:#E6A23C;font-family:PingFang SC">
注意事项
<br/>12021年1月开始的订单才开始按天计算提成只计算已审核的订单
<br/>2发工资日期定为每月15号若当前日期大于15号则认定上个月的工资已发放
</span></div>
<el-row :gutter="10" class="mb8" style="margin-top:10px;">
<div>
<span style="color: #e6a23c; font-family: PingFang SC">
注意事项
<br />12021年1月开始的订单才开始按天计算提成只计算已审核的订单
<br />2发工资日期定为每月15号若当前日期大于15号则认定上个月的工资已发放
</span>
</div>
<el-row :gutter="10" class="mb8" style="margin-top: 10px">
<el-col :span="1.5">
<el-button
type="warning"
@ -47,74 +76,116 @@
size="mini"
@click="handleExport"
v-hasPermi="['commisionDay:detail:export']"
>导出
>导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="commisionList"
@selection-change="handleSelectionChange" stripe :row-class-name="tableRowClassName">
<el-table
v-loading="loading"
:data="commisionList"
@selection-change="handleSelectionChange"
stripe
:row-class-name="tableRowClassName"
>
<el-table-column label="业务员" align="center" prop="nickName">
<template slot-scope="scope">
<span>{{ scope.row.nickName }}</span>
</template>
</el-table-column>
<el-table-column label="岗位" align="center" prop="postName"/>
<el-table-column label="总提成" align="center" prop="totalCommissionAmount">
<el-table-column label="岗位" align="center" prop="postName" />
<el-table-column
label="总提成"
align="center"
prop="totalCommissionAmount"
>
<template scope="scope">
{{scope.row.totalCommissionAmount.toFixed(fixLength)}}
{{ scope.row.totalCommissionAmount.toFixed(fixLength) }}
</template>
</el-table-column>
<el-table-column label="已发放提成" align="center" prop="totalHasSentCommissionAmount">
<el-table-column
label="已发放提成"
align="center"
prop="totalHasSentCommissionAmount"
>
<template scope="scope">
{{scope.row.totalHasSentCommissionAmount.toFixed(fixLength)}}
{{ scope.row.totalHasSentCommissionAmount.toFixed(fixLength) }}
</template>
</el-table-column>
<el-table-column label="未发放提成" align="center" prop="totalNotSentCommissionAmount">
<el-table-column
label="未发放提成"
align="center"
prop="totalNotSentCommissionAmount"
>
<template scope="scope">
{{scope.row.totalNotSentCommissionAmount.toFixed(fixLength)}}
{{ scope.row.totalNotSentCommissionAmount.toFixed(fixLength) }}
</template>
</el-table-column>
<el-table-column label="下月应发提成" align="center" prop="nextMonthCommission">
<el-table-column
label="下月应发提成"
align="center"
prop="nextMonthCommission"
>
<template scope="scope">
{{scope.row.nextMonthCommission.toFixed(fixLength)}}
{{ scope.row.nextMonthCommission.toFixed(fixLength) }}
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template scope="scope">
<el-button type="text" @click="openFormDialog('查看发放计划', scope.row)">查看发放计划</el-button>
<el-button
type="text"
@click="openFormDialog('查看发放计划', scope.row)"
>查看发放计划</el-button
>
</template>
</el-table-column>
<!--<el-table-column label="提成" align="center" prop="commissionTotalAmount"></el-table-column>-->
</el-table>
<pagination
v-show="total>0"
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<el-dialog title="提成发放计划" :visible.sync="sendCommissionPlanTable" 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-dialog
title="提成发放计划"
:visible.sync="sendCommissionPlanTable"
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">
<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>
</el-table-column>
<el-table-column property="yearMonthCommission" label="提成金额" width="100">
<el-table-column
property="yearMonthCommission"
label="提成金额"
width="100"
>
<template scope="scope">
{{scope.row.yearMonthCommission.toFixed(fixLength)}}
{{ scope.row.yearMonthCommission.toFixed(fixLength) }}
</template>
</el-table-column>
</el-table>
@ -123,197 +194,215 @@
</template>
<style>
.el-table .warning-row {
background: oldlace;
}
.el-table .warning-row {
background: oldlace;
}
.el-table .success-row {
/*background: #1890FF;*/
color: #1890FF
}
.el-table .success-row {
/*background: #1890FF;*/
color: #1890ff;
}
</style>
<script>
import {
detailDayCommision, exportDayCommision} from "@/api/custom/commision";
import { 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 {
name: "CommisionDayDetail",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
month: dayjs(),
//
commisionList: [],
//
open: false,
//
userIdOptions: [],
//
postIdOptions: [],
//
totalUserIdOptions: [],
//
searchUserIdOptions: [],
//
options: {},
//
queryParams: {
pageNum: 1,
pageSize: 20,
userId: null,
postId: null,
},
sendCommissionPlanTable: false,
sendCommissionPlan:{},
fixLength: 2
};
},
created() {
this.getList();
getOptions().then(response => {
this.options = response.data.reduce((opts, cur) => {
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});
}
export default {
name: "CommisionDayDetail",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
month: dayjs(),
//
commisionList: [],
//
open: false,
//
userIdOptions: [],
//
postIdOptions: [],
//
totalUserIdOptions: [],
//
searchUserIdOptions: [],
//
options: {},
//
queryParams: {
pageNum: 1,
pageSize: 20,
userId: null,
postId: null,
},
sendCommissionPlanTable: false,
sendCommissionPlan: {},
fixLength: 2,
};
},
created() {
this.getList();
getOptions().then((response) => {
this.options = response.data.reduce((opts, cur) => {
if (cur.postCode != "after_sale" && cur.postCode != "nutri") {
return opts;
}, {});
this.postIdOptions = this.postIdOptions.sort((a, b) => a.dictValue - b.dictValue);
this.searchUserIdOptions = this.totalUserIdOptions.slice();
})
}
if (!opts[cur.postId]) {
opts[cur.postId] = [];
}
opts[cur.postId].push({
dictValue: cur.userId,
dictLabel: cur.userName,
});
},
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 => {
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;
}, {});
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.total = response.total;
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 () {
}
);
},
//
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 exportDayCommision(queryParams);
}).then(response => {
})
.then((response) => {
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.month = time;
},
postChange(postId) {
this.userIdOptions = this.options[postId];
},
searchPostChange(postId) {
if (!postId) {
this.searchUserIdOptions = this.totalUserIdOptions.slice();
}
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;
}
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;
});
}
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";
if (index == 1) {
sums[index] = data.length + "个月";
return;
}
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>

@ -1,6 +1,12 @@
<template>
<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-input
v-model="queryParams.id"
@ -29,11 +35,18 @@
/>
</el-form-item>
<el-form-item label="主营养师" prop="nutritionistId">
<el-select v-model="queryParams.nutritionistId" placeholder="请选择主营养师" clearable size="small">
<el-option v-for="dict in nutritionistIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"/>
<el-select
v-model="queryParams.nutritionistId"
placeholder="请选择主营养师"
clearable
size="small"
>
<el-option
v-for="dict in nutritionistIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item>
<el-form-item label="合同状态" prop="status">
@ -47,8 +60,16 @@
</el-select>
</el-form-item>
<el-form-item>
<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-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>
@ -92,50 +113,108 @@
<!-- v-hasPermi="['custom:contract:export']"-->
<!-- >导出</el-button>-->
<!-- </el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</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 label="合同编号" align="center" prop="id" fixed="left" width="150"/>
<el-table-column label="合同状态" align="center" prop="status" width="80" fixed="left">
<el-table-column
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">
<el-tag
:type="scope.row.status === 'yes' ? 'success' : 'danger'"
disable-transitions>
{{scope.row.status === 'yes' ? '已签订':'未签订'}}
disable-transitions
>
{{ scope.row.status === "yes" ? "已签订" : "未签订" }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="客户姓名" align="center" prop="name" 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">
<el-table-column
label="客户姓名"
align="center"
prop="name"
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">
{{scope.row.servePromise ? `${scope.row.servePromise}`: ''}}
{{ scope.row.servePromise ? `${scope.row.servePromise}` : "" }}
</template>
</el-table-column>
<el-table-column label="金额" align="center" prop="amount" width="100"/>
<el-table-column label="调理项目" align="center" prop="projectName" width="100"/>
<el-table-column label="签订时间" align="center" prop="updateTime" width="180"/>
<el-table-column label="金额" align="center" prop="amount" width="100" />
<el-table-column
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">
<template slot-scope="scope">
<el-button type="text" icon="el-icon-copy-document" @click="handleCopy(scope.row.path)" class="copyBtn"
:data-clipboard-text="copyValue">复制
<el-button
type="text"
icon="el-icon-copy-document"
@click="handleCopy(scope.row.path)"
class="copyBtn"
:data-clipboard-text="copyValue"
>复制
</el-button>
</template>
</el-table-column>
<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" prop="remark" width="120" />
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
fixed="right"
width="150"
>
<template slot-scope="scope">
<el-button
v-if="scope.row.status==='yes'"
v-if="scope.row.status === 'yes'"
size="mini"
type="text"
icon="el-icon-view"
@click="handleLook(scope.row.path)"
>查看
>查看
</el-button>
<el-button
size="mini"
@ -143,14 +222,14 @@
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['custom:contract:remove']"
>删除
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@ -161,29 +240,52 @@
<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-item label="调理项目" prop="projectId">
<el-select v-model="form.projectId" placeholder="请选择调理项目" filterable clearable size="small">
<el-option v-for="dict in conditioningProjectIdOption"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"/>
<el-select
v-model="form.projectId"
placeholder="请选择调理项目"
filterable
clearable
size="small"
>
<el-option
v-for="dict in conditioningProjectIdOption"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item>
<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 label="金额" prop="amount">
<el-input v-model="form.amount" placeholder="请输入金额"/>
<el-input v-model="form.amount" placeholder="请输入金额" />
</el-form-item>
<el-form-item label="服务承诺" prop="servePromise" v-show="form.projectId == 0">
<el-input style="width: 193px; margin-right: 12px" v-model="form.servePromise" placeholder="请输入服务承诺"/>
<el-form-item
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 label="营养师" prop="nutritionistId">
<el-select v-model="form.nutritionistId" placeholder="请选择营养师" clearable size="small">
<el-option v-for="dict in nutritionistIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"/>
<el-select
v-model="form.nutritionistId"
placeholder="请选择营养师"
clearable
size="small"
>
<el-option
v-for="dict in nutritionistIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item>
<el-form-item label="服务时间" prop="serveTime">
@ -197,7 +299,11 @@
</el-select>
</el-form-item>
<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>
<div slot="footer" class="dialog-footer">
@ -209,263 +315,271 @@
</template>
<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 {
name: "Contract",
data() {
const checkServePromise = (rule, value, callback) => {
if (this.form.projectId == 0 && !value) {
return callback(new Error('请输入服务承诺'))
}
callback();
};
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: false,
//
total: 0,
//
contractList: [],
//
nutritionistIdOptions: [],
//
title: "",
//
open: false,
//
serveTimeOptions: [],
//
signStatusOptions: [],
//
conditioningProjectIdOption:[],
//
copyValue: '',
//
queryParams: {
pageNum: 1,
pageSize: 10,
id: null,
name: null,
phone: null,
status: null,
},
//
form: {},
//
rules: {
projectId:[
{required: true, message: "请选择调理项目", trigger: "blur"}
],
name: [
{required: true, message: "请输入客户姓名", trigger: "blur"}
],
amount: [
{required: true, message: "请输入签订金额", trigger: "blur"},
{
required: true,
trigger: "blur",
pattern: /^[1-9]\d*$/,
message: "签订金额格式不正确",
},
],
servePromise: [
{required: true, trigger: "blur", validator: checkServePromise}
],
serveTime: [
{required: true, message: "请选择服务时间", trigger: "blur"}
],
nutritionistId: [
{required: true, message: "请选择营养师", trigger: "blur"}
]
}
};
export default {
name: "Contract",
data() {
const checkServePromise = (rule, value, callback) => {
if (this.form.projectId == 0 && !value) {
return callback(new Error("请输入服务承诺"));
}
callback();
};
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: false,
//
total: 0,
//
contractList: [],
//
nutritionistIdOptions: [],
//
title: "",
//
open: false,
//
serveTimeOptions: [],
//
signStatusOptions: [],
//
conditioningProjectIdOption: [],
//
copyValue: "",
//
queryParams: {
pageNum: 1,
pageSize: 10,
id: null,
name: null,
phone: null,
status: null,
},
//
form: {},
//
rules: {
projectId: [
{ required: true, message: "请选择调理项目", trigger: "blur" },
],
name: [{ required: true, message: "请输入客户姓名", trigger: "blur" }],
amount: [
{ required: true, message: "请输入签订金额", trigger: "blur" },
{
required: true,
trigger: "blur",
pattern: /^[1-9]\d*$/,
message: "签订金额格式不正确",
},
],
servePromise: [
{ required: true, trigger: "blur", validator: checkServePromise },
],
serveTime: [
{ 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();
getOptions().then(response => {
const options = response.data.reduce((opts, cur) => {
if (!opts[cur.postCode]) {
opts[cur.postCode] = [{dictValue: 0, dictLabel: ' ', remark: null}];
},
/** 重置按钮操作 */
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;
}
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.getDicts("cus_sign_status").then(response => {
this.signStatusOptions = response.data;
});
this.getDicts("conditioning_project").then(response => {
this.conditioningProjectIdOption = response.data;
addContract(this.form).then((response) => {
if (response.code === 200) {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
}
});
}
// }
});
},
methods: {
/** 查询合同列表 */
getList() {
this.loading = true;
listContract(this.queryParams).then(response => {
this.contractList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
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 () {
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除合同编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return delContract(ids);
}).then(() => {
})
.then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(function () {
});
},
/** 导出按钮操作 */
// handleExport() {
// const queryParams = this.queryParams;
// this.$confirm('?', "", {
// confirmButtonText: "",
// cancelButtonText: "",
// type: "warning"
// }).then(function () {
// return exportContract(queryParams);
// }).then(response => {
// this.download(response.msg);
// }).catch(function () {
// });
// },
handleCopy(path) {
this.copyValue = window.location.origin.replace('manage', 'sign') + path;
const btnCopy = new Clipboard('.copyBtn');
this.$message({
message: '拷贝成功',
type: 'success'
});
// btnCopy.destroy();
},
handleLook(path) {
const url = window.location.origin.replace('manage', 'sign') + path;
// const url = "http://stsign.busyinn.com" + path;
window.open(url, '_blank');
}
}
};
})
.catch(function () {});
},
/** 导出按钮操作 */
// handleExport() {
// const queryParams = this.queryParams;
// this.$confirm('?', "", {
// confirmButtonText: "",
// cancelButtonText: "",
// type: "warning"
// }).then(function () {
// return exportContract(queryParams);
// }).then(response => {
// this.download(response.msg);
// }).catch(function () {
// });
// },
handleCopy(path) {
this.copyValue = window.location.origin.replace("manage", "sign") + path;
const btnCopy = new Clipboard(".copyBtn");
this.$message({
message: "拷贝成功",
type: "success",
});
// btnCopy.destroy();
},
handleLook(path) {
const url = window.location.origin.replace("manage", "sign") + path;
// const url = "http://stsign.busyinn.com" + path;
window.open(url, "_blank");
},
},
};
</script>

@ -149,7 +149,11 @@
prop="salesman"
: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">
<el-button
size="mini"
@ -159,7 +163,11 @@
</el-button>
</template>
</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">
<el-button
size="mini"
@ -169,7 +177,11 @@
</el-button>
</template>
</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">
<el-button
size="mini"
@ -179,17 +191,25 @@
</el-button>
</template>
</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">
<el-button
size="mini"
type="text"
@click="handleClickHeatStatistics(scope.row)"
>详情
>详情
</el-button>
</template>
</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">
<el-button
size="mini"
@ -339,13 +359,11 @@ import {
} from "@/api/custom/customer";
import store from "@/store";
import { getOptions } from "@/api/custom/order";
import OrderDrawer from "@/components/OrderDrawer";
import PhysicalSignsDialog from "@/components/PhysicalSignsDialog";
import ContractDrawer from "@/components/ContractDrawer";
import HeatStatisticsDrawer from "@/components/HeatStatisticsDrawer";
import { mapGetters } from "vuex";
export default {
name: "Customer",
@ -353,7 +371,7 @@ export default {
"order-drawer": OrderDrawer,
"physical-signs-dialog": PhysicalSignsDialog,
"contract-drawer": ContractDrawer,
"heatStatisticsDrawer": HeatStatisticsDrawer
heatStatisticsDrawer: HeatStatisticsDrawer,
},
data() {
const userId = store.getters && store.getters.userId;
@ -374,13 +392,13 @@ export default {
//
customerCenterList: [],
//
preSaleIdOptions: [],
// preSaleIdOptions: [],
//
afterSaleIdOptions: [],
// afterSaleIdOptions: [],
//
nutritionistIdOptions: [],
// nutritionistIdOptions: [],
//
nutriAssisIdOptions: [],
// nutriAssisIdOptions: [],
//
title: "",
//
@ -437,25 +455,14 @@ export default {
},
created() {
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"] || [];
});
},
computed: {
...mapGetters([
"preSaleIdOptions",
"afterSaleIdOptions",
"nutritionistIdOptions",
"nutriAssisIdOptions",
]),
},
methods: {
/** 查询客户档案列表 */
@ -504,7 +511,7 @@ export default {
handleOnMenuClick(row) {
// console.log(row);
},
handleClickHeatStatistics(row){
handleClickHeatStatistics(row) {
this.$refs["heatStatisticsRef"].showDrawer(row);
},
//

@ -1,16 +1,30 @@
<template>
<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-date-picker clearable style="width: 200px"
v-model="queryParams.fanTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期">
<el-date-picker
clearable
style="width: 200px"
v-model="queryParams.fanTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期"
>
</el-date-picker>
</el-form-item>
<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
v-for="dict in preSaleIdOptions"
:key="dict.dictValue"
@ -20,7 +34,12 @@
</el-select>
</el-form-item>
<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
v-for="dict in accountIdOptions"
:key="dict.dictValue"
@ -30,8 +49,16 @@
</el-select>
</el-form-item>
<el-form-item style="margin-left: 20px">
<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-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>
@ -43,7 +70,8 @@
size="mini"
@click="handleAdd"
v-hasPermi="['custom:fanStatistics:add']"
>新增</el-button>
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@ -53,7 +81,8 @@
:disabled="single"
@click="handleUpdate"
v-hasPermi="['custom:fanStatistics:edit']"
>修改</el-button>
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@ -63,7 +92,8 @@
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['custom:fanStatistics:remove']"
>删除</el-button>
>删除</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@ -72,16 +102,30 @@
size="mini"
@click="handleExport"
v-hasPermi="['custom:fanStatistics:export']"
>导出</el-button>
>导出</el-button
>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</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 label="进粉日期" align="center" prop="fanTime" width="180">
<el-table-column
label="进粉日期"
align="center"
prop="fanTime"
width="180"
>
<template slot-scope="scope">
<span>{{ parseTime(scope.row.fanTime, '{y}-{m}-{d}') }}</span>
<span>{{ parseTime(scope.row.fanTime, "{y}-{m}-{d}") }}</span>
</template>
</el-table-column>
<el-table-column label="销售" align="center" prop="userName" />
@ -94,7 +138,11 @@
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template>
</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">
<el-button
size="mini"
@ -102,43 +150,55 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['custom:fanStatistics:edit']"
>修改</el-button>
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['custom:fanStatistics:remove']"
>删除</el-button>
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
layout="total, slot, sizes, prev, pager, next, jumper"
@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>
<!-- 添加进粉统计对话框 -->
<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-item label="进粉日期" prop="fanTime">
<el-date-picker clearable style="width: 200px"
v-model="form.fanTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期">
<el-date-picker
clearable
style="width: 200px"
v-model="form.fanTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期"
>
</el-date-picker>
</el-form-item>
<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
v-for="dict in preSaleIdOptions"
:key="dict.dictValue"
@ -147,326 +207,355 @@
/>
</el-select>
</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-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
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>
</el-form>
<div slot="footer" class="dialog-footer" >
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</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-item label="进粉日期" prop="fanTime">
<el-date-picker clearable style="width: 200px"
v-model="editForm.fanTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期">
<el-date-picker
clearable
style="width: 200px"
v-model="editForm.fanTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期"
>
</el-date-picker>
</el-form-item>
<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>
<div slot="footer" class="dialog-footer" >
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="editSubmit"> </el-button>
<el-button @click="editCancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listFanStatistics, getFanStatistics, delFanStatistics, addFanStatistics, updateFanStatistics, exportFanStatistics, getWxByUserId } from "@/api/custom/fanStatistics";
import { getOptions } from "@/api/custom/order";
import store from "@/store";
import dayjs from "dayjs";
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("成交时间不能为空"));
import {
listFanStatistics,
getFanStatistics,
delFanStatistics,
addFanStatistics,
updateFanStatistics,
exportFanStatistics,
getWxByUserId,
} from "@/api/custom/fanStatistics";
import store from "@/store";
import dayjs from "dayjs";
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();
};
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;
this.total = response.total;
this.loading = false;
});
},
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;
//
cancel() {
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;
}
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
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 (value == null || value == undefined) {
this.msgError("请填写进粉数量");
flag = false;
return;
}
let flag = true;
this.form.fanNum.forEach( (value, index) => {
if(value == null || value == undefined){
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 (flag) {
addFanStatistics(this.form).then((response) => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.editOpen = false;
this.msgSuccess("新增成功");
this.open = false;
this.reset();
this.getList();
}
});
}else{
this.msgError("数据未填写完整");
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除进粉统计编号为"' + ids + '"的数据项?', "警告", {
} else {
this.msgError("数据未填写完整");
}
});
},
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: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
type: "warning",
}
)
.then(function () {
return delFanStatistics(ids);
}).then(() => {
})
.then(() => {
this.getList();
this.msgSuccess("删除成功");
}).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;
}
}
});
},
})
.catch(function () {});
},
watch: {
// ID
"form.userId": function (newVal, oldVal) {
this.getWxByUserId(newVal);
},
}
};
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
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>

@ -335,7 +335,7 @@
</template>
</el-table-column>
<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">
<template slot-scope="scope">
{{ toThousands(scope.row.amount) }}
@ -386,7 +386,7 @@
v-hasPermi="['custom:order:edit']"
>修改
</el-button>
<el-button
<el-button
size="mini"
type="text"
icon="el-icon-s-data"
@ -455,6 +455,7 @@ import orderPause from "./orderPause";
import OrderDetail from "@/components/OrderDetail";
import OrderEdit from "@/components/OrderEdit";
import AutoHideMessage from "@/components/AutoHideMessage";
import { mapGetters } from "vuex";
const beginTime = dayjs().startOf("month").format("YYYY-MM-DD");
const endTime = dayjs().format("YYYY-MM-DD");
@ -492,16 +493,6 @@ export default {
daterange: [beginTime, endTime],
//
payTypeIdOptions: [],
//
preSaleIdOptions: [],
//
afterSaleIdOptions: [],
//
nutritionistIdOptions: [],
//
nutriAssisIdOptions: [],
//
plannerIdOptions: [],
//
accountIdOptions: [],
//
@ -510,12 +501,6 @@ export default {
conditioningProjectIdOption: [],
//
reviewStatusOptions: [],
//
plannerAssisIdOptions: [],
//
operatorIdOptions: [],
//
operatorAssisIdOptions: [],
//
queryParams: {
pageNum: 1,
@ -539,32 +524,28 @@ export default {
},
};
},
computed: {
...mapGetters([
//
"preSaleIdOptions",
//
"afterSaleIdOptions",
//
"nutritionistIdOptions",
//
"nutriAssisIdOptions",
//
"plannerIdOptions",
//
"plannerAssisIdOptions",
//
"operatorIdOptions",
//
"operatorAssisIdOptions",
]),
},
created() {
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.payTypeIdOptions = response.data;
});

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

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