Paymentnew.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  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,getChongXiufu,getUserInfo} from '@/api/home.js'
  81. import { Toast } from 'vant';
  82. export default {
  83. name: 'PaymentNew',
  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. getChongXiufu(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 center center;
  144. background-size: cover;
  145. padding: 70px 16px 32px 16px;
  146. box-sizing: border-box;
  147. }
  148. .headers {
  149. position: relative;
  150. height: 44px;
  151. background-color: #fff;
  152. display: flex;
  153. align-items: center;
  154. justify-content: center;
  155. border-bottom: 1px solid #eee;
  156. .back {
  157. position: absolute;
  158. left: 15px;
  159. font-size: 20px;
  160. img{
  161. width: 20px;
  162. height: 20px;
  163. }
  164. }
  165. .title {
  166. font-size: 18px;
  167. font-weight: 500;
  168. }
  169. }
  170. .fund-card {
  171. background: #fff;
  172. border-radius: 16px;
  173. box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  174. padding: 28px 18px 24px 18px;
  175. max-width: 350px;
  176. margin: 0 auto;
  177. text-align: center;
  178. }
  179. .title {
  180. font-size: 24px;
  181. font-weight: bold;
  182. margin-bottom: 8px;
  183. }
  184. .subtitle {
  185. font-size: 12px;
  186. color: #333;
  187. margin-bottom: 18px;
  188. .amount {
  189. font-weight: bold;
  190. font-size: 16px;
  191. }
  192. }
  193. .form-section {
  194. margin-bottom: 18px;
  195. text-align: left;
  196. }
  197. .label {
  198. font-size: 15px;
  199. color: #333;
  200. margin-bottom: 8px;
  201. }
  202. .pay-list {
  203. display: flex;
  204. flex-direction: column;
  205. gap: 18px;
  206. margin-top: 8px;
  207. }
  208. .pay-item {
  209. display: flex;
  210. align-items: center;
  211. background: #fff;
  212. border-radius: 8px;
  213. padding: 10px 10px;
  214. box-shadow: 0 1px 4px rgba(0,0,0,0.03);
  215. cursor: pointer;
  216. border: 1.5px solid #eee;
  217. margin-bottom: 2px;
  218. transition: border-color 0.2s;
  219. }
  220. .pay-item:hover, .pay-item input[type="radio"]:checked + .pay-title {
  221. border-color: #4caf50;
  222. }
  223. .pay-icon {
  224. width: 32px;
  225. height: 32px;
  226. margin-right: 12px;
  227. }
  228. .pay-title {
  229. flex: 1;
  230. font-size: 15px;
  231. color: #333;
  232. }
  233. .pay-item input[type="radio"] {
  234. width: 18px;
  235. height: 18px;
  236. }
  237. .price-field {
  238. background: #f7f8fa;
  239. border-radius: 8px;
  240. padding: 8px 12px;
  241. .price-input {
  242. width: 100%;
  243. border: none;
  244. background: transparent;
  245. color: #333;
  246. font-size: 16px;
  247. font-weight: bold;
  248. outline: none;
  249. }
  250. }
  251. .submit-btn {
  252. margin-top: 10px;
  253. height: 40px;
  254. width: 100%;
  255. font-size: 18px;
  256. border-radius: 12px;
  257. background: #f7f8fa;
  258. color: #999;
  259. border: none;
  260. font-weight: bold;
  261. cursor: pointer;
  262. transition: all 0.3s;
  263. &:not(:disabled) {
  264. background: #4caf50;
  265. color: #fff;
  266. }
  267. &:disabled {
  268. cursor: not-allowed;
  269. }
  270. }
  271. /* 认证弹窗样式 */
  272. .custom-dialog-mask {
  273. position: fixed;
  274. top: 0;
  275. left: 0;
  276. right: 0;
  277. bottom: 0;
  278. background: rgba(0, 0, 0, 0.6);
  279. display: flex;
  280. align-items: center;
  281. justify-content: center;
  282. z-index: 9999;
  283. }
  284. .custom-dialog {
  285. position: relative;
  286. width: 280px;
  287. background: #fff;
  288. border-radius: 12px;
  289. padding: 20px;
  290. text-align: center;
  291. animation: dialogFadeIn 0.3s ease;
  292. }
  293. .dialog-icon {
  294. width: 60px;
  295. height: 60px;
  296. margin: 0 auto 16px;
  297. }
  298. .auth-icon {
  299. width: 100%;
  300. height: 100%;
  301. }
  302. .dialog-title {
  303. font-size: 18px;
  304. font-weight: 500;
  305. margin-bottom: 12px;
  306. }
  307. .auth-title {
  308. color: #1890FF;
  309. }
  310. .dialog-content {
  311. font-size: 14px;
  312. color: #666;
  313. line-height: 1.8;
  314. margin: 16px 0 24px;
  315. }
  316. .dialog-btn {
  317. width: 100%;
  318. height: 40px;
  319. border: none;
  320. border-radius: 20px;
  321. font-size: 16px;
  322. color: #fff;
  323. cursor: pointer;
  324. transition: all 0.3s ease;
  325. }
  326. .auth-btn {
  327. background: #1890FF;
  328. }
  329. .auth-btn:hover {
  330. background: #40a9ff;
  331. }
  332. .auth-dialog {
  333. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  334. }
  335. .dialog-close {
  336. position: absolute;
  337. top: 12px;
  338. right: 12px;
  339. width: 24px;
  340. height: 24px;
  341. display: flex;
  342. align-items: center;
  343. justify-content: center;
  344. cursor: pointer;
  345. transition: all 0.3s ease;
  346. }
  347. .dialog-close:hover {
  348. transform: rotate(90deg);
  349. }
  350. .dialog-close .close-icon {
  351. position: relative;
  352. width: 16px;
  353. height: 16px;
  354. }
  355. .dialog-close .close-icon::before,
  356. .dialog-close .close-icon::after {
  357. content: '';
  358. position: absolute;
  359. width: 100%;
  360. height: 2px;
  361. background-color: #999;
  362. top: 50%;
  363. left: 0;
  364. }
  365. .dialog-close .close-icon::before {
  366. transform: rotate(45deg);
  367. }
  368. .dialog-close .close-icon::after {
  369. transform: rotate(-45deg);
  370. }
  371. @keyframes dialogFadeIn {
  372. from {
  373. opacity: 0;
  374. transform: scale(0.9);
  375. }
  376. to {
  377. opacity: 1;
  378. transform: scale(1);
  379. }
  380. }
  381. </style>