customer.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  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. <!-- 移动端:分类标签在搜索组件上方 -->
  6. <cwg-match-media :max-width="991">
  7. <view class="search-content mobile-search-content">
  8. <view class="search-tabs">
  9. <view class="crm-cursor tab-item" :class="{ active: search.belongsType == 1 }" @click="chooseBelongsType(1)">
  10. {{ t('Ib.Custom.Unverified') }}
  11. <view v-if="statistics.unverifiedNum !== undefined" class="count-badge">({{ statistics.unverifiedNum }})</view>
  12. </view>
  13. <view class="crm-cursor tab-item" :class="{ active: search.belongsType == 2 }" @click="chooseBelongsType(2)">
  14. {{ t('Ib.Custom.UnDeposit') }}
  15. <view v-if="statistics.unDepositNum !== undefined" class="count-badge">({{ statistics.unDepositNum }})</view>
  16. </view>
  17. <view class="crm-cursor tab-item" :class="{ active: search.belongsType == 3 }" @click="chooseBelongsType(3)">
  18. {{ t('Ib.Custom.Deposited') }}
  19. <view v-if="statistics.depositNum !== undefined" class="count-badge">({{ statistics.depositNum }})</view>
  20. </view>
  21. </view>
  22. <view class="search-bar">
  23. <cwg-complex-search :fields="filterFields" v-model="searchParams" @search="handleSearch" @reset="handleReset" />
  24. </view>
  25. </view>
  26. </cwg-match-media>
  27. <!-- PC端:分类标签和搜索组件在同一行 (搜索在左,标签在右) -->
  28. <cwg-match-media :min-width="992">
  29. <view class="search-content pc-search-content">
  30. <view class="search-bar">
  31. <cwg-complex-search :fields="filterFields" v-model="searchParams" @search="handleSearch" @reset="handleReset" />
  32. </view>
  33. <view class="search-tabs">
  34. <view class="crm-cursor tab-item" :class="{ active: search.belongsType == 1 }" @click="chooseBelongsType(1)">
  35. {{ t('Ib.Custom.Unverified') }}
  36. <view v-if="statistics.unverifiedNum !== undefined" class="count-badge">({{ statistics.unverifiedNum }})</view>
  37. </view>
  38. <view class="crm-cursor tab-item" :class="{ active: search.belongsType == 2 }" @click="chooseBelongsType(2)">
  39. {{ t('Ib.Custom.UnDeposit') }}
  40. <view v-if="statistics.unDepositNum !== undefined" class="count-badge">({{ statistics.unDepositNum }})</view>
  41. </view>
  42. <view class="crm-cursor tab-item" :class="{ active: search.belongsType == 3 }" @click="chooseBelongsType(3)">
  43. {{ t('Ib.Custom.Deposited') }}
  44. <view v-if="statistics.depositNum !== undefined" class="count-badge">({{ statistics.depositNum }})</view>
  45. </view>
  46. </view>
  47. </view>
  48. </cwg-match-media>
  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="applyForm" @close="closeApply" @confirm="confirmApply" />
  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. import { nextTick } from 'vue'
  86. const { Code } = Config
  87. const statistics = ref({
  88. unverifiedNum: 0,
  89. unDepositNum: 0,
  90. depositNum: 0,
  91. })
  92. const searchParams = ref({})
  93. const search = ref({
  94. 'name': '',
  95. 'email': '',
  96. 'cId': '',
  97. // 1:未实名 2:未入金 3:已入金
  98. belongsType: null,
  99. })
  100. const filterFields = [
  101. { key: 'cId', type: 'input', label: 'CID', placeholder: 'CID', defaultValue: '' },
  102. { key: 'name', type: 'input', label: t('Ib.Custom.NameLabel'), placeholder: t('Ib.Custom.NameLabel'), defaultValue: '' },
  103. { key: 'email', type: 'input', label: t('Label.Email'), placeholder: t('Label.Email'), defaultValue: '' }
  104. ]
  105. const formInfoRow = ref({})
  106. const pointForm = ref({})
  107. const applyForm = ref({})
  108. const applyTable = ref([])
  109. const docVisible = ref(false)
  110. const pointVisible = ref(false)
  111. const applyVisible = ref(false)
  112. const tableRef = ref(null)
  113. // 表格列配置
  114. const columns = ref([
  115. {
  116. prop: 'cId',
  117. label: t('Label.CidAccount'),
  118. align: 'center',
  119. },
  120. {
  121. prop: 'name',
  122. label: t('Ib.Custom.NameLabel'),
  123. align: 'center',
  124. },
  125. {
  126. prop: 'email',
  127. label: t('Label.Email'),
  128. align: 'center',
  129. },
  130. {
  131. prop: 'countryEnName',
  132. label: t('Label.Nationality'),
  133. align: 'center',
  134. width: lang ? 110 : 0,
  135. },
  136. {
  137. prop: 'addTime',
  138. label: t('Label.RegistrationTime'),
  139. align: 'center',
  140. width: lang ? 110 : 0,
  141. },
  142. {
  143. prop: 'belongsType',
  144. label: t('Ib.Custom.CustomerStatus'),
  145. align: 'center',
  146. formatter: ({ row }) => row.belongsType == 1 ? t('Ib.Custom.Unverified') :
  147. row.belongsType == 2 ? t('Ib.Custom.UnDeposit') :
  148. row.belongsType == 3 ? t('Ib.Custom.Deposited') : '--',
  149. },
  150. {
  151. prop: 'ibStatus',
  152. label: t('Ib.Custom.ApplyAgent'),
  153. align: 'center',
  154. formatter: ({ row }) => row.ibStatus == 2 ? t('Ib.Custom.Yes') : t('Ib.Custom.No'),
  155. },
  156. {
  157. prop: 'action',
  158. label: t('Label.Action'),
  159. align: 'center',
  160. slot: 'action',
  161. },
  162. ])
  163. const mobilePrimaryFields = ref([
  164. {
  165. prop: 'cId',
  166. label: t('Label.CidAccount'),
  167. align: 'center',
  168. },
  169. {
  170. prop: 'name',
  171. label: t('Ib.Custom.NameLabel'),
  172. align: 'center',
  173. },
  174. {
  175. prop: 'email',
  176. label: t('Label.Email'),
  177. align: 'center',
  178. },
  179. {
  180. prop: 'more',
  181. type: 'more',
  182. width: 20,
  183. align: 'right',
  184. },
  185. ])
  186. const listApi = ref(null)
  187. listApi.value = ibApi.customerSubs
  188. const handleSearch = (params: any) => {
  189. // 合并表单的过滤参数,同时保留当前的 belongsType 标签选中状态
  190. search.value = {
  191. ...params,
  192. belongsType: search.value.belongsType
  193. }
  194. nextTick(() => {
  195. tableRef.value.refreshTable()
  196. })
  197. }
  198. const handleReset = () => {
  199. search.value = {
  200. name: '',
  201. email: '',
  202. cId: '',
  203. belongsType: search.value.belongsType // 保持当前的分类标签选中
  204. }
  205. nextTick(() => {
  206. tableRef.value.refreshTable()
  207. })
  208. }
  209. //选择belongsType(点击已选中的 tab 可反选取消)
  210. const chooseBelongsType = (belongsType) => {
  211. if (search.value.belongsType == belongsType) {
  212. search.value.belongsType = null // 反选:取消选中
  213. } else {
  214. search.value.belongsType = belongsType
  215. }
  216. // 切换 tab 时自动重新请求列表
  217. nextTick(() => {
  218. tableRef.value.refreshTable()
  219. })
  220. }
  221. // 下拉菜单配置
  222. const menuList = (row) => {
  223. return [
  224. {
  225. label: t('Documentary.AgentBackground.item1'),
  226. type: 'documentary',
  227. row,
  228. show: true,
  229. },
  230. {
  231. label: t('Home.msg.ibTitle'),
  232. type: 'applyIb',
  233. row,
  234. show: row.ibStatus == 1 && row.belongsType != 1,
  235. },
  236. {
  237. label: t('Ib.Custom.AccountAdjust'),
  238. type: 'Point',
  239. row,
  240. show: row.belongsType != 1,
  241. },
  242. ].filter((item) => item.show)
  243. }
  244. const handleMenuClick = (item) => {
  245. if (item.type == 'documentary') {
  246. const { cId, id, permissionDisplay } = item.row
  247. formInfoRow.value = {
  248. cId, id, permissionDisplay,
  249. }
  250. docVisible.value = true
  251. } else if (item.type == 'applyIb') {
  252. applyForm.value = row
  253. applyVisible.value = true
  254. } else if (item.type == 'Point') {
  255. const { cId, id, comPoint1, hide1 } = item.row
  256. pointForm.value = {
  257. cId, id, comPoint1, hide1,
  258. }
  259. pointVisible.value = true
  260. }
  261. }
  262. //获取统计数
  263. const getStatistics = async () => {
  264. try {
  265. let res = await ibApi.customerSubsStatistics({})
  266. if (res.code == Code.StatusOK && res.data) {
  267. statistics.value = {
  268. unverifiedNum: res.data.unverifiedNum || 0,
  269. unDepositNum: res.data.unDepositNum || 0,
  270. depositNum: res.data.depositNum || 0,
  271. }
  272. }
  273. } catch (error) {
  274. }
  275. }
  276. onMounted(() => {
  277. getStatistics()
  278. // docVisible.value =true
  279. // pointVisible.value =true
  280. // applyVisible.value =true
  281. })
  282. const closeDoc = () => {
  283. docVisible.value = false
  284. }
  285. const closeApply = () => {
  286. applyVisible.value = false
  287. }
  288. const closePoint = () => {
  289. pointVisible.value = false
  290. }
  291. const confirmDoc = () => {
  292. docVisible.value = false
  293. tableRef.value.refreshTable()
  294. }
  295. const confirmPoint = () => {
  296. pointVisible.value = false
  297. tableRef.value.refreshTable()
  298. }
  299. const confirmApply = () => {
  300. applyVisible.value = false
  301. tableRef.value.refreshTable()
  302. }
  303. </script>
  304. <style scoped lang="scss">
  305. @import "@/uni.scss";
  306. .search-content {
  307. display: flex;
  308. justify-content: space-between;
  309. align-items: flex-start;
  310. }
  311. .mobile-search-content {
  312. flex-direction: column;
  313. align-items: flex-start;
  314. gap: px2rpx(10);
  315. .search-tabs{
  316. padding: 0;
  317. margin: 0;
  318. }
  319. }
  320. .pc-search-content {
  321. flex-direction: row;
  322. align-items: flex-start;
  323. }
  324. .search-bar {
  325. display: flex;
  326. align-items: center;
  327. justify-content: flex-start;
  328. flex-wrap: wrap;
  329. gap: px2rpx(10);
  330. margin: px2rpx(16) 0;
  331. .cwg-combox,
  332. .uni-easyinput,
  333. .uni-date {
  334. width: px2rpx(180) !important;
  335. flex: none;
  336. }
  337. }
  338. .search-tabs {
  339. display: flex;
  340. align-items: center;
  341. flex-wrap: wrap;
  342. gap: px2rpx(10);
  343. margin: px2rpx(16) 0;
  344. .tab-item {
  345. display: flex;
  346. min-width: px2rpx(100);
  347. border: 1px solid #F0F0F0;
  348. border-radius: px2rpx(4);
  349. margin-right: px2rpx(5);
  350. height: px2rpx(33);
  351. line-height: px2rpx(33);
  352. justify-content: center;
  353. &.active {
  354. color: var(--color-white);
  355. background-color: var(--color-error);
  356. border-color: var(--color-error);
  357. }
  358. }
  359. }
  360. </style>