index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. <template>
  2. <view v-if="vipSetting.length > 0">
  3. <view class="vipcard-detail-header">
  4. <image class="bg" :src="statics.vipcardDetailHeaderBg"></image>
  5. <view class="main pt20">
  6. <view class="flex alcenter space">
  7. <view class="col3 text-center">
  8. <view class="ft12 cl-w8">{{vipLevel>1?'到期日期':''}}</view>
  9. <view class="mt8 vipcard-num">{{vipLevel>1?userinfo.dtime:''}}</view>
  10. </view>
  11. <view class="col3 flex center">
  12. <image class="vipcard-face" :src="avatar"></image>
  13. </view>
  14. <view class="col3 text-center">
  15. <view class="ft12 cl-w8">{{vipLevel>1?'剩余天数':''}}</view>
  16. <view v-if="userinfo.dqts>=0" class="mt8 vipcard-num">{{vipLevel>1?userinfo.dqts+'天':''}}</view>
  17. <view v-if="userinfo.dqts<0" class="mt8 vipcard-num">{{vipLevel>1?'已经到期'+-userinfo.dqts+'天':''}}</view>
  18. </view>
  19. </view>
  20. <view class="flex center mt8">
  21. <view class="vipcard-level-tag ft12 cl-w8">当前等级:<text class="ftw600 ft12 ml4">{{vipname}}</text></view>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="vipcard-detail-main">
  26. <view class="flex center">
  27. <swiper @change="changeVip" class="vipcard-swiper" previous-margin="15px" next-margin="30px" :indicator-dots="false" :autoplay="false">
  28. <swiper-item>
  29. <view class="swiper-item">
  30. <view class="card">
  31. <image class="bg" :src="statics.vipcardBg[vipLevel-1]"></image>
  32. <view class="main">
  33. <view class="text-center ft20 ftw600 cl-main">{{vipname}}</view>
  34. <view v-if="userinfo.dqts>=0" class="mt20 flex center">
  35. <view @click="vipcm" v-if="vipLevel == 1" class="vipcard-info"><text class="ft14 ftw600 ml4 cl-main">立即升级</text></view>
  36. <view @click="vipcm" v-if="vipLevel == 2" class="vipcard-info">{{userinfo.dqts}}天后到期 续费VIP</view>
  37. </view>
  38. <view v-if="userinfo.dqts<0" class="mt20 flex center">
  39. <view @click="vipcm" v-if="vipLevel == 1" class="vipcard-info"><text class="ft14 ftw600 ml4 cl-main">立即升级</text></view>
  40. <view @click="vipcm" v-if="vipLevel == 2" class="vipcard-info">已经到期{{-userinfo.dqts}}天 立即续费VIP</view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </swiper-item>
  46. </swiper>
  47. </view>
  48. <view class="pd16_15">
  49. <view class="box noshadow pd16_15">
  50. <view class="ft16 ftw600 cl-main">VIP会员持有权益</view>
  51. <view class="flex space alcenter mt16">
  52. <view class="vipcard-con-box pd20_15 flex alcenter">
  53. <image style="width: 80rpx;height: 80rpx;" :src="statics.vipTq[0]"></image>
  54. <view class="ml10">
  55. <view class="ft14 ftw600 cl-main">福利</view>
  56. <view class="mt6 ft12 cl-notice">超级礼包</view>
  57. </view>
  58. </view>
  59. <view class="vipcard-con-box pd20_15 flex alcenter">
  60. <image style="width: 80rpx;height: 80rpx;" :src="statics.vipTq[1]"></image>
  61. <view class="ml10">
  62. <view class="ft14 ftw600 cl-main">特惠折扣</view>
  63. <view class="mt6 ft12 cl-notice">会员专属价</view>
  64. </view>
  65. </view>
  66. </view>
  67. <view class="flex space alcenter mt16">
  68. <view class="vipcard-con-box pd20_15 flex alcenter">
  69. <image style="width: 80rpx;height: 80rpx;" :src="statics.vipTq[2]"></image>
  70. <view class="ml10">
  71. <view class="ft14 ftw600 cl-main">专属特惠</view>
  72. <view class="mt6 ft12 cl-notice">免费视频</view>
  73. </view>
  74. </view>
  75. <view class="vipcard-con-box pd20_15 flex alcenter">
  76. <image style="width: 80rpx;height: 80rpx;" :src="statics.vipTq[3]"></image>
  77. <view class="ml10">
  78. <view class="ft14 ftw600 cl-main">专属顾问</view>
  79. <view class="mt6 ft12 cl-notice">独家找片</view>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. </view>
  86. <dialog-birthday :showOnly="true" :title="'V'+vipSetting[selectId].level +vipSetting[selectId].name + '生日礼包'" v-if="showBirthday" @closed="showBirthday = false"></dialog-birthday>
  87. </view>
  88. </template>
  89. <script>
  90. export default{
  91. data(){
  92. return {
  93. vipLevel:'',
  94. rankNum:290, //成长值
  95. selectId:0,
  96. vipname:'',
  97. showBirthday:false,
  98. avatar:'',
  99. userinfo:[],
  100. vid:0,
  101. mid:0,
  102. vipSetting:[
  103. {level:1,name:'普通会员',rank_need:100},
  104. {level:2,name:'VIP会员',rank_need:200},
  105. // {level:3,name:'铂金会员',rank_need:300},
  106. // {level:4,name:'钻石会员',rank_need:400},
  107. // {level:5,name:'至尊会员',rank_need:500},
  108. ],
  109. }
  110. },
  111. onLoad(e) {
  112. if(e.vid){
  113. this.vid=e.vid
  114. }
  115. if(e.mid){
  116. this.mid=e.mid
  117. }
  118. },
  119. onShow() {
  120. this.ongrzlTap();
  121. },
  122. computed:{
  123. getVipType(){
  124. let arr = new Array;
  125. for(var a in this.vipSetting){
  126. let type = 0; // 0未达到 1已达到 2当前
  127. if(this.vipLevel > this.vipSetting[a].level){
  128. type = 1;
  129. }else if(this.vipLevel == this.vipSetting[a].level){
  130. type = 2;
  131. }
  132. arr.push(type);
  133. }
  134. return arr;
  135. }
  136. },
  137. methods:{
  138. async ongrzlTap(){
  139. let data = {};
  140. data.token = uni.getStorageSync("userinfo").token;
  141. data.uid = uni.getStorageSync("userinfo").id;
  142. uni.request({
  143. url: this.configs.webUrl+'/api/user/index',
  144. data: data,
  145. success: res =>{
  146. if(res.data.code==1){
  147. let ionfo=res.data.data
  148. this.userinfo=ionfo
  149. this.vipLevel=ionfo.group_id
  150. if(this.vipLevel==1){
  151. this.vipname='普通会员'
  152. }else{
  153. this.vipname='VIP会员'
  154. }
  155. if(res.data.data.avatar){
  156. var str = res.data.data.avatar;
  157. if(str.indexOf("data:image") != -1){
  158. this.avatar='';
  159. }else{
  160. if(str.indexOf("http") != -1){
  161. this.avatar=res.data.data.avatar;
  162. }else{
  163. this.avatar=this.configs.imgUrl+res.data.data.avatar;
  164. }
  165. }
  166. }else{
  167. this.avatar='';
  168. }
  169. }else{
  170. uni.showToast({ title: res.data.msg,icon:"none" });
  171. }
  172. },
  173. fail: (data, code) => {
  174. //console.log('fail' + JSON.stringify(data));
  175. }
  176. });
  177. },
  178. changeVip(e){
  179. this.selectId = parseInt(e.detail.current);
  180. },
  181. vipcm(){
  182. //uni.showToast({ title: '0000',icon:"none" });
  183. uni.navigateTo({
  184. url:'/pages/client/vipcard/vipcm?vid='+this.vid+'&mid='+this.mid
  185. })
  186. }
  187. }
  188. }
  189. </script>
  190. <style>
  191. .vipcard-detail-header{
  192. position: relative;
  193. height: 480rpx;
  194. }
  195. .vipcard-detail-header .bg{
  196. width: 100%;
  197. height: 480rpx;
  198. }
  199. .vipcard-detail-header .main{
  200. height: 480rpx;
  201. width: 100%;
  202. position: absolute;
  203. left: 0;
  204. top: 0;
  205. }
  206. .vipcard-detail-header .vipcard-num{
  207. font-size: 24rpx;
  208. font-weight: bold;
  209. line-height: 48rpx;
  210. background: linear-gradient(180deg, #F2DCA9 0%, #C79556 100%);
  211. -webkit-background-clip: text;
  212. -webkit-text-fill-color: transparent;
  213. }
  214. .vipcard-detail-header .vipcard-face{
  215. width: 112rpx;
  216. height: 112rpx;
  217. border:8rpx solid rgba(255,255,255,0.9);
  218. border-radius: 100rpx;
  219. background: rgba(255,255,255,0.9);
  220. }
  221. .vipcard-detail-header .vipcard-level-tag{
  222. height: 40rpx;
  223. border-radius: 20rpx;
  224. padding: 0 16rpx;
  225. display: flex;
  226. justify-content: center;
  227. align-items: center;
  228. border:2rpx solid rgba(255,255,255,.3)
  229. }
  230. .vipcard-detail-main{
  231. position: relative;
  232. margin-top: -212rpx;
  233. }
  234. .vipcard-swiper{
  235. height: 280rpx;
  236. width: 100%;
  237. }
  238. .vipcard-swiper .swiper-item{
  239. width: 100%;
  240. padding-left: 15px; /**就用PX了**/
  241. }
  242. .vipcard-swiper .swiper-item .card{
  243. height: 280rpx;
  244. width: 100%;
  245. position: relative;
  246. border-radius: 32rpx;
  247. overflow: hidden;
  248. }
  249. .vipcard-swiper .swiper-item .card .bg{
  250. width: 100%;
  251. height: 280rpx;
  252. }
  253. .vipcard-swiper .swiper-item .card .main{
  254. width: 100%;
  255. height: 280rpx;
  256. position: absolute;
  257. left: 0;
  258. top: 0;
  259. z-index: 2;
  260. padding: 72rpx;
  261. }
  262. .vipcard-swiper .swiper-item .card .main .vipcard-info{
  263. height: 80rpx;
  264. background: #FFFFFF;
  265. border-radius: 24rpx;
  266. padding: 0 20rpx;
  267. text-align: center;
  268. line-height: 80rpx;
  269. color:#ff0000;
  270. font-size: 30rpx;
  271. }
  272. .vipcard-swiper .swiper-item .card .vip-type-tag{
  273. width: 104rpx;
  274. height: 40rpx;
  275. background: linear-gradient(136deg, #4E4E4E 0%, #262728 100%);
  276. border-radius: 0rpx 20rpx 20rpx 0rpx;
  277. text-align: center;
  278. line-height: 40rpx;
  279. font-size: 24rpx;
  280. color:#F7E3C3;
  281. font-weight: 500;
  282. position: absolute;
  283. z-index: 3;
  284. left: 0;
  285. top:40rpx;
  286. }
  287. .vipcard-con-box{
  288. width: 300rpx;
  289. background: #FFFFFF;
  290. box-shadow: 0rpx 4rpx 32rpx 0rpx rgba(0, 0, 0, 0.04);
  291. border-radius: 8rpx;
  292. }
  293. </style>