From ad3b5be7063d791a3a4838c76fbbff2a1854f423 Mon Sep 17 00:00:00 2001
From: xiezhijun <15270898033@163.com>
Date: Fri, 20 Aug 2021 15:57:53 +0800
Subject: [PATCH] =?UTF-8?q?=E7=9B=B4=E6=92=AD=E8=AE=B0=E5=BD=95=E9=A1=B5?=
 =?UTF-8?q?=E9=9D=A2=E6=B7=BB=E5=8A=A0=E8=BF=9B=E7=B2=89=E8=AE=B0=E5=BD=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../custom/SysLiveSchedulController.java      |  27 ++-
 .../custom/SysWxSaleAccountController.java    |   9 +
 .../stdiet/custom/domain/SysLiveSchedul.java  |   4 +
 .../domain/SysLiveSchedulFanRecord.java       |  43 ++++
 .../mapper/SysLiveSchedulFanRecordMapper.java |  61 ++++++
 .../service/ISysLiveSchedulService.java       |  22 ++
 .../impl/SysLiveSchedulServiceImpl.java       |  30 +++
 .../custom/SysLiveSchedulFanRecordMapper.xml  |  85 ++++++++
 .../mapper/custom/SysLiveSchedulMapper.xml    |  13 ++
 stdiet-ui/src/api/custom/liveSchedul.js       |  18 ++
 stdiet-ui/src/api/custom/wxAccount.js         |   9 +
 .../src/views/custom/liveSchedul/index.vue    | 202 +++++++++++++++++-
 12 files changed, 506 insertions(+), 17 deletions(-)
 create mode 100644 stdiet-custom/src/main/java/com/stdiet/custom/domain/SysLiveSchedulFanRecord.java
 create mode 100644 stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysLiveSchedulFanRecordMapper.java
 create mode 100644 stdiet-custom/src/main/resources/mapper/custom/SysLiveSchedulFanRecordMapper.xml

diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysLiveSchedulController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysLiveSchedulController.java
index b753274b3..e4fe38404 100644
--- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysLiveSchedulController.java
+++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysLiveSchedulController.java
@@ -5,16 +5,10 @@ import java.util.List;
 
 import com.stdiet.common.utils.DateUtils;
 import com.stdiet.common.utils.StringUtils;
+import com.stdiet.custom.domain.SysLiveSchedulFanRecord;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import com.stdiet.common.annotation.Log;
 import com.stdiet.common.core.controller.BaseController;
 import com.stdiet.common.core.domain.AjaxResult;
@@ -261,4 +255,21 @@ public class SysLiveSchedulController extends BaseController
         }
         return AjaxResult.success(live);
     }
+
+    /**
+     * 给对应直播添加、更新进粉记录
+     */
+    @PostMapping(value = "/addOrEditSysLiveSchedulFanRecord")
+    public AjaxResult addOrEditSysLiveSchedulFanRecord(@RequestBody  SysLiveSchedulFanRecord sysLiveSchedulFanRecord){
+        int row = sysLiveSchedulFanRecord.getId() == null ? sysLiveSchedulService.addLiveSchedulFanRecord(sysLiveSchedulFanRecord) : sysLiveSchedulService.updateLiveSchedulFanRecord(sysLiveSchedulFanRecord);
+        return toAjax(row);
+    }
+
+    /**
+     * 给对应直播删除进粉记录
+     */
+    @GetMapping(value = "/delSysLiveSchedulFanRecord")
+    public AjaxResult delSysLiveSchedulFanRecord(@RequestParam("id")Long id){
+        return toAjax(sysLiveSchedulService.delLiveSchedulFanRecord(id));
+    }
 }
\ No newline at end of file
diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysWxSaleAccountController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysWxSaleAccountController.java
index cf02a80f8..6db7ccd63 100644
--- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysWxSaleAccountController.java
+++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysWxSaleAccountController.java
@@ -119,4 +119,13 @@ public class SysWxSaleAccountController extends BaseController
     {
         return toAjax(sysWxSaleAccountService.deleteSysWxSaleAccountByIds(ids));
     }
+
+    /**
+     * 查询所有微信账号
+     */
+    @GetMapping("/getAllWxAccount")
+    public AjaxResult getAllWxAccount() {
+        List<SysWxSaleAccount> list = sysWxSaleAccountService.selectSysWxSaleAccountList(new SysWxSaleAccount());
+        return AjaxResult.success(list);
+    }
 }
\ No newline at end of file
diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysLiveSchedul.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysLiveSchedul.java
index 774c4434d..f4b023aa7 100644
--- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysLiveSchedul.java
+++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysLiveSchedul.java
@@ -81,5 +81,9 @@ public class SysLiveSchedul extends BaseEntity
 
     private String fanChannelName;
 
+    //导粉情况
     private List<Map<String,Object>> wxAccountList;
+
+    //进粉情况
+    private List<Map<String,Object>> addFanList;
 }
\ No newline at end of file
diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysLiveSchedulFanRecord.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysLiveSchedulFanRecord.java
new file mode 100644
index 000000000..530d35997
--- /dev/null
+++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysLiveSchedulFanRecord.java
@@ -0,0 +1,43 @@
+package com.stdiet.custom.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.stdiet.common.utils.DateUtils;
+import lombok.Data;
+import com.stdiet.common.annotation.Excel;
+import com.stdiet.common.core.domain.BaseEntity;
+
+/**
+ * 直播记录中每场直播对应进粉记录对象 sys_live_schedul_fan_record
+ *
+ * @author xzj
+ * @date 2021-08-19
+ */
+@Data
+public class SysLiveSchedulFanRecord extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** $column.columnComment */
+    private Long id;
+
+    /** 直播ID */
+    @Excel(name = "直播ID")
+    private Long liveSchedulId;
+
+    /** 微信账号ID */
+    @Excel(name = "微信账号ID")
+    private Long saleWxAccountId;
+
+    /** 进粉客户微信号 */
+    @Excel(name = "进粉客户微信号")
+    private String fanWxNumber;
+
+    /** 进粉时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
+    @Excel(name = "进粉时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm")
+    private Date enterFanTime;
+
+    /** 删除标识 0未删除 1已删除 */
+    private Integer delFlag;
+}
\ No newline at end of file
diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysLiveSchedulFanRecordMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysLiveSchedulFanRecordMapper.java
new file mode 100644
index 000000000..39f0ff770
--- /dev/null
+++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysLiveSchedulFanRecordMapper.java
@@ -0,0 +1,61 @@
+package com.stdiet.custom.mapper;
+
+import java.util.List;
+import com.stdiet.custom.domain.SysLiveSchedulFanRecord;
+
+/**
+ * 直播记录中每场直播对应进粉记录Mapper接口
+ *
+ * @author xzj
+ * @date 2021-08-19
+ */
+public interface SysLiveSchedulFanRecordMapper
+{
+    /**
+     * 查询直播记录中每场直播对应进粉记录
+     *
+     * @param id 直播记录中每场直播对应进粉记录ID
+     * @return 直播记录中每场直播对应进粉记录
+     */
+    public SysLiveSchedulFanRecord selectSysLiveSchedulFanRecordById(Long id);
+
+    /**
+     * 查询直播记录中每场直播对应进粉记录列表
+     *
+     * @param sysLiveSchedulFanRecord 直播记录中每场直播对应进粉记录
+     * @return 直播记录中每场直播对应进粉记录集合
+     */
+    public List<SysLiveSchedulFanRecord> selectSysLiveSchedulFanRecordList(SysLiveSchedulFanRecord sysLiveSchedulFanRecord);
+
+    /**
+     * 新增直播记录中每场直播对应进粉记录
+     *
+     * @param sysLiveSchedulFanRecord 直播记录中每场直播对应进粉记录
+     * @return 结果
+     */
+    public int insertSysLiveSchedulFanRecord(SysLiveSchedulFanRecord sysLiveSchedulFanRecord);
+
+    /**
+     * 修改直播记录中每场直播对应进粉记录
+     *
+     * @param sysLiveSchedulFanRecord 直播记录中每场直播对应进粉记录
+     * @return 结果
+     */
+    public int updateSysLiveSchedulFanRecord(SysLiveSchedulFanRecord sysLiveSchedulFanRecord);
+
+    /**
+     * 删除直播记录中每场直播对应进粉记录
+     *
+     * @param id 直播记录中每场直播对应进粉记录ID
+     * @return 结果
+     */
+    public int deleteSysLiveSchedulFanRecordById(Long id);
+
+    /**
+     * 批量删除直播记录中每场直播对应进粉记录
+     *
+     * @param ids 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteSysLiveSchedulFanRecordByIds(Long[] ids);
+}
\ No newline at end of file
diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysLiveSchedulService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysLiveSchedulService.java
index 3ae973af1..020b752fa 100644
--- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysLiveSchedulService.java
+++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysLiveSchedulService.java
@@ -4,6 +4,7 @@ import java.util.List;
 
 import com.stdiet.common.core.domain.AjaxResult;
 import com.stdiet.custom.domain.SysLiveSchedul;
+import com.stdiet.custom.domain.SysLiveSchedulFanRecord;
 
 /**
  * 直播排班Service接口
@@ -91,4 +92,25 @@ public interface ISysLiveSchedulService
      * @return
      */
     public SysLiveSchedul getLiveSchedulByTime(SysLiveSchedul sysLiveSchedul);
+
+
+    /**
+     * 给对应直播添加进粉记录
+     * @return
+     */
+    int addLiveSchedulFanRecord(SysLiveSchedulFanRecord sysLiveSchedulFanRecord);
+
+    /**
+     * 给对应直播更新进粉记录
+     * @param sysLiveSchedulFanRecord
+     * @return
+     */
+    int updateLiveSchedulFanRecord(SysLiveSchedulFanRecord sysLiveSchedulFanRecord);
+
+    /**
+     * 给对应直播删除进粉记录
+     * @param id
+     * @return
+     */
+    int delLiveSchedulFanRecord(Long id);
 }
\ No newline at end of file
diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysLiveSchedulServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysLiveSchedulServiceImpl.java
index 986f2c047..493068ece 100644
--- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysLiveSchedulServiceImpl.java
+++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysLiveSchedulServiceImpl.java
@@ -8,6 +8,8 @@ import java.util.List;
 import com.stdiet.common.core.domain.AjaxResult;
 import com.stdiet.common.utils.DateUtils;
 import com.stdiet.common.utils.SecurityUtils;
+import com.stdiet.custom.domain.SysLiveSchedulFanRecord;
+import com.stdiet.custom.mapper.SysLiveSchedulFanRecordMapper;
 import lombok.Data;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -27,6 +29,9 @@ public class SysLiveSchedulServiceImpl implements ISysLiveSchedulService
     @Autowired
     private SysLiveSchedulMapper sysLiveSchedulMapper;
 
+    @Autowired
+    private SysLiveSchedulFanRecordMapper sysLiveSchedulFanRecordMapper;
+
     /**
      * 查询直播排班
      *
@@ -186,4 +191,29 @@ public class SysLiveSchedulServiceImpl implements ISysLiveSchedulService
     public SysLiveSchedul getLiveSchedulByTime(SysLiveSchedul sysLiveSchedul){
         return sysLiveSchedulMapper.getLiveSchedulByTime(sysLiveSchedul);
     }
+
+    /**
+     * 给对应直播添加进粉记录
+     * @return
+     */
+    public int addLiveSchedulFanRecord(SysLiveSchedulFanRecord sysLiveSchedulFanRecord){
+        return sysLiveSchedulFanRecordMapper.insertSysLiveSchedulFanRecord(sysLiveSchedulFanRecord);
+    }
+
+    /**
+     * 给对应直播修改进粉记录
+     * @return
+     */
+    public int updateLiveSchedulFanRecord(SysLiveSchedulFanRecord sysLiveSchedulFanRecord){
+        return sysLiveSchedulFanRecordMapper.updateSysLiveSchedulFanRecord(sysLiveSchedulFanRecord);
+    }
+
+    /**
+     * 给对应直播删除进粉记录
+     * @param id
+     * @return
+     */
+    public int delLiveSchedulFanRecord(Long id){
+        return sysLiveSchedulFanRecordMapper.deleteSysLiveSchedulFanRecordById(id);
+    }
 }
\ No newline at end of file
diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysLiveSchedulFanRecordMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysLiveSchedulFanRecordMapper.xml
new file mode 100644
index 000000000..37d1a6fa2
--- /dev/null
+++ b/stdiet-custom/src/main/resources/mapper/custom/SysLiveSchedulFanRecordMapper.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.stdiet.custom.mapper.SysLiveSchedulFanRecordMapper">
+
+    <resultMap type="SysLiveSchedulFanRecord" id="SysLiveSchedulFanRecordResult">
+        <result property="id"    column="id"    />
+        <result property="liveSchedulId"    column="live_schedul_id"    />
+        <result property="saleWxAccountId"    column="sale_wx_account_id"    />
+        <result property="fanWxNumber"    column="fan_wx_number"    />
+        <result property="enterFanTime"    column="enter_fan_time"    />
+        <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"    />
+    </resultMap>
+
+    <sql id="selectSysLiveSchedulFanRecordVo">
+        select id, live_schedul_id, sale_wx_account_id, fan_wx_number, enter_fan_time, create_time, create_by, update_time, update_by, del_flag from sys_live_schedul_fan_record
+    </sql>
+
+    <select id="selectSysLiveSchedulFanRecordList" parameterType="SysLiveSchedulFanRecord" resultMap="SysLiveSchedulFanRecordResult">
+        <include refid="selectSysLiveSchedulFanRecordVo"/> where del_flag = 0
+    </select>
+
+    <select id="selectSysLiveSchedulFanRecordById" parameterType="Long" resultMap="SysLiveSchedulFanRecordResult">
+        <include refid="selectSysLiveSchedulFanRecordVo"/>
+        where id = #{id} and del_flag = 0
+    </select>
+
+    <insert id="insertSysLiveSchedulFanRecord" parameterType="SysLiveSchedulFanRecord" useGeneratedKeys="true" keyProperty="id">
+        insert into sys_live_schedul_fan_record
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="liveSchedulId != null">live_schedul_id,</if>
+            <if test="saleWxAccountId != null">sale_wx_account_id,</if>
+            <if test="fanWxNumber != null">fan_wx_number,</if>
+            <if test="enterFanTime != null">enter_fan_time,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="delFlag != null">del_flag,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="liveSchedulId != null">#{liveSchedulId},</if>
+            <if test="saleWxAccountId != null">#{saleWxAccountId},</if>
+            <if test="fanWxNumber != null">#{fanWxNumber},</if>
+            <if test="enterFanTime != null">#{enterFanTime},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="delFlag != null">#{delFlag},</if>
+        </trim>
+    </insert>
+
+    <update id="updateSysLiveSchedulFanRecord" parameterType="SysLiveSchedulFanRecord">
+        update sys_live_schedul_fan_record
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="liveSchedulId != null">live_schedul_id = #{liveSchedulId},</if>
+            <if test="saleWxAccountId != null">sale_wx_account_id = #{saleWxAccountId},</if>
+            <if test="fanWxNumber != null">fan_wx_number = #{fanWxNumber},</if>
+            <if test="enterFanTime != null">enter_fan_time = #{enterFanTime},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="delFlag != null">del_flag = #{delFlag},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <update id="deleteSysLiveSchedulFanRecordById" parameterType="Long">
+        update sys_live_schedul_fan_record set del_flag = 1  where id = #{id}
+    </update>
+
+    <update id="deleteSysLiveSchedulFanRecordByIds" parameterType="String">
+        update sys_live_schedul_fan_record set del_flag = 1 where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
+</mapper>
\ No newline at end of file
diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysLiveSchedulMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysLiveSchedulMapper.xml
index 3a0cf375d..ce9bf25a8 100644
--- a/stdiet-custom/src/main/resources/mapper/custom/SysLiveSchedulMapper.xml
+++ b/stdiet-custom/src/main/resources/mapper/custom/SysLiveSchedulMapper.xml
@@ -29,6 +29,8 @@
 
         <!-- 根据渠道查询对应微信号(微信账号分配表中) -->
         <association property="wxAccountList" column="id" select="getWxAccountListByLiveId"/>
+        <!-- 查询该场直播真实进粉情况 -->
+        <association property="addFanList" column="id" select="getAddFanRecordByLiveSchedulId"></association>
     </resultMap>
 
     <resultMap type="SysLiveSchedul" id="SysLiveSchedulResultSigle">
@@ -220,5 +222,16 @@
         and  #{liveStartTime} >= live_start_time order by live_start_time desc limit 1
     </select>
 
+    <!-- 根据直播记录ID查询对应进粉情况 -->
+    <select id="getAddFanRecordByLiveSchedulId" parameterType="Long" resultType="Map">
+        select
+        fr.id, fr.live_schedul_id liveSchedulId, fr.sale_wx_account_id saleWxAccountId, fr.fan_wx_number as fanWxNumber, DATE_FORMAT(fr.enter_fan_time,'%Y-%m-%d %H:%i') as enterFanTime,
+        w.wx_account as saleWxAccount, u.nick_name as saleName
+        from sys_live_schedul_fan_record as fr
+        left join sys_wx_sale_account as w on w.id = fr.sale_wx_account_id and w.del_flag = 0
+        left join sys_wx_distribution as swd on swd.wechat_account = w.id and swd.del_flag = 0
+        left join sys_user u on u.user_id = swd.user_id
+        where fr.del_flag = 0 and fr.live_schedul_id = #{id} order by fr.create_time desc
+    </select>
 
 </mapper>
\ No newline at end of file
diff --git a/stdiet-ui/src/api/custom/liveSchedul.js b/stdiet-ui/src/api/custom/liveSchedul.js
index 9a2a539e9..b10f3a442 100644
--- a/stdiet-ui/src/api/custom/liveSchedul.js
+++ b/stdiet-ui/src/api/custom/liveSchedul.js
@@ -89,5 +89,23 @@ export function getLiveSchedulByTime(data) {
   })
 }
 
+//添加、编辑进粉记录
+export function addOrEditSysLiveSchedulFanRecord(data){
+  return request({
+    url: '/custom/liveSchedul/addOrEditSysLiveSchedulFanRecord',
+    method: 'post',
+    data: data
+  })
+}
+
+//删除进粉记录
+export function delSysLiveSchedulFanRecord(query){
+  return request({
+    url: '/custom/liveSchedul/delSysLiveSchedulFanRecord',
+    method: 'get',
+    params: query
+  })
+}
+
 
 
diff --git a/stdiet-ui/src/api/custom/wxAccount.js b/stdiet-ui/src/api/custom/wxAccount.js
index 4320b65fa..6a8f4a35c 100644
--- a/stdiet-ui/src/api/custom/wxAccount.js
+++ b/stdiet-ui/src/api/custom/wxAccount.js
@@ -51,3 +51,12 @@ export function exportWxAccount(query) {
     params: query
   })
 }
+
+// 查询所有微信账号
+export function getAllWxAccount() {
+  return request({
+    url: '/custom/wxAccount/getAllWxAccount',
+    method: 'get'
+  })
+}
+
diff --git a/stdiet-ui/src/views/custom/liveSchedul/index.vue b/stdiet-ui/src/views/custom/liveSchedul/index.vue
index 303499622..9445c72bc 100644
--- a/stdiet-ui/src/views/custom/liveSchedul/index.vue
+++ b/stdiet-ui/src/views/custom/liveSchedul/index.vue
@@ -137,16 +137,18 @@
         </template>
       </el-table-column>
       <el-table-column label="直播营养师" align="center" prop="liveNutritionistName" />
-      <el-table-column label="直播运营" align="center" prop="liveOperatorName" />
-      <el-table-column label="直播策划" align="center" prop="livePlannerName" />
+      <!--<el-table-column label="直播运营" align="center" prop="liveOperatorName" />
+      <el-table-column label="直播策划" align="center" prop="livePlannerName" />-->
       <el-table-column label="所属账号" align="center" prop="fanChannelName" />
-      <el-table-column label="接粉微信号" align="center" prop="wxAccountList">
+      <el-table-column label="导粉情况" align="center" prop="wxAccountList">
         <template slot-scope="scope">
+          <span style="margin-right:10px">{{scope.row.wxAccountList.length}}</span>
           <el-popover
           placement="left"
           width="370"
           trigger="click">
-          <el-table :data="scope.row.wxAccountList" style="width:360;height: 300px;overflow: auto;">
+          
+          <el-table :data="scope.row.wxAccountList" height="300" style="width: 100%">
             <el-table-column width="80" property="saleName" label="销售"></el-table-column>
             <el-table-column width="180" property="wxAccount" label="微信号" align="center"></el-table-column>
             <el-table-column width="80" property="fanNum" label="导粉量" align="center"></el-table-column>
@@ -155,6 +157,55 @@
           </el-popover>
         </template>
       </el-table-column>
+      <el-table-column label="进粉情况" align="center" prop="addFanList">
+        <template slot-scope="scope">
+          <span style="margin-right:10px">{{scope.row.addFanList.length}}</span>
+          <el-popover
+          :title="scope.row.liveRoomName + '-'  + scope.row.fanChannelName + '-' + scope.row.liveNutritionistName + '-' + parseTime(scope.row.liveStartTime, '{h}:{i}') + '至' + parseTime(scope.row.liveEndTime, '{h}:{i}') + '直播进粉记录'"
+          placement="left"
+          width="680"
+          trigger="click">
+          <el-row :gutter="10" class="mb8">
+            <el-col :span="1.5">
+              <el-button
+                type="primary"
+                icon="el-icon-plus"
+                size="mini"
+                @click="addFanRecord(scope.row)"
+              >新增</el-button>
+              <span style="margin-left:5px;color:red">总数:{{scope.row.addFanList.length}}</span>
+            </el-col>
+          </el-row>
+          <el-table :data="scope.row.addFanList" height="250" style="width: 100%"><!-- 620;height: 300px;overflow: auto; -->
+            <el-table-column width="70" property="saleName" label="销售"></el-table-column>
+            <el-table-column width="140" property="saleWxAccount" label="销售微信号" align="center"></el-table-column>
+            <el-table-column width="140" property="fanWxNumber" label="客户微信号" align="center"></el-table-column>
+            <el-table-column width="140" property="enterFanTime" label="进粉时间" align="center"></el-table-column>
+            <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="140">
+                <template slot-scope="scope">
+                      <el-button
+                        style="margin-left:16px"
+                          size="normal"
+                          type="text"
+                          icon="el-icon-edit"
+                          @click="updateFanRecord(scope.row)"
+                      >修改</el-button>
+                      <el-popconfirm title="确定要删除吗?" @onConfirm="delFanRecord(scope.row)">
+                          <el-button
+                             slot="reference"
+                            size="normal"
+                            type="text"
+                            icon="el-icon-delete"
+                          >删除</el-button> 
+                      </el-popconfirm>
+                    
+                </template>
+            </el-table-column>
+          </el-table>
+          <el-button slot="reference">详情</el-button>
+          </el-popover>
+        </template>
+      </el-table-column>
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="300">
         <template slot-scope="scope"><!-- scope.row.statusTrueName,scope.row.statusFalseName -->
           <el-switch
@@ -344,12 +395,58 @@
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
+
+     <el-dialog :title="addEditFanRecordTitle" :visible.sync="addEditFanRecordOpen" width="600px" append-to-body :close-on-click-modal="false">
+        <el-form ref="addEditFanRecordForm" :model="addEditFanRecordForm" :rules="addEditFanRecordRules" label-width="120px">
+            <el-form-item label="销售微信号" prop="saleWxAccountId">
+            <el-select
+                v-model="addEditFanRecordForm.saleWxAccountId"
+                placeholder="请选择销售微信号"
+                clearable
+                filterable
+                size="small"
+                style="width:300px"
+              >
+              <el-option
+                v-for="dict in wxAccountList"
+                :key="dict.id"
+                :label="dict.wxAccount"
+                :value="parseInt(dict.id)"
+              />
+            </el-select>
+            </el-form-item>
+            <el-form-item label="粉丝微信号" prop="fanWxNumber">
+                <el-input
+                  v-model="addEditFanRecordForm.fanWxNumber"
+                  placeholder="请输入微信号"
+                  clearable
+                  size="small"
+                  maxlength="50"
+                  style="width:300px"
+                />
+            </el-form-item>
+            <el-form-item label="进粉时间" prop="enterFanTime">
+                <el-date-picker
+                v-model="addEditFanRecordForm.enterFanTime"
+                format="yyyy-MM-dd HH:mm"
+                value-format="yyyy-MM-dd HH:mm"
+                type="datetime"
+                style="width:300px"
+                placeholder="进粉时间">
+            </el-date-picker>
+          </el-form-item>
+        </el-form>
+        <div slot="footer" class="dialog-footer">
+          <el-button type="primary" @click="submitAddEditFanRecordForm">确 定</el-button>
+          <el-button @click="cancelAddEditFanRecordForm">取 消</el-button>
+        </div>
+    </el-dialog>
   </div>
 </template>
 
 <script>
-import { listLiveSchedul, getLiveSchedul, delLiveSchedul, addLiveSchedul, updateLiveSchedul, exportLiveSchedul,updateLiveStatus,copyLastTimeLiveSchedul } from "@/api/custom/liveSchedul";
-import { listWxAccount } from "@/api/custom/wxAccount";
+import { listLiveSchedul, getLiveSchedul, delLiveSchedul, addLiveSchedul, updateLiveSchedul, exportLiveSchedul,updateLiveStatus,copyLastTimeLiveSchedul,addOrEditSysLiveSchedulFanRecord,delSysLiveSchedulFanRecord } from "@/api/custom/liveSchedul";
+import { getAllWxAccount } from "@/api/custom/wxAccount";
 import AutoHideInfo from "@/components/AutoHideInfo";
 import dayjs from "dayjs";
 const nowDate = dayjs().format("YYYY-MM-DD");
@@ -414,7 +511,19 @@ export default {
       //接粉渠道
       fanChanneloptions: [],
       //所有微信号
-      wxAccountList:[]
+      wxAccountList:[],
+
+      addEditFanRecordTitle: "",
+      addEditFanRecordOpen: false,
+      addEditFanRecordForm: {},
+      addEditFanRecordRules: {
+        saleWxAccountId: [{ required: true, trigger: "blur", message: "请选择销售微信号" }],
+        fanWxNumber:[{ required: true, trigger: "blur", message: "请填写粉丝微信号" }],
+        enterFanTime:[{ required: true, trigger: "blur", message: "请选择进粉时间" }],
+      },
+      //记录当前添加或编辑进粉记录对应直播记录的ID
+      addOrEditSchedulId: null,
+
     };
   },
   components:{
@@ -454,16 +563,18 @@ export default {
                 item.status = (item.liveStatus == 0 || item.liveStatus == 2) ? false : true; 
                 item.statusFalseName = item.liveStatus == 0 ? '未开播' : '已下播';
                 item.statusTrueName = '已开播';
+                item.addFanVisible = this.addOrEditSchedulId == item.id;  
             });
         }
         this.total = response.total;
         this.loading = false;
+        this.addOrEditSchedulId = null;
       });
     },
     //获取所有微信号
     getListWxAccount() {
-      listWxAccount(this.queryParams).then((response) => {
-        this.wxAccountList = response.rows;
+      getAllWxAccount().then((response) => {
+        this.wxAccountList = response.data;
       });
     },
     // 取消按钮
@@ -620,6 +731,79 @@ export default {
           }
       });
       
+    },
+    addEditFanRecordFormRest(){
+        this.addEditFanRecordForm = {
+          id: null,
+          liveSchedulId: null,
+          saleWxAccountId: null,
+          fanWxNumber: null,
+          enterFanTime: nowTime
+        },
+        this.addOrEditSchedulId = null;
+    }, 
+    addFanRecord(item){
+        this.addEditFanRecordFormRest();
+        this.addEditFanRecordForm.liveSchedulId = item.id;
+        this.addEditFanRecordTitle = item.liveRoomName + "-" + item.fanChannelName + "-" + item.liveNutritionistName + "-" + this.parseTime(item.liveStartTime, '{h}:{i}') +"至" + this.parseTime(item.liveEndTime, '{h}:{i}') + "直播-添加进粉记录";
+        this.addEditFanRecordOpen = true;
+    },
+    updateFanRecord(item){
+        this.addEditFanRecordFormRest();
+        if(item.id == null){
+            return;
+        }
+        this.addEditFanRecordForm = {
+          id: item.id,
+          liveSchedulId: item.liveSchedulId,
+          saleWxAccountId: item.saleWxAccountId,
+          fanWxNumber: item.fanWxNumber,
+          enterFanTime: item.enterFanTime
+        };
+        let liveSchedul = this.getLiveSchedulById(item.liveSchedulId);
+        this.addEditFanRecordTitle = liveSchedul.liveRoomName + "-" + liveSchedul.fanChannelName + "-" + liveSchedul.liveNutritionistName + "-" + this.parseTime(liveSchedul.liveStartTime, '{h}:{i}') +"至" + this.parseTime(liveSchedul.liveEndTime, '{h}:{i}') + "直播-编辑进粉记录";
+        this.addEditFanRecordOpen = true;
+    },
+    delFanRecord(item){
+        if(item == null || item.id == null){
+          return;
+        }
+        delSysLiveSchedulFanRecord({'id': item.id}).then((reponse) => {
+            if(reponse.code == 200){
+              this.msgSuccess("删除成功");
+              this.addEditFanRecordOpen = false;
+               this.getList();
+            }else{
+              this.msgSuccess("删除失败");
+            }
+        });
+    },
+    submitAddEditFanRecordForm(){
+         this.$refs["addEditFanRecordForm"].validate(valid => {
+            if (valid) {
+                  addOrEditSysLiveSchedulFanRecord(this.addEditFanRecordForm).then((response) => {
+                      if(response.code == 200){
+                            this.msgSuccess(this.addEditFanRecordForm.id == null ? "添加成功" : "编辑成功");
+                            this.addEditFanRecordOpen = false;
+                            this.addOrEditSchedulId = this.addEditFanRecordForm.liveSchedulId;
+                            this.getList();
+                      }else{
+                         this.msgError(this.addEditFanRecordForm.id == null ? "添加失败" : "编辑失败");
+                      }
+
+                  });
+            }else{
+              this.msgError("数据未填写完整");
+            }
+         });
+    },
+    cancelAddEditFanRecordForm(){
+        this.addEditFanRecordOpen = false;
+    },
+    getLiveSchedulById(id){
+      if(this.liveSchedulList != null && this.liveSchedulList.length > 0 && id != null){
+         return this.liveSchedulList.find((opt) => opt.id === id);
+      }
     }
   }
 };