customer.vue 8.2 KB

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