index.vue 8.0 KB

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