index.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <!-- 流量明细 客户充值界面 -->
  2. <template>
  3. <div class="customer-top-up">
  4. <!-- 搜索条件区 -->
  5. <div class="search-section">
  6. <a-form ref="formRef" :model="searchForm" layout="inline">
  7. <a-form-item field="name" label="客户名称">
  8. <a-input
  9. v-model="searchForm.name"
  10. placeholder="请输入客户名称"
  11. allow-clear
  12. />
  13. </a-form-item>
  14. <!-- <a-form-item field="exportTime" label="卡导入时间">
  15. <a-range-picker
  16. v-model="searchForm.exportTime"
  17. style="width: 254px; marginbottom: 20px"
  18. />
  19. </a-form-item> -->
  20. <a-form-item>
  21. <a-space>
  22. <a-button type="primary" @click="handleSearch">搜索</a-button>
  23. <a-button @click="resetSearch">重置</a-button>
  24. </a-space>
  25. </a-form-item>
  26. </a-form>
  27. </div>
  28. <!-- 数据表格 -->
  29. <a-table
  30. row-key="userId"
  31. :columns="columns"
  32. :data="tableData"
  33. :pagination="pagination"
  34. @page-change="onPageChange"
  35. @page-size-change="onPageSizeChange"
  36. >
  37. <template #dataUsage="{ record }">
  38. <div class="boldTxt txtPointer" @click="openDetail(record)">
  39. {{ record.dataUsage }}M
  40. </div>
  41. </template>
  42. </a-table>
  43. <a-modal
  44. v-model:visible="showDetail"
  45. title="流量消耗明细"
  46. @cancel="showDetail = false"
  47. @before-ok="submitDetail"
  48. okText="确定"
  49. width="1000px"
  50. cancelText="关闭"
  51. >
  52. <a-table
  53. row-key="ICCID"
  54. :columns="columnsDetail"
  55. :data="tableDataDetail"
  56. :pagination="paginationDetail"
  57. :scroll="{
  58. x: '130%',
  59. y: '100%',
  60. }"
  61. @page-change="onDetailPageChange"
  62. @page-size-change="onDetailPageSizeChange"
  63. >
  64. <template #dataUsage="{ record }">
  65. <div>{{ record.dataUsage }}M/{{ record.dataTotal }}M</div>
  66. </template>
  67. <template #userName="{ record }">
  68. <div>{{ record.userName }}/{{ record.userId }}</div>
  69. </template>
  70. </a-table>
  71. </a-modal>
  72. </div>
  73. </template>
  74. <script setup>
  75. import { ref, reactive, onMounted } from "vue";
  76. import { Message } from "@arco-design/web-vue";
  77. import { getSimConsumptionDetailsList, getUserSimInfo } from "@/api/path/finance.js";
  78. onMounted(() => {
  79. getSimConsumptionDetailsListFc();
  80. });
  81. const initPage = {
  82. total: 0,
  83. current: 1,
  84. pageSize: 10,
  85. };
  86. const formRef = ref();
  87. const searchForm = ref({
  88. name: "",
  89. });
  90. const columns = [
  91. {
  92. title: "序号",
  93. dataIndex: "index",
  94. align: "center",
  95. render: ({ rowIndex }) => rowIndex + 1,
  96. width: 60,
  97. },
  98. { title: "客户", dataIndex: "username" },
  99. { title: "运营商", dataIndex: "source" },
  100. { title: "统计时间", dataIndex: "statisticalTime" },
  101. { title: "卡套餐", dataIndex: "cardPackageName" },
  102. { title: "已用流量套餐", dataIndex: "dataUsage", slotName: "dataUsage", },
  103. // { title: "已用加油包流量", dataIndex: "dataUsage" },
  104. { title: "计算周期", dataIndex: "billingCycle" },
  105. ];
  106. const columnsDetail = [
  107. {
  108. title: "序号",
  109. dataIndex: "index",
  110. align: "center",
  111. render: ({ rowIndex }) => rowIndex + 1,
  112. width: 60,
  113. },
  114. { title: "ICCID/MSISDN", dataIndex: "iccid" },
  115. { title: "客户", dataIndex: "userName" },
  116. { title: "运营商", dataIndex: "source", width: 120, },
  117. { title: "统计时间", dataIndex: "updatedAt", width: 180, },
  118. { title: "用户名称/编号", dataIndex: "userName", slotName: "userName" },
  119. { title: "卡套餐", dataIndex: "productName" },
  120. {
  121. title: "已用/可用(套餐流量)",
  122. dataIndex: "usedData",
  123. dataIndex: "dataUsage",
  124. slotName: "dataUsage",
  125. },
  126. // { title: "已用/可用(加油包流量)", dataIndex: "fuelPacketUsed" },
  127. ];
  128. const tableData = ref([]);
  129. const tableDataDetail = ref([
  130. {
  131. ICCID: "1210938748329018",
  132. customerName: "泰国李总",
  133. operators: "泰国AIS",
  134. updateTime: "2024-10-24 08:10:34",
  135. userName: "Jay/010211",
  136. cardPackages: "100M每月",
  137. usedData: "28M/100M",
  138. fuelPacketUsed: "28M/30M",
  139. },
  140. {
  141. ICCID: "1210938748329019",
  142. customerName: "泰国李总",
  143. operators: "泰国AIS",
  144. updateTime: "2024-10-24 08:10:34",
  145. userName: "Jay/010211",
  146. cardPackages: "100M每月",
  147. usedData: "28M/100M",
  148. fuelPacketUsed: "28M/30M",
  149. },
  150. {
  151. ICCID: "12109387483290110",
  152. customerName: "泰国李总",
  153. operators: "泰国AIS",
  154. updateTime: "2024-10-24 08:10:34",
  155. userName: "Jay/010211",
  156. cardPackages: "100M每月",
  157. usedData: "28M/100M",
  158. fuelPacketUsed: "28M/30M",
  159. },
  160. {
  161. ICCID: "12109387483290111",
  162. customerName: "泰国李总",
  163. operators: "泰国AIS",
  164. updateTime: "2024-10-24 08:10:34",
  165. userName: "Jay/010211",
  166. cardPackages: "100M每月",
  167. usedData: "28M/100M",
  168. fuelPacketUsed: "28M/30M",
  169. },
  170. {
  171. ICCID: "12109387483290112",
  172. customerName: "泰国李总",
  173. operators: "泰国AIS",
  174. updateTime: "2024-10-24 08:10:34",
  175. userName: "Jay/010211",
  176. cardPackages: "100M每月",
  177. usedData: "28M/100M",
  178. fuelPacketUsed: "28M/30M",
  179. },
  180. ]);
  181. const pagination = ref({
  182. ...initPage,
  183. showTotal: true,
  184. showJumper: true,
  185. showPageSize: true,
  186. });
  187. const paginationDetail = ref({
  188. ...initPage,
  189. showTotal: true,
  190. showJumper: true,
  191. showPageSize: true,
  192. });
  193. const onPageChange = (page) => {
  194. pagination.value.current = page;
  195. getSimConsumptionDetailsListFc();
  196. };
  197. const onPageSizeChange = (pageSize) => {
  198. pagination.value.pageSize = pageSize;
  199. getSimConsumptionDetailsListFc();
  200. };
  201. const onDetailPageChange = (page) => {
  202. pagination.value.current = page;
  203. getUserSimInfoFc();
  204. };
  205. const onDetailPageSizeChange = (pageSize) => {
  206. pagination.value.pageSize = pageSize;
  207. getUserSimInfoFc();
  208. };
  209. const handleSearch = () => {
  210. pagination.value = { ...initPage };
  211. getSimConsumptionDetailsListFc();
  212. };
  213. const resetSearch = () => {
  214. formRef.value.resetFields();
  215. handleSearch();
  216. };
  217. const showDetail = ref(false);
  218. const submitDetail = () => {
  219. window.setTimeout(() => {
  220. showDetail.value = false;
  221. }, 1000);
  222. };
  223. const curUserId = ref(null);
  224. const openDetail = (record) => {
  225. curUserId.value = record.userId;
  226. getUserSimInfoFc(() => {
  227. showDetail.value = true;
  228. });
  229. };
  230. const getSimConsumptionDetailsListFc = async () => {
  231. const param = {
  232. current: pagination.value.current,
  233. size: pagination.value.pageSize,
  234. ...searchForm.value,
  235. };
  236. const { data } = await getSimConsumptionDetailsList(param);
  237. tableData.value = data?.records || [];
  238. pagination.value.total = data.total;
  239. };
  240. const getUserSimInfoFc = async (cb) => {
  241. const param = {
  242. current: paginationDetail.value.current,
  243. size: paginationDetail.value.pageSize,
  244. id: curUserId.value,
  245. };
  246. const { data } = await getUserSimInfo(param);
  247. tableDataDetail.value =
  248. data.map((v) => {
  249. const obj =
  250. v?.dataPackage && v.dataPackage.length > 0 ? v.dataPackage[0] : {};
  251. return {
  252. ...obj,
  253. ...v,
  254. };
  255. }) || [];
  256. paginationDetail.value.total = data.length;
  257. cb && cb();
  258. };
  259. </script>
  260. <style scoped lang="less">
  261. .customer-top-up {
  262. padding: 20px !important;
  263. .search-section {
  264. margin-bottom: 20px;
  265. }
  266. .audit-btn {
  267. margin-bottom: 10px;
  268. }
  269. }
  270. .text-box {
  271. width: 100%;
  272. margin-left: 10px;
  273. .text {
  274. font-family: PingFang SC;
  275. font-size: 12px;
  276. font-weight: 400;
  277. line-height: 19px;
  278. color: rgba(153, 153, 153, 1);
  279. text-align: left;
  280. }
  281. }
  282. </style>