index.vue 9.4 KB

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