payment_xx.vue 7.0 KB

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