index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  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="update-tip">
  16. <text class="tip-icon">🕒</text>
  17. <text
  18. >数据更新时间:{{
  19. formatDate(
  20. new Date().setDate(new Date().getDate() - 1),
  21. "YYYY-MM-DD",
  22. ) || "--"
  23. }}</text
  24. >
  25. </view>
  26. <!-- 背景装饰 -->
  27. <view class="header-circle circle-1"></view>
  28. <view class="header-circle circle-2"></view>
  29. </view>
  30. <scroll-view
  31. class="list-scroll"
  32. scroll-y="true"
  33. refresher-enabled
  34. :refresher-triggered="isRefreshing"
  35. @refresherrefresh="onRefresh"
  36. @scrolltolower="onLoadMore"
  37. >
  38. <view class="list-container">
  39. <view
  40. class="card-item"
  41. v-for="(item, index) in rows"
  42. :key="index"
  43. @click="toDetail(item)"
  44. >
  45. <view class="card-header">
  46. <view class="header-left">
  47. <text class="index-num">{{ index + 1 }}</text>
  48. <text class="company-name">{{ item.receiverName }}</text>
  49. </view>
  50. <view class="header-right">
  51. <text class="status-tag">黑名单</text>
  52. </view>
  53. </view>
  54. <view class="card-body">
  55. <view class="code-row">
  56. <text class="label">信用代码:</text>
  57. <text class="value code-text">{{ item.companyCode }}</text>
  58. </view>
  59. <view class="info-grid">
  60. <view class="info-item">
  61. <text class="label">省份</text>
  62. <text class="value">{{ item.receiverProvince }}</text>
  63. </view>
  64. <view class="info-item">
  65. <text class="label">性质</text>
  66. <text class="value">{{ item.customerNature }}</text>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. <view class="loading-more" v-if="loading">
  72. <image
  73. class="loading-icon"
  74. src="../../../static/images/loading.png"
  75. />
  76. <text class="loading-text">加载中...</text>
  77. </view>
  78. <view v-if="!loading && rows.length === 0" class="empty-data">
  79. <EmptyView text="无相关数据" />
  80. </view>
  81. <view v-if="!hasMore && rows.length > 0" class="no-more">
  82. <text>没有更多数据了</text>
  83. </view>
  84. </view>
  85. </scroll-view>
  86. <view class="footer-btn-area">
  87. <button class="action-btn export-btn" @click="handleExport">
  88. 导出至邮箱
  89. </button>
  90. </view>
  91. </view>
  92. </template>
  93. <script>
  94. import EmptyView from "../../../wigets/empty.vue";
  95. import request from "../../../request/index.js";
  96. import { formatDate } from "../../../utils/utils.js";
  97. const PROVINCES = ["北京市", "上海市", "广东省", "浙江省", "江苏省"];
  98. const NATURES = ["协议客户", "非协议客户", "商业客户", "终端客户"];
  99. export default {
  100. components: {
  101. EmptyView,
  102. },
  103. data() {
  104. return {
  105. isRefreshing: false,
  106. loading: false,
  107. rows: [],
  108. totalCount: 60, // Simulated total count
  109. hasMore: true,
  110. pageNum: 1,
  111. pageSize: 20,
  112. };
  113. },
  114. created() {
  115. this.resetFetch();
  116. },
  117. methods: {
  118. formatDate,
  119. generateFakeData() {
  120. const newRows = [];
  121. const codes = [
  122. "91370104771001730R",
  123. "91420105783155681H",
  124. "91330110MA2CCJE32Y",
  125. "91441581761581268X",
  126. "91510106768621824L",
  127. ];
  128. const startIdx = (this.pageNum - 1) * this.pageSize;
  129. const endIdx = Math.min(startIdx + this.pageSize, this.totalCount);
  130. if (startIdx >= this.totalCount) {
  131. this.hasMore = false;
  132. return [];
  133. }
  134. for (let i = startIdx; i < endIdx; i++) {
  135. newRows.push({
  136. id: i,
  137. receiverName: `测试收货企业${i + 1}有限公司`,
  138. companyCode: codes[i % codes.length],
  139. receiverProvince: PROVINCES[i % PROVINCES.length],
  140. customerNature: NATURES[i % NATURES.length],
  141. });
  142. }
  143. return newRows;
  144. },
  145. async onRefresh() {
  146. this.isRefreshing = true;
  147. this.pageNum = 1;
  148. this.hasMore = true;
  149. // Simulate network request
  150. setTimeout(() => {
  151. this.rows = this.generateFakeData();
  152. this.isRefreshing = false;
  153. }, 1000);
  154. },
  155. onLoadMore() {
  156. if (this.loading || !this.hasMore) return;
  157. this.loading = true;
  158. this.pageNum++;
  159. // Simulate network request
  160. setTimeout(() => {
  161. const more = this.generateFakeData();
  162. if (more.length > 0) {
  163. this.rows = [...this.rows, ...more];
  164. } else {
  165. this.hasMore = false;
  166. }
  167. this.loading = false;
  168. }, 800);
  169. },
  170. resetFetch() {
  171. this.loading = true;
  172. this.pageNum = 1;
  173. this.hasMore = true;
  174. // Simulate initial load
  175. setTimeout(() => {
  176. this.rows = this.generateFakeData();
  177. this.loading = false;
  178. }, 500);
  179. },
  180. toDetail(item) {
  181. uni.navigateTo({
  182. url: `/traceCodePackages/traceabilityReport/pages/blacklist/detail/index?id=${item.id}&name=${encodeURIComponent(item.receiverName)}`,
  183. });
  184. },
  185. handleExport() {
  186. uni.showModal({
  187. title: "导出至邮箱",
  188. editable: true,
  189. placeholderText: "请输入邮箱地址",
  190. success: (res) => {
  191. if (res.confirm) {
  192. if (!res.content) {
  193. uni.showToast({
  194. title: "请输入邮箱",
  195. icon: "none",
  196. });
  197. return;
  198. }
  199. uni.showToast({
  200. title: "导出请求已发送",
  201. icon: "success",
  202. });
  203. }
  204. },
  205. });
  206. },
  207. },
  208. };
  209. </script>
  210. <style scoped>
  211. .detail-page {
  212. display: flex;
  213. flex-direction: column;
  214. height: calc(100vh - 116rpx - env(safe-area-inset-bottom));
  215. box-sizing: border-box;
  216. background: #f5f7fa;
  217. }
  218. /* Header Section */
  219. .header-section {
  220. background: linear-gradient(135deg, #2b32b2 0%, #1488cc 100%);
  221. padding: 40rpx 40rpx 80rpx; /* Extra padding at bottom for overlap effect */
  222. position: relative;
  223. z-index: 20;
  224. color: #fff;
  225. border-bottom-left-radius: 40rpx;
  226. border-bottom-right-radius: 40rpx;
  227. overflow: hidden;
  228. box-shadow: 0 10rpx 30rpx rgba(20, 136, 204, 0.2);
  229. }
  230. .header-content {
  231. display: flex;
  232. justify-content: space-between;
  233. align-items: center;
  234. position: relative;
  235. z-index: 2;
  236. margin-bottom: 24rpx;
  237. }
  238. .title-group {
  239. display: flex;
  240. flex-direction: column;
  241. }
  242. .main-title {
  243. font-size: 40rpx;
  244. font-weight: bold;
  245. margin-bottom: 8rpx;
  246. letter-spacing: 2rpx;
  247. }
  248. .sub-title {
  249. font-size: 24rpx;
  250. opacity: 0.8;
  251. }
  252. .stat-box {
  253. display: flex;
  254. align-items: baseline;
  255. }
  256. .stat-num {
  257. font-size: 56rpx;
  258. font-weight: bold;
  259. margin-right: 8rpx;
  260. font-family: "DINAlternate-Bold", sans-serif;
  261. }
  262. .stat-unit {
  263. font-size: 24rpx;
  264. opacity: 0.8;
  265. }
  266. .update-tip {
  267. display: inline-flex;
  268. align-items: center;
  269. background: rgba(255, 255, 255, 0.15);
  270. padding: 8rpx 20rpx;
  271. border-radius: 30rpx;
  272. font-size: 22rpx;
  273. backdrop-filter: blur(10px);
  274. position: relative;
  275. z-index: 2;
  276. }
  277. .tip-icon {
  278. margin-right: 8rpx;
  279. font-size: 20rpx;
  280. }
  281. /* Header Decor Circles */
  282. .header-circle {
  283. position: absolute;
  284. border-radius: 50%;
  285. background: rgba(255, 255, 255, 0.05);
  286. }
  287. .circle-1 {
  288. width: 300rpx;
  289. height: 300rpx;
  290. top: -100rpx;
  291. right: -50rpx;
  292. }
  293. .circle-2 {
  294. width: 200rpx;
  295. height: 200rpx;
  296. bottom: -50rpx;
  297. left: -50rpx;
  298. }
  299. /* List Scroll */
  300. .list-scroll {
  301. flex: 1;
  302. height: 0;
  303. padding: 0 24rpx; /* Remove vertical padding from scroll container */
  304. box-sizing: border-box;
  305. margin-top: -50rpx; /* Negative margin to pull list up */
  306. position: relative;
  307. z-index: 21;
  308. }
  309. .list-container {
  310. padding-top: 10rpx;
  311. padding-bottom: calc(200rpx + env(safe-area-inset-bottom));
  312. }
  313. .card-item {
  314. background: #fff;
  315. border-radius: 20rpx;
  316. padding: 30rpx;
  317. margin-bottom: 24rpx;
  318. box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.05);
  319. transition: transform 0.2s;
  320. }
  321. .card-item:active {
  322. transform: scale(0.99);
  323. }
  324. .card-header {
  325. display: flex;
  326. justify-content: space-between;
  327. align-items: flex-start;
  328. margin-bottom: 24rpx;
  329. }
  330. .header-left {
  331. flex: 1;
  332. display: flex;
  333. align-items: center;
  334. margin-right: 20rpx;
  335. }
  336. .index-num {
  337. font-size: 24rpx;
  338. color: #999;
  339. margin-right: 12rpx;
  340. font-family: monospace;
  341. }
  342. .company-name {
  343. font-size: 32rpx;
  344. font-weight: 600;
  345. color: #333;
  346. line-height: 1.4;
  347. }
  348. .header-right {
  349. flex-shrink: 0;
  350. }
  351. .status-tag {
  352. font-size: 20rpx;
  353. padding: 6rpx 16rpx;
  354. border-radius: 20rpx;
  355. background: #fff1f0;
  356. color: #ff4d4f;
  357. font-weight: 600;
  358. border: 1rpx solid rgba(255, 77, 79, 0.2);
  359. }
  360. .card-body {
  361. background: #f9fbfd;
  362. border-radius: 12rpx;
  363. padding: 24rpx;
  364. }
  365. .code-row {
  366. display: flex;
  367. align-items: center;
  368. margin-bottom: 20rpx;
  369. padding-bottom: 20rpx;
  370. border-bottom: 1rpx solid #edf0f5;
  371. }
  372. .code-row:last-child {
  373. margin-bottom: 0;
  374. padding-bottom: 0;
  375. border-bottom: none;
  376. }
  377. .code-text {
  378. font-family: monospace;
  379. color: #333 !important;
  380. font-weight: 600 !important;
  381. letter-spacing: 1rpx;
  382. }
  383. .info-grid {
  384. display: flex;
  385. flex-wrap: wrap;
  386. gap: 24rpx;
  387. }
  388. .info-item {
  389. display: flex;
  390. align-items: center;
  391. width: 45%;
  392. }
  393. .info-item .label,
  394. .code-row .label {
  395. font-size: 24rpx;
  396. color: #999;
  397. margin-right: 12rpx;
  398. }
  399. .info-item .value,
  400. .code-row .value {
  401. font-size: 26rpx;
  402. color: #666;
  403. font-weight: 500;
  404. }
  405. /* Loading & Footer */
  406. .loading-more {
  407. display: flex;
  408. justify-content: center;
  409. align-items: center;
  410. padding: 30rpx 0;
  411. }
  412. .loading-text {
  413. font-size: 24rpx;
  414. color: #999;
  415. }
  416. .loading-icon {
  417. width: 32rpx;
  418. height: 32rpx;
  419. margin-right: 12rpx;
  420. animation: spin 1s linear infinite;
  421. }
  422. .empty-data {
  423. padding-top: 120rpx;
  424. }
  425. .no-more {
  426. text-align: center;
  427. color: #ccc;
  428. font-size: 24rpx;
  429. padding: 30rpx 0;
  430. }
  431. @keyframes spin {
  432. from {
  433. transform: rotate(0deg);
  434. }
  435. to {
  436. transform: rotate(360deg);
  437. }
  438. }
  439. .footer-btn-area {
  440. padding: 24rpx 32rpx calc(24rpx + env(safe-area-inset-bottom));
  441. background: #fff;
  442. box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.08);
  443. position: fixed;
  444. z-index: 100;
  445. bottom: 0;
  446. width: 100%;
  447. box-sizing: border-box;
  448. }
  449. .action-btn {
  450. width: 100%;
  451. height: 88rpx;
  452. line-height: 88rpx;
  453. border-radius: 44rpx;
  454. font-size: 30rpx;
  455. font-weight: 600;
  456. text-align: center;
  457. border: none;
  458. transition: all 0.3s;
  459. }
  460. .action-btn::after {
  461. border: none;
  462. }
  463. .action-btn:active {
  464. transform: scale(0.96);
  465. }
  466. .export-btn {
  467. background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
  468. color: #fff;
  469. box-shadow: 0 6rpx 16rpx rgba(24, 144, 255, 0.35);
  470. }
  471. </style>