index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  1. <template>
  2. <Water></Water>
  3. <view class="nav" :style="{ paddingTop: statusBarHeight + 'px' }">
  4. <text class="nav-back" :style="{ top: statusBarHeight + 'px' }" @click="onBack"></text>
  5. <view class="nav-title">{{ title }}</view>
  6. </view>
  7. <view class="page">
  8. <view class="header-card" :style="{ paddingTop: statusBarHeight + 60 + 'px' }">
  9. <view class="meta">
  10. <view class="dot"></view>
  11. <text class="meta-text">客户名称:{{ title }}</text>
  12. </view>
  13. <view class="meta">
  14. <view class="dot"></view>
  15. <text class="meta-text">信用代码:{{ creditCode }}</text>
  16. </view>
  17. </view>
  18. <view class="list-container" :style="{ paddingTop: statusBarHeight - 30 + 'px' }">
  19. <view v-if="loading" class="empty-row">加载中...</view>
  20. <view v-else-if="products.length === 0" class="empty-row">暂无数据</view>
  21. <view v-else v-for="(prd, i) in products" :key="'prd-' + i">
  22. <view class="section-title">{{ prd.productType }}{{ prd.pkgSpec ? '(' + prd.pkgSpec + ')' : '' }}</view>
  23. <view class="card product-card">
  24. <view v-for="(c, j) in prd.upstreamDTOList" :key="'cust-' + j">
  25. <view class="customer-row" @click.stop="toggleCustomer(i, j)">
  26. <view class="customer-info-main">
  27. <view class="main-row">
  28. <text class="customer-label">上游客户:</text>
  29. <text class="customer-name highlight">{{ c.upstreamCustomer }}</text>
  30. </view>
  31. <view class="info-sub-grid">
  32. <view class="sub-item">
  33. <text class="sub-label">客户类型:</text>
  34. <text class="sub-value">{{ c.customerNature || '--' }}</text>
  35. </view>
  36. <view class="sub-item">
  37. <text class="sub-label">客户级别:</text>
  38. <text class="sub-value">{{ c.customerLevel || '--' }}</text>
  39. </view>
  40. <view class="sub-item">
  41. <text class="sub-label">责任经理:</text>
  42. <text class="sub-value">{{ c.responsibleManager || '--' }}</text>
  43. </view>
  44. </view>
  45. </view>
  46. <uni-icons type="down" size="22" color="#999" :style="{
  47. transform: c.expanded ? 'rotate(180deg)' : 'rotate(0deg)',
  48. transition: 'transform 0.3s ease-in-out',
  49. }"></uni-icons>
  50. </view>
  51. <view class="table-card" v-show="c.expanded">
  52. <scroll-view scroll-x="true" class="table-scroll">
  53. <view class="blk-table">
  54. <view class="blk-header">
  55. <view class="th col-region">货源片区</view>
  56. <view class="th col-qty">数量(盒)</view>
  57. <view class="th col-batch">批号</view>
  58. <view class="th col-sample">追溯码(抽样)</view>
  59. <view class="th col-terminal">终端到达数量(盒)</view>
  60. </view>
  61. <view class="blk-body">
  62. <view class="blk-row" v-for="(row, idx) in c.detailLineDTOList" :key="'row-' + idx">
  63. <view class="td col-region">{{ row.supplyArea }}</view>
  64. <view class="td col-qty">{{ row.quantity }}</view>
  65. <view class="td col-batch">{{ row.batchNumber }}</view>
  66. <view class="td col-sample copyable-code" @click="copyTraceCode(row.supervisionCodeSample)">{{
  67. row.supervisionCodeSample }}</view>
  68. <view class="td col-terminal">{{ row.quantity || '--' }}</view>
  69. </view>
  70. <view v-if="!c.detailLineDTOList || c.detailLineDTOList.length === 0" class="empty-row">暂无数据</view>
  71. </view>
  72. </view>
  73. </scroll-view>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. <BottomScrollTip :text="'左右滑动表格查看更多内容'" />
  81. </template>
  82. <script>
  83. import Water from "@/components/water/water.vue";
  84. import BottomScrollTip from "../../../../wigets/BottomScrollTip.vue";
  85. import request from "../../../../request/index";
  86. export default {
  87. components: {
  88. Water,
  89. BottomScrollTip
  90. },
  91. data() {
  92. return {
  93. statusBarHeight: 20,
  94. title: "黑名单详情",
  95. products: [],
  96. creditCode: "",
  97. loading: false,
  98. };
  99. },
  100. onLoad(options) {
  101. const info = uni.getSystemInfoSync();
  102. this.statusBarHeight = info.statusBarHeight || 20;
  103. const name = this.safeDecode(options && options.name);
  104. this.title = name || "黑名单详情";
  105. this.creditCode = options.id || "";
  106. this.dateStr = options.dateStr || ''
  107. this.fetchDetail(this.creditCode, options.dateStr); // 使用固定日期测试,或使用 dateStr
  108. },
  109. onShareAppMessage() {
  110. return {
  111. title: this.title || "黑名单详情",
  112. path: this.buildSharePath(),
  113. };
  114. },
  115. onShareTimeline() {
  116. return {
  117. title: this.title || "黑名单详情",
  118. query: this.buildShareQuery(),
  119. };
  120. },
  121. methods: {
  122. safeDecode(value) {
  123. const raw = value == null ? "" : String(value);
  124. if (!raw) return "";
  125. try {
  126. return decodeURIComponent(raw);
  127. } catch (e) {
  128. return raw;
  129. }
  130. },
  131. buildShareQuery() {
  132. const name = encodeURIComponent(this.title || "");
  133. const id = encodeURIComponent(this.creditCode || "");
  134. const dateStr = encodeURIComponent(this.dateStr || "");
  135. return `id=${id}&dateStr=${dateStr}&name=${name}`;
  136. },
  137. buildSharePath() {
  138. return `/traceCodePackages/traceabilityReport/pages/blacklist/detail/index?${this.buildShareQuery()}`;
  139. },
  140. copyTraceCode(code) {
  141. const text = String(code || "").trim();
  142. if (!text) {
  143. uni.showToast({ title: "无可复制内容", icon: "none" });
  144. return;
  145. }
  146. uni.setClipboardData({
  147. data: text,
  148. success: () => {
  149. uni.showToast({ title: "追溯码已复制", icon: "none" });
  150. },
  151. });
  152. },
  153. onBack() {
  154. try {
  155. uni.navigateBack();
  156. } catch (e) { }
  157. },
  158. toggleCustomer(i, j) {
  159. const cur = this.products[i].upstreamDTOList[j];
  160. this.$set(this.products[i].upstreamDTOList[j], "expanded", !cur.expanded);
  161. },
  162. fetchDetail(creditCode, billTime) {
  163. if (!creditCode) return;
  164. this.loading = true;
  165. request("/blacklist-report/get-export-company-detail", {
  166. creditCode,
  167. billTime,
  168. path: "traceabilityReport/pages/blacklist/detail/index.vue",
  169. }).then((res) => {
  170. if (res.code == 200) {
  171. this.products = this.processData(res.data || []);
  172. }
  173. this.loading = false;
  174. });
  175. },
  176. processData(data) {
  177. return data.map((prd, i) => ({
  178. ...prd,
  179. upstreamDTOList: (prd.upstreamDTOList || []).map((cust, j) => ({
  180. ...cust,
  181. expanded: i === 0 && j === 0, // 默认展开第一个
  182. })),
  183. }));
  184. },
  185. },
  186. };
  187. </script>
  188. <style scoped>
  189. .header-card {
  190. background: #2c69ff;
  191. border-bottom-left-radius: 32rpx;
  192. border-bottom-right-radius: 32rpx;
  193. padding: 36rpx;
  194. color: #fff;
  195. }
  196. .meta {
  197. display: flex;
  198. align-items: center;
  199. margin: 14rpx 0;
  200. }
  201. .dot {
  202. width: 8rpx;
  203. height: 8rpx;
  204. border-radius: 50%;
  205. background: #fff;
  206. margin-right: 20rpx;
  207. }
  208. .meta-text {
  209. font-size: 32rpx;
  210. }
  211. .nav {
  212. position: fixed;
  213. top: 0;
  214. left: 0;
  215. right: 0;
  216. height: 44px;
  217. background-color: #2c69ff;
  218. display: flex;
  219. align-items: center;
  220. justify-content: center;
  221. z-index: 10;
  222. }
  223. .nav-title {
  224. font-size: 36rpx;
  225. color: #fff;
  226. font-weight: 700;
  227. }
  228. .nav-back {
  229. position: absolute;
  230. left: 40rpx;
  231. top: 12rpx;
  232. width: 20rpx;
  233. height: 20rpx;
  234. color: #fff;
  235. border-left: 3rpx solid #fff;
  236. border-bottom: 3rpx solid #fff;
  237. transform: rotate(45deg) translateY(56rpx);
  238. margin-left: 40rpx;
  239. margin-top: -6rpx;
  240. }
  241. .page {
  242. min-height: 100vh;
  243. background: #f3f6f9;
  244. }
  245. .section-title {
  246. position: relative;
  247. font-size: 30rpx;
  248. font-weight: bold;
  249. color: #2c69ff;
  250. margin-left: 24rpx;
  251. }
  252. .section-title::after {
  253. content: "";
  254. position: absolute;
  255. left: -20rpx;
  256. bottom: 11rpx;
  257. width: 8rpx;
  258. height: 50%;
  259. background: #2c69ff;
  260. border-radius: 10px;
  261. }
  262. .list-container {
  263. padding: 0 24rpx 24rpx;
  264. box-sizing: border-box;
  265. }
  266. .card {
  267. margin: 24rpx;
  268. background: #fff;
  269. border-radius: 16rpx;
  270. font-size: 30rpx;
  271. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
  272. }
  273. .product-card {
  274. padding: 24rpx;
  275. }
  276. .product-title {
  277. font-size: 32rpx;
  278. font-weight: bold;
  279. color: #333;
  280. margin-bottom: 16rpx;
  281. }
  282. .customer-row {
  283. display: flex;
  284. align-items: flex-start;
  285. padding: 24rpx 0;
  286. border-bottom: 1rpx solid #f0f0f0;
  287. justify-content: space-between;
  288. }
  289. .customer-info-main {
  290. flex: 1;
  291. margin-right: 20rpx;
  292. }
  293. .main-row {
  294. margin-bottom: 16rpx;
  295. display: flex;
  296. align-items: center;
  297. }
  298. .customer-label {
  299. font-size: 28rpx;
  300. color: #999;
  301. flex-shrink: 0;
  302. }
  303. .customer-name {
  304. font-size: 28rpx;
  305. color: #333;
  306. }
  307. .customer-name.highlight {
  308. color: #2c69ff;
  309. font-weight: 600;
  310. font-size: 30rpx;
  311. }
  312. .info-sub-grid {
  313. display: flex;
  314. flex-wrap: wrap;
  315. gap: 16rpx 24rpx;
  316. }
  317. .sub-item {
  318. display: flex;
  319. align-items: center;
  320. min-width: 45%;
  321. }
  322. .sub-label {
  323. font-size: 24rpx;
  324. color: #bbb;
  325. flex-shrink: 0;
  326. }
  327. .sub-value {
  328. font-size: 24rpx;
  329. color: #666;
  330. font-weight: 500;
  331. }
  332. .customer-row:last-child {
  333. border-bottom: none;
  334. }
  335. .expand-tag {
  336. margin-left: auto;
  337. font-size: 26rpx;
  338. color: #2c69ff;
  339. }
  340. .table-card {
  341. padding: 0;
  342. overflow: hidden;
  343. margin-top: 16rpx;
  344. }
  345. .table-scroll {
  346. width: 100%;
  347. }
  348. .blk-table {
  349. min-width: 1150rpx;
  350. border-top: 1rpx solid #eee;
  351. border-left: 1rpx solid #eee;
  352. }
  353. .blk-header {
  354. display: flex;
  355. background: #f5f7fa;
  356. font-size: 26rpx;
  357. font-weight: bold;
  358. color: #2c69ff;
  359. }
  360. .blk-body {
  361. font-size: 26rpx;
  362. color: #666;
  363. }
  364. .blk-row {
  365. display: flex;
  366. border-bottom: 1rpx solid #eee;
  367. }
  368. .blk-row:nth-child(even) {
  369. background-color: #f7f7f7;
  370. }
  371. .th,
  372. .td {
  373. padding: 16rpx 10rpx;
  374. border-right: 1rpx solid #eee;
  375. display: flex;
  376. align-items: center;
  377. justify-content: center;
  378. text-align: center;
  379. word-break: break-all;
  380. box-sizing: border-box;
  381. flex-shrink: 0;
  382. }
  383. .th {
  384. border-bottom: 1rpx solid #eee;
  385. }
  386. .empty-row {
  387. padding: 30rpx;
  388. text-align: center;
  389. color: #999;
  390. }
  391. .col-region {
  392. width: 200rpx;
  393. }
  394. .col-qty {
  395. width: 160rpx;
  396. }
  397. .col-batch {
  398. width: 200rpx;
  399. }
  400. .col-sample {
  401. width: 325rpx;
  402. }
  403. .copyable-code {
  404. color: #2c69ff;
  405. }
  406. .col-terminal {
  407. width: 265rpx;
  408. }
  409. </style>