payment.vue 8.1 KB

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