index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  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. </template>
  65. <script>
  66. import Water from "@/components/water/water.vue";
  67. import request from "../../../../request/index.js";
  68. import { formatDate } from "../../../../utils/utils.js";
  69. export default {
  70. components: {
  71. Water,
  72. },
  73. data() {
  74. return {
  75. title: "",
  76. customerProvinceName: "",
  77. customerLevel: "",
  78. customerCategory: "",
  79. responsibleManager: "",
  80. totalWarningAmount: 0,
  81. statusBarHeight: 20,
  82. flowList: [],
  83. loading: false,
  84. };
  85. },
  86. onLoad(options) {
  87. const info = uni.getSystemInfoSync();
  88. this.statusBarHeight = info.statusBarHeight || 20;
  89. const name = options.name ? decodeURIComponent(options.name) : "";
  90. const updatedTime = options.updatedTime || "";
  91. this.title = name || "报表详情";
  92. if (name && updatedTime) {
  93. this.fetchDetail(name, updatedTime);
  94. }
  95. },
  96. methods: {
  97. formatDate,
  98. formatBillTime(time) {
  99. if (!time) return "--";
  100. try {
  101. return formatDate(new Date(time), "YYYY-MM-DD HH:mm");
  102. } catch (e) {
  103. return time;
  104. }
  105. },
  106. onBack() {
  107. try {
  108. uni.navigateBack();
  109. } catch (e) { }
  110. },
  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. fetchDetail(customerName, updatedTime) {
  125. this.loading = true;
  126. uni.showLoading({ title: "加载中..." });
  127. request(
  128. `/report/ganmaoling/list/customers/${customerName}/date/${updatedTime}`,
  129. {
  130. path: "traceabilityReport/pages/ganmaoling/detail/index.vue",
  131. },
  132. "get",
  133. ).then((res) => {
  134. uni.hideLoading();
  135. if (res.code == 200 && res.data) {
  136. const d = res.data;
  137. this.customerProvinceName = d.customerProvinceName;
  138. this.customerLevel = d.customerLevel;
  139. this.customerCategory = d.customerCategory;
  140. this.responsibleManager = d.responsibleManager;
  141. this.totalWarningAmount = d.totalWarningAmount;
  142. this.flowList = d.reportDTOList || [];
  143. }
  144. this.loading = false;
  145. });
  146. },
  147. },
  148. };
  149. </script>
  150. <style scoped>
  151. .nav {
  152. position: fixed;
  153. top: 0;
  154. left: 0;
  155. right: 0;
  156. height: 44px;
  157. background-color: #2c69ff;
  158. display: flex;
  159. align-items: center;
  160. justify-content: center;
  161. }
  162. .nav-title {
  163. font-size: 36rpx;
  164. color: #fff;
  165. font-weight: 700;
  166. }
  167. .nav-back {
  168. position: absolute;
  169. left: 40rpx;
  170. top: 12rpx;
  171. width: 20rpx;
  172. height: 20rpx;
  173. color: #fff;
  174. border-left: 3rpx solid #fff;
  175. border-bottom: 3rpx solid #fff;
  176. transform: rotate(45deg) translateY(56rpx);
  177. margin-left: 40rpx;
  178. margin-top: -6rpx;
  179. }
  180. .page {
  181. height: 100vh;
  182. }
  183. .card {
  184. margin: 24rpx;
  185. background: #fff;
  186. border-radius: 16rpx;
  187. font-size: 32rpx;
  188. }
  189. .header-card {
  190. background: #2c69ff;
  191. border-bottom-left-radius: 32rpx;
  192. border-bottom-right-radius: 32rpx;
  193. padding: 36rpx;
  194. color: #fff;
  195. }
  196. .meta {
  197. display: flex;
  198. align-items: center;
  199. margin: 14rpx 0;
  200. }
  201. .dot {
  202. width: 8rpx;
  203. height: 8rpx;
  204. border-radius: 50%;
  205. background: #fff;
  206. margin-right: 20rpx;
  207. }
  208. .meta-text {
  209. font-size: 32rpx;
  210. }
  211. .section-title {
  212. position: relative;
  213. font-size: 32rpx;
  214. font-weight: bold;
  215. color: #333;
  216. margin: 30rpx 30rpx 20rpx;
  217. }
  218. .section-title::after {
  219. content: "";
  220. position: absolute;
  221. left: -20rpx;
  222. bottom: 8rpx;
  223. width: 8rpx;
  224. height: 50%;
  225. background: #2c69ff;
  226. border-radius: 10px;
  227. }
  228. .table-card {
  229. padding: 0;
  230. overflow: hidden;
  231. }
  232. .table-scroll {
  233. width: 100%;
  234. }
  235. .flow-table {
  236. min-width: 1720rpx;
  237. border-top: 1rpx solid #ccc;
  238. border-left: 1rpx solid #ccc;
  239. }
  240. .flow-header {
  241. display: flex;
  242. background: #f5f7fa;
  243. font-size: 26rpx;
  244. font-weight: bold;
  245. color: #2c69ff;
  246. }
  247. .flow-body {
  248. font-size: 26rpx;
  249. color: #666;
  250. }
  251. .flow-row {
  252. display: flex;
  253. border-bottom: 1rpx solid #ccc;
  254. }
  255. .flow-row:nth-child(even) {
  256. background-color: #f7f7f7;
  257. }
  258. .th,
  259. .td {
  260. padding: 16rpx 10rpx;
  261. border-right: 1rpx solid #ccc;
  262. display: flex;
  263. align-items: center;
  264. justify-content: center;
  265. text-align: center;
  266. word-break: break-all;
  267. box-sizing: border-box;
  268. flex-shrink: 0;
  269. }
  270. .th {
  271. border-bottom: 1rpx solid #ccc;
  272. }
  273. .col-company {
  274. width: 350rpx;
  275. }
  276. .col-time {
  277. width: 220rpx;
  278. }
  279. .col-type {
  280. width: 160rpx;
  281. }
  282. .col-product {
  283. width: 200rpx;
  284. }
  285. .col-batch {
  286. width: 180rpx;
  287. }
  288. .col-source {
  289. width: 180rpx;
  290. }
  291. .col-qty {
  292. width: 120rpx;
  293. }
  294. .col-code {
  295. width: 310rpx;
  296. }
  297. .copyable-code {
  298. color: #2c69ff;
  299. }
  300. .chain-text {
  301. white-space: pre-wrap;
  302. text-align: left !important;
  303. font-size: 22rpx;
  304. line-height: 1.4;
  305. padding: 10rpx !important;
  306. }
  307. .td-group {
  308. display: flex;
  309. flex-direction: column;
  310. width: 480rpx;
  311. flex-shrink: 0;
  312. }
  313. .sub-row {
  314. display: flex;
  315. flex: 1;
  316. border-bottom: 1rpx solid #ccc;
  317. }
  318. .sub-row:last-child {
  319. border-bottom: none;
  320. }
  321. </style>