user.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  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/set/index')">
  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/set/index')" v-if="isLogin">
  17. <view class="ddflex">
  18. {{ userInfos.nickName }}
  19. <!-- <image src="../../static/pages/images/rz_qy_h.png" class="auth-img"
  20. v-if="userInfos.authStatus == 2"></image>
  21. <image src="../../static/pages/images/rz_qy.png" class="auth-img" v-else></image>
  22. <image src="../../static/pages/images/rz_gr_h.png" class="auth-img"
  23. v-if="userInfos.companyStatus == 2"></image>
  24. <image src="../../static/pages/images/rz_gr.png" class="auth-img" v-else></image> -->
  25. </view>
  26. <text class="edu" v-if="userInfos.mobile">{{ styleHintPhoneText(userInfos.mobile) }}</text>
  27. </view>
  28. <view class="flex" v-else><text class="login-btn" @click="jumpUrl('')">点击登录</text></view>
  29. <view class="rule dflex" @click="isSign == 0 || sign == 1 ? jumpUrl('') : signFun()" v-if="isShowSign">
  30. <image src="/static/pages/images/qdico.png"></image>
  31. {{ !isLogin ? '签到' : isSign == 0 || sign == 1 ? '已签到' : '签到' }}
  32. </view>
  33. <!-- </navigator> -->
  34. </view>
  35. <view class="datas dflex">
  36. <navigator url="" hover-class="none" class="li" v-if="is_open_wallet.isOpenWallet == 1"
  37. @click="jumpUrl('wallet/index/index')">
  38. <text>{{ userMoney ? userMoney : '0.00' }}</text>
  39. 钱包
  40. </navigator>
  41. <navigator url="" hover-class="none" class="li"
  42. :style="is_open_wallet.isOpenWallet != 1 && Open_Points_Mall != 1 ? 'width:50%' : ''"
  43. @click="jumpUrl('mine/coupons/coupons')">
  44. <text>{{ userInfos.coupon ? userInfos.coupon : '0' }}</text>
  45. 优惠券
  46. </navigator>
  47. <navigator url="" hover-class="none" class="li" @click="jumpUrl('integralshop/index/index')">
  48. <text>{{ userInfos.integral ? userInfos.integral : '0' }}</text>
  49. 积分
  50. </navigator>
  51. <navigator url="" hover-class="none" class="li"
  52. :style="is_open_wallet.isOpenWallet != 1 && Open_Points_Mall != 1 ? 'width:50%' : ''"
  53. @click="jumpUrl('mine/collect/collect')">
  54. <text>{{ userInfos.collect ? userInfos.collect : '0' }}</text>
  55. 收藏
  56. </navigator>
  57. <!-- <navigator url="/mine/footprint/footprint" hover-class="none" class="li"><text>{{footprint?footprint:'0'}}</text>足迹</navigator> -->
  58. </view>
  59. <view style="height: 80rpx;"></view>
  60. </view>
  61. <view class="con" style="margin-top: -80rpx;">
  62. <view class="order">
  63. <navigator url="" hover-class="none" class="tits dflex" @click="jumpUrl('mine/order/order')">
  64. <view class="flex">我的活动</view>
  65. 全部活动
  66. <image src="../../static/pages/images/more.png" class="rico"></image>
  67. </navigator>
  68. <view class="ddflex" style="justify-content: space-between;padding: 40rpx 80rpx;">
  69. <view class="order-item ddflex">
  70. <image src="../../static/images/sd_tw.png"></image>
  71. <view>待参与</view>
  72. </view>
  73. <vieW class="order-line"></vieW>
  74. <view class="order-item ddflex">
  75. <image src="../../static/images/sd_tw.png"></image>
  76. <view>已完成</view>
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. <view class="con">
  82. <view class="order">
  83. <navigator url="" hover-class="none" class="tits dflex" @click="jumpUrl('mine/order/order')">
  84. <view class="flex">我的顾问</view>
  85. </navigator>
  86. <view class="service-person">
  87. <view class="ddflex" @click="jumpUrl('/card/index/index')">
  88. <image class="service-person-header" src="../../static/pages/images/userimg.png"></image>
  89. <view>
  90. <view class="service-person-name ddflex">
  91. <view>Hi~我是杜平</view>
  92. <image src="/static/images/rico2.png" class="rico"></image>
  93. </view>
  94. <view class="service-person-number">(工号:106547) 欢迎您来到我的微页</view>
  95. <view class="service-person-options ddflex">
  96. <view class="service-person-option ddflex">
  97. <image src="/static/pages/images/dz_hui.png"></image>
  98. <view>96%</view>
  99. </view>
  100. <view class="service-person-option ddflex">
  101. <image src="/static/pages/images/cy_hui.png"></image>
  102. <view>从业21.6年</view>
  103. </view>
  104. <view class="service-person-option ddflex">
  105. <image src="/static/pages/images/fw_hui.png"></image>
  106. <view>为1678人服务</view>
  107. </view>
  108. </view>
  109. </view>
  110. </view>
  111. <view class="service-person-phone ddflex">
  112. <view class="ddflex flex" style="justify-content: center;">
  113. <image src="/static/pages/images/phone1.png"></image>
  114. <view>联系电话</view>
  115. </view>
  116. <view class="order-line"></view>
  117. <view class="ddflex flex" style="justify-content: center;">
  118. <image style="width: 35rpx;height: 28rpx;" src="/static/pages/images/qw.png"></image>
  119. <view>加企微信</view>
  120. </view>
  121. </view>
  122. </view>
  123. </view>
  124. </view>
  125. <view class="box mlist">
  126. <navigator class="li ddflex" url="/promote/invite/invite" hover-class="none">
  127. <image :src="picUrlss + 'scrm/mico_fx.png'" class="mico"></image>
  128. <view class="fflex">推荐好友</view>
  129. <image src="../../static/pages/images/more.png" class="rico"></image>
  130. </navigator>
  131. </view>
  132. <view class="box mlist">
  133. <view class="li ddflex">
  134. <view class="fflex">
  135. <contact-button class-name="ddflex" :img-url="picUrlss+'scrm/mico_kf.png'"
  136. img-style='width: 49rpx;height: 49rpx;margin: 0 25rpx 0 0;' button-text="联系客服"
  137. styles="line-height:initial;"></contact-button>
  138. </view>
  139. <image src="../../static/pages/images/more.png" class="rico"></image>
  140. </view>
  141. <navigator class="li ddflex" url="/mine/help/help" hover-class="none">
  142. <image :src="picUrlss+'ruiteng/my_service5.png'" class="mico" mode="aspectFit"></image>
  143. <view class="fflex">帮助中心</view>
  144. <image src="../../static/pages/images/more.png" class="rico"></image>
  145. </navigator>
  146. <navigator class="li ddflex" url="/mine/feedback/feedback" hover-class="none">
  147. <image :src="picUrlss + 'scrm/mico_fk.png'" class="mico"></image>
  148. <view class="fflex">建议与反馈</view>
  149. <image src="../../static/pages/images/more.png" class="rico"></image>
  150. </navigator>
  151. <navigator class="li ddflex" url="/pages/about/about" hover-class="none">
  152. <image :src="picUrlss + 'scrm/mico_about.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. <footer-copyright></footer-copyright>
  158. <!-- <view class="placeholder-view" :style="'height:' + (bottomBlankHeignt + 115) + 'rpx'"></view> -->
  159. <foot channel="user"></foot>
  160. <update-userinfo :update-info="isUpdateInfo" :update-mobile="isUpdateMobile" v-if="isShowUpdate"
  161. @closeUpdate="closeUpdate" @updateInfo="updateInfo" @updateMobile="updateMobile"></update-userinfo>
  162. <view class="lt ddflex" @click="jumpConversation()">
  163. <view class="ddflex" style="position: relative;width: 100%;height: 100%;">
  164. <image src="../../static/pages/images/lt.png"></image>
  165. <view class="lt-num" v-if="getMsgNumber()>0">{{getMsgNumber()}}</view>
  166. </view>
  167. </view>
  168. </view>
  169. </template>
  170. <script>
  171. // pages/user/user.js
  172. const app = getApp();
  173. const req = require('../../utils/request.js');
  174. const util = require('../../utils/util.js');
  175. const route = require('../../utils/route');
  176. import foot from '../../components/nav-bar/index';
  177. import footerCopyright from '../../components/footer-copyright/footer-copyright';
  178. export default {
  179. data() {
  180. return {
  181. systems: {},
  182. skinNotColor: req.public.skinNotColor,
  183. picUrlss: req.public.picUrls,
  184. bottomBlankHeignt: app.globalData.isIPhoneX ? 68 : 0,
  185. // merchantId: '',
  186. iconSrc: req.public.iconSrc,
  187. //头部页面背景链接
  188. isHideVip: true,
  189. //隐藏会员
  190. isVip: true,
  191. //是否是会员
  192. IS_secondary_members: 0,
  193. distr: '',
  194. userinfovip: '',
  195. userMoney: '',
  196. istetphone: '',
  197. logo: '',
  198. name: '',
  199. is_open_wallet: '',
  200. Open_Points_Mall: '',
  201. statistics: '',
  202. vipList: '',
  203. rongkang: req.header.appId,
  204. isSign: '',
  205. sign: 0,
  206. isLogin: false,
  207. noLogin: false,
  208. is_open_shop: '',
  209. isShowSign: false, //是否显示签到按钮
  210. config: {},
  211. userInfo: {},
  212. userInfos: {},
  213. isShowUpdate: false, //是否显示更新信息弹窗
  214. isUpdateInfo: false, //更新用户信息
  215. isUpdateMobile: false, //绑定手机号
  216. };
  217. },
  218. components: {
  219. foot,
  220. footerCopyright
  221. },
  222. props: {},
  223. onLoad(options) {
  224. uni.hideTabBar();
  225. uni.setNavigationBarColor({
  226. frontColor: this.skinNotColor ? '#000' : '#ffffff',
  227. backgroundColor: this.skinNotColor ? '#fff' : req.public.titleTopBgColor
  228. });
  229. if (JSON.parse(req.getStorage('configRes')).IS_secondary_members) {
  230. let IS_secondary_members = JSON.parse(req.getStorage('configRes')).IS_secondary_members;
  231. console.log(IS_secondary_members);
  232. this.setData({
  233. IS_secondary_members: IS_secondary_members
  234. });
  235. }
  236. this.userInfo = req.getStorage('userInfo');
  237. // #ifdef MP-WEIXIN
  238. let userInfo = req.getStorage('userInfo');
  239. if (req.isAuth()) {
  240. setTimeout(res => {
  241. if (!userInfo.avatar || userInfo.nickName == '微信用户' || this.userInfos.nickName == '微信用户') {
  242. this.isShowUpdate = true;
  243. this.isUpdateInfo = true;
  244. }
  245. if (userInfo.avatar && !userInfo.mobile && (this.userInfos && !this.userInfos.mobile)) {
  246. this.isShowUpdate = true;
  247. this.isUpdateMobile = true;
  248. }
  249. }, 2000);
  250. }
  251. // #endif
  252. },
  253. onShow: function() {
  254. let userInfo = req.getStorage('userInfo');
  255. this.isLogin = req.isLogins(false);
  256. if (this.isLogin) {
  257. this.getMy();
  258. this.getAbout();
  259. this.getRule();
  260. this.noLogin = true;
  261. } else {
  262. this.noLogin = false;
  263. }
  264. },
  265. methods: {
  266. getMsgNumber(){
  267. return getApp().globalData.unReadMessageNum;
  268. },
  269. styleHintPhoneText(phone) {
  270. var phones = util.styleHintPhoneText(phone);
  271. return phones;
  272. },
  273. jumpUrl(url) {
  274. if (req.isLogins(true)) {
  275. app.globalData.navigateTo(url);
  276. }
  277. },
  278. jumpMerchantManage() {
  279. let token = req.getStorage('AUTH_TOKEN');
  280. this.jumpUrl('merchant/index?appId=' + req.header.appId + '&token=' + token);
  281. },
  282. // 是否签到{}
  283. isSignFun() {
  284. req.getRequest('/api/integral/isSign', {}, res => {
  285. this.setData({
  286. isSign: res
  287. });
  288. });
  289. },
  290. gouserInfo() {
  291. app.globalData.navigateTo('mine/userinfo/userinfo');
  292. },
  293. getDistributionConfig() {
  294. req.postRequest('/api/distribution/config', {}, res => {
  295. this.setData({
  296. distr: res
  297. });
  298. });
  299. },
  300. // 签到
  301. signFun() {
  302. req.postRequest('/api/integral/sign', {}, data => {
  303. if (data) {
  304. req.msg('连续签到' + data.continuityDay + '天' + ',获得' + data.IntegralChange + '积分');
  305. this.setData({
  306. sign: 1
  307. });
  308. this.getOpenPonints();
  309. }
  310. });
  311. },
  312. getuserVip() {
  313. req.getRequest('/api/user/levelDetails', {}, data => {
  314. let expireTime = Array;
  315. if (data.expireTime) {
  316. expireTime = data.expireTime.split(' ');
  317. data.expireTime = data.expireTime.replace(/-/g, '/');
  318. } // 解决苹果不兼容---日期
  319. // data.expireTime=data.expireTime.replace(/-/g, '/')
  320. let nowTime = new Date().getTime();
  321. let endTime = new Date(data.expireTime).getTime();
  322. let times = parseInt((endTime - nowTime) / 1000); // var expireTime= new Date(data.expireTime)
  323. // var time1=expireTime.getTime();
  324. // console.log(times, nowTime, endTime, data.expireTime);
  325. this.setData({
  326. userinfovip: data,
  327. ['userinfovip.expireTime']: expireTime[0]
  328. });
  329. if (times <= 0) {
  330. this.setData({
  331. ['userinfovip.end']: true
  332. });
  333. } else {
  334. this.setData({
  335. ['userinfovip.end']: false
  336. });
  337. }
  338. // console.log(data);
  339. });
  340. },
  341. getOpenPonints() {
  342. req.getRequest('/api/integral/returnIntegral', {}, res => {
  343. this.setData({
  344. integral: res
  345. });
  346. });
  347. },
  348. getMy() {
  349. let that = this;
  350. req.getRequest('/api/user/info', {}, data => {
  351. // data.merchantId = req.getStorage('userInfo').merchantId
  352. data.nickName = req.excludeSpecial(data.nickName);
  353. this.userInfos = data;
  354. // that.setData(data); // this.isbindmobile();
  355. console.log('userinfo==' + JSON.stringify(data));
  356. this.isSignFun();
  357. this.getstatistics(data);
  358. this.getDistributionConfig();
  359. this.getuserVip();
  360. this.getuserMoney();
  361. this.getVip();
  362. this.getOpenPonints();
  363. // console.log(this);
  364. });
  365. },
  366. getuserMoney() {
  367. let is_open_wallet = JSON.parse(req.getStorage('configRes')).is_open_wallet;
  368. if (is_open_wallet) {
  369. if (JSON.parse(is_open_wallet).isOpenWallet == 1) {
  370. route.extendNew({}, res => {
  371. // console.log(parseFloat(res.all).toFixed(2));
  372. if (res)
  373. this.setData({
  374. userMoney: parseFloat(res.all).toFixed(2)
  375. });
  376. });
  377. }
  378. }
  379. },
  380. getAbout() {
  381. var _this = this;
  382. req.getRequest('/api/config', {}, function(res) {
  383. _this.phone = res.CONFIG_SERVICE_HOT_MOBILE;
  384. _this.config = res;
  385. _this.setData({
  386. istetphone: res.user_bind_mobile,
  387. logo: res.CONFIG_PROJECT_LOGO,
  388. name: res.CONFIG_PROJECT_TITLE
  389. });
  390. // console.log(res);
  391. if (res && res.is_open_wallet) {
  392. _this.setData({
  393. is_open_wallet: JSON.parse(res.is_open_wallet)
  394. });
  395. }
  396. if (res.is_open_shop) {
  397. _this.is_open_shop = res.is_open_shop;
  398. }
  399. // if (res.user_bind_mobile == '1') {
  400. // let userInfo = req.getStorage('userInfo');
  401. // if (userInfo && (userInfo.mobile == null || userInfo.mobile == '')) {
  402. // app.globalData.openPage('pages/authorize/authorize?bindmobile=1');
  403. // }
  404. // }
  405. });
  406. // 是否开启积分商城
  407. req.getRequest(
  408. '/api/params/value', {
  409. type: 'Open_Points_Mall'
  410. },
  411. res => {
  412. this.setData({
  413. Open_Points_Mall: res
  414. });
  415. }
  416. );
  417. },
  418. callPhone() {
  419. if (req.isLogins(true)) {
  420. uni.makePhoneCall({
  421. phoneNumber: this.phone
  422. });
  423. }
  424. },
  425. goUrl() {
  426. app.globalData.openPage('mine/vip/vip');
  427. },
  428. // 门店统计
  429. getstatistics(data) {
  430. let from = {};
  431. if (data.listShopBase && data.listShopBase != null && data.listShopBase.length > 0) {
  432. from.shopId = data.listShopBase[0].id;
  433. }
  434. if (data.listMerchant && data.listMerchant != null && data.listMerchant.length > 0 && data.listShopBase
  435. .length < 1) {
  436. from.merchantId = data.listMerchant[0].id;
  437. }
  438. req.getRequest('/api/order/statistics', from, data => {
  439. this.setData({
  440. statistics: data
  441. });
  442. console.log(data);
  443. });
  444. },
  445. getRule() {
  446. let that = this;
  447. req.getRequest('/api/integral/config', {}, res => {
  448. if (res && res.length > 0) {
  449. res.map(it => {
  450. if (it.illustrate && it.illustrate.indexOf('签到') > -1) {
  451. if (it.state == 2) {
  452. that.isShowSign = true;
  453. }
  454. }
  455. });
  456. }
  457. });
  458. },
  459. getVipListOrg() {
  460. if (this.vipList && this.userinfovip) {
  461. if (!this.userinfovip.levelGrade) {
  462. this.vipList.map((it, index) => {
  463. this.vipList[0].isShowInfo = true;
  464. });
  465. } else {
  466. this.vipList.map((it, index) => {
  467. if (this.userinfovip.level == it.id) {
  468. if (index < this.vipList.length - 1) {
  469. this.vipList[index + 1].isShowInfo = true;
  470. }
  471. }
  472. });
  473. }
  474. }
  475. },
  476. getVip() {
  477. req.getRequest('/api/levelStrategy/userLevelList', {}, data => {
  478. if (data && data.length > 0) {
  479. data.map((it, index) => {
  480. it.upgradeTerm = JSON.parse(it.upgradeTerm);
  481. it.isShowInfo = false;
  482. // if(index == 0) it.isShowInfo = true;
  483. return it;
  484. });
  485. this.vipList = data;
  486. this.getVipListOrg();
  487. }
  488. });
  489. },
  490. showInfo(index) {
  491. if (!this.vipList[index].isShowInfo) {
  492. this.vipList.map(it => {
  493. it.isShowInfo = false;
  494. return it;
  495. });
  496. }
  497. this.vipList[index].isShowInfo = !this.vipList[index].isShowInfo;
  498. },
  499. closeUpdate() {
  500. this.isShowUpdate = false;
  501. },
  502. updateInfo(e) {
  503. this.isUpdateInfo = e;
  504. this.getMy();
  505. },
  506. updateMobile(e) {
  507. this.isUpdateMobile = e;
  508. this.getMy();
  509. },
  510. jumpConversation() {
  511. req.jumpConversation();
  512. },
  513. // 判断强制绑定手机号
  514. // isbindmobile() {
  515. // if (req.getStorage('configRes')) {
  516. // let configRes = JSON.parse(req.getStorage('configRes'))
  517. // this.setData({ istetphone: configRes.user_bind_mobile, logo: configRes.CONFIG_PROJECT_LOGO, name: configRes.CONFIG_PROJECT_TITLE })
  518. // } else {
  519. // req.g('/api/config', (res) => {
  520. // req.setStorage('configRes', JSON.stringify(res))
  521. // this.setData({ istetphone: res.user_bind_mobile, logo: res.CONFIG_PROJECT_LOGO, name: res.CONFIG_PROJECT_TITLE })
  522. // })
  523. // }
  524. // if(this.data.istetphone=='1'){
  525. // // 获取用户手机号
  526. // let userInfo= req.getStorage('userInfo')
  527. // if(userInfo.mobile==null||userInfo.mobile==''){
  528. // console.log("获取用户手机号===============================")
  529. // app.openPage('pages/authorize/authorize?bindmobile=1')
  530. // }
  531. // }
  532. // },
  533. },
  534. created() {
  535. const systemInfo = uni.getSystemInfoSync();
  536. // px转换到rpx的比例
  537. let pxToRpxScale = 750 / systemInfo.windowWidth;
  538. let systems = {
  539. ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
  540. navigationHeight: 44 * pxToRpxScale // 导航栏的高度
  541. };
  542. systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
  543. this.systems = systems;
  544. }
  545. };
  546. </script>
  547. <style>
  548. @import './user.css';
  549. </style>