detail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520
  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. <!-- 公众号跳转小程序 -->
  53. <!-- <div class="wx-open-weapp">
  54. <wx-open-launch-weapp
  55. id="launch-btn"
  56. username="gh_xxxxxxxx"
  57. :path="`pages/home/index.html?user=123&action=abc`"
  58. >
  59. <script type="text/wxtag-template">
  60. <style>
  61. .link_btn {
  62. width: 400rpx;
  63. margin: 600rpx auto 0;
  64. height: 88rpx;
  65. background: linear-gradient(88deg, #5FBC23 0%, #85CE52 100%);
  66. opacity: 1;
  67. border-radius: 44rpx;
  68. color: #fff;
  69. text-align: center;
  70. line-height: 88rpx;
  71. font-size: 32rpx;
  72. }
  73. </style>
  74. <div class="link_btn">前往争霸赛小程序</div>
  75. </script>
  76. </wx-open-launch-weapp>
  77. </div> -->
  78. </view>
  79. </view>
  80. </template>
  81. <script>
  82. import { getSignPackage } from '@/apis/app.js';
  83. import { _API_HuiFuCheck, _API_QuickBankPay, _API_QuickBankSms, _API_CheckStatus } from '../../apis/zbs.js';
  84. const jweixin = require('jweixin-module');
  85. export default {
  86. data() {
  87. return {
  88. status: true,
  89. data: {},
  90. showSignup: true,
  91. countDown: 0, // 倒计时,
  92. sms_code: '', // 验证码,
  93. id: '',
  94. payId: '',
  95. showBank: false
  96. }
  97. },
  98. onShow() {
  99. this.getData()
  100. },
  101. computed: {
  102. userinfo() {
  103. return this.$store.state.userinfo
  104. }
  105. },
  106. // onReady() {
  107. // this.signInit();
  108. // // 微信 config 信息验证后,渲染开放标签
  109. // uni.$on('jweixinReady', () => {
  110. // console.log('完成')
  111. // })
  112. // },
  113. methods: {
  114. // 去重新绑定
  115. goUnbank() {
  116. uni.navigateTo({
  117. url: './unBank'
  118. })
  119. },
  120. //进入争霸赛小程序
  121. signInit() {
  122. const _this = this;
  123. let link = window.location.href;
  124. getSignPackage({
  125. url: link
  126. }).then(res => {
  127. if (res.code == 200) {
  128. let data = JSON.parse(res.data);
  129. // 判断是否支持分享
  130. jweixin.config({
  131. debug: false, //开启debug模式.正式环境设置为false,测试环境设置为true
  132. appId: data.appId,
  133. timestamp: data.timestamp,
  134. nonceStr: data.nonceStr,
  135. signature: data.signature,
  136. jsApiList: ['wx-open-launch-weapp'], //根据需要看需要哪些SDK的功能
  137. openTagList: ['wx-open-launch-weapp'] // 跳转小程序时必填
  138. });
  139. jweixin.ready(res => {
  140. uni.$emit('jweixinReady', res)
  141. this.$nextTick(() => {
  142. let btn = document.getElementById('launch-btn');
  143. btn.addEventListener('launch', e => {
  144. console.log('success');
  145. });
  146. btn.addEventListener('error', e => {
  147. alert('小程序打开失败');
  148. console.log('fail', e.detail);
  149. });
  150. });
  151. });
  152. jweixin.error(err => {
  153. console.log(err, 'err')
  154. });
  155. } else {
  156. uni.showModal({
  157. content: res.msg || '分享失败',
  158. showCancel: false
  159. })
  160. }
  161. });
  162. },
  163. // 查询报名信息
  164. getData() {
  165. uni.showLoading()
  166. _API_HuiFuCheck().then(res => {
  167. uni.hideLoading()
  168. if (res.code == 200) {
  169. this.id = res.data.id
  170. this.showBank = true
  171. if (res.data.status) {
  172. this.showSignup = false
  173. this.data = res.data
  174. }
  175. } else if (res.code == 50014) {
  176. uni.showModal({
  177. title: '提示',
  178. content: '检测到您还未绑定银行卡,请前往绑定',
  179. showCancel: false,
  180. success: (res) => {
  181. if (res.confirm) {
  182. uni.redirectTo({
  183. url: './form'
  184. })
  185. }
  186. }
  187. })
  188. return
  189. } else {
  190. uni.showModal({
  191. content: res.message || '获取失败',
  192. showCancel: false
  193. });
  194. return false;
  195. }
  196. })
  197. },
  198. // 1.发送验证码
  199. getCode() {
  200. let that = this
  201. _API_QuickBankPay({ id: this.id }).then(res => {
  202. if (res.code == 200) {
  203. uni.showModal({
  204. content: '验证码发送成功',
  205. showCancel: false,
  206. success: (e) => {
  207. if (e.confirm) {
  208. that.payId = res.data.id
  209. that.countDown = 180;
  210. that.timer = setInterval(() => {
  211. that.countDown--;
  212. if (!that.countDown) {
  213. that.countDown = 0;
  214. clearInterval(that.timer);
  215. }
  216. }, 1000);
  217. }
  218. }
  219. })
  220. } else {
  221. uni.showModal({
  222. content: res.message || '获取验证码失败',
  223. showCancel: false
  224. });
  225. return false;
  226. }
  227. })
  228. },
  229. // 2. 携带验证码支付
  230. singup() {
  231. let that = this
  232. if (!this.sms_code) {
  233. uni.showModal({
  234. content: '请先输入验证码',
  235. showCancel: false
  236. })
  237. return
  238. }
  239. uni.showModal({
  240. title: '提示',
  241. content: '确定要支付吗?',
  242. success: (res) => {
  243. if (res.confirm) {
  244. _API_QuickBankSms({ id: that.payId, sms_code: that.sms_code }).then(res => {
  245. if (res.code == 200) {
  246. if (res.data.status == 0) {
  247. that.SearchStatus()
  248. } else if (res.data.status == 1) {
  249. that.showSignup = false
  250. }
  251. } else {
  252. uni.showModal({
  253. title: '失败',
  254. content: res.message || '获取失败',
  255. showCancel: false
  256. })
  257. return false;
  258. }
  259. })
  260. .catch(err => {})
  261. .finally(() => {
  262. setTimeout(() => {}, 3000)
  263. })
  264. }
  265. }
  266. })
  267. },
  268. // 3. 查询支付状态
  269. SearchStatus() {
  270. let that = this
  271. uni.showLoading({
  272. title: '查询支付状态中...',
  273. mask: true
  274. });
  275. _API_CheckStatus({ id: this.payId }).then(res => {
  276. if (res.code == 200) {
  277. if (res.data.status == 1) {
  278. uni.hideLoading()
  279. that.getData()
  280. that.showSignup = false
  281. } else {
  282. that.SearchStatus()
  283. }
  284. } else {
  285. uni.hideLoading()
  286. uni.showModal({
  287. content: res.message || '查询失败',
  288. showCancel: false
  289. })
  290. }
  291. }).catch(err => {
  292. uni.hideLoading()
  293. uni.showModal({
  294. content: err || '查询失败',
  295. showCancel: false
  296. })
  297. })
  298. }
  299. }
  300. }
  301. </script>
  302. <style>
  303. page {
  304. background-color: #F5F5F5;
  305. }
  306. </style>
  307. <style lang="scss" scoped>
  308. .bank {
  309. border-radius: 16rpx;
  310. margin: 30rpx 30rpx 0 30rpx;
  311. background-color: #fff;
  312. // border: 2rpx dashed #FF232C;
  313. padding: 24rpx;
  314. font-size: 28rpx;
  315. &_name {
  316. // text-align: center;
  317. font-weight: bold;
  318. font-size: 32rpx;
  319. margin-bottom: 20rpx;
  320. }
  321. &_btn {
  322. margin: 50rpx auto 0;
  323. width: 600rpx;
  324. line-height: 88rpx;
  325. border-radius: 44rpx;
  326. text-align: center;
  327. color: #FF232C;
  328. font-size: 32rpx;
  329. border: 2rpx solid #FF232C;
  330. }
  331. }
  332. .link_btn {
  333. width: 400rpx;
  334. margin: 600rpx auto 0;
  335. height: 88rpx;
  336. background: linear-gradient(88deg, #5FBC23 0%, #85CE52 100%);
  337. opacity: 1;
  338. border-radius: 44rpx;
  339. color: #fff;
  340. text-align: center;
  341. line-height: 88rpx;
  342. font-size: 32rpx;
  343. }
  344. .payB {
  345. margin-top: 30rpx;
  346. text-align: center;
  347. color: #FF232C;
  348. font-weight: bold;
  349. }
  350. .pay {
  351. margin: 0 30rpx 0 30rpx;
  352. border-radius: 16rpx;
  353. background-color: #fff;
  354. padding: 40rpx 20rpx 40rpx 20rpx;
  355. &_title {
  356. font-size: 34rpx;
  357. font-weight: bold;
  358. }
  359. &_time {
  360. margin-top: 20rpx;
  361. font-size: 32rpx;
  362. }
  363. &_btnSig {
  364. margin: 50rpx auto 0;
  365. width: 600rpx;
  366. line-height: 88rpx;
  367. border-radius: 44rpx;
  368. text-align: center;
  369. color: #fff;
  370. font-size: 32rpx;
  371. }
  372. .red {
  373. background: linear-gradient(93deg, #FF232C 0%, #FF571B 100%);
  374. }
  375. .gray {
  376. background-color: #E1E1E1;
  377. }
  378. }
  379. .item {
  380. @include flex();
  381. height: 104rpx;
  382. box-sizing: border-box;
  383. color: $app-sec-text-color;
  384. background: #F8F8F8;
  385. margin: 50rpx 0 40rpx 0;
  386. border-radius: 8rpx;
  387. padding-left: 24rpx;
  388. .login_icon {
  389. width: 36rpx;
  390. height: 44rpx;
  391. }
  392. .icon,
  393. .cuIcon-roundclosefill {
  394. margin: 0 20rpx;
  395. font-size: 36rpx;
  396. }
  397. input {
  398. flex: 1;
  399. height: 104rpx;
  400. margin-left: 15rpx;
  401. }
  402. .countdown {
  403. @include flex();
  404. height: 60rpx;
  405. font-size: 24rpx;
  406. padding: 0 20rpx;
  407. border: 2rpx solid #FB231F;
  408. margin-right: 20rpx;
  409. border-radius: 33rpx;
  410. color: $base-color;
  411. text {
  412. margin-left: 8rpx;
  413. }
  414. }
  415. }
  416. .top {
  417. width: 100%;
  418. height: 340rpx;
  419. display: flex;
  420. flex-direction: column;
  421. align-items: center;
  422. background: linear-gradient(88deg, #72DB2E 0%, #92E25A 100%);
  423. &_flex {
  424. display: flex;
  425. align-items: center;
  426. margin-top: 40rpx;
  427. .topt {
  428. color: #fff;
  429. margin-left: 24rpx;
  430. .title {
  431. font-size: 38rpx;
  432. font-weight: bold;
  433. color: #fff;
  434. }
  435. .tip {
  436. font-size: 28rpx;
  437. color: #fff;
  438. margin-top: 10rpx;
  439. }
  440. }
  441. }
  442. .bottom {
  443. width: 750rpx;
  444. height: 28rpx;
  445. border-radius: 490rpx;
  446. margin-top: 42rpx;
  447. position: relative;
  448. background: #419F05;
  449. &_box {
  450. // width: 702rpx;
  451. width: 94%;
  452. // height: 300rpx;
  453. background-color: #fff;
  454. position: absolute;
  455. left: 24rpx;
  456. top: 14rpx;
  457. padding-bottom: 16rpx;
  458. .tip {
  459. margin-top: 30rpx;
  460. padding: 0 24rpx;
  461. margin-bottom: 150rpx;
  462. .tipTitle {
  463. font-size: 36rpx;
  464. font-weight: bold;
  465. color: #333;
  466. margin-bottom: 14rpx;
  467. }
  468. }
  469. .show {
  470. width: 100%;
  471. height: 38rpx;
  472. background: linear-gradient(180deg, #419F05 0%, rgba(65, 159, 5, 0) 100%);
  473. opacity: 0.49;
  474. }
  475. }
  476. &-money {
  477. text-align: center;
  478. font-size: 72rpx;
  479. font-family: PingFang SC, PingFang SC;
  480. font-weight: bold;
  481. color: #77C740;
  482. line-height: 100rpx;
  483. padding: 10rpx 0 48rpx 0;
  484. text {
  485. font-size: 40rpx;
  486. font-family: PingFang SC, PingFang SC;
  487. font-weight: bold;
  488. color: #77C740;
  489. }
  490. }
  491. .line {
  492. margin: 0 auto;
  493. width: 654rpx;
  494. height: 0px;
  495. opacity: 1;
  496. border: 2rpx dashed #EEEEEE;
  497. margin-bottom: 40rpx;
  498. }
  499. &-p {
  500. font-size: 32rpx;
  501. font-family: PingFang SC, PingFang SC;
  502. font-weight: 400;
  503. color: #333333;
  504. padding: 0 24rpx;
  505. margin-bottom: 24rpx;
  506. }
  507. }
  508. }
  509. </style>