detail.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  1. <template>
  2. <view>
  3. <view v-if="showSignup" style="padding-top: 50rpx;">
  4. <view class="pay">
  5. <image src="https://qnys.chuliu.cc/daweiboshi_szy/1_1615541900_nrG1vctYn8.jpg"
  6. mode="widthFix" style="width: 750rpx;margin-bottom: 60rpx;"></image>
  7. <view class="pay_title">
  8. 大卫博士学位争霸赛第43季
  9. </view>
  10. <view class="item">
  11. <input maxlength="6" type="number" v-model="sms_code" placeholder="请输入验证码" />
  12. <view v-throttle="2000" class="countdown" @tap="getCode">
  13. {{ countDown ? `重新获取(${countDown}s)` : '获取验证码' }}
  14. </view>
  15. </view>
  16. <view v-throttle="2000" class="pay_btnSig" :class="status ? 'red' : 'gray'" @click="singup">支付9.9报名</view>
  17. </view>
  18. <view v-show="showBank" class="payB" @click="goUnbank">
  19. 支付不了,重新绑定?
  20. </view>
  21. </view>
  22. <view v-else class="top">
  23. <view class="top_flex">
  24. <image src="../../static/team/green.png" mode="widthFix" style="width: 150rpx;"></image>
  25. <view class="topt">
  26. <view class="title">
  27. 报名成功!
  28. </view>
  29. <view class="tip">
  30. 感谢您的支持
  31. </view>
  32. </view>
  33. </view>
  34. <view class="bottom">
  35. <view class="bottom_box">
  36. <view class="show"></view>
  37. <view class="bottom-money">
  38. <text>¥</text>{{ data.money }}
  39. </view>
  40. <view class="line" />
  41. <view class="bottom-p">
  42. 订单编号:{{ data.pay_number }}
  43. </view>
  44. <view class="bottom-p">
  45. 支付时间:{{ data.time }}
  46. </view>
  47. <view class="bottom-p">
  48. 支付方式:银行卡支付
  49. </view>
  50. </view>
  51. </view>
  52. <view class="link_btn" @click="goApp">前往争霸赛小程序</view>
  53. </view>
  54. </view>
  55. </template>
  56. <script>
  57. import { getSignPackage } from '@/apis/app.js';
  58. import { _API_HuiFuCheck, _API_QuickBankPay, _API_QuickBankSms, _API_CheckStatus } from '../../apis/zbs.js';
  59. const jweixin = require('jweixin-module');
  60. export default {
  61. data() {
  62. return {
  63. status: true,
  64. data: {},
  65. showSignup: true,
  66. countDown: 0, // 倒计时,
  67. sms_code: '', // 验证码,
  68. id: '',
  69. payId: '',
  70. showBank: false
  71. }
  72. },
  73. onShow() {
  74. this.getData()
  75. },
  76. computed: {
  77. userinfo() {
  78. return this.$store.state.userinfo
  79. }
  80. },
  81. methods: {
  82. // 去重新绑定
  83. goUnbank() {
  84. uni.navigateTo({
  85. url: './unBank?type=1'
  86. })
  87. },
  88. // 去小程序
  89. goApp() {
  90. window.location.href ='https://wxaurl.cn/7ylHYm7Pkce'
  91. },
  92. // 查询报名信息
  93. getData() {
  94. uni.showLoading()
  95. _API_HuiFuCheck().then(res => {
  96. uni.hideLoading()
  97. if (res.code == 200) {
  98. this.id = res.data.id
  99. this.showBank = true
  100. if (res.data.status) {
  101. this.showSignup = false
  102. this.data = res.data
  103. }
  104. } else if (res.code == 50014) {
  105. uni.showModal({
  106. title: '提示',
  107. content: '检测到您还未绑定银行卡,请前往绑定',
  108. showCancel: false,
  109. success: (res) => {
  110. if (res.confirm) {
  111. uni.redirectTo({
  112. url: './form?type=1'
  113. })
  114. }
  115. }
  116. })
  117. return
  118. } else {
  119. uni.showModal({
  120. content: res.message || '获取失败',
  121. showCancel: false
  122. });
  123. return false;
  124. }
  125. })
  126. },
  127. // 1.发送验证码
  128. getCode() {
  129. let that = this
  130. _API_QuickBankPay({ id: this.id }).then(res => {
  131. if (res.code == 200) {
  132. uni.showModal({
  133. content: '验证码发送成功',
  134. showCancel: false,
  135. success: (e) => {
  136. if (e.confirm) {
  137. that.payId = res.data.id
  138. that.countDown = 180;
  139. that.timer = setInterval(() => {
  140. that.countDown--;
  141. if (!that.countDown) {
  142. that.countDown = 0;
  143. clearInterval(that.timer);
  144. }
  145. }, 1000);
  146. }
  147. }
  148. })
  149. } else {
  150. uni.showModal({
  151. content: res.message || '获取验证码失败',
  152. showCancel: false
  153. });
  154. return false;
  155. }
  156. })
  157. },
  158. // 2. 携带验证码支付
  159. singup() {
  160. let that = this
  161. if (!this.sms_code) {
  162. uni.showModal({
  163. content: '请先输入验证码',
  164. showCancel: false
  165. })
  166. return
  167. }
  168. uni.showModal({
  169. title: '提示',
  170. content: '确定要支付吗?',
  171. success: (res) => {
  172. if (res.confirm) {
  173. _API_QuickBankSms({ id: that.payId, sms_code: that.sms_code }).then(res => {
  174. if (res.code == 200) {
  175. if (res.data.status == 0) {
  176. that.SearchStatus()
  177. } else if (res.data.status == 1) {
  178. that.showSignup = false
  179. }
  180. } else {
  181. uni.showModal({
  182. title: '失败',
  183. content: res.message || '获取失败',
  184. showCancel: false
  185. })
  186. return false;
  187. }
  188. })
  189. .catch(err => {})
  190. .finally(() => {
  191. setTimeout(() => {}, 3000)
  192. })
  193. }
  194. }
  195. })
  196. },
  197. // 3. 查询支付状态
  198. SearchStatus() {
  199. let that = this
  200. uni.showLoading({
  201. title: '查询支付状态中...',
  202. mask: true
  203. });
  204. _API_CheckStatus({ id: this.payId }).then(res => {
  205. if (res.code == 200) {
  206. if (res.data.status == 1) {
  207. uni.hideLoading()
  208. that.getData()
  209. that.showSignup = false
  210. } else {
  211. that.SearchStatus()
  212. }
  213. } else {
  214. uni.hideLoading()
  215. uni.showModal({
  216. content: res.message || '查询失败',
  217. showCancel: false
  218. })
  219. }
  220. }).catch(err => {
  221. uni.hideLoading()
  222. uni.showModal({
  223. content: err || '查询失败',
  224. showCancel: false
  225. })
  226. })
  227. }
  228. }
  229. }
  230. </script>
  231. <style>
  232. page {
  233. background-color: #F5F5F5;
  234. }
  235. </style>
  236. <style lang="scss" scoped>
  237. .bank {
  238. border-radius: 16rpx;
  239. margin: 30rpx 30rpx 0 30rpx;
  240. background-color: #fff;
  241. // border: 2rpx dashed #FF232C;
  242. padding: 24rpx;
  243. font-size: 28rpx;
  244. &_name {
  245. // text-align: center;
  246. font-weight: bold;
  247. font-size: 32rpx;
  248. margin-bottom: 20rpx;
  249. }
  250. &_btn {
  251. margin: 50rpx auto 0;
  252. width: 600rpx;
  253. line-height: 88rpx;
  254. border-radius: 44rpx;
  255. text-align: center;
  256. color: #FF232C;
  257. font-size: 32rpx;
  258. border: 2rpx solid #FF232C;
  259. }
  260. }
  261. .link_btn {
  262. width: 400rpx;
  263. margin: 600rpx auto 0;
  264. height: 88rpx;
  265. background: linear-gradient(88deg, #5FBC23 0%, #85CE52 100%);
  266. opacity: 1;
  267. border-radius: 44rpx;
  268. color: #fff;
  269. text-align: center;
  270. line-height: 88rpx;
  271. font-size: 32rpx;
  272. }
  273. .payB {
  274. margin-top: 30rpx;
  275. text-align: center;
  276. color: #FF232C;
  277. font-weight: bold;
  278. }
  279. .pay {
  280. margin: 0 30rpx 0 30rpx;
  281. border-radius: 16rpx;
  282. background-color: #fff;
  283. padding: 40rpx 20rpx 40rpx 20rpx;
  284. &_title {
  285. font-size: 34rpx;
  286. font-weight: bold;
  287. }
  288. &_time {
  289. margin-top: 20rpx;
  290. font-size: 32rpx;
  291. }
  292. &_btnSig {
  293. margin: 50rpx auto 0;
  294. width: 600rpx;
  295. line-height: 88rpx;
  296. border-radius: 44rpx;
  297. text-align: center;
  298. color: #fff;
  299. font-size: 32rpx;
  300. }
  301. .red {
  302. background: linear-gradient(93deg, #FF232C 0%, #FF571B 100%);
  303. }
  304. .gray {
  305. background-color: #E1E1E1;
  306. }
  307. }
  308. .item {
  309. @include flex();
  310. height: 104rpx;
  311. box-sizing: border-box;
  312. color: $app-sec-text-color;
  313. background: #F8F8F8;
  314. margin: 50rpx 0 40rpx 0;
  315. border-radius: 8rpx;
  316. padding-left: 24rpx;
  317. .login_icon {
  318. width: 36rpx;
  319. height: 44rpx;
  320. }
  321. .icon,
  322. .cuIcon-roundclosefill {
  323. margin: 0 20rpx;
  324. font-size: 36rpx;
  325. }
  326. input {
  327. flex: 1;
  328. height: 104rpx;
  329. margin-left: 15rpx;
  330. }
  331. .countdown {
  332. @include flex();
  333. height: 60rpx;
  334. font-size: 24rpx;
  335. padding: 0 20rpx;
  336. border: 2rpx solid #FB231F;
  337. margin-right: 20rpx;
  338. border-radius: 33rpx;
  339. color: $base-color;
  340. text {
  341. margin-left: 8rpx;
  342. }
  343. }
  344. }
  345. .top {
  346. width: 100%;
  347. height: 340rpx;
  348. display: flex;
  349. flex-direction: column;
  350. align-items: center;
  351. background: linear-gradient(88deg, #72DB2E 0%, #92E25A 100%);
  352. &_flex {
  353. display: flex;
  354. align-items: center;
  355. margin-top: 40rpx;
  356. .topt {
  357. color: #fff;
  358. margin-left: 24rpx;
  359. .title {
  360. font-size: 38rpx;
  361. font-weight: bold;
  362. color: #fff;
  363. }
  364. .tip {
  365. font-size: 28rpx;
  366. color: #fff;
  367. margin-top: 10rpx;
  368. }
  369. }
  370. }
  371. .bottom {
  372. width: 750rpx;
  373. height: 28rpx;
  374. border-radius: 490rpx;
  375. margin-top: 42rpx;
  376. position: relative;
  377. background: #419F05;
  378. &_box {
  379. // width: 702rpx;
  380. width: 94%;
  381. // height: 300rpx;
  382. background-color: #fff;
  383. position: absolute;
  384. left: 24rpx;
  385. top: 14rpx;
  386. padding-bottom: 16rpx;
  387. .tip {
  388. margin-top: 30rpx;
  389. padding: 0 24rpx;
  390. margin-bottom: 150rpx;
  391. .tipTitle {
  392. font-size: 36rpx;
  393. font-weight: bold;
  394. color: #333;
  395. margin-bottom: 14rpx;
  396. }
  397. }
  398. .show {
  399. width: 100%;
  400. height: 38rpx;
  401. background: linear-gradient(180deg, #419F05 0%, rgba(65, 159, 5, 0) 100%);
  402. opacity: 0.49;
  403. }
  404. }
  405. &-money {
  406. text-align: center;
  407. font-size: 72rpx;
  408. font-family: PingFang SC, PingFang SC;
  409. font-weight: bold;
  410. color: #77C740;
  411. line-height: 100rpx;
  412. padding: 10rpx 0 48rpx 0;
  413. text {
  414. font-size: 40rpx;
  415. font-family: PingFang SC, PingFang SC;
  416. font-weight: bold;
  417. color: #77C740;
  418. }
  419. }
  420. .line {
  421. margin: 0 auto;
  422. width: 654rpx;
  423. height: 0px;
  424. opacity: 1;
  425. border: 2rpx dashed #EEEEEE;
  426. margin-bottom: 40rpx;
  427. }
  428. &-p {
  429. font-size: 32rpx;
  430. font-family: PingFang SC, PingFang SC;
  431. font-weight: 400;
  432. color: #333333;
  433. padding: 0 24rpx;
  434. margin-bottom: 24rpx;
  435. }
  436. }
  437. }
  438. </style>