newVip.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <view class="content">
  3. <image src="../../static/index/vip01.png" mode=""></image>
  4. <view class="box">
  5. <view class="tit-box">
  6. <image class="img" src="../../static/index/vip02.png" mode=""></image>
  7. <view class="tit-tit">
  8. 新人专享福利
  9. </view>
  10. <image class="img" src="../../static/index/vip02.png" mode=""></image>
  11. </view>
  12. <view class="box-con-img">
  13. <image src="../../static/index/vip04.png" mode=""></image>
  14. </view>
  15. <view class="buy" @click="buy()">
  16. 新会员专享¥{{cj ||0}}
  17. </view>
  18. </view>
  19. <!-- <view class="box" style="top: 1100rpx;">
  20. <view class="tit-box">
  21. <image class="img" src="../../static/index/vip02.png" mode=""></image>
  22. <view class="tit-tit">
  23. 新人规则
  24. </view>
  25. <image class="img" src="../../static/index/vip02.png" mode=""></image>
  26. </view>
  27. <view class="box-guize">
  28. <view class="content-guize">
  29. <view class="left">
  30. 1
  31. </view>
  32. <view class="gz">
  33. 新人福利新人福利新人福利新人福利新人福
  34. 利新人福利。
  35. </view>
  36. </view>
  37. </view>
  38. </view> -->
  39. </view>
  40. </template>
  41. <script>
  42. import {
  43. cJbuy,
  44. cJiang
  45. } from '@/api/index.js'
  46. export default {
  47. data() {
  48. return {
  49. list: [], //抽奖
  50. };
  51. },
  52. onLoad() {
  53. },
  54. beforeDestroy() {
  55. console.log('定时器销毁1');
  56. if (this.timer) {
  57. clearTimeout(this.timer); //关闭
  58. console.log('定时器销毁');
  59. }
  60. },
  61. onShow() {
  62. this.loadDate()
  63. },
  64. computed: {
  65. cj() {
  66. return `${this.list.price ||0}(${this.list.count||0}次)`
  67. }
  68. },
  69. methods: {
  70. async loadDate() {
  71. await cJiang({}).then(res => {
  72. console.log(res, 'res');
  73. this.list = res.data
  74. })
  75. },
  76. buy() {
  77. cJbuy().then(res => {
  78. console.log(res, 'resssssss');
  79. this.loadDate()
  80. if (res.status == 200) {
  81. this.$api.msg(res.msg)
  82. setTimeout(function() {
  83. uni.switchTab({
  84. url: '/pages/user/user',
  85. })
  86. }, 1000)
  87. }
  88. console.log('中间执行了');
  89. }).catch(res=>{
  90. if (res.msg == '请填写地址'&&res.status==400) {
  91. console.log('执行了');
  92. this.$api.msg(res.msg)
  93. let time = setTimeout(function() {
  94. uni.navigateTo({
  95. url: '/pages/set/address'
  96. }, )
  97. }, 1500)
  98. }
  99. }
  100. )
  101. }
  102. }
  103. }
  104. </script>
  105. <style lang="scss">
  106. .content {
  107. width: 100vw;
  108. height: 100vh;
  109. margin: 0;
  110. padding: 0;
  111. z-index: 99;
  112. image {
  113. width: 100%;
  114. height: 100%;
  115. }
  116. }
  117. .box {
  118. padding: 20rpx 0;
  119. width: 590rpx;
  120. background: #FFFEFC;
  121. border: 12rpx solid #FDDB8E;
  122. border-radius: 20rpx;
  123. position: absolute;
  124. top: 600rpx;
  125. z-index: 999;
  126. left: 80rpx;
  127. display: flex;
  128. flex-direction: column;
  129. justify-content: center;
  130. align-items: center;
  131. .box-guize {
  132. .content-guize {
  133. display: flex;
  134. padding: 30rpx;
  135. justify-content: space-around;
  136. .left {
  137. width: 34rpx;
  138. height: 34rpx;
  139. background: #EE4C47;
  140. border-radius: 50%;
  141. font-size: 25px;
  142. font-family: FZLTHJW;
  143. font-weight: normal;
  144. color: #FFFFFF;
  145. line-height: 34px;
  146. text-align: center;
  147. }
  148. .gz {
  149. margin-left: 10rpx;
  150. font-size: 25rpx;
  151. font-family: PingFang SC;
  152. font-weight: 400;
  153. color: #333333;
  154. }
  155. }
  156. }
  157. .tit-box {
  158. display: flex;
  159. justify-content: space-around;
  160. align-items: center;
  161. .img {
  162. width: 17rpx;
  163. height: 15rpx;
  164. image {
  165. width: 100%;
  166. height: 100%;
  167. }
  168. }
  169. .tit-tit {
  170. margin: 0 40rpx;
  171. height: 67rpx;
  172. font-size: 40rpx;
  173. font-family: PingFang SC;
  174. font-weight: 500;
  175. color: #F94C2B;
  176. line-height: 67rpx;
  177. }
  178. }
  179. .box-con-img {
  180. margin: 20rpx 0;
  181. width: 240rpx;
  182. height: 240rpx;
  183. image {
  184. width: 100%;
  185. height: 100%;
  186. }
  187. }
  188. .buy {
  189. // width: 340rpx;
  190. padding: 0 20rpx;
  191. height: 58rpx;
  192. background: linear-gradient(-2deg, #DB1A34, #FA5244, #EF4744);
  193. box-shadow: 0rpx 7rpx 13rpx 0rpx rgba(225, 38, 55, 0.3100);
  194. border-radius: 16rpx;
  195. line-height: 58rpx;
  196. text-align: center;
  197. font-size: 30rpx;
  198. font-family: FZLTCHK;
  199. font-weight: normal;
  200. color: #FFFFFF;
  201. }
  202. }
  203. </style>