Recharge.vue 25 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031
  1. <template>
  2. <div class="recharge-page">
  3. <!-- 顶部标题 -->
  4. <div class="page-header">
  5. <div class="header-content">
  6. <div class="logo-wrapper">
  7. <div class="logo-container">
  8. <img src="@/assets/images/logo.png" alt="告白语音" class="logo-image" />
  9. </div>
  10. </div>
  11. </div>
  12. </div>
  13. <!-- 用户信息 -->
  14. <div class="user-info-section">
  15. <div class="user-info-card">
  16. <div class="user-avatar">
  17. <img v-if="userInfo.avatar" :src="userInfo.avatar" class="avatar" />
  18. <div v-else class="avatar-placeholder">
  19. <van-icon name="user-o" size="28" />
  20. </div>
  21. <!--<div class="switch-btn" @click="switchUser">
  22. </div>-->
  23. </div>
  24. <div class="user-details">
  25. <div class="user-name">{{ userInfo.nickname || "未知用户" }}</div>
  26. <div class="user-id">
  27. <img src="@/assets/images/id.png" alt="ID" class="id-icon" />
  28. <span>{{ userInfo.id || "未知ID" }}</span>
  29. </div>
  30. </div>
  31. <div class="action-buttons">
  32. <van-button v-if="canExchange === 'true'" type="primary" size="small" round @click="goToCoinExchange"
  33. class="action-btn">
  34. 金币兑换
  35. </van-button>
  36. <van-button type="primary" size="small" round @click="logout" class="action-btn logout-btn">
  37. 退出登录
  38. </van-button>
  39. </div>
  40. </div>
  41. </div>
  42. <!-- 充值金额选择 -->
  43. <div class="recharge-section">
  44. <h2 class="section-title">充值金额</h2>
  45. <div class="recharge-grid">
  46. <div v-for="(item, index) in rechargeOptionsWithCustom" :key="index" class="recharge-item"
  47. :class="{ active: selectedRecharge === index }" @click="selectRecharge(index)">
  48. <div class="diamond-icon">
  49. <img src="@/assets/images/recharge_zuanshi.png" alt="钻石" class="diamond-img" />
  50. </div>
  51. <template v-if="!item.isCustom">
  52. <div class="recharge-amount">{{ item.amount }}</div>
  53. <div class="recharge-price">¥{{ item.price }}</div>
  54. </template>
  55. <template v-else>
  56. <div class="recharge-amount">自定义金额</div>
  57. <div class="recharge-price">点击输入</div>
  58. </template>
  59. </div>
  60. </div>
  61. <div v-if="isCustomSelected" class="custom-input">
  62. <van-field v-model="customAmount" type="number" input-align="center" placeholder="请输入自定义金额(元)" clearable />
  63. </div>
  64. </div>
  65. <!-- 支付方式 -->
  66. <div class="payment-section">
  67. <div v-if="paymentType === 'alipay'" class="payment-option">
  68. <div class="payment-icon">
  69. <img src="@/assets/images/recharge_paypal.png" alt="支付宝支付" class="alipay-icon" />
  70. </div>
  71. <div class="payment-name">支付宝支付</div>
  72. <div class="payment-selected">
  73. <img src="@/assets/images/duihao.png" alt="选中" class="check-icon" />
  74. </div>
  75. </div>
  76. <div v-if="paymentType === 'wechat'" class="payment-option">
  77. <div class="payment-icon">
  78. <img src="@/assets/images/recharge_wechat.png" alt="微信支付" class="wechat-icon" />
  79. </div>
  80. <div class="payment-name">微信支付</div>
  81. <div class="payment-selected">
  82. <img src="@/assets/images/duihao.png" alt="选中" class="check-icon" />
  83. </div>
  84. </div>
  85. </div>
  86. <!-- 温馨提示 -->
  87. <div class="tips-section">
  88. <div class="tips-title">温馨提示:</div>
  89. <div class="tips-content">
  90. <div class="tip-item">
  91. 1. 充值前请确定您已满18周岁并具有完全民事行为能力。
  92. </div>
  93. <div class="tip-item">
  94. 2. 安全账号转账、理赔转账、刷单、代充均为骗局,请认真核实并确认
  95. </div>
  96. <div class="tip-item" v-if="paymentType === 'wechat'">
  97. 3. 大额充值,支付方式可选择"零钱通"
  98. </div>
  99. <div class="tip-item" v-if="paymentType === 'alipay'">
  100. 3. 大额充值,请确保支付宝账户余额充足
  101. </div>
  102. <div class="tip-item">4. 如有疑问,请联系服务号客服</div>
  103. </div>
  104. <!-- 协议勾选 -->
  105. <div class="agreement-checkbox" @click="toggleAgreement">
  106. <div class="checkbox-wrapper" :class="{ checked: agreementChecked }">
  107. <van-icon v-if="agreementChecked" name="success" size="14" color="#fff" />
  108. </div>
  109. <div class="agreement-text">
  110. 我已阅读并同意
  111. <span class="agreement-link" @click.stop="showAgreement">《用户充值协议》</span>
  112. </div>
  113. </div>
  114. </div>
  115. <!-- 支付按钮 -->
  116. <div class="pay-button">
  117. <van-button type="primary" block round @click="confirmPay">确认支付</van-button>
  118. </div>
  119. <!-- 协议弹框 -->
  120. <van-dialog v-model="agreementVisible" title="用户充值协议" confirm-button-text="我已阅读" @confirm="agreementChecked = true"
  121. :show-cancel-button="false">
  122. <div class="agreement-content">
  123. <iframe v-if="agreementVisible" src="https://gbyy91.com/agreement/recharge.html" frameborder="0"
  124. class="agreement-iframe"></iframe>
  125. </div>
  126. </van-dialog>
  127. </div>
  128. </template>
  129. <script>
  130. // eslint-disable-next-line no-undef
  131. import { getProductList } from "@/api/product";
  132. import { getUserInfo } from "@/api/user";
  133. import { aliPayCoin, aliPayH5 } from "@/api/pay";
  134. import { ahtuCodeApi, wechatPayCoin, wxPay } from "@/api/pay";
  135. import {
  136. getDevicePayWayId,
  137. getPlatformType,
  138. ALI_CUSTOM,
  139. PAYMENT_TYPE,
  140. } from "@/utils/config";
  141. export default {
  142. name: "RechargePage",
  143. data() {
  144. return {
  145. resultDataMess: {},
  146. userCode: "", // 用于微信支付
  147. userInfo: {
  148. // 用于支付宝支付
  149. id: "",
  150. nickname: "",
  151. avatar: "",
  152. },
  153. rechargeOptions: [],
  154. selectedRecharge: 0,
  155. paymentMethod: "alipay",
  156. isLoading: false,
  157. agreementChecked: false,
  158. agreementVisible: false,
  159. // 自定义金额
  160. customAmount: "",
  161. // 支付方式类型
  162. paymentType: PAYMENT_TYPE,
  163. // 金币兑换权限
  164. canExchange: localStorage.getItem("canExchange") || "false",
  165. };
  166. },
  167. computed: {
  168. selectedRechargeOption() {
  169. return this.rechargeOptionsWithCustom[this.selectedRecharge] || null;
  170. },
  171. // 显示列表 = 产品列表 + 自定义
  172. rechargeOptionsWithCustom() {
  173. if (ALI_CUSTOM && this.paymentType === "alipay") {
  174. return [...(this.rechargeOptions || []), { isCustom: true }];
  175. } else {
  176. return [...(this.rechargeOptions || [])];
  177. }
  178. },
  179. // 是否选择了自定义
  180. isCustomSelected() {
  181. const selectedOption = this.rechargeOptionsWithCustom[this.selectedRecharge];
  182. return selectedOption && selectedOption.isCustom === true;
  183. }
  184. },
  185. created() {
  186. // 获取用户信息
  187. this.initUserInfo();
  188. // 获取产品列表
  189. this.fetchProductList();
  190. if (this.paymentType === "wechat") {
  191. this.listenWeixinBridge(); // 监听桥梁加载
  192. }
  193. },
  194. methods: {
  195. // 初始化用户信息
  196. async initUserInfo() {
  197. // 从路由参数获取用户信息
  198. const { id, nickname, avatar } = this.$route.query;
  199. if (this.paymentType === "wechat") {
  200. this.userCode = this.$route.query.userCode;
  201. }
  202. if (id) {
  203. // 如果路由参数中有用户ID,直接使用
  204. this.userInfo.id = id;
  205. this.userInfo.nickname = nickname || "未知用户";
  206. this.userInfo.avatar = avatar || "";
  207. } else {
  208. // 如果没有用户ID,尝试从本地存储获取
  209. // const savedUserId = localStorage.getItem('lastUserId')
  210. // if (savedUserId) {
  211. // try {
  212. // // 从API获取用户信息
  213. // const res = await getUserInfo(savedUserId)
  214. // if (res.data && res.data.userId) {
  215. // this.userInfo.id = res.data.userId
  216. // this.userInfo.nickname = res.data.userName || '未知用户'
  217. // this.userInfo.avatar = res.data.avatar || ''
  218. // } else {
  219. // this.$toast('未找到用户信息')
  220. // this.$router.replace('/')
  221. // }
  222. // } catch (error) {
  223. // console.error('获取用户信息失败:', error)
  224. // this.$toast('获取用户信息失败')
  225. // this.$router.replace('/')
  226. // }
  227. // } else {
  228. // 没有用户ID,返回搜索页面
  229. this.$toast("请先登录");
  230. this.$router.replace("/");
  231. // }
  232. }
  233. // 保存最后使用的用户ID
  234. // if (this.userInfo.id) {
  235. // localStorage.setItem("lastUserId", this.userInfo.id);
  236. // }
  237. },
  238. // 监听 weixinJSBridge 加载
  239. listenWeixinBridge() {
  240. if (window.WeixinJSBridge) {
  241. this.onWeixinBridgeReady();
  242. } else {
  243. const listener = () => this.onWeixinBridgeReady();
  244. document.addEventListener("WeixinJSBridgeReady", listener, false);
  245. }
  246. },
  247. // weixinJSBridge 加载成功回调
  248. onWeixinBridgeReady() {
  249. this.bridgeReady = true;
  250. console.log("weixinJSBridge 加载成功");
  251. },
  252. // 获取产品列表
  253. async fetchProductList() {
  254. try {
  255. const payWayId = getDevicePayWayId();
  256. const res = await getProductList(payWayId);
  257. this.rechargeOptions = res.data || [];
  258. } catch (error) {
  259. console.error("获取产品列表失败:", error);
  260. // 设置默认数据,以防接口调用失败
  261. this.rechargeOptions = [
  262. { amount: 60, price: 6 },
  263. { amount: 120, price: 6 },
  264. { amount: 300, price: 6 },
  265. { amount: 600, price: 6 },
  266. { amount: 1000, price: 6 },
  267. { amount: 2000, price: 6 },
  268. { amount: 3800, price: 6 },
  269. { amount: 5000, price: 6 },
  270. { amount: 10000, price: 6 },
  271. ];
  272. }
  273. },
  274. selectRecharge(index) {
  275. this.selectedRecharge = index;
  276. },
  277. // 切换用户
  278. switchUser() {
  279. this.$router.push("/");
  280. },
  281. // 切换协议勾选状态
  282. toggleAgreement() {
  283. this.agreementChecked = !this.agreementChecked;
  284. },
  285. // 显示协议弹框
  286. showAgreement() {
  287. this.agreementVisible = true;
  288. },
  289. confirmPay() {
  290. if (this.isLoading) return; // 防止重复点击
  291. if (!this.userInfo.id) {
  292. this.$toast("请先选择用户");
  293. return;
  294. }
  295. // 检查协议是否勾选
  296. if (!this.agreementChecked) {
  297. this.$toast("请阅读并同意充值协议");
  298. return;
  299. }
  300. // 自定义金额校验
  301. if (this.isCustomSelected) {
  302. const amountNumber = Number(this.customAmount);
  303. if (
  304. !this.customAmount ||
  305. Number.isNaN(amountNumber) ||
  306. amountNumber <= 0
  307. ) {
  308. this.$toast("请输入有效的自定义金额");
  309. return;
  310. }
  311. }
  312. const selectedOption = this.selectedRechargeOption;
  313. // 使用二次确认弹窗
  314. this.$dialog
  315. .confirm({
  316. title: "支付确认",
  317. message: `
  318. <div class="confirm-dialog-content">
  319. <div class="confirm-tip">请核实并确认ID是否正确,请提防:</div>
  320. <div class="warning-list">
  321. <div class="warning-item">刷单赚取佣金</div>
  322. <div class="warning-item">公检法要求转账到安全账户</div>
  323. <div class="warning-item">购物退款、理赔需要转账</div>
  324. <div class="warning-item">代充值</div>
  325. <div class="warning-item">支付返利活动</div>
  326. </div>
  327. </div>
  328. `,
  329. confirmButtonText: "确认支付",
  330. cancelButtonText: "取消",
  331. showCancelButton: true,
  332. showConfirmButton: true,
  333. allowHtml: true,
  334. })
  335. .then(() => {
  336. // 调用支付接口
  337. if (this.paymentType === "wechat") {
  338. this.requestWechatPay(selectedOption);
  339. } else {
  340. this.requestAliPay(selectedOption);
  341. }
  342. })
  343. .catch(() => {
  344. // 取消支付
  345. });
  346. },
  347. // 请求支付宝支付
  348. async requestAliPay(product) {
  349. // 显示加载提示
  350. this.isLoading = true;
  351. this.$toast.loading({
  352. message: "正在发起支付...",
  353. forbidClick: true,
  354. duration: 0,
  355. });
  356. try {
  357. // 获取平台类型
  358. const platform = getPlatformType();
  359. // 构建支付参数
  360. const payData = {
  361. userId: this.userInfo.id,
  362. productId: product && product.isCustom ? 1018 : product.id,
  363. };
  364. // 自定义金额时追加 amount
  365. if (product && product.isCustom) {
  366. payData.amount = Number(this.customAmount);
  367. }
  368. // 调用支付宝H5支付接口
  369. const res = await aliPayH5(payData, platform);
  370. this.$toast.clear();
  371. this.isLoading = false;
  372. // 优先尝试解析服务端 JSON 错误并提示
  373. try {
  374. if (typeof res === "string") {
  375. const trimmed = res.trim();
  376. if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
  377. const json = JSON.parse(trimmed);
  378. if (
  379. json &&
  380. typeof json === "object" &&
  381. json.code !== undefined &&
  382. json.code !== 200
  383. ) {
  384. this.$toast.fail(json.message || "支付请求失败");
  385. return;
  386. }
  387. }
  388. } else if (
  389. res &&
  390. typeof res === "object" &&
  391. res.code !== undefined &&
  392. res.code !== 200
  393. ) {
  394. this.$toast.fail(res.message || "支付请求失败");
  395. return;
  396. }
  397. } catch (e) {
  398. // 忽略解析错误,继续后续流程
  399. }
  400. // 处理HTML表单响应
  401. if (typeof res === "string" && res.includes("<form")) {
  402. // 创建一个div来放置表单
  403. const div = document.createElement("div");
  404. div.innerHTML = res;
  405. document.body.appendChild(div);
  406. // 自动提交表单
  407. setTimeout(() => {
  408. const form = div.querySelector("form");
  409. if (form) {
  410. form.submit();
  411. } else {
  412. this.$toast.fail("支付表单加载失败");
  413. }
  414. }, 100);
  415. } else {
  416. this.$toast.fail("获取支付表单失败");
  417. }
  418. } catch (error) {
  419. this.$toast.clear();
  420. this.isLoading = false;
  421. console.error("支付请求失败:", error);
  422. this.$toast.fail("支付请求失败,请重试");
  423. }
  424. },
  425. // 请求微信支付
  426. async requestWechatPay(product) {
  427. // 显示加载提示
  428. this.isLoading = true;
  429. this.$toast.loading({
  430. message: "正在发起支付...",
  431. forbidClick: true,
  432. duration: 0,
  433. });
  434. try {
  435. // 构建支付参数
  436. const payWayId = getDevicePayWayId(); // 获取设备对应的支付方式ID
  437. const payData = {
  438. productName: "一号房间",
  439. openId: localStorage.getItem("userOpenId"),
  440. userId: this.userInfo.id,
  441. productId: product.id,
  442. amount: product.price,
  443. orderNo: Date.now(),
  444. payWayId: payWayId, // 添加支付方式ID
  445. };
  446. // 调用后端支付接口
  447. const res = await wxPay(payData);
  448. this.$toast.clear();
  449. this.isLoading = false;
  450. // 处理支付结果
  451. if (res.status == 200) {
  452. try {
  453. let signData = JSON.parse(res.data.outputJSON);
  454. this.resultDataMess = signData;
  455. console.log(signData, "signData");
  456. let wxJsapiParam = signData.wxJsapiParam;
  457. if (signData.returnCode == "0000") {
  458. // 5. 调用 weixinJSBridge 支付
  459. this.invokeWeixinBridgePayment(wxJsapiParam);
  460. } else {
  461. this.$toast.fail(
  462. this.resultDataMess.returnMsg || "获取支付链接失败"
  463. );
  464. }
  465. } catch {
  466. this.$toast.fail(
  467. this.resultDataMess.returnMsg || "获取支付链接失败"
  468. );
  469. }
  470. } else {
  471. this.$toast.fail(this.resultDataMess.returnMsg || "获取支付链接失败");
  472. }
  473. } catch (error) {
  474. this.$toast.clear();
  475. this.isLoading = false;
  476. console.error("支付请求失败:", error);
  477. this.$toast.fail("支付请求失败,请重试");
  478. }
  479. },
  480. // 调用 weixinJSBridge 支付
  481. invokeWeixinBridgePayment(payParams) {
  482. window.WeixinJSBridge.invoke(
  483. "getBrandWCPayRequest",
  484. payParams,
  485. this.handleWeixinPayResult
  486. );
  487. },
  488. // 处理支付结果
  489. handleWeixinPayResult(res) {
  490. if (res.err_msg === "get_brand_wcpay_request:ok") {
  491. // 支付成功
  492. this.handlePaymentSuccess(res);
  493. } else if (res.err_msg === "get_brand_wcpay_request:cancel") {
  494. // 支付取消
  495. this.handlePaymentCancel();
  496. } else {
  497. // 支付失败
  498. this.handlePaymentFailure(res);
  499. }
  500. },
  501. // 处理支付成功
  502. handlePaymentSuccess() {
  503. console.log("支付成功");
  504. this.$toast.success("支付成功");
  505. window.location.href = "https://gbyy91.com/pay";
  506. },
  507. // 处理支付失败
  508. handlePaymentFailure(message) {
  509. console.error("支付失败:", message);
  510. this.$toast.fail(message || "支付失败,请重试");
  511. },
  512. // 处理支付取消
  513. handlePaymentCancel() {
  514. console.log("用户取消支付");
  515. this.$toast("支付已取消");
  516. },
  517. // 金币兑换
  518. goToCoinExchange() {
  519. this.$router.push("/coin-exchange");
  520. },
  521. // 退出登录
  522. logout() {
  523. // 清除本地存储的用户信息
  524. // localStorage.removeItem("lastUserId");
  525. localStorage.removeItem("userId");
  526. localStorage.removeItem("userName");
  527. localStorage.removeItem("avatar");
  528. localStorage.removeItem("token");
  529. localStorage.removeItem("integral");
  530. localStorage.removeItem("canExchange");
  531. // 跳转到搜索页面
  532. this.$router.push("/");
  533. },
  534. },
  535. };
  536. </script>
  537. <style scoped>
  538. .recharge-page {
  539. min-height: 100vh;
  540. display: flex;
  541. flex-direction: column;
  542. background-color: #f5f7fa;
  543. padding-bottom: 10px;
  544. position: relative;
  545. overflow: hidden;
  546. }
  547. /* 顶部标题样式 */
  548. .page-header {
  549. padding: 5px 16px 0;
  550. display: flex;
  551. align-items: center;
  552. margin-bottom: 0;
  553. }
  554. .header-content {
  555. display: flex;
  556. align-items: center;
  557. width: 100%;
  558. }
  559. .logo-wrapper {
  560. display: flex;
  561. align-items: center;
  562. justify-content: flex-start;
  563. width: 100%;
  564. }
  565. .logo-container {
  566. display: flex;
  567. align-items: center;
  568. justify-content: flex-start;
  569. }
  570. .logo-image {
  571. width: 90px;
  572. height: 60px;
  573. object-fit: contain;
  574. }
  575. /* 页面标题样式 */
  576. .page-title {
  577. text-align: center;
  578. margin-bottom: 5px;
  579. }
  580. .page-title h1 {
  581. font-size: 18px;
  582. font-weight: 600;
  583. color: #333;
  584. margin: 0;
  585. }
  586. /* 用户信息样式 */
  587. .user-info-section {
  588. padding: 0 8px;
  589. margin-top: 0;
  590. margin-bottom: 5px;
  591. }
  592. .user-info-card {
  593. background-color: #fff;
  594. border-radius: 12px;
  595. padding: 8px;
  596. display: flex;
  597. align-items: center;
  598. position: relative;
  599. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  600. }
  601. .user-avatar {
  602. margin-right: 10px;
  603. position: relative;
  604. }
  605. .avatar,
  606. .avatar-placeholder {
  607. width: 40px;
  608. height: 40px;
  609. border-radius: 50%;
  610. overflow: hidden;
  611. background-color: #f2f2f2;
  612. display: flex;
  613. align-items: center;
  614. justify-content: center;
  615. border: 2px solid #f5eeff;
  616. }
  617. .user-details {
  618. flex: 1;
  619. }
  620. .user-name {
  621. font-size: 14px;
  622. font-weight: 600;
  623. margin-bottom: 4px;
  624. color: #333;
  625. }
  626. .user-id {
  627. font-size: 12px;
  628. color: #666;
  629. display: flex;
  630. align-items: center;
  631. background-color: #f5f5f5;
  632. padding: 2px 8px;
  633. border-radius: 12px;
  634. display: inline-flex;
  635. }
  636. .id-icon {
  637. width: 14px;
  638. height: 14px;
  639. margin-right: 4px;
  640. }
  641. .switch-account-btn {
  642. background-color: #b66fff;
  643. color: white;
  644. padding: 6px 12px;
  645. border-radius: 16px;
  646. font-size: 12px;
  647. position: absolute;
  648. right: 12px;
  649. cursor: pointer;
  650. box-shadow: 0 2px 6px rgba(182, 111, 255, 0.3);
  651. }
  652. /* 操作按钮样式 */
  653. .action-buttons {
  654. display: flex;
  655. gap: 8px;
  656. margin-left: 8px;
  657. }
  658. /* 充值金额样式 */
  659. .recharge-section {
  660. padding: 0 8px;
  661. margin-bottom: 5px;
  662. }
  663. .section-title {
  664. font-size: 14px;
  665. font-weight: bold;
  666. margin-bottom: 5px;
  667. color: #333;
  668. }
  669. .recharge-grid {
  670. display: grid;
  671. grid-template-columns: repeat(3, 1fr);
  672. gap: 10px;
  673. padding: 0 2px;
  674. }
  675. .recharge-item {
  676. background-color: #f0f0f0;
  677. border-radius: 8px;
  678. padding: 8px 8px;
  679. display: flex;
  680. flex-direction: column;
  681. align-items: center;
  682. cursor: pointer;
  683. transition: all 0.2s ease;
  684. border: 1px solid #dddddd;
  685. position: relative;
  686. overflow: hidden;
  687. }
  688. .recharge-item.active {
  689. background-color: #f5eeff;
  690. border: 1px solid #b66fff;
  691. transform: scale(1.02);
  692. box-shadow: 0 2px 8px rgba(182, 111, 255, 0.2);
  693. }
  694. .recharge-item.active:before {
  695. content: "";
  696. position: absolute;
  697. top: 0;
  698. right: 0;
  699. width: 0;
  700. height: 0;
  701. border-style: solid;
  702. border-width: 0 20px 20px 0;
  703. border-color: transparent #b66fff transparent transparent;
  704. }
  705. .recharge-item.active:after {
  706. content: "✓";
  707. position: absolute;
  708. top: 0;
  709. right: 3px;
  710. color: white;
  711. font-size: 10px;
  712. font-weight: bold;
  713. }
  714. .diamond-icon {
  715. margin-bottom: 3px;
  716. }
  717. .diamond-img {
  718. width: 20px;
  719. height: 20px;
  720. object-fit: contain;
  721. }
  722. .recharge-amount {
  723. font-size: 14px;
  724. font-weight: bold;
  725. margin-bottom: 1px;
  726. }
  727. .recharge-price {
  728. font-size: 12px;
  729. color: #666;
  730. }
  731. .custom-input {
  732. margin-top: 8px;
  733. padding: 0 2px;
  734. }
  735. /* 支付方式样式 */
  736. .payment-section {
  737. padding: 0 8px;
  738. margin-bottom: 5px;
  739. background-color: #fff;
  740. border-radius: 12px;
  741. margin: 8px;
  742. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  743. }
  744. .payment-option {
  745. display: flex;
  746. align-items: center;
  747. padding: 8px;
  748. border-bottom: 1px solid #eaeaea;
  749. }
  750. .payment-icon {
  751. margin-right: 12px;
  752. }
  753. .alipay-icon,
  754. .wechat-icon {
  755. width: 28px;
  756. height: 28px;
  757. object-fit: contain;
  758. }
  759. .payment-name {
  760. flex: 1;
  761. font-size: 14px;
  762. font-weight: 500;
  763. color: #333;
  764. }
  765. .payment-selected {
  766. display: flex;
  767. align-items: center;
  768. justify-content: center;
  769. }
  770. .check-icon {
  771. width: 20px;
  772. height: 20px;
  773. object-fit: contain;
  774. }
  775. /* 温馨提示样式 */
  776. .tips-section {
  777. padding: 8px 12px;
  778. margin: 0 8px 5px;
  779. background-color: #f8f8f8;
  780. border-radius: 12px;
  781. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  782. }
  783. .tips-title {
  784. font-size: 14px;
  785. font-weight: 600;
  786. color: #333;
  787. margin-bottom: 5px;
  788. }
  789. .tips-content {
  790. margin-bottom: 4px;
  791. }
  792. .tip-item {
  793. font-size: 12px;
  794. color: #666;
  795. margin-bottom: 6px;
  796. line-height: 1.5;
  797. }
  798. .tip-item:last-child {
  799. margin-bottom: 0;
  800. }
  801. .agreement-checkbox {
  802. display: flex;
  803. align-items: center;
  804. margin-top: 5px;
  805. cursor: pointer;
  806. }
  807. .checkbox-wrapper {
  808. width: 16px;
  809. height: 16px;
  810. border: 1px solid #ddd;
  811. border-radius: 3px;
  812. margin-right: 6px;
  813. display: flex;
  814. align-items: center;
  815. justify-content: center;
  816. }
  817. .checkbox-wrapper.checked {
  818. background-color: #b66fff;
  819. border-color: #b66fff;
  820. }
  821. .agreement-text {
  822. font-size: 12px;
  823. color: #666;
  824. }
  825. .agreement-link {
  826. color: #b66fff;
  827. text-decoration: none;
  828. }
  829. /* 协议弹框样式 */
  830. .agreement-content {
  831. padding: 10px;
  832. height: 60vh;
  833. overflow: hidden;
  834. }
  835. .agreement-iframe {
  836. width: 100%;
  837. height: 100%;
  838. border: none;
  839. }
  840. /* 支付按钮样式 */
  841. .pay-button {
  842. padding: 0 8px;
  843. margin-top: 8px;
  844. margin-bottom: 5px;
  845. }
  846. .pay-button .van-button {
  847. background-color: #b66fff;
  848. border: none;
  849. height: 38px;
  850. font-size: 15px;
  851. font-weight: 500;
  852. box-shadow: 0 4px 12px rgba(182, 111, 255, 0.3);
  853. }
  854. /* 二次确认弹窗样式 */
  855. :deep(.custom-dialog1) {
  856. width: 90%;
  857. max-width: 300px;
  858. border-radius: 12px;
  859. overflow: hidden;
  860. }
  861. :deep(.custom-dialog .van-dialog__header) {
  862. padding: 15px 0;
  863. font-weight: 600;
  864. font-size: 16px;
  865. color: #333;
  866. }
  867. :deep(.custom-dialog .van-dialog__content) {
  868. padding: 10px 20px 15px;
  869. max-height: none;
  870. overflow: visible;
  871. }
  872. :deep(.confirm-dialog-content) {
  873. display: flex;
  874. flex-direction: column;
  875. align-items: center;
  876. text-align: center;
  877. }
  878. :deep(.confirm-price) {
  879. font-size: 24px;
  880. font-weight: bold;
  881. color: #333;
  882. margin-bottom: 10px;
  883. }
  884. :deep(.confirm-tip) {
  885. font-size: 14px;
  886. color: #333;
  887. font-weight: 500;
  888. margin-bottom: 3px;
  889. text-align: left;
  890. align-self: flex-start;
  891. }
  892. :deep(.warning-list) {
  893. width: 100%;
  894. text-align: left;
  895. margin-top: 0;
  896. }
  897. :deep(.warning-item) {
  898. font-size: 13px;
  899. color: #666;
  900. margin-bottom: 4px;
  901. position: relative;
  902. padding-left: 12px;
  903. }
  904. :deep(.warning-item:before) {
  905. content: "•";
  906. position: absolute;
  907. left: 0;
  908. color: #666;
  909. }
  910. :deep(.warning-item:last-child) {
  911. margin-bottom: 0;
  912. }
  913. :deep(.custom-dialog .van-dialog__footer) {
  914. display: flex;
  915. border-top: 1px solid #eee;
  916. }
  917. :deep(.custom-dialog .van-button) {
  918. flex: 1;
  919. height: 44px;
  920. font-size: 16px;
  921. border: none;
  922. border-radius: 0;
  923. margin: 0;
  924. }
  925. :deep(.custom-dialog .van-dialog__cancel) {
  926. color: #333;
  927. }
  928. :deep(.custom-dialog .van-dialog__confirm) {
  929. color: #f44336;
  930. font-weight: normal;
  931. }
  932. </style>