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