vip.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <template>
  2. <view>
  3. <!--标题栏-->
  4. <bar-title bgColor="bg-white" isBack title="会员">
  5. <block slot="content">会员</block>
  6. </bar-title>
  7. <view class="zaiui-user-info-box">
  8. <view class="cu-list menu-avatar">
  9. <view class="cu-item">
  10. <view class="cu-avatar round lg" :style="`background-image:url(${user.avatar});`"/>
  11. <view class="content text-xl">
  12. <view class="flex flex-direction" style="align-items: flex-start;">
  13. <text class="margin-right">{{user.name}}</text>
  14. <!-- <text class="text-sm">{{user.score_per}}</text> -->
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. <!-- <view class="zaiui-flex-tab show">
  21. <view class="flex">
  22. <view class="basis-xxl">
  23. <scroll-view scroll-x class="nav z" scroll-with-animation>
  24. <block v-for="(item,index) in headTab.list" :key="item.id">
  25. <view class="cu-item" :class="item.id==headTab.TabCur?'select':''" @tap="tabSelect" :data-id="item.id">
  26. <view>{{item.name}}</view>
  27. <view class="tab-dot bg-red"/>
  28. </view>
  29. </block>
  30. </scroll-view>
  31. </view>
  32. </view>
  33. </view> -->
  34. <view class="card" v-for="item in viplist">
  35. <image class="card-bg" src="@/static/images/my/price_shape.png">
  36. <view class="flex hd">
  37. <view class="col">
  38. <view class="text-white h4">
  39. <text class="text-white cuIcon-vipcard"></text>
  40. {{item.name}}
  41. </view>
  42. </view>
  43. <view class="col text-end">
  44. <button class="cu-btn bg-red" data-type="vip" @click="handleBuy(item.id)">立即购买</button>
  45. </view>
  46. </view>
  47. <view class="detail">
  48. <view class="text-white price">价格<text>¥{{item.price}}</text></view>
  49. <view class="text-white price">有效期<text>{{item.day_desc}}</text></view>
  50. </view>
  51. <view class="detail">
  52. <view class="text-white">{{item.content}}<text class="margin-left-xs text-red cuIcon-roundright"></text></view>
  53. </view>
  54. </view>
  55. </view>
  56. </template>
  57. <script>
  58. import barTitle from '@/components/zaiui-common/basics/bar-title';
  59. import _tool from '@/static/zaiui/util/tools.js'; //工具函数
  60. export default {
  61. components: {
  62. barTitle
  63. },
  64. data() {
  65. return {
  66. skin: true,
  67. headTab: {
  68. list: [{
  69. id: 0,
  70. name: '会员权益'
  71. }],
  72. TabCur: 0
  73. },
  74. user: {},
  75. place: {},
  76. viplist: []
  77. }
  78. },
  79. onLoad() {
  80. this.loadInfo()
  81. this.loadList()
  82. },
  83. onReady() {
  84. _tool.setBarColor(true);
  85. uni.pageScrollTo({
  86. scrollTop: 0,
  87. duration: 0
  88. });
  89. },
  90. methods: {
  91. loadInfo() {
  92. this.reqByuser({
  93. url: '?l=vip.info',
  94. data: {},
  95. success: res => {
  96. if(res.data.status == 1) {
  97. this.user = res.data.data.user;
  98. this.place = res.data.data.place;
  99. }else {
  100. this.error = res.data.msg
  101. }
  102. }
  103. })
  104. },
  105. loadList() {
  106. this.reqByuser({
  107. url: '?l=vip.list',
  108. data: {},
  109. success: res => {
  110. // res = {data: {"status":1,"msg":"success","data":{"list":[{"id":1,"cdate":1720929230,"name":"黄金会员","price":"100.00","day_desc":"一年","day":365,"level":1,"content":"<p><br></p>","status":1,"pay":1,"sprice":"100.00","buy":2},{"id":2,"cdate":1723109226,"name":"白金会员","price":100,"day_desc":"三年","day":864,"level":2,"content":"<p>ffff</p>","status":1,"pay":1,"sprice":"200.00","buy":1}],"place":{"name":"PPT","logo":"","content":"<p>test</p>","score_name":"金币","score_per":"1","bg":"","type":1,"vip_name":"会员","agent_name":"主理人","money_id":1,"uid":1,"channel":1,"money_name":"¥"},"resource":[{"name":"内容1","icon":"","type":1},{"name":"商品","icon":"","type":3},{"name":"功能","icon":"","type":2}],"user":{"id":1,"name":"test","avatar":"","cash":"-10.00","score_cash":"0.00","vip_id":1,"agent_id":1,"client_id":1,"score_cash_name":"0.00金币","money_cash_name":"¥-10.00"}},"code":200}}
  111. if(res.data.status == 1) {
  112. this.viplist = res.data.data.list;
  113. }else {
  114. this.error = res.data.msg
  115. }
  116. }
  117. })
  118. },
  119. handleBuy(id) {
  120. this.reqByuser({
  121. url: '?l=vip.buy',
  122. data: {
  123. id
  124. },
  125. success: res => {
  126. if(res.data.status == 1) {
  127. console.log(res.data.data)
  128. location.href = res.data.data.pay.link;
  129. }else {
  130. this.error = res.data.msg
  131. }
  132. }
  133. })
  134. }
  135. }
  136. }
  137. </script>
  138. <style lang="scss">
  139. /* #ifdef APP-PLUS */
  140. @import "../../static/colorui/main.css";
  141. @import "../../static/colorui/icon.css";
  142. @import "../../static/zaiui/style/app.scss";
  143. /* #endif */
  144. </style>
  145. <style lang="scss" scoped>
  146. .card {
  147. position: relative;
  148. width: 680upx;
  149. height: 380upx;
  150. margin: 32upx auto 0;
  151. border-radius: 15upx;
  152. box-sizing: border-box;
  153. padding: 32upx;
  154. image {
  155. position: absolute;
  156. background-color: #0cbc87;
  157. width: 100%;
  158. border-radius: 15upx;
  159. height: 100%;
  160. left: 0;
  161. top: 0;
  162. opacity: 0.8;
  163. }
  164. &>view {
  165. position: relative;
  166. z-index: 1;
  167. }
  168. .hd {
  169. align-items: center;
  170. justify-content: space-between;
  171. margin-bottom: 40upx;
  172. .h4 {
  173. font-size: 40upx;
  174. font-weight: bolder;
  175. text {
  176. margin-right: 10upx;
  177. }
  178. }
  179. }
  180. .detail {
  181. display: flex;
  182. margin-bottom: 20upx;
  183. justify-content: space-between;
  184. .price {
  185. display: flex;
  186. flex-direction: column;
  187. width: 45%;
  188. font-size: 28upx;
  189. margin-right: 20upx;
  190. text {
  191. font-size: 40upx;
  192. margin-top: 5upx;
  193. &.through {
  194. text-decoration: line-through;
  195. font-size: 28upx;
  196. }
  197. }
  198. }
  199. }
  200. }
  201. </style>