index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669
  1. <template>
  2. <view class="detail-page">
  3. <!-- 背景层 -->
  4. <view class="header-bg"></view>
  5. <!-- 顶部内容层 -->
  6. <view class="header-section">
  7. <view class="header-content">
  8. <view class="title-group">
  9. <text class="main-title">感冒灵大批量跨区域客户</text>
  10. <text class="sub-title"
  11. >订单维度:单笔订单实际盒数 {{ ">" }} 20000盒</text
  12. >
  13. <text class="sub-title"
  14. >地域维度:出库企业所在省份 ≠ 入库企业所在省份</text
  15. >
  16. </view>
  17. <view class="stat-box">
  18. <text class="stat-num">{{ totalCount }}</text>
  19. <text class="stat-unit">家</text>
  20. </view>
  21. </view>
  22. <view class="header-toolbar">
  23. <view class="update-tip">
  24. <!-- <text class="tip-icon">🕒</text> -->
  25. <text
  26. >更新:{{
  27. formatDate(
  28. new Date().setDate(new Date().getDate() - 1),
  29. "YYYY-MM-DD",
  30. ) || "--"
  31. }}</text
  32. >
  33. </view>
  34. </view>
  35. </view>
  36. <!-- 列表区域 -->
  37. <scroll-view
  38. class="list-scroll"
  39. scroll-y="true"
  40. refresher-enabled
  41. :refresher-triggered="isRefreshing"
  42. @refresherrefresh="onRefresh"
  43. >
  44. <view class="list-container">
  45. <view
  46. class="card-item"
  47. v-for="(item, index) in rows"
  48. :key="index"
  49. @click="toDetail(item)"
  50. >
  51. <view class="card-header">
  52. <view class="header-left">
  53. <text class="index-num">{{ index + 1 }}</text>
  54. <text class="company-name">{{ item.customerName }}</text>
  55. <text
  56. class="level-tag"
  57. :class="getLevelClass(item.customerLevel)"
  58. >
  59. {{ item.customerLevel }}
  60. </text>
  61. </view>
  62. <view class="header-right">
  63. <text class="alert-count">{{ item.totalWarningAmount }}次预警</text>
  64. </view>
  65. </view>
  66. <view class="card-body">
  67. <view class="info-grid">
  68. <view class="info-item">
  69. <text class="label">省份</text>
  70. <text class="value">{{ item.customerProvinceName }}</text>
  71. </view>
  72. <view class="info-item">
  73. <text class="label">责任人</text>
  74. <text class="value">{{ item.responsibleManager }}</text>
  75. </view>
  76. <view class="info-item">
  77. <text class="label">性质</text>
  78. <text class="value">{{ item.customerCategory }}</text>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. <view v-if="!loading && rows.length === 0" class="empty-data">
  84. <EmptyView text="无相关数据" />
  85. </view>
  86. </view>
  87. </scroll-view>
  88. <!-- 底部按钮区 -->
  89. <view class="footer-btn-area">
  90. <button class="action-btn history-btn" @click="handleHistory">
  91. 历史记录
  92. </button>
  93. <button class="action-btn export-btn" @click="handleExport">
  94. 导出至邮箱
  95. </button>
  96. </view>
  97. <!-- 蒙层 -->
  98. <view
  99. class="report-export-create-modal-mask"
  100. v-if="emailModalOpen"
  101. @click="closeEmailModal"
  102. @touchmove.stop.prevent
  103. ></view>
  104. <!-- 邮箱导出弹窗 -->
  105. <view
  106. class="report-export-create-modal report-export-create-email-modal"
  107. :class="{ 'report-export-create-modal--open': emailModalOpen }"
  108. v-if="emailModalOpen"
  109. >
  110. <view class="report-export-create-modal-title">
  111. <text>发送至邮箱</text>
  112. <view
  113. class="report-export-create-modal-close"
  114. @click.stop="closeEmailModal"
  115. >×</view
  116. >
  117. </view>
  118. <view
  119. class="report-export-create-modal-body"
  120. >
  121. <up-input
  122. v-model="emailForm.email"
  123. border="none"
  124. :customStyle="{
  125. backgroundColor: '#ebf3fb',
  126. height: '80rpx',
  127. paddingLeft: '20rpx',
  128. }"
  129. placeholder="请填写邮箱"
  130. @input="emailError = false"
  131. >
  132. <template #suffix>
  133. <view style="margin-right: 20rpx; color: #666">@999.com.cn</view>
  134. </template>
  135. </up-input>
  136. <text v-if="emailError" class="report-export-error-text"
  137. >请输入邮箱</text
  138. >
  139. </view>
  140. <view
  141. class="report-export-create-modal-footer"
  142. >
  143. <view
  144. class="report-export-create-modal-btn cancel-btn"
  145. @click.stop="closeEmailModal"
  146. >取消</view
  147. >
  148. <view
  149. class="report-export-create-modal-btn confirm-btn"
  150. @click.stop="handleSendEmail"
  151. >发送</view
  152. >
  153. </view>
  154. </view>
  155. </view>
  156. </template>
  157. <script>
  158. import EmptyView from "../../../wigets/empty.vue";
  159. import request from "../../../request/index.js";
  160. import { formatDate } from "../../../utils/utils.js";
  161. export default {
  162. components: {
  163. EmptyView,
  164. },
  165. data() {
  166. return {
  167. isRefreshing: false,
  168. loading: false,
  169. rows: [],
  170. totalCount: 0,
  171. emailModalOpen: false,
  172. emailForm: {
  173. email: "",
  174. },
  175. emailError: false,
  176. };
  177. },
  178. created() {
  179. this.resetFetch();
  180. },
  181. methods: {
  182. formatDate,
  183. getLevelClass(level) {
  184. if (level === "VIP") return "tag-vip";
  185. if (level === "二级") return "tag-l2";
  186. if (level === "三级") return "tag-l3";
  187. return "tag-default";
  188. },
  189. fetchList() {
  190. if (this.loading) return;
  191. this.loading = true;
  192. request(
  193. `/report/ganmaoling/list`,
  194. {
  195. days: 1,
  196. path: "traceabilityReport/pages/ganmaoling/index.vue",
  197. },
  198. "get",
  199. ).then((res) => {
  200. if (res.code == 200) {
  201. this.rows = res.data || [];
  202. this.totalCount = res.data?.length || 0;
  203. }
  204. this.loading = false;
  205. this.isRefreshing = false;
  206. });
  207. },
  208. async onRefresh() {
  209. this.isRefreshing = true;
  210. this.fetchList();
  211. },
  212. resetFetch() {
  213. this.rows = [];
  214. this.fetchList();
  215. },
  216. toDetail(item) {
  217. uni.navigateTo({
  218. url: `/traceCodePackages/traceabilityReport/pages/ganmaoling/detail/index?name=${encodeURIComponent(item.customerName)}&updatedTime=${item.updatedTime || ""}`,
  219. });
  220. },
  221. handleExport() {
  222. this.emailModalOpen = true;
  223. this.emailForm.email = "";
  224. this.emailError = false;
  225. },
  226. closeEmailModal() {
  227. this.emailModalOpen = false;
  228. },
  229. handleSendEmail() {
  230. if (!this.emailForm.email) {
  231. this.emailError = true;
  232. return;
  233. }
  234. uni.showLoading({ title: "发送中..." });
  235. request(
  236. `/report/ganmaoling/list`,
  237. {
  238. days: 1,
  239. email: this.emailForm.email + "@999.com.cn",
  240. path: "traceabilityReport/pages/ganmaoling/index.vue",
  241. },
  242. "get",
  243. ).then((res) => {
  244. uni.hideLoading();
  245. if (res.code == 200) {
  246. uni.showToast({
  247. title: "发送成功",
  248. icon: "success",
  249. });
  250. this.closeEmailModal();
  251. } else {
  252. uni.showToast({
  253. title: res.msg || "发送失败",
  254. icon: "none",
  255. });
  256. }
  257. });
  258. },
  259. handleHistory() {
  260. uni.navigateTo({
  261. url: "/traceCodePackages/traceabilityReport/pages/ganmaoling/history/index",
  262. });
  263. },
  264. },
  265. };
  266. </script>
  267. <style scoped>
  268. .detail-page {
  269. display: flex;
  270. flex-direction: column;
  271. height: calc(100vh - 116rpx - env(safe-area-inset-bottom));
  272. box-sizing: border-box;
  273. background: #f5f7fa;
  274. position: relative;
  275. }
  276. /* Header Background Layer */
  277. .header-bg {
  278. position: absolute;
  279. top: 0;
  280. left: 0;
  281. width: 100%;
  282. height: 320rpx; /* Fixed height for background */
  283. background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
  284. border-bottom-left-radius: 40rpx;
  285. border-bottom-right-radius: 40rpx;
  286. z-index: 1;
  287. box-shadow: 0 10rpx 30rpx rgba(24, 144, 255, 0.2);
  288. }
  289. /* Header Content Layer */
  290. .header-section {
  291. padding: 40rpx 40rpx 80rpx;
  292. position: relative;
  293. z-index: 3; /* Above List */
  294. color: #fff;
  295. /* Transparent background to allow overlap effect */
  296. }
  297. .header-content {
  298. display: flex;
  299. justify-content: space-between;
  300. align-items: flex-start;
  301. position: relative;
  302. z-index: 2;
  303. margin-bottom: 30rpx;
  304. }
  305. .title-group {
  306. display: flex;
  307. flex-direction: column;
  308. flex: 1;
  309. margin-right: 20rpx;
  310. }
  311. .main-title {
  312. font-size: 44rpx;
  313. font-weight: bold;
  314. margin-bottom: 16rpx;
  315. letter-spacing: 2rpx;
  316. line-height: 1.2;
  317. }
  318. .sub-title {
  319. font-size: 24rpx;
  320. opacity: 0.9;
  321. margin-bottom: 8rpx;
  322. line-height: 1.4;
  323. }
  324. .stat-box {
  325. display: flex;
  326. align-items: baseline;
  327. }
  328. .stat-num {
  329. font-size: 56rpx;
  330. font-weight: bold;
  331. margin-right: 8rpx;
  332. font-family: "DINAlternate-Bold", sans-serif;
  333. }
  334. .stat-unit {
  335. font-size: 24rpx;
  336. opacity: 0.8;
  337. }
  338. .header-toolbar {
  339. display: flex;
  340. justify-content: space-between;
  341. align-items: center;
  342. position: relative;
  343. z-index: 3;
  344. }
  345. .update-tip {
  346. display: inline-flex;
  347. align-items: center;
  348. background: rgba(255, 255, 255, 0.15);
  349. padding: 8rpx 20rpx;
  350. border-radius: 30rpx;
  351. font-size: 22rpx;
  352. backdrop-filter: blur(10px);
  353. }
  354. .tip-icon {
  355. margin-right: 8rpx;
  356. font-size: 20rpx;
  357. }
  358. /* List Section */
  359. .list-scroll {
  360. flex: 1;
  361. height: 0;
  362. padding: 0 24rpx;
  363. box-sizing: border-box;
  364. margin-top: -50rpx; /* Overlap effect */
  365. position: relative;
  366. z-index: 2; /* Between bg and header content */
  367. }
  368. .list-container {
  369. padding-top: 10rpx;
  370. padding-bottom: calc(200rpx + env(safe-area-inset-bottom));
  371. }
  372. .card-item {
  373. background: #fff;
  374. border-radius: 20rpx;
  375. padding: 30rpx;
  376. margin-bottom: 24rpx;
  377. box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.05);
  378. transition: transform 0.2s;
  379. }
  380. .card-item:active {
  381. transform: scale(0.99);
  382. }
  383. .card-header {
  384. display: flex;
  385. justify-content: space-between;
  386. align-items: flex-start;
  387. margin-bottom: 24rpx;
  388. }
  389. .header-left {
  390. flex: 1;
  391. display: flex;
  392. align-items: center;
  393. flex-wrap: wrap;
  394. margin-right: 20rpx;
  395. gap: 12rpx;
  396. }
  397. .index-num {
  398. font-size: 24rpx;
  399. color: #999;
  400. font-family: monospace;
  401. }
  402. .company-name {
  403. font-size: 32rpx;
  404. font-weight: 600;
  405. color: #096dd9;
  406. line-height: 1.4;
  407. text-decoration: underline;
  408. }
  409. .level-tag {
  410. font-size: 20rpx;
  411. padding: 4rpx 12rpx;
  412. border-radius: 8rpx;
  413. white-space: nowrap;
  414. line-height: 1.2;
  415. }
  416. .header-right {
  417. flex-shrink: 0;
  418. }
  419. .tag-vip {
  420. background: linear-gradient(135deg, #e6f7ff, #bae7ff);
  421. color: #096dd9;
  422. }
  423. .tag-l2 {
  424. background: linear-gradient(135deg, #f6ffed, #d9f7be);
  425. color: #389e0d;
  426. }
  427. .tag-l3 {
  428. background: linear-gradient(135deg, #fff7e6, #ffe7ba);
  429. color: #d46b08;
  430. }
  431. .tag-default {
  432. background: #f5f5f5;
  433. color: #999;
  434. }
  435. .card-body {
  436. background: #f9fbfd;
  437. border-radius: 12rpx;
  438. padding: 24rpx;
  439. }
  440. .info-grid {
  441. display: flex;
  442. flex-wrap: wrap;
  443. gap: 24rpx;
  444. }
  445. .info-item {
  446. display: flex;
  447. align-items: center;
  448. min-width: 45%;
  449. }
  450. .info-item .label {
  451. font-size: 24rpx;
  452. color: #999;
  453. margin-right: 12rpx;
  454. }
  455. .info-item .value {
  456. font-size: 26rpx;
  457. color: #666;
  458. font-weight: 500;
  459. }
  460. .alert-count {
  461. font-size: 22rpx;
  462. color: #ff4d4f;
  463. background: rgba(255, 77, 79, 0.1);
  464. padding: 6rpx 16rpx;
  465. border-radius: 20rpx;
  466. font-weight: 600;
  467. }
  468. .empty-data {
  469. padding-top: 120rpx;
  470. }
  471. .footer-btn-area {
  472. padding: 24rpx 32rpx calc(24rpx + env(safe-area-inset-bottom));
  473. background: #fff;
  474. box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.08);
  475. position: fixed;
  476. z-index: 100;
  477. bottom: 0;
  478. width: 100%;
  479. box-sizing: border-box;
  480. display: flex;
  481. gap: 24rpx;
  482. }
  483. .action-btn {
  484. flex: 1;
  485. height: 88rpx;
  486. line-height: 88rpx;
  487. border-radius: 44rpx;
  488. font-size: 30rpx;
  489. font-weight: 600;
  490. text-align: center;
  491. border: none;
  492. transition: all 0.3s;
  493. }
  494. .action-btn::after {
  495. border: none;
  496. }
  497. .action-btn:active {
  498. transform: scale(0.96);
  499. }
  500. .history-btn {
  501. background: #fff;
  502. color: #1890ff;
  503. border: 2rpx solid #1890ff;
  504. box-shadow: 0 4rpx 12rpx rgba(24, 144, 255, 0.1);
  505. }
  506. .export-btn {
  507. background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
  508. color: #fff;
  509. box-shadow: 0 6rpx 16rpx rgba(24, 144, 255, 0.35);
  510. }
  511. /* 弹窗样式 */
  512. .report-export-create-modal-mask {
  513. position: fixed;
  514. top: 0;
  515. left: 0;
  516. right: 0;
  517. bottom: 0;
  518. background: rgba(0, 0, 0, 0.6);
  519. z-index: 999;
  520. backdrop-filter: blur(2px);
  521. }
  522. .report-export-create-modal {
  523. position: fixed;
  524. z-index: 1000;
  525. background: #fff;
  526. transition: all 0.3s ease;
  527. }
  528. .report-export-create-email-modal {
  529. top: 50%;
  530. left: 50%;
  531. transform: translate(-50%, -50%);
  532. width: 620rpx;
  533. border-radius: 24rpx;
  534. opacity: 0;
  535. visibility: hidden;
  536. overflow: hidden;
  537. }
  538. .report-export-create-email-modal.report-export-create-modal--open {
  539. opacity: 1;
  540. visibility: visible;
  541. }
  542. .report-export-create-modal-title {
  543. padding: 36rpx 32rpx;
  544. font-size: 36rpx;
  545. color: #333;
  546. text-align: center;
  547. font-weight: 600;
  548. border-bottom: 1rpx solid #f0f0f0;
  549. position: relative;
  550. }
  551. .report-export-create-modal-close {
  552. position: absolute;
  553. right: 32rpx;
  554. top: 50%;
  555. transform: translateY(-50%);
  556. font-size: 44rpx;
  557. color: #999;
  558. line-height: 1;
  559. padding: 10rpx;
  560. }
  561. .report-export-create-modal-body {
  562. padding: 48rpx 40rpx 32rpx;
  563. }
  564. .report-export-error-text {
  565. font-size: 24rpx;
  566. color: #ff4d4f;
  567. margin-top: 12rpx;
  568. display: block;
  569. }
  570. .report-export-create-modal-footer {
  571. padding: 0 40rpx 48rpx;
  572. display: flex;
  573. justify-content: space-between;
  574. gap: 24rpx;
  575. }
  576. .report-export-create-modal-btn {
  577. height: 88rpx;
  578. line-height: 88rpx;
  579. border-radius: 44rpx;
  580. text-align: center;
  581. font-size: 30rpx;
  582. font-weight: 600;
  583. flex: 1;
  584. margin: 0;
  585. }
  586. .cancel-btn {
  587. background: #f5f7fa;
  588. color: #666;
  589. border: 1rpx solid #e4e7ed;
  590. }
  591. .confirm-btn {
  592. background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
  593. color: #fff;
  594. box-shadow: 0 6rpx 16rpx rgba(24, 144, 255, 0.3);
  595. }
  596. </style>