user.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  1. <template>
  2. <view>
  3. <view :class="'mine' + (skinNotColor ? ' not-color' : '')">
  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. <navigator url="" hover-class="none" class="li" v-if="is_open_wallet.isOpenWallet == 1"
  35. @click="jumpUrl('wallet/index/index')">
  36. <text>{{ userMoney ? userMoney : '0.00' }}</text>
  37. 钱包
  38. </navigator>
  39. <navigator url="" hover-class="none" class="li"
  40. :style="is_open_wallet.isOpenWallet != 1 && Open_Points_Mall != 1 ? 'width:50%' : ''"
  41. @click="jumpUrl('mine/coupons/coupons')">
  42. <text>{{ userInfos.coupon ? userInfos.coupon : '0' }}</text>
  43. 优惠券
  44. </navigator>
  45. <navigator url="" hover-class="none" class="li" @click="jumpUrl('integralshop/index/index')">
  46. <text>{{ userInfos.integral ? userInfos.integral : '0' }}</text>
  47. 积分
  48. </navigator>
  49. <navigator url="" hover-class="none" class="li"
  50. :style="is_open_wallet.isOpenWallet != 1 && Open_Points_Mall != 1 ? 'width:50%' : ''"
  51. @click="jumpUrl('mine/collect/collect')">
  52. <text>{{ userInfos.collect ? userInfos.collect : '0' }}</text>
  53. 收藏
  54. </navigator>
  55. <!-- <navigator url="/mine/footprint/footprint" hover-class="none" class="li"><text>{{footprint?footprint:'0'}}</text>足迹</navigator> -->
  56. </view>
  57. <view style="height: 80rpx;"></view>
  58. </view>
  59. <view class="con" style="margin-top: -80rpx;" v-if="userInfos.userType!=1">
  60. <view class="order">
  61. <navigator url="" hover-class="none" class="tits dflex" @click="jumpUrl('match/activity/activity')">
  62. <view class="flex">我的活动</view>
  63. 全部活动
  64. <image src="../../static/pages/images/more.png" class="rico"></image>
  65. </navigator>
  66. <view class="ddflex" style="justify-content: space-between;padding: 40rpx 0rpx;">
  67. <view class="order-item ddflex fflex" @click="jumpUrl('match/activity/activity?current=2')">
  68. <image src="/static/images/hd_dcy.png"></image>
  69. <view>待参与</view>
  70. </view>
  71. <vieW class="order-line"></vieW>
  72. <view class="order-item ddflex fflex" @click="jumpUrl('match/activity/activity?current=3')">
  73. <image src="/static/images/hd_ywc.png"></image>
  74. <view>已完成</view>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. <view class="con" style="margin-top: -80rpx;" v-else>
  80. <view class="order">
  81. <view class="ddflex" style="justify-content: space-between;padding: 40rpx 0rpx;">
  82. <view class="order-item ddflex fflex" @click="jumpUrl('match/activityManage/activityManage')">
  83. <image src="/static/images/hdgl.png"></image>
  84. <view>活动管理</view>
  85. </view>
  86. <vieW class="order-line"></vieW>
  87. <view class="order-item ddflex fflex" @click="jumpUrl('library/poster/index')">
  88. <image src="/static/images/hbtg.png"></image>
  89. <view>海报推广</view>
  90. </view>
  91. <vieW class="order-line"></vieW>
  92. <view class="order-item ddflex fflex" @click="jumpUrl('library/page/page')">
  93. <image src="/static/images/yxdy.png"></image>
  94. <view>营销单页</view>
  95. </view>
  96. </view>
  97. </view>
  98. </view>
  99. <view class="con" v-if="!userInfos.userType">
  100. <view class="order">
  101. <navigator url="" hover-class="none" class="tits dflex" @click="jumpUrl('mine/order/order')">
  102. <view class="flex">我的顾问</view>
  103. </navigator>
  104. <view class="service-person">
  105. <view class="ddflex" @click="jumpUrl('/card/index/index')">
  106. <image class="service-person-header" :src="recommendCard.avatar?recommendCard.avatar:'../../static/pages/images/userimg.png'"></image>
  107. <view>
  108. <view class="service-person-name ddflex">
  109. <view>Hi~我是{{recommendCard.realName}}</view>
  110. <image src="/static/images/rico2.png" class="rico"></image>
  111. </view>
  112. <view class="service-person-number">(工号:{{recommendCard.jobNumber}}) 欢迎您来到我的微页</view>
  113. <view class="service-person-options ddflex">
  114. <view class="service-person-option ddflex">
  115. <image src="/static/pages/images/dz_hui.png"></image>
  116. <view>{{recommendCard.favorableComment}}%</view>
  117. </view>
  118. <view class="service-person-option ddflex">
  119. <image src="/static/pages/images/cy_hui.png"></image>
  120. <view>入司{{recommendCard.inDate?getAgeFn(recommendCard.inDate):1}}年</view>
  121. </view>
  122. <view class="service-person-option ddflex">
  123. <image src="/static/pages/images/fw_hui.png"></image>
  124. <view>为{{recommendCard.cntCust?recommendCard.cntCust:0}}人服务</view>
  125. </view>
  126. </view>
  127. </view>
  128. </view>
  129. <view class="service-person-phone ddflex">
  130. <view class="ddflex flex" style="justify-content: center;" @click.stop="callPhone(recommendCard.phone)">
  131. <image src="/static/pages/images/phone1.png"></image>
  132. <view>联系电话</view>
  133. </view>
  134. <view class="order-line" v-if="recommendCard.phone&&recommendCard.wechat"></view>
  135. <view class="ddflex flex" style="justify-content: center;" @click.stop="isShowCodePop=true">
  136. <image style="width: 35rpx;height: 28rpx;" src="/static/pages/images/qw.png"></image>
  137. <view>加企微信</view>
  138. </view>
  139. </view>
  140. </view>
  141. </view>
  142. </view>
  143. <view class="box mlist" v-if="userInfos.userType!=1">
  144. <navigator class="li ddflex" url="/promote/invite/invite" hover-class="none">
  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. </navigator>
  149. </view>
  150. <view class="box mlist" v-else>
  151. <navigator class="li ddflex" url="/card/index/index" 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. </view>
  182. <footer-copyright></footer-copyright>
  183. <!-- <view class="placeholder-view" :style="'height:' + (bottomBlankHeignt + 115) + 'rpx'"></view> -->
  184. <foot channel="user"></foot>
  185. <update-userinfo :update-info="isUpdateInfo" :update-mobile="isUpdateMobile" v-if="isShowUpdate"
  186. @closeUpdate="closeUpdate" @updateInfo="updateInfo" @updateMobile="updateMobile"></update-userinfo>
  187. <view class="lt ddflex" @click="jumpConversation()">
  188. <view class="ddflex" style="position: relative;width: 100%;height: 100%;">
  189. <image src="../../static/pages/images/lt.png"></image>
  190. <view class="lt-num" v-if="getMsgNumber()>0">{{getMsgNumber()}}</view>
  191. </view>
  192. </view>
  193. <view class="ceng2" v-if="isShowCodePop" @click="isShowCodePop = false" @touchmove.stop.prevent="moveHandle"></view>
  194. <view class="code-pop" v-if="isShowCodePop">
  195. <view class="code-content" v-if="recommendCard.wechatCode">
  196. <image :src="recommendCard.wechatCode?recommendCard.wechatCode:'/static/images/wxCode.jpg'" show-menu-by-longpress="true"></image>
  197. <view style="text-align: center;font-size: 24rpx;color: #999;margin-bottom: 50rpx;">长按识别微信二维码</view>
  198. </view>
  199. <view class="code-text" v-else>
  200. <view>微信号</view>
  201. <view>{{recommendCard.wechat}}</view>
  202. </view>
  203. <view class="code-btn" @click="copy(recommendCard.wechat)">
  204. 复制微信号
  205. </view>
  206. </view>
  207. <bindJobnum v-if="isShowBind" @closeBind="closeBind()"></bindJobnum>
  208. </view>
  209. </template>
  210. <script>
  211. // pages/user/user.js
  212. const app = getApp();
  213. const req = require('../../utils/request.js');
  214. const util = require('../../utils/util.js');
  215. const route = require('../../utils/route');
  216. import foot from '../../components/nav-bar/index';
  217. import footerCopyright from '../../components/footer-copyright/footer-copyright';
  218. import bindJobnum from '../../components/bind-jobnum/index.vue';
  219. export default {
  220. data() {
  221. return {
  222. systems: {},
  223. skinNotColor: req.public.skinNotColor,
  224. picUrlss: req.public.picUrls,
  225. bottomBlankHeignt: app.globalData.isIPhoneX ? 68 : 0,
  226. // merchantId: '',
  227. iconSrc: req.public.iconSrc,
  228. //头部页面背景链接
  229. isHideVip: true,
  230. //隐藏会员
  231. isVip: true,
  232. //是否是会员
  233. IS_secondary_members: 0,
  234. distr: '',
  235. userinfovip: '',
  236. userMoney: '',
  237. istetphone: '',
  238. logo: '',
  239. name: '',
  240. is_open_wallet: '',
  241. Open_Points_Mall: '',
  242. statistics: '',
  243. vipList: '',
  244. rongkang: req.header.appId,
  245. isSign: '',
  246. sign: 0,
  247. isLogin: false,
  248. noLogin: false,
  249. is_open_shop: '',
  250. isShowSign: false, //是否显示签到按钮
  251. config: {},
  252. userInfo: {},
  253. userInfos: {},
  254. isShowUpdate: false, //是否显示更新信息弹窗
  255. isUpdateInfo: false, //更新用户信息
  256. isUpdateMobile: false, //绑定手机号
  257. recommendCard:{},
  258. isShowCodePop:false,
  259. isShowBind:false
  260. };
  261. },
  262. components: {
  263. foot,
  264. footerCopyright,
  265. bindJobnum
  266. },
  267. props: {},
  268. onLoad(options) {
  269. uni.hideTabBar();
  270. uni.setNavigationBarColor({
  271. frontColor: this.skinNotColor ? '#000' : '#ffffff',
  272. backgroundColor: this.skinNotColor ? '#fff' : req.public.titleTopBgColor
  273. });
  274. if (JSON.parse(req.getStorage('configRes')).IS_secondary_members) {
  275. let IS_secondary_members = JSON.parse(req.getStorage('configRes')).IS_secondary_members;
  276. console.log(IS_secondary_members);
  277. this.setData({
  278. IS_secondary_members: IS_secondary_members
  279. });
  280. }
  281. this.userInfo = req.getStorage('userInfo');
  282. // #ifdef MP-WEIXIN
  283. let userInfo = req.getStorage('userInfo');
  284. if (req.isAuth()) {
  285. setTimeout(res => {
  286. if (!userInfo.avatar || userInfo.nickName == '微信用户' || this.userInfos.nickName == '微信用户') {
  287. this.isShowUpdate = true;
  288. this.isUpdateInfo = true;
  289. }
  290. if (userInfo.avatar && !userInfo.mobile && (this.userInfos && !this.userInfos.mobile)) {
  291. this.isShowUpdate = true;
  292. this.isUpdateMobile = true;
  293. }
  294. }, 2000);
  295. }
  296. // #endif
  297. },
  298. onShow: function() {
  299. let userInfo = req.getStorage('userInfo');
  300. this.isLogin = req.isLogins(false);
  301. if (this.isLogin) {
  302. this.getMy();
  303. this.getAbout();
  304. this.getRecommendCard()
  305. this.noLogin = true;
  306. } else {
  307. this.noLogin = false;
  308. }
  309. },
  310. methods: {
  311. getMsgNumber(){
  312. return getApp().globalData.unReadMessageNum;
  313. },
  314. jumpUrl(url) {
  315. if (req.isLogins(true)) {
  316. app.globalData.navigateTo(url);
  317. }
  318. },
  319. jumpMerchantManage() {
  320. let token = req.getStorage('AUTH_TOKEN');
  321. this.jumpUrl('merchant/index?appId=' + req.header.appId + '&token=' + token);
  322. },
  323. gouserInfo() {
  324. app.globalData.navigateTo('mine/userinfo/userinfo');
  325. },
  326. getMy() {
  327. let that = this;
  328. req.getRequest('/api/user/info', {}, data => {
  329. // data.merchantId = req.getStorage('userInfo').merchantId
  330. data.nickName = req.excludeSpecial(data.nickName);
  331. this.userInfos = data;
  332. // that.setData(data); // this.isbindmobile();
  333. console.log('userinfo==' + JSON.stringify(data));
  334. this.getuserMoney();
  335. // console.log(this);
  336. });
  337. },
  338. getuserMoney() {
  339. let is_open_wallet = JSON.parse(req.getStorage('configRes')).is_open_wallet;
  340. if (is_open_wallet) {
  341. if (JSON.parse(is_open_wallet).isOpenWallet == 1) {
  342. route.extendNew({}, res => {
  343. // console.log(parseFloat(res.all).toFixed(2));
  344. if (res)
  345. this.setData({
  346. userMoney: parseFloat(res.all).toFixed(2)
  347. });
  348. });
  349. }
  350. }
  351. },
  352. getAbout() {
  353. var _this = this;
  354. req.getRequest('/api/other/config', {}, function(res) {
  355. _this.phone = res.CONFIG_SERVICE_HOT_MOBILE;
  356. _this.config = res;
  357. _this.setData({
  358. istetphone: res.user_bind_mobile,
  359. logo: res.CONFIG_PROJECT_LOGO,
  360. name: res.CONFIG_PROJECT_TITLE
  361. });
  362. // console.log(res);
  363. if (res && res.is_open_wallet) {
  364. _this.setData({
  365. is_open_wallet: JSON.parse(res.is_open_wallet)
  366. });
  367. }
  368. if (res.is_open_shop) {
  369. _this.is_open_shop = res.is_open_shop;
  370. }
  371. });
  372. },
  373. callPhone() {
  374. if (req.isLogins(true)) {
  375. uni.makePhoneCall({
  376. phoneNumber: this.phone
  377. });
  378. }
  379. },
  380. goUrl() {
  381. app.globalData.openPage('mine/vip/vip');
  382. },
  383. showInfo(index) {
  384. if (!this.vipList[index].isShowInfo) {
  385. this.vipList.map(it => {
  386. it.isShowInfo = false;
  387. return it;
  388. });
  389. }
  390. this.vipList[index].isShowInfo = !this.vipList[index].isShowInfo;
  391. },
  392. closeUpdate() {
  393. this.isShowUpdate = false;
  394. },
  395. updateInfo(e) {
  396. this.isUpdateInfo = e;
  397. this.getMy();
  398. },
  399. updateMobile(e) {
  400. this.isUpdateMobile = e;
  401. this.getMy();
  402. },
  403. closeBind(){
  404. this.isShowBind = false;
  405. },
  406. jumpConversation() {
  407. req.jumpConversation();
  408. },
  409. // 判断强制绑定手机号
  410. // isbindmobile() {
  411. // if (req.getStorage('configRes')) {
  412. // let configRes = JSON.parse(req.getStorage('configRes'))
  413. // this.setData({ istetphone: configRes.user_bind_mobile, logo: configRes.CONFIG_PROJECT_LOGO, name: configRes.CONFIG_PROJECT_TITLE })
  414. // } else {
  415. // req.g('/api/config', (res) => {
  416. // req.setStorage('configRes', JSON.stringify(res))
  417. // this.setData({ istetphone: res.user_bind_mobile, logo: res.CONFIG_PROJECT_LOGO, name: res.CONFIG_PROJECT_TITLE })
  418. // })
  419. // }
  420. // if(this.data.istetphone=='1'){
  421. // // 获取用户手机号
  422. // let userInfo= req.getStorage('userInfo')
  423. // if(userInfo.mobile==null||userInfo.mobile==''){
  424. // console.log("获取用户手机号===============================")
  425. // app.openPage('pages/authorize/authorize?bindmobile=1')
  426. // }
  427. // }
  428. // },
  429. // 获取推荐销售
  430. getRecommendCard(){
  431. req.getRequest('/api/visiting/card/recommendCardInfo',{},res=>{
  432. this.recommendCard = res
  433. })
  434. },
  435. getAgeFn(date){
  436. console.log('getAge',date)
  437. return util.getAge(date)
  438. },
  439. // 拨打电话
  440. callPhone(val) {
  441. if(!val) return false
  442. uni.makePhoneCall({
  443. phoneNumber: val
  444. });
  445. },
  446. copy(val){
  447. this.isShowCodePop = false
  448. uni.setClipboardData({
  449. data: val,
  450. complete() {
  451. req.msg('复制成功')
  452. }
  453. })
  454. },
  455. },
  456. created() {
  457. const systemInfo = uni.getSystemInfoSync();
  458. // px转换到rpx的比例
  459. let pxToRpxScale = 750 / systemInfo.windowWidth;
  460. let systems = {
  461. ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
  462. navigationHeight: 44 * pxToRpxScale // 导航栏的高度
  463. };
  464. systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
  465. this.systems = systems;
  466. }
  467. };
  468. </script>
  469. <style>
  470. @import './user.css';
  471. </style>