导粉记录部分功能

This commit is contained in:
xiezhijun 2021-05-18 18:49:20 +08:00
parent 4c57672097
commit c802d5151f
10 changed files with 576 additions and 1 deletions

View File

@ -1,6 +1,9 @@
package com.stdiet.web.controller.custom;
import java.util.List;
import com.stdiet.custom.domain.SysWxSaleAccount;
import com.stdiet.custom.service.ISysWxSaleAccountService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -33,6 +36,9 @@ public class SysImportFanRecordController extends BaseController
@Autowired
private ISysImportFanRecordService sysImportFanRecordService;
@Autowired
private ISysWxSaleAccountService sysWxSaleAccountService;
/**
* 查询导粉管理列表
*/
@ -100,4 +106,15 @@ public class SysImportFanRecordController extends BaseController
{
return toAjax(sysImportFanRecordService.deleteSysImportFanRecordByIds(ids));
}
/**
* 获取可接粉的微信号以及对应销售
* @param sysWxSaleAccount
* @return
*/
@PreAuthorize("@ss.hasPermi('custom:importFanRecord:add')")
@GetMapping(value = "/getWxAccountAndSale")
public TableDataInfo getWxAccountAndSale(SysWxSaleAccount sysWxSaleAccount){
return getDataTable(sysWxSaleAccountService.getWxAccountAndSale(sysWxSaleAccount));
}
}

View File

@ -44,4 +44,7 @@ public class SysWxSaleAccount extends BaseEntity
private Integer status;
private Integer useCount;
//销售昵称
private String saleName;
}

View File

@ -71,4 +71,11 @@ public interface SysWxSaleAccountMapper
SysWxSaleAccount selectWxAdId();
int insertWxAdLog(SysWxAdLog sysWxAdLog);
/**
* 获取可接粉的微信号以及分配的销售昵称
* @param sysWxSaleAccount
* @return
*/
List<SysWxSaleAccount> getWxAccountAndSale(SysWxSaleAccount sysWxSaleAccount);
}

View File

@ -72,4 +72,11 @@ public interface ISysWxSaleAccountService
String getWxAdId(SysWxAdLog sysWxAdLog);
Integer logWxAd(SysWxAdLog sysWxAdLog);
/**
* 获取可接粉的微信号以及分配的销售昵称
* @param sysWxSaleAccount
* @return
*/
List<SysWxSaleAccount> getWxAccountAndSale(SysWxSaleAccount sysWxSaleAccount);
}

View File

@ -33,7 +33,7 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService {
private SysOrderMapper sysOrderMapper;
@Autowired
private SysOrderPauseMapper sysOrderPauseMapper;
private SysOrderPauseMapper sysOrderPauseMapper ;
@Autowired
private ISysOrderNutritionistReplaceRecordService sysOrderNutritionistReplaceRecordService;

View File

@ -128,4 +128,13 @@ public class SysWxSaleAccountServiceImpl implements ISysWxSaleAccountService {
public Integer logWxAd(SysWxAdLog sysWxAdLog) {
return sysWxSaleAccountMapper.insertWxAdLog(sysWxAdLog);
}
/**
* 获取可接粉的微信号以及分配的销售昵称
* @param sysWxSaleAccount
* @return
*/
public List<SysWxSaleAccount> getWxAccountAndSale(SysWxSaleAccount sysWxSaleAccount){
return sysWxSaleAccountMapper.getWxAccountAndSale(sysWxSaleAccount);
}
}

View File

@ -19,6 +19,9 @@
<result property="delFlag" column="del_flag"/>
<result property="status" column="status"/>
<result property="useCount" column="use_count"/>
<!-- 销售 -->
<result property="saleName" column="sale_name"></result>
</resultMap>
<sql id="selectSysWxSaleAccountVo">
@ -31,6 +34,7 @@
<if test="wxNickName != null and wxNickName != ''">and wx_nick_name like concat('%', #{wxNickName}, '%')</if>
<if test="wxAccount != null and wxAccount != ''">and wx_account like concat('%', #{wxAccount}, '%')</if>
<if test="wxPhone != null and wxPhone != ''">and wx_phone like concat('%', #{wxPhone}, '%')</if>
<if test="status != null">and status = #{status}</if>
order by id desc
</select>
@ -134,4 +138,15 @@
</trim>
</insert>
<!-- 查询可以接粉的微信号以及对应销售,用于导粉记录管理 -->
<select id="getWxAccountAndSale" parameterType="SysWxSaleAccount" resultMap="SysWxSaleAccountResult">
select wa.id, wa.wx_account, su.nick_name as sale_name
from sys_wx_sale_account wa
left join sys_wx_distribution swd on wa.id = swd.wechat_account and swd.del_flag = 0
LEFT JOIN sys_user su ON su.user_id = swd.user_id AND su.del_flag = 0
where wa.del_flag = 0 and wa.status = 0
<if test="wxAccount != null and wxAccount != ''">and wa.wx_account like concat('%', #{wxAccount}, '%')</if>
order by wa.id desc
</select>
</mapper>

View File

@ -0,0 +1,61 @@
import request from '@/utils/request'
// 查询导粉管理列表
export function listImportFanRecord(query) {
return request({
url: '/custom/importFanRecord/list',
method: 'get',
params: query
})
}
// 查询导粉管理详细
export function getImportFanRecord(id) {
return request({
url: '/custom/importFanRecord/' + id,
method: 'get'
})
}
// 新增导粉管理
export function addImportFanRecord(data) {
return request({
url: '/custom/importFanRecord',
method: 'post',
data: data
})
}
// 修改导粉管理
export function updateImportFanRecord(data) {
return request({
url: '/custom/importFanRecord',
method: 'put',
data: data
})
}
// 删除导粉管理
export function delImportFanRecord(id) {
return request({
url: '/custom/importFanRecord/' + id,
method: 'delete'
})
}
// 导出导粉管理
export function exportImportFanRecord(query) {
return request({
url: '/custom/importFanRecord/export',
method: 'get',
params: query
})
}
export function getWxAccountAndSale(query){
return request({
url: '/custom/importFanRecord/getWxAccountAndSale',
method: 'get',
params: query
})
}

View File

@ -0,0 +1,120 @@
<template>
<!-- 添加或修改导粉管理对话框 -->
<el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
<div style="height: 500px; overflow: auto">
<el-table v-loading="loading" :data="wxAccountList">
<!--<el-table-column label="微信昵称" align="center" prop="wxNickName" />-->
<el-table-column label="微信号" align="center" prop="wxAccount" width="120"/>
<el-table-column label="销售" align="center" prop="saleName" width="120"/>
<el-table-column label="已导粉数量" align="center" prop="importFanNum" width="120"/>
<el-table-column label="进粉渠道" align="center" prop="fanChannel" >
<template slot-scope="scope">
<el-select
v-model="scope.row.fanChannel"
placeholder="请选择账号渠道"
clearable
filterable
size="small"
>
<el-option
v-for="dict in fanChanneloptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="导粉数量" align="center" prop="fanNum" width="200">
<template slot-scope="scope">
<el-input-number v-model="scope.row.fanNum" :min="1" :max="10000" label="导粉数量" style="width:160px"></el-input-number>
</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:importFanRecord:add']"
>导粉</el-button>
</template>
</el-table-column>
</el-table>
</div>
</el-dialog>
</template>
<script>
import { addImportFanRecord,getWxAccountAndSale } from "@/api/custom/importFanRecord";
export default {
name: "ImportFan",
components: {
},
data() {
return {
//
loading: true,
//
title: "",
//
open: false,
//
rules: {
title: [
{ required: true, message: "标题不能为空", trigger: "blur" },
]
},
data: null,
callback: null,
//
wxAccountList:[],
fanChanneloptions:[]
};
},
created(){
},
methods: {
showDialog(data, callback, fanChanneloptions) {
if(!data || data == undefined || data == null){
return;
}
this.fanChanneloptions = fanChanneloptions;
this.title = "「"+data.importFanDate+"」微信导粉(只显示可接粉微信号)";
this.reset();
this.callback = callback;
this.getListWxAccount();
this.open = true;
},
reset(){
},
/** 提交按钮 */
submitForm() {
},
onClosed() {
this.reset();
},
cancel(){
this.open = false;
this.reset();
},
//
getListWxAccount() {
this.loading = true;
getWxAccountAndSale().then((response) => {
this.wxAccountList = response.rows;
this.loading = false;
});
},
},
};
</script>
<style lang="scss" scoped>
</style>

View File

@ -0,0 +1,336 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="导粉日期" prop="importFanDate">
<el-date-picker clearable size="small" style="width: 200px"
v-model="queryParams.importFanDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择导粉日期">
</el-date-picker>
</el-form-item>
<el-form-item label="账号渠道" prop="importFanChannel">
<el-select
v-model="queryParams.importFanChannel"
placeholder="请选择账号渠道"
clearable
filterable
size="small"
>
<el-option
v-for="dict in fanChanneloptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item>
<!--<el-form-item label="进粉直播间" prop="importFanLive">
<el-input
v-model="queryParams.importFanLive"
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="showDialog(null)"
v-hasPermi="['custom:importFanRecord: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:importFanRecord: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:importFanRecord: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:importFanRecord:export']"
>导出</el-button>
</el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="importFanRecordList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="导粉日期" align="center" prop="importFanDate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.importFanDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="导粉渠道" align="center" prop="importFanChannel" />
<!--<el-table-column label="进粉直播间" align="center" prop="importFanLive" />-->
<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:importFanRecord:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['custom:importFanRecord: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="importFanDate">
<el-date-picker clearable size="small" style="width: 200px"
v-model="form.importFanDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择导粉日期">
</el-date-picker>
</el-form-item>
<el-form-item label="导粉渠道" prop="importFanChannel">
<el-input v-model="form.importFanChannel" placeholder="请输入导粉渠道" />
</el-form-item>
<el-form-item label="进粉直播间" prop="importFanLive">
<el-input v-model="form.importFanLive" 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>
<ImportFan ref="importFanRef"></ImportFan>
</div>
</template>
<script>
import { listImportFanRecord, getImportFanRecord, delImportFanRecord, addImportFanRecord, updateImportFanRecord, exportImportFanRecord } from "@/api/custom/importFanRecord";
import ImportFan from "@/components/ImportFanRecord/ImportFan";
import dayjs from "dayjs";
const nowDate = dayjs().format("YYYY-MM-DD");
const nowTime = dayjs().format("YYYY-MM-DD HH:mm");
export default {
name: "ImportFanRecord",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
importFanRecordList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
importFanDate: nowDate,
importFanChannel: null,
importFanLive: null,
},
//
form: {},
//
rules: {
},
//
fanChanneloptions:[]
};
},
created() {
this.getList();
this.getDicts("cus_account").then((response) => {
this.fanChanneloptions = response.data;
});
},
components:{
ImportFan
},
methods: {
/** 查询导粉管理列表 */
getList() {
this.loading = true;
listImportFanRecord(this.queryParams).then(response => {
this.importFanRecordList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
importFanDate: null,
importFanChannel: null,
importFanLive: 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
getImportFanRecord(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) {
updateImportFanRecord(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
}
});
} else {
addImportFanRecord(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 delImportFanRecord(ids);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(function() {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有导粉管理数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return exportImportFanRecord(queryParams);
}).then(response => {
this.download(response.msg);
}).catch(function() {});
},
showDialog(data){
if(this.queryParams.importFanDate == undefined || this.queryParams.importFanDate == null){
this.$message({
type: 'warning',
message: '导粉日期不能为空',
center: true
});
return;
}
if(data == null){
data = {};
}
data.importFanDate = this.queryParams.importFanDate;
this.$refs.importFanRef.showDialog(data,()=>{
this.getList();
}, this.fanChanneloptions);
}
}
};
</script>