This commit is contained in:
xiezhijun
2021-06-30 18:53:22 +08:00
18 changed files with 629 additions and 129 deletions

View File

@ -20,6 +20,12 @@
:value.sync="data.avoidFood"
@onConfirm="handleOnConfirm"
/>
<RemarkCom
v-if="dev && showRemark"
title="营养师点评"
:value.sync="data.recipesPlanRemark"
@onConfirm="handleOnRemarkConfirm"
/>
</div>
</template>
<script>
@ -39,6 +45,10 @@ export default {
type: Boolean,
default: false,
},
showRemark: {
type: Boolean,
default: false,
},
},
components: {
"text-info": TextInfo,
@ -115,6 +125,21 @@ export default {
});
},
},
watch: {
data(val, oldVal) {
if (
val &&
val.dietitianName &&
!this.basicInfo[3].some((obj) => obj.value === "dietitianName")
) {
this.basicInfo.splice(3, 0, [
{ title: "主营养师", value: "dietitianName" },
{ title: "营养师助理", value: "assDietitianName" },
{ title: "售后营养师", value: "afterDietitianName" },
]);
}
},
},
};
</script>
<style lang="scss" scoped>

View File

@ -4,7 +4,7 @@
placement="right"
trigger="click"
width="400"
title="备注"
:title="title"
@hide="handleOnHide"
>
<el-input
@ -12,10 +12,10 @@
v-model="nData"
rows="6"
placeholder="请输入备注信息"
maxlength="300"
maxlength="600"
show-word-limit
/>
<span slot="reference" class="trigger">备注 </span>
<span slot="reference" class="trigger">{{ title }}</span>
</el-popover>
<div class="content">
<span v-if="newLine">
@ -35,6 +35,10 @@ export default {
type: String,
default: "",
},
title: {
type: String,
default: "备注",
},
},
components: {},
data() {

View File

@ -21,6 +21,12 @@
:value.sync="data.avoidFood"
@onConfirm="handleOnConfirm"
/>
<RemarkCom
v-if="dev && showRemark"
title="营养师点评"
:value.sync="data.recipesPlanRemark"
@onConfirm="handleOnRemarkConfirm"
/>
</div>
<el-collapse>
<el-collapse-item
@ -57,6 +63,7 @@ import TextInfo from "@/components/TextInfo";
import ACFCom from "./ACFCom";
import RemarkCom from "./RemarkCom";
import { updateHealthy } from "@/api/custom/healthy";
import { updateRecipesPlan } from "@/api/custom/recipesPlan";
export default {
name: "HealthyView",
@ -69,6 +76,10 @@ export default {
type: Boolean,
default: false,
},
showRemark: {
type: Boolean,
default: false,
},
},
components: {
"text-info": TextInfo,
@ -121,7 +132,7 @@ export default {
{ title: "过敏源", value: "allergen" },
],
},
{
{
title: "运动习惯评估",
content: [
{ title: "每周运动次数", value: "motionNum" },
@ -238,6 +249,33 @@ export default {
}
});
},
handleOnRemarkConfirm(data) {
const { pathname } = window.location;
const recipesId = pathname.substring(pathname.lastIndexOf("/") + 1);
updateRecipesPlan({
id: recipesId,
...data,
}).then((res) => {
if (res.code === 200) {
this.$message.success("修改成功");
}
});
},
},
watch: {
data(val, oldVal) {
if (
val &&
val.dietitianName &&
!this.basicInfo[3].some((obj) => obj.value === "dietitianName")
) {
this.basicInfo.splice(3, 0, [
{ title: "主营养师", value: "dietitianName" },
{ title: "营养师助理", value: "assDietitianName" },
{ title: "售后营养师", value: "afterDietitianName" },
]);
}
},
},
};
</script>

View File

@ -1,6 +1,6 @@
import {
getCustomerPhysicalSignsByCusId,
getCustomer
getCustomerPhysicalSignsByCusId
// getCustomer
} from "@/api/custom/customer";
import { dealHealthy } from "@/utils/healthyData";
import {
@ -34,8 +34,6 @@ const oriState = {
healthyDataType: 0,
avoidFoodIds: [],
//
customerData: {},
//
planList: [],
planListLoading: false
};
@ -130,7 +128,8 @@ const actions = {
dispatch("fetchTopicDetailActions", {
topicId: defTopic.topicId,
id: defTopic.id,
uid: defTopic.uid
uid: defTopic.uid,
callback: payload.callback
});
}, 100);
mTopicList = result.rows;
@ -145,7 +144,6 @@ const actions = {
const {
healthyData,
planList,
customerData,
topicList,
customerList
} = state;
@ -158,11 +156,6 @@ const actions = {
if (!planList.length || planList[0].cusId !== parseInt(uid)) {
dispatch("getRecipesPlanActions", { cusId: uid });
}
// 客户档案
if (customerData.id !== parseInt(uid)) {
dispatch("getCustomerFileActions", { cusId: uid });
}
//
const result = await fetchTopicDetail({ topicId, id });
if (result.code === 200) {
// 设置已读
@ -184,12 +177,6 @@ const actions = {
});
}
},
async getCustomerFileActions({ commit }, payload) {
const result = await getCustomer(payload.cusId);
if (result.code === 200) {
commit("save", { customerData: result.data });
}
},
async postTopicReplyActions(
{ commit, rootGetters, dispatch, state },
payload
@ -223,7 +210,7 @@ const actions = {
const healthyDataResult = await getCustomerPhysicalSignsByCusId(
payload.cusId
);
const newState = {};
const newState = { healthyData: {}, avoidFoodIds: [] };
if (healthyDataResult.code === 200) {
if (!healthyDataResult.data.customerHealthy) {
// throw new Error("客户还没填写健康评估表");
@ -236,6 +223,12 @@ const actions = {
newState.avoidFoodIds = (newState.healthyData.avoidFood || []).map(
obj => obj.id
);
newState.healthyData.dietitianName =
healthyDataResult.data.customerInfo.dietitianName;
newState.healthyData.assDietitianName =
healthyDataResult.data.customerInfo.assDietitianName;
newState.healthyData.afterDietitianName =
healthyDataResult.data.customerInfo.afterDietitianName;
}
}
commit("save", {

View File

@ -49,7 +49,8 @@ const oriState = {
igdTypeOptions: [],
physicalSignsOptions: [],
//
curShortCutObj: {}
curShortCutObj: {},
recipesPlanRemark: ""
};
const mutations = {
@ -147,7 +148,8 @@ const actions = {
endNumDay,
recipesId,
cusId,
reviewStatus
reviewStatus,
remark
} = planResponse.data;
commit("updateStateData", {
cusId,
@ -157,7 +159,8 @@ const actions = {
name: payload.name,
planId: payload.planId,
startNum: startNumDay,
endNum: endNumDay
endNum: endNumDay,
recipesPlanRemark: remark
});
getDicts("cus_cus_unit").then(response => {
commit("updateStateData", { cusUnitOptions: response.data });
@ -237,7 +240,8 @@ const actions = {
commit("updateStateData", payload);
}
},
async getHealthyData({ commit }, payload) {
async getHealthyData({ commit, state }, payload) {
const { recipesPlanRemark } = state;
commit("updateStateData", { healthDataLoading: true });
const healthyDataResult = await getCustomerPhysicalSignsByCusId(
payload.cusId
@ -256,7 +260,10 @@ const actions = {
commit("updateStateData", {
healthDataLoading: false,
healthyDataType,
healthyData,
healthyData: {
...healthyData,
recipesPlanRemark
},
avoidFoodIds: (healthyData.avoidFood || []).map(obj => obj.id)
});
},
@ -555,7 +562,7 @@ const actions = {
id: new Date().getTime(),
name: tarDishes.name,
type: response.data.type.split(",").sort(),
className: response.data.className, //大类小类名称
className: response.data.className, //大类小类名称
data: tarDishes
}).then(() => {
window.postMessage(

View File

@ -237,7 +237,12 @@ export default {
this.replyTarget = "";
this.replyContent = "";
this.replyObj = {};
this.fetchTopicListApi({ fromUid: data.uid });
this.fetchTopicListApi({
fromUid: data.uid,
callback: (msg) => {
this.$message.error(msg);
},
});
}
},
handleOnTopicClick(data) {

View File

@ -15,22 +15,6 @@
:data="healthyDataType === 1 ? healthyData : {}"
v-show="healthyDataType === 1"
/>
<div v-if="customerData.id" class="customer_service_info">
<div class="info_item">
<span>主任营养师</span>
<span>
{{ customerData.dietitianName || "无" }}
</span>
</div>
<div class="info_item">
<span>营养师助理</span>
<span>{{ customerData.assDietitianName || "无" }}</span>
</div>
<div class="info_item">
<span>售后营养师</span>
<span>{{ customerData.afterDietitianName || "无" }}</span>
</div>
</div>
</div>
</el-tab-pane>
<el-tab-pane label="食谱计划" name="plan">
@ -69,12 +53,7 @@ export default {
},
},
computed: {
...mapState([
"healthyData",
"healthyDataType",
"healthDataLoading",
"customerData",
]),
...mapState(["healthyData", "healthyDataType", "healthDataLoading"]),
},
};
</script>

View File

@ -10,11 +10,13 @@
<div class="content">
<HealthyView
dev
showRemark
:data="healthyDataType === 0 ? healthyData : {}"
v-show="healthyDataType === 0"
/>
<BodySignView
dev
showRemark
:data="healthyDataType === 1 ? healthyData : {}"
v-show="healthyDataType === 1"
/>