!205 完善客户档案

Merge pull request !205 from 德仔/develop
This commit is contained in:
德仔 2021-04-15 15:35:57 +08:00 committed by Gitee
commit 7ae95e8d96
5 changed files with 77 additions and 15 deletions

View File

@ -5,6 +5,7 @@ import com.stdiet.common.core.controller.BaseController;
import com.stdiet.common.core.domain.AjaxResult; import com.stdiet.common.core.domain.AjaxResult;
import com.stdiet.common.core.page.TableDataInfo; import com.stdiet.common.core.page.TableDataInfo;
import com.stdiet.common.enums.BusinessType; import com.stdiet.common.enums.BusinessType;
import com.stdiet.common.utils.SecurityUtils;
import com.stdiet.common.utils.StringUtils; import com.stdiet.common.utils.StringUtils;
import com.stdiet.common.utils.poi.ExcelUtil; import com.stdiet.common.utils.poi.ExcelUtil;
import com.stdiet.common.utils.sign.AesUtils; import com.stdiet.common.utils.sign.AesUtils;
@ -14,6 +15,7 @@ import com.stdiet.custom.service.ISysCustomerHealthyService;
import com.stdiet.custom.service.ISysCustomerPhysicalSignsService; import com.stdiet.custom.service.ISysCustomerPhysicalSignsService;
import com.stdiet.custom.service.ISysCustomerService; import com.stdiet.custom.service.ISysCustomerService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.SecurityConfig;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -44,6 +46,10 @@ public class SysCustomerController extends BaseController {
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysCustomer sysCustomer) { public TableDataInfo list(SysCustomer sysCustomer) {
startPage(); startPage();
String remark = SecurityUtils.getLoginUser().getUser().getRemark();
if (StringUtils.isNotEmpty(remark) && remark.contains("|") && sysCustomer.getChannelId() == null) {
sysCustomer.setChannels(remark.split("\\|"));
}
List<SysCustomer> list = sysCustomerService.selectSysCustomerList(sysCustomer); List<SysCustomer> list = sysCustomerService.selectSysCustomerList(sysCustomer);
if (list != null && list.size() > 0) { if (list != null && list.size() > 0) {
for (SysCustomer sysCus : list) { for (SysCustomer sysCus : list) {

View File

@ -97,4 +97,9 @@ public class SysCustomer extends BaseEntity
/** 体征数据,非持久化字段 */ /** 体征数据,非持久化字段 */
private SysCustomerPhysicalSigns sign; private SysCustomerPhysicalSigns sign;
@Excel(name = "进粉渠道")
private Long channelId;
private String[] channels;
} }

View File

@ -26,10 +26,11 @@
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="channelId" column="channel_id" />
</resultMap> </resultMap>
<sql id="selectSysCustomerVo"> <sql id="selectSysCustomerVo">
select id, name, phone, email, fans_time, fans_channel, address, pay_date, start_date, purchase_num, pay_total, main_dietitian, assistant_dietitian, after_dietitian, salesman, charge_person, follow_status, create_time, create_by, update_time, update_by from sys_customer select id, name, phone, email, fans_time, fans_channel, address, pay_date, start_date, purchase_num, pay_total, main_dietitian, assistant_dietitian, after_dietitian, salesman, charge_person, follow_status, create_time, create_by, update_time, update_by, channel_id from sys_customer
</sql> </sql>
<select id="selectSysCustomerList" parameterType="SysCustomer" resultMap="SysCustomerResult"> <select id="selectSysCustomerList" parameterType="SysCustomer" resultMap="SysCustomerResult">
@ -45,6 +46,13 @@
<if test="assistantDietitian != null and assistantDietitian != ''"> and assistant_dietitian = #{assistantDietitian}</if> <if test="assistantDietitian != null and assistantDietitian != ''"> and assistant_dietitian = #{assistantDietitian}</if>
<if test="assistantDietitian == 0"> and (isnull(assistant_dietitian) or assistant_dietitian=0)</if> <if test="assistantDietitian == 0"> and (isnull(assistant_dietitian) or assistant_dietitian=0)</if>
<if test="fansChannel != null "> and fans_channel = #{fansChannel}</if> <if test="fansChannel != null "> and fans_channel = #{fansChannel}</if>
<if test="channelId != null "> and channel_id = #{channelId}</if>
<if test="channels != null">
and channel_id in
<foreach collection="channels" item="cn" separator="," open="(" close=")">
#{cn}
</foreach>
</if>
order by create_time desc order by create_time desc
</select> </select>
@ -76,6 +84,7 @@
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if> <if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if> <if test="updateBy != null">update_by,</if>
<if test="channelId != null">channel_id,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if> <if test="name != null">#{name},</if>
@ -98,6 +107,7 @@
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if> <if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if> <if test="updateBy != null">#{updateBy},</if>
<if test="channelId != null">#{channelId},</if>
</trim> </trim>
</insert> </insert>
@ -124,6 +134,7 @@
<if test="createBy != null">create_by = #{createBy},</if> <if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if> <if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateBy != null">update_by = #{updateBy},</if>
<if test="channelId != null">channel_id = #{channelId},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>

View File

@ -212,6 +212,7 @@ export default {
this.$refs.cusCreateOrderDialogRef.showDialog( this.$refs.cusCreateOrderDialogRef.showDialog(
{ {
customer: this.data.name, customer: this.data.name,
accountId: this.data.channelId,
cusId: this.data.id, cusId: this.data.id,
preSaleId: this.data.salesman, preSaleId: this.data.salesman,
afterSaleId: this.data.afterDietitian, afterSaleId: this.data.afterDietitian,

View File

@ -16,8 +16,7 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<!-- <el-form-item label="进粉方式" prop="fansChannel">
<el-form-item label="进粉渠道" prop="fansChannel">
<el-select v-model="queryParams.fansChannel" placeholder="请选择"> <el-select v-model="queryParams.fansChannel" placeholder="请选择">
<el-option <el-option
v-for="dict in fansChannelOptions" v-for="dict in fansChannelOptions"
@ -26,6 +25,16 @@
:value="parseInt(dict.dictValue)" :value="parseInt(dict.dictValue)"
/> />
</el-select> </el-select>
</el-form-item> -->
<el-form-item label="进粉渠道" prop="channelId">
<el-select v-model="queryParams.channelId" placeholder="请选择">
<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>
<el-form-item label="营养师" prop="mainDietitian"> <el-form-item label="营养师" prop="mainDietitian">
<el-select v-model="queryParams.mainDietitian" placeholder="请选择"> <el-select v-model="queryParams.mainDietitian" placeholder="请选择">
@ -132,13 +141,18 @@
<span>{{ parseTime(scope.row.fansTime, "{y}-{m}-{d}") }}</span> <span>{{ parseTime(scope.row.fansTime, "{y}-{m}-{d}") }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <!-- <el-table-column
label="进粉渠道" label="进粉方式"
align="center" align="center"
prop="fansChannel" prop="fansChannel"
:formatter="fansChannelFormat" :formatter="fansChannelFormat"
> /> -->
</el-table-column> <el-table-column
label="进粉渠道"
align="center"
prop="channelId"
:formatter="channelFormat"
/>
<el-table-column label="客户姓名" align="center" prop="name" /> <el-table-column label="客户姓名" align="center" prop="name" />
<el-table-column label="手机号" align="center" prop="phone" /> <el-table-column label="手机号" align="center" prop="phone" />
<el-table-column <el-table-column
@ -250,7 +264,6 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="操作" label="操作"
align="center" align="center"
@ -363,10 +376,10 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="进粉渠道" prop="fansChannel"> <el-form-item label="进粉渠道" prop="channelId">
<el-select v-model="form.fansChannel" placeholder="请选择"> <el-select v-model="form.channelId" placeholder="请选择">
<el-option <el-option
v-for="dict in fansChannelOptions" v-for="dict in accountIdOptions"
:key="dict.dictValue" :key="dict.dictValue"
:label="dict.dictLabel" :label="dict.dictLabel"
:value="parseInt(dict.dictValue)" :value="parseInt(dict.dictValue)"
@ -393,7 +406,9 @@
<!-- 食谱计划抽屉 --> <!-- 食谱计划抽屉 -->
<RecipesPlanDrawer ref="recipesPlanDrawerRef" /> <RecipesPlanDrawer ref="recipesPlanDrawerRef" />
<!-- 客户打卡记录 --> <!-- 客户打卡记录 -->
<CustomerPunchLogDrawer ref="customerPunchLogDrawerRef"></CustomerPunchLogDrawer> <CustomerPunchLogDrawer
ref="customerPunchLogDrawerRef"
></CustomerPunchLogDrawer>
</div> </div>
</template> </template>
@ -424,7 +439,7 @@ export default {
"contract-drawer": ContractDrawer, "contract-drawer": ContractDrawer,
heatStatisticsDrawer: HeatStatisticsDrawer, heatStatisticsDrawer: HeatStatisticsDrawer,
RecipesPlanDrawer, RecipesPlanDrawer,
CustomerPunchLogDrawer CustomerPunchLogDrawer,
}, },
data() { data() {
const userId = store.getters && store.getters.userId; const userId = store.getters && store.getters.userId;
@ -446,6 +461,8 @@ export default {
customerCenterList: [], customerCenterList: [],
// //
fansChannelOptions: [], fansChannelOptions: [],
//
accountIdOptions: [],
// //
title: "", title: "",
// //
@ -493,6 +510,9 @@ export default {
fansTime: [ fansTime: [
{ required: true, message: "进粉时间不能为空", trigger: "blur" }, { required: true, message: "进粉时间不能为空", trigger: "blur" },
], ],
channelId: [
{ required: true, message: "进粉渠道不能为空", trigger: "blur" },
],
}, },
fanPickerOptions: { fanPickerOptions: {
disabledDate(time) { disabledDate(time) {
@ -505,6 +525,20 @@ export default {
this.getDicts("customer_fans_channel").then((response) => { this.getDicts("customer_fans_channel").then((response) => {
this.fansChannelOptions = response.data; this.fansChannelOptions = response.data;
}); });
this.getDicts("cus_account").then((response) => {
if (this.userRemark && this.userRemark.includes("|")) {
const accRange = this.userRemark.split("|");
this.accountIdOptions = accRange.reduce((arr, accId) => {
const tarObj = response.data.find((obj) => obj.dictValue === accId);
if (tarObj) {
arr.push(tarObj);
}
return arr;
}, []);
} else {
this.accountIdOptions = response.data;
}
});
this.getList(); this.getList();
}, },
computed: { computed: {
@ -517,6 +551,8 @@ export default {
"nutritionistIdOptions", "nutritionistIdOptions",
// //
"nutriAssisIdOptions", "nutriAssisIdOptions",
//
"userRemark",
]), ]),
}, },
methods: { methods: {
@ -554,6 +590,9 @@ export default {
fansChannelFormat(row, column) { fansChannelFormat(row, column) {
return this.selectDictLabel(this.fansChannelOptions, row.fansChannel); return this.selectDictLabel(this.fansChannelOptions, row.fansChannel);
}, },
channelFormat(row, column) {
return this.selectDictLabel(this.accountIdOptions, row.channelId);
},
handleOnOrderClick(row) { handleOnOrderClick(row) {
this.$refs["cusOrderDrawerRef"].showDrawer(row); this.$refs["cusOrderDrawerRef"].showDrawer(row);
}, },