index.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  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"
  19. >所在省份:{{ customerProvinceName || "--" }}</text
  20. >
  21. </view>
  22. <view class="meta">
  23. <view class="dot"></view>
  24. <text class="meta-text">客户性质:{{ customerCategory || "--" }}</text>
  25. </view>
  26. <view class="meta">
  27. <view class="dot"></view>
  28. <text class="meta-text">客户等级:{{ customerLevel || "--" }}</text>
  29. </view>
  30. <view class="meta">
  31. <view class="dot"></view>
  32. <text class="meta-text"
  33. >责任经理:{{ responsibleManager || "--" }}</text
  34. >
  35. </view>
  36. <view class="meta">
  37. <view class="dot"></view>
  38. <text class="meta-text"
  39. >累计预警次数:{{
  40. totalWarningAmount || totalWarningAmount == 0
  41. ? totalWarningAmount
  42. : "--"
  43. }}</text
  44. >
  45. </view>
  46. </view>
  47. <view class="section-title">流转信息</view>
  48. <view class="card table-card">
  49. <scroll-view scroll-x="true" class="table-scroll">
  50. <view class="flow-table">
  51. <view class="flow-header">
  52. <view class="th col-company">收货企业</view>
  53. <view class="th col-toCustomerCategory">客户性质</view>
  54. <view class="th col-toCustomerLevel">客户等级</view>
  55. <view class="th col-toResponsibleManager">责任经理</view>
  56. <view class="th col-time">单据时间</view>
  57. <view class="th col-type">单据类型</view>
  58. <view class="th col-product">产品名称</view>
  59. <view class="th col-batch">批号</view>
  60. <view class="th col-source">货源地</view>
  61. <view class="th col-qty">数量(盒)</view>
  62. <view class="th col-code">追溯码(抽样)</view>
  63. </view>
  64. <view class="flow-body">
  65. <view
  66. class="flow-row"
  67. v-for="(item, index) in flowList"
  68. :key="index"
  69. >
  70. <view class="th col-company">{{ item.toEntName }}</view>
  71. <view class="td col-toCustomerCategory">{{
  72. item.toCustomerCategory
  73. }}</view>
  74. <view class="td col-toCustomerLevel">{{
  75. item.toCustomerLevel
  76. }}</view>
  77. <view class="td col-toResponsibleManager">{{
  78. item.toResponsibleManager
  79. }}</view>
  80. <view class="td col-time">{{ item.billTime }}</view>
  81. <view class="td col-type">{{ item.billType }}</view>
  82. <view class="td col-product">{{ item.productName }}</view>
  83. <view class="td col-batch">{{ item.productBatchNo }}</view>
  84. <view class="td col-source">{{ item.regionName }}</view>
  85. <view class="td col-qty">{{ item.fromQty }}</view>
  86. <view
  87. class="td col-code copyable-code"
  88. @click="copyTraceCode(item.traceCode)"
  89. >{{ item.traceCode }}</view
  90. >
  91. <!-- <view class="td col-chain chain-text">{{ item.batchTraceLink }}</view> -->
  92. </view>
  93. <view v-if="flowList.length === 0" class="empty-row">暂无数据</view>
  94. </view>
  95. </view>
  96. </scroll-view>
  97. </view>
  98. </view>
  99. <BottomScrollTip :text="'左右滑动表格查看更多内容'" />
  100. </template>
  101. <script>
  102. import Water from "@/components/water/water.vue";
  103. import BottomScrollTip from "../../../../wigets/BottomScrollTip.vue";
  104. import request from "../../../../request/index.js";
  105. import { formatDate } from "../../../../utils/utils.js";
  106. export default {
  107. components: {
  108. Water,
  109. BottomScrollTip,
  110. },
  111. data() {
  112. return {
  113. title: "",
  114. customerProvinceName: "",
  115. customerLevel: "",
  116. customerCategory: "",
  117. responsibleManager: "",
  118. totalWarningAmount: 0,
  119. statusBarHeight: 20,
  120. flowList: [],
  121. loading: false,
  122. updatedTime: "",
  123. };
  124. },
  125. onLoad(options) {
  126. const info = uni.getSystemInfoSync();
  127. this.statusBarHeight = info.statusBarHeight || 20;
  128. const name = this.safeDecode(options && options.name);
  129. const updatedTime = options.updatedTime || "";
  130. this.title = name || "报表详情";
  131. this.updatedTime = updatedTime;
  132. if (name && updatedTime) {
  133. this.fetchDetail(name, updatedTime);
  134. }
  135. },
  136. onShareAppMessage() {
  137. return {
  138. title: this.title || "报表详情",
  139. path: this.buildSharePath(),
  140. };
  141. },
  142. onShareTimeline() {
  143. return {
  144. title: this.title || "报表详情",
  145. query: this.buildShareQuery(),
  146. };
  147. },
  148. methods: {
  149. safeDecode(value) {
  150. const raw = value == null ? "" : String(value);
  151. if (!raw) return "";
  152. try {
  153. return decodeURIComponent(raw);
  154. } catch (e) {
  155. return raw;
  156. }
  157. },
  158. buildShareQuery() {
  159. const name = encodeURIComponent(this.title || "");
  160. const updatedTime = encodeURIComponent(this.updatedTime || "");
  161. return `name=${name}&updatedTime=${updatedTime}`;
  162. },
  163. buildSharePath() {
  164. return `/traceCodePackages/traceabilityReport/pages/ganmaoling/detail/index?${this.buildShareQuery()}`;
  165. },
  166. formatDate,
  167. formatBillTime(time) {
  168. if (!time) return "--";
  169. try {
  170. return formatDate(new Date(time), "YYYY-MM-DD HH:mm");
  171. } catch (e) {
  172. return time;
  173. }
  174. },
  175. onBack() {
  176. try {
  177. uni.navigateBack();
  178. } catch (e) {}
  179. },
  180. copyTraceCode(code) {
  181. const text = String(code || "").trim();
  182. if (!text) {
  183. uni.showToast({ title: "无可复制内容", icon: "none" });
  184. return;
  185. }
  186. uni.setClipboardData({
  187. data: text,
  188. success: () => {
  189. uni.showToast({ title: "追溯码已复制", icon: "none" });
  190. },
  191. });
  192. },
  193. fetchDetail(customerName, updatedTime) {
  194. this.loading = true;
  195. uni.showLoading({ title: "加载中..." });
  196. request(
  197. `/report/ganmaoling/list/customers/${customerName}/date/${updatedTime}`,
  198. {
  199. path: "traceabilityReport/pages/ganmaoling/detail/index.vue",
  200. },
  201. "get",
  202. ).then((res) => {
  203. uni.hideLoading();
  204. if (res.code == 200 && res.data) {
  205. const d = res.data;
  206. this.customerProvinceName = d.customerProvinceName;
  207. this.customerLevel = d.customerLevel;
  208. this.customerCategory = d.customerCategory;
  209. this.responsibleManager = d.responsibleManager;
  210. this.totalWarningAmount = d.totalWarningAmount;
  211. this.flowList = d.reportDTOList || [];
  212. }
  213. this.loading = false;
  214. });
  215. },
  216. },
  217. };
  218. </script>
  219. <style scoped>
  220. .nav {
  221. position: fixed;
  222. top: 0;
  223. left: 0;
  224. right: 0;
  225. height: 44px;
  226. background-color: #2c69ff;
  227. display: flex;
  228. align-items: center;
  229. justify-content: center;
  230. }
  231. .nav-title {
  232. font-size: 36rpx;
  233. color: #fff;
  234. font-weight: 700;
  235. }
  236. .nav-back {
  237. position: absolute;
  238. left: 40rpx;
  239. top: 12rpx;
  240. width: 20rpx;
  241. height: 20rpx;
  242. color: #fff;
  243. border-left: 3rpx solid #fff;
  244. border-bottom: 3rpx solid #fff;
  245. transform: rotate(45deg) translateY(56rpx);
  246. margin-left: 40rpx;
  247. margin-top: -6rpx;
  248. }
  249. .page {
  250. height: 100vh;
  251. }
  252. .card {
  253. margin: 24rpx;
  254. background: #fff;
  255. border-radius: 16rpx;
  256. font-size: 32rpx;
  257. }
  258. .header-card {
  259. background: #2c69ff;
  260. border-bottom-left-radius: 32rpx;
  261. border-bottom-right-radius: 32rpx;
  262. padding: 36rpx;
  263. color: #fff;
  264. }
  265. .meta {
  266. display: flex;
  267. align-items: center;
  268. margin: 14rpx 0;
  269. }
  270. .dot {
  271. width: 8rpx;
  272. height: 8rpx;
  273. border-radius: 50%;
  274. background: #fff;
  275. margin-right: 20rpx;
  276. }
  277. .meta-text {
  278. font-size: 32rpx;
  279. }
  280. .section-title {
  281. position: relative;
  282. font-size: 32rpx;
  283. font-weight: bold;
  284. color: #333;
  285. margin: 30rpx 30rpx 20rpx;
  286. }
  287. .section-title::after {
  288. content: "";
  289. position: absolute;
  290. left: -20rpx;
  291. bottom: 8rpx;
  292. width: 8rpx;
  293. height: 50%;
  294. background: #2c69ff;
  295. border-radius: 10px;
  296. }
  297. .table-card {
  298. padding: 0;
  299. overflow: hidden;
  300. }
  301. .table-scroll {
  302. width: 100%;
  303. }
  304. .flow-table {
  305. min-width: 1785rpx;
  306. border-top: 1rpx solid #ccc;
  307. border-left: 1rpx solid #ccc;
  308. }
  309. .flow-header {
  310. display: flex;
  311. background: #f5f7fa;
  312. font-size: 26rpx;
  313. font-weight: bold;
  314. color: #2c69ff;
  315. }
  316. .flow-body {
  317. font-size: 26rpx;
  318. color: #666;
  319. }
  320. .flow-row {
  321. display: flex;
  322. border-bottom: 1rpx solid #ccc;
  323. }
  324. .flow-row:nth-child(even) {
  325. background-color: #f7f7f7;
  326. }
  327. .th,
  328. .td {
  329. padding: 16rpx 10rpx;
  330. border-right: 1rpx solid #ccc;
  331. display: flex;
  332. align-items: center;
  333. justify-content: center;
  334. text-align: center;
  335. word-break: break-all;
  336. box-sizing: border-box;
  337. flex-shrink: 0;
  338. }
  339. .th {
  340. border-bottom: 1rpx solid #ccc;
  341. }
  342. .col-company {
  343. width: 350rpx;
  344. }
  345. .col-toCustomerLevel {
  346. width: 160rpx;
  347. }
  348. .col-toCustomerCategory {
  349. width: 160rpx;
  350. }
  351. .col-toResponsibleManager {
  352. width: 160rpx;
  353. }
  354. .col-time {
  355. width: 220rpx;
  356. }
  357. .col-type {
  358. width: 160rpx;
  359. }
  360. .col-product {
  361. width: 200rpx;
  362. }
  363. .col-batch {
  364. width: 180rpx;
  365. }
  366. .col-source {
  367. width: 180rpx;
  368. }
  369. .col-qty {
  370. width: 160rpx;
  371. }
  372. .col-code {
  373. width: 310rpx;
  374. }
  375. .copyable-code {
  376. color: #2c69ff;
  377. }
  378. .chain-text {
  379. white-space: pre-wrap;
  380. text-align: left !important;
  381. font-size: 22rpx;
  382. line-height: 1.4;
  383. padding: 10rpx !important;
  384. }
  385. .td-group {
  386. display: flex;
  387. flex-direction: column;
  388. width: 480rpx;
  389. flex-shrink: 0;
  390. }
  391. .sub-row {
  392. display: flex;
  393. flex: 1;
  394. border-bottom: 1rpx solid #ccc;
  395. }
  396. .sub-row:last-child {
  397. border-bottom: none;
  398. }
  399. </style>