detail.vue 8.1 KB

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