index.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  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.customerLevel || '--' }}</text>
  35. </view>
  36. <view class="sub-item">
  37. <text class="sub-label">客户类型:</text>
  38. <text class="sub-value">{{ c.customerNature || '--' }}</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. </template>
  81. <script>
  82. import Water from "@/components/water/water.vue";
  83. import request from "../../../../request/index";
  84. export default {
  85. components: {
  86. Water,
  87. },
  88. data() {
  89. return {
  90. statusBarHeight: 20,
  91. title: "黑名单详情",
  92. products: [],
  93. creditCode: "",
  94. loading: false,
  95. };
  96. },
  97. onLoad(options) {
  98. const info = uni.getSystemInfoSync();
  99. this.statusBarHeight = info.statusBarHeight || 20;
  100. const name =
  101. options && options.name ? decodeURIComponent(options.name) : "";
  102. this.title = name || "黑名单详情";
  103. this.creditCode = options.id || "";
  104. this.dateStr = options.dateStr || ''
  105. this.fetchDetail(this.creditCode, options.dateStr); // 使用固定日期测试,或使用 dateStr
  106. },
  107. methods: {
  108. copyTraceCode(code) {
  109. const text = String(code || "").trim();
  110. if (!text) {
  111. uni.showToast({ title: "无可复制内容", icon: "none" });
  112. return;
  113. }
  114. uni.setClipboardData({
  115. data: text,
  116. success: () => {
  117. uni.showToast({ title: "追溯码已复制", icon: "none" });
  118. },
  119. });
  120. },
  121. onBack() {
  122. try {
  123. uni.navigateBack();
  124. } catch (e) { }
  125. },
  126. toggleCustomer(i, j) {
  127. const cur = this.products[i].upstreamDTOList[j];
  128. this.$set(this.products[i].upstreamDTOList[j], "expanded", !cur.expanded);
  129. },
  130. fetchDetail(creditCode, billTime) {
  131. if (!creditCode) return;
  132. this.loading = true;
  133. request("/blacklist-report/get-export-company-detail", {
  134. creditCode,
  135. billTime,
  136. path: "traceabilityReport/pages/blacklist/detail/index.vue",
  137. }).then((res) => {
  138. if (res.code == 200) {
  139. this.products = this.processData(res.data || []);
  140. }
  141. this.loading = false;
  142. });
  143. },
  144. processData(data) {
  145. return data.map((prd, i) => ({
  146. ...prd,
  147. upstreamDTOList: (prd.upstreamDTOList || []).map((cust, j) => ({
  148. ...cust,
  149. expanded: i === 0 && j === 0, // 默认展开第一个
  150. })),
  151. }));
  152. },
  153. },
  154. };
  155. </script>
  156. <style scoped>
  157. .header-card {
  158. background: #2c69ff;
  159. border-bottom-left-radius: 32rpx;
  160. border-bottom-right-radius: 32rpx;
  161. padding: 36rpx;
  162. color: #fff;
  163. }
  164. .meta {
  165. display: flex;
  166. align-items: center;
  167. margin: 14rpx 0;
  168. }
  169. .dot {
  170. width: 8rpx;
  171. height: 8rpx;
  172. border-radius: 50%;
  173. background: #fff;
  174. margin-right: 20rpx;
  175. }
  176. .meta-text {
  177. font-size: 32rpx;
  178. }
  179. .nav {
  180. position: fixed;
  181. top: 0;
  182. left: 0;
  183. right: 0;
  184. height: 44px;
  185. background-color: #2c69ff;
  186. display: flex;
  187. align-items: center;
  188. justify-content: center;
  189. z-index: 10;
  190. }
  191. .nav-title {
  192. font-size: 36rpx;
  193. color: #fff;
  194. font-weight: 700;
  195. }
  196. .nav-back {
  197. position: absolute;
  198. left: 40rpx;
  199. top: 12rpx;
  200. width: 20rpx;
  201. height: 20rpx;
  202. color: #fff;
  203. border-left: 3rpx solid #fff;
  204. border-bottom: 3rpx solid #fff;
  205. transform: rotate(45deg) translateY(56rpx);
  206. margin-left: 40rpx;
  207. margin-top: -6rpx;
  208. }
  209. .page {
  210. min-height: 100vh;
  211. background: #f3f6f9;
  212. }
  213. .section-title {
  214. position: relative;
  215. font-size: 30rpx;
  216. font-weight: bold;
  217. color: #2c69ff;
  218. margin-left: 24rpx;
  219. }
  220. .section-title::after {
  221. content: "";
  222. position: absolute;
  223. left: -20rpx;
  224. bottom: 11rpx;
  225. width: 8rpx;
  226. height: 50%;
  227. background: #2c69ff;
  228. border-radius: 10px;
  229. }
  230. .list-container {
  231. padding: 0 24rpx 24rpx;
  232. box-sizing: border-box;
  233. }
  234. .card {
  235. margin: 24rpx;
  236. background: #fff;
  237. border-radius: 16rpx;
  238. font-size: 30rpx;
  239. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
  240. }
  241. .product-card {
  242. padding: 24rpx;
  243. }
  244. .product-title {
  245. font-size: 32rpx;
  246. font-weight: bold;
  247. color: #333;
  248. margin-bottom: 16rpx;
  249. }
  250. .customer-row {
  251. display: flex;
  252. align-items: flex-start;
  253. padding: 24rpx 0;
  254. border-bottom: 1rpx solid #f0f0f0;
  255. justify-content: space-between;
  256. }
  257. .customer-info-main {
  258. flex: 1;
  259. margin-right: 20rpx;
  260. }
  261. .main-row {
  262. margin-bottom: 16rpx;
  263. display: flex;
  264. align-items: center;
  265. }
  266. .customer-label {
  267. font-size: 28rpx;
  268. color: #999;
  269. flex-shrink: 0;
  270. }
  271. .customer-name {
  272. font-size: 28rpx;
  273. color: #333;
  274. }
  275. .customer-name.highlight {
  276. color: #2c69ff;
  277. font-weight: 600;
  278. font-size: 30rpx;
  279. }
  280. .info-sub-grid {
  281. display: flex;
  282. flex-wrap: wrap;
  283. gap: 16rpx 24rpx;
  284. }
  285. .sub-item {
  286. display: flex;
  287. align-items: center;
  288. min-width: 45%;
  289. }
  290. .sub-label {
  291. font-size: 24rpx;
  292. color: #bbb;
  293. flex-shrink: 0;
  294. }
  295. .sub-value {
  296. font-size: 24rpx;
  297. color: #666;
  298. font-weight: 500;
  299. }
  300. .customer-row:last-child {
  301. border-bottom: none;
  302. }
  303. .expand-tag {
  304. margin-left: auto;
  305. font-size: 26rpx;
  306. color: #2c69ff;
  307. }
  308. .table-card {
  309. padding: 0;
  310. overflow: hidden;
  311. margin-top: 16rpx;
  312. }
  313. .table-scroll {
  314. width: 100%;
  315. }
  316. .blk-table {
  317. min-width: 1080rpx;
  318. border-top: 1rpx solid #eee;
  319. border-left: 1rpx solid #eee;
  320. }
  321. .blk-header {
  322. display: flex;
  323. background: #f5f7fa;
  324. font-size: 26rpx;
  325. font-weight: bold;
  326. color: #2c69ff;
  327. }
  328. .blk-body {
  329. font-size: 26rpx;
  330. color: #666;
  331. }
  332. .blk-row {
  333. display: flex;
  334. border-bottom: 1rpx solid #eee;
  335. }
  336. .blk-row:nth-child(even) {
  337. background-color: #f7f7f7;
  338. }
  339. .th,
  340. .td {
  341. padding: 16rpx 10rpx;
  342. border-right: 1rpx solid #eee;
  343. display: flex;
  344. align-items: center;
  345. justify-content: center;
  346. text-align: center;
  347. word-break: break-all;
  348. box-sizing: border-box;
  349. flex-shrink: 0;
  350. }
  351. .th {
  352. border-bottom: 1rpx solid #eee;
  353. }
  354. .empty-row {
  355. padding: 30rpx;
  356. text-align: center;
  357. color: #999;
  358. }
  359. .col-region {
  360. width: 200rpx;
  361. }
  362. .col-qty {
  363. width: 140rpx;
  364. }
  365. .col-batch {
  366. width: 200rpx;
  367. }
  368. .col-sample {
  369. width: 320rpx;
  370. }
  371. .copyable-code {
  372. color: #2c69ff;
  373. }
  374. .col-terminal {
  375. width: 220rpx;
  376. }
  377. </style>