index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <template>
  2. <div>
  3. <div v-if="dialogInfoTradingAdd" class="crm_verified_info_mask" @click="close"></div>
  4. <div id="TradingDetailedInfoAdd" class="InfoBox" :class="{ active: dialogInfoTradingAdd }">
  5. <div class="header">
  6. <div>
  7. <span class="title">{{ $t('Ucard.KycAuth.b2') }}</span>
  8. </div>
  9. <span class="close crm-cursor" @click="close"
  10. ><el-icon><Close /></el-icon
  11. ></span>
  12. </div>
  13. <el-form ref="formRef" :rules="rules" :model="form" label-width="120PX">
  14. <el-form-item :label="$t('Ucard.KycAuth.item8') + ':'">
  15. <el-input v-model="form.cId" disabled placeholder=""></el-input>
  16. </el-form-item>
  17. <el-form-item :label="$t('Ucard.KycAuth.item9') + ':'">
  18. <el-input
  19. v-model="form.lastName"
  20. disabled
  21. placeholder="姓"
  22. style="width: 45%; display: inline-block"
  23. ></el-input>
  24. <el-input
  25. v-model="form.firstName"
  26. disabled
  27. placeholder="名"
  28. style="width: 45%; display: inline-block; margin-left: 10px"
  29. ></el-input>
  30. </el-form-item>
  31. <el-form-item :label="$t('Ucard.KycAuth.item10') + ':'">
  32. <el-input v-model="form.email" disabled placeholder=""></el-input>
  33. </el-form-item>
  34. <el-form-item :label="$t('Ucard.KycAuth.item11') + ':'">
  35. <el-input v-model="form.mobile" disabled placeholder=""></el-input>
  36. </el-form-item>
  37. <!-- <el-form-item prop="uniqueId" :label="$t('Ucard.KycAuth.item7') + ':'">
  38. <el-input
  39. disabled
  40. size="small"
  41. v-model="form.uniqueId"
  42. :placeholder="$t('Placeholder.Input')"
  43. ></el-input>
  44. </el-form-item> -->
  45. <el-form-item prop="cardTypeId" :label="$t('Ucard.KycAuth.item1') + ':'">
  46. <el-select v-model="form.cardTypeId" size="small" :placeholder="$t('Placeholder.Choose')">
  47. <el-option
  48. v-for="(item, index) in currencyList"
  49. :key="index"
  50. :value="item.cardTypeId"
  51. :label="item.cardName"
  52. ></el-option>
  53. </el-select>
  54. </el-form-item>
  55. </el-form>
  56. <span class="btn crm-cursor" @click="confirm"
  57. ><span>{{ $t('Btn.Confirm') }}</span></span
  58. >
  59. </div>
  60. </div>
  61. </template>
  62. <script setup>
  63. import { ref, reactive, watch, computed, inject } from 'vue'
  64. import Config from '@/config/index'
  65. import Service from '@/service/ucard'
  66. import { useI18n } from 'vue-i18n'
  67. const { t } = useI18n()
  68. const { Code } = Config
  69. const pigeon = inject('pigeon')
  70. const Session = inject('session')
  71. // Props
  72. const props = defineProps({
  73. dialogInfoTradingAdd: {
  74. type: Boolean,
  75. default: false,
  76. },
  77. addType: {
  78. default: '',
  79. },
  80. editor: {
  81. default: '',
  82. },
  83. myInfo: {
  84. default: '',
  85. },
  86. formList: {
  87. default: '',
  88. },
  89. })
  90. // Emits
  91. const emit = defineEmits(['closeAdd', 'confirmToReload'])
  92. // Refs
  93. const formRef = ref(null)
  94. const loading = ref(false)
  95. const currencyList = ref([])
  96. const isOk = ref(false)
  97. // Reactive data
  98. const form = reactive({})
  99. const pagerInfo = reactive({ row: 10, current: 1, pageTotal: 0, rowTotal: 0 })
  100. const received = reactive({ receivedCurrency: '', receivedAmount: '', exchangeRate: '' })
  101. // Rules
  102. const rules = reactive({
  103. uniqueId: [
  104. {
  105. required: true,
  106. message: t('Placeholder.Input'),
  107. trigger: 'blur',
  108. },
  109. ],
  110. cardTypeId: [
  111. {
  112. required: true,
  113. message: t('Placeholder.Input'),
  114. trigger: 'blur',
  115. },
  116. ],
  117. })
  118. // Computed
  119. const AccessToken = computed(() => {
  120. return {
  121. 'Access-Token': Session.Get('access_token'),
  122. }
  123. })
  124. // Methods
  125. // 提交KYC认证
  126. const kycSubmit = async () => {
  127. loading.value = true
  128. try {
  129. let res = await Service.kycSubmit(form)
  130. if (res.code == Code.StatusOK) {
  131. pigeon.MessageOK(t('Msg.SearchSuccess'))
  132. searchFunc()
  133. } else {
  134. pigeon.MessageError(res.msg)
  135. }
  136. } finally {
  137. loading.value = false
  138. }
  139. }
  140. // 获取卡片类型列表
  141. const cardTypesList = async () => {
  142. let res = await Service.cardTypesList({
  143. page: {
  144. current: pagerInfo.current,
  145. row: pagerInfo.row,
  146. },
  147. })
  148. if (res.code == Code.StatusOK) {
  149. currencyList.value = res.data
  150. } else {
  151. pigeon.MessageError(res.msg)
  152. }
  153. }
  154. //关闭
  155. const close = () => {
  156. emit('closeAdd', false)
  157. }
  158. //提交成功后回调
  159. const confirmToReload = () => {
  160. emit('confirmToReload', true)
  161. }
  162. //提交
  163. const confirm = () => {
  164. formRef.value.validate((valid) => {
  165. if (valid) {
  166. kycSubmit()
  167. } else {
  168. return false
  169. }
  170. })
  171. }
  172. const searchFunc = () => {
  173. // 这里需要根据实际情况实现搜索功能
  174. }
  175. // Watchers
  176. watch(
  177. () => props.formList,
  178. (form) => {
  179. Object.assign(form, {
  180. uniqueId: form.uniqueId || form.cId || '',
  181. lastName: form.lastName || '',
  182. firstName: form.firstName || '',
  183. email: form.email || '',
  184. mobile: form.mobile || form.phone || '',
  185. signaturePhoto: '',
  186. currency: '',
  187. activePhoto: '',
  188. })
  189. }
  190. )
  191. watch(
  192. () => props.addType,
  193. () => {
  194. cardTypesList()
  195. }
  196. )
  197. </script>
  198. <style lang="scss" scoped>
  199. .crm_verified_info_mask {
  200. position: fixed;
  201. z-index: 9999 !important;
  202. top: 0;
  203. left: 0;
  204. width: 100vw;
  205. height: 100vh;
  206. background: rgba(0, 0, 0, 0.3);
  207. }
  208. .InfoBox {
  209. width: 450px;
  210. height: 100%;
  211. padding: 15px 0;
  212. border-radius: 2px;
  213. box-sizing: border-box;
  214. box-shadow: 0px 3px 5px 0px rgba(49, 49, 49, 0.35);
  215. position: fixed;
  216. background-color: #ffffff;
  217. z-index: 10000 !important;
  218. overflow: hidden;
  219. overflow-y: auto;
  220. top: 0;
  221. right: -455px;
  222. transition: all 0.6s;
  223. }
  224. .InfoBox.active {
  225. right: 0;
  226. }
  227. .imgs {
  228. width: 100%;
  229. height: 100%;
  230. position: relative;
  231. .el-upload-list__item-actions {
  232. width: 100%;
  233. height: 100%;
  234. position: absolute;
  235. top: 0;
  236. left: 0;
  237. }
  238. }
  239. </style>