Commit 9511364f by xinla

客户画像修改优化

1 parent f7a5f7c8
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br />
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener"
>vue-cli documentation</a
>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li>
<a
href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel"
target="_blank"
rel="noopener"
>babel</a
>
</li>
<li>
<a
href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-router"
target="_blank"
rel="noopener"
>router</a
>
</li>
<li>
<a
href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-vuex"
target="_blank"
rel="noopener"
>vuex</a
>
</li>
<li>
<a
href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint"
target="_blank"
rel="noopener"
>eslint</a
>
</li>
</ul>
<h3>Essential Links</h3>
<ul>
<li>
<a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a>
</li>
<li>
<a href="https://forum.vuejs.org" target="_blank" rel="noopener"
>Forum</a
>
</li>
<li>
<a href="https://chat.vuejs.org" target="_blank" rel="noopener"
>Community Chat</a
>
</li>
<li>
<a href="https://twitter.com/vuejs" target="_blank" rel="noopener"
>Twitter</a
>
</li>
<li>
<a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a>
</li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li>
<a href="https://router.vuejs.org" target="_blank" rel="noopener"
>vue-router</a
>
</li>
<li>
<a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a>
</li>
<li>
<a
href="https://github.com/vuejs/vue-devtools#vue-devtools"
target="_blank"
rel="noopener"
>vue-devtools</a
>
</li>
<li>
<a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener"
>vue-loader</a
>
</li>
<li>
<a
href="https://github.com/vuejs/awesome-vue"
target="_blank"
rel="noopener"
>awesome-vue</a
>
</li>
</ul>
</div>
</template>
<script>
export default {
name: "HelloWorld",
props: {
msg: String
}
};
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less">
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<span class="finish-box"> <span class="finish-box">
<span <span
class="finish" class="finish"
v-if="item1.trajectoryType == 4 && item1.status !=3" v-if="item1.trajectoryType == 4 && item1.status != 3"
@click="finDynamic(item1.id)" @click="finDynamic(item1.id)"
>完成</span >完成</span
> >
...@@ -53,10 +53,10 @@ ...@@ -53,10 +53,10 @@
</template> </template>
<script> <script>
import { removeTrajectory, handleWait } from "@/api/portrait"; import { removeTrajectory, handleWait } from '@/api/portrait'
export default { export default {
props: ["stepList"], props: ['stepList'],
inject:['reload'], inject: ['reload'],
data() { data() {
return { return {
// 步骤条 // 步骤条
...@@ -66,45 +66,45 @@ export default { ...@@ -66,45 +66,45 @@ export default {
// 轨迹内层 // 轨迹内层
nlist: [], nlist: [],
oldele: [], oldele: [],
content: "", content: '',
type: 0, type: 0,
wList: [], wList: [],
finished: false, finished: false,
loading: false, loading: false
}; }
}, },
watch: { watch: {
stepList(newVal, oldVal) { stepList(newVal, oldVal) {
// console.log(newVal, oldVal); // console.log(newVal, oldVal);
if (newVal != oldVal) { if (newVal != oldVal) {
// debugger // debugger
this.wlist = []; this.wlist = []
this.wList = []; this.wList = []
this.oldele = []; this.oldele = []
this.nlist = []; this.nlist = []
} }
newVal.forEach((ele) => { newVal.forEach((ele) => {
this.oldele.push(parseInt(this.getTime(ele.createDate))); this.oldele.push(parseInt(this.getTime(ele.createDate)))
// console.log(parseInt(this.getTime(ele.createDate))); // console.log(parseInt(this.getTime(ele.createDate)));
}); })
// console.log(this.oldele); // console.log(this.oldele);
this.oldele = this.newArr(this.oldele).sort(this.f); this.oldele = this.newArr(this.oldele).sort(this.f)
// console.log(this.oldele); // console.log(this.oldele);
for (let i = 0; i < this.oldele.length; i++) { for (let i = 0; i < this.oldele.length; i++) {
for (let j = 0; j < newVal.length; j++) { for (let j = 0; j < newVal.length; j++) {
// console.log(newVal[j].createDate); // console.log(newVal[j].createDate);
if (this.oldele[i] == this.getTime(newVal[j].createDate)) { if (this.oldele[i] == this.getTime(newVal[j].createDate)) {
this.nlist.push(newVal[j]); this.nlist.push(newVal[j])
// console.log(this.nlist); // console.log(this.nlist);
} }
} }
this.wlist.push(this.nlist); this.wlist.push(this.nlist)
this.nlist = []; this.nlist = []
} }
// console.log(this.wlist); // console.log(this.wlist);
this.onLoad() this.onLoad()
}, }
}, },
methods: { methods: {
onLoad() { onLoad() {
...@@ -112,82 +112,82 @@ export default { ...@@ -112,82 +112,82 @@ export default {
// setTimeout 仅做示例,真实场景中一般为 ajax 请求 // setTimeout 仅做示例,真实场景中一般为 ajax 请求
setTimeout(() => { setTimeout(() => {
// debugger // debugger
let total = this.wlist.length > 10 ? 10 : this.wlist.length; let total = this.wlist.length > 10 ? 10 : this.wlist.length
for (let i = 0; i < total; i++) { for (let i = 0; i < total; i++) {
this.wList.push(this.wlist[i]); this.wList.push(this.wlist[i])
} }
// 加载状态结束 // 加载状态结束
this.loading = false; this.loading = false
// 数据全部加载完成 // 数据全部加载完成
if (this.wList.length >= this.wlist.length) { if (this.wList.length >= this.wlist.length) {
this.finished = true; this.finished = true
} }
}, 1000); }, 1000)
}, },
// 根据数字判断类型 // 根据数字判断类型
chargeType(num) { chargeType(num) {
if (num == 1) { if (num == 1) {
return (this.type = "信息动态"); return (this.type = '信息动态')
} else if (num == 2) { } else if (num == 2) {
return (this.type = "社交动态"); return (this.type = '社交动态')
} else if (num == 3) { } else if (num == 3) {
return (this.type = "活动规则"); return (this.type = '活动规则')
} else if (num == 4) { } else if (num == 4) {
return (this.type = "待办动态"); return (this.type = '待办动态')
} }
}, },
// 数组去重 // 数组去重
newArr(arr) { newArr(arr) {
return Array.from(new Set(arr)); return Array.from(new Set(arr))
}, },
// 数组由大到小排序 // 数组由大到小排序
f(a, b) { f(a, b) {
//排序函数 //排序函数
return -(a - b); //取反并返回比较参数 return -(a - b) //取反并返回比较参数
}, },
// 时间处理器 // 时间处理器
getTime(data) { getTime(data) {
const date = new Date(data); const date = new Date(data)
// console.log(timer.getFullYear()); // console.log(timer.getFullYear());
var Y = date.getFullYear(); var Y = date.getFullYear()
var M = var M =
date.getMonth() + 1 < 10 date.getMonth() + 1 < 10
? "0" + (date.getMonth() + 1) ? '0' + (date.getMonth() + 1)
: date.getMonth() + 1; : date.getMonth() + 1
var D = date.getDate() < 10 ? "0" + date.getDate() : date.getDate(); var D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
return Y + M + D; return Y + M + D
}, },
getTime1(data) { getTime1(data) {
const date = new Date(data); const date = new Date(data)
// console.log(timer.getFullYear()); // console.log(timer.getFullYear());
var Y = date.getFullYear() + "-"; var Y = date.getFullYear() + '-'
var M = var M =
(date.getMonth() + 1 < 10 (date.getMonth() + 1 < 10
? "0" + (date.getMonth() + 1) ? '0' + (date.getMonth() + 1)
: date.getMonth() + 1) + "-"; : date.getMonth() + 1) + '-'
var D = date.getDate() < 10 ? "0" + date.getDate() : date.getDate(); var D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
return Y + M + D; return Y + M + D
}, },
getTime2(data) { getTime2(data) {
const date = new Date(data); const date = new Date(data)
// console.log(timer.getFullYear()); // console.log(timer.getFullYear());
var h = var h =
(date.getHours() < 10 ? "0" + date.getHours() : date.getHours()) + ":"; (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':'
var m = var m =
date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes(); date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
return h + m; return h + m
}, },
// 处理星期几 // 处理星期几
getTime3(time) { getTime3(time) {
var dateArray = time.split("-"); var dateArray = time.split('-')
var date = new Date( var date = new Date(
dateArray[0], dateArray[0],
parseInt(dateArray[1] - 1), parseInt(dateArray[1] - 1),
dateArray[2] dateArray[2]
); )
var week = "星期" + "日一二三四五六".charAt(date.getDay()); var week = '星期' + '日一二三四五六'.charAt(date.getDay())
return week; return week
}, },
// 删除轨迹 // 删除轨迹
delDynamic(id) { delDynamic(id) {
...@@ -199,14 +199,14 @@ export default { ...@@ -199,14 +199,14 @@ export default {
// this.msgSuccess("删除成功"); // this.msgSuccess("删除成功");
// debugger // debugger
// location.reload(); // location.reload();
this.$toast.success('删除成功'); this.$toast.success('删除成功')
this.reload () this.reload()
// 重新获取全部数据 // 重新获取全部数据
} }
}) })
.catch((err) => { .catch((err) => {
console.log(err); console.log(err)
}); })
}, },
// 点击完成 // 点击完成
finDynamic(id) { finDynamic(id) {
...@@ -214,15 +214,15 @@ export default { ...@@ -214,15 +214,15 @@ export default {
.then((data) => { .then((data) => {
if (data.code == 200) { if (data.code == 200) {
// this.delDynamic(id); // this.delDynamic(id);
this.reload(); this.reload()
} }
}) })
.catch((err) => { .catch((err) => {
console.log(err); console.log(err)
}); })
}, }
}, }
}; }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
...@@ -267,7 +267,7 @@ export default { ...@@ -267,7 +267,7 @@ export default {
color: #2c8cf0; color: #2c8cf0;
font-size: 12px; font-size: 12px;
font-weight: 600; font-weight: 600;
// right: 30px; // right: 30px;
// top: 0px; // top: 0px;
} }
</style> </style>
...@@ -23,23 +23,21 @@ ...@@ -23,23 +23,21 @@
<div> <div>
<span <span
>{{ >{{
form.remark user.remark
? form.remark ? user.remark
: form.name + '_' + form.remarkCorpName : (user.name || '') + '-' + (user.remarkCorpName || '')
}} }}
&nbsp; &nbsp;</span </span>
><span <span class="icon iconfont icon-man" v-if="user.gender == 1">
class="icon iconfont icon-man" </span>
v-if="form.gender == 1"
></span>
<span <span
class="icon iconfont icon-xingbie" class="icon iconfont icon-xingbie"
v-else-if="form.gender == 2" v-else-if="user.gender == 2"
></span> ></span>
<van-icon name="manager" color="#9c9c9c" v-else /> <van-icon name="manager" color="#9c9c9c" v-else />
</div> </div>
<div class="c9"> <div class="c9">
<span>昵称:</span><span>{{ form.name }}</span> <span>昵称:</span><span>{{ user.name }}</span>
</div> </div>
</div> </div>
</div> </div>
...@@ -53,6 +51,7 @@ ...@@ -53,6 +51,7 @@
input-align="right" input-align="right"
/> />
<van-field <van-field
v-if="flage"
v-model="form.age" v-model="form.age"
name="年龄" name="年龄"
label="年龄" label="年龄"
...@@ -68,7 +67,12 @@ ...@@ -68,7 +67,12 @@
input-align="right" input-align="right"
@click="!flage ? (show = true) : ''" @click="!flage ? (show = true) : ''"
/> />
<van-popup v-model="show" position="bottom" round :style="{ height: '60%' }"> <van-popup
v-model="show"
position="bottom"
round
:style="{ height: '60%' }"
>
<van-datetime-picker <van-datetime-picker
v-model="currentDate" v-model="currentDate"
type="date" type="date"
...@@ -76,7 +80,7 @@ ...@@ -76,7 +80,7 @@
:min-date="minDate" :min-date="minDate"
:max-date="maxDate" :max-date="maxDate"
@confirm="confirm" @confirm="confirm"
@cancel = "cancel" @cancel="cancel"
/></van-popup> /></van-popup>
<!-- -------------------------- --> <!-- -------------------------- -->
<van-field <van-field
...@@ -128,7 +132,6 @@ ...@@ -128,7 +132,6 @@
</template> </template>
<script> <script>
import { getCustomerInfo, getWeCustomerInfo } from '@/api/portrait' import { getCustomerInfo, getWeCustomerInfo } from '@/api/portrait'
import { getUserInfo } from '@/api/common'
export default { export default {
data() { data() {
return { return {
...@@ -140,6 +143,7 @@ export default { ...@@ -140,6 +143,7 @@ export default {
currentDate: new Date(2000, 0, 17), currentDate: new Date(2000, 0, 17),
// 接口开始 // 接口开始
// 表单数据 // 表单数据
user: {},
form: { form: {
externalUserid: '', // 客户Id externalUserid: '', // 客户Id
userId: '', // 员工Id userId: '', // 员工Id
...@@ -152,28 +156,25 @@ export default { ...@@ -152,28 +156,25 @@ export default {
qq: '', // qq qq: '', // qq
position: '', // 职业 position: '', // 职业
remarkCorpName: '', // 公司 remarkCorpName: '', // 公司
description: '', // 其他描述 description: '' // 其他描述
}, }
} }
}, },
computed: { computed: {
// 获取客户年龄
userId() { userId() {
return this.$store.state.userId // 员工Id return this.$store.state.userId // 员工Id
}, }
}, },
created() { created() {
this.form.externalUserid = this.$route.query.customerId
this.form.externalUserid = this.$route.query.customerId;
// 获取客户详细信息 // 获取客户详细信息
getCustomerInfo({ getCustomerInfo({
externalUserid: this.form.externalUserid, externalUserid: this.form.externalUserid,
userId: this.userId, userId: this.userId
}) })
.then(({ data }) => { .then(({ data }) => {
// console.log(data); this.form = data
this.form = data; this.user = Object.assign({}, data)
// console.log(this.form);
}) })
.catch((err) => { .catch((err) => {
console.log(err) console.log(err)
...@@ -183,10 +184,10 @@ export default { ...@@ -183,10 +184,10 @@ export default {
// 选择生日 // 选择生日
confirm(val) { confirm(val) {
this.show = false this.show = false
this.form.birthday =this.getTime (val) this.form.birthday = this.getTime(val)
console.log(val); console.log(val)
}, },
cancel () { cancel() {
this.show = false this.show = false
}, },
edit() { edit() {
...@@ -211,16 +212,22 @@ export default { ...@@ -211,16 +212,22 @@ export default {
}, },
// 点击保存按钮提交表单 // 点击保存按钮提交表单
saveUserInformation() { saveUserInformation() {
this.flage = !this.flage; this.$toast.loading({
message: 'loading...',
duration: 0,
forbidClick: true
})
this.flage = !this.flage
this.form.userId = this.userId
getWeCustomerInfo(this.form) getWeCustomerInfo(this.form)
.then((data) => { .then((data) => {
console.log(data) this.$toast('操作成功')
}) })
.catch((err) => { .catch((err) => {
console.log(err) console.log(err)
}) })
}, }
}, }
} }
</script> </script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!