pointsAndBalance.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <div class="resume-box">
  3. <div class="resume-header" v-if="showTitle">
  4. <div class="resume-title">余额充值</div>
  5. </div>
  6. <div class="d-flex align-center justify-center mb-10 mt-5">
  7. <div
  8. v-for="(item, index) in list"
  9. :key="index"
  10. class="packagesItem cursor-pointer mx-3"
  11. :class="{'active': current === (index+1)}"
  12. style="width: 200px;"
  13. @click="current = index + 1; price = item.price"
  14. >
  15. <div class="d-flex flex-column align-center pb-5" style="position: relative;">
  16. <div class="my-4 font-size-16 font-weight-bold titleColor">{{ item.title }}</div>
  17. <div class="font-weight-bold priceBox">
  18. <span v-if="item.custom">
  19. <input
  20. v-model="item.price"
  21. type="text"
  22. class="custom-input-num"
  23. :style="{'color': current === (index + 1) ? '#ff4747' : '#000'}"
  24. @keyup.enter="handleCustomEnter"
  25. @focus="item.tip = '输入完成后请按Enter键确认'"
  26. >
  27. </span>
  28. <span class="font28" v-else>{{ item.price }}</span>
  29. </div>
  30. <div class="dailyPrice font-size-12 mt-3">
  31. <span v-if="!item.custom">¥{{ item.price }}</span>
  32. <span v-else>{{ item.tip }}</span>
  33. </div>
  34. <div class="vip">
  35. <svg-icon v-if="current === (index+1)" name="diamond-active" size="50"></svg-icon>
  36. <svg-icon v-else name="diamond" size="50"></svg-icon>
  37. </div>
  38. </div>
  39. </div>
  40. </div>
  41. <div class="code pa-5 resume-box">
  42. <div class="resume-header">
  43. <div class="resume-title">扫码支付</div>
  44. </div>
  45. <div class="d-flex align-end mt-3">
  46. <div class="code-left">
  47. <QrCode text="二维码内容二维码内容二维码内容二维码内容" :width="170" />
  48. </div>
  49. <div class="code-right ml-5">
  50. <div class="price">
  51. <span class="font-size-13">¥</span>
  52. {{ price }}
  53. </div>
  54. <div class="mt-3 d-flex align-center">
  55. <span class="color-666 font-weight-bold mr-5">支付方式</span>
  56. <v-chip-group v-model="payment" selected-class="text-primary" mandatory>
  57. <v-chip filter v-for="k in paymentList" :key="k.value" :value="k.value" class="mr-3" label>
  58. {{ k.label }}
  59. <svg-icon class="ml-1" :name="k.icon" :size="k.size"></svg-icon>
  60. </v-chip>
  61. </v-chip-group>
  62. </div>
  63. <div class="font-size-14 color-666 mt-3 cursor-pointer">
  64. 服务协议
  65. <span class="septal-line"></span>
  66. <span @click="show = true">对公支付</span>
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. </div>
  72. <CtDialog :visible="show" :widthType="2" :footer="false" titleClass="text-h6" title="对公账户信息" @close="show = false">
  73. <Public v-if="show" :price="price"></Public>
  74. </CtDialog>
  75. </template>
  76. <script setup>
  77. defineOptions({ name: 'myAccount-pointsAndBalance'})
  78. import { ref } from 'vue'
  79. import Public from './public.vue'
  80. import QrCode from '@/components/QrCode'
  81. defineProps({
  82. showTitle: {
  83. type: Boolean,
  84. default: false
  85. }
  86. })
  87. const show = ref(false)
  88. const current = ref(1)
  89. const price = ref(200)
  90. const list = ref([
  91. { title: '余额200元', price: 200 },
  92. { title: '余额800元', price: 800 },
  93. { title: '余额1000元', price: 1000 },
  94. { title: '余额1200元', price: 1200 },
  95. { title: '自定义充值', price: 100, custom: true, tip: '输入完成后请按Enter键确认' }
  96. ])
  97. const payment = ref('wx_native')
  98. const paymentList = [
  99. { label: '微信扫码', icon: 'weChat', size: 21, color: 'success', value: 'wx_native' },
  100. { label: '支付宝扫码', icon: 'alipay', size: 23, color: '#3383c6', value: 'alipay_qr' }
  101. ]
  102. const handleCustomEnter = (e) => {
  103. const num = e.target.value
  104. const custom = list.value.find(k => k.custom)
  105. if (num < 100) {
  106. custom.tip = '最低充值金额为100元'
  107. custom.price = 100
  108. return
  109. }
  110. price.value = num
  111. }
  112. </script>
  113. <style scoped lang="scss">
  114. .packagesItem {
  115. border: 1px solid var(--color-f3);
  116. border-radius: 8px;
  117. background-color: var(--color-f2f4f742);
  118. }
  119. .dailyPrice {
  120. border-radius: 14px;
  121. background-color: #dde3e94f;
  122. padding: 2px 18px;
  123. color: var(--color-666);
  124. }
  125. .active {
  126. border: 2px solid #cf990c;
  127. background: linear-gradient(rgb(255, 242, 214) 8.86%, rgb(255, 225, 177) 100%);;
  128. .priceBox {
  129. color: var(--v-error-base);
  130. }
  131. .dailyPrice {
  132. color: var(--v-error-base);
  133. background-color: #fff4e7;
  134. }
  135. }
  136. .custom-input-num {
  137. border: none;
  138. outline: none;
  139. background-color: transparent;
  140. max-width: 100%;
  141. text-align: center;
  142. font-weight: 700;
  143. }
  144. .code {
  145. max-width: 1100px;
  146. background-color: #f7f8fa;
  147. border-radius: 6px;
  148. margin: 0 auto;
  149. &-left {
  150. border: 1px solid #00897B;
  151. border-radius: 6px;
  152. padding: 5px;
  153. }
  154. &-right {
  155. .price {
  156. font-size: 30px;
  157. font-weight: 700;
  158. color: var(--v-error-base);
  159. }
  160. }
  161. }
  162. .vip {
  163. width: 50px;
  164. height: 50px;
  165. position: absolute;
  166. top: 0;
  167. right: 0;
  168. overflow: hidden;
  169. border-radius: 8px
  170. }
  171. :deep(.v-slide-group__content) {
  172. background: none !important;
  173. }
  174. </style>