完善客户档案

This commit is contained in:
huangdeliang 2021-04-15 15:34:40 +08:00
parent 5fe3c85e1d
commit fe7c44d173
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.page.TableDataInfo;
import com.stdiet.common.enums.BusinessType;
import com.stdiet.common.utils.SecurityUtils;
import com.stdiet.common.utils.StringUtils;
import com.stdiet.common.utils.poi.ExcelUtil;
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.ISysCustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.SecurityConfig;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
@ -44,6 +46,10 @@ public class SysCustomerController extends BaseController {
@GetMapping("/list")
public TableDataInfo list(SysCustomer sysCustomer) {
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);
if (list != null && list.size() > 0) {
for (SysCustomer sysCus : list) {

View File

@ -97,4 +97,9 @@ public class SysCustomer extends BaseEntity
/** 体征数据,非持久化字段 */
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="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="channelId" column="channel_id" />
</resultMap>
<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>
<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 == 0"> and (isnull(assistant_dietitian) or assistant_dietitian=0)</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
</select>
@ -76,6 +84,7 @@
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="channelId != null">channel_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
@ -98,6 +107,7 @@
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="channelId != null">#{channelId},</if>
</trim>
</insert>
@ -124,6 +134,7 @@
<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="channelId != null">channel_id = #{channelId},</if>
</trim>
where id = #{id}
</update>

View File

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

View File

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