index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  1. <template>
  2. <view class="memberCenter">
  3. <zs-header title="会员中心" :background="background"></zs-header>
  4. <view class="top-box target" :style="{backgroundImage:`url(${list[current].backImg})`}">
  5. <view class="user-info">
  6. <image class="image" :src="userInfo.imgPath || defaultImg" lazy-load mode=""></image>
  7. <view class="info">
  8. <view class="user-name" :style="{color:`${list[current].backColour}`}">{{userInfo.nickname ||'用户'}}</view>
  9. <view class="tel">{{currentLevelName ||'您当前未开通会员'}}</view>
  10. </view>
  11. </view>
  12. <view class="swiper-box">
  13. <image v-if="current!=0" class="click left" src="../../static/member/click.gif" mode=""></image>
  14. <image v-if="current!=list.length-1" class="click" src="../../static/member/click.gif" mode=""></image>
  15. <swiper @change="changeSwiper" :current="current" class="swiper"
  16. >
  17. <swiper-item class="swiper-item" v-for="(item,index) in list" :key="item.setMealCode">
  18. <view class="content">
  19. <view :style="{background:item.backColour,color:item.colour}" v-if="userInfo.setMealCode == item.setMealCode" class="tag">
  20. 当前等级
  21. </view>
  22. <image class="icon" :src="item.imgUrl" mode=""></image>
  23. <!-- <view class="price" :style="{color:item.color}">
  24. {{`开通会员${item.price}/月`}}
  25. </view>
  26. <view class="notice" :style="{color:item.color}">
  27. 开通会员预计节省 <text class="num">¥99元</text>
  28. </view> -->
  29. </view>
  30. </swiper-item>
  31. </swiper>
  32. </view>
  33. </view>
  34. <view v-if="list1.length">
  35. <view class="title-box">
  36. <view class="title">
  37. 基础权益
  38. </view>
  39. </view>
  40. <u-grid :border="false" col="3">
  41. <u-grid-item v-for="(item,d) in list1" :key="d">
  42. <image class="icon" :src="item.equityImg" mode=""></image>
  43. <text class="title">{{item.equityName}}</text>
  44. <text class="desc">{{item.equityDetail}}</text>
  45. </u-grid-item>
  46. </u-grid>
  47. </view>
  48. <view v-if="list2.length">
  49. <view class="title-box">
  50. <view class="title">
  51. 专属权益
  52. </view>
  53. </view>
  54. <u-grid :border="false" col="3">
  55. <u-grid-item v-for="(item,d) in list2" :key="d" @click="openPop(item)">
  56. <image class="icon" :src="item.equityImg" mode=""></image>
  57. <text class="title">{{item.equityName}}</text>
  58. <text class="desc">{{item.equityDetail}}</text>
  59. </u-grid-item>
  60. </u-grid>
  61. </view>
  62. <!--
  63. <view class="title-box">
  64. <view class="title">
  65. 娱乐
  66. </view>
  67. <view class="desc">
  68. 享受多达24种娱乐权益
  69. </view>
  70. </view>
  71. <u-grid :border="false" col="3">
  72. <u-grid-item v-for="(item,listIndex) in list1" :key="listIndex">
  73. <image class="icon" :src="item.icon" mode=""></image>
  74. <text class="title">{{item.title}}</text>
  75. <text class="desc">{{item.desc}}</text>
  76. </u-grid-item>
  77. </u-grid> -->
  78. <view class="fixed-box">
  79. <view class="btn-box">
  80. <view class="left-box" @click="handleCall">
  81. <image class="icon" src="../../static/phone.png" mode=""></image>
  82. <view class="info">
  83. <view class="tel">
  84. 10086
  85. </view>
  86. <view class="desc">
  87. 套餐咨询
  88. </view>
  89. </view>
  90. </view>
  91. <button class="btn" :loading="btnLoading" @click="goOrder">
  92. 立即开通
  93. </button>
  94. </view>
  95. <view class="agreement-box">
  96. <u-checkbox-group size="28rpx" v-model="checked" @change="choose">
  97. <u-checkbox activeColor="#EE4320" shape="circle" name="1" ></u-checkbox>
  98. </u-checkbox-group>
  99. <view class="text">
  100. 已阅读并同意 <text class="color" @click="jump">《慧研学惠生活基础会员服务协议》</text>
  101. </view>
  102. </view>
  103. </view>
  104. <u-popup :show="show" round="32rpx" mode="bottom" @close="show = false">
  105. <view class="discounts-title">
  106. 权益领取
  107. </view>
  108. <view class="discounts">
  109. <view class="discounts-item" >
  110. <view class="type-box">
  111. <view class="price">
  112. {{item | filterPrice}}
  113. </view>
  114. <view class="type">
  115. {{item | filterType}}
  116. </view>
  117. </view>
  118. <view class="info">
  119. <view class="card-title">
  120. {{item.couponName}}
  121. </view>
  122. <view class="limit">
  123. {{item.useStartTime}}后可用
  124. </view>
  125. <view class="desc">
  126. {{item.usrDetail || '-'}}
  127. </view>
  128. </view>
  129. <view class="btn" :class="[item.exist > 0?'used':'']" @click="handleBuy(item.id,item.exist)">
  130. {{item.exist > 0?'已领取':'领取'}}
  131. </view>
  132. </view>
  133. <view class="sub-title" v-if="item.equityMsg">
  134. 权益领取
  135. </view>
  136. <!-- <rich-text class="desc" :nodes="item.equityMsg"></rich-text> -->
  137. <view class="desc" v-html="item.equityMsg">
  138. {{item.equityMsg}}
  139. </view>
  140. </view>
  141. </u-popup>
  142. <web-view v-if="H5url" :src="H5url"></web-view>
  143. </view>
  144. </template>
  145. <script>
  146. import {mealList,equityList,getH5url} from '@/api/combo.js'
  147. import {getXiaojuCoupon,getCouponDetail} from '@/api/coupon.js'
  148. export default {
  149. data() {
  150. return {
  151. checked:'',
  152. current: 0,//轮播套餐index
  153. currentMeal: 0,//套餐id
  154. background: false,
  155. defaultImg: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fci.xiaohongshu.com%2Fc34b7b74-ba38-0456-982a-43c0f97522fe%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fci.xiaohongshu.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1693532127&t=a2e186c12aecaab7723611cb52a6778f',
  156. userInfo: {
  157. imgPath: "",
  158. isAuth: 1,
  159. lastLogin: "",
  160. nickname: "",
  161. openId: "",
  162. phoneNum: "",
  163. score: 0,
  164. setMealId: 0,
  165. sex: 1,
  166. userId: "",
  167. },
  168. list: [{backImg:''}],
  169. list1:[],
  170. list2:[],
  171. query:{
  172. "channelCode": "",
  173. "channelType": "",
  174. "discount": 6,
  175. "extension": "test",
  176. "phone": "",
  177. "saleModalId": ""
  178. },
  179. H5url:'',
  180. btnLoading:false,
  181. currentMealCode:0,
  182. show:false,
  183. item:{}
  184. }
  185. },
  186. computed: {
  187. currentLevelName() {
  188. let list = this.list.filter(item=>{
  189. if(item.setMealCode == this.userInfo.setMealCode){
  190. return item
  191. }
  192. })
  193. if(list.length){
  194. return list[0].setMealName
  195. }else{
  196. return ''
  197. }
  198. }
  199. },
  200. filters: {
  201. filterPrice: function(val) {
  202. if(val.couponType == 1){
  203. return `¥${val.couponDiscount}`
  204. }else if(val.couponType == 2){
  205. return `${val.couponDiscount}折`
  206. }else if(val.couponType == 3){
  207. return `¥${val.couponDiscount}`
  208. }
  209. },
  210. filterType: function(val) {
  211. if(val.couponType == 1){
  212. if(val.couponCondition){
  213. return `满${val.couponCondition}立减`
  214. }else{
  215. return '无门槛立减'
  216. }
  217. }else if(val.couponType == 2){
  218. if(val.couponCondition){
  219. return `满${val.couponCondition}`
  220. }else{
  221. return '无门槛立减'
  222. }
  223. }else if(val.couponType == 3){
  224. if(val.couponCondition){
  225. return `满${val.couponCondition}立减`
  226. }else{
  227. return '无门槛立减'
  228. }
  229. }
  230. },
  231. },
  232. methods: {
  233. handleCall() {
  234. uni.makePhoneCall({
  235. phoneNumber: '10086' //仅为示例
  236. });
  237. },
  238. openPop(item){
  239. if(item.bindService == 2){//加油券
  240. this.show = true
  241. getCouponDetail({id:item.bindContent}).then(res=>{
  242. if(res.state == 'Success'){
  243. this.item = res.content
  244. this.item.equityMsg = item.equityMsg.replaceAll('\n','<br/>')
  245. }
  246. })
  247. }
  248. },
  249. // 点击领取
  250. handleBuy() {
  251. getXiaojuCoupon({activityXiaojuId:this.item.activityXiaojuId,userId:JSON.parse(uni.getStorageSync('userInfo')).userId,mobile:JSON.parse(uni.getStorageSync('userInfo')).phoneNum}).then(res=>{
  252. if(res.state == 'Success'){
  253. uni.showToast({
  254. title:'领取成功',
  255. icon:'success'
  256. })
  257. }
  258. })
  259. },
  260. jump(){
  261. uni.navigateTo({
  262. url:'/agreement/member'
  263. })
  264. },
  265. choose(val){
  266. console.log(val);
  267. },
  268. goOrder(){
  269. if(!this.checked.length) return uni.showToast({
  270. title:'请勾选会员服务协议',
  271. icon:'none'
  272. })
  273. if(this.btnLoading) return
  274. this.query.saleModalId = this.list[this.current].setMealCode
  275. // this.H5url = 'http://iot-pay-server.dev.zonelife.cn/app-h5/task/dist/index.html#/localLife/orderResult?businessName=%E7%A0%94%E5%AD%A620%E5%85%83%E5%8C%85&lifeId=fcbfbb7ea3ada89ad160da82dc9c75e6'
  276. this.getH5url()
  277. },
  278. changeSwiper(val) {
  279. this.current = val.target.current
  280. this.currentMeal = this.list[val.target.current].setMealCode
  281. this.query.discount = this.list[val.target.current].discount
  282. this.equityList(this.currentMeal,1)
  283. this.equityList(this.currentMeal,2)
  284. },
  285. mealList(){
  286. return new Promise((resolve,reject)=>{
  287. mealList({currentPage:1,pageSize:99,status:1}).then(res=>{
  288. if (res.state == 'Success') {
  289. this.list = res.content.records
  290. this.currentMeal = this.list[0].setMealCode
  291. this.query.discount = this.list[0].discount
  292. resolve(this.currentMeal)
  293. }
  294. })
  295. })
  296. },
  297. equityList(setMealCode,equityType){
  298. return new Promise((resolve,reject)=>{
  299. equityList({currentPage:1,pageSize:99,setMealCode,equityType,status:1,showType:1}).then(res=>{
  300. if (res.state == 'Success') {
  301. this['list'+equityType] = res.content.records
  302. resolve(setMealCode)
  303. }
  304. })
  305. })
  306. },
  307. getData(){
  308. this.mealList().then(id=>{
  309. return this.equityList(id,1)
  310. }).then(id1=>{
  311. this.equityList(id1,2)
  312. })
  313. },
  314. getH5url(){
  315. this.btnLoading = true
  316. getH5url(this.query).then(res=>{
  317. this.btnLoading = false
  318. if (res.state == 'Success') {
  319. this.H5url = res.content
  320. }
  321. })
  322. }
  323. },
  324. onPageScroll(e) {
  325. if (e.scrollTop >= 50) {
  326. this.background = true
  327. } else {
  328. this.background = false
  329. }
  330. },
  331. created() {
  332. if(uni.getStorageSync('userInfo')) {
  333. this.userInfo = JSON.parse(uni.getStorageSync('userInfo'))
  334. this.query.phone = this.userInfo.phoneNum
  335. }
  336. // this.current = this.userInfo.setMealId
  337. this.getData()
  338. },
  339. onLoad(options) {
  340. console.log('onload',options);
  341. }
  342. }
  343. </script>
  344. <style lang="scss">
  345. .memberCenter {
  346. min-height: 100vh;
  347. background: #FFF;
  348. padding-bottom: 180rpx;
  349. .swiper-box{
  350. position: relative;
  351. .click{
  352. position: absolute;
  353. top: calc(50% - 25rpx) ;
  354. right: 0;
  355. width: 100rpx;
  356. height: 100rpx;
  357. z-index: 999;
  358. }
  359. .click.left{
  360. left: 0;
  361. transform: rotateY(180deg);
  362. }
  363. .swiper {
  364. width: 750rpx !important;
  365. height: 272rpx !important;
  366. position: relative;
  367. left: -30rpx;
  368. top: 20rpx;
  369. }
  370. .swiper-item {
  371. width: 640rpx !important;
  372. height: 272rpx !important;
  373. position: relative;
  374. padding: 0 55rpx;
  375. .active {
  376. // transform: scale(1) !important;
  377. }
  378. .content {
  379. // transform: scale(.9);
  380. // transition: transform .3s;
  381. // transform-origin: center center;
  382. .icon {
  383. width: 640rpx;
  384. height: 272rpx;
  385. border-radius: 16rpx;
  386. }
  387. .tag {
  388. width: 104rpx;
  389. height: 34rpx;
  390. line-height: 34rpx;
  391. text-align: center;
  392. font-size: 22rpx;
  393. color: #fff;
  394. border-radius: 16rpx 0rpx 16rpx 0rpx;
  395. position: absolute;
  396. top: 0%;
  397. left: 55rpx;
  398. z-index: 2;
  399. }
  400. .price {
  401. font-size: 24rpx;
  402. position: absolute;
  403. left: 95rpx;
  404. top: 140rpx;
  405. }
  406. .notice {
  407. font-size: 24rpx;
  408. position: absolute;
  409. left: 95rpx;
  410. bottom: 40rpx;
  411. .num {
  412. font-weight: bold;
  413. font-size: 36rpx;
  414. }
  415. }
  416. }
  417. }
  418. }
  419. .top-box {
  420. width: 750rpx;
  421. height: 600rpx;
  422. padding: 150rpx 30rpx 0;
  423. box-sizing: border-box;
  424. position: relative;
  425. background-size: 100% 495rpx;
  426. background-repeat: no-repeat;
  427. .user-info {
  428. display: flex;
  429. align-items: center;
  430. justify-content: space-between;
  431. padding: 15rpx 0;
  432. color: #222222;
  433. .image {
  434. width: 108rpx;
  435. height: 108rpx;
  436. background: #f1f1f1;
  437. border-radius: 50%;
  438. }
  439. .info {
  440. flex: 1;
  441. margin-left: 30rpx;
  442. .user-name {
  443. font-size: 32rpx;
  444. font-weight: bold;
  445. color: #222222;
  446. }
  447. .tel {
  448. font-size: 24rpx;
  449. margin-top: 10rpx;
  450. color: #AAAAAA;
  451. }
  452. }
  453. }
  454. }
  455. .title-box {
  456. display: flex;
  457. align-items: center;
  458. margin: 30rpx 30rpx 0;
  459. .title {
  460. color: #222222;
  461. font-weight: bold;
  462. font-size: 32rpx;
  463. }
  464. .desc {
  465. margin-left: 10rpx;
  466. font-size: 22rpx;
  467. color: #AAAAAA;
  468. }
  469. }
  470. .u-grid{
  471. .u-grid-item{
  472. padding-top:30rpx ;
  473. }
  474. .icon{
  475. width: 80rpx;
  476. height: 80rpx;
  477. border-radius: 50%;
  478. }
  479. .title{
  480. width: 200rpx;
  481. font-size: 28rpx;
  482. color: #222222;
  483. margin-top: 10rpx;
  484. text-align: center;
  485. font-weight: bold;
  486. }
  487. .desc{
  488. width: 150rpx;
  489. color: #AAAAAA;
  490. font-size: 20rpx;
  491. text-align: center;
  492. }
  493. }
  494. .fixed-box {
  495. position: fixed;
  496. bottom: 0%;
  497. left: 0%;
  498. width: 100%;
  499. background: #fff;
  500. padding: 15rpx 20rpx 40rpx;
  501. box-sizing: border-box;
  502. .btn-box{
  503. display: flex;
  504. justify-content: space-between;
  505. align-items: center;
  506. .left-box {
  507. display: flex;
  508. align-items: center;
  509. .icon {
  510. width: 80rpx;
  511. height: 80rpx;
  512. }
  513. .info {
  514. margin-left: 20rpx;
  515. .tel {
  516. color: #222222;
  517. font-weight: bold;
  518. font-size: 32rpx;
  519. }
  520. .desc {
  521. font-size: 22rpx;
  522. color: #999999;
  523. }
  524. }
  525. }
  526. .btn {
  527. width: 340rpx;
  528. height: 80rpx;
  529. line-height: 80rpx;
  530. margin: 0;
  531. text-align: center;
  532. background: #FF4C3A;
  533. color: #fff;
  534. font-size: 28rpx;
  535. font-weight: bold;
  536. border-radius: 40rpx 40rpx 40rpx 40rpx;
  537. }
  538. }
  539. .agreement-box{
  540. display: flex;
  541. align-items: center;
  542. justify-content: center;
  543. font-size: 20rpx;
  544. color: #999999;
  545. margin-top: 20rpx;
  546. .color{
  547. color: #EE4320;
  548. }
  549. }
  550. }
  551. .discounts-title {
  552. font-weight: bold;
  553. font-size: 32rpx;
  554. color: #222222;
  555. // text-align: center;
  556. padding: 28rpx 24rpx;
  557. }
  558. .discounts {
  559. padding: 0 24rpx 28rpx;
  560. max-height: 1000rpx;
  561. min-height: 600rpx;
  562. overflow: auto;
  563. .discounts-item {
  564. margin-bottom: 20rpx;
  565. display: flex;
  566. align-items: center;
  567. background-color: rgb(239, 239, 239);
  568. background: url('../../static/new-card.png') no-repeat;
  569. background-repeat: no-repeat;
  570. background-size: 100% 144rpx;
  571. border-radius: 16rpx;
  572. height: 144rpx;
  573. padding: 0 24rpx;
  574. box-sizing: border-box;
  575. .type-box{
  576. text-align: center;
  577. .price{
  578. ont-size: 40rpx;
  579. color: #FF4D3A;
  580. }
  581. .type{
  582. font-size: 20rpx;
  583. color: #AAAAAA;
  584. margin-top: 12rpx;
  585. }
  586. }
  587. .info {
  588. flex: 1;
  589. margin-left: 40rpx;
  590. .card-title {
  591. font-size: 28rpx;
  592. color: #222222;
  593. }
  594. .desc{
  595. font-size: 20rpx;
  596. color: #AAAAAA;
  597. }
  598. .limit{
  599. font-size: 20rpx;
  600. color: #AAAAAA;
  601. margin:10rpx 0;
  602. }
  603. }
  604. .btn {
  605. width: 118rpx;
  606. height: 48rpx;
  607. line-height: 48rpx;
  608. text-align: center;
  609. font-size: 24rpx;
  610. background: #EE4320;
  611. border-radius: 24rpx;
  612. color: #FFF;
  613. box-sizing: border-box;
  614. }
  615. .btn.used{
  616. border: 2rpx solid #EE421F;
  617. color: #EE421F;
  618. background: none;
  619. }
  620. }
  621. .sub-title{
  622. font-weight: bold;
  623. font-size: 26rpx;
  624. color: #222222;
  625. // text-align: center;
  626. padding: 28rpx 24rpx;
  627. }
  628. .desc{
  629. color: #AAAAAA;
  630. font-size: 24rpx;
  631. line-height: 40rpx;
  632. }
  633. }
  634. }
  635. </style>