导粉统计,更新客户手机号时更新下微信用户对应的客户ID
This commit is contained in:
parent
7cac34799c
commit
574c8b424e
stdiet-admin/src/main/java/com/stdiet/web/controller/custom
stdiet-custom/src/main
java/com/stdiet/custom
domain
mapper
service
resources/mapper/custom
stdiet-ui/src
api/custom
components/ImportFanRecord/ImportFan
views/custom/importFanRecord
@ -233,4 +233,13 @@ public class SysLiveSchedulController extends BaseController
|
||||
public AjaxResult copyLastTimeLiveSchedul(){
|
||||
return sysLiveSchedulService.copyLastTimeLiveSchedul();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据日期查询直播记录
|
||||
*/
|
||||
@GetMapping(value = "/getAllLiveSchedulByDate")
|
||||
public AjaxResult getAllLiveSchedulByDate(SysLiveSchedul sysLiveSchedul){
|
||||
List<SysLiveSchedul> list = sysLiveSchedulService.selectSysLiveSchedulList(sysLiveSchedul);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
}
|
@ -1,9 +1,13 @@
|
||||
package com.stdiet.custom.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.stdiet.common.annotation.Excel;
|
||||
import com.stdiet.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 导粉管理对象 sys_import_fan_record
|
||||
@ -11,6 +15,7 @@ import com.stdiet.common.core.domain.BaseEntity;
|
||||
* @author xzj
|
||||
* @date 2021-05-17
|
||||
*/
|
||||
@Data
|
||||
public class SysImportFanRecord extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ -33,4 +38,18 @@ public class SysImportFanRecord extends BaseEntity
|
||||
|
||||
/** 删除标识,0未删除 1已删除 */
|
||||
private Long delFlag;
|
||||
|
||||
//微信ID
|
||||
private Long wxAccountId;
|
||||
|
||||
//进粉数量
|
||||
private Long fanNum;
|
||||
|
||||
private String importFanChannelName;
|
||||
|
||||
private String liveRoomName;
|
||||
|
||||
private String liveNutritionistName;
|
||||
|
||||
private List<Map<String,Object>> wxAccountList;
|
||||
}
|
@ -58,4 +58,11 @@ public interface SysImportFanRecordMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysImportFanRecordByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 根据日期渠道、直播间获取进粉记录
|
||||
* @param sysImportFanRecord
|
||||
* @return
|
||||
*/
|
||||
public SysImportFanRecord getFanRecordByChannelLive(SysImportFanRecord sysImportFanRecord);
|
||||
}
|
@ -58,4 +58,11 @@ public interface SysImportFanWxAccountMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysImportFanWxAccountByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 根据导粉记录ID、微信ID查询对应微信记录
|
||||
* @param sysImportFanWxAccount
|
||||
* @return
|
||||
*/
|
||||
public SysImportFanWxAccount getWxAccountByFanRecordId(SysImportFanWxAccount sysImportFanWxAccount);
|
||||
}
|
@ -2,6 +2,7 @@ package com.stdiet.custom.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.stdiet.custom.domain.SysWxUserInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 微信用户Mapper接口
|
||||
@ -62,4 +63,11 @@ public interface SysWxUserInfoMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysWxUserInfoByIds(String[] openids);
|
||||
|
||||
/**
|
||||
* 根据手机号查询微信用户
|
||||
* @param phone
|
||||
* @return
|
||||
*/
|
||||
public SysWxUserInfo getSysWxUserInfoByPhone(@Param("phone")String phone);
|
||||
}
|
@ -58,4 +58,11 @@ public interface ISysImportFanWxAccountService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysImportFanWxAccountById(Long id);
|
||||
|
||||
/**
|
||||
* 根据导粉记录ID、微信ID查询对应微信记录
|
||||
* @param sysImportFanWxAccount
|
||||
* @return
|
||||
*/
|
||||
public SysImportFanWxAccount getWxAccountByFanRecordId(SysImportFanWxAccount sysImportFanWxAccount);
|
||||
}
|
@ -63,5 +63,12 @@ public interface ISysWxUserInfoService
|
||||
*/
|
||||
public int deleteSysWxUserInfoById(String openid);
|
||||
|
||||
/**
|
||||
* 根据手机号查询微信用户
|
||||
* @param phone
|
||||
* @return
|
||||
*/
|
||||
public SysWxUserInfo getSysWxUserInfoByPhone(String phone);
|
||||
|
||||
|
||||
}
|
@ -14,6 +14,7 @@ import com.stdiet.custom.domain.SysCustomer;
|
||||
import com.stdiet.custom.domain.SysCustomerPhysicalSigns;
|
||||
import com.stdiet.custom.dto.request.HealthyDetailRequest;
|
||||
import com.stdiet.custom.dto.response.NutritionalCalories;
|
||||
import com.stdiet.custom.mapper.SysCustomerMapper;
|
||||
import com.stdiet.custom.service.ISysCustomerService;
|
||||
import com.stdiet.custom.utils.NutritionalUtils;
|
||||
import com.stdiet.custom.utils.PdfUtils;
|
||||
@ -36,7 +37,7 @@ public class SysCustomerHealthyServiceImpl implements ISysCustomerHealthyService
|
||||
private SysCustomerHealthyMapper sysCustomerHealthyMapper;
|
||||
|
||||
@Autowired
|
||||
private ISysCustomerService sysCustomerService;
|
||||
private SysCustomerMapper sysCustomerMapper;
|
||||
|
||||
public static final String reportDownFileNameFormat = "%s超重%s斤%s";
|
||||
|
||||
@ -78,7 +79,7 @@ public class SysCustomerHealthyServiceImpl implements ISysCustomerHealthyService
|
||||
return AjaxResult.error("客户不存在");
|
||||
}
|
||||
//判断客户是否存在
|
||||
SysCustomer sysCustomer = sysCustomerService.selectSysCustomerById(Long.parseLong(customerId));
|
||||
SysCustomer sysCustomer = sysCustomerMapper.selectSysCustomerById(Long.parseLong(customerId));
|
||||
if(sysCustomer == null){
|
||||
return AjaxResult.error("客户不存在");
|
||||
}
|
||||
|
@ -6,10 +6,14 @@ import com.stdiet.common.utils.sign.AesUtils;
|
||||
import com.stdiet.custom.domain.SysCustomer;
|
||||
import com.stdiet.custom.domain.SysCustomerHealthy;
|
||||
import com.stdiet.custom.domain.SysCustomerPhysicalSigns;
|
||||
import com.stdiet.custom.domain.SysWxUserInfo;
|
||||
import com.stdiet.custom.mapper.SysCustomerMapper;
|
||||
import com.stdiet.custom.mapper.SysCustomerPhysicalSignsMapper;
|
||||
import com.stdiet.custom.mapper.SysWxUserInfoMapper;
|
||||
import com.stdiet.custom.service.ISysCustomerService;
|
||||
import com.stdiet.custom.service.ISysWxUserInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -38,6 +42,9 @@ public class SysCustomerServiceImpl implements ISysCustomerService {
|
||||
@Autowired
|
||||
private SysCustomerPhysicalSignsServiceImpl sysCustomerPhysicalSignsService;
|
||||
|
||||
@Autowired
|
||||
private ISysWxUserInfoService sysWxUserInfoService;
|
||||
|
||||
/**
|
||||
* 查询客户信息
|
||||
*
|
||||
@ -69,7 +76,11 @@ public class SysCustomerServiceImpl implements ISysCustomerService {
|
||||
@Override
|
||||
public int insertSysCustomer(SysCustomer sysCustomer) {
|
||||
sysCustomer.setCreateTime(DateUtils.getNowDate());
|
||||
return sysCustomerMapper.insertSysCustomer(sysCustomer);
|
||||
int row = sysCustomerMapper.insertSysCustomer(sysCustomer);
|
||||
if(row > 0){
|
||||
updateWxInfoMessage(sysCustomer);
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -81,7 +92,11 @@ public class SysCustomerServiceImpl implements ISysCustomerService {
|
||||
@Override
|
||||
public int updateSysCustomer(SysCustomer sysCustomer) {
|
||||
sysCustomer.setUpdateTime(DateUtils.getNowDate());
|
||||
return sysCustomerMapper.updateSysCustomer(sysCustomer);
|
||||
int row = sysCustomerMapper.updateSysCustomer(sysCustomer);
|
||||
if(row > 0){
|
||||
updateWxInfoMessage(sysCustomer);
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -177,4 +192,17 @@ public class SysCustomerServiceImpl implements ISysCustomerService {
|
||||
public SysCustomer getCustomerByOpenId(String openid){
|
||||
return sysCustomerMapper.getCustomerByOpenId(openid);
|
||||
}
|
||||
|
||||
@Async
|
||||
public void updateWxInfoMessage(SysCustomer newCustomer){
|
||||
if(newCustomer == null || newCustomer.getId() == null || StringUtils.isEmpty(newCustomer.getPhone())){
|
||||
return;
|
||||
}
|
||||
//根据手机号查询微信用户记录
|
||||
SysWxUserInfo wxUserInfo = sysWxUserInfoService.getSysWxUserInfoByPhone(newCustomer.getPhone());
|
||||
if(wxUserInfo != null && (wxUserInfo.getCusId() == null || wxUserInfo.getCusId().longValue() != newCustomer.getId())){
|
||||
wxUserInfo.setCusId(newCustomer.getId());
|
||||
sysWxUserInfoService.updateSysWxUserInfo(wxUserInfo);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,10 @@
|
||||
package com.stdiet.custom.service.impl;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.stdiet.common.utils.DateUtils;
|
||||
import com.stdiet.custom.domain.SysImportFanWxAccount;
|
||||
import com.stdiet.custom.service.ISysImportFanWxAccountService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.stdiet.custom.mapper.SysImportFanRecordMapper;
|
||||
@ -20,6 +23,9 @@ public class SysImportFanRecordServiceImpl implements ISysImportFanRecordService
|
||||
@Autowired
|
||||
private SysImportFanRecordMapper sysImportFanRecordMapper;
|
||||
|
||||
@Autowired
|
||||
private ISysImportFanWxAccountService sysImportFanWxAccountService;
|
||||
|
||||
/**
|
||||
* 查询导粉管理
|
||||
*
|
||||
@ -54,7 +60,29 @@ public class SysImportFanRecordServiceImpl implements ISysImportFanRecordService
|
||||
public int insertSysImportFanRecord(SysImportFanRecord sysImportFanRecord)
|
||||
{
|
||||
sysImportFanRecord.setCreateTime(DateUtils.getNowDate());
|
||||
return sysImportFanRecordMapper.insertSysImportFanRecord(sysImportFanRecord);
|
||||
//根据账号渠道、直播间判断是否已存在该渠道的导粉记录
|
||||
SysImportFanRecord record = sysImportFanRecordMapper.getFanRecordByChannelLive(sysImportFanRecord);
|
||||
int row = 0;
|
||||
if(record == null){
|
||||
row = sysImportFanRecordMapper.insertSysImportFanRecord(sysImportFanRecord);
|
||||
}
|
||||
if(record != null || row > 0){
|
||||
//添加微信号对应记录
|
||||
SysImportFanWxAccount sysImportFanWxAccount = new SysImportFanWxAccount();
|
||||
sysImportFanWxAccount.setImportFanRecordId(record != null ? record.getId() : sysImportFanRecord.getId());
|
||||
sysImportFanWxAccount.setImportWxAccountId(sysImportFanRecord.getWxAccountId());
|
||||
sysImportFanWxAccount.setImportFanNum(sysImportFanRecord.getFanNum());
|
||||
sysImportFanWxAccount.setCreateTime(new Date());
|
||||
//根据微信号、导粉记录查询是否存在
|
||||
SysImportFanWxAccount oldFanWxAccount = sysImportFanWxAccountService.getWxAccountByFanRecordId(sysImportFanWxAccount);
|
||||
if(oldFanWxAccount == null){
|
||||
row = sysImportFanWxAccountService.insertSysImportFanWxAccount(sysImportFanWxAccount);
|
||||
}else{
|
||||
oldFanWxAccount.setImportFanNum((oldFanWxAccount.getImportFanNum() == null ? 0 : oldFanWxAccount.getImportFanNum()) + sysImportFanWxAccount.getImportFanNum());
|
||||
row = sysImportFanWxAccountService.updateSysImportFanWxAccount(oldFanWxAccount);
|
||||
}
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -93,4 +93,13 @@ public class SysImportFanWxAccountServiceImpl implements ISysImportFanWxAccountS
|
||||
{
|
||||
return sysImportFanWxAccountMapper.deleteSysImportFanWxAccountById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据导粉记录ID、微信ID查询对应微信记录
|
||||
* @param sysImportFanWxAccount
|
||||
* @return
|
||||
*/
|
||||
public SysImportFanWxAccount getWxAccountByFanRecordId(SysImportFanWxAccount sysImportFanWxAccount){
|
||||
return sysImportFanWxAccountMapper.getWxAccountByFanRecordId(sysImportFanWxAccount);
|
||||
}
|
||||
}
|
@ -97,4 +97,13 @@ public class SysWxUserInfoServiceImpl implements ISysWxUserInfoService {
|
||||
public int deleteSysWxUserInfoById(String openid) {
|
||||
return sysWxUserInfoMapper.deleteSysWxUserInfoById(openid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据手机号查询微信用户
|
||||
* @param phone
|
||||
* @return
|
||||
*/
|
||||
public SysWxUserInfo getSysWxUserInfoByPhone(String phone){
|
||||
return sysWxUserInfoMapper.getSysWxUserInfoByPhone(phone);
|
||||
}
|
||||
}
|
@ -14,18 +14,47 @@
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
|
||||
<result property="importFanChannelName" column="import_fan_channel_name"></result>
|
||||
<result property="liveRoomName" column="live_room_name"></result>
|
||||
<result property="liveNutritionistName" column="live_nutritionist_name"></result>
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="SysImportFanRecord" id="SysImportFanRecordResultExtended">
|
||||
<result property="id" column="id" />
|
||||
<result property="importFanDate" column="import_fan_date" />
|
||||
<result property="importFanChannel" column="import_fan_channel" />
|
||||
<result property="importFanLive" column="import_fan_live" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
|
||||
<result property="importFanChannelName" column="import_fan_channel_name"></result>
|
||||
<result property="liveRoomName" column="live_room_name"></result>
|
||||
<result property="liveNutritionistName" column="live_nutritionist_name"></result>
|
||||
|
||||
<!-- 查询该渠道已导粉的微信号 -->
|
||||
<association property="wxAccountList" column="id" select="getWxAccountListByFanRecordId"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysImportFanRecordVo">
|
||||
select id, import_fan_date, import_fan_channel, import_fan_live, create_time, create_by, update_time, update_by, del_flag from sys_import_fan_record
|
||||
</sql>
|
||||
|
||||
<select id="selectSysImportFanRecordList" parameterType="SysImportFanRecord" resultMap="SysImportFanRecordResult">
|
||||
<include refid="selectSysImportFanRecordVo"/>
|
||||
where del_flag = 0
|
||||
<if test="importFanDate != null "> and import_fan_date = #{importFanDate}</if>
|
||||
<if test="importFanChannel != null "> and import_fan_channel = #{importFanChannel}</if>
|
||||
<if test="importFanLive != null "> and import_fan_live = #{importFanLive}</if>
|
||||
<select id="selectSysImportFanRecordList" parameterType="SysImportFanRecord" resultMap="SysImportFanRecordResultExtended">
|
||||
select fc.id, fc.import_fan_date, fc.import_fan_channel, fc.import_fan_live, fc.create_time,
|
||||
ca.dict_label as import_fan_channel_name, slt.dict_label as live_room_name,su_nutritionist.nick_name as live_nutritionist_name
|
||||
from sys_import_fan_record as fc
|
||||
left join (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'cus_account') AS ca ON ca.dict_value = fc.import_fan_channel
|
||||
left join sys_live_schedul as slc on slc.id = fc.import_fan_live and slc.del_flag = 0
|
||||
left join (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'sys_live_type') AS slt ON slt.dict_value = slc.live_room
|
||||
left join sys_user as su_nutritionist on su_nutritionist.user_id = slc.live_nutritionist_id and su_nutritionist.del_flag = 0
|
||||
where fc.del_flag = 0
|
||||
<if test="importFanDate != null "> and fc.import_fan_date = #{importFanDate}</if>
|
||||
<if test="importFanChannel != null "> and fc.import_fan_channel = #{importFanChannel}</if>
|
||||
<if test="importFanLive != null "> and fc.import_fan_live = #{importFanLive}</if>
|
||||
</select>
|
||||
|
||||
<select id="selectSysImportFanRecordById" parameterType="Long" resultMap="SysImportFanRecordResult">
|
||||
@ -83,4 +112,20 @@
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="getFanRecordByChannelLive" parameterType="SysImportFanRecord" resultMap="SysImportFanRecordResult">
|
||||
select * from sys_import_fan_record where del_flag = 0 and import_fan_date = #{importFanDate} and import_fan_channel = #{importFanChannel}
|
||||
and import_fan_live = #{importFanLive}
|
||||
order by id desc limit 1
|
||||
</select>
|
||||
|
||||
<select id="getWxAccountListByFanRecordId" parameterType="Long" resultType="Map">
|
||||
select fwc.id, fwc.import_fan_record_id as importFanRecordId, fwc.import_wx_account_id as importWxAccountId, fwc.import_fan_num as importFanNum,
|
||||
su.nick_name as saleName,wa.wx_account as wxAccount
|
||||
from sys_import_fan_wx_account fwc
|
||||
left join sys_wx_sale_account wa on wa.id = fwc.import_wx_account_id and wa.del_flag = 0
|
||||
left join sys_wx_distribution swd on swd.wechat_account = wa.id and swd.del_flag = 0
|
||||
left join sys_user su on swd.user_id = su.id and su.del_flag = 0
|
||||
where fwc.del_flag = 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -82,4 +82,9 @@
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="getWxAccountByFanRecordId" parameterType="SysImportFanWxAccount" resultMap="SysImportFanWxAccountResult">
|
||||
select * from sys_import_fan_wx_account where del_flag = 0 and import_fan_record_id = #{importFanRecordId}
|
||||
and import_wx_account_id = #{importWxAccountId} order by id desc limit 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -129,4 +129,10 @@
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 根据手机号查询微信用户 -->
|
||||
<select id="getSysWxUserInfoByPhone" parameterType="String" resultMap="SysWxUserInfoResult">
|
||||
<include refid="selectSysWxUserInfoVo"/>
|
||||
where phone = #{phone} order by create_time desc limit 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -71,4 +71,14 @@ export function copyLastTimeLiveSchedul() {
|
||||
})
|
||||
}
|
||||
|
||||
// 根据日期查询直播记录
|
||||
export function getAllLiveSchedulByDate(data) {
|
||||
return request({
|
||||
url: '/custom/liveSchedul/getAllLiveSchedulByDate',
|
||||
method: 'get',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,16 +1,16 @@
|
||||
<template>
|
||||
<!-- 添加或修改导粉管理对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
|
||||
<el-dialog :title="title" :visible.sync="open" width="1100px" :close-on-click-modal="false" 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" >
|
||||
<el-table-column label="进粉渠道" align="center" prop="importFanChannel" >
|
||||
<template slot-scope="scope">
|
||||
<el-select
|
||||
v-model="scope.row.fanChannel"
|
||||
v-model="scope.row.importFanChannel"
|
||||
placeholder="请选择账号渠道"
|
||||
clearable
|
||||
filterable
|
||||
@ -25,6 +25,24 @@
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="直播间" align="center" prop="importFanLive" >
|
||||
<template slot-scope="scope">
|
||||
<el-select
|
||||
v-model="scope.row.importFanLive"
|
||||
placeholder="请选择直播间"
|
||||
clearable
|
||||
filterable
|
||||
size="small"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in liveSchedukList"
|
||||
:key="dict.id"
|
||||
:label="dict.liveRoomName"
|
||||
:value="parseInt(dict.id)"
|
||||
/>
|
||||
</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>
|
||||
@ -33,10 +51,9 @@
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
size="normal"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
@click="addImportFanRecord(scope.row)"
|
||||
v-hasPermi="['custom:importFanRecord:add']"
|
||||
>导粉</el-button>
|
||||
</template>
|
||||
@ -48,6 +65,7 @@
|
||||
</template>
|
||||
<script>
|
||||
import { addImportFanRecord,getWxAccountAndSale } from "@/api/custom/importFanRecord";
|
||||
import { getAllLiveSchedulByDate } from "@/api/custom/liveSchedul";
|
||||
export default {
|
||||
name: "ImportFan",
|
||||
components: {
|
||||
@ -71,10 +89,13 @@ export default {
|
||||
callback: null,
|
||||
//可接粉的微信号
|
||||
wxAccountList:[],
|
||||
fanChanneloptions:[]
|
||||
fanChanneloptions:[],
|
||||
//当日直播间
|
||||
liveSchedukList:[]
|
||||
};
|
||||
},
|
||||
created(){
|
||||
|
||||
|
||||
},
|
||||
methods: {
|
||||
@ -82,11 +103,13 @@ export default {
|
||||
if(!data || data == undefined || data == null){
|
||||
return;
|
||||
}
|
||||
this.data = data;
|
||||
this.fanChanneloptions = fanChanneloptions;
|
||||
this.title = "「"+data.importFanDate+"」微信导粉(只显示可接粉微信号)";
|
||||
this.reset();
|
||||
this.callback = callback;
|
||||
this.getListWxAccount();
|
||||
this.getAllLiveSchedulByDate();
|
||||
this.open = true;
|
||||
},
|
||||
reset(){
|
||||
@ -107,10 +130,57 @@ export default {
|
||||
getListWxAccount() {
|
||||
this.loading = true;
|
||||
getWxAccountAndSale().then((response) => {
|
||||
response.rows.forEach((item,index) => {
|
||||
item.fanNum = 1;
|
||||
})
|
||||
this.wxAccountList = response.rows;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
getAllLiveSchedulByDate(){
|
||||
console.log("--");
|
||||
getAllLiveSchedulByDate({'liveSchedulDate':this.data.importFanDate}).then((response) => {
|
||||
response.data.forEach((item,index) => {
|
||||
item.liveRoomName = item.liveNutritionistName + " " + item.liveRoomName;
|
||||
});
|
||||
this.liveSchedukList = response.data;
|
||||
});
|
||||
},
|
||||
addImportFanRecord(row){
|
||||
//账号渠道、进粉数量不能为空
|
||||
if(row.importFanChannel == undefined || row.importFanChannel == null){
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: '进粉渠道不能为空',
|
||||
center: true
|
||||
});
|
||||
return;
|
||||
}
|
||||
if(row.fanNum == undefined || row.fanNum == null){
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: '进粉数量不能为空',
|
||||
center: true
|
||||
});
|
||||
return;
|
||||
}
|
||||
let param = {
|
||||
'importFanDate': this.data.importFanDate,
|
||||
'importFanChannel': row.importFanChannel,
|
||||
'importFanLive': row.importFanLive,
|
||||
'wxAccountId': row.id,
|
||||
'fanNum': row.fanNum
|
||||
}
|
||||
addImportFanRecord(param).then((response) => {
|
||||
if(response.code == 200){
|
||||
this.msgSuccess("导粉成功");
|
||||
row.importFanChannel = null;
|
||||
row.fanNum = 1;
|
||||
row.importFanLive = null;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
@ -89,8 +89,12 @@
|
||||
<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" prop="importFanChannelName" />
|
||||
<el-table-column label="所属直播间" align="center" prop="liveRoomName" >
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.liveRoomName + "—" + scope.row.liveNutritionistName}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
|
Loading…
x
Reference in New Issue
Block a user