index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751
  1. <template>
  2. <view class="detail-page">
  3. <!-- 顶部状态栏 -->
  4. <view class="header-section">
  5. <view class="header-content">
  6. <view class="title-group">
  7. <text class="main-title">黑名单企业库</text>
  8. <text class="sub-title">实时监控异常经营企业</text>
  9. </view>
  10. <view class="stat-box">
  11. <text class="stat-num">{{ totalCount }}</text>
  12. <text class="stat-unit">家</text>
  13. </view>
  14. </view>
  15. <view class="header-toolbar">
  16. <view class="update-tip">
  17. <text class="tip-icon">🕒</text>
  18. <text
  19. >更新:{{
  20. formatDate(
  21. new Date().setDate(new Date().getDate() - 1),
  22. "YYYY-MM-DD",
  23. ) || "--"
  24. }}</text
  25. >
  26. </view>
  27. <view class="filter-wrap">
  28. <view class="selector" @click.stop="toggleProvinceDropdown">
  29. <text class="selector-text">{{
  30. selectedProvince || "全部省份"
  31. }}</text>
  32. <text
  33. class="selector-arrow"
  34. :class="{ open: dropdownProvinceOpen }"
  35. ></text>
  36. </view>
  37. </view>
  38. </view>
  39. <!-- 背景装饰 -->
  40. <view class="header-circle circle-1"></view>
  41. <view class="header-circle circle-2"></view>
  42. </view>
  43. <scroll-view
  44. class="list-scroll"
  45. scroll-y="true"
  46. refresher-enabled
  47. :refresher-triggered="isRefreshing"
  48. @refresherrefresh="onRefresh"
  49. @scrolltolower="onLoadMore"
  50. >
  51. <view class="list-container">
  52. <view
  53. class="card-item"
  54. v-for="(item, index) in rows"
  55. :key="index"
  56. @click="toDetail(item)"
  57. >
  58. <view class="card-header">
  59. <view class="header-left">
  60. <text class="index-num">{{ index + 1 }}</text>
  61. <text class="company-name">{{ item.receiverName }}</text>
  62. </view>
  63. <view class="header-right">
  64. <text class="status-tag">黑名单</text>
  65. </view>
  66. </view>
  67. <view class="card-body">
  68. <view class="code-row">
  69. <text class="label">信用代码:</text>
  70. <text class="value code-text">{{ item.companyCode }}</text>
  71. </view>
  72. <view class="info-grid">
  73. <view class="info-item">
  74. <text class="label">省份</text>
  75. <text class="value">{{ item.receiverProvince }}</text>
  76. </view>
  77. <view class="info-item">
  78. <text class="label">性质</text>
  79. <text class="value">{{ item.customerNature }}</text>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. <view class="loading-more" v-if="loading">
  85. <image
  86. class="loading-icon"
  87. src="../../../static/images/loading.png"
  88. />
  89. <text class="loading-text">加载中...</text>
  90. </view>
  91. <view v-if="!loading && rows.length === 0" class="empty-data">
  92. <EmptyView text="无相关数据" />
  93. </view>
  94. <view v-if="!hasMore && rows.length > 0" class="no-more">
  95. <text>没有更多数据了</text>
  96. </view>
  97. </view>
  98. </scroll-view>
  99. <view class="footer-btn-area">
  100. <button class="action-btn history-btn" @click="handleHistory">
  101. 历史记录
  102. </button>
  103. <button class="action-btn export-btn" @click="handleExport">
  104. 导出至邮箱
  105. </button>
  106. </view>
  107. <!-- 独立的下拉菜单层 -->
  108. <view class="dropdown-layer" v-if="dropdownProvinceOpen" @click.stop>
  109. <view class="dropdown">
  110. <view class="dropdown-search-bar">
  111. <input
  112. class="dropdown-search-input"
  113. v-model="provinceSearchText"
  114. @input="onProvinceSearch"
  115. placeholder="搜索省份..."
  116. placeholder-style="color: #999"
  117. />
  118. </view>
  119. <scroll-view scroll-y="true" class="dropdown-scroll-view">
  120. <view
  121. class="dropdown-item"
  122. v-for="(p, i) in filteredProvinceList"
  123. :key="p || i"
  124. :class="{
  125. active: p === selectedProvince || (!selectedProvince && i === 0),
  126. }"
  127. @click.stop="selectProvince(p)"
  128. >
  129. {{ p || "全部省份" }}
  130. <text
  131. v-if="p === selectedProvince || (!selectedProvince && i === 0)"
  132. class="check-mark"
  133. >✓</text
  134. >
  135. </view>
  136. <view v-if="filteredProvinceList.length === 0" class="dropdown-empty"
  137. >暂无数据</view
  138. >
  139. </scroll-view>
  140. </view>
  141. </view>
  142. </view>
  143. </template>
  144. <script>
  145. import EmptyView from "../../../wigets/empty.vue";
  146. import request from "../../../request/index.js";
  147. import { formatDate } from "../../../utils/utils.js";
  148. const NATURES = ["协议客户", "非协议客户", "商业客户", "终端客户"];
  149. export default {
  150. components: {
  151. EmptyView,
  152. },
  153. data() {
  154. return {
  155. isRefreshing: false,
  156. loading: false,
  157. rows: [],
  158. totalCount: 60, // Simulated total count
  159. hasMore: true,
  160. pageNum: 1,
  161. pageSize: 20,
  162. dropdownProvinceOpen: false,
  163. provinceSearchText: "",
  164. provinceList: [""],
  165. selectedProvince: "",
  166. };
  167. },
  168. created() {
  169. this.resetFetch();
  170. this.getProviceList();
  171. },
  172. methods: {
  173. formatDate,
  174. getProviceList() {
  175. request("/common/getProviceList", {
  176. path: "traceabilityReport/pages/blacklist/index.vue",
  177. }).then((res) => {
  178. if (res.code == 200) {
  179. const _data = res.data || [];
  180. this.provinceList = ["", ..._data.map((item) => item.regionName)];
  181. }
  182. });
  183. },
  184. generateFakeData() {
  185. const newRows = [];
  186. const codes = [
  187. "91370104771001730R",
  188. "91420105783155681H",
  189. "91330110MA2CCJE32Y",
  190. "91441581761581268X",
  191. "91510106768621824L",
  192. ];
  193. const provinces =
  194. this.provinceList.length > 1
  195. ? this.provinceList.slice(1)
  196. : ["北京市", "上海市", "广东省", "浙江省", "江苏省"];
  197. const startIdx = (this.pageNum - 1) * this.pageSize;
  198. const endIdx = Math.min(startIdx + this.pageSize, this.totalCount);
  199. if (startIdx >= this.totalCount) {
  200. this.hasMore = false;
  201. return [];
  202. }
  203. for (let i = startIdx; i < endIdx; i++) {
  204. newRows.push({
  205. id: i,
  206. receiverName: `测试收货企业${i + 1}有限公司`,
  207. companyCode: codes[i % codes.length],
  208. receiverProvince: provinces[i % provinces.length],
  209. customerNature: NATURES[i % NATURES.length],
  210. });
  211. }
  212. return newRows;
  213. },
  214. async onRefresh() {
  215. this.isRefreshing = true;
  216. this.pageNum = 1;
  217. this.hasMore = true;
  218. // Simulate network request
  219. setTimeout(() => {
  220. this.rows = this.generateFakeData();
  221. this.isRefreshing = false;
  222. }, 1000);
  223. },
  224. onLoadMore() {
  225. if (this.loading || !this.hasMore) return;
  226. this.loading = true;
  227. this.pageNum++;
  228. // Simulate network request
  229. setTimeout(() => {
  230. const more = this.generateFakeData();
  231. if (more.length > 0) {
  232. this.rows = [...this.rows, ...more];
  233. } else {
  234. this.hasMore = false;
  235. }
  236. this.loading = false;
  237. }, 800);
  238. },
  239. resetFetch() {
  240. this.loading = true;
  241. this.pageNum = 1;
  242. this.hasMore = true;
  243. // Simulate initial load
  244. setTimeout(() => {
  245. this.rows = this.generateFakeData();
  246. this.loading = false;
  247. }, 500);
  248. },
  249. toDetail(item) {
  250. uni.navigateTo({
  251. url: `/traceCodePackages/traceabilityReport/pages/blacklist/detail/index?id=${item.id}&name=${encodeURIComponent(item.receiverName)}`,
  252. });
  253. },
  254. handleHistory() {
  255. uni.navigateTo({
  256. url: "/traceCodePackages/traceabilityReport/pages/blacklist/history/index",
  257. });
  258. },
  259. handleExport() {
  260. uni.showModal({
  261. title: "导出至邮箱",
  262. editable: true,
  263. placeholderText: "请输入邮箱地址",
  264. success: (res) => {
  265. if (res.confirm) {
  266. if (!res.content) {
  267. uni.showToast({
  268. title: "请输入邮箱",
  269. icon: "none",
  270. });
  271. return;
  272. }
  273. uni.showToast({
  274. title: "导出请求已发送",
  275. icon: "success",
  276. });
  277. }
  278. },
  279. });
  280. },
  281. toggleProvinceDropdown() {
  282. this.dropdownProvinceOpen = !this.dropdownProvinceOpen;
  283. },
  284. closeProvinceDropdown() {
  285. this.dropdownProvinceOpen = false;
  286. },
  287. selectProvince(province) {
  288. this.selectedProvince = province || "";
  289. this.dropdownProvinceOpen = false;
  290. },
  291. },
  292. computed: {
  293. filteredProvinceList() {
  294. if (!this.provinceSearchText) {
  295. return this.provinceList;
  296. }
  297. return this.provinceList.filter((p) =>
  298. p?.toLowerCase()?.includes(this.provinceSearchText.toLowerCase()),
  299. );
  300. },
  301. },
  302. };
  303. </script>
  304. <style scoped>
  305. .detail-page {
  306. display: flex;
  307. flex-direction: column;
  308. height: calc(100vh - 116rpx - env(safe-area-inset-bottom));
  309. box-sizing: border-box;
  310. background: #f5f7fa;
  311. }
  312. /* Header Section */
  313. .header-section {
  314. background: linear-gradient(135deg, #2b32b2 0%, #1488cc 100%);
  315. padding: 40rpx 40rpx 80rpx; /* Extra padding at bottom for overlap effect */
  316. position: relative;
  317. z-index: 20;
  318. color: #fff;
  319. border-bottom-left-radius: 40rpx;
  320. border-bottom-right-radius: 40rpx;
  321. overflow: hidden;
  322. box-shadow: 0 10rpx 30rpx rgba(20, 136, 204, 0.2);
  323. }
  324. .header-content {
  325. display: flex;
  326. justify-content: space-between;
  327. align-items: center;
  328. position: relative;
  329. z-index: 2;
  330. margin-bottom: 24rpx;
  331. }
  332. .title-group {
  333. display: flex;
  334. flex-direction: column;
  335. }
  336. .main-title {
  337. font-size: 40rpx;
  338. font-weight: bold;
  339. margin-bottom: 8rpx;
  340. letter-spacing: 2rpx;
  341. }
  342. .sub-title {
  343. font-size: 24rpx;
  344. opacity: 0.8;
  345. }
  346. .stat-box {
  347. display: flex;
  348. align-items: baseline;
  349. }
  350. .stat-num {
  351. font-size: 56rpx;
  352. font-weight: bold;
  353. margin-right: 8rpx;
  354. font-family: "DINAlternate-Bold", sans-serif;
  355. }
  356. .stat-unit {
  357. font-size: 24rpx;
  358. opacity: 0.8;
  359. }
  360. .header-toolbar {
  361. display: flex;
  362. justify-content: space-between;
  363. align-items: center;
  364. position: relative;
  365. z-index: 3;
  366. }
  367. .update-tip {
  368. display: inline-flex;
  369. align-items: center;
  370. background: rgba(255, 255, 255, 0.15);
  371. padding: 8rpx 20rpx;
  372. border-radius: 30rpx;
  373. font-size: 22rpx;
  374. backdrop-filter: blur(10px);
  375. }
  376. .tip-icon {
  377. margin-right: 8rpx;
  378. font-size: 20rpx;
  379. }
  380. /* Filter Styles */
  381. .filter-wrap {
  382. position: relative;
  383. }
  384. .selector {
  385. display: flex;
  386. align-items: center;
  387. color: #fff;
  388. font-size: 26rpx;
  389. font-weight: 500;
  390. padding: 8rpx 20rpx;
  391. background: rgba(255, 255, 255, 0.2);
  392. border-radius: 30rpx;
  393. border: 1rpx solid rgba(255, 255, 255, 0.3);
  394. }
  395. .selector-text {
  396. max-width: 200rpx;
  397. overflow: hidden;
  398. white-space: nowrap;
  399. text-overflow: ellipsis;
  400. }
  401. .selector-arrow {
  402. margin-left: 10rpx;
  403. width: 0;
  404. height: 0;
  405. border-left: 8rpx solid transparent;
  406. border-right: 8rpx solid transparent;
  407. border-top: 10rpx solid #fff;
  408. transition: transform 0.3s;
  409. }
  410. .selector-arrow.open {
  411. transform: rotate(180deg);
  412. }
  413. /* Dropdown Layer (Absolute on top of everything) */
  414. .dropdown-layer {
  415. position: absolute;
  416. top: 300rpx; /* Adjust based on header layout */
  417. right: 40rpx;
  418. z-index: 999;
  419. }
  420. .dropdown {
  421. width: 360rpx;
  422. background: #fff;
  423. border-radius: 12rpx;
  424. box-shadow: 0 8rpx 30rpx rgba(0, 0, 0, 0.15);
  425. overflow: hidden;
  426. }
  427. .dropdown-search-bar {
  428. padding: 16rpx;
  429. border-bottom: 1rpx solid #f0f0f0;
  430. }
  431. .dropdown-search-input {
  432. background: #f5f7fa;
  433. height: 64rpx;
  434. border-radius: 32rpx;
  435. padding: 0 24rpx;
  436. font-size: 26rpx;
  437. }
  438. .dropdown-scroll-view {
  439. max-height: 400rpx;
  440. }
  441. .dropdown-item {
  442. padding: 20rpx 30rpx;
  443. font-size: 28rpx;
  444. color: #333;
  445. display: flex;
  446. justify-content: space-between;
  447. align-items: center;
  448. transition: background 0.2s;
  449. }
  450. .dropdown-item:active {
  451. background: #f5f7fa;
  452. }
  453. .dropdown-item.active {
  454. color: #1890ff;
  455. font-weight: 500;
  456. background: #e6f7ff;
  457. }
  458. .check-mark {
  459. font-size: 24rpx;
  460. }
  461. .dropdown-empty {
  462. padding: 40rpx;
  463. text-align: center;
  464. color: #999;
  465. font-size: 26rpx;
  466. }
  467. /* Header Decor Circles */
  468. .header-circle {
  469. position: absolute;
  470. border-radius: 50%;
  471. background: rgba(255, 255, 255, 0.05);
  472. }
  473. .circle-1 {
  474. width: 300rpx;
  475. height: 300rpx;
  476. top: -100rpx;
  477. right: -50rpx;
  478. }
  479. .circle-2 {
  480. width: 200rpx;
  481. height: 200rpx;
  482. bottom: -50rpx;
  483. left: -50rpx;
  484. }
  485. /* List Scroll */
  486. .list-scroll {
  487. flex: 1;
  488. height: 0;
  489. padding: 0 24rpx; /* Remove vertical padding from scroll container */
  490. box-sizing: border-box;
  491. margin-top: -50rpx; /* Negative margin to pull list up */
  492. position: relative;
  493. z-index: 21;
  494. }
  495. .list-container {
  496. padding-top: 10rpx;
  497. padding-bottom: calc(200rpx + env(safe-area-inset-bottom));
  498. }
  499. .card-item {
  500. background: #fff;
  501. border-radius: 20rpx;
  502. padding: 30rpx;
  503. margin-bottom: 24rpx;
  504. box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.05);
  505. transition: transform 0.2s;
  506. }
  507. .card-item:active {
  508. transform: scale(0.99);
  509. }
  510. .card-header {
  511. display: flex;
  512. justify-content: space-between;
  513. align-items: flex-start;
  514. margin-bottom: 24rpx;
  515. }
  516. .header-left {
  517. flex: 1;
  518. display: flex;
  519. align-items: center;
  520. margin-right: 20rpx;
  521. }
  522. .index-num {
  523. font-size: 24rpx;
  524. color: #999;
  525. margin-right: 12rpx;
  526. font-family: monospace;
  527. }
  528. .company-name {
  529. font-size: 32rpx;
  530. font-weight: 600;
  531. color: #333;
  532. line-height: 1.4;
  533. }
  534. .header-right {
  535. flex-shrink: 0;
  536. }
  537. .status-tag {
  538. font-size: 20rpx;
  539. padding: 6rpx 16rpx;
  540. border-radius: 20rpx;
  541. background: #fff1f0;
  542. color: #ff4d4f;
  543. font-weight: 600;
  544. border: 1rpx solid rgba(255, 77, 79, 0.2);
  545. }
  546. .card-body {
  547. background: #f9fbfd;
  548. border-radius: 12rpx;
  549. padding: 24rpx;
  550. }
  551. .code-row {
  552. display: flex;
  553. align-items: center;
  554. margin-bottom: 20rpx;
  555. padding-bottom: 20rpx;
  556. border-bottom: 1rpx solid #edf0f5;
  557. }
  558. .code-row:last-child {
  559. margin-bottom: 0;
  560. padding-bottom: 0;
  561. border-bottom: none;
  562. }
  563. .code-text {
  564. font-family: monospace;
  565. color: #333 !important;
  566. font-weight: 600 !important;
  567. letter-spacing: 1rpx;
  568. }
  569. .info-grid {
  570. display: flex;
  571. flex-wrap: wrap;
  572. gap: 24rpx;
  573. }
  574. .info-item {
  575. display: flex;
  576. align-items: center;
  577. width: 45%;
  578. }
  579. .info-item .label,
  580. .code-row .label {
  581. font-size: 24rpx;
  582. color: #999;
  583. margin-right: 12rpx;
  584. }
  585. .info-item .value,
  586. .code-row .value {
  587. font-size: 26rpx;
  588. color: #666;
  589. font-weight: 500;
  590. }
  591. /* Loading & Footer */
  592. .loading-more {
  593. display: flex;
  594. justify-content: center;
  595. align-items: center;
  596. padding: 30rpx 0;
  597. }
  598. .loading-text {
  599. font-size: 24rpx;
  600. color: #999;
  601. }
  602. .loading-icon {
  603. width: 32rpx;
  604. height: 32rpx;
  605. margin-right: 12rpx;
  606. animation: spin 1s linear infinite;
  607. }
  608. .empty-data {
  609. padding-top: 120rpx;
  610. }
  611. .no-more {
  612. text-align: center;
  613. color: #ccc;
  614. font-size: 24rpx;
  615. padding: 30rpx 0;
  616. }
  617. @keyframes spin {
  618. from {
  619. transform: rotate(0deg);
  620. }
  621. to {
  622. transform: rotate(360deg);
  623. }
  624. }
  625. .footer-btn-area {
  626. padding: 24rpx 32rpx calc(24rpx + env(safe-area-inset-bottom));
  627. background: #fff;
  628. box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.08);
  629. position: fixed;
  630. z-index: 100;
  631. bottom: 0;
  632. width: 100%;
  633. box-sizing: border-box;
  634. display: flex;
  635. gap: 24rpx;
  636. }
  637. .action-btn {
  638. flex: 1;
  639. height: 88rpx;
  640. line-height: 88rpx;
  641. border-radius: 44rpx;
  642. font-size: 30rpx;
  643. font-weight: 600;
  644. text-align: center;
  645. border: none;
  646. transition: all 0.3s;
  647. }
  648. .action-btn::after {
  649. border: none;
  650. }
  651. .action-btn:active {
  652. transform: scale(0.96);
  653. }
  654. .history-btn {
  655. background: #fff;
  656. color: #1890ff;
  657. border: 2rpx solid #1890ff;
  658. box-shadow: 0 4rpx 12rpx rgba(24, 144, 255, 0.1);
  659. }
  660. .export-btn {
  661. background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
  662. color: #fff;
  663. box-shadow: 0 6rpx 16rpx rgba(24, 144, 255, 0.35);
  664. }
  665. </style>