Payment2.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. <template>
  2. <div>
  3. <div class="headers">
  4. <div class="back" @click="goBack">
  5. <img src="@/assets/back.png" alt="">
  6. </div>
  7. <div class="title">{{item.title}}</div>
  8. </div>
  9. <div class="invite-page">
  10. <div class="fund-card">
  11. <div class="title">参与【 {{item.title}} 】</div>
  12. <div class="subtitle">
  13. 参与成功科技股收益立即打款到账您的账户
  14. </div>
  15. <div class="form-section">
  16. <div class="label">请选择支付方式</div>
  17. <div class="pay-list">
  18. <div
  19. class="pay-item"
  20. v-for="(item, idx) in payList"
  21. :key="item.id || idx"
  22. @click="payType = item.title"
  23. >
  24. <img
  25. class="pay-icon"
  26. :src="item.title.includes('微信') ? require('@/assets/weixin.png') : require('@/assets/zhifubao.png')"
  27. alt="icon"
  28. />
  29. <span class="pay-title">{{ item.title }}</span>
  30. <input
  31. type="radio"
  32. name="pay"
  33. :checked="payType === item.title"
  34. @change="payType = item.title"
  35. />
  36. </div>
  37. </div>
  38. </div>
  39. <div class="form-section">
  40. <div class="label">产品价格</div>
  41. <div class="price-field">
  42. <input
  43. type="text"
  44. v-model="item.money"
  45. readonly
  46. class="price-input"
  47. >
  48. </div>
  49. </div>
  50. <button
  51. class="submit-btn"
  52. :disabled="!payType"
  53. @click="handleSubmit"
  54. >
  55. 立即支付
  56. </button>
  57. </div>
  58. </div>
  59. <!-- 实名认证提示弹窗 -->
  60. <div v-if="showAuthDialog" class="custom-dialog-mask">
  61. <div class="custom-dialog auth-dialog">
  62. <div class="dialog-close" @click="showAuthDialog = false">
  63. <i class="close-icon"></i>
  64. </div>
  65. <div class="dialog-icon">
  66. <svg t="1710401275044" class="auth-icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6356">
  67. <path d="M512 512m-448 0a448 448 0 1 0 896 0 448 448 0 1 0-896 0Z" fill="#1890FF" p-id="6357"></path>
  68. <path d="M512 320c-17.7 0-32 14.3-32 32v256c0 17.7 14.3 32 32 32s32-14.3 32-32V352c0-17.7-14.3-32-32-32z" fill="#FFFFFF" p-id="6358"></path>
  69. <path d="M512 720m-48 0a48 48 0 1 0 96 0 48 48 0 1 0-96 0Z" fill="#FFFFFF" p-id="6359"></path>
  70. </svg>
  71. </div>
  72. <div class="dialog-title auth-title">温馨提示</div>
  73. <div class="dialog-content">您还未完成实名认证<br/>请先进行实名认证</div>
  74. <button class="dialog-btn auth-btn" @click="goToAuth">去认证</button>
  75. </div>
  76. </div>
  77. </div>
  78. </template>
  79. <script>
  80. import {getTong,getChongInfo2,getUserInfo} from '@/api/home.js'
  81. import { Toast } from 'vant';
  82. export default {
  83. name: 'Payment2',
  84. data() {
  85. return {
  86. payType: '',
  87. payList: [],
  88. item:{},
  89. userInfo: {},
  90. showAuthDialog: false
  91. }
  92. },
  93. methods:{
  94. goBack() {
  95. this.$router.go(-1)
  96. },
  97. async getPayType(){
  98. const res = await getTong()
  99. this.payList = res.data || []
  100. },
  101. async getUserInfo() {
  102. try {
  103. const res = await getUserInfo();
  104. this.userInfo = res.data;
  105. } catch (error) {
  106. console.error('获取用户信息失败:', error);
  107. }
  108. },
  109. handleSubmit() {
  110. // 检查实名认证状态
  111. if (this.userInfo.if_real === 0) {
  112. this.showAuthDialog = true;
  113. return;
  114. }
  115. // 处理提交逻辑
  116. let params = {
  117. type: this.payType,
  118. money: this.item.money,
  119. }
  120. getChongInfo2(params).then(res => {
  121. if(res.code === 1){
  122. Toast.success('提交成功')
  123. setTimeout(() => {
  124. window.location.href = res.data.payUrl
  125. }, 1000);
  126. }
  127. })
  128. },
  129. goToAuth() {
  130. this.$router.push('/user-center');
  131. }
  132. },
  133. mounted(){
  134. this.getPayType()
  135. this.getUserInfo()
  136. this.item = this.$route.query.item
  137. }
  138. }
  139. </script>
  140. <style lang="scss" scoped>
  141. .invite-page {
  142. min-height: 100vh;
  143. /* background: url('../assets/dabag.png') no-repeat; */
  144. background-color: #b43a39;
  145. background-size: cover;
  146. padding: 70px 16px 32px 16px;
  147. box-sizing: border-box;
  148. }
  149. .headers {
  150. position: relative;
  151. height: 44px;
  152. background-color: #fff;
  153. display: flex;
  154. align-items: center;
  155. justify-content: center;
  156. border-bottom: 1px solid #eee;
  157. .back {
  158. position: absolute;
  159. left: 15px;
  160. font-size: 20px;
  161. img{
  162. width: 20px;
  163. height: 20px;
  164. }
  165. }
  166. .title {
  167. font-size: 18px;
  168. font-weight: 500;
  169. }
  170. }
  171. .top-header {
  172. display: flex;
  173. align-items: center;
  174. margin-bottom: 24px;
  175. padding-top:12px;
  176. .logo {
  177. width: 85px;
  178. height: 58px;
  179. object-fit: contain;
  180. background: #fff;
  181. margin-right: 16px;
  182. }
  183. .slogan {
  184. color: #fff;
  185. font-size: 16px;
  186. font-weight: bold;
  187. line-height: 1.3;
  188. text-shadow: 0 2px 8px rgba(0,0,0,0.12);
  189. }
  190. }
  191. .fund-card {
  192. background: #fff;
  193. border-radius: 16px;
  194. box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  195. padding: 28px 18px 24px 18px;
  196. max-width: 350px;
  197. margin: 0 auto;
  198. text-align: center;
  199. }
  200. .title {
  201. font-size: 24px;
  202. font-weight: bold;
  203. margin-bottom: 8px;
  204. }
  205. .subtitle {
  206. font-size: 12px;
  207. color: #333;
  208. margin-bottom: 18px;
  209. .amount {
  210. font-weight: bold;
  211. font-size: 16px;
  212. }
  213. }
  214. .form-section {
  215. margin-bottom: 18px;
  216. text-align: left;
  217. }
  218. .label {
  219. font-size: 15px;
  220. color: #333;
  221. margin-bottom: 8px;
  222. }
  223. .pay-list {
  224. display: flex;
  225. flex-direction: column;
  226. gap: 18px;
  227. margin-top: 8px;
  228. }
  229. .pay-item {
  230. display: flex;
  231. align-items: center;
  232. background: #fff;
  233. border-radius: 8px;
  234. padding: 10px 10px;
  235. box-shadow: 0 1px 4px rgba(0,0,0,0.03);
  236. cursor: pointer;
  237. border: 1.5px solid #eee;
  238. margin-bottom: 2px;
  239. transition: border-color 0.2s;
  240. }
  241. .pay-item:hover, .pay-item input[type="radio"]:checked + .pay-title {
  242. border-color: #4caf50;
  243. }
  244. .pay-icon {
  245. width: 32px;
  246. height: 32px;
  247. margin-right: 12px;
  248. }
  249. .pay-title {
  250. flex: 1;
  251. font-size: 15px;
  252. color: #333;
  253. }
  254. .pay-item input[type="radio"] {
  255. width: 18px;
  256. height: 18px;
  257. }
  258. .price-field {
  259. background: #f7f8fa;
  260. border-radius: 8px;
  261. padding: 8px 12px;
  262. .price-input {
  263. width: 100%;
  264. border: none;
  265. background: transparent;
  266. color: #333;
  267. font-size: 16px;
  268. font-weight: bold;
  269. outline: none;
  270. }
  271. }
  272. .submit-btn {
  273. margin-top: 10px;
  274. height: 40px;
  275. width: 100%;
  276. font-size: 18px;
  277. border-radius: 12px;
  278. background: #f7f8fa;
  279. color: #999;
  280. border: none;
  281. font-weight: bold;
  282. cursor: pointer;
  283. transition: all 0.3s;
  284. &:not(:disabled) {
  285. background: #4caf50;
  286. color: #fff;
  287. }
  288. &:disabled {
  289. cursor: not-allowed;
  290. }
  291. }
  292. /* 认证弹窗样式 */
  293. .custom-dialog-mask {
  294. position: fixed;
  295. top: 0;
  296. left: 0;
  297. right: 0;
  298. bottom: 0;
  299. background: rgba(0, 0, 0, 0.6);
  300. display: flex;
  301. align-items: center;
  302. justify-content: center;
  303. z-index: 9999;
  304. }
  305. .custom-dialog {
  306. position: relative;
  307. width: 280px;
  308. background: #fff;
  309. border-radius: 12px;
  310. padding: 20px;
  311. text-align: center;
  312. animation: dialogFadeIn 0.3s ease;
  313. }
  314. .dialog-icon {
  315. width: 60px;
  316. height: 60px;
  317. margin: 0 auto 16px;
  318. }
  319. .auth-icon {
  320. width: 100%;
  321. height: 100%;
  322. }
  323. .dialog-title {
  324. font-size: 18px;
  325. font-weight: 500;
  326. margin-bottom: 12px;
  327. }
  328. .auth-title {
  329. color: #1890FF;
  330. }
  331. .dialog-content {
  332. font-size: 14px;
  333. color: #666;
  334. line-height: 1.8;
  335. margin: 16px 0 24px;
  336. }
  337. .dialog-btn {
  338. width: 100%;
  339. height: 40px;
  340. border: none;
  341. border-radius: 20px;
  342. font-size: 16px;
  343. color: #fff;
  344. cursor: pointer;
  345. transition: all 0.3s ease;
  346. }
  347. .auth-btn {
  348. background: #1890FF;
  349. }
  350. .auth-btn:hover {
  351. background: #40a9ff;
  352. }
  353. .auth-dialog {
  354. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  355. }
  356. .dialog-close {
  357. position: absolute;
  358. top: 12px;
  359. right: 12px;
  360. width: 24px;
  361. height: 24px;
  362. display: flex;
  363. align-items: center;
  364. justify-content: center;
  365. cursor: pointer;
  366. transition: all 0.3s ease;
  367. }
  368. .dialog-close:hover {
  369. transform: rotate(90deg);
  370. }
  371. .dialog-close .close-icon {
  372. position: relative;
  373. width: 16px;
  374. height: 16px;
  375. }
  376. .dialog-close .close-icon::before,
  377. .dialog-close .close-icon::after {
  378. content: '';
  379. position: absolute;
  380. width: 100%;
  381. height: 2px;
  382. background-color: #999;
  383. top: 50%;
  384. left: 0;
  385. }
  386. .dialog-close .close-icon::before {
  387. transform: rotate(45deg);
  388. }
  389. .dialog-close .close-icon::after {
  390. transform: rotate(-45deg);
  391. }
  392. @keyframes dialogFadeIn {
  393. from {
  394. opacity: 0;
  395. transform: scale(0.9);
  396. }
  397. to {
  398. opacity: 1;
  399. transform: scale(1);
  400. }
  401. }
  402. </style>