index.vue 14 KB

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