customer.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <template>
  2. <cwg-page-wrapper class="create-page" :isHeaderFixed="true">
  3. <cwg-header :title="t('Home.page_ib.item2')" />
  4. <view class="info-card">
  5. <view class="search-content">
  6. <view class="search-bar">
  7. <uni-easyinput v-model="search.cId" placeholder="CID" />
  8. <uni-easyinput v-model="search.name" :placeholder="t('Ib.Custom.NameLabel')" />
  9. <uni-easyinput v-model="search.email" :placeholder="t('Label.Email')" />
  10. </view>
  11. <view class="search-tabs">
  12. <view class="crm-cursor tab-item" :class="{ active: search.belongsType == 1 }" @click="chooseBelongsType(1)"
  13. >
  14. {{ t('Ib.Custom.Unverified') }}
  15. <view
  16. v-if="statistics.unverifiedNum !== undefined"
  17. class="count-badge"
  18. >({{ statistics.unverifiedNum }})
  19. </view>
  20. </view>
  21. <view
  22. class="crm-cursor tab-item"
  23. :class="{ active: search.belongsType == 2 }"
  24. @click="chooseBelongsType(2)"
  25. >
  26. {{ t('Ib.Custom.UnDeposit') }}
  27. <view
  28. v-if="statistics.unDepositNum !== undefined"
  29. class="count-badge"
  30. >({{ statistics.unDepositNum }})
  31. </view
  32. >
  33. </view>
  34. <view
  35. class="crm-cursor tab-item"
  36. :class="{ active: search.belongsType == 3 }"
  37. @click="chooseBelongsType(3)"
  38. >
  39. {{ t('Ib.Custom.Deposited') }}
  40. <view
  41. v-if="statistics.depositNum !== undefined"
  42. class="count-badge"
  43. >({{ statistics.depositNum }})
  44. </view
  45. >
  46. </view>
  47. </view>
  48. </view>
  49. <cwg-tabel
  50. ref="tableRef"
  51. :columns="columns"
  52. :mobilePrimaryFields="mobilePrimaryFields"
  53. :queryParams="search"
  54. :api="listApi"
  55. :show-operation="true"
  56. :showPagination="true"
  57. >
  58. <template #action="{ row }">
  59. <cwg-dropdown :menu-list="menuList(row)" @menuClick="handleMenuClick">
  60. <view class="pc-header-btn">
  61. <cwg-icon name="crm-ellipsis" :size="24" />
  62. </view>
  63. </cwg-dropdown>
  64. </template>
  65. </cwg-tabel>
  66. <!-- 跟单全局设置 -->
  67. <DocumentaryDialog :visible="docVisible" :detail="formInfoRow" @close="closeDoc" @confirm="confirmDoc" />
  68. <!-- 开户调整 -->
  69. <PointDialog :visible="pointVisible" :detail="pointForm" @close="closePoint" @confirm="confirmPoint" />
  70. <ApplyIbDialog :visible="applyVisible" :tableData="pointForm" @close="closePoint" @confirm="confirmPoint" />
  71. </view>
  72. </cwg-page-wrapper>
  73. </template>
  74. <script setup lang="ts">
  75. import { computed, ref, onMounted } from 'vue'
  76. import { useI18n } from 'vue-i18n'
  77. import Config from '@/config/index'
  78. const { t, locale } = useI18n()
  79. import { customApi } from '@/service/custom'
  80. import { lang } from '@/composables/config'
  81. import { ibApi } from '@/service/ib'
  82. import DocumentaryDialog from '@/pages/ib/components/documentaryDialog.vue'
  83. import PointDialog from '@/pages/ib/components/pointDialog.vue'
  84. import ApplyIbDialog from '@/pages/ib/components/applyIbDialog.vue'
  85. const { Code } = Config
  86. const statistics = ref({
  87. unverifiedNum: 0,
  88. unDepositNum: 0,
  89. depositNum: 0,
  90. })
  91. const search = ref({
  92. 'name': '',
  93. 'email': '',
  94. 'cId': '',
  95. // 1:未实名 2:未入金 3:已入金
  96. belongsType: null,
  97. })
  98. const formInfoRow = ref({})
  99. const pointForm = ref({})
  100. const applyTable = ref([])
  101. const docVisible = ref(false)
  102. const pointVisible = ref(false)
  103. const applyVisible = ref(false)
  104. const tableRef = ref(null)
  105. // 表格列配置
  106. const columns = ref([
  107. {
  108. prop: 'cId',
  109. label: t('Label.CidAccount'),
  110. align: 'center',
  111. },
  112. {
  113. prop: 'name',
  114. label: t('Ib.Custom.NameLabel'),
  115. align: 'center',
  116. },
  117. {
  118. prop: 'email',
  119. label: t('Label.Email'),
  120. align: 'center',
  121. },
  122. {
  123. prop: 'countryEnName',
  124. label: t('Label.Nationality'),
  125. align: 'center',
  126. width: lang ? 110 : 0,
  127. },
  128. {
  129. prop: 'addTime',
  130. label: t('Label.RegistrationTime'),
  131. align: 'center',
  132. width: lang ? 110 : 0,
  133. },
  134. {
  135. prop: 'belongsType',
  136. label: t('Ib.Custom.CustomerStatus'),
  137. align: 'center',
  138. formatter: ({ row }) => row.belongsType == 1 ? t('Ib.Custom.Unverified') :
  139. row.belongsType == 2 ? t('Ib.Custom.UnDeposit') :
  140. row.belongsType == 3 ? t('Ib.Custom.Deposited') : '--',
  141. },
  142. {
  143. prop: 'ibStatus',
  144. label: t('Ib.Custom.ApplyAgent'),
  145. align: 'center',
  146. formatter: ({ row }) => row.ibStatus == 2 ? t('Ib.Custom.Yes') : t('Ib.Custom.No'),
  147. },
  148. {
  149. prop: 'action',
  150. label: t('Label.Action'),
  151. align: 'center',
  152. slot: 'action',
  153. },
  154. ])
  155. const mobilePrimaryFields = ref([
  156. {
  157. prop: 'cId',
  158. label: t('Label.CidAccount'),
  159. align: 'center',
  160. },
  161. {
  162. prop: 'name',
  163. label: t('Ib.Custom.NameLabel'),
  164. align: 'center',
  165. },
  166. {
  167. prop: 'email',
  168. label: t('Label.Email'),
  169. align: 'center',
  170. },
  171. {
  172. prop: 'more',
  173. type: 'more',
  174. width: 20,
  175. align: 'right',
  176. },
  177. ])
  178. const listApi = ref(null)
  179. listApi.value = ibApi.customerSubs
  180. //选择belongsType(点击已选中的 tab 可反选取消)
  181. const chooseBelongsType = (belongsType) => {
  182. if (search.value.belongsType == belongsType) {
  183. search.value.belongsType = null // 反选:取消选中
  184. } else {
  185. search.value.belongsType = belongsType
  186. }
  187. }
  188. // 下拉菜单配置
  189. const menuList = (row) => {
  190. return [
  191. {
  192. label: t('Documentary.AgentBackground.item1'),
  193. type: 'documentary',
  194. row,
  195. show: true,
  196. },
  197. {
  198. label: t('Home.msg.ibTitle'),
  199. type: 'applyIb',
  200. row,
  201. show: row.ibStatus == 1 && row.belongsType != 1,
  202. },
  203. {
  204. label: t('Ib.Custom.AccountAdjust'),
  205. type: 'Point',
  206. row,
  207. show: row.belongsType != 1,
  208. },
  209. ].filter((item) => item.show)
  210. }
  211. const handleMenuClick = (item) => {
  212. if (item.type == 'documentary') {
  213. const { cId, id, permissionDisplay } = item.row
  214. formInfoRow.value = {
  215. cId, id, permissionDisplay,
  216. }
  217. docVisible.value = true
  218. } else if (item.type == 'applyIb') {
  219. applyVisible.value = true
  220. } else if (item.type == 'Point') {
  221. const { cId, id, comPoint1, hide1 } = item.row
  222. pointForm.value = {
  223. cId, id, comPoint1, hide1,
  224. }
  225. pointVisible.value = true
  226. }
  227. }
  228. //获取统计数
  229. const getStatistics = async () => {
  230. try {
  231. let res = await ibApi.customerSubsStatistics({})
  232. if (res.code == Code.StatusOK && res.data) {
  233. statistics.value = {
  234. unverifiedNum: res.data.unverifiedNum || 0,
  235. unDepositNum: res.data.unDepositNum || 0,
  236. depositNum: res.data.depositNum || 0,
  237. }
  238. }
  239. } catch (error) {
  240. }
  241. }
  242. onMounted(() => {
  243. getStatistics()
  244. // docVisible.value =true
  245. // pointVisible.value =true
  246. })
  247. const closeDoc = () => {
  248. docVisible.value = false
  249. }
  250. const closeApply = () => {
  251. applyVisible.value = false
  252. }
  253. const closePoint = () => {
  254. pointVisible.value = false
  255. }
  256. const confirmDoc = () => {
  257. docVisible.value = false
  258. tableRef.value.refreshTable()
  259. }
  260. const confirmPoint = () => {
  261. pointVisible.value = false
  262. tableRef.value.refreshTable()
  263. }
  264. const confirmApply = () => {
  265. applyVisible.value = false
  266. tableRef.value.refreshTable()
  267. }
  268. </script>
  269. <style scoped lang="scss">
  270. @import "@/uni.scss";
  271. .search-content {
  272. display: flex;
  273. justify-content: space-between;
  274. }
  275. .search-bar {
  276. display: flex;
  277. align-items: center;
  278. justify-content: flex-start;
  279. flex-wrap: wrap;
  280. gap: px2rpx(10);
  281. margin: px2rpx(16) 0;
  282. .cwg-combox,
  283. .uni-easyinput,
  284. .uni-date {
  285. width: px2rpx(180) !important;
  286. flex: none;
  287. }
  288. }
  289. .search-tabs {
  290. display: flex;
  291. align-items: center;
  292. flex-wrap: wrap;
  293. gap: px2rpx(10);
  294. margin: px2rpx(16) 0;
  295. .tab-item {
  296. display: flex;
  297. min-width: px2rpx(100);
  298. border: 1px solid #F0F0F0;
  299. border-radius: px2rpx(4);
  300. margin-left: px2rpx(5);
  301. height: px2rpx(33);
  302. line-height: px2rpx(33);
  303. justify-content: center;
  304. &.active {
  305. color: var(--color-white);
  306. background-color: var(--color-error);
  307. border-color: var(--color-error);
  308. }
  309. }
  310. }
  311. </style>