Commit 7abb7542 authored by 赵茹林's avatar 赵茹林

回访信息 修复更新手机号、微信号后界面没有更新显示的问题,最后更新时间不显示/不更新显示的问题

parent a6b45465
<!-- 回访信息 -->
<template>
<div class="callback-container">
<div class="callback-info callback-item" style="margin-bottom: 15px;">
ID:{{callbackObj.user_id}} &emsp;
用户昵称:{{callbackObj.detail.nickname}} &emsp;
宝宝名称:{{callbackObj.detail.baby_name || '-'}} &emsp;
宝宝生日:{{(callbackObj.detail.birthday == '0000-00-00') ? '-' : callbackObj.detail.birthday}} &emsp;
手机号:{{callbackObj.detail.mobile || '-'}} &emsp;
关联手机号:
<span class="callback-edit">
<!--<i v-if="!callbackEdit.mobile.show" @click="editCallback('mobile')">{{callbackObj.detail.relation_mobile ? callbackObj.detail.relation_mobile : '&#45;&#45;'}}</i>-->
<el-card shadow="never" class="callback-container" v-loading="loading">
<el-card shadow="never" class="callback-info callback-item" style="margin-bottom: 15px;">
ID:{{user.user_id}} &emsp;
用户昵称:{{user.nickname}} &emsp;
宝宝名称:{{user.baby_name || '-'}} &emsp;
宝宝生日:{{(user.birthday == '0000-00-00') ? '-' : user.birthday}} &emsp;
手机号:{{user.mobile || '-'}} &emsp;
<div style="display: inline-block; white-space: nowrap">
关联手机号:
<span class="callback-edit">
<!--<i v-if="!callbackEdit.mobile.show" @click="editCallback('mobile')">{{user.relation_mobile || '&#45;&#45;'}}</i>-->
<template v-if="$store.state.readonly">
{{callbackEdit.mobile.value || '-'}}
</template>
......@@ -20,10 +22,13 @@
v-model="callbackEdit.mobile.value"
style="width: 130px;" size="small"></el-input>
<!--v-else @blur="callbackEdit.mobile.show = !callbackEdit.mobile.show"-->
</span> &emsp;
微信号:
<span class="callback-edit">
<!--<i v-if="!callbackEdit.wechat.show" @click="editCallback('wechat')">{{callbackObj.detail.wx_number ? callbackObj.detail.wx_number : '&#45;&#45;'}}</i>-->
</span> &emsp;
</div>
<div style="display: inline-block; white-space: nowrap">
微信号:
<span class="callback-edit">
<!--<i v-if="!callbackEdit.wechat.show" @click="editCallback('wechat')">{{user.wx_number || '&#45;&#45;'}}</i>-->
<template v-if="$store.state.readonly">
{{callbackEdit.wechat.value || '-'}}
</template>
......@@ -33,25 +38,28 @@
v-model="callbackEdit.wechat.value"
style="width: 100px;" size="small"></el-input>
<!--v-else @blur="callbackEdit.wechat.show = !callbackEdit.wechat.show"-->
</span> &emsp;
</span> &emsp;
</div>
<el-button
v-if="!$store.state.readonly"
@click="editCallbackSave"
:disabled="(callbackEdit.wechat.value == callbackEdit.wechat.origin) && (callbackEdit.mobile.value == callbackEdit.mobile.origin)"
type="primary" plain size="small">更新用户信息</el-button>&emsp;
<span style="font-size: 12px; color: #999999; white-space: nowrap">最后更新:{{callbackObj.detail.updated_at || '-'}}</span>
</div>
type="primary" plain size="small">更新用户信息
</el-button>&emsp;
<span style="font-size: 12px; color: #999999; white-space: nowrap">最后更新:{{user.updated_at || '-'}}</span>
</el-card>
<div class="callback-item" style="display: flex; align-items: flex-start; margin-bottom: 15px; line-height: 32px;">
<el-card shadow="never" class="callback-item" style="display: flex; align-items: flex-start; margin-bottom: 15px; line-height: 32px;">
标签:
<span class="callback-tag-wrapper" v-if="tag.length">
<el-tag :key="item.id" :type="item.type==1 ? 'info' : ''" v-for="item in tag">{{item.label_name}}</el-tag>
</span>
<el-button v-if="!$store.state.readonly" type="warning" size="small" plain @click="dialogToggle">编辑标签</el-button>
</div>
</el-card>
<!--添加回访信息-->
<div v-if="callbackObj.teacher_id && callbackAdd && !$store.state.readonly" class="callback-item callback-input">
<el-card shadow="never" v-if="callbackObj.teacher_id && callbackAdd && !$store.state.readonly" class="callback-item callback-input">
<el-form size="small" inline>
<el-form-item required>
<el-select v-model="add.method" placeholder="回访方式" style="width: 140px;">
......@@ -83,9 +91,9 @@
<el-input
type="textarea" :rows="3"
placeholder="请输入回访内容" v-model="add.desc"></el-input>
</div>
</el-card>
<div class="callback-list callback-item">
<el-card shadow="never" class="callback-list callback-item">
<ol v-if="list.length">
<li :key="item.id" v-for="item in list">
<!--系统-->
......@@ -108,7 +116,7 @@
</ol>
<p class="callback-list-text" v-else>暂无回访数据</p>
<page :total="total" :limit="limit" @pageChange="onPageChange" @sizeChange="onSizeChange"/>
</div>
</el-card>
<el-dialog :title="dialog.title" append-to-body :visible.sync="dialog.show" width="800px">
......@@ -126,7 +134,8 @@
slot="reference"
@close="tagDel(item)"
:closable="item.type==1 ? false : true"
:type="item.type==1 ? 'info' : ''">{{item.label_name}}</el-tag>
:type="item.type==1 ? 'info' : ''">{{item.label_name}}
</el-tag>
</el-popover>
</template>
......@@ -141,8 +150,8 @@
:options="treeDataOrigin" :props="{ value: 'objString', label: 'name', multiple: false, checkStrictly: false }"></el-cascader>
</el-form-item>
<el-form-item label="已选标签备注:">
<div v-if="!tagSelectedText" style="color: #999;">未选择标签</div>
<div v-else v-html="tagSelectedText"></div>
<div v-if="!tagSelectedText" style="color: #999;">未选择标签</div>
<div v-else v-html="tagSelectedText"></div>
</el-form-item>
</el-form>
......@@ -152,21 +161,32 @@
</span>
</el-dialog>
</div>
</el-card>
</template>
<script>
import {CALLBACK_METHOD, CALLBACK_TYPE, CALLBACK_INTENTION} from "@/util/wordbook";
import {getUserTagApi, getTagApi, getCallBackApi, postCallBackApi, postUserTagApi, delUserTagApi, putUserInfoApi} from "@/service/api";
import {
getUserDetailApi,
getUserTagApi,
getTagApi,
getCallBackApi,
postCallBackApi,
postUserTagApi,
delUserTagApi,
putUserInfoApi
} from "@/service/api";
import page from '@/components/framework/page'
export default {
name: "CallBack",
components: { page },
components: {page},
props: {
callbackObj: {
type: Object,
default: () => {}
default: () => {
}
},
callbackAdd: {
type: Boolean,
......@@ -175,6 +195,15 @@
},
data() {
return {
loading: true,
user: {
user_id: '',
nickname: '',
baby_name: '',
birthday: '',
mobile: '',
updated_at: ''
},
CALLBACK_METHOD: CALLBACK_METHOD,
CALLBACK_TYPE: CALLBACK_TYPE,
CALLBACK_INTENTION: CALLBACK_INTENTION,
......@@ -233,20 +262,23 @@
created() {
},
watch: {
'callbackObj.detail'() {
this.callbackEdit.mobile.value = this.callbackObj.detail.relation_mobile;
this.callbackEdit.mobile.origin = this.callbackObj.detail.relation_mobile;
this.callbackEdit.wechat.value = this.callbackObj.detail.wx_number;
this.callbackEdit.wechat.origin = this.callbackObj.detail.wx_number;
'user'() {
this.callbackEdit.mobile.value = this.user.relation_mobile;
this.callbackEdit.mobile.origin = this.user.relation_mobile;
this.callbackEdit.wechat.value = this.user.wx_number;
this.callbackEdit.wechat.origin = this.user.wx_number;
}
},
mounted() {
this.user.user_id = this.callbackObj.user_id;
this.getUser();
this.getTag();
this.getData();
},
methods: {
filterName(string, type) {
return this[type].find(i => {return i.value == string}).label
return this[type].find(i => {
return i.value == string
}).label
},
editCallback(type) {
......@@ -260,8 +292,9 @@
relation_mobile: this.callbackEdit.mobile.value,
wx_number: this.callbackEdit.wechat.value
}
putUserInfoApi(this.callbackObj.user_id, json).then(res => {
putUserInfoApi(this.user.user_id, json).then(res => {
this.$message({type: 'success', message: '用户信息更新成功'});
this.getUser();
// this.$emit('updateUser');
})
},
......@@ -274,7 +307,7 @@
type: 'warning'
}).then(() => {
delUserTagApi(item.id).then(res => {
this.$message({ type: 'success', message: '标签删除成功!' });
this.$message({type: 'success', message: '标签删除成功!'});
this.getTag();
})
})
......@@ -295,18 +328,18 @@
},
dialogSave() {
if (!this.tagSelected.length) {
this.$message({ type: 'error', message: '请选择标签!' });
this.$message({type: 'error', message: '请选择标签!'});
return
}
var json = {
user_id: this.callbackObj.user_id,
user_id: this.user.user_id,
type: 0,
first_label_id: this.tagSelected[0]
};
this.tagSelected[1] ? json.second_label_id = this.tagSelected[1] : '';
this.tagSelected[2] ? json.third_label_id = this.tagSelected[2] : '';
postUserTagApi(json).then(res => {
this.$message({ type: 'success', message: '添加成功!' });
this.$message({type: 'success', message: '添加成功!'});
this.getTag();
this.dialogReset();
})
......@@ -341,17 +374,24 @@
})
}
}
getTagApi().then(res => {
recursion(res);
this.treeDataOrigin = res;
});
},
getUser() {
getUserDetailApi(this.user.user_id).then(res => {
// console.log(res, 999)
this.user = res;
this.getData();
this.loading = false;
})
},
getTag() {
if (this.callbackObj.user_id) {
getUserTagApi(this.callbackObj.user_id).then(res => {
this.tag = res;
})
}
getUserTagApi(this.user.user_id).then(res => {
this.tag = res;
})
},
getData() {
let json = {
......@@ -359,7 +399,7 @@
page: this.nowPage
};
this.teacher_num ? json.teacher_num = this.teacher_num : '';
this.callbackObj.user_id ? json.user_id = this.callbackObj.user_id : '';
this.user.user_id ? json.user_id = this.user.user_id : '';
// console.log(json, 9000)
getCallBackApi(json).then(res => {
this.list = res.page_data;
......@@ -388,7 +428,7 @@
return
}
let json = {
user_id: this.callbackObj.user_id,
user_id: this.user.user_id,
teacher_id: this.callbackObj.teacher_id, // TODO
// teacher_id: 84, // TODO
method: this.add.method,
......@@ -418,9 +458,14 @@
<style lang="less">
.callback-container {
border: none;
.el-divider--horizontal {
margin: 20px 0;
}
.el-card__body {
padding: 0;
}
}
.callback-item {
......@@ -430,26 +475,32 @@
border: solid 1px rgba(220, 223, 230, 0.5);
border-radius: 2px;
font-size: 14px;
&:last-child {
margin-bottom: 0;
}
}
.callback-info {
/*display: flex;*/
padding: 10px 15px;
line-height: 32px;
.callback-edit {
display: inline-block;
.el-input__inner {
vertical-align: top;
}
i {
margin: 0 -4px;
padding: 0 4px;
font-style: normal;
cursor: pointer;
transition: 240ms background-color;
&:hover {
background-color: #dde4ee;
border-radius: 3px;
......@@ -481,29 +532,37 @@
padding: 2px 0;
line-height: 24px;
font-size: 14px;
span {
/*display: inline-block;*/
margin-right: 12px;
&.time {
font-family: monospace;
font-size: 13px;
}
&.grey {
color: #555;
}
&.dark {
color: #333;
}
&.bold {
font-weight: bold;
}
&.info {
font-size: 13px;
color: #888;
}
&.green {
color: #33CC66;
}
&.red {
color: red;
}
......@@ -513,12 +572,15 @@
.callback-input {
font-size: 0;
.el-form-item {
margin-right: 10px;
margin-bottom: 10px;
}
.is-required .el-select {
display: flex;
&:before {
content: '*';
color: #F56C6C;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment