!277 调整界面

Merge pull request !277 from 德仔/develop
This commit is contained in:
德仔 2021-06-05 15:08:37 +08:00 committed by Gitee
commit 486f2d4f86
6 changed files with 173 additions and 111 deletions

View File

@ -85,6 +85,11 @@ public class SysServicesTopic {
String toName; String toName;
String name; String name;
String avatar;
String fromAvatar;
String toAvatar;
List<SysServicesTopic> comments; List<SysServicesTopic> comments;
List<SysServicesTopic> replys; List<SysServicesTopic> replys;

View File

@ -25,7 +25,7 @@
SELECT * FROM ( SELECT * FROM (
SELECT topic_id, id, `read`, create_time, update_time, 'customer' AS role FROM sys_services_topic_status WHERE role = #{role} AND uid = #{uid} SELECT topic_id, id, `read`, create_time, update_time, 'customer' AS role FROM sys_services_topic_status WHERE role = #{role} AND uid = #{uid}
) AS status ) AS status
LEFT JOIN sys_services_topic USING(topic_id) LEFT JOIN sys_services_topic USING(topic_id) WHERE del_flag = 0
ORDER BY `read` ASC, update_time DESC ORDER BY `read` ASC, update_time DESC
</select> </select>
@ -39,6 +39,7 @@
<result column="img" property="img" typeHandler="com.stdiet.custom.typehandler.ArrayJsonHandler"/> <result column="img" property="img" typeHandler="com.stdiet.custom.typehandler.ArrayJsonHandler"/>
<result column="create_time" property="createTime"/> <result column="create_time" property="createTime"/>
<association property="name" column="{uid=uid,role=role}" select="selectUserInfo"/> <association property="name" column="{uid=uid,role=role}" select="selectUserInfo"/>
<association property="avatar" column="{uid=uid,role=role}" select="selectUserAvatar"/>
<association property="comments" column="topic_id" select="selectServicesTopicCommentByTopicId"/> <association property="comments" column="topic_id" select="selectServicesTopicCommentByTopicId"/>
</resultMap> </resultMap>
@ -53,7 +54,9 @@
<result column="img" property="img" typeHandler="com.stdiet.custom.typehandler.ArrayJsonHandler"/> <result column="img" property="img" typeHandler="com.stdiet.custom.typehandler.ArrayJsonHandler"/>
<result column="create_time" property="createTime"/> <result column="create_time" property="createTime"/>
<association property="fromName" column="{uid=from_uid,role=from_role}" select="selectUserInfo"/> <association property="fromName" column="{uid=from_uid,role=from_role}" select="selectUserInfo"/>
<association property="fromAvatar" column="{uid=from_uid,role=from_role}" select="selectUserAvatar"/>
<association property="toName" column="{uid=to_uid,role=to_role}" select="selectUserInfo"/> <association property="toName" column="{uid=to_uid,role=to_role}" select="selectUserInfo"/>
<!-- <association property="toAvatar" column="{uid=to_uid,role=to_role}" select="selectUserAvatar"/>-->
<association property="replys" column="id" <association property="replys" column="id"
select="selectServicesTopicCommentReplyByCommentId"/> select="selectServicesTopicCommentReplyByCommentId"/>
</resultMap> </resultMap>
@ -71,7 +74,9 @@
<result column="img" property="img" typeHandler="com.stdiet.custom.typehandler.ArrayJsonHandler"/> <result column="img" property="img" typeHandler="com.stdiet.custom.typehandler.ArrayJsonHandler"/>
<result column="create_time" property="createTime"/> <result column="create_time" property="createTime"/>
<association property="fromName" column="{uid=from_uid,role=from_role}" select="selectUserInfo"/> <association property="fromName" column="{uid=from_uid,role=from_role}" select="selectUserInfo"/>
<association property="fromAvatar" column="{uid=from_uid,role=from_role}" select="selectUserAvatar"/>
<association property="toName" column="{uid=to_uid,role=to_role}" select="selectUserInfo"/> <association property="toName" column="{uid=to_uid,role=to_role}" select="selectUserInfo"/>
<!-- <association property="toAvatar" column="{uid=to_uid,role=to_role}" select="selectUserAvatar"/>-->
</resultMap> </resultMap>
@ -103,6 +108,18 @@
</choose> </choose>
</select> </select>
<!-- 查询头像-->
<select id="selectUserAvatar" parameterType="java.util.Map" resultType="String">
<choose>
<when test="_parameter.get('role') == 'customer'">
select avatar_url from sys_wx_user_info where cus_id = #{uid}
</when>
<otherwise>
select IF(avatar != '', CONCAT("https://api.stdiet.top/prod-api", avatar), '') as avatar from sys_user where user_id = #{uid}
</otherwise>
</choose>
</select>
<!-- 插入问题--> <!-- 插入问题-->
<insert id="insertSysServicesTopic" parameterType="SysServicesTopic" useGeneratedKeys="true" <insert id="insertSysServicesTopic" parameterType="SysServicesTopic" useGeneratedKeys="true"
keyProperty="id" keyColumn="id"> keyProperty="id" keyColumn="id">

View File

@ -75,7 +75,7 @@ const actions = {
commit("save", { selTopicId: topicId }); commit("save", { selTopicId: topicId });
// 客户信息 // 客户信息
if (healthyData.customerId !== parseInt(uid)) { if (healthyData.customerId !== parseInt(uid)) {
dispatch("getHealthyData", { cusId: uid }); dispatch("getHealthyData", { cusId: uid, callback: payload.callback });
} }
// //
const result = await fetchTopicDetail({ topicId, id }); const result = await fetchTopicDetail({ topicId, id });
@ -116,22 +116,26 @@ const actions = {
const healthyDataResult = await getCustomerPhysicalSignsByCusId( const healthyDataResult = await getCustomerPhysicalSignsByCusId(
payload.cusId payload.cusId
); );
let healthyData = undefined, const newState = {};
healthyDataType = 0;
if (healthyDataResult.code === 200) { if (healthyDataResult.code === 200) {
if (!healthyDataResult.data.customerHealthy) { if (!healthyDataResult.data.customerHealthy) {
throw new Error("客户还没填写健康评估表"); // throw new Error("客户还没填写健康评估表");
payload.callback && payload.callback("客户还没填写健康评估表");
} else {
newState.healthyDataType = healthyDataResult.data.type;
newState.healthyData = dealHealthy(
healthyDataResult.data.customerHealthy
);
newState.avoidFoodIds = (newState.healthyData.avoidFood || []).map(
obj => obj.id
);
} }
healthyDataType = healthyDataResult.data.type;
healthyData = dealHealthy(healthyDataResult.data.customerHealthy);
} else { } else {
throw new Error(healthyDataResult.msg); throw new Error(healthyDataResult.msg);
} }
commit("save", { commit("save", {
healthDataLoading: false, healthDataLoading: false,
healthyDataType, ...newState
healthyData,
avoidFoodIds: (healthyData.avoidFood || []).map(obj => obj.id)
}); });
} }
}; };

View File

@ -27,7 +27,12 @@
</el-select> </el-select>
</el-form-item> --> </el-form-item> -->
<el-form-item label="进粉渠道" prop="channelId"> <el-form-item label="进粉渠道" prop="channelId">
<el-select v-model="queryParams.channelId" filterable clearable placeholder="请选择"> <el-select
v-model="queryParams.channelId"
filterable
clearable
placeholder="请选择"
>
<el-option <el-option
v-for="dict in accountIdOptions" v-for="dict in accountIdOptions"
:key="dict.dictValue" :key="dict.dictValue"
@ -84,24 +89,24 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="病史体征" prop="physicalSignsId"> <el-form-item label="病史体征" prop="physicalSignsId">
<el-select <el-select
v-model="queryParams.physicalSignsId" v-model="queryParams.physicalSignsId"
filterable filterable
clearable clearable
allow-create allow-create
default-first-option default-first-option
placeholder="请选择病史体征" placeholder="请选择病史体征"
>
<el-option
v-for="physicalSign in physicalSignsList"
:key="physicalSign.id"
:label="physicalSign.name"
:value="physicalSign.id"
> >
<el-option </el-option>
v-for="physicalSign in physicalSignsList" </el-select>
:key="physicalSign.id" </el-form-item>
:label="physicalSign.name"
:value="physicalSign.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="cyan" icon="el-icon-search" @click="handleQuery" <el-button type="cyan" icon="el-icon-search" @click="handleQuery"
@ -330,8 +335,18 @@
<el-row :gutter="15"> <el-row :gutter="15">
<el-form ref="form" :model="form" :rules="rules" label-width="100px"> <el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="进粉渠道" prop="channelId" style="width:400px"> <el-form-item
<el-select v-model="form.channelId" placeholder="请选择" filterable clearable @change="channelAutoSelectNutritionist"> label="进粉渠道"
prop="channelId"
style="width: 400px"
>
<el-select
v-model="form.channelId"
placeholder="请选择"
filterable
clearable
@change="channelAutoSelectNutritionist"
>
<el-option <el-option
v-for="dict in accountIdOptions" v-for="dict in accountIdOptions"
:key="dict.dictValue" :key="dict.dictValue"
@ -356,12 +371,12 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="客户名字" prop="name" style="width:300px"> <el-form-item label="客户名字" prop="name" style="width: 300px">
<el-input v-model.trim="form.name" placeholder="请输入名字" /> <el-input v-model.trim="form.name" placeholder="请输入名字" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="手机号" prop="phone" style="width:300px"> <el-form-item label="手机号" prop="phone" style="width: 300px">
<el-input v-model.trim="form.phone" placeholder="请输入手机号" /> <el-input v-model.trim="form.phone" placeholder="请输入手机号" />
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -413,8 +428,6 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-form> </el-form>
</el-row> </el-row>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@ -508,7 +521,7 @@ export default {
assistantDietitian: null, assistantDietitian: null,
afterDietitian: null, afterDietitian: null,
salesman: null, salesman: null,
physicalSignsId: null physicalSignsId: null,
}, },
// //
form: {}, form: {},
@ -551,7 +564,7 @@ export default {
}, },
}, },
// //
physicalSignsList:[] physicalSignsList: [],
}; };
}, },
created() { created() {
@ -573,8 +586,8 @@ export default {
} }
}); });
this.getList(); this.getList();
listPhysicalSigns().then(response => { listPhysicalSigns().then((response) => {
this.physicalSignsList = response.rows; this.physicalSignsList = response.rows;
}); });
}, },
computed: { computed: {
@ -789,52 +802,68 @@ export default {
}) })
.catch(function () {}); .catch(function () {});
}, },
channelAutoSelectNutritionist(channelValue){ channelAutoSelectNutritionist(channelValue) {
this.form.fansChannel = channelValue == "" ? null : channelValue; this.form.fansChannel = channelValue == "" ? null : channelValue;
if(channelValue == undefined || channelValue == null || channelValue == ""){ if (
this.form.mainDietitian = null; channelValue == undefined ||
return; channelValue == null ||
} channelValue == ""
if(this.form.fansTime == undefined || this.form.fansTime == null){ ) {
this.form.mainDietitian = null; this.form.mainDietitian = null;
return; return;
} }
this.autoSelectNutritionist(); if (this.form.fansTime == undefined || this.form.fansTime == null) {
this.form.mainDietitian = null;
return;
}
this.autoSelectNutritionist();
}, },
fanTimeAutoSelectNutritionist(fansTime){ fanTimeAutoSelectNutritionist(fansTime) {
this.form.fansTime = fansTime; this.form.fansTime = fansTime;
if(fansTime == undefined || fansTime == null){ if (fansTime == undefined || fansTime == null) {
this.form.mainDietitian = null; this.form.mainDietitian = null;
return; return;
} }
if(this.form.fansChannel == undefined || this.form.fansChannel == null || this.form.fansChannel == ""){ if (
this.form.mainDietitian = null; this.form.fansChannel == undefined ||
return; this.form.fansChannel == null ||
} this.form.fansChannel == ""
this.autoSelectNutritionist(); ) {
this.form.mainDietitian = null;
return;
}
this.autoSelectNutritionist();
}, },
autoSelectNutritionist(){ autoSelectNutritionist() {
getLiveSchedulByTime({'fanChannel':this.form.fansChannel,'liveStartTimeString':encodeURIComponent(this.form.fansTime)}).then((response) => { getLiveSchedulByTime({
if (response.code === 200) { fanChannel: this.form.fansChannel,
let live = response.data; liveStartTimeString: encodeURIComponent(this.form.fansTime),
if(live != undefined && live != null && live.liveNutritionistId != null && this.nutritionistIdOptions != null){ }).then((response) => {
let mainDietitian = null; if (response.code === 200) {
this.nutritionistIdOptions.forEach((item,index) => { let live = response.data;
if(live.liveNutritionistId == item.dictValue){ if (
mainDietitian = live.liveNutritionistId; live != undefined &&
} live != null &&
if(index == this.nutritionistIdOptions.length - 1){ live.liveNutritionistId != null &&
this.form.mainDietitian = mainDietitian; this.nutritionistIdOptions != null
} ) {
}); let mainDietitian = null;
}else{ this.nutritionistIdOptions.forEach((item, index) => {
this.form.mainDietitian = null; if (live.liveNutritionistId == item.dictValue) {
} mainDietitian = live.liveNutritionistId;
}else{
this.form.mainDietitian = null;
} }
}); if (index == this.nutritionistIdOptions.length - 1) {
} this.form.mainDietitian = mainDietitian;
}
});
} else {
this.form.mainDietitian = null;
}
} else {
this.form.mainDietitian = null;
}
});
},
}, },
}; };
</script> </script>

View File

@ -1,7 +1,9 @@
<template> <template>
<div class="topic_comment_item"> <div class="topic_comment_item" @click="handOnClick(data)">
<div class="comment_avatar"> <div class="comment_avatar">
<el-avatar size="medium">{{ data.fromName.substr(-1) }}</el-avatar> <el-avatar size="medium" :src="data.fromAvatar || ''">{{
data.fromName.substr(-1)
}}</el-avatar>
</div> </div>
<div class="comment_content"> <div class="comment_content">
<div class="content_title"> <div class="content_title">
@ -10,11 +12,7 @@
<div class="content_type">{{ data.content }}</div> <div class="content_type">{{ data.content }}</div>
<div class="content_time"> <div class="content_time">
{{ formatDate(data.createTime) }} {{ formatDate(data.createTime) }}
<div <div v-if="data.fromUid !== userId.toString()" class="reply_btn">
v-if="data.fromUid !== userId.toString()"
class="reply_btn"
@click="handOnClick(data)"
>
回复 回复
</div> </div>
</div> </div>
@ -30,7 +28,7 @@ export default {
return { return {
roleDict: { roleDict: {
customer: "客户", customer: "客户",
dietician: "主营养师", dietician: "主营养师",
after_sale: "售后营养师", after_sale: "售后营养师",
dietician_assistant: "营养师助理", dietician_assistant: "营养师助理",
}, },
@ -61,6 +59,7 @@ export default {
.topic_comment_item { .topic_comment_item {
margin: 12px; margin: 12px;
display: flex; display: flex;
cursor: pointer;
.comment_avatar { .comment_avatar {
flex: 0 0 36px; flex: 0 0 36px;
@ -87,7 +86,7 @@ export default {
.reply_btn { .reply_btn {
margin-left: 16px; margin-left: 16px;
color: #1890ff; color: #1890ff;
cursor: pointer; // cursor: pointer;
} }
} }
} }

View File

@ -31,12 +31,19 @@
</div> </div>
<div class="topic_detail"> <div class="topic_detail">
<div class="topic_detail_list"> <div class="topic_detail_list">
<div class="topic_detail_title" v-if="!!detailData.content"> <div
<div>{{ detailData.content }}</div> class="topic_detail_title"
<div class="content_time" :style="{ marginTop: '4px' }"> v-if="!!detailData.content"
{{ formatDate(detailData.createTime) }} @click="handleOnReplyTopic(detailData)"
<div class="reply_btn" @click="handleOnReplyTopic(detailData)"> >
回复 <el-avatar :src="detailData.avatar">{{
detailData.name.substr(-1)
}}</el-avatar>
<div :style="{ marginLeft: '8px' }">
<div>{{ detailData.content }}</div>
<div class="content_time" :style="{ marginTop: '4px' }">
{{ formatDate(detailData.createTime) }}
<div class="reply_btn">回复</div>
</div> </div>
</div> </div>
</div> </div>
@ -83,12 +90,8 @@ import { createNamespacedHelpers, mapActions as globalMapActions } from "vuex";
import Comment from "./Comment"; import Comment from "./Comment";
import dayjs from "dayjs"; import dayjs from "dayjs";
import { keys } from "@/utils/websocket"; import { keys } from "@/utils/websocket";
const { const { mapActions, mapState, mapMutations, mapGetters } =
mapActions, createNamespacedHelpers("message");
mapState,
mapMutations,
mapGetters,
} = createNamespacedHelpers("message");
export default { export default {
data() { data() {
return { return {
@ -179,14 +182,17 @@ export default {
return dayjs(date).format("MM-DD HH:mm"); return dayjs(date).format("MM-DD HH:mm");
}, },
handleOnTopicClick(data) { handleOnTopicClick(data) {
this.replyTarget = ""; if (data.topicId !== this.selTopicId) {
this.replyContent = ""; this.replyTarget = "";
this.replyObj = {}; this.replyContent = "";
this.fetchTopicDetailActions({ this.replyObj = {};
topicId: data.topicId, this.fetchTopicDetailActions({
id: data.id, topicId: data.topicId,
uid: data.uid, id: data.id,
}); uid: data.uid,
callback: (err) => this.$message.error(err),
});
}
}, },
handleOnReplyTopic(data) { handleOnReplyTopic(data) {
this.replyTarget = "主题"; this.replyTarget = "主题";
@ -340,11 +346,13 @@ export default {
.reply_btn { .reply_btn {
margin-left: 16px; margin-left: 16px;
color: #1890ff; color: #1890ff;
cursor: pointer; // cursor: pointer;
} }
} }
.topic_detail_title { .topic_detail_title {
display: flex;
cursor: pointer;
} }
.comment_reply_item { .comment_reply_item {