customer.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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="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. 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 applyForm = ref({})
  101. const applyTable = ref([])
  102. const docVisible = ref(false)
  103. const pointVisible = ref(false)
  104. const applyVisible = ref(false)
  105. const tableRef = ref(null)
  106. // 表格列配置
  107. const columns = ref([
  108. {
  109. prop: 'cId',
  110. label: t('Label.CidAccount'),
  111. align: 'center',
  112. },
  113. {
  114. prop: 'name',
  115. label: t('Ib.Custom.NameLabel'),
  116. align: 'center',
  117. },
  118. {
  119. prop: 'email',
  120. label: t('Label.Email'),
  121. align: 'center',
  122. },
  123. {
  124. prop: 'countryEnName',
  125. label: t('Label.Nationality'),
  126. align: 'center',
  127. width: lang ? 110 : 0,
  128. },
  129. {
  130. prop: 'addTime',
  131. label: t('Label.RegistrationTime'),
  132. align: 'center',
  133. width: lang ? 110 : 0,
  134. },
  135. {
  136. prop: 'belongsType',
  137. label: t('Ib.Custom.CustomerStatus'),
  138. align: 'center',
  139. formatter: ({ row }) => row.belongsType == 1 ? t('Ib.Custom.Unverified') :
  140. row.belongsType == 2 ? t('Ib.Custom.UnDeposit') :
  141. row.belongsType == 3 ? t('Ib.Custom.Deposited') : '--',
  142. },
  143. {
  144. prop: 'ibStatus',
  145. label: t('Ib.Custom.ApplyAgent'),
  146. align: 'center',
  147. formatter: ({ row }) => row.ibStatus == 2 ? t('Ib.Custom.Yes') : t('Ib.Custom.No'),
  148. },
  149. {
  150. prop: 'action',
  151. label: t('Label.Action'),
  152. align: 'center',
  153. slot: 'action',
  154. },
  155. ])
  156. const mobilePrimaryFields = ref([
  157. {
  158. prop: 'cId',
  159. label: t('Label.CidAccount'),
  160. align: 'center',
  161. },
  162. {
  163. prop: 'name',
  164. label: t('Ib.Custom.NameLabel'),
  165. align: 'center',
  166. },
  167. {
  168. prop: 'email',
  169. label: t('Label.Email'),
  170. align: 'center',
  171. },
  172. {
  173. prop: 'more',
  174. type: 'more',
  175. width: 20,
  176. align: 'right',
  177. },
  178. ])
  179. const listApi = ref(null)
  180. listApi.value = ibApi.customerSubs
  181. //选择belongsType(点击已选中的 tab 可反选取消)
  182. const chooseBelongsType = (belongsType) => {
  183. if (search.value.belongsType == belongsType) {
  184. search.value.belongsType = null // 反选:取消选中
  185. } else {
  186. search.value.belongsType = belongsType
  187. }
  188. }
  189. // 下拉菜单配置
  190. const menuList = (row) => {
  191. return [
  192. {
  193. label: t('Documentary.AgentBackground.item1'),
  194. type: 'documentary',
  195. row,
  196. show: true,
  197. },
  198. {
  199. label: t('Home.msg.ibTitle'),
  200. type: 'applyIb',
  201. row,
  202. show: row.ibStatus == 1 && row.belongsType != 1,
  203. },
  204. {
  205. label: t('Ib.Custom.AccountAdjust'),
  206. type: 'Point',
  207. row,
  208. show: row.belongsType != 1,
  209. },
  210. ].filter((item) => item.show)
  211. }
  212. const handleMenuClick = (item) => {
  213. if (item.type == 'documentary') {
  214. const { cId, id, permissionDisplay } = item.row
  215. formInfoRow.value = {
  216. cId, id, permissionDisplay,
  217. }
  218. docVisible.value = true
  219. } else if (item.type == 'applyIb') {
  220. applyForm.value = row
  221. applyVisible.value = true
  222. } else if (item.type == 'Point') {
  223. const { cId, id, comPoint1, hide1 } = item.row
  224. pointForm.value = {
  225. cId, id, comPoint1, hide1,
  226. }
  227. pointVisible.value = true
  228. }
  229. }
  230. //获取统计数
  231. const getStatistics = async () => {
  232. try {
  233. let res = await ibApi.customerSubsStatistics({})
  234. if (res.code == Code.StatusOK && res.data) {
  235. statistics.value = {
  236. unverifiedNum: res.data.unverifiedNum || 0,
  237. unDepositNum: res.data.unDepositNum || 0,
  238. depositNum: res.data.depositNum || 0,
  239. }
  240. }
  241. } catch (error) {
  242. }
  243. }
  244. onMounted(() => {
  245. getStatistics()
  246. // docVisible.value =true
  247. // pointVisible.value =true
  248. applyVisible.value =true
  249. })
  250. const closeDoc = () => {
  251. docVisible.value = false
  252. }
  253. const closeApply = () => {
  254. applyVisible.value = false
  255. }
  256. const closePoint = () => {
  257. pointVisible.value = false
  258. }
  259. const confirmDoc = () => {
  260. docVisible.value = false
  261. tableRef.value.refreshTable()
  262. }
  263. const confirmPoint = () => {
  264. pointVisible.value = false
  265. tableRef.value.refreshTable()
  266. }
  267. const confirmApply = () => {
  268. applyVisible.value = false
  269. tableRef.value.refreshTable()
  270. }
  271. </script>
  272. <style scoped lang="scss">
  273. @import "@/uni.scss";
  274. .search-content {
  275. display: flex;
  276. justify-content: space-between;
  277. }
  278. .search-bar {
  279. display: flex;
  280. align-items: center;
  281. justify-content: flex-start;
  282. flex-wrap: wrap;
  283. gap: px2rpx(10);
  284. margin: px2rpx(16) 0;
  285. .cwg-combox,
  286. .uni-easyinput,
  287. .uni-date {
  288. width: px2rpx(180) !important;
  289. flex: none;
  290. }
  291. }
  292. .search-tabs {
  293. display: flex;
  294. align-items: center;
  295. flex-wrap: wrap;
  296. gap: px2rpx(10);
  297. margin: px2rpx(16) 0;
  298. .tab-item {
  299. display: flex;
  300. min-width: px2rpx(100);
  301. border: 1px solid #F0F0F0;
  302. border-radius: px2rpx(4);
  303. margin-left: px2rpx(5);
  304. height: px2rpx(33);
  305. line-height: px2rpx(33);
  306. justify-content: center;
  307. &.active {
  308. color: var(--color-white);
  309. background-color: var(--color-error);
  310. border-color: var(--color-error);
  311. }
  312. }
  313. }
  314. </style>