payment.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. <template>
  2. <view style="padding-top: 50rpx;">
  3. <view class="top" v-if="!showSignup">
  4. <!-- <image src="https://qnys.chuliu.cc/daweiboshi_szy/photo_2024-09-12%2018.14.49.jpeg"
  5. mode="widthFix" style="width: 750rpx;margin-bottom: 60rpx;"></image> -->
  6. <image src="https://qnys.chuliu.cc/daweiboshi_szy/1_1615541900_nrG1vctYn8.jpg"
  7. mode="widthFix" style="width: 750rpx;margin-bottom: 60rpx;"></image >
  8. <view class="title">
  9. 第{{ data.season }}届大卫博士创业实战营
  10. </view>
  11. <view class="time">
  12. 举办时间:{{ data.start + '-' + data.end }}
  13. <!-- 举办时间:等待通知 -->
  14. </view>
  15. <view v-if="data.status == 1" class="btnSig gray">已获取名额</view>
  16. <view v-else class="btnSig" :class="status ? 'red' : 'gray'" v-throttle="2000" @click="singup">点击获取名额</view>
  17. </view>
  18. <view class="voucher" v-else>
  19. <image src="../../static/new_my/bg.png" class="bgImg" mode="widthFix" style="width: 750rpx;"></image>
  20. <view class="bgImg">
  21. <text style="margin-top: 30rpx;">第{{ data.season }}届大卫博士创业实战营</text>
  22. </view>
  23. <view class="voucher_con">
  24. <view class="voucher_icon">
  25. <image src="../../static/icon/success.png" mode="widthFix" style="width: 300rpx;margin-top: 78rpx;">
  26. </image>
  27. <view class="success">报名成功</view>
  28. <view class="timed">
  29. 举办时间:{{ data.start+ '-' +data.end }}
  30. <!-- 举办时间:等待通知 -->
  31. </view>
  32. <view class="timed">
  33. <view class="left">人脸照片:</view>
  34. <view class="right">
  35. <image v-if="data.path" :src="data.path" @click="initFace" mode="widthFix" style="width: 160rpx;height: 160rpx;">
  36. </image>
  37. <image v-else src="../../static/icon/uploadF.png" mode="widthFix" style="width: 160rpx;"
  38. @click="initFace"></image>
  39. </view>
  40. </view>
  41. <view class="timed">
  42. <view class="link_btn" @click="goApp()">点击查看邀请函</view>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. import {
  51. _API_payment,
  52. _API_SearchStatus,
  53. GetEnrollInfo
  54. } from '@/apis/szy.js';
  55. import {
  56. UploadSzyImg
  57. } from '@/common/util/request'
  58. export default {
  59. data() {
  60. return {
  61. status: false,
  62. data: {
  63. season: '',
  64. start: '',
  65. end: '',
  66. name: '',
  67. mobile: '',
  68. cost: '',
  69. local: '',
  70. path:''
  71. },
  72. noClick: true,
  73. showSignup: false,
  74. }
  75. },
  76. onLoad() {
  77. this.getInfo()
  78. // this.getData()
  79. },
  80. computed: {
  81. userinfo() {
  82. return this.$store.state.userinfo
  83. }
  84. },
  85. onPullDownRefresh() {
  86. this.getInfo()
  87. },
  88. methods: {
  89. goApp(){
  90. if(!this.data.path){
  91. uni.showModal({
  92. title: '提示',
  93. content: '检测到您还未上传照片',
  94. showCancel: false
  95. })
  96. return
  97. }
  98. uni.reLaunch({
  99. url: '/pages/payment-xx/notice'
  100. })
  101. console.log(11)
  102. },
  103. initFace() {
  104. uni.chooseImage({
  105. count: 1, //默认9
  106. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  107. sourceType: ['album'], //从相册选择
  108. success: res => {
  109. const tempFilePaths = res.tempFilePaths;
  110. uni.uploadFile({
  111. url: UploadSzyImg,
  112. filePath: tempFilePaths[0],
  113. name: 'image',
  114. header: {
  115. Authorization: 'Bearer ' + this.$store.state.app.token
  116. },
  117. success: (res) => {
  118. const data = JSON.parse(res.data)
  119. if (data.code == 200) {
  120. this.getInfo()
  121. } else {
  122. uni.showToast({
  123. title: res.message || '上传失败',
  124. icon: 'none'
  125. })
  126. }
  127. },
  128. fail: err => {
  129. uni.showToast({
  130. title: '上传失败1',
  131. icon: 'none'
  132. })
  133. }
  134. });
  135. }
  136. })
  137. },
  138. getTimes(data) {
  139. var time = new Date(data)
  140. var year = time.getFullYear()
  141. var month = time.getMonth() + 1 < 10 ? '0' + (time.getMonth() + 1) : time.getMonth() + 1;
  142. var day = time.getDate() < 10 ? '0' + time.getDate() : time.getDate();
  143. var today = year + '.' + month + '.' + day;
  144. return today;
  145. },
  146. // 支付状态
  147. SearchStatus() {
  148. uni.showLoading({
  149. mask: true
  150. })
  151. _API_SearchStatus().then(res => {
  152. uni.hideLoading()
  153. if (res.code == 200) {
  154. this.getInfo()
  155. } else {
  156. uni.showModal({
  157. content: res.message || '获取失败',
  158. showCancel: false
  159. })
  160. }
  161. })
  162. },
  163. // 获取赛季信息
  164. getInfo() {
  165. GetEnrollInfo().then(res => {
  166. if (res.code == 200) {
  167. // res.data.enroll_start_time = "2024-05-06 10:30:00" // 报名时间
  168. // res.data.enroll_end_time = "2024-05-07 12:30:00" // 报名时间
  169. this.data = res.data
  170. uni.setStorageSync("szy_data", res.data)
  171. this.data.start = this.getTimes(res.data.start_time)
  172. this.data.end = this.getTimes(res.data.end_time)
  173. const a = new Date(res.data.enroll_start_time.replace(/-/g,'/')).getTime()
  174. const b = new Date(res.data.enroll_end_time.replace(/-/g,'/')).getTime()
  175. const now = Date.parse(new Date())
  176. if (now > a && now < b && res.data.limit_num > res.data.num) {
  177. this.status = true
  178. }
  179. if (res.data.status == 1 && res.data.pay_status == 1) {
  180. this.showSignup = true
  181. } else if (res.data.status == 1 && res.data.pay_status == 0) {
  182. this.showSignup = false
  183. uni.navigateTo({
  184. url: './singup'
  185. })
  186. } else {
  187. this.showSignup = false
  188. }
  189. } else {
  190. uni.showModal({
  191. content: res.message || '获取失败',
  192. showCancel: false
  193. })
  194. }
  195. })
  196. },
  197. singup() {
  198. if (!this.status && !this.data.status) {
  199. return
  200. }
  201. let that = this
  202. uni.showModal({
  203. title: '提示',
  204. content: '确定要获取名额吗?',
  205. success: (res) => {
  206. if (res.confirm) {
  207. _API_payment().then(res => {
  208. if (res.code == 200) {
  209. // that.SearchStatus()
  210. uni.navigateTo({
  211. url: './singup'
  212. })
  213. } else {
  214. uni.showModal({
  215. title: '失败',
  216. content: res.message || '获取失败',
  217. showCancel: false
  218. })
  219. return false;
  220. }
  221. })
  222. .catch(err => {})
  223. .finally(() => {
  224. setTimeout(() => {}, 3000)
  225. })
  226. }
  227. }
  228. })
  229. }
  230. }
  231. }
  232. </script>
  233. <style lang="scss" scoped>
  234. .top {
  235. margin: 0 30rpx 0 30rpx;
  236. border-radius: 16rpx;
  237. background-color: #fff;
  238. padding: 40rpx 20rpx 40rpx 20rpx;
  239. }
  240. .title {
  241. font-size: 34rpx;
  242. font-weight: bold;
  243. }
  244. .link_btn {
  245. width: 400rpx;
  246. margin: 100rpx auto 0;
  247. height: 88rpx;
  248. background: linear-gradient(88deg, #b51027 0%, #c7002c 100%);
  249. opacity: 1;
  250. border-radius: 44rpx;
  251. color: #ffebf8;
  252. text-align: center;
  253. line-height: 88rpx;
  254. font-size: 32rpx;
  255. }
  256. .time {
  257. margin-top: 20rpx;
  258. font-size: 32rpx;
  259. }
  260. .btnSig {
  261. margin: 50rpx auto 0;
  262. width: 600rpx;
  263. line-height: 88rpx;
  264. border-radius: 44rpx;
  265. text-align: center;
  266. color: #fff;
  267. font-size: 32rpx;
  268. }
  269. .red {
  270. background: linear-gradient(93deg, #FF232C 0%, #FF571B 100%);
  271. }
  272. .gray {
  273. background-color: #E1E1E1;
  274. }
  275. .voucher {
  276. hieght: 100vh;
  277. min-height: 100vh;
  278. width: 100vw;
  279. position: relative;
  280. .bgImg {
  281. height: 100vh;
  282. width: 100vw;
  283. position: fixed;
  284. top: 0;
  285. left: 0;
  286. display: flex;
  287. flex-direction: column;
  288. align-items: center;
  289. font-size: 46rpx;
  290. font-weight: bold;
  291. text {
  292. color: #FFFFFF;
  293. margin-top: 10rpx;
  294. }
  295. }
  296. .voucher_con {
  297. position: fixed;
  298. height: 85%;
  299. width: 100%;
  300. bottom: 0;
  301. left: 0;
  302. background: #fff;
  303. border-top-left-radius: 60rpx;
  304. border-top-right-radius: 60rpx;
  305. .line {
  306. width: 128rpx;
  307. height: 8rpx;
  308. background: #f1f3f5;
  309. margin: 36rpx auto 0;
  310. }
  311. .title {
  312. color: #333;
  313. font-size: 38rpx;
  314. // margin: 48rpx auto 60rpx;
  315. text-align: center;
  316. font-weight: bold;
  317. }
  318. .voucher_icon {
  319. text-align: center;
  320. // image {
  321. // height: 192rpx;
  322. // width: 192rpx;
  323. // margin-bottom: 30rpx;
  324. // }
  325. .success {
  326. margin-top: 18rpx;
  327. font-size: 48rpx;
  328. color: #333;
  329. font-weight: bold;
  330. }
  331. .timed {
  332. margin-top: 36rpx;
  333. font-size: 30rpx;
  334. font-weight: bold;
  335. // color: #FF0000;
  336. display: flex;
  337. padding-left: 60rpx;
  338. }
  339. }
  340. .logistics {
  341. width: 250rpx;
  342. height: 68rpx;
  343. margin: 0 auto;
  344. background: rgba(255, 244, 243, 0.39);
  345. border: 2rpx solid #FB231F;
  346. opacity: 1;
  347. border-radius: 44rpx;
  348. color: #FB231F;
  349. }
  350. .info {
  351. margin: 68rpx 50rpx 40rpx 50rpx;
  352. color: #333333;
  353. text {
  354. font-size: 32rpx;
  355. }
  356. >view {
  357. margin-top: 20rpx;
  358. }
  359. }
  360. }
  361. }
  362. .bottom {
  363. position: fixed;
  364. bottom: 0;
  365. width: 100%;
  366. height: 100rpx;
  367. padding: 6rpx 30rpx;
  368. background-color: #fff;
  369. border-top: 1px solid #eeeeee;
  370. &-btn {
  371. color: #fff;
  372. text-align: center;
  373. font-size: 32rpx;
  374. font-weight: bold;
  375. line-height: 88rpx;
  376. height: 88rpx;
  377. background: linear-gradient(90deg, #F30000 0%, #FE4815 100%);
  378. opacity: 1;
  379. border-radius: 44px;
  380. }
  381. }
  382. </style>