customerDetail.vue 13 KB

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