Merge branch 'master' of gitee.com:darlk/ShengTangManage into develop

This commit is contained in:
huangdeliang
2021-02-09 14:17:37 +08:00
36 changed files with 3042 additions and 769 deletions

View 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}
})
}

View File

@ -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
})
}

View 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
})
}

View File

@ -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="请选择">

View File

@ -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>

View File

@ -3,7 +3,8 @@
<div v-if="showFlag">
<div style="float:right;margin-top:-10px;margin-bottom: 10px;" v-show="dataList.length > 0">
<!-- 只有新版健康评估信息才可修改旧的体征数据不支持修改 -->
<el-button v-hasPermi="['custom:healthy:edit']" type="primary" v-show="dataType == 0" @click="handleEditHealthyClick()" plain>修改信息</el-button>
<el-button v-hasPermi="['custom:healthy:edit']" type="info" v-show="dataType == 0" @click="handleEditRemarkClick()" plain>修改备注</el-button>
<el-button v-hasPermi="['custom:healthy:edit']" type="warning" v-show="dataType == 0" @click="handleEditHealthyClick()" plain>修改信息</el-button>
<el-button type="danger" v-hasPermi="['custom:healthy:remove']" @click="handleDelete()" plain>删除信息</el-button>
</div>
<!-- 客户健康评估 -->
@ -14,6 +15,15 @@
<p class="p_title_1" style="margin-top: 5px;">{{titleArray[index]}}</p>
<table-detail-message :data="item" ></table-detail-message>
</div>
<!-- 备注 -->
<el-table :data="remarkList" :show-header="false" border :cell-style="remarkColumnStyle" style="width: 100%;">
<el-table-column width="140" prop="remarkTitle">
</el-table-column>
<el-table-column prop="remarkValue">
<template slot-scope="scope">
<auto-hide-message :data="scope.row.remarkValue" :maxLength="100"/></template>
</el-table-column>
</el-table>
</div>
<!-- 其他信息 -->
<div style="height:400px;overflow: auto">
@ -59,7 +69,8 @@
</div>
<!-- 编辑 -->
<physicalSigns-edit ref="physicalSignsEditDialog" @refreshHealthyData="getCustomerHealthyByCusId()"></physicalSigns-edit>
<!-- 编辑备注 -->
<physicalSigns-remark ref="physicalSignsRemarkDialog" @refreshHealthyData="getCustomerHealthyByCusId()"></physicalSigns-remark>
</el-dialog>
</template>
<script>
@ -69,13 +80,14 @@ import AutoHideMessage from "@/components/AutoHideMessage";
import * as healthyData from "@/utils/healthyData";
import Clipboard from 'clipboard';
import PhysicalSignsEdit from "@/components/PhysicalSignsEdit";
import PhysicalSignsRemark from "@/components/PhysicalSignsRemark";
export default {
name: "PhysicalSignsDialog",
components: {
"auto-hide-message": AutoHideMessage,
"table-detail-message": TableDetailMessage,
"physicalSigns-edit":PhysicalSignsEdit
"physicalSigns-edit":PhysicalSignsEdit,
"physicalSigns-remark":PhysicalSignsRemark
},
data() {
return {
@ -86,6 +98,7 @@ export default {
dataList: [],
dataType: 0,
healthyData: null,
remarkList:[{"remarkTitle": "备注信息", "remarkValue": ""}],
// 体征标题
signTitleData: [
["创建时间", "姓名", "年龄"],
@ -127,8 +140,8 @@ export default {
],
[
["早餐习惯","早餐吃的食物","午餐习惯"],["晚餐习惯","正餐中素菜占比","最常吃的肉类"],
["晚餐时间","每周吃夜宵次数","夜宵通常吃的食物"],["食物的冷热偏好","食物的口味偏好","平均每周吃生菜几次"],
["每周吃生菜的频次类型","平均每天吃水果次数","吃水果的时间段"],["平时吃水果的频次","一餐吃几碗饭","吃几成饱"],
["晚餐时间","每周吃夜宵次数","夜宵通常吃的食物"],["食物的冷热偏好","食物的口味偏好","平均每周吃生菜几次"],
["每周吃生菜的频次类型","平均每天吃水果次数","吃水果的时间段"],["平时吃水果的频次","一餐吃几碗饭","吃几成饱"],
["吃饭速度","饮食特点","常吃的零食"],["有无服用营养保健品","营养保健品品牌名","营养保健品产品名"],
["服用营养保健品频次","忌口过敏食物",""]
],
@ -204,13 +217,21 @@ export default {
return "background:#ffffff;";
}
},
// 自定义备注列背景色
remarkColumnStyle({ row, column, rowIndex, columnIndex }) {
if (columnIndex % 2 === 0) {
//第三第四列的背景色就改变了2和3都是列数的下标
return "background:#f3f6fc;font-weight:bold";
} else {
return "background:#ffffff;";
}
},
showDialog(data) {
this.data = data;
this.title = `${data.name}」客户健康评估信息`;
this.getCustomerHealthyByCusId();
},
getCustomerHealthyByCusId(){
getCustomerPhysicalSignsByCusId(this.data.id).then((res) => {
this.showFlag = false;
if (res.data.customerHealthy) {
@ -218,6 +239,7 @@ export default {
this.dataType = res.data.type;
if(this.dataType == 0){
this.healthyData = Object.assign({}, res.data.customerHealthy);
this.remarkList[0].remarkValue = this.healthyData.remark;
this.getDataListByHealthyMessage(res.data.customerHealthy);
}else{
this.getDataListBySignMessage(res.data.customerHealthy)
@ -443,6 +465,9 @@ export default {
handleEditHealthyClick() {
//console.log(JSON.stringify(this.healthyData));
this.$refs["physicalSignsEditDialog"].showDialog(this.data, this.healthyData);
},
handleEditRemarkClick(){
this.$refs["physicalSignsRemarkDialog"].showDialog(this.data, this.healthyData);
}
}
};

View File

@ -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;
}
}
};

View File

@ -0,0 +1,88 @@
<template>
<el-dialog :visible.sync="visible" :title="title" width="500px" append-to-body @closed="onClosed">
<el-form ref="form" :model="form" :rules="rules" label-position="top" label-width="100px">
<el-form-item label="" prop="remark" >
<el-input
type="textarea"
:rows="5"
maxlength="300"
show-word-limit
placeholder="请输入备注"
v-model="form.remark">
</el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submit()"> </el-button>
<el-button @click="onClosed()"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { getCustomerPhysicalSignsByCusId } from "@/api/custom/customer";
import { updateHealthy } from "@/api/custom/healthy";
export default {
name: "PhysicalSignsRemark",
components: {
},
data() {
return {
visible: false,
title: "",
data: undefined,
form: {
id: null,
remark: null
},
rules: {
}
};
},
methods: {
showDialog(data, healthy) {
this.data = data;
this.title = "修改"+`${data.name}`+"备注";
this.form.id = healthy.id;
this.form.remark = healthy.remark;
this.visible = true;
},
onClosed() {
this.visible = false;
this.data = null;
},
submit(){
this.$refs.form.validate((valid) => {
if (valid) {
this.editCustomerHealthy();
} else {
this.$message({message: "数据未填写完整", type: "warning"});
}
});
},
editCustomerHealthy(){
updateHealthy(this.form).then((response) => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.onClosed();
this.$emit('refreshHealthyData');
}
}).catch(function() {
console.log("error");
});
}
}
};
</script>
<style>
.margin-top-20{
margin-top:20px;
}
.p_title_1{
font-size: 18px;
font-weight: bold;
margin-top: 20px;
}
</style>

View File

@ -1,496 +0,0 @@
<template>
<div class="app-container">
<el-form
:model="queryParams"
ref="queryForm"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="账号名称" prop="nickName">
<el-input
v-model="queryParams.nickName"
placeholder="请输入账号名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="账号id" prop="accountId">
<el-select
v-model="queryParams.accountId"
placeholder="请选择账号id"
clearable
size="small"
>
<el-option
v-for="dict in accountIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item label="手机号" prop="phone">
<el-input
v-model="queryParams.phone"
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: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"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="手机号" align="center" prop="id" />
<el-table-column label="账号名称" align="center" prop="nickName" />
<el-table-column
label="账号id"
align="center"
prop="accountId"
:formatter="accountIdFormat"
/>
<el-table-column label="微信号" align="center" prop="wxId" />
<el-table-column label="手机号" align="center" prop="phone" />
<el-table-column label="手机号" align="center" prop="remark" />
<el-table-column label="二维码图片" align="center" prop="imgUrl" />
<el-table-column label="使用次数" align="center" prop="count" />
<el-table-column label="微信资源id" align="center" prop="mediaId" />
<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"
:close-on-click-modal="false"
width="500px"
append-to-body
>
<el-form ref="form" :model="form" :rules="rules" label-width="90px">
<el-form-item label="账号昵称" prop="nickName">
<el-input v-model="form.nickName" placeholder="请输入账号名称" />
</el-form-item>
<el-form-item label="账号id" prop="accountId">
<el-select v-model="form.accountId" placeholder="请选择账号id">
<el-option
v-for="dict in accountIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="微信号" prop="wxId">
<el-input v-model="form.wxId" placeholder="请输入微信号" />
</el-form-item>
<el-form-item label="手机号" prop="phone">
<el-input v-model="form.phone" placeholder="请输入手机号" />
</el-form-item>
<el-form-item label="二维码图片" prop="imgUrl">
<el-upload
:class="`upload-demo ${
upload.fileList.length ? 'has-file' : ''
}`"
ref="upload"
drag
:action="upload.url"
:limit="upload.limit"
:headers="upload.headers"
:disabled="upload.isUploading"
:file-list="upload.fileList"
:multiple="upload.multiple"
:on-change="handleFileChange"
:on-remove="handleFileRemove"
:on-exceed="handleFileexceed"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:on-error="handleFileFail"
:data="upload.data"
:auto-upload="true"
list-type="picture"
>
<i class="el-icon-upload" />
<div class="el-upload__text">
将文件拖到此处<em>点击上传</em>
</div>
<div class="el-upload__tip" slot="tip">
只能上传jpg/png文件且不超过500kb
</div>
</el-upload>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</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 {
addWxAccount,
delWxAccount,
exportWxAccount,
getWxAccount,
listWxAccount,
updateWxAccount,
} from "@/api/custom/WxAccount";
import { getToken } from "@/utils/auth";
export default {
name: "WxAccount",
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 微信销售账号表格数据
WxAccountList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 账号id字典
accountIdOptions: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
nickName: null,
accountId: null,
phone: null,
},
upload: {
// 是否禁用上传
isUploading: false,
// 上传的地址
url: process.env.VUE_APP_BASE_API + "/custom/WxAccount/upload",
// 设置上传的请求头部
headers: {
Authorization: "Bearer " + getToken(),
},
// 其他需要携带的数据
data: {},
//文件列表
fileList: [],
//同时上传文件上限
limit: 1,
//每个文件大小
fileSize: 1024 * 500,
//是否支持同时选择多张
multiple: false,
},
// 表单参数
form: {},
// 表单校验
rules: {},
};
},
created() {
this.getList();
this.getDicts("cus_account").then((response) => {
this.accountIdOptions = response.data;
});
},
methods: {
/** 查询微信销售账号列表 */
getList() {
this.loading = true;
listWxAccount(this.queryParams).then((response) => {
this.WxAccountList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 账号id字典翻译
accountIdFormat(row, column) {
return this.selectDictLabel(this.accountIdOptions, row.accountId);
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
nickName: null,
accountId: null,
wxId: null,
phone: null,
remark: null,
imgUrl: null,
count: null,
mediaId: 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 () {});
},
//监控上传文件列表
handleFileChange(file, fileList) {
let sizeFlag = file.size > this.upload.fileSize;
if (sizeFlag) {
this.$message({
message: "当前文件过大",
type: "warning",
});
fileList.pop();
}
this.upload.fileList = fileList;
},
handleFileRemove(file, fileList) {
this.upload.fileList = fileList;
},
// 文件数量超过限度
handleFileexceed(file, fileList) {
//console.log(this.upload.fileList.length);
this.$message({
message: "最多可上传" + this.upload.limit + "份文件",
type: "warning",
});
},
// 文件上传中处理
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
// 文件上传成功处理
handleFileSuccess(response, file, fileList) {
if (response != null && response.code === 200) {
this.form.imgUrl = response.fileName;
// console.log(response);
} else {
this.fail();
this.$message.error(response.msg);
}
},
// 文件上传失败处理
handleFileFail(err, file, fileList) {
if (err) {
this.$message.error("文件上传失败,请检查文件格式");
this.fail();
}
},
fail() {
this.submitFlag = false;
this.upload.isUploading = false;
},
},
};
</script>
<style>
.has-file .el-upload--picture {
display: none;
}
.has-file .el-upload__tip {
display: none;
}
</style>

View 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>

View File

@ -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: "体重格式不正确",
},
],

View 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>

View 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>