index.vue 8.9 KB

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