index.vue 7.3 KB

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