payment_xx.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. <template>
  2. <view style="padding-top: 50rpx;">
  3. <view class="top" v-if="!showSignup">
  4. <image src="https://qnys.chuliu.cc/daweiboshi_szy/1_1615541900_nrG1vctYn8.jpg"
  5. mode="widthFix" style="width: 750rpx;margin-bottom: 60rpx;"></image>
  6. <view class="title">
  7. 第{{ data.season }}届大卫博士创业实战营
  8. </view>
  9. <view class="time">
  10. 举办时间:{{ data.start + '-' + data.end }}
  11. </view>
  12. <view v-if="data.status == 1" class="btnSig gray">已获取名额</view>
  13. <view v-else class="btnSig" :class="status ? 'red' : 'gray'" v-throttle="2000" @click="singup">点击获取名额</view>
  14. </view>
  15. <view class="voucher" v-else>
  16. <image src="../../static/new_my/bg.png" class="bgImg" mode="widthFix" style="width: 750rpx;"></image>
  17. <view class="bgImg">
  18. <text style="margin-top: 30rpx;">第{{ data.season }}届大卫博士创业实战营</text>
  19. </view>
  20. <view class="voucher_con">
  21. <view class="voucher_icon">
  22. <image src="../../static/icon/success.png" mode="widthFix" style="width: 300rpx;margin-top: 78rpx;">
  23. </image>
  24. <view class="success">获取名额成功,请联系批发商</view>
  25. <view class="timed">
  26. 举办时间:{{ data.start+ '-' +data.end }}
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. import {
  35. _API_payment,
  36. _API_SearchStatus,
  37. GetEnrollInfo,
  38. } from '@/apis/szy.js';
  39. export default {
  40. data() {
  41. return {
  42. status: false,
  43. data: {
  44. season: '',
  45. start: '',
  46. end: '',
  47. name: '',
  48. mobile: '',
  49. cost: '',
  50. local: ''
  51. },
  52. noClick: true,
  53. showSignup: false,
  54. }
  55. },
  56. onLoad() {
  57. this.getInfo()
  58. },
  59. computed: {
  60. userinfo() {
  61. return this.$store.state.userinfo
  62. }
  63. },
  64. onPullDownRefresh() {
  65. this.getInfo()
  66. },
  67. methods: {
  68. // 返回首页
  69. goBack() {
  70. uni.switchTab({
  71. url: '/pages/index/index'
  72. })
  73. },
  74. // 获取赛季信息
  75. getInfo() {
  76. GetEnrollInfo().then(res => {
  77. if (res.code == 200) {
  78. // res.data = {
  79. // cost: 199,
  80. // end: "2023.11.25",
  81. // end_time: "2023-11-25 18:00:00",
  82. // enroll_end_time: "2023-11-21 16:00:00",
  83. // enroll_start_time: "2023-11-14 10:30:00", // 报名时间
  84. // limit_num: 100000,
  85. // num: 0,
  86. // pay_status: 1, // 是否支付
  87. // season: 63,
  88. // start: "2023.10.24",
  89. // start_time: "2023-11-24 08:00:00", // 举办时间
  90. // status: 0 // 是否报名
  91. // }
  92. // res.data.enroll_start_time = "2023-11-14 10:30:00" // 报名时间
  93. this.data = res.data
  94. this.data.start = this.getTimes(res.data.start_time)
  95. this.data.end = this.getTimes(res.data.end_time)
  96. const a = new Date(res.data.enroll_start_time.replace(/-/g,'/')).getTime()
  97. const b = new Date(res.data.enroll_end_time.replace(/-/g,'/')).getTime()
  98. const now = Date.parse(new Date())
  99. if (now > a && now < b && res.data.limit_num > res.data.num) {
  100. this.status = true
  101. }
  102. if (res.data.status == 1) {
  103. this.showSignup = true
  104. } else {
  105. this.showSignup = false
  106. }
  107. } else {
  108. uni.showModal({
  109. content: res.message || '获取失败',
  110. showCancel: false
  111. })
  112. }
  113. })
  114. },
  115. getTimes(data) {
  116. var time = new Date(data)
  117. var year = time.getFullYear()
  118. var month = time.getMonth() + 1 < 10 ? '0' + (time.getMonth() + 1) : time.getMonth() + 1;
  119. var day = time.getDate() < 10 ? '0' + time.getDate() : time.getDate();
  120. var today = year + '.' + month + '.' + day;
  121. return today;
  122. },
  123. // 支付状态
  124. SearchStatus() {
  125. uni.showLoading({
  126. mask: true
  127. })
  128. _API_SearchStatus().then(res => {
  129. uni.hideLoading()
  130. if (res.code == 200) {
  131. this.getInfo()
  132. } else {
  133. uni.showModal({
  134. content: res.message || '获取失败',
  135. showCancel: false
  136. })
  137. }
  138. })
  139. },
  140. singup() {
  141. if (!this.status && !this.data.status) {
  142. return
  143. }
  144. let that = this
  145. uni.showModal({
  146. title: '提示',
  147. content: '确定要获取名额吗?',
  148. success: (res) => {
  149. if (res.confirm) {
  150. _API_payment().then(res => {
  151. if (res.code == 200) {
  152. that.SearchStatus()
  153. } else {
  154. uni.showModal({
  155. title: '失败',
  156. content: res.message || '获取失败',
  157. showCancel: false
  158. })
  159. return false;
  160. }
  161. })
  162. .catch(err => {})
  163. .finally(() => {
  164. setTimeout(() => {}, 3000)
  165. })
  166. }
  167. }
  168. })
  169. }
  170. }
  171. }
  172. </script>
  173. <style lang="scss" scoped>
  174. .top {
  175. margin: 0 30rpx 0 30rpx;
  176. border-radius: 16rpx;
  177. background-color: #fff;
  178. padding: 40rpx 20rpx 40rpx 20rpx;
  179. }
  180. .title {
  181. font-size: 34rpx;
  182. font-weight: bold;
  183. }
  184. .time {
  185. margin-top: 20rpx;
  186. font-size: 32rpx;
  187. }
  188. .btnSig {
  189. margin: 50rpx auto 0;
  190. width: 600rpx;
  191. line-height: 88rpx;
  192. border-radius: 44rpx;
  193. text-align: center;
  194. color: #fff;
  195. font-size: 32rpx;
  196. }
  197. .red {
  198. background: linear-gradient(93deg, #FF232C 0%, #FF571B 100%);
  199. }
  200. .gray {
  201. background-color: #E1E1E1;
  202. }
  203. .voucher {
  204. hieght: 100vh;
  205. min-height: 100vh;
  206. width: 100vw;
  207. position: relative;
  208. .bgImg {
  209. height: 100vh;
  210. width: 100vw;
  211. position: fixed;
  212. top: 0;
  213. left: 0;
  214. display: flex;
  215. flex-direction: column;
  216. align-items: center;
  217. font-size: 46rpx;
  218. font-weight: bold;
  219. text {
  220. color: #FFFFFF;
  221. margin-top: 10rpx;
  222. }
  223. }
  224. .voucher_con {
  225. position: fixed;
  226. height: 85%;
  227. width: 100%;
  228. bottom: 0;
  229. left: 0;
  230. background: #fff;
  231. border-top-left-radius: 60rpx;
  232. border-top-right-radius: 60rpx;
  233. .line {
  234. width: 128rpx;
  235. height: 8rpx;
  236. background: #f1f3f5;
  237. margin: 36rpx auto 0;
  238. }
  239. .title {
  240. color: #333;
  241. font-size: 38rpx;
  242. // margin: 48rpx auto 60rpx;
  243. text-align: center;
  244. font-weight: bold;
  245. }
  246. .voucher_icon {
  247. text-align: center;
  248. // image {
  249. // height: 192rpx;
  250. // width: 192rpx;
  251. // margin-bottom: 30rpx;
  252. // }
  253. .success {
  254. margin-top: 18rpx;
  255. font-size: 48rpx;
  256. color: #333;
  257. font-weight: bold;
  258. }
  259. .timed {
  260. margin-top: 36rpx;
  261. font-size: 40rpx;
  262. font-weight: bold;
  263. color: #FF0000;
  264. }
  265. }
  266. .logistics {
  267. width: 250rpx;
  268. height: 68rpx;
  269. margin: 0 auto;
  270. background: rgba(255, 244, 243, 0.39);
  271. border: 2rpx solid #FB231F;
  272. opacity: 1;
  273. border-radius: 44rpx;
  274. color: #FB231F;
  275. }
  276. .info {
  277. margin: 68rpx 50rpx 40rpx 50rpx;
  278. color: #333333;
  279. text {
  280. font-size: 32rpx;
  281. }
  282. >view {
  283. margin-top: 20rpx;
  284. }
  285. }
  286. }
  287. }
  288. .bottom {
  289. position: fixed;
  290. bottom: 0;
  291. width: 100%;
  292. height: 100rpx;
  293. padding: 6rpx 30rpx;
  294. background-color: #fff;
  295. border-top: 1px solid #eeeeee;
  296. &-btn {
  297. color: #fff;
  298. text-align: center;
  299. font-size: 32rpx;
  300. font-weight: bold;
  301. line-height: 88rpx;
  302. height: 88rpx;
  303. background: linear-gradient(90deg, #F30000 0%, #FE4815 100%);
  304. opacity: 1;
  305. border-radius: 44px;
  306. }
  307. }
  308. </style>