customer.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  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. <DocumentaryDialog :visible="docVisible" @close="close" />
  67. </view>
  68. </cwg-page-wrapper>
  69. </template>
  70. <script setup lang="ts">
  71. import { computed, ref, onMounted } from 'vue'
  72. import { useI18n } from 'vue-i18n'
  73. import Config from '@/config/index'
  74. const { t, locale } = useI18n()
  75. import { customApi } from '@/service/custom'
  76. import { lang } from '@/composables/config'
  77. import { ibApi } from '@/service/ib'
  78. import DocumentaryDialog from '@/pages/ib/components/documentaryDialog.vue'
  79. const { Code } = Config
  80. const statistics = ref({
  81. unverifiedNum: 0,
  82. unDepositNum: 0,
  83. depositNum: 0,
  84. })
  85. const search = ref({
  86. 'name': '',
  87. 'email': '',
  88. 'cId': '700101',
  89. // 1:未实名 2:未入金 3:已入金
  90. belongsType: null,
  91. })
  92. const formInfoRow = ref({})
  93. const docVisible = ref(false)
  94. // 表格列配置
  95. const columns = ref([
  96. {
  97. prop: 'cId',
  98. label: t('Label.CidAccount'),
  99. align: 'center',
  100. },
  101. {
  102. prop: 'name',
  103. label: t('Ib.Custom.NameLabel'),
  104. align: 'center',
  105. },
  106. {
  107. prop: 'email',
  108. label: t('Label.Email'),
  109. align: 'center',
  110. },
  111. {
  112. prop: 'countryEnName',
  113. label: t('Label.Nationality'),
  114. align: 'center',
  115. width: lang ? 110 : 0,
  116. },
  117. {
  118. prop: 'addTime',
  119. label: t('Label.RegistrationTime'),
  120. align: 'center',
  121. width: lang ? 110 : 0,
  122. },
  123. {
  124. prop: 'belongsType',
  125. label: t('Ib.Custom.CustomerStatus'),
  126. align: 'center',
  127. formatter: ({ row }) => row.belongsType == 1 ? t('Ib.Custom.Unverified') :
  128. row.belongsType == 2 ? t('Ib.Custom.UnDeposit') :
  129. row.belongsType == 3 ? t('Ib.Custom.Deposited') : '--',
  130. },
  131. {
  132. prop: 'ibStatus',
  133. label: t('Ib.Custom.ApplyAgent'),
  134. align: 'center',
  135. formatter: ({ row }) => row.ibStatus == 2 ? t('Ib.Custom.Yes') : t('Ib.Custom.No'),
  136. },
  137. {
  138. prop: 'action',
  139. label: t('Label.Action'),
  140. align: 'center',
  141. slot: 'action',
  142. },
  143. ])
  144. const mobilePrimaryFields = ref([
  145. {
  146. prop: 'cId',
  147. label: t('Label.CidAccount'),
  148. align: 'center',
  149. },
  150. {
  151. prop: 'name',
  152. label: t('Ib.Custom.NameLabel'),
  153. align: 'center',
  154. },
  155. {
  156. prop: 'email',
  157. label: t('Label.Email'),
  158. align: 'center',
  159. },
  160. {
  161. prop: 'more',
  162. type: 'more',
  163. width: 20,
  164. align: 'right',
  165. },
  166. ])
  167. const listApi = ref(null)
  168. listApi.value = ibApi.customerSubs
  169. //选择belongsType(点击已选中的 tab 可反选取消)
  170. const chooseBelongsType = (belongsType) => {
  171. if (search.value.belongsType == belongsType) {
  172. search.value.belongsType = null // 反选:取消选中
  173. } else {
  174. search.value.belongsType = belongsType
  175. }
  176. }
  177. // 下拉菜单配置
  178. const menuList = (row) => {
  179. return [
  180. {
  181. label: t('Documentary.AgentBackground.item1'),
  182. type: 'documentary',
  183. row,
  184. show: true,
  185. },
  186. {
  187. label: t('Home.msg.ibTitle'),
  188. type: 'applyIb',
  189. row,
  190. show: row.ibStatus == 1 && row.belongsType != 1,
  191. },
  192. {
  193. label: t('Ib.Custom.AccountAdjust'),
  194. type: 'Point',
  195. row,
  196. show: row.belongsType != 1,
  197. },
  198. ].filter((item) => item.show)
  199. }
  200. const handleMenuClick = (item) => {
  201. if (item.type == 'documentary') {
  202. const { cId, id, permissionDisplay } = item.row
  203. formInfoRow.value = {
  204. cId, id, permissionDisplay,
  205. }
  206. } else if (item.type == 'applyIb') {
  207. uni.navigateTo({
  208. url: '/pages/ib/applyIb/index?cId=' + row.cId,
  209. })
  210. } else if (item.type == 'Point') {
  211. uni.navigateTo({
  212. url: '/pages/ib/point/index?cId=' + row.cId,
  213. })
  214. }
  215. }
  216. //获取统计数
  217. const getStatistics = async () => {
  218. try {
  219. let res = await ibApi.customerSubsStatistics({})
  220. if (res.code == Code.StatusOK && res.data) {
  221. statistics.value = {
  222. unverifiedNum: res.data.unverifiedNum || 0,
  223. unDepositNum: res.data.unDepositNum || 0,
  224. depositNum: res.data.depositNum || 0,
  225. }
  226. }
  227. } catch (error) {
  228. }
  229. }
  230. onMounted(() => {
  231. getStatistics()
  232. // docVisible.value =true
  233. })
  234. </script>
  235. <style scoped lang="scss">
  236. @import "@/uni.scss";
  237. .search-content {
  238. display: flex;
  239. justify-content: space-between;
  240. }
  241. .search-bar {
  242. display: flex;
  243. align-items: center;
  244. justify-content: flex-start;
  245. flex-wrap: wrap;
  246. gap: px2rpx(10);
  247. margin: px2rpx(16) 0;
  248. .cwg-combox,
  249. .uni-easyinput,
  250. .uni-date {
  251. width: px2rpx(180) !important;
  252. flex: none;
  253. }
  254. }
  255. .search-tabs {
  256. display: flex;
  257. align-items: center;
  258. flex-wrap: wrap;
  259. gap: px2rpx(10);
  260. margin: px2rpx(16) 0;
  261. .tab-item {
  262. display: flex;
  263. min-width: px2rpx(100);
  264. border: 1px solid #F0F0F0;
  265. border-radius: px2rpx(4);
  266. margin-left: px2rpx(5);
  267. height: px2rpx(33);
  268. line-height: px2rpx(33);
  269. justify-content: center;
  270. &.active {
  271. color: var(--color-white);
  272. background-color: var(--color-error);
  273. border-color: var(--color-error);
  274. }
  275. }
  276. }
  277. </style>