customerDetail.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  1. <template>
  2. <view>
  3. <view class="topBgline plr20">
  4. <view class="justify-start p30 bgcolf radius12">
  5. <u-avatar :src='detailUser.avatar'></u-avatar>
  6. <view class="ml16">
  7. <view class="bold fs28">{{detailUser.name}}</view>
  8. <view class="fs24 base-color-3">备注:{{detailUser.remark}}</view>
  9. </view>
  10. </view>
  11. </view>
  12. <view class="bgf p20">
  13. <view class="justify-between align-center">
  14. <view>会员资料</view>
  15. <view class="fs24 u-border plr20 ptb6 radius40 base-color-6"
  16. @click="changeuser()">修改用户信息</view>
  17. </view>
  18. <view class="justify-between">
  19. <view class="justify-start align-center fs24 mt20 widthpath" >
  20. <view class="base-color-6 mr40">性别</view>
  21. <view>{{moreInfo.sex?moreInfo.sex:'未知'}}</view>
  22. </view>
  23. <view class="justify-start align-center fs24 mt20 widthpath" >
  24. <view class="base-color-6 mr40">年龄</view>
  25. <view>{{moreInfo.age?moreInfo.age:'未知'}}</view>
  26. </view>
  27. </view>
  28. <view class="justify-start align-center fs24 mtb20">
  29. <view class="base-color-6 mr40">行为习惯</view>
  30. <view>{{moreInfo.habits?moreInfo.habits:'无'}}</view>
  31. </view>
  32. <view class="justify-start align-center fs24">
  33. <view class="base-color-6 mr40">患病时间</view>
  34. <view>{{moreInfo.illnessTime?moreInfo.illnessTime:'无'}}</view>
  35. </view>
  36. <view class="justify-start align-center fs24 mt20" >
  37. <view class="base-color-6 mr40">疾病</view>
  38. <view>{{moreInfo.disease?moreInfo.disease:'无'}}</view>
  39. </view>
  40. <view class="justify-start align-center fs24 mt20" >
  41. <view class="base-color-6 mr40">家人的疾病</view>
  42. <view>{{moreInfo.familyDisease?moreInfo.familyDisease:'无'}}</view>
  43. </view>
  44. <view class="justify-between align-center">
  45. <view class="justify-start align-center fs24 mt20 widthpath">
  46. <view class="base-color-6 mr40">是否线下就诊</view>
  47. <view>{{moreInfo.isLine?'已线下就诊':'无'}}</view>
  48. </view>
  49. <view class="justify-start align-center fs24 mt20 widthpath" >
  50. <view class="base-color-6 mr40 ">体质</view>
  51. <view>{{moreInfo.constitution?moreInfo.constitution:'无'}}</view>
  52. </view>
  53. </view>
  54. <view class="justify-start align-center fs24 mt20" >
  55. <view class="base-color-6 mr40">使用药品</view>
  56. <view>{{moreInfo.medicine?moreInfo.medicine:'无'}}</view>
  57. </view>
  58. <view class="justify-start align-center fs24 mt20" >
  59. <view class="base-color-6 mr40">咨询产品</view>
  60. <view>{{moreInfo.consultProduct?moreInfo.consultProduct:'无'}}</view>
  61. </view>
  62. <view class="justify-start align-center fs24 mt20" >
  63. <view class="base-color-6 mr40">是否已经购买产品</view>
  64. <view>{{moreInfo.isBuy?'已购买':'无'}}</view>
  65. </view>
  66. </view>
  67. <view class="center bgf fs28">看课记录</view>
  68. <view class="bgf p20">
  69. <view class="justify-start ">
  70. <view v-for="(item,index) in titname" :key="index" class="justify-start align-center ml28">
  71. <view :style="{ backgroundColor: statusColors[index] || '#CCCCCC' }"
  72. class="w24 h24 radius4"></view>
  73. <view class="fs24 mr6 ml10">{{item}}</view>
  74. </view>
  75. </view>
  76. <view class="fs24 mt20 base-color-6" >近{{typestate==0?'7':'30'}}天看课记录</view>
  77. <view class="justify-between mt20">
  78. <view class="justify-start align-center mt12 " style="width: 80%;flex-wrap: wrap">
  79. <view class="w54 h54 mr20 radius4 mb12" v-for="(item,index) in answerlist" :key="index"
  80. >
  81. <view class="fs24 base-color-6">{{item.date.slice(-2)}}</view>
  82. <view :style="{ backgroundColor: statusColors[item.logType] || '#CCCCCC' }"
  83. class="w30 h30 radius4"></view>
  84. </view>
  85. </view>
  86. <view class="u-border lh45 plr20 fs24 radius40 base-color-3 h50"
  87. @click="todetail">{{typestate==0?'详情':'收起'}}</view>
  88. </view>
  89. <view class="pt120"></view>
  90. </view>
  91. <view class="justify-around botfun bgf">
  92. <view class="justify-start align-center bottom-btns base-bg"
  93. @click="navTo('/pages/user/courseManage?userId='+userId)" >
  94. <view class="colorf ml12">课程管理</view>
  95. </view>
  96. <view class="justify-start align-center bottom-btns base-bg"
  97. @click="navTo('/pages/user/UrgeClasses?userId='+userId)">
  98. <view class="colorf ml12" >催课管理</view>
  99. </view>
  100. </view>
  101. </view>
  102. </template>
  103. <script>
  104. import {
  105. getcustomerlist,
  106. getcustomer
  107. } from "@/api/user.js";
  108. import { getConfigSignature,getQwExternalContactDetails } from '@/api/common.js'
  109. export default {
  110. data() {
  111. return {
  112. typeOption: [{
  113. label: '全部',
  114. value: 0
  115. }, {
  116. label: '今天',
  117. value: 1
  118. }, {
  119. label: '昨天',
  120. value: 2
  121. }, {
  122. label: '前天',
  123. value: 3
  124. }, {
  125. label: '近七天',
  126. value: 4
  127. }],
  128. tabindex: 0,
  129. detailUser: [],
  130. user: [],
  131. answerlist:[],
  132. answerText:'禁用',
  133. id:'',
  134. dateTag:'',
  135. qwUserId:'',
  136. startTime:"",
  137. endTime:'',
  138. todayday: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
  139. moreInfo:{},
  140. statusColors: {
  141. 0: '#909399',
  142. 1: '#0bc6ff',
  143. 2: '#67c23a',
  144. 3: '#f55a4f',
  145. 4: '#ffd700',
  146. },
  147. titname:['未看课','看课中','完课','待看课','看课中断',],
  148. statelist:[
  149. { status: 4 },
  150. { status: 1 },
  151. { status: 2 },
  152. { status: 5 },
  153. { status: 3 },
  154. { status: 5 },
  155. { status: 3 },
  156. ],
  157. typestate:0,
  158. externalUserId:'',
  159. userId:''
  160. }
  161. },
  162. onShow() {
  163. this.getuser()
  164. // this.detailUser =uni.getStorageSync('detailUser')
  165. // if(this.detailUser.status==0){
  166. // this.answerText='取消禁用'
  167. // }
  168. this.qwUserId=uni.getStorageSync('qwUserId')
  169. this.$nextTick(()=>{
  170. setTimeout(()=>{
  171. this.getAnswerlists()
  172. },200)
  173. })
  174. },
  175. mounted() {
  176. },
  177. onLoad(option) {
  178. // this.id=option.id
  179. this.url=window.location.href;
  180. this.code=options.code;
  181. this.corpId=options.corpId;
  182. uni.setStorageSync("corpId",this.corpId);
  183. this.externalUserId=uni.getStorageSync("externalUserId");
  184. var userId=uni.getStorageSync("qwUserId");
  185. if(userId!=null&&userId!=undefined&&userId!=""){
  186. this.userId=userId;
  187. }
  188. this.getConfigSignature()
  189. if(this.externalUserId!=null&&this.externalUserId!=undefined&&this.userId!=null&&this.userId!=undefined){
  190. console.log("获取外部联系人")
  191. this.getQwExternalContactDetails()
  192. }
  193. },
  194. methods: {
  195. changeuser(){
  196. uni.navigateTo({
  197. url:'/pages/user/editUser?externalUserId='+this.externalUserId
  198. })
  199. },
  200. getQwExternalContactDetails(){
  201. var that=this
  202. var data = {
  203. corpId: this.corpId,
  204. userId:this.userId,
  205. externalUserId:this.externalUserId,
  206. };
  207. getQwExternalContactDetails(data).then(res => {
  208. if(res.code==200){
  209. this.user=res.data;
  210. }else{
  211. }
  212. });
  213. },
  214. getConfigSignature(){
  215. var data = {
  216. corpId: this.corpId,
  217. url: this.url,
  218. code: this.code
  219. };
  220. if(this.userId!=null){
  221. data.isGetUserId=0;
  222. }
  223. else{
  224. data.isGetUserId=1;
  225. }
  226. var that=this;
  227. // var obj={cmd:"log",data:"getConfigSignature开始"};
  228. // uni.$emit('sendMsg',obj);
  229. getConfigSignature(data).then(
  230. res => {
  231. console.log(res)
  232. // var obj={cmd:"log",data:JSON.stringify(res)};
  233. // uni.$emit('sendMsg',obj);
  234. if(res.code==200){
  235. that.isConfig=true;
  236. const agentConfigSignature = res.config.agentConfigSignature;
  237. const configSignature = res.config.configSignature;
  238. const corpId = res.config.corpId;
  239. const nonceStr = res.config.nonceStr;
  240. const timestamp = res.config.timestamp;
  241. const agentId = res.config.agentId;
  242. if(res.config.userid!=null&&res.config.userid!=''){
  243. that.userId = res.config.userid;//当前员工ID
  244. uni.setStorageSync("qwUserId",that.userId);
  245. console.log("获取到USERID")
  246. }
  247. else{
  248. console.log("不需要获取USERID")
  249. }
  250. console.log(this.userId)
  251. jWeixin.config({
  252. beta: true,
  253. debug: false,
  254. appId: corpId,
  255. timestamp: timestamp,
  256. nonceStr: nonceStr,
  257. signature: configSignature,
  258. jsApiList: ['getCurExternalContact','sendChatMessage','openEnterpriseChat']
  259. });
  260. // const newSignature={
  261. // 'timestamp':timestamp,
  262. // 'nonceStr':nonceStr,
  263. // 'signature':configSignature,
  264. // }
  265. // ww.register({
  266. // corpId: corpId, // 必填,当前用户企业所属企业ID
  267. // jsApiList: ['openEnterpriseChat'], // 必填,需要使用的JSAPI列表
  268. // newSignature // 必填,根据url生成企业签名的回调函数
  269. // })
  270. jWeixin.ready(() => {
  271. jWeixin.agentConfig({
  272. corpid: corpId,
  273. agentid: agentId,
  274. timestamp: timestamp,
  275. nonceStr: nonceStr,
  276. signature: agentConfigSignature,
  277. jsApiList: ['getCurExternalContact','sendChatMessage','openEnterpriseChat'],
  278. success: (res) => {
  279. jWeixin.invoke('getCurExternalContact', {}, async (res) => {
  280. if (res.err_msg === "getCurExternalContact:ok") {
  281. that.externalUserId = res.userId;
  282. uni.setStorageSync("externalUserId",res.userId)
  283. that.getQwExternalContactDetails()
  284. // that.initInterval=setInterval(function(){
  285. // if(that.isInit){
  286. // clearInterval(that.initInterval);
  287. // that.getQwSopLogsByJsApi();
  288. // }
  289. // },200)
  290. } else {
  291. // 错误处理
  292. }
  293. });
  294. // jWeixin.openEnterpriseChat({
  295. // // 注意:userIds和externalUserIds至少选填一个。内部群最多2000人;外部群最多500人;如果有微信联系人,最多40人
  296. // externalUserIds: 'wmfFKfDQAAhvgwhJr9fqkRWjvN0CzFcA', // 参与会话的外部联系人列表,格式为userId1;userId2;…,用分号隔开。
  297. // groupName: '', // 会话名称。单聊时该参数传入空字符串""即可。
  298. // chatId: "", // 若要打开已有会话,需指定此参数。如果是新建会话,chatId必须为空串
  299. // success: function(res) {
  300. // var chatId = res.chatId; //返回当前群聊ID,仅当使用agentConfig注入该接口权限时才返回chatId
  301. // // 回调
  302. // that.externalUserId=res.chatId;
  303. // console.log(res)
  304. // setTimeout(function(){
  305. // jWeixin.invoke('sendChatMessage', {
  306. // msgtype:"news", //消息类型,必填
  307. // enterChat: true,
  308. // text: {
  309. // content:"你好11111111111111111", //文本内容
  310. // },
  311. // news:
  312. // {
  313. // link: "https://www.baidu.com/", //H5消息页面url 必填
  314. // title: "百度一下", //H5消息标题
  315. // desc: "百度一下你就知道", //H5消息摘要
  316. // imgUrl: "https://cos.his.cdwjyyh.com/fs/20240914/efc6995ee755489b8a3e0c8413846a4e.jpg", //H5消息封面图片URL
  317. // },
  318. // }, function(res) {
  319. // if (res.err_msg == 'sendChatMessage:ok') {
  320. // //发送成功
  321. // uni.showToast({
  322. // title: "回车发送",
  323. // icon: 'none',
  324. // });
  325. // }
  326. // })
  327. // },500);
  328. // },
  329. // fail: function(res) {
  330. // if(res.errMsg.indexOf('function not exist') > -1){
  331. // alert('版本过低请升级')
  332. // }
  333. // }
  334. // });
  335. },
  336. fail: (res) => {
  337. console.error('agentConfig fail:', res);
  338. },
  339. });
  340. });
  341. jWeixin.error((res) => {
  342. console.error('wx.error:', res);
  343. });
  344. }
  345. else{
  346. // uni.setStorageSync("qwUserId",null);
  347. console.log("获取USERID失败")
  348. // setTimeout(function(){
  349. // window.location.reload();
  350. // },5000);
  351. }
  352. },
  353. rej => {
  354. setTimeout(function(){
  355. window.location.reload();
  356. },5000);
  357. }
  358. );
  359. },
  360. todetail(){
  361. if(this.typestate==0){
  362. this.typestate=1
  363. }else{
  364. this.typestate=0
  365. }
  366. this.getAnswerlists()
  367. },
  368. getuser(){
  369. const data={
  370. qwExternalContactId:this.externalUserId
  371. }
  372. getcustomer(data).then(res=>{
  373. if (res.code == 200) {
  374. this.detailUser=res.data
  375. this.moreInfo=res.moreInfo
  376. } else {
  377. uni.showToast({
  378. icon: 'none',
  379. title: res.msg
  380. })
  381. }
  382. })
  383. },
  384. getAnswerlists() {
  385. const params = {
  386. type:this.typestate,
  387. qwExternalContactId:this.externalUserId
  388. }
  389. getcustomerlist(params).then(res => {
  390. if (res.code == 200) {
  391. this.answerlist=res.data.data
  392. } else {
  393. uni.showToast({
  394. icon: 'none',
  395. title: res.msg
  396. })
  397. }
  398. })
  399. },
  400. navTo(url){
  401. uni.navigateTo({
  402. url
  403. })
  404. },
  405. }
  406. }
  407. </script>
  408. <style lang="scss" scoped>
  409. .widthpath {
  410. width: 50%;
  411. }
  412. .topBgline {
  413. background: linear-gradient(to right, rgba(225, 238, 255, 1), rgba(223, 224, 254, 1));
  414. padding-top: 40rpx;
  415. }
  416. .bgcolf {
  417. background: rgba(255, 255, 255, 0.4);
  418. }
  419. .actsel {
  420. background-color: #1773ff;
  421. color: #fff;
  422. transition: background-color 0.4s ease-in-out;
  423. }
  424. .notact {
  425. background-color: #f8f8f8;
  426. }
  427. .livebox {
  428. width: calc(50% - 10rpx);
  429. background-color: #f8f8f8;
  430. padding: 20rpx 10rpx;
  431. border-radius: 12rpx;
  432. }
  433. .liveboxs {
  434. width: calc(33% - 10rpx);
  435. background-color: #f8f8f8;
  436. padding: 20rpx 10rpx;
  437. border-radius: 12rpx;
  438. }
  439. .bottom-btns {
  440. padding: 10rpx 40rpx;
  441. border-radius: 50rpx;
  442. }
  443. .botfun {
  444. position: fixed;
  445. width: 100%;
  446. bottom: 0rpx;
  447. padding: 20rpx 0;
  448. }
  449. </style>