index.vue 7.3 KB

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