微信导粉统计
This commit is contained in:
65
stdiet-ui/src/api/custom/fanStatistics.js
Normal file
65
stdiet-ui/src/api/custom/fanStatistics.js
Normal file
@ -0,0 +1,65 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询进粉统计列表
|
||||
export function listFanStatistics(query) {
|
||||
return request({
|
||||
url: '/custom/fanStatistics/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询进粉统计详细
|
||||
export function getFanStatistics(id) {
|
||||
return request({
|
||||
url: '/custom/fanStatistics/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增进粉统计
|
||||
export function addFanStatistics(data) {
|
||||
return request({
|
||||
url: '/custom/fanStatistics',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改进粉统计
|
||||
export function updateFanStatistics(data) {
|
||||
return request({
|
||||
url: '/custom/fanStatistics',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除进粉统计
|
||||
export function delFanStatistics(id) {
|
||||
return request({
|
||||
url: '/custom/fanStatistics/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 导出进粉统计
|
||||
export function exportFanStatistics(query) {
|
||||
return request({
|
||||
url: '/custom/fanStatistics/export',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 获取
|
||||
export function getWxByUserId(userId) {
|
||||
return request({
|
||||
url: '/custom/fanStatistics/getWxByUserId',
|
||||
method: 'get',
|
||||
params: {"userId": userId}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,55 +1,53 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询微信销售账号列表
|
||||
// 查询微信账号列表
|
||||
export function listWxAccount(query) {
|
||||
return request({
|
||||
url: '/custom/WxAccount/list',
|
||||
url: '/custom/wxAccount/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询微信销售账号详细
|
||||
// 查询微信账号详细
|
||||
export function getWxAccount(id) {
|
||||
return request({
|
||||
url: '/custom/WxAccount/' + id,
|
||||
url: '/custom/wxAccount/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增微信销售账号
|
||||
// 新增微信账号
|
||||
export function addWxAccount(data) {
|
||||
return request({
|
||||
url: '/custom/WxAccount',
|
||||
url: '/custom/wxAccount',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改微信销售账号
|
||||
// 修改微信账号
|
||||
export function updateWxAccount(data) {
|
||||
return request({
|
||||
url: '/custom/WxAccount',
|
||||
url: '/custom/wxAccount',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除微信销售账号
|
||||
// 删除微信账号
|
||||
export function delWxAccount(id) {
|
||||
return request({
|
||||
url: '/custom/WxAccount/' + id,
|
||||
url: '/custom/wxAccount/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 导出微信销售账号
|
||||
// 导出微信账号
|
||||
export function exportWxAccount(query) {
|
||||
return request({
|
||||
url: '/custom/WxAccount/export',
|
||||
url: '/custom/wxAccount/export',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
|
53
stdiet-ui/src/api/custom/wxDistribution.js
Normal file
53
stdiet-ui/src/api/custom/wxDistribution.js
Normal file
@ -0,0 +1,53 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询微信分配管理列表
|
||||
export function listWxDistribution(query) {
|
||||
return request({
|
||||
url: '/custom/wxDistribution/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询微信分配管理详细
|
||||
export function getWxDistribution(id) {
|
||||
return request({
|
||||
url: '/custom/wxDistribution/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增微信分配管理
|
||||
export function addWxDistribution(data) {
|
||||
return request({
|
||||
url: '/custom/wxDistribution',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改微信分配管理
|
||||
export function updateWxDistribution(data) {
|
||||
return request({
|
||||
url: '/custom/wxDistribution',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除微信分配管理
|
||||
export function delWxDistribution(id) {
|
||||
return request({
|
||||
url: '/custom/wxDistribution/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 导出微信分配管理
|
||||
export function exportWxDistribution(query) {
|
||||
return request({
|
||||
url: '/custom/wxDistribution/export',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
@ -15,13 +15,13 @@
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="年龄" prop="age" >
|
||||
<el-input type="number" v-model="form.age" placeholder="请输入年龄" autocomplete="off" ></el-input>
|
||||
<el-input type="number" v-model="form.age" placeholder="请输入年龄(整数)" autocomplete="off" ></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="身高(厘米)" prop="tall" >
|
||||
<el-input type="number" v-model="form.tall" placeholder="请输入身高" autocomplete="off" ></el-input>
|
||||
<el-input type="number" v-model="form.tall" placeholder="请输入身高(整数)" autocomplete="off" ></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="体重(斤)" prop="weight" >
|
||||
<el-input type="number" v-model="form.weight" placeholder="请输入体重" autocomplete="off" ></el-input>
|
||||
<el-input v-model="form.weight" placeholder="请输入体重(可保留一位小数)" autocomplete="off" ></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="调理项目" prop="conditioningProjectId">
|
||||
<el-select v-model="form.conditioningProjectId" filterable clearable placeholder="请选择">
|
||||
|
@ -46,10 +46,10 @@
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
<p class="p_title_2">4、生食果蔬状况</p>
|
||||
<el-form-item :label="'(1) 平均每周吃生/拌菜几次'" prop="vegetablesNum" class="margin-left">
|
||||
<el-form-item :label="'(1) 平均每周吃生蔬菜几次'" prop="vegetablesNum" class="margin-left">
|
||||
<el-input-number v-model="form.vegetablesNum" :step="1" :min="0"></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item :label="'(2) 每周吃生/拌菜的频次'" prop="vegetablesRateType" class="margin-left">
|
||||
<el-form-item :label="'(2) 每周吃生蔬菜的频次'" prop="vegetablesRateType" class="margin-left">
|
||||
<el-radio-group v-model="form.vegetablesRateType">
|
||||
<el-radio v-for="(item,index) in healthyData['vegetablesRateTypeArray']" :label="item.value" :key="index">{{item.name}}</el-radio>
|
||||
</el-radio-group>
|
||||
|
@ -127,8 +127,8 @@ export default {
|
||||
],
|
||||
[
|
||||
["早餐习惯","早餐吃的食物","午餐习惯"],["晚餐习惯","正餐中素菜占比","最常吃的肉类"],
|
||||
["晚餐时间","每周吃夜宵次数","夜宵通常吃的食物"],["食物的冷热偏好","食物的口味偏好","平均每周吃生菜几次"],
|
||||
["每周吃生菜的频次类型","平均每天吃水果次数","吃水果的时间段"],["平时吃水果的频次","一餐吃几碗饭","吃几成饱"],
|
||||
["晚餐时间","每周吃夜宵次数","夜宵通常吃的食物"],["食物的冷热偏好","食物的口味偏好","平均每周吃生蔬菜几次"],
|
||||
["每周吃生蔬菜的频次类型","平均每天吃水果次数","吃水果的时间段"],["平时吃水果的频次","一餐吃几碗饭","吃几成饱"],
|
||||
["吃饭速度","饮食特点","常吃的零食"],["有无服用营养保健品","营养保健品品牌名","营养保健品产品名"],
|
||||
["服用营养保健品频次","忌口过敏食物",""]
|
||||
],
|
||||
|
@ -20,7 +20,7 @@
|
||||
<healthy-form7 v-show="stepArray[6]" :form.sync="form"></healthy-form7>
|
||||
<healthy-form8 v-show="stepArray[7]" :flag="1" :form.sync="form"></healthy-form8>
|
||||
<edit-file v-show="stepArray[8]" ref="editFile" :form.sync="form"></edit-file>
|
||||
<el-form-item style="text-align: center; margin: 30px auto" >
|
||||
<el-form-item style="text-align: center; margin: 30px auto" v-show="submitShow">
|
||||
<el-button type="primary" @click="submit()" style="width: 40%" >提交</el-button>
|
||||
<el-button @click="onClosed()" style="width: 40%" >取消</el-button>
|
||||
</el-form-item>
|
||||
@ -61,6 +61,7 @@ export default {
|
||||
healthyData:healthyData,
|
||||
showModuleArray:[0],
|
||||
stepArray: [true,false,false,false,false,false,false,false,false],
|
||||
submitShow: true,
|
||||
visible: false,
|
||||
title: "",
|
||||
data: undefined,
|
||||
@ -90,7 +91,7 @@ export default {
|
||||
{
|
||||
required: true,
|
||||
trigger: "blur",
|
||||
pattern: /^[1-9]\d*$/,
|
||||
pattern: /^(\d+)(\.\d{1})?$/,
|
||||
message: "体重格式不正确",
|
||||
},
|
||||
],
|
||||
@ -162,12 +163,14 @@ export default {
|
||||
});
|
||||
},
|
||||
changeShowModule(){
|
||||
console.log("---------------");
|
||||
let allShow = false;
|
||||
for(var i = 0; i < this.stepArray.length; i++){
|
||||
let flag = this.showModuleArray.find((opt) => opt === i);
|
||||
console.log(flag != null && flag != undefined);
|
||||
this.$set(this.stepArray, i, (flag != null && flag != undefined));
|
||||
let showFlag = flag != null && flag != undefined
|
||||
this.$set(this.stepArray, i, showFlag);
|
||||
allShow = showFlag ? showFlag : allShow;
|
||||
}
|
||||
this.submitShow = allShow;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
449
stdiet-ui/src/views/custom/fanStatistics/index.vue
Normal file
449
stdiet-ui/src/views/custom/fanStatistics/index.vue
Normal file
@ -0,0 +1,449 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<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>
|
||||
</el-form-item>
|
||||
<el-form-item label="销售" prop="userId">
|
||||
<el-select v-model="queryParams.userId" placeholder="请选择销售" filterable clearable>
|
||||
<el-option
|
||||
v-for="dict in preSaleIdOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="parseInt(dict.dictValue)"
|
||||
/>
|
||||
</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-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['custom:fanStatistics:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['custom:fanStatistics:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['custom:fanStatistics:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['custom:fanStatistics:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<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">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.fanTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="销售" align="center" prop="userName" />
|
||||
<el-table-column label="进粉渠道" align="center" prop="account" />
|
||||
<el-table-column label="微信昵称" align="center" prop="wxNickName" />
|
||||
<el-table-column label="微信号" align="center" prop="wxAccount" />
|
||||
<el-table-column label="进粉数量" align="center" prop="fanNum" />
|
||||
<!--<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<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">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['custom:fanStatistics:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['custom:fanStatistics:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
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>
|
||||
</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>
|
||||
</el-form-item>
|
||||
<el-form-item label="销售" prop="userId">
|
||||
<el-select v-model="form.userId" placeholder="请选择销售" filterable clearable size="small" @change="getWxByUserId">
|
||||
<el-option
|
||||
v-for="dict in preSaleIdOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="parseInt(dict.dictValue)"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<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>
|
||||
</div>
|
||||
</el-form>
|
||||
<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-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>
|
||||
</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-form-item>
|
||||
|
||||
</el-form>
|
||||
<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("成交时间不能为空"));
|
||||
}
|
||||
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
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
fanTime: [{ required: true, trigger: "blur", message: "请选择日期" }],
|
||||
userId: [{ required: true, trigger: "blur", message: "请选择销售" }]
|
||||
},
|
||||
showWxFlag:false,
|
||||
//当前选择的用户被分配的微信号
|
||||
wxList:[],
|
||||
//销售列表
|
||||
preSaleIdOptions:[],
|
||||
editOpen: false,
|
||||
editForm:{},
|
||||
// 表单校验
|
||||
editRules: {
|
||||
fanTime: [{ required: true, trigger: "blur", message: "请选择日期" }],
|
||||
fanNum: [{ required: true, trigger: "blur", message: "请输入进粉数量" }],
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getSaleUserList();
|
||||
},
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
});
|
||||
if(flag){
|
||||
addFanStatistics(this.form).then(response => {
|
||||
if (response.code === 200) {
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}
|
||||
});
|
||||
}
|
||||
}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() {
|
||||
return delFanStatistics(ids);
|
||||
}).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;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<section>
|
||||
<div style="padding: 16px; text-align: center">
|
||||
<img :src="logo" style="width: 258px; height: 80px" alt="logo" />
|
||||
<div style="padding: 5px; text-align: center">
|
||||
<img :src="logo" style="width: 150px; height: 35px" alt="logo" />
|
||||
</div>
|
||||
<div style="margin: 20px 15px 20px 15px;" >
|
||||
<div style="margin: 10px 15px 10px 15px;" >
|
||||
<el-steps :active="stepActive" finish-status="success">
|
||||
<el-step v-for="(item,index) in stepArray" title=""></el-step>
|
||||
</el-steps>
|
||||
@ -184,7 +184,7 @@ export default {
|
||||
{
|
||||
required: true,
|
||||
trigger: "blur",
|
||||
pattern: /^[1-9]\d*$/,
|
||||
pattern: /^(\d+)(\.\d{1})?$/,
|
||||
message: "体重格式不正确",
|
||||
},
|
||||
],
|
||||
|
317
stdiet-ui/src/views/custom/wxAccount/index.vue
Normal file
317
stdiet-ui/src/views/custom/wxAccount/index.vue
Normal file
@ -0,0 +1,317 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="微信昵称" prop="wxNickName">
|
||||
<el-input
|
||||
v-model="queryParams.wxNickName"
|
||||
placeholder="请输入微信昵称"
|
||||
clearable
|
||||
size="small"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="微信号" prop="wxAccount">
|
||||
<el-input
|
||||
v-model="queryParams.wxAccount"
|
||||
placeholder="请输入微信号"
|
||||
clearable
|
||||
size="small"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" prop="wxPhone">
|
||||
<el-input
|
||||
v-model="queryParams.wxPhone"
|
||||
placeholder="请输入手机号"
|
||||
clearable
|
||||
size="small"
|
||||
/>
|
||||
</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-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['custom:wxAccount:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['custom:wxAccount:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['custom:wxAccount:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['custom:wxAccount:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="wxAccountList" stripe @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="微信昵称" align="center" prop="wxNickName" />
|
||||
<el-table-column label="微信号" align="center" prop="wxAccount" />
|
||||
<el-table-column label="手机号" align="center" prop="wxPhone" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<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">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['custom:wxAccount:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['custom:wxAccount:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改微信账号对话框 -->
|
||||
<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="wxNickName">
|
||||
<el-input v-model="form.wxNickName" maxlength="100" placeholder="请输入微信昵称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="微信号" prop="wxAccount">
|
||||
<el-input v-model="form.wxAccount" maxlength="100" placeholder="请输入微信号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" prop="wxPhone">
|
||||
<el-input v-model="form.wxPhone" maxlength="20" placeholder="请输入手机号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
show-word-limit
|
||||
maxlength="100"
|
||||
placeholder="请输入备注"
|
||||
v-model="form.remark">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listWxAccount, getWxAccount, delWxAccount, addWxAccount, updateWxAccount, exportWxAccount } from "@/api/custom/wxAccount";
|
||||
|
||||
export default {
|
||||
name: "WxAccount",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 微信账号表格数据
|
||||
wxAccountList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
wxNickName: null,
|
||||
wxAccount:null,
|
||||
wxPhone:null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
wxNickName: [{ required: true, trigger: "blur", message: "请输入微信昵称" }],
|
||||
wxAccount: [{ required: true, trigger: "blur", message: "请输入微信号" }],
|
||||
wxPhone: [
|
||||
{
|
||||
required: false,
|
||||
trigger: "blur",
|
||||
pattern: /^[0-9]{5,11}$/,
|
||||
message: "手机号格式不正确",
|
||||
},
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询微信账号列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listWxAccount(this.queryParams).then(response => {
|
||||
this.wxAccountList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
wxNickName: null,
|
||||
wxAccount: null,
|
||||
wxPhone: null,
|
||||
wxCodeUrl: null,
|
||||
remark: null,
|
||||
wxType: null,
|
||||
createTime: null,
|
||||
createBy: null,
|
||||
updateTime: null,
|
||||
updateBy: null,
|
||||
delFlag: 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
|
||||
getWxAccount(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) {
|
||||
updateWxAccount(this.form).then(response => {
|
||||
if (response.code === 200) {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
addWxAccount(this.form).then(response => {
|
||||
if (response.code === 200) {
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$confirm('是否确认删除微信账号编号为"' + ids + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function() {
|
||||
return delWxAccount(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
}).catch(function() {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
const queryParams = this.queryParams;
|
||||
this.$confirm('是否确认导出所有微信账号数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function() {
|
||||
return exportWxAccount(queryParams);
|
||||
}).then(response => {
|
||||
this.download(response.msg);
|
||||
}).catch(function() {});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
376
stdiet-ui/src/views/custom/wxDistribution/index.vue
Normal file
376
stdiet-ui/src/views/custom/wxDistribution/index.vue
Normal file
@ -0,0 +1,376 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<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-option
|
||||
v-for="dict in preSaleIdOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="parseInt(dict.dictValue)"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="销售组别" prop="saleGroupId">
|
||||
<el-select v-model="queryParams.saleGroupId" placeholder="请选择组别" filterable clearable size="small">
|
||||
<el-option
|
||||
v-for="dict in saleGroupOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="parseInt(dict.dictValue)"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="进粉渠道" prop="accountId">
|
||||
<el-select v-model="queryParams.accountId" filterable placeholder="请选择渠道" clearable size="small">
|
||||
<el-option
|
||||
v-for="dict in accountIdOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="parseInt(dict.dictValue)"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!--<el-form-item label="微信号" prop="wechatAccount">
|
||||
<el-input
|
||||
v-model="queryParams.wechatAccount"
|
||||
placeholder="请输入微信号"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</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-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['custom:wxDistribution:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['custom:wxDistribution:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['custom:wxDistribution:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['custom:wxDistribution:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<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">
|
||||
<template slot-scope="scope">
|
||||
<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">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['custom:wxDistribution:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['custom:wxDistribution:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改微信分配管理对话框 -->
|
||||
<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-option
|
||||
v-for="dict in preSaleIdOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="parseInt(dict.dictValue)"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="销售组别" prop="saleGroupId">
|
||||
<el-select v-model="form.saleGroupId" placeholder="请选择组别" filterable clearable size="small">
|
||||
<el-option
|
||||
v-for="dict in saleGroupOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="parseInt(dict.dictValue)"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="进粉渠道" prop="accountId">
|
||||
<el-select v-model="form.accountId" filterable placeholder="请选择渠道" clearable size="small">
|
||||
<el-option
|
||||
v-for="dict in accountIdOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="parseInt(dict.dictValue)"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="微信号" prop="wechatAccount">
|
||||
<el-select v-model="form.wechatAccount" filterable placeholder="请选择微信号" clearable size="small">
|
||||
<el-option
|
||||
v-for="dict in wxAccountList"
|
||||
:key="dict.id"
|
||||
:label="dict.wxAccount"
|
||||
:value="parseInt(dict.id)"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</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;
|
||||
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;
|
||||
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) {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}
|
||||
});
|
||||
} 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 + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function() {
|
||||
return delWxDistribution(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
}).catch(function() {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
const queryParams = this.queryParams;
|
||||
this.$confirm('是否确认导出所有微信分配数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function() {
|
||||
return exportWxDistribution(queryParams);
|
||||
}).then(response => {
|
||||
this.download(response.msg);
|
||||
}).catch(function() {});
|
||||
},
|
||||
getListWxAccount() {
|
||||
listWxAccount(this.queryParams).then(response => {
|
||||
this.wxAccountList = response.rows;
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Reference in New Issue
Block a user