index.vue 12 KB

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