index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  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>会员尊享权益</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" @touchmove.stop.prevent="moveHandle">
  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" style="position: relative;">
  156. <w-barcode :options="config.bar"></w-barcode>
  157. </view>
  158. <view class="acea-row row-center-wrapper" style="margin-top: 35rpx;position: relative;">
  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" @touchmove.stop.prevent="moveHandle"></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. moveHandle(){
  238. },
  239. /**
  240. * 授权回调
  241. */
  242. onLoadFun: function() {
  243. this.isShowAuth = false;
  244. },
  245. // 授权关闭
  246. authColse: function(e) {
  247. this.isShowAuth = e
  248. },
  249. more(){
  250. uni.navigateTo({
  251. url: '/pages/users/user_vip/index'
  252. })
  253. },
  254. record(){
  255. uni.navigateTo({
  256. url: '/pages/annex/record_list/index'
  257. })
  258. },
  259. hello(res) {
  260. // console.log(321,res)
  261. },
  262. getCode() {
  263. getRandCode().then(res => {
  264. let code = res.data.code;
  265. this.config.bar.code = code;
  266. this.config.qrc.code = code;
  267. }).catch(err => {
  268. return this.$util.Tips(err);
  269. })
  270. },
  271. tapQrCode() {
  272. if(this.isLogin){
  273. this.isCode = true;
  274. this.codeIndex = 0;
  275. this.$nextTick(function() {
  276. let code = this.user_info.bar_code;
  277. this.config.bar.code = code;
  278. this.config.qrc.code = code;
  279. })
  280. }else{
  281. toLogin()
  282. }
  283. },
  284. closeCode() {
  285. this.isCode = false
  286. },
  287. tapCode(index) {
  288. this.codeIndex = index;
  289. if (index == 1) {
  290. this.getCode();
  291. } else {
  292. let code = this.user_info.bar_code;
  293. this.config.bar.code = code;
  294. this.config.qrc.code = code;
  295. }
  296. },
  297. levelInfo(){
  298. getlevelInfo().then(res=>{
  299. this.user_info = res.data.user;
  300. this.task_info = res.data.task;
  301. this.level_info = res.data.level_info;
  302. res.data.level_list.forEach(item=>{
  303. if(item.name === res.data.level_info.name){
  304. this.level_info.next_exp = item.next_exp_num
  305. }
  306. })
  307. }).catch(err=>{
  308. this.$util.Tips({
  309. title: err
  310. })
  311. })
  312. },
  313. getUserBillList(){
  314. moneyList({
  315. page: 1,
  316. limit: 5
  317. },9).then(res=>{
  318. this.list = res.data.list;
  319. }).catch(err=>{
  320. this.$util.Tips({
  321. title: err
  322. })
  323. })
  324. }
  325. }
  326. }
  327. </script>
  328. <style lang="scss">
  329. .vipGrade{
  330. .mark {
  331. position: fixed;
  332. top: 0;
  333. left: 0;
  334. bottom: 0;
  335. right: 0;
  336. background: rgba(0, 0, 0, 0.5);
  337. z-index: 50;
  338. }
  339. .codePopup .header .title.on{
  340. background-color: #F7B942 !important;
  341. }
  342. .headerBg{
  343. background: url('../static/big-bg.png') no-repeat;
  344. background-size: 100% 100%;
  345. width: 100%;
  346. height: 276rpx;
  347. padding-top: 1rpx;
  348. .header{
  349. width: 690rpx;
  350. height: 318rpx;
  351. background: url('../static/grade-bg.png') no-repeat;
  352. background-size: 100% 100%;
  353. margin: 18rpx auto 0 auto;
  354. padding-top: 40rpx;
  355. .top{
  356. margin: 0 30rpx 70rpx 30rpx;
  357. .progress{
  358. overflow: hidden;
  359. background-color: #EEEEEE;
  360. width: 200rpx;
  361. height: 6rpx;
  362. border-radius: 7rpx;
  363. position: relative;
  364. margin-right: 6rpx;
  365. .bg-reds{
  366. width: 0;
  367. height: 100%;
  368. transition: width 0.6s ease;
  369. background: linear-gradient(90deg, rgba(233, 51, 35, 1) 0%, rgba(255, 137, 51, 1) 100%);
  370. }
  371. }
  372. .percent{
  373. font-size: 20rpx;
  374. color: #463B26;
  375. margin-left: 12rpx;
  376. }
  377. .code{
  378. color: #333333;
  379. font-size: 20rpx;
  380. text-align: center;
  381. .icon-erweima3{
  382. margin-bottom: 6rpx;
  383. }
  384. }
  385. .pictrue{
  386. width: 80rpx;
  387. height: 80rpx;
  388. border: 2rpx solid #9A8661;
  389. border-radius: 50%;
  390. margin-right: 22rpx;
  391. image{
  392. width: 100%;
  393. height: 100%;
  394. border-radius: 50%;
  395. }
  396. }
  397. .nickname{
  398. font-size: 30rpx;
  399. font-weight: 600;
  400. color: #333333;
  401. max-width: 220rpx;
  402. }
  403. .name{
  404. font-size: 20rpx;
  405. color: #E8C891;
  406. font-weight: 500;
  407. background: #333333;
  408. border-radius: 6rpx;
  409. padding: 0 6rpx;
  410. margin-left: 12rpx;
  411. }
  412. .levelImage{
  413. width: 30rpx;
  414. height: 30rpx;
  415. margin-left: 12rpx;
  416. }
  417. }
  418. .bottom{
  419. padding-left: 30rpx;
  420. .item{
  421. flex: 1;
  422. padding: 0 10rpx;
  423. color: #333333;
  424. font-size: 24rpx;
  425. .num{
  426. font-weight: 600;
  427. font-size: 36rpx;
  428. margin-top: 6rpx;
  429. .numSp{
  430. font-size: 26rpx;
  431. }
  432. }
  433. }
  434. }
  435. }
  436. }
  437. .equity{
  438. margin: 82rpx auto 0 auto;
  439. width: 690rpx;
  440. height: 300rpx;
  441. background: #FFFFFF;
  442. border-radius: 14rpx;
  443. .title{
  444. padding: 28rpx 24rpx 0 24rpx;
  445. font-weight: 600;
  446. color: #333333;
  447. font-size: 34rpx;
  448. .more{
  449. font-weight: 400;
  450. color: #666666;
  451. font-size: 24rpx;
  452. .iconfont{
  453. font-size: 20rpx;
  454. }
  455. }
  456. }
  457. .list{
  458. margin-top: 44rpx;
  459. .item{
  460. color: #282828;
  461. font-size: 26rpx;
  462. .pictrue{
  463. width: 90rpx;
  464. height: 90rpx;
  465. border-radius: 50%;
  466. margin-bottom: 12rpx;
  467. image{
  468. width: 100%;
  469. height: 100%;
  470. border-radius: 50%;
  471. }
  472. }
  473. }
  474. }
  475. }
  476. .task{
  477. width: 690rpx;
  478. height: 524rpx;
  479. background: #FFFFFF;
  480. border-radius: 14rpx;
  481. margin: 20rpx auto 0 auto;
  482. &.on{
  483. height: unset;
  484. }
  485. .title{
  486. padding: 34rpx 24rpx 46rpx 24rpx;
  487. font-weight: 600;
  488. color: #333333;
  489. line-height: 30rpx;
  490. .more{
  491. font-weight: 400;
  492. color: #666666;
  493. font-size: 24rpx;
  494. .iconfont{
  495. font-size: 20rpx;
  496. }
  497. }
  498. }
  499. .list{
  500. .item{
  501. .icon{
  502. font-size: 72rpx;
  503. color: #E7C993;
  504. }
  505. .num{
  506. color: #282828;
  507. font-size: 32rpx;
  508. font-weight: 600;
  509. }
  510. padding: 0 24rpx 26rpx 24rpx;
  511. position: relative;
  512. margin-bottom: 34rpx;
  513. .pictrue{
  514. width: 76rpx;
  515. height: 76rpx;
  516. background-color: #FDF8EE;
  517. border-radius: 50%;
  518. .iconfont{
  519. color: #F7B942;
  520. font-size: 40rpx;
  521. }
  522. }
  523. .txt{
  524. font-weight: 400;
  525. color: #282828;
  526. font-size: 28rpx;
  527. margin-left: 24rpx;
  528. .line1{
  529. width: 320rpx;
  530. }
  531. .exp{
  532. color: #999999;
  533. font-size: 22rpx;
  534. margin-top: 2rpx;
  535. &.record{
  536. margin-top: 8rpx;
  537. }
  538. image{
  539. color: #999999;
  540. margin-right: 10rpx;
  541. width: 22rpx;
  542. height: 22rpx;
  543. }
  544. }
  545. .time{
  546. color: #999999;
  547. font-size: 22rpx;
  548. margin-top: 8rpx;
  549. }
  550. }
  551. .bnt{
  552. width: 112rpx;
  553. height: 44rpx;
  554. background: #F4DBAB;
  555. border-radius: 26rpx;
  556. color: #755214;
  557. font-size: 24rpx;
  558. }
  559. &::before{
  560. position: absolute;
  561. content: '';
  562. width: 542rpx;
  563. height: 1px;
  564. background: #EEEEEE;
  565. bottom: 0rpx;
  566. right: 24rpx;
  567. }
  568. }
  569. }
  570. }
  571. }
  572. </style>