rechargeVIP.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <template>
  2. <view class="content">
  3. <view class="top">
  4. <view class="top__bg">
  5. <image class="image" src="../../static/imgs/public/img_top_bg_2.png" mode="aspectFit"></image>
  6. </view>
  7. <view class="top__container">
  8. <view class="top__container__kaitong" v-if="user_data.is_vip">已开通</view>
  9. <view class="top__container__avatar">
  10. <image class="image" :src="UserData().getData().avatar_url" mode=""></image>
  11. </view>
  12. <view class="top__container__info">
  13. <view class="top__container__info__name">
  14. {{user_data.user_name}}
  15. </view>
  16. <view class="top__container__info__date" v-if="user_data.is_vip">
  17. 有效期至:{{util.timeFormat(user_data.vip_effective_time_time)}}
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="title-id">
  23. <view class="title-id__name">购买会员</view>
  24. <view class="title-id__des"> 畅 \ 享 \ 全 \ 场 \ 免 \ 费</view>
  25. <view class="title-id__line"></view>
  26. </view>
  27. <view class="list">
  28. <view class="list__item" v-for="(item,index) in data_list" :key="index" @click="clickItem(index)">
  29. <image v-if="current_index==index" class="image" src="../../static/imgs/read/img_buy_onselect_bi_status.png"></image>
  30. <image v-else class="image" src="../../static/imgs/read/img_buy_unselect_bi_status.png"></image>
  31. <view class="list__item__container">
  32. <view class="list__item__container__prompt" :style="{color:current_index==index?color_prompt_s:color_prompt_n}">
  33. {{item.prompt1}}
  34. </view>
  35. <view class="list__item__container__rmb" :style="{color:current_index==index?color_rmb:color_black}">
  36. ¥ {{(item.amount/100).toFixed(1)}}
  37. </view>
  38. <view class="list__item__container__des" :style="{color:current_index==index?color_des:color_black}">
  39. {{item.base_angle}}
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="bottom">
  45. <view class="bottom__button-ljgm" @click="clickLjgm">
  46. <image class="image" src="../../static/imgs/public/img_ljgm.png" mode=""></image>
  47. </view>
  48. </view>
  49. </view>
  50. </template>
  51. <script setup lang="ts">
  52. import { ref } from 'vue';
  53. import { config } from '../../config/config';
  54. import { http } from '../../framework/http';
  55. import { log } from '../../framework/log';
  56. import { UserData } from '../../stores/userDataManager';
  57. import { util } from '../../framework/util';
  58. import { tools } from '../../framework/tools';
  59. let user_data = UserData().getData()
  60. let data_list = ref([])
  61. let current_index = ref(-1)
  62. let color_prompt_s = '#824B2C'
  63. let color_prompt_n = '#6D6D82'
  64. let color_black = '#000000'
  65. let color_rmb = '#FF5E00'
  66. let color_des = '#EB3737'
  67. requestRechargeList()
  68. function requestRechargeList() {
  69. let url = config.url_confg.Static.get_recharge_list(2)
  70. http.StaticRequest(url,(err,data)=>{
  71. if(!err) {
  72. console.log('vip-',data)
  73. if(data.code==config.url_confg.StatesCode.SUCCESS){
  74. data_list.value = data.content
  75. }
  76. } else {
  77. log.Error(err)
  78. }
  79. })
  80. }
  81. function clickItem(index:number){
  82. if(current_index.value==index) {
  83. return
  84. }
  85. current_index.value = index
  86. }
  87. function clickLjgm() {
  88. if(current_index.value<0) {
  89. util.showInfoToast('请选择购买会员金额')
  90. return
  91. }
  92. let data = data_list.value[current_index.value]
  93. util.showLoading('',true)
  94. tools.requestRechargeOrderBuy(3,data.goods_id,(order_id:string)=>{
  95. if(order_id.length>0) {
  96. setTimeout(function() {
  97. tools.requestRechargeOrderInfo(order_id,(status:number)=>{
  98. util.hideLoading()
  99. if(status==2) {
  100. UserData().update_user_info(()=>{
  101. util.showSuccessToast('VIP成功')
  102. })
  103. }
  104. })
  105. }, 2000);
  106. } else {
  107. util.hideLoading()
  108. }
  109. })
  110. }
  111. </script>
  112. <style lang="scss">
  113. .content{
  114. display: flex;
  115. flex-direction: column;
  116. .top{
  117. margin-top: 40rpx;
  118. display: flex;
  119. justify-content: center;
  120. position: relative;
  121. &__bg{
  122. flex-shrink: 0;
  123. width: 90%; //704rpx;
  124. height: 245rpx;
  125. .image{
  126. width: 100%;
  127. height: 100%;
  128. }
  129. }
  130. &__container{
  131. position: absolute;
  132. display: flex;
  133. flex-direction: row;
  134. width: 90%;
  135. // background-color: green;
  136. &__kaitong {
  137. position: absolute;
  138. top: 6rpx;
  139. right: 0;
  140. width: 128rpx;
  141. height: 60rpx;
  142. border-top-right-radius: 30rpx;
  143. border-bottom-left-radius: 30rpx;
  144. color: #ffffff;
  145. background-color: #9A71F1;
  146. display: flex;
  147. justify-content: center;
  148. align-items: center;
  149. }
  150. &__avatar{
  151. margin-top: 70rpx;
  152. margin-left: 60rpx;
  153. flex-shrink: 0;
  154. width: 110rpx;
  155. height: 110rpx;
  156. .image{
  157. width: 100%;
  158. height: 100%;
  159. border-radius: 50%;
  160. }
  161. }
  162. &__info {
  163. margin-top: 60rpx;
  164. margin-left: 30rpx;
  165. display: flex;
  166. flex-direction: column;
  167. // height: 150rpx;
  168. // background-color: red;
  169. &__name{
  170. margin-top: 30rpx;
  171. font-size: 25px;
  172. font-weight: 450;
  173. }
  174. &__date{
  175. margin-top: 10rpx;
  176. font-size: 17px;
  177. }
  178. }
  179. }
  180. }
  181. .title-id{
  182. display: flex;
  183. flex-direction: column;
  184. position: relative;
  185. margin-top: 40rpx;
  186. padding: 0 40rpx;
  187. &__name{
  188. margin-left: 10rpx;
  189. font-size: 30px;
  190. font-weight: 600;
  191. color: #EE5DB0;
  192. }
  193. &__des{
  194. font-size: 12px;
  195. color: #EE5DB0;
  196. }
  197. &__line{
  198. position: absolute;
  199. top: 50rpx;
  200. width: 250rpx;
  201. height: 20rpx;
  202. background-color: #EE5DB0;
  203. opacity: 0.4;
  204. }
  205. }
  206. .list{
  207. display: flex;
  208. flex-flow: row wrap; //横向排列、换行排列
  209. padding: 40rpx 20rpx;
  210. &__item{
  211. display: flex;
  212. flex-direction: column;
  213. align-items: center;
  214. width: 50%;
  215. height: 246rpx;
  216. position: relative;
  217. // background-color: green;
  218. .image{
  219. width: 100%;
  220. height: 100%;
  221. }
  222. &__container{
  223. position: absolute;
  224. display: flex;
  225. flex-direction: column;
  226. justify-content: center;
  227. align-items: center;
  228. &__prompt{
  229. margin-top: 50rpx;
  230. font-size: 20px;
  231. color: #6D6D82;
  232. }
  233. &__rmb{
  234. margin-top: 10rpx;
  235. font-size: 20px;
  236. font-weight: 500;
  237. }
  238. &__des{
  239. position: absolute;
  240. bottom: -30%;
  241. font-size: 13px;
  242. }
  243. }
  244. }
  245. }
  246. .bottom {
  247. margin-top: 100rpx;
  248. display: flex;
  249. justify-content: center;
  250. align-items: center;
  251. &__button-ljgm{
  252. flex-shrink: 0;
  253. width: 80%;
  254. height: 100rpx;
  255. .image{
  256. width: 100%;
  257. height: 100%;
  258. }
  259. }
  260. }
  261. }
  262. </style>