user.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  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">1</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. styleHintPhoneText(phone) {
  267. var phones = util.styleHintPhoneText(phone);
  268. return phones;
  269. },
  270. jumpUrl(url) {
  271. if (req.isLogins(true)) {
  272. app.globalData.navigateTo(url);
  273. }
  274. },
  275. jumpMerchantManage() {
  276. let token = req.getStorage('AUTH_TOKEN');
  277. this.jumpUrl('merchant/index?appId=' + req.header.appId + '&token=' + token);
  278. },
  279. // 是否签到{}
  280. isSignFun() {
  281. req.getRequest('/api/integral/isSign', {}, res => {
  282. this.setData({
  283. isSign: res
  284. });
  285. });
  286. },
  287. gouserInfo() {
  288. app.globalData.navigateTo('mine/userinfo/userinfo');
  289. },
  290. getDistributionConfig() {
  291. req.postRequest('/api/distribution/config', {}, res => {
  292. this.setData({
  293. distr: res
  294. });
  295. });
  296. },
  297. // 签到
  298. signFun() {
  299. req.postRequest('/api/integral/sign', {}, data => {
  300. if (data) {
  301. req.msg('连续签到' + data.continuityDay + '天' + ',获得' + data.IntegralChange + '积分');
  302. this.setData({
  303. sign: 1
  304. });
  305. this.getOpenPonints();
  306. }
  307. });
  308. },
  309. getuserVip() {
  310. req.getRequest('/api/user/levelDetails', {}, data => {
  311. let expireTime = Array;
  312. if (data.expireTime) {
  313. expireTime = data.expireTime.split(' ');
  314. data.expireTime = data.expireTime.replace(/-/g, '/');
  315. } // 解决苹果不兼容---日期
  316. // data.expireTime=data.expireTime.replace(/-/g, '/')
  317. let nowTime = new Date().getTime();
  318. let endTime = new Date(data.expireTime).getTime();
  319. let times = parseInt((endTime - nowTime) / 1000); // var expireTime= new Date(data.expireTime)
  320. // var time1=expireTime.getTime();
  321. // console.log(times, nowTime, endTime, data.expireTime);
  322. this.setData({
  323. userinfovip: data,
  324. ['userinfovip.expireTime']: expireTime[0]
  325. });
  326. if (times <= 0) {
  327. this.setData({
  328. ['userinfovip.end']: true
  329. });
  330. } else {
  331. this.setData({
  332. ['userinfovip.end']: false
  333. });
  334. }
  335. // console.log(data);
  336. });
  337. },
  338. getOpenPonints() {
  339. req.getRequest('/api/integral/returnIntegral', {}, res => {
  340. this.setData({
  341. integral: res
  342. });
  343. });
  344. },
  345. getMy() {
  346. let that = this;
  347. req.getRequest('/api/user/info', {}, data => {
  348. // data.merchantId = req.getStorage('userInfo').merchantId
  349. data.nickName = req.excludeSpecial(data.nickName);
  350. this.userInfos = data;
  351. // that.setData(data); // this.isbindmobile();
  352. console.log('userinfo==' + JSON.stringify(data));
  353. this.isSignFun();
  354. this.getstatistics(data);
  355. this.getDistributionConfig();
  356. this.getuserVip();
  357. this.getuserMoney();
  358. this.getVip();
  359. this.getOpenPonints();
  360. // console.log(this);
  361. });
  362. },
  363. getuserMoney() {
  364. let is_open_wallet = JSON.parse(req.getStorage('configRes')).is_open_wallet;
  365. if (is_open_wallet) {
  366. if (JSON.parse(is_open_wallet).isOpenWallet == 1) {
  367. route.extendNew({}, res => {
  368. // console.log(parseFloat(res.all).toFixed(2));
  369. if (res)
  370. this.setData({
  371. userMoney: parseFloat(res.all).toFixed(2)
  372. });
  373. });
  374. }
  375. }
  376. },
  377. getAbout() {
  378. var _this = this;
  379. req.getRequest('/api/config', {}, function(res) {
  380. _this.phone = res.CONFIG_SERVICE_HOT_MOBILE;
  381. _this.config = res;
  382. _this.setData({
  383. istetphone: res.user_bind_mobile,
  384. logo: res.CONFIG_PROJECT_LOGO,
  385. name: res.CONFIG_PROJECT_TITLE
  386. });
  387. // console.log(res);
  388. if (res && res.is_open_wallet) {
  389. _this.setData({
  390. is_open_wallet: JSON.parse(res.is_open_wallet)
  391. });
  392. }
  393. if (res.is_open_shop) {
  394. _this.is_open_shop = res.is_open_shop;
  395. }
  396. // if (res.user_bind_mobile == '1') {
  397. // let userInfo = req.getStorage('userInfo');
  398. // if (userInfo && (userInfo.mobile == null || userInfo.mobile == '')) {
  399. // app.globalData.openPage('pages/authorize/authorize?bindmobile=1');
  400. // }
  401. // }
  402. });
  403. // 是否开启积分商城
  404. req.getRequest(
  405. '/api/params/value', {
  406. type: 'Open_Points_Mall'
  407. },
  408. res => {
  409. this.setData({
  410. Open_Points_Mall: res
  411. });
  412. }
  413. );
  414. },
  415. callPhone() {
  416. if (req.isLogins(true)) {
  417. uni.makePhoneCall({
  418. phoneNumber: this.phone
  419. });
  420. }
  421. },
  422. goUrl() {
  423. app.globalData.openPage('mine/vip/vip');
  424. },
  425. // 门店统计
  426. getstatistics(data) {
  427. let from = {};
  428. if (data.listShopBase && data.listShopBase != null && data.listShopBase.length > 0) {
  429. from.shopId = data.listShopBase[0].id;
  430. }
  431. if (data.listMerchant && data.listMerchant != null && data.listMerchant.length > 0 && data.listShopBase
  432. .length < 1) {
  433. from.merchantId = data.listMerchant[0].id;
  434. }
  435. req.getRequest('/api/order/statistics', from, data => {
  436. this.setData({
  437. statistics: data
  438. });
  439. console.log(data);
  440. });
  441. },
  442. getRule() {
  443. let that = this;
  444. req.getRequest('/api/integral/config', {}, res => {
  445. if (res && res.length > 0) {
  446. res.map(it => {
  447. if (it.illustrate && it.illustrate.indexOf('签到') > -1) {
  448. if (it.state == 2) {
  449. that.isShowSign = true;
  450. }
  451. }
  452. });
  453. }
  454. });
  455. },
  456. getVipListOrg() {
  457. if (this.vipList && this.userinfovip) {
  458. if (!this.userinfovip.levelGrade) {
  459. this.vipList.map((it, index) => {
  460. this.vipList[0].isShowInfo = true;
  461. });
  462. } else {
  463. this.vipList.map((it, index) => {
  464. if (this.userinfovip.level == it.id) {
  465. if (index < this.vipList.length - 1) {
  466. this.vipList[index + 1].isShowInfo = true;
  467. }
  468. }
  469. });
  470. }
  471. }
  472. },
  473. getVip() {
  474. req.getRequest('/api/levelStrategy/userLevelList', {}, data => {
  475. if (data && data.length > 0) {
  476. data.map((it, index) => {
  477. it.upgradeTerm = JSON.parse(it.upgradeTerm);
  478. it.isShowInfo = false;
  479. // if(index == 0) it.isShowInfo = true;
  480. return it;
  481. });
  482. this.vipList = data;
  483. this.getVipListOrg();
  484. }
  485. });
  486. },
  487. showInfo(index) {
  488. if (!this.vipList[index].isShowInfo) {
  489. this.vipList.map(it => {
  490. it.isShowInfo = false;
  491. return it;
  492. });
  493. }
  494. this.vipList[index].isShowInfo = !this.vipList[index].isShowInfo;
  495. },
  496. closeUpdate() {
  497. this.isShowUpdate = false;
  498. },
  499. updateInfo(e) {
  500. this.isUpdateInfo = e;
  501. this.getMy();
  502. },
  503. updateMobile(e) {
  504. this.isUpdateMobile = e;
  505. this.getMy();
  506. },
  507. jumpConversation() {
  508. req.jumpConversation();
  509. },
  510. // 判断强制绑定手机号
  511. // isbindmobile() {
  512. // if (req.getStorage('configRes')) {
  513. // let configRes = JSON.parse(req.getStorage('configRes'))
  514. // this.setData({ istetphone: configRes.user_bind_mobile, logo: configRes.CONFIG_PROJECT_LOGO, name: configRes.CONFIG_PROJECT_TITLE })
  515. // } else {
  516. // req.g('/api/config', (res) => {
  517. // req.setStorage('configRes', JSON.stringify(res))
  518. // this.setData({ istetphone: res.user_bind_mobile, logo: res.CONFIG_PROJECT_LOGO, name: res.CONFIG_PROJECT_TITLE })
  519. // })
  520. // }
  521. // if(this.data.istetphone=='1'){
  522. // // 获取用户手机号
  523. // let userInfo= req.getStorage('userInfo')
  524. // if(userInfo.mobile==null||userInfo.mobile==''){
  525. // console.log("获取用户手机号===============================")
  526. // app.openPage('pages/authorize/authorize?bindmobile=1')
  527. // }
  528. // }
  529. // },
  530. },
  531. created() {
  532. const systemInfo = uni.getSystemInfoSync();
  533. // px转换到rpx的比例
  534. let pxToRpxScale = 750 / systemInfo.windowWidth;
  535. let systems = {
  536. ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
  537. navigationHeight: 44 * pxToRpxScale // 导航栏的高度
  538. };
  539. systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
  540. this.systems = systems;
  541. }
  542. };
  543. </script>
  544. <style>
  545. @import './user.css';
  546. </style>