user.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. <template>
  2. <view>
  3. <view :class="'mine' + (skinNotColor ? ' not-color' : '')+(config.greyTheme==1?' grayTheme':'')">
  4. <view :style="'height:' + systems.barHeight + 'rpx;'"></view>
  5. <view
  6. :style="'top:' + systems.ktxStatusHeight + 'rpx;z-index:3;position: absolute;'+'line-height: '+ systems.navigationHeight+'rpx;text-align: center;left: 0;font-size: 34rpx;right: 0;color: #FFFFFF;'">
  7. 我的
  8. </view>
  9. <image src="../../static/pages/images/userBg.png" class="wdbg" @click="jumpUrl('mine/userinfo/userinfo')">
  10. </image>
  11. <view class="minec">
  12. <view class="minec-img" @click="jumpUrl('mine/userinfo/userinfo')">
  13. <image :src="userInfos.avatar ? userInfos.avatar : '/static/pages/images/userimg.png'"
  14. mode="aspectFit" class="user"></image>
  15. </view>
  16. <view class="mines" @click="jumpUrl('mine/userinfo/userinfo')" v-if="isLogin">
  17. <view class="ddflex">
  18. {{ userInfos.nickName }}
  19. <view class="ddflex" style="font-size: 24rpx;font-weight: 400;" @click.stop="isShowBind=true" v-if="userInfos.userType!=1">
  20. <image style="width: 23rpx;height: 22rpx;margin-right: 10rpx;" src="/static/images/bind.png" class="auth-img"></image>
  21. 绑定工号
  22. </view>
  23. </view>
  24. <text class="edu" v-if="userInfos.mobile">{{ userInfos.mobile }}</text>
  25. </view>
  26. <view class="flex" v-else><text class="login-btn" @click="jumpUrl('')">点击登录</text></view>
  27. <view class="rule dflex" @click="isSign == 0 || sign == 1 ? jumpUrl('') : signFun()" v-if="isShowSign">
  28. <image src="/static/pages/images/qdico.png"></image>
  29. {{ !isLogin ? '签到' : isSign == 0 || sign == 1 ? '已签到' : '签到' }}
  30. </view>
  31. <!-- </navigator> -->
  32. </view>
  33. <view class="datas dflex">
  34. <!-- @click="jumpUrl('mine/coupons/coupons')" -->
  35. <navigator url="" hover-class="none" class="li" @click="jumpUrl('mine/collect/collect')">
  36. <text>{{ myCount.matchNo ? myCount.matchNo : '0' }}</text>
  37. 我的收藏
  38. </navigator>
  39. <navigator url="" hover-class="none" class="li" @click="jumpUrl('mine/follow/index')">
  40. <text>{{ myCount.followNo ? myCount.followNo : '0' }}</text>
  41. 我的关注
  42. </navigator>
  43. <navigator url="" hover-class="none" class="li"
  44. @click="jumpUrl('match/activity/activity')">
  45. <text>{{ myCount.enlistMatchNo ? myCount.enlistMatchNo : '0' }}</text>
  46. 参与活动
  47. </navigator>
  48. <!-- <navigator url="/mine/footprint/footprint" hover-class="none" class="li"><text>{{footprint?footprint:'0'}}</text>足迹</navigator> -->
  49. </view>
  50. <view style="height: 80rpx;"></view>
  51. </view>
  52. <view :class="(config.greyTheme==1?' grayTheme':'')">
  53. <view class="con" style="margin-top: -80rpx;" v-if="userInfos.userType!=1">
  54. <view class="order">
  55. <navigator url="" hover-class="none" class="tits dflex" @click="jumpUrl('match/activity/activity')">
  56. <view class="flex">我的活动</view>
  57. 全部活动
  58. <image src="../../static/pages/images/more.png" class="rico"></image>
  59. </navigator>
  60. <view class="ddflex" style="justify-content: space-between;padding: 40rpx 0rpx;">
  61. <view class="order-item ddflex fflex" @click="jumpUrl('match/activity/activity?current=2')">
  62. <image src="/static/images/hd_dcy.png"></image>
  63. <view>待参与</view>
  64. </view>
  65. <vieW class="order-line"></vieW>
  66. <view class="order-item ddflex fflex" @click="jumpUrl('match/activity/activity?current=3')">
  67. <image src="/static/images/hd_ywc.png"></image>
  68. <view>已完成</view>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. <view class="con" style="margin-top: -80rpx;" v-else>
  74. <view class="order">
  75. <view class="ddflex" style="justify-content: space-between;padding: 40rpx 0rpx;">
  76. <view class="order-item ddflex fflex" @click="jumpUrl('match/activityManage/activityManage')">
  77. <image src="/static/images/hdgl.png"></image>
  78. <view>活动管理</view>
  79. </view>
  80. <vieW class="order-line"></vieW>
  81. <view class="order-item ddflex fflex" @click="jumpUrl('library/poster/index')">
  82. <image src="/static/images/hbtg.png"></image>
  83. <view>海报推广</view>
  84. </view>
  85. <vieW class="order-line"></vieW>
  86. <view class="order-item ddflex fflex" @click="jumpUrl('library/page/page')">
  87. <image src="/static/images/yxdy.png"></image>
  88. <view>营销单页</view>
  89. </view>
  90. </view>
  91. </view>
  92. </view>
  93. <view class="con" v-if="!userInfos.userType&&recommendCard">
  94. <view class="order">
  95. <navigator url="" hover-class="none" class="tits dflex" @click="jumpUrl('mine/order/order')">
  96. <view class="flex">我的顾问</view>
  97. </navigator>
  98. <view class="service-person">
  99. <view class="dflex" @click="jumpUrl('/card/index/index')">
  100. <image class="service-person-header" :src="recommendCard.avatar?recommendCard.avatar:'../../static/pages/images/userimg.png'"></image>
  101. <view class="fflex">
  102. <view class="dflex">
  103. <view class="fflex">
  104. <view class="service-person-name ddflex">
  105. <view>Hi~我是{{recommendCard.realName}}</view>
  106. <image src="/static/images/rico2.png" class="rico"></image>
  107. </view>
  108. <view class="service-person-number">(工号:{{recommendCard.jobNumber}}) 您的1V1专属保险顾问</view>
  109. </view>
  110. <view class="service-person-btn" @click="jumpSingleChatRoom()">在线咨询</view>
  111. </view>
  112. <view class="service-person-options ddflex">
  113. <view class="service-person-option ddflex">
  114. <image src="/static/pages/images/dz_hui.png"></image>
  115. <view>{{recommendCard.favorableComment}}%</view>
  116. </view>
  117. <view class="service-person-option ddflex">
  118. <image src="/static/pages/images/cy_hui.png"></image>
  119. <view>入司{{recommendCard.inDate?monthDayDiff(recommendCard.inDate):'1年'}}</view>
  120. </view>
  121. <view class="service-person-option ddflex">
  122. <image src="/static/pages/images/fw_hui.png"></image>
  123. <view>为{{recommendCard.cntCust?recommendCard.cntCust:0}}人服务</view>
  124. </view>
  125. </view>
  126. </view>
  127. </view>
  128. <view class="service-person-phone ddflex">
  129. <view class="ddflex flex" style="justify-content: center;" @click.stop="callPhone(recommendCard.phone)">
  130. <image src="/static/pages/images/phone1.png"></image>
  131. <view>联系电话</view>
  132. </view>
  133. <view class="order-line" v-if="recommendCard.phone&&recommendCard.wechat"></view>
  134. <view class="ddflex flex" style="justify-content: center;" @click.stop="isShowCodePop=true">
  135. <image style="width: 35rpx;height: 28rpx;" src="/static/pages/images/qw.png"></image>
  136. <view>加微信</view>
  137. </view>
  138. </view>
  139. </view>
  140. </view>
  141. </view>
  142. <!-- url="/promote/invite/invite" -->
  143. <view class="box mlist" v-if="userInfos.userType!=1">
  144. <button class="li ddflex" open-type="share">
  145. <image src="/static/images/yqhy.png" class="mico"></image>
  146. <view class="fflex">推荐好友</view>
  147. <image src="../../static/pages/images/more.png" class="rico"></image>
  148. </button>
  149. </view>
  150. <view class="box mlist" v-else>
  151. <navigator class="li ddflex" @click="toCard()" hover-class="none">
  152. <image src="/static/images/wdmp.png" class="mico"></image>
  153. <view class="fflex">我的名片</view>
  154. <image src="../../static/pages/images/more.png" class="rico"></image>
  155. </navigator>
  156. </view>
  157. <view class="box mlist">
  158. <view class="li ddflex">
  159. <view class="fflex">
  160. <contact-button class-name="ddflex" img-url="/static/images/lxkf.png"
  161. img-style='width: 49rpx;height: 49rpx;margin: 0 25rpx 0 0;' button-text="联系客服"
  162. styles="line-height:initial;"></contact-button>
  163. </view>
  164. <image src="../../static/pages/images/more.png" class="rico"></image>
  165. </view>
  166. <navigator class="li ddflex" url="/mine/help/help" hover-class="none">
  167. <image src="/static/images/bzzx.png" class="mico" mode="aspectFit"></image>
  168. <view class="fflex">帮助中心</view>
  169. <image src="../../static/pages/images/more.png" class="rico"></image>
  170. </navigator>
  171. <navigator class="li ddflex" url="/mine/feedback/feedback" hover-class="none">
  172. <image src="/static/images/jyfk.png" class="mico"></image>
  173. <view class="fflex">建议与反馈</view>
  174. <image src="../../static/pages/images/more.png" class="rico"></image>
  175. </navigator>
  176. <navigator class="li ddflex" url="/pages/about/about" hover-class="none">
  177. <image src="/static/images/gywm.png" class="mico"></image>
  178. <view class="fflex">关于中国人寿</view>
  179. <image src="../../static/pages/images/more.png" class="rico"></image>
  180. </navigator>
  181. <navigator class="li ddflex" url="/mine/set/set" hover-class="none">
  182. <image src="/static/images/setting.png" class="mico"></image>
  183. <view class="fflex">设置中心</view>
  184. <image src="../../static/pages/images/more.png" class="rico"></image>
  185. </navigator>
  186. </view>
  187. </view>
  188. <!-- <footer-copyright></footer-copyright> -->
  189. <view style="height: 80rpx;"></view>
  190. <!-- <view class="placeholder-view" :style="'height:' + (bottomBlankHeignt + 115) + 'rpx'"></view> -->
  191. <foot channel="user"></foot>
  192. <update-userinfo :update-info="isUpdateInfo" :update-mobile="isUpdateMobile" v-if="isShowUpdate"
  193. @closeUpdate="closeUpdate" @updateInfo="updateInfo" @updateMobile="updateMobile"></update-userinfo>
  194. <msgNumber bottom="230rpx"></msgNumber>
  195. <view class="ceng2" v-if="isShowCodePop" @click="isShowCodePop = false" @touchmove.stop.prevent="moveHandle"></view>
  196. <view class="code-pop" v-if="isShowCodePop">
  197. <view class="code-content" v-if="recommendCard.wechatCode">
  198. <image :src="recommendCard.wechatCode?recommendCard.wechatCode:'/static/images/wxCode.jpg'" show-menu-by-longpress="true"></image>
  199. <view style="text-align: center;font-size: 24rpx;color: #999;margin-bottom: 50rpx;">长按识别微信二维码</view>
  200. </view>
  201. <view class="code-text" v-else>
  202. <view>微信号</view>
  203. <view>{{recommendCard.wechat}}</view>
  204. </view>
  205. <view class="code-btn" @click="copy(recommendCard.wechat)">
  206. 复制微信号
  207. </view>
  208. </view>
  209. <bindJobnum v-if="isShowBind" @closeBind="closeBind()"></bindJobnum>
  210. </view>
  211. </template>
  212. <script>
  213. // pages/user/user.js
  214. const app = getApp();
  215. const req = require('../../utils/request.js');
  216. const util = require('../../utils/util.js');
  217. const route = require('../../utils/route');
  218. import foot from '../../components/nav-bar/index';
  219. import footerCopyright from '../../components/footer-copyright/footer-copyright';
  220. import bindJobnum from '../../components/bind-jobnum/index.vue';
  221. import msgNumber from '../../components/msg-number/index.vue';
  222. export default {
  223. data() {
  224. return {
  225. systems: {},
  226. skinNotColor: req.public.skinNotColor,
  227. picUrlss: req.public.picUrls,
  228. bottomBlankHeignt: app.globalData.isIPhoneX ? 68 : 0,
  229. // merchantId: '',
  230. iconSrc: req.public.iconSrc,
  231. //头部页面背景链接
  232. isHideVip: true,
  233. //隐藏会员
  234. isVip: true,
  235. //是否是会员
  236. IS_secondary_members: 0,
  237. distr: '',
  238. userinfovip: '',
  239. userMoney: '',
  240. istetphone: '',
  241. logo: '',
  242. name: '',
  243. is_open_wallet: '',
  244. Open_Points_Mall: '',
  245. statistics: '',
  246. vipList: '',
  247. rongkang: req.header.appId,
  248. isSign: '',
  249. sign: 0,
  250. isLogin: false,
  251. noLogin: false,
  252. is_open_shop: '',
  253. isShowSign: false, //是否显示签到按钮
  254. config: {},
  255. userInfo: {},
  256. userInfos: {},
  257. isShowUpdate: false, //是否显示更新信息弹窗
  258. isUpdateInfo: false, //更新用户信息
  259. isUpdateMobile: false, //绑定手机号
  260. recommendCard:'',
  261. isShowCodePop:false,
  262. isShowBind:false,
  263. myCount:{
  264. enlistMatchNo:0,
  265. followNo:0,
  266. matchNo:0
  267. }
  268. };
  269. },
  270. components: {
  271. foot,
  272. footerCopyright,
  273. bindJobnum,
  274. msgNumber
  275. },
  276. props: {},
  277. onLoad(options) {
  278. uni.hideTabBar();
  279. uni.setNavigationBarColor({
  280. frontColor: this.skinNotColor ? '#000' : '#ffffff',
  281. backgroundColor: this.skinNotColor ? '#fff' : req.public.titleTopBgColor
  282. });
  283. if (JSON.parse(req.getStorage('configRes')).IS_secondary_members) {
  284. let IS_secondary_members = JSON.parse(req.getStorage('configRes')).IS_secondary_members;
  285. console.log(IS_secondary_members);
  286. this.setData({
  287. IS_secondary_members: IS_secondary_members
  288. });
  289. }
  290. this.userInfo = req.getStorage('userInfo');
  291. // #ifdef MP-WEIXIN
  292. let userInfo = req.getStorage('userInfo');
  293. if (req.isAuth()) {
  294. setTimeout(res => {
  295. if (!userInfo.avatar || userInfo.nickName == '微信用户' || this.userInfos.nickName == '微信用户') {
  296. this.isShowUpdate = true;
  297. this.isUpdateInfo = true;
  298. }
  299. if (userInfo.avatar && !userInfo.mobile && (this.userInfos && !this.userInfos.mobile)) {
  300. this.isShowUpdate = true;
  301. this.isUpdateMobile = true;
  302. }
  303. }, 2000);
  304. }
  305. // #endif
  306. },
  307. onShow: function() {
  308. let userInfo = req.getStorage('userInfo');
  309. this.isLogin = req.isLogins(false);
  310. if (this.isLogin) {
  311. this.getMy();
  312. this.getAbout();
  313. this.getMyCount()
  314. this.noLogin = true;
  315. } else {
  316. this.noLogin = false;
  317. }
  318. },
  319. onShareAppMessage(res) {
  320. if (res.from == 'button') {
  321. let userInfo = req.getStorage('userInfo');
  322. return {
  323. title: userInfo.nickName+'邀请您加入'+this.config.CONFIG_PROJECT_TITLE,
  324. path: '/pages/index/index',
  325. imageUrl: this.config.CONFIG_PROJECT_LOGO, // 分享图
  326. };
  327. }
  328. },
  329. methods: {
  330. jumpUrl(url) {
  331. if (req.isLogins(true)) {
  332. app.globalData.navigateTo(url);
  333. }
  334. },
  335. jumpMerchantManage() {
  336. let token = req.getStorage('AUTH_TOKEN');
  337. this.jumpUrl('merchant/index?appId=' + req.header.appId + '&token=' + token);
  338. },
  339. gouserInfo() {
  340. app.globalData.navigateTo('mine/userinfo/userinfo');
  341. },
  342. getMy() {
  343. let that = this;
  344. req.getRequest('/api/user/info', {}, data => {
  345. // data.merchantId = req.getStorage('userInfo').merchantId
  346. data.nickName = req.excludeSpecial(data.nickName);
  347. this.userInfos = data;
  348. // that.setData(data); // this.isbindmobile();
  349. console.log('userinfo==' + JSON.stringify(data));
  350. this.getRecommendCard()
  351. // console.log(this);
  352. });
  353. },
  354. getAbout() {
  355. var _this = this;
  356. req.getRequest('/api/other/config', {}, function(res) {
  357. _this.phone = res.CONFIG_SERVICE_HOT_MOBILE;
  358. _this.config = res;
  359. _this.setData({
  360. istetphone: res.user_bind_mobile,
  361. logo: res.CONFIG_PROJECT_LOGO,
  362. name: res.CONFIG_PROJECT_TITLE
  363. });
  364. // console.log(res);
  365. if (res && res.is_open_wallet) {
  366. _this.setData({
  367. is_open_wallet: JSON.parse(res.is_open_wallet)
  368. });
  369. }
  370. if (res.is_open_shop) {
  371. _this.is_open_shop = res.is_open_shop;
  372. }
  373. });
  374. },
  375. callPhone() {
  376. if (req.isLogins(true)) {
  377. uni.makePhoneCall({
  378. phoneNumber: this.phone
  379. });
  380. }
  381. },
  382. goUrl() {
  383. app.globalData.openPage('mine/vip/vip');
  384. },
  385. showInfo(index) {
  386. if (!this.vipList[index].isShowInfo) {
  387. this.vipList.map(it => {
  388. it.isShowInfo = false;
  389. return it;
  390. });
  391. }
  392. this.vipList[index].isShowInfo = !this.vipList[index].isShowInfo;
  393. },
  394. closeUpdate() {
  395. this.isShowUpdate = false;
  396. },
  397. updateInfo(e) {
  398. this.isUpdateInfo = e;
  399. this.getMy();
  400. },
  401. updateMobile(e) {
  402. this.isUpdateMobile = e;
  403. this.getMy();
  404. },
  405. closeBind(){
  406. this.isShowBind = false;
  407. },
  408. // 判断强制绑定手机号
  409. // isbindmobile() {
  410. // if (req.getStorage('configRes')) {
  411. // let configRes = JSON.parse(req.getStorage('configRes'))
  412. // this.setData({ istetphone: configRes.user_bind_mobile, logo: configRes.CONFIG_PROJECT_LOGO, name: configRes.CONFIG_PROJECT_TITLE })
  413. // } else {
  414. // req.g('/api/config', (res) => {
  415. // req.setStorage('configRes', JSON.stringify(res))
  416. // this.setData({ istetphone: res.user_bind_mobile, logo: res.CONFIG_PROJECT_LOGO, name: res.CONFIG_PROJECT_TITLE })
  417. // })
  418. // }
  419. // if(this.data.istetphone=='1'){
  420. // // 获取用户手机号
  421. // let userInfo= req.getStorage('userInfo')
  422. // if(userInfo.mobile==null||userInfo.mobile==''){
  423. // console.log("获取用户手机号===============================")
  424. // app.openPage('pages/authorize/authorize?bindmobile=1')
  425. // }
  426. // }
  427. // },
  428. // 获取推荐销售
  429. getRecommendCard(){
  430. if(this.userInfos.userType==1){
  431. req.getRequest('/api/visiting/card/userInfo',{},res=>{
  432. this.recommendCard = res
  433. })
  434. }else{
  435. if(this.userInfos.manageSaleNo){
  436. req.getRequest('/api/visiting/card/recommendCardInfo',{},res=>{
  437. this.recommendCard = res
  438. })
  439. }else{
  440. this.recommendCard = ''
  441. }
  442. }
  443. },
  444. monthDayDiff(date){
  445. return util.monthDayDiff(date)
  446. },
  447. // 拨打电话
  448. callPhone(val) {
  449. if(!val) return false
  450. uni.makePhoneCall({
  451. phoneNumber: val
  452. });
  453. },
  454. copy(val){
  455. this.isShowCodePop = false
  456. uni.setClipboardData({
  457. data: val,
  458. complete() {
  459. req.msg('复制成功')
  460. }
  461. })
  462. },
  463. jumpSingleChatRoom() {
  464. if (this.recommendCard) {
  465. req.jumpSingleChatRoom(this.recommendCard.userId, this.recommendCard.avatar, this.recommendCard
  466. .realName);
  467. }
  468. },
  469. getMyCount(){
  470. req.getRequest('/api/my/count',{},res=>{
  471. this.myCount = res
  472. })
  473. },
  474. toCard(){
  475. if(this.recommendCard){
  476. if(this.recommendCard.auditState==0){
  477. // 待审核
  478. this.jumpUrl('card/success/success?state=0')
  479. return false
  480. }else if(this.recommendCard.auditState==1){
  481. // 审核成功
  482. this.jumpUrl('card/success/success?state=1')
  483. return false
  484. }else if(this.recommendCard.auditState==2){
  485. // 审核失败
  486. this.jumpUrl('card/success/success?state=2&&msg='+this.recommendCard.auditFailReason)
  487. return false
  488. }
  489. }else{
  490. this.jumpUrl('card/create/create')
  491. }
  492. }
  493. },
  494. created() {
  495. const systemInfo = uni.getSystemInfoSync();
  496. // px转换到rpx的比例
  497. let pxToRpxScale = 750 / systemInfo.windowWidth;
  498. let systems = {
  499. ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
  500. navigationHeight: 44 * pxToRpxScale // 导航栏的高度
  501. };
  502. systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
  503. this.systems = systems;
  504. }
  505. };
  506. </script>
  507. <style>
  508. @import './user.css';
  509. </style>