Commit adc166d2 by xinla

调试客户画像

1 parent 8433f437
...@@ -28,13 +28,15 @@ export default { ...@@ -28,13 +28,15 @@ export default {
let code = query.code let code = query.code
this.corpId = query.corpId this.corpId = query.corpId
this.agentId = query.agentId this.agentId = query.agentId
this.$toast('agentId:' + this.agentId)
if (!code) { if (!code) {
this.$toast('未获得授权') this.$toast('未获得授权')
return return
} }
let { data } = await getUserInfo(code, this.agentId) let { data } = await getUserInfo(code, this.agentId)
this.$store.state.userId = data.userId this.$store.state.userId = data.userId
// this.$toast('userId:' + this.$store.state.userId) this.$toast('userId:' + this.$store.state.userId)
}, },
watch: { watch: {
// 通过config接口注入权限验证配置 // 通过config接口注入权限验证配置
...@@ -49,7 +51,7 @@ export default { ...@@ -49,7 +51,7 @@ export default {
reload() { reload() {
this.isRouterAlive = false this.isRouterAlive = false
this.$nextTick(function() { this.$nextTick(function() {
this.isRouterAlive = true // this.isRouterAlive = true
}) })
}, },
wxConfig() { wxConfig() {
......
/** /**
* 请求路径参数转为对象 * query请求路径参数转为对象
* @param {*} url * @param {*} url
*/ */
export function param2Obj(url) { export function param2Obj(url) {
const search = decodeURIComponent(url) let search = decodeURIComponent(url).split('?')[1]
.split('?')[1] search = search && search.split('#')[0]
.split('#')[0]
if (!search) { if (!search) {
return {} return {}
} }
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
> >
<van-tab :title="'添加的员工(' + staff.length + ')'"> <van-tab :title="'添加的员工(' + staff.length + ')'">
<van-list v-model="loading" :finished="finished" @load="onLoad"> <van-list v-model="loading" :finished="finished" @load="onLoad">
<van-cell v-for="(item,index) in staff" :key="index"> <van-cell v-for="(item, index) in staff" :key="index">
<div class="details"> <div class="details">
<div class="detail"> <div class="detail">
<div class="left"> <div class="left">
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</div> </div>
<div class="right"> <div class="right">
<div> <div>
{{ item.groupName + "(" + item.groupMemberNum + ")" }} {{ item.groupName + '(' + item.groupMemberNum + ')' }}
</div> </div>
<div> <div>
<span class="c9">群主:</span> <span class="c9">群主:</span>
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
</template> </template>
<script> <script>
import { findAddaddEmployes, findAddGroupNum } from "@/api/portrait"; import { findAddaddEmployes, findAddGroupNum } from '@/api/portrait'
export default { export default {
data() { data() {
return { return {
...@@ -95,13 +95,15 @@ export default { ...@@ -95,13 +95,15 @@ export default {
groupChat: [], // 添加的群聊 groupChat: [], // 添加的群聊
commonGroup: [], // 共同的群聊 commonGroup: [], // 共同的群聊
// externalUserid: "wmiGuBCgAAIH-T9ekaE-Q52N2lKWeInw", // externalUserid: "wmiGuBCgAAIH-T9ekaE-Q52N2lKWeInw",
externalUserid: "FengJuZhuDeJieDao", externalUserid: '',
userid: "45DuXiangShangQingXie", // 员工Id userid: this.$store.state.userId, // 员工Id
}; }
}, },
created() { created() {
this.findAddaddEmployes(); this.externalUserid = this.$route.query.customerId
this.findAddGroupNum();
this.findAddaddEmployes()
this.findAddGroupNum()
}, },
methods: { methods: {
conGroup() { conGroup() {
...@@ -111,27 +113,27 @@ export default { ...@@ -111,27 +113,27 @@ export default {
onLoad() { onLoad() {
setTimeout(() => { setTimeout(() => {
for (let i = 0; i < 2; i++) { for (let i = 0; i < 2; i++) {
this.list.push(this.list.length + 1); this.list.push(this.list.length + 1)
} }
// 加载状态结束 // 加载状态结束
this.loading = false; this.loading = false
// 数据全部加载完成 // 数据全部加载完成
if (this.list.length >= 2) { if (this.list.length >= 2) {
this.finished = true; this.finished = true
} }
}, 1000); }, 1000)
}, },
findAddaddEmployes() { findAddaddEmployes() {
findAddaddEmployes(this.externalUserid) findAddaddEmployes(this.externalUserid)
.then(({ data }) => { .then(({ data }) => {
// console.log(data); // console.log(data);
this.staff = data; this.staff = data
}) })
.catch((err) => { .catch((err) => {
console.log(err); console.log(err)
}); })
}, },
findAddGroupNum() { findAddGroupNum() {
findAddGroupNum({ findAddGroupNum({
...@@ -141,35 +143,35 @@ export default { ...@@ -141,35 +143,35 @@ export default {
.then(({ data }) => { .then(({ data }) => {
// console.log(data); // console.log(data);
// debugger // debugger
this.groupChat = data; this.groupChat = data
this.commonGroup = this.groupChat.filter((ele) => { this.commonGroup = this.groupChat.filter((ele) => {
// debugger // debugger
return ele.groupMemberNum == 1; return ele.groupMemberNum == 1
}); })
}) })
.catch((err) => { .catch((err) => {
console.log(err); console.log(err)
}); })
}, },
// 时间处理器 // 时间处理器
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 = var D =
date.getDate() < 10 ? "0" + date.getDate() : date.getDate() + " "; date.getDate() < 10 ? '0' + date.getDate() : date.getDate() + ' '
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 Y + M + D + h + m; return Y + M + D + h + m
}, },
}, },
}; }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
......
...@@ -101,8 +101,8 @@ ...@@ -101,8 +101,8 @@
</div> </div>
</template> </template>
<script> <script>
import { getCustomerInfo, getWeCustomerInfo } from "@/api/portrait"; import { getCustomerInfo, getWeCustomerInfo } from '@/api/portrait'
import { getUserInfo } from "@/api/common"; import { getUserInfo } from '@/api/common'
export default { export default {
data() { data() {
return { return {
...@@ -110,57 +110,58 @@ export default { ...@@ -110,57 +110,58 @@ export default {
// 接口开始 // 接口开始
// 表单数据 // 表单数据
form: { form: {
externalUserid: "wm2H-nDQAACG5x4XjsM1OoW8UVfpbn3A", // 客户Id externalUserid: '', // 客户Id
userId: "45DuXiangShangQingXie", // 员工Id userId: this.$store.state.userId, // 员工Id
name: "", // 昵称 name: '', // 昵称
remarkMobiles: "", // 手机号 remarkMobiles: '', // 手机号
birthday: "", // 客户生日 birthday: '', // 客户生日
age:'',// 年龄 age: '', // 年龄
email: "", // 邮箱 email: '', // 邮箱
address: "", // 地址 address: '', // 地址
qq: "", // qq qq: '', // qq
position: "", // 职业 position: '', // 职业
remarkCorpName: "", // 公司 remarkCorpName: '', // 公司
description: "", // 其他描述 description: '', // 其他描述
}, },
}; }
}, },
computed: { computed: {
// 获取客户年龄 // 获取客户年龄
}, },
created() { created() {
this.form.externalUserid = this.$route.query.customerId
// 获取客户详细信息 // 获取客户详细信息
getCustomerInfo({ getCustomerInfo({
externalUserid: this.form.externalUserid, externalUserid: this.form.externalUserid,
userId: this.form.userId, userId: this.form.userId,
}) })
.then(({ data }) => { .then(({ data }) => {
console.log(data); console.log(data)
this.form = data; this.form = data
console.log(this.form); console.log(this.form)
}) })
.catch((err) => { .catch((err) => {
console.log(err); console.log(err)
}); })
}, },
methods: { methods: {
edit() { edit() {
this.flage = !this.flage; this.flage = !this.flage
}, },
// 点击保存按钮提交表单 // 点击保存按钮提交表单
saveUserInformation() { saveUserInformation() {
this.flage = !this.flage; this.flage = !this.flage
getWeCustomerInfo(this.form) getWeCustomerInfo(this.form)
.then((data)=> { .then((data) => {
console.log(data); console.log(data)
}) })
.catch((err) => { .catch((err) => {
console.log(err); console.log(err)
}); })
}, },
}, },
}; }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="data" @click="goRoute">详细资料></div> <div class="data" @click="goRoute('/detail')">详细资料></div>
</div> </div>
<div class="detail"> <div class="detail">
<div class="c9">手机号</div> <div class="c9">手机号</div>
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
<div class="realationship"> <div class="realationship">
<div class="detail"> <div class="detail">
<div>社交关系</div> <div>社交关系</div>
<div class="data" @click="detailGoRoute()">详情</div> <div class="data" @click="goRoute('/community')">详情</div>
</div> </div>
<div class="detail"> <div class="detail">
<div class="boxnumber"> <div class="boxnumber">
...@@ -387,7 +387,7 @@ export default { ...@@ -387,7 +387,7 @@ export default {
// externalUserid: "wm2H-nDQAACG5x4XjsM1OoW8UVfpbn3A", // 客户Id // externalUserid: "wm2H-nDQAACG5x4XjsM1OoW8UVfpbn3A", // 客户Id
// externalUserid: "wmiGuBCgAAgeijfvvpJ62cBfwrB-c4kw", // externalUserid: "wmiGuBCgAAgeijfvvpJ62cBfwrB-c4kw",
externalUserid: 'FengJuZhuDeJieDao', externalUserid: 'FengJuZhuDeJieDao',
userid: '45DuXiangShangQingXie', // 员工Id userid: this.$store.state.userId, // 员工Id
form: { form: {
name: '', // 昵称 name: '', // 昵称
remarkMobiles: '', // 手机号 remarkMobiles: '', // 手机号
...@@ -490,7 +490,8 @@ export default { ...@@ -490,7 +490,8 @@ export default {
this.styleActive4 = '' this.styleActive4 = ''
}, },
activity() { activity() {
;(this.trajectoryType = 3), this.findTrajectory() this.trajectoryType = 3
this.findTrajectory()
this.styleActive1 = '' this.styleActive1 = ''
this.styleActive2 = '' this.styleActive2 = ''
this.styleActive3 = 'background:#1989fa;color:#fff' this.styleActive3 = 'background:#1989fa;color:#fff'
...@@ -562,18 +563,11 @@ export default { ...@@ -562,18 +563,11 @@ export default {
// 点击删除按钮 // 点击删除按钮
deltodoshow() {}, deltodoshow() {},
goRoute() { goRoute(path) {
this.$router.push({
path: '/detail',
query: {
// type
},
})
},
detailGoRoute() {
this.$router.push({ this.$router.push({
path: '/community', path,
query: { query: {
customerId: this.externalUserid,
// type // type
}, },
}) })
...@@ -695,8 +689,25 @@ export default { ...@@ -695,8 +689,25 @@ export default {
}, },
}, },
created() { created() {
// 获取客户信息
let _this = this let _this = this
wx.invoke('getContext', {}, function(res) {
if (res.err_msg == 'getContext:ok') {
entry = res.entry //返回进入H5页面的入口类型,目前有normal、contact_profile、single_chat_tools、group_chat_tools
if (
![
'single_chat_tools',
'group_chat_tools',
'contact_profile',
].includes(entry)
) {
// _this.$toast.clear()
_this.$toast('入口错误:' + entry)
return
}
wx.invoke('getCurExternalContact', {}, (res) => {
if (res.err_msg == 'getCurExternalContact:ok') {
_this.externalUserid = res.userId //返回当前外部联系人userId
// 获取客户信息
_this.findAddaddEmployes(), _this.findAddaddEmployes(),
_this.findAddGroupNum(), _this.findAddGroupNum(),
_this.getCustomerInfo(), _this.getCustomerInfo(),
...@@ -704,11 +715,19 @@ export default { ...@@ -704,11 +715,19 @@ export default {
getAllTags() getAllTags()
.then(({ data }) => { .then(({ data }) => {
// console.log(data); // console.log(data);
this.alllabel = data _this.alllabel = data
}) })
.catch((err) => { .catch((err) => {
console.log(err) console.log(err)
}) })
} else {
//错误处理
}
})
} else {
//错误处理
}
})
}, },
components: { components: {
StepList, StepList,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!