menber.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <template>
  2. <view class="content">
  3. <view class="user-top flex">
  4. <view class="user-avart">
  5. <image :src="userInfo.avatar" mode="" v-if="userInfo.avatar" class="user-avatar"></image>
  6. <image src="../../static/error/missing-face.png" mode="" class="user-avatar" v-else></image>
  7. </view>
  8. <view class="user-info">
  9. <view class="user-name clamp">
  10. {{ userInfo.nickname}}
  11. </view>
  12. <view class="user-level">
  13. {{ userInfo.level ==0 ? '尚未开通VIP':'会员' }}
  14. </view>
  15. </view>
  16. <view class="bottom-bg"></view>
  17. </view>
  18. <view class="title">
  19. 会员权益
  20. </view>
  21. <view class="tit">
  22. 开通会员可享受无限次使用次数,非会员仅可享受0次。
  23. </view>
  24. <view class="title">
  25. VIP充值套餐
  26. </view>
  27. <view class="menber-item flex" v-for="(item,index) in list" :class="{'action': index == currentIndex}" @click="navClick(index,item)">
  28. <view class="item-right-top">
  29. {{((item.price*1)/(item.time*1)).toFixed(2)}}元/天
  30. </view>
  31. <view class="item-price">
  32. {{item.title}}
  33. </view>
  34. <view class="item-info">
  35. <text class="old-price">原价{{item.ot_price*1}}元</text>{{item.price*1}}<text class="dw">元</text>
  36. </view>
  37. </view>
  38. <view class="zf-btn" @click="zf" :class="{'press': loading}">
  39. {{loading?'支付中':'立即支付'}}
  40. </view>
  41. <view class="check_box flex_item">
  42. <view>
  43. <radio style="transform: scale(0.75)" @click="Getcheckbox" color="#FFCE8A" :checked="checked" />
  44. </view>
  45. <view class="">我已阅读并同意会员<text @click="TOprivacy">用户协议</text></view>
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. import { getMenberCard,buyMenber } from '@/api/index.js'
  51. import {
  52. mapState,
  53. mapMutations
  54. } from 'vuex';
  55. export default {
  56. data() {
  57. return {
  58. currentIndex: 0,
  59. checked: true,
  60. list: [],
  61. loading: false,
  62. chooosId: '',
  63. }
  64. },
  65. computed: {
  66. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  67. },
  68. onLoad() {
  69. },
  70. onShow() {
  71. this.getMenberCard()
  72. },
  73. onReachBottom() {
  74. },
  75. onReady() {
  76. },
  77. methods: {
  78. navClick(index,item) {
  79. this.currentIndex = index
  80. this.chooosId = item.id
  81. },
  82. //阅读并同意
  83. Getcheckbox() {
  84. let obj = this;
  85. obj.checked = !obj.checked;
  86. },
  87. TOprivacy() {
  88. // uni.navigateTo({
  89. // url: ''
  90. // })
  91. },
  92. zf() {
  93. let obj = this
  94. if(obj.loading) {
  95. return
  96. }
  97. if(!obj.checked) {
  98. return obj.$api.msg('请阅读并同意会员用户协议')
  99. }
  100. obj.loading = true
  101. buyMenber({
  102. char_id: obj.chooosId,
  103. type: 0
  104. }).then(res => {
  105. console.log(res)
  106. }).catch(err => {
  107. obj.loading = false
  108. })
  109. },
  110. getMenberCard() {
  111. let obj = this
  112. getMenberCard().then(res => {
  113. console.log(res)
  114. obj.list = res.data
  115. obj.chooosId = res.data[0].id
  116. })
  117. }
  118. }
  119. }
  120. </script>
  121. <style lang="scss">
  122. page {
  123. background-color: #fff;
  124. }
  125. .user-top {
  126. width: 100%;
  127. height: 350rpx;
  128. background-color: #1c1c20;
  129. font-size: 38rpx;
  130. font-weight: bold;
  131. color: #FFFFFF;
  132. align-items: center;
  133. justify-content: flex-start;
  134. padding: 0 52rpx;
  135. position: relative;
  136. .user-avart {
  137. flex-shrink: 0;
  138. width: 100rpx;
  139. height: 100rpx;
  140. image {
  141. width: 100rpx;
  142. height: 100rpx;
  143. border-radius: 50%;
  144. }
  145. }
  146. .user-info {
  147. flex-grow: 1;
  148. padding-left: 24rpx;
  149. .user-name {
  150. font-size: 38rpx;
  151. font-weight: bold;
  152. color: #FFFFFF;
  153. }
  154. .user-level {
  155. font-size: 24rpx;
  156. font-weight: bold;
  157. color: #FFFFFF;
  158. }
  159. }
  160. .bottom-bg {
  161. width: 750rpx;
  162. height: 55rpx;
  163. position: absolute;
  164. border-radius: 25rpx 25rpx 0 0;
  165. background-color: #fff;
  166. bottom: 0;
  167. left: 0;
  168. }
  169. }
  170. .title {
  171. font-size: 36rpx;
  172. font-weight: bold;
  173. color: #000000;
  174. padding-left: 30rpx;
  175. }
  176. .tit {
  177. font-size: 26rpx;
  178. font-weight: 500;
  179. color: #5C5C5C;
  180. padding: 30rpx 0 30rpx 30rpx;
  181. }
  182. .action {
  183. border: 6rpx solid #ffe5c2;
  184. font-weight: 900;
  185. background: #FFFAF3;
  186. }
  187. .menber-item {
  188. width: 690rpx;
  189. height: 170rpx;
  190. margin: auto;
  191. // border: 3rpx solid #ffe5c2;
  192. box-shadow: 2rpx 1rpx 30rpx 0px rgba(0, 0, 0, 0.1);
  193. border-radius: 18rpx;
  194. position: relative;
  195. align-items: center;
  196. padding: 0 30rpx 0 40rpx;
  197. margin-top: 30rpx;
  198. .item-right-top {
  199. min-width: 128rpx;
  200. display: inline-block;
  201. text-align: center;
  202. line-height: 38rpx;
  203. font-size: 24rpx;
  204. font-weight: bold;
  205. color: #9F570E;
  206. height: 38rpx;
  207. background: linear-gradient(270deg, #FFE7C4, #FFCE8A);
  208. border-radius: 0px 18rpx 0px 18rpx;
  209. position: absolute;
  210. right: 0;
  211. top: 0;
  212. }
  213. .item-info {
  214. font-size: 48rpx;
  215. font-weight: bold;
  216. color: #9F570E;
  217. .item-price {
  218. font-size: 32rpx;
  219. font-weight: bold;
  220. color: #131313;
  221. }
  222. .old-price {
  223. font-size: 24rpx;
  224. font-weight: bold;
  225. text-decoration: line-through;
  226. color: #AEAEAE;
  227. padding-right: 12rpx;
  228. }
  229. .dw {
  230. font-size: 26rpx;
  231. }
  232. }
  233. }
  234. .zf-btn {
  235. width: 620rpx;
  236. background: linear-gradient(270deg, #FFE7C4, #FFCE8A);
  237. border-radius: 49rpx;
  238. margin: 80rpx auto 40rpx;
  239. font-size: 32rpx;
  240. font-weight: bold;
  241. color: #9F570E;
  242. line-height: 100rpx;
  243. text-align: center;
  244. }
  245. .press {
  246. background: #999;
  247. color: #eee;
  248. }
  249. .check_box {
  250. // padding: 25rpx 25rpx;
  251. padding-bottom: 70rpx;
  252. font-size: 28rpx;
  253. text {
  254. color: #6786FB;
  255. }
  256. }
  257. .flex_item {
  258. display: flex;
  259. justify-content: center;
  260. }
  261. </style>