index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  1. <template>
  2. <view class="vipGrade">
  3. <view class="headerBg">
  4. <view class="header">
  5. <view class="top acea-row row-between-wrapper">
  6. <view class="acea-row row-middle">
  7. <view class="pictrue">
  8. <image :src="user_info.avatar"></image>
  9. </view>
  10. <view>
  11. <view class="acea-row row-middle">
  12. <view class="nickname line1">{{ user_info.nickname }}</view>
  13. <view class="name" v-if="level_info.name">{{ level_info.name }}</view>
  14. <image :src="level_info.icon" class="levelImage" v-if="level_info.icon"></image>
  15. </view>
  16. <view class="acea-row row-middle">
  17. <view class="progress">
  18. <view
  19. class="bg-reds"
  20. :style="
  21. 'width:' +
  22. (level_info.exp > level_info.next_exp
  23. ? 100
  24. : $util.$h.Div(parseInt(level_info.exp), level_info.next_exp) >= 5
  25. ? $util.$h.Div(parseInt(level_info.exp), level_info.next_exp)
  26. : 5) +
  27. '%;'
  28. "
  29. ></view>
  30. </view>
  31. <view class="percent">{{ level_info.exp ? level_info.exp.split('.')[0] : 0 }}/{{ level_info.next_exp || 0 }}</view>
  32. </view>
  33. </view>
  34. </view>
  35. <view class="code" @click="tapQrCode">
  36. <view class="iconfont icon-erweima3"></view>
  37. <view>会员码</view>
  38. </view>
  39. </view>
  40. <view class="bottom acea-row row-middle">
  41. <view class="item">
  42. <view>积分</view>
  43. <view class="num">{{ user_info.integral || 0 }}</view>
  44. </view>
  45. <view class="item">
  46. <view>余额</view>
  47. <view class="num" v-if="user_info.now_money">
  48. {{ user_info.now_money.split('.')[0] || 0 }}
  49. <text class="numSp" v-if="user_info.now_money.split('.')[1] > 0">.{{ user_info.now_money.split('.')[1] }}</text>
  50. </view>
  51. <view class="num" v-else>0</view>
  52. </view>
  53. <view class="item">
  54. <view>优惠券</view>
  55. <view class="num">{{ user_info.couponCount || 0 }}</view>
  56. </view>
  57. <view class="item">
  58. <view>折扣</view>
  59. <view class="num">{{ level_info.discount / 10 || 0 }}</view>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="equity">
  65. <view class="title acea-row row-between-wrapper">
  66. <view>{{ level_info.name || '' }}会员尊享权益</view>
  67. <view class="more" @click="more">
  68. 查看更多
  69. <text class="iconfont icon-jinru2"></text>
  70. </view>
  71. </view>
  72. <view class="list acea-row row-around row-middle">
  73. <view class="item">
  74. <view class="pictrue">
  75. <image :src="imgHost + '/statics/images/userVip1.png'"></image>
  76. </view>
  77. <view>购物折扣</view>
  78. </view>
  79. <view class="item">
  80. <view class="pictrue">
  81. <image :src="imgHost + '/statics/images/userVip2.png'"></image>
  82. </view>
  83. <view>专属徽章</view>
  84. </view>
  85. <view class="item">
  86. <view class="pictrue">
  87. <image :src="imgHost + '/statics/images/userVip3.png'"></image>
  88. </view>
  89. <view>经验累积</view>
  90. </view>
  91. <view class="item">
  92. <view class="pictrue">
  93. <image :src="imgHost + '/statics/images/userVip4.png'"></image>
  94. </view>
  95. <view>尊享客服</view>
  96. </view>
  97. </view>
  98. </view>
  99. <view class="task">
  100. <view class="title acea-row row-between-wrapper">
  101. <view>成长任务</view>
  102. <view class="more" @click="more">
  103. 查看更多
  104. <text class="iconfont icon-jinru2"></text>
  105. </view>
  106. </view>
  107. <view class="list">
  108. <view class="item acea-row row-between-wrapper">
  109. <view class="acea-row row-middle">
  110. <view class="pictrue acea-row row-center-wrapper">
  111. <text class="iconfont icon-meiriqiandao"></text>
  112. </view>
  113. <view class="txt">
  114. <view>每日签到</view>
  115. <view class="exp acea-row row-middle">
  116. <image src="../static/exp.png"></image>
  117. 经验值+{{ task_info.sign }}
  118. </view>
  119. </view>
  120. </view>
  121. <navigator class="bnt acea-row row-center-wrapper" url="/pages/users/user_sgin/index" hover-class="none">去完成</navigator>
  122. </view>
  123. <view class="item acea-row row-between-wrapper">
  124. <view class="acea-row row-middle">
  125. <view class="pictrue acea-row row-center-wrapper">
  126. <text class="iconfont icon-goumaishangpin"></text>
  127. </view>
  128. <view class="txt">
  129. <view>购买商品</view>
  130. <view class="exp acea-row row-middle">
  131. <image src="../static/exp.png"></image>
  132. 经验值+{{ task_info.order }}
  133. </view>
  134. </view>
  135. </view>
  136. <navigator class="bnt acea-row row-center-wrapper" open-type="switchTab" url="/pages/goods_cate/goods_cate" hover-class="none">去完成</navigator>
  137. </view>
  138. <view class="item acea-row row-between-wrapper">
  139. <view class="acea-row row-middle">
  140. <view class="pictrue acea-row row-center-wrapper">
  141. <text class="iconfont icon-yaoqinghaoyou2"></text>
  142. </view>
  143. <view class="txt">
  144. <view>邀请好友</view>
  145. <view class="exp acea-row row-middle">
  146. <image src="../static/exp.png"></image>
  147. 经验值+{{ task_info.invite }}
  148. </view>
  149. </view>
  150. </view>
  151. <navigator class="bnt acea-row row-center-wrapper" url="/pages/users/user_spread_code/index" hover-class="none">去完成</navigator>
  152. </view>
  153. </view>
  154. </view>
  155. <view class="task on">
  156. <view class="title acea-row row-between-wrapper">
  157. <view>消费记录</view>
  158. <view class="more" @click="record">
  159. 查看更多
  160. <text class="iconfont icon-jinru2"></text>
  161. </view>
  162. </view>
  163. <view class="list">
  164. <view class="item acea-row row-between row-top" v-for="(item, index) in list" :key="index">
  165. <view class="acea-row row-top">
  166. <text class="icon iconfont icon-xiaofeijilu1" v-if="item.type == 1"></text>
  167. <text class="icon iconfont icon-fufeihuiyuan1" v-else-if="item.type == 7"></text>
  168. <text class="icon iconfont icon-xiaofeijilu-rongcuo" v-else></text>
  169. <view class="txt">
  170. <view class="line1">{{ item.title }}</view>
  171. <view class="exp record">{{ item.type_name }}</view>
  172. <view class="time">{{ item.day }}</view>
  173. </view>
  174. </view>
  175. <view class="num">-{{ item.price }}</view>
  176. </view>
  177. </view>
  178. </view>
  179. <view class="codePopup" v-show="isCode" @touchmove.stop.prevent="moveHandle">
  180. <view class="header acea-row row-between-wrapper">
  181. <view class="title" :class="{ on: codeIndex == index, onLeft: codeIndex == 1 }" v-for="(item, index) in codeList" :key="index" @click="tapCode(index)">
  182. {{ item.name }}
  183. </view>
  184. </view>
  185. <view>
  186. <view class="acea-row row-center-wrapper">
  187. <w-barcode :options="config.bar"></w-barcode>
  188. </view>
  189. <view class="acea-row row-center-wrapper" style="margin-top: 35rpx">
  190. <w-qrcode :options="config.qrc" @generate="hello"></w-qrcode>
  191. </view>
  192. <view class="codeNum">{{ config.bar.code }}</view>
  193. <view class="tip">如遇到扫码失败请将屏幕调至最亮重新扫码</view>
  194. </view>
  195. <view class="iconfont icon-guanbi2" @click="closeCode"></view>
  196. </view>
  197. <view class="mark" v-if="isCode" @touchmove.stop.prevent="moveHandle"></view>
  198. <!-- #ifdef MP -->
  199. <authorize v-if="isShowAuth" @authColse="authColse" @onLoadFun="onLoadFun"></authorize>
  200. <!-- #endif -->
  201. </view>
  202. </template>
  203. <script>
  204. import { HTTP_REQUEST_URL } from '@/config/app';
  205. import { getlevelInfo, moneyList, getRandCode } from '@/api/user.js';
  206. import { mapGetters } from 'vuex';
  207. import { toLogin } from '@/libs/login.js';
  208. export default {
  209. computed: mapGetters(['isLogin']),
  210. data() {
  211. return {
  212. config: {
  213. bar: {
  214. code: '',
  215. color: ['#000'],
  216. bgColor: '#FFFFFF', // 背景色
  217. width: 480, // 宽度
  218. height: 110 // 高度
  219. },
  220. qrc: {
  221. code: '',
  222. size: 380, // 二维码大小
  223. level: 3, //等级 0~4
  224. bgColor: '#FFFFFF', //二维码背景色 默认白色
  225. border: {
  226. color: ['#eee', '#eee'], //边框颜色支持渐变色
  227. lineWidth: 3 //边框宽度
  228. },
  229. // img: '/static/logo.png', //图片
  230. // iconSize: 40, //二维码图标的大小
  231. color: ['#333', '#333'] //边框颜色支持渐变色
  232. }
  233. },
  234. codeList: [
  235. {
  236. name: '会员码'
  237. },
  238. {
  239. name: '付款码'
  240. }
  241. ],
  242. codeIndex: 0,
  243. isCode: false,
  244. imgHost: HTTP_REQUEST_URL,
  245. level_info: {},
  246. user_info: {},
  247. task_info: {},
  248. list: [],
  249. isShowAuth: false
  250. };
  251. },
  252. onLoad() {
  253. this.levelInfo();
  254. this.getUserBillList();
  255. },
  256. onReady() {},
  257. onShow() {},
  258. methods: {
  259. /**
  260. * 授权回调
  261. */
  262. onLoadFun: function () {
  263. this.isShowAuth = false;
  264. },
  265. // 授权关闭
  266. authColse: function (e) {
  267. this.isShowAuth = e;
  268. },
  269. more() {
  270. uni.navigateTo({
  271. url: '/pages/users/user_vip/index'
  272. });
  273. },
  274. record() {
  275. uni.navigateTo({
  276. url: '/pages/annex/record_list/index'
  277. });
  278. },
  279. hello(res) {
  280. // console.log(321,res)
  281. },
  282. getCode() {
  283. getRandCode()
  284. .then((res) => {
  285. let code = res.data.code;
  286. this.config.bar.code = code;
  287. this.config.qrc.code = code;
  288. })
  289. .catch((err) => {
  290. return this.$util.Tips(err);
  291. });
  292. },
  293. tapQrCode() {
  294. if (this.isLogin) {
  295. this.isCode = true;
  296. this.codeIndex = 0;
  297. this.$nextTick(function () {
  298. let code = this.user_info.bar_code;
  299. this.config.bar.code = code;
  300. this.config.qrc.code = code;
  301. });
  302. } else {
  303. toLogin();
  304. }
  305. },
  306. closeCode() {
  307. this.isCode = false;
  308. },
  309. tapCode(index) {
  310. this.codeIndex = index;
  311. if (index == 1) {
  312. this.getCode();
  313. } else {
  314. let code = this.user_info.bar_code;
  315. this.config.bar.code = code;
  316. this.config.qrc.code = code;
  317. }
  318. },
  319. levelInfo() {
  320. getlevelInfo()
  321. .then((res) => {
  322. this.user_info = res.data.user;
  323. this.task_info = res.data.task;
  324. this.level_info = res.data.level_info;
  325. res.data.level_list.forEach((item) => {
  326. if (item.name === res.data.level_info.name) {
  327. this.level_info.next_exp = item.next_exp_num;
  328. }
  329. });
  330. })
  331. .catch((err) => {
  332. this.$util.Tips({
  333. title: err
  334. });
  335. });
  336. },
  337. getUserBillList() {
  338. moneyList(
  339. {
  340. page: 1,
  341. limit: 5
  342. },
  343. 9
  344. )
  345. .then((res) => {
  346. this.list = res.data.list;
  347. })
  348. .catch((err) => {
  349. this.$util.Tips({
  350. title: err
  351. });
  352. });
  353. },
  354. moveHandle() {}
  355. }
  356. };
  357. </script>
  358. <style lang="scss">
  359. .vipGrade {
  360. .mark {
  361. position: fixed;
  362. top: 0;
  363. left: 0;
  364. bottom: 0;
  365. right: 0;
  366. background: rgba(0, 0, 0, 0.5);
  367. z-index: 50;
  368. }
  369. .codePopup .header .title.on {
  370. background-color: #f7b942 !important;
  371. }
  372. .headerBg {
  373. background: url('../static/big-bg.png') no-repeat;
  374. background-size: 100% 100%;
  375. width: 100%;
  376. height: 276rpx;
  377. padding-top: 1rpx;
  378. .header {
  379. width: 690rpx;
  380. height: 318rpx;
  381. background: url('../static/grade-bg.png') no-repeat;
  382. background-size: 100% 100%;
  383. margin: 18rpx auto 0 auto;
  384. padding-top: 40rpx;
  385. .top {
  386. margin: 0 30rpx 70rpx 30rpx;
  387. .progress {
  388. overflow: hidden;
  389. background-color: #eeeeee;
  390. width: 200rpx;
  391. height: 6rpx;
  392. border-radius: 7rpx;
  393. position: relative;
  394. margin-right: 6rpx;
  395. .bg-reds {
  396. width: 0;
  397. height: 100%;
  398. transition: width 0.6s ease;
  399. background: linear-gradient(90deg, rgba(233, 51, 35, 1) 0%, rgba(255, 137, 51, 1) 100%);
  400. }
  401. }
  402. .percent {
  403. font-size: 20rpx;
  404. color: #463b26;
  405. margin-left: 12rpx;
  406. }
  407. .code {
  408. color: #333333;
  409. font-size: 20rpx;
  410. text-align: center;
  411. .icon-erweima3 {
  412. margin-bottom: 6rpx;
  413. }
  414. }
  415. .pictrue {
  416. width: 80rpx;
  417. height: 80rpx;
  418. border: 2rpx solid #9a8661;
  419. border-radius: 50%;
  420. margin-right: 22rpx;
  421. image {
  422. width: 100%;
  423. height: 100%;
  424. border-radius: 50%;
  425. }
  426. }
  427. .nickname {
  428. font-size: 30rpx;
  429. font-weight: 600;
  430. color: #333333;
  431. max-width: 220rpx;
  432. }
  433. .name {
  434. font-size: 20rpx;
  435. color: #e8c891;
  436. font-weight: 500;
  437. background: #333333;
  438. border-radius: 6rpx;
  439. padding: 0 6rpx;
  440. margin-left: 12rpx;
  441. }
  442. .levelImage {
  443. width: 30rpx;
  444. height: 30rpx;
  445. margin-left: 12rpx;
  446. }
  447. }
  448. .bottom {
  449. padding-left: 30rpx;
  450. .item {
  451. flex: 1;
  452. padding: 0 10rpx;
  453. color: #333333;
  454. font-size: 24rpx;
  455. .num {
  456. font-weight: 600;
  457. font-size: 36rpx;
  458. margin-top: 6rpx;
  459. .numSp {
  460. font-size: 26rpx;
  461. }
  462. }
  463. }
  464. }
  465. }
  466. }
  467. .equity {
  468. margin: 82rpx auto 0 auto;
  469. width: 690rpx;
  470. height: 300rpx;
  471. background: #ffffff;
  472. border-radius: 14rpx;
  473. .title {
  474. padding: 28rpx 24rpx 0 24rpx;
  475. font-weight: 600;
  476. color: #333333;
  477. font-size: 34rpx;
  478. .more {
  479. font-weight: 400;
  480. color: #666666;
  481. font-size: 24rpx;
  482. .iconfont {
  483. font-size: 20rpx;
  484. }
  485. }
  486. }
  487. .list {
  488. margin-top: 44rpx;
  489. .item {
  490. color: #282828;
  491. font-size: 26rpx;
  492. .pictrue {
  493. width: 90rpx;
  494. height: 90rpx;
  495. border-radius: 50%;
  496. margin-bottom: 12rpx;
  497. image {
  498. width: 100%;
  499. height: 100%;
  500. border-radius: 50%;
  501. }
  502. }
  503. }
  504. }
  505. }
  506. .task {
  507. width: 690rpx;
  508. height: 524rpx;
  509. background: #ffffff;
  510. border-radius: 14rpx;
  511. margin: 20rpx auto 0 auto;
  512. &.on {
  513. height: unset;
  514. }
  515. .title {
  516. padding: 34rpx 24rpx 46rpx 24rpx;
  517. font-weight: 600;
  518. color: #333333;
  519. line-height: 30rpx;
  520. .more {
  521. font-weight: 400;
  522. color: #666666;
  523. font-size: 24rpx;
  524. .iconfont {
  525. font-size: 20rpx;
  526. }
  527. }
  528. }
  529. .list {
  530. .item {
  531. .icon {
  532. font-size: 72rpx;
  533. color: #e7c993;
  534. }
  535. .num {
  536. color: #282828;
  537. font-size: 32rpx;
  538. font-weight: 600;
  539. }
  540. padding: 0 24rpx 26rpx 24rpx;
  541. position: relative;
  542. margin-bottom: 34rpx;
  543. .pictrue {
  544. width: 76rpx;
  545. height: 76rpx;
  546. background-color: #fdf8ee;
  547. border-radius: 50%;
  548. .iconfont {
  549. color: #f7b942;
  550. font-size: 40rpx;
  551. }
  552. }
  553. .txt {
  554. font-weight: 400;
  555. color: #282828;
  556. font-size: 28rpx;
  557. margin-left: 24rpx;
  558. .line1 {
  559. width: 320rpx;
  560. }
  561. .exp {
  562. color: #999999;
  563. font-size: 22rpx;
  564. margin-top: 2rpx;
  565. &.record {
  566. margin-top: 8rpx;
  567. }
  568. image {
  569. color: #999999;
  570. margin-right: 10rpx;
  571. width: 22rpx;
  572. height: 22rpx;
  573. }
  574. }
  575. .time {
  576. color: #999999;
  577. font-size: 22rpx;
  578. margin-top: 8rpx;
  579. }
  580. }
  581. .bnt {
  582. width: 112rpx;
  583. height: 44rpx;
  584. background: #f4dbab;
  585. border-radius: 26rpx;
  586. color: #755214;
  587. font-size: 24rpx;
  588. }
  589. &::before {
  590. position: absolute;
  591. content: '';
  592. width: 542rpx;
  593. height: 1px;
  594. background: #eeeeee;
  595. bottom: 0rpx;
  596. right: 24rpx;
  597. }
  598. }
  599. }
  600. }
  601. }
  602. </style>