pointsAndBalance.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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-5 font-size-16 font-weight-bold titleColor">{{ item.name }}</div>
  17. <div class="font-weight-bold priceBox mt-3">
  18. <span v-if="item.custom">
  19. <input
  20. v-model="item.payPrice"
  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>¥{{ payCalculation(item.payPrice, 'realPay') }}</span>
  29. </div>
  30. <!-- <div class="dailyPrice font-size-12 mt-3">
  31. <span v-if="!item.custom">¥{{ calcFun(item.payPrice, true) }}</span>
  32. <span v-else>{{ item.tip }}</span>
  33. </div> -->
  34. <!-- <span class="mt-3" @click="handleRecharge(item)">立即充值</span> -->
  35. <v-btn class="mt-8" size="small" color="error" variant="outlined" rounded @click="handleRecharge(item)">立即充值</v-btn>
  36. <div class="vip">
  37. <!-- <svg-icon v-if="current === (index+1)" name="diamond-active" size="50"></svg-icon>
  38. <svg-icon v-else name="diamond" size="50"></svg-icon> -->
  39. <svg-icon name="diamond" size="50"></svg-icon>
  40. </div>
  41. </div>
  42. </div>
  43. </div>
  44. <!-- <div class="code pa-5 resume-box">
  45. <div class="resume-header">
  46. <div class="resume-title">扫码支付</div>
  47. </div>
  48. <div class="d-flex align-end mt-3">
  49. <div class="code-left">
  50. <QrCode text="二维码内容二维码内容二维码内容二维码内容" :width="170" />
  51. </div>
  52. <div class="code-right ml-5">
  53. <div class="price">
  54. <span class="font-size-13">¥</span>
  55. {{ price }}
  56. </div>
  57. <div class="mt-3 d-flex align-center">
  58. <span class="color-666 font-weight-bold mr-5">支付方式</span>
  59. <v-chip-group v-model="payment" selected-class="text-primary" mandatory>
  60. <v-chip filter v-for="k in paymentList" :key="k.value" :value="k.value" class="mr-3" label>
  61. {{ k.label }}
  62. <svg-icon class="ml-1" :name="k.icon" :size="k.size"></svg-icon>
  63. </v-chip>
  64. </v-chip-group>
  65. </div>
  66. <div class="font-size-14 color-666 mt-3 cursor-pointer">
  67. 服务协议
  68. <span class="septal-line"></span>
  69. <span @click="show = true">对公支付</span>
  70. </div>
  71. </div>
  72. </div>
  73. </div> -->
  74. </div>
  75. <CtDialog :visible="show" :widthType="2" :footer="false" titleClass="text-h6" title="对公账户信息" @close="show = false">
  76. <Public v-if="show" :price="price"></Public>
  77. </CtDialog>
  78. <confirmPaymentDialog
  79. v-if="showConfirmPaymentDialog"
  80. :appId="11"
  81. :cost="payCalculation(rechargeDataItem.payPrice, 'realPay')"
  82. :rechargeInfo="rechargeDataItem"
  83. @paySuccess="paySuccess"
  84. @close="showConfirmPaymentDialog = false"
  85. ></confirmPaymentDialog>
  86. </template>
  87. <script setup>
  88. defineOptions({ name: 'myAccount-pointsAndBalance'})
  89. import { ref } from 'vue'
  90. import Public from './public.vue'
  91. // import QrCode from '@/components/QrCode'
  92. import { getEnterpriseRechargePackageList } from '@/api/recruit/enterprise/member/points'
  93. import { payCalculation } from '@/utils/position'
  94. defineProps({
  95. showTitle: {
  96. type: Boolean,
  97. default: false
  98. }
  99. })
  100. const show = ref(false)
  101. const current = ref(1)
  102. const price = ref(200)
  103. const list = ref([])
  104. // const payment = ref('wx_native')
  105. // const paymentList = [
  106. // { label: '微信扫码', icon: 'weChat', size: 21, color: 'success', value: 'wx_native' },
  107. // { label: '支付宝扫码', icon: 'alipay', size: 23, color: '#3383c6', value: 'alipay_qr' }
  108. // ]
  109. const handleCustomEnter = (e) => {
  110. const num = e.target.value
  111. const custom = list.value.find(k => k.custom)
  112. if (num < 100) {
  113. custom.tip = '最低充值金额为100元'
  114. custom.price = 100
  115. return
  116. }
  117. price.value = num
  118. }
  119. const getData = async () => {
  120. // const params = {}
  121. const data = await getEnterpriseRechargePackageList()
  122. list.value = data || []
  123. // const end = { name: '自定义充值', payPrice: 100, custom: true, tip: '输入完成后请按Enter键确认' }
  124. // list.value = data ? [...data, end] : [end]
  125. }
  126. getData()
  127. // 支付弹窗
  128. const rechargeDataItem = ref(null)
  129. const showConfirmPaymentDialog = ref(false)
  130. const handleRecharge = (item) => {
  131. rechargeDataItem.value = { ...item }
  132. // 打开支付弹窗
  133. showConfirmPaymentDialog.value = true
  134. }
  135. // 支付成功
  136. import { useUserStore } from '@/store/user'; const store = useUserStore()
  137. const paySuccess = async () => {
  138. showConfirmPaymentDialog.value = false
  139. await store.getEnterpriseUserAccountInfo()
  140. }
  141. </script>
  142. <style scoped lang="scss">
  143. .packagesItem {
  144. border: 1px solid var(--color-f3);
  145. border-radius: 8px;
  146. background-color: var(--color-f2f4f742);
  147. }
  148. .dailyPrice {
  149. border-radius: 14px;
  150. background-color: #dde3e94f;
  151. padding: 2px 18px;
  152. color: var(--color-666);
  153. }
  154. .active {
  155. // border: 2px solid #cf990c;
  156. // background: linear-gradient(rgb(255, 242, 214) 8.86%, rgb(255, 225, 177) 100%);;
  157. // .priceBox {
  158. // color: var(--v-error-base);
  159. // }
  160. // .dailyPrice {
  161. // color: var(--v-error-base);
  162. // background-color: #fff4e7;
  163. // }
  164. }
  165. .custom-input-num {
  166. border: none;
  167. outline: none;
  168. background-color: transparent;
  169. max-width: 100%;
  170. text-align: center;
  171. font-weight: 700;
  172. }
  173. .code {
  174. max-width: 1100px;
  175. background-color: #f7f8fa;
  176. border-radius: 6px;
  177. margin: 0 auto;
  178. &-left {
  179. border: 1px solid #00897B;
  180. border-radius: 6px;
  181. padding: 5px;
  182. }
  183. &-right {
  184. .price {
  185. font-size: 30px;
  186. font-weight: 700;
  187. color: var(--v-error-base);
  188. }
  189. }
  190. }
  191. .vip {
  192. width: 50px;
  193. height: 50px;
  194. position: absolute;
  195. top: 0;
  196. right: 0;
  197. overflow: hidden;
  198. border-radius: 8px
  199. }
  200. :deep(.v-slide-group__content) {
  201. background: none !important;
  202. }
  203. </style>