index.vue 9.7 KB

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