!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 name;
String avatar;
String fromAvatar;
String toAvatar;
List<SysServicesTopic> comments;
List<SysServicesTopic> replys;

View File

@ -25,7 +25,7 @@
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}
) 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
</select>
@ -39,6 +39,7 @@
<result column="img" property="img" typeHandler="com.stdiet.custom.typehandler.ArrayJsonHandler"/>
<result column="create_time" property="createTime"/>
<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"/>
</resultMap>
@ -53,7 +54,9 @@
<result column="img" property="img" typeHandler="com.stdiet.custom.typehandler.ArrayJsonHandler"/>
<result column="create_time" property="createTime"/>
<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="toAvatar" column="{uid=to_uid,role=to_role}" select="selectUserAvatar"/>-->
<association property="replys" column="id"
select="selectServicesTopicCommentReplyByCommentId"/>
</resultMap>
@ -71,7 +74,9 @@
<result column="img" property="img" typeHandler="com.stdiet.custom.typehandler.ArrayJsonHandler"/>
<result column="create_time" property="createTime"/>
<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="toAvatar" column="{uid=to_uid,role=to_role}" select="selectUserAvatar"/>-->
</resultMap>
@ -103,6 +108,18 @@
</choose>
</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"
keyProperty="id" keyColumn="id">

View File

@ -75,7 +75,7 @@ const actions = {
commit("save", { selTopicId: topicId });
// 客户信息
if (healthyData.customerId !== parseInt(uid)) {
dispatch("getHealthyData", { cusId: uid });
dispatch("getHealthyData", { cusId: uid, callback: payload.callback });
}
//
const result = await fetchTopicDetail({ topicId, id });
@ -116,22 +116,26 @@ const actions = {
const healthyDataResult = await getCustomerPhysicalSignsByCusId(
payload.cusId
);
let healthyData = undefined,
healthyDataType = 0;
const newState = {};
if (healthyDataResult.code === 200) {
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 {
throw new Error(healthyDataResult.msg);
}
commit("save", {
healthDataLoading: false,
healthyDataType,
healthyData,
avoidFoodIds: (healthyData.avoidFood || []).map(obj => obj.id)
...newState
});
}
};

View File

@ -27,7 +27,12 @@
</el-select>
</el-form-item> -->
<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
v-for="dict in accountIdOptions"
:key="dict.dictValue"
@ -330,8 +335,18 @@
<el-row :gutter="15">
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-col :span="12">
<el-form-item label="进粉渠道" prop="channelId" style="width:400px">
<el-select v-model="form.channelId" placeholder="请选择" filterable clearable @change="channelAutoSelectNutritionist">
<el-form-item
label="进粉渠道"
prop="channelId"
style="width: 400px"
>
<el-select
v-model="form.channelId"
placeholder="请选择"
filterable
clearable
@change="channelAutoSelectNutritionist"
>
<el-option
v-for="dict in accountIdOptions"
:key="dict.dictValue"
@ -356,12 +371,12 @@
</el-form-item>
</el-col>
<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-form-item>
</el-col>
<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-form-item>
</el-col>
@ -413,8 +428,6 @@
</el-select>
</el-form-item>
</el-col>
</el-form>
</el-row>
<div slot="footer" class="dialog-footer">
@ -508,7 +521,7 @@ export default {
assistantDietitian: null,
afterDietitian: null,
salesman: null,
physicalSignsId: null
physicalSignsId: null,
},
//
form: {},
@ -551,7 +564,7 @@ export default {
},
},
//
physicalSignsList:[]
physicalSignsList: [],
};
},
created() {
@ -573,7 +586,7 @@ export default {
}
});
this.getList();
listPhysicalSigns().then(response => {
listPhysicalSigns().then((response) => {
this.physicalSignsList = response.rows;
});
},
@ -789,52 +802,68 @@ export default {
})
.catch(function () {});
},
channelAutoSelectNutritionist(channelValue){
channelAutoSelectNutritionist(channelValue) {
this.form.fansChannel = channelValue == "" ? null : channelValue;
if(channelValue == undefined || channelValue == null || channelValue == ""){
if (
channelValue == undefined ||
channelValue == null ||
channelValue == ""
) {
this.form.mainDietitian = null;
return;
}
if(this.form.fansTime == undefined || this.form.fansTime == null){
if (this.form.fansTime == undefined || this.form.fansTime == null) {
this.form.mainDietitian = null;
return;
}
this.autoSelectNutritionist();
},
fanTimeAutoSelectNutritionist(fansTime){
fanTimeAutoSelectNutritionist(fansTime) {
this.form.fansTime = fansTime;
if(fansTime == undefined || fansTime == null){
if (fansTime == undefined || fansTime == null) {
this.form.mainDietitian = null;
return;
}
if(this.form.fansChannel == undefined || this.form.fansChannel == null || this.form.fansChannel == ""){
if (
this.form.fansChannel == undefined ||
this.form.fansChannel == null ||
this.form.fansChannel == ""
) {
this.form.mainDietitian = null;
return;
}
this.autoSelectNutritionist();
},
autoSelectNutritionist(){
getLiveSchedulByTime({'fanChannel':this.form.fansChannel,'liveStartTimeString':encodeURIComponent(this.form.fansTime)}).then((response) => {
autoSelectNutritionist() {
getLiveSchedulByTime({
fanChannel: this.form.fansChannel,
liveStartTimeString: encodeURIComponent(this.form.fansTime),
}).then((response) => {
if (response.code === 200) {
let live = response.data;
if(live != undefined && live != null && live.liveNutritionistId != null && this.nutritionistIdOptions != null){
if (
live != undefined &&
live != null &&
live.liveNutritionistId != null &&
this.nutritionistIdOptions != null
) {
let mainDietitian = null;
this.nutritionistIdOptions.forEach((item,index) => {
if(live.liveNutritionistId == item.dictValue){
this.nutritionistIdOptions.forEach((item, index) => {
if (live.liveNutritionistId == item.dictValue) {
mainDietitian = live.liveNutritionistId;
}
if(index == this.nutritionistIdOptions.length - 1){
if (index == this.nutritionistIdOptions.length - 1) {
this.form.mainDietitian = mainDietitian;
}
});
}else{
} else {
this.form.mainDietitian = null;
}
}else{
} else {
this.form.mainDietitian = null;
}
});
}
},
},
};
</script>

View File

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

View File

@ -31,12 +31,19 @@
</div>
<div class="topic_detail">
<div class="topic_detail_list">
<div class="topic_detail_title" v-if="!!detailData.content">
<div
class="topic_detail_title"
v-if="!!detailData.content"
@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" @click="handleOnReplyTopic(detailData)">
回复
<div class="reply_btn">回复</div>
</div>
</div>
</div>
@ -83,12 +90,8 @@ import { createNamespacedHelpers, mapActions as globalMapActions } from "vuex";
import Comment from "./Comment";
import dayjs from "dayjs";
import { keys } from "@/utils/websocket";
const {
mapActions,
mapState,
mapMutations,
mapGetters,
} = createNamespacedHelpers("message");
const { mapActions, mapState, mapMutations, mapGetters } =
createNamespacedHelpers("message");
export default {
data() {
return {
@ -179,6 +182,7 @@ export default {
return dayjs(date).format("MM-DD HH:mm");
},
handleOnTopicClick(data) {
if (data.topicId !== this.selTopicId) {
this.replyTarget = "";
this.replyContent = "";
this.replyObj = {};
@ -186,7 +190,9 @@ export default {
topicId: data.topicId,
id: data.id,
uid: data.uid,
callback: (err) => this.$message.error(err),
});
}
},
handleOnReplyTopic(data) {
this.replyTarget = "主题";
@ -340,11 +346,13 @@ export default {
.reply_btn {
margin-left: 16px;
color: #1890ff;
cursor: pointer;
// cursor: pointer;
}
}
.topic_detail_title {
display: flex;
cursor: pointer;
}
.comment_reply_item {