index.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  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="list-container" :style="{ paddingTop: statusBarHeight + 60 + 'px' }">
  9. <view class="tip">点击客户名称展开详细表格</view>
  10. <view v-for="(prd, i) in products" :key="'prd-' + i">
  11. <view class="section-title">感冒灵</view>
  12. <view class="card product-card">
  13. <view class="customer-row" v-for="(c, j) in prd.customers" :key="'cust-' + j">
  14. <text class="customer-label">上游客户:</text>
  15. <text class="customer-name" @click.stop="toggleCustomer(i, j)">{{
  16. c.name
  17. }}</text>
  18. <text class="expand-tag" @click.stop="toggleCustomer(i, j)">{{
  19. c.expanded ? "收起" : "展开"
  20. }}</text>
  21. </view>
  22. <view class="table-card" v-for="(c, j) in prd.customers" :key="'tbl-' + j" v-show="c.expanded">
  23. <scroll-view scroll-x="true" class="table-scroll">
  24. <view class="blk-table">
  25. <view class="blk-header">
  26. <view class="th col-region">货源片区</view>
  27. <view class="th col-qty">数量</view>
  28. <view class="th col-batch">批号</view>
  29. <view class="th col-sample">监管码样本(抽样)</view>
  30. <view class="th col-terminal">终端到达数量</view>
  31. </view>
  32. <view class="blk-body">
  33. <view class="blk-row" v-for="(row, idx) in c.details" :key="'row-' + idx">
  34. <view class="td col-region">{{ row.region }}</view>
  35. <view class="td col-qty">{{ row.quantity }}</view>
  36. <view class="td col-batch">{{ row.batchNo }}</view>
  37. <view class="td col-sample">{{ row.sample }}</view>
  38. <view class="td col-terminal">{{ row.arrivalQty }}</view>
  39. </view>
  40. <view v-if="!c.details || c.details.length === 0" class="empty-row">暂无数据</view>
  41. </view>
  42. </view>
  43. </scroll-view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </template>
  50. <script>
  51. import Water from "@/components/water/water.vue";
  52. export default {
  53. components: {
  54. Water,
  55. },
  56. data() {
  57. return {
  58. statusBarHeight: 20,
  59. title: "黑名单详情",
  60. products: [],
  61. };
  62. },
  63. onLoad(options) {
  64. const info = uni.getSystemInfoSync();
  65. this.statusBarHeight = info.statusBarHeight || 20;
  66. const name =
  67. options && options.name ? decodeURIComponent(options.name) : "";
  68. this.title = name || "黑名单详情";
  69. this.products = this.generateMockProducts(name || "感冒灵");
  70. },
  71. methods: {
  72. onBack() {
  73. try {
  74. uni.navigateBack();
  75. } catch (e) { }
  76. },
  77. toggleCustomer(i, j) {
  78. const cur = this.products[i].customers[j];
  79. this.$set(this.products[i].customers[j], "expanded", !cur.expanded);
  80. },
  81. generateMockProducts(drugName) {
  82. const makeDetails = (n = 3) =>
  83. Array.from({ length: n }).map((_, idx) => ({
  84. region: ["广东", "江苏", "四川", "山东"][idx % 4],
  85. quantity: 100 + idx * 20,
  86. batchNo: `B${String(202400 + idx)}`,
  87. sample: `抽样${10 + idx}枚`,
  88. arrivalQty: 90 + idx * 15,
  89. }));
  90. return [
  91. {
  92. name: drugName,
  93. customers: [
  94. { name: "公司A", expanded: false, details: makeDetails(3) },
  95. { name: "公司B", expanded: false, details: makeDetails(2) },
  96. ],
  97. },
  98. {
  99. name: drugName,
  100. customers: [
  101. { name: "公司A", expanded: true, details: makeDetails(4) },
  102. { name: "公司C", expanded: false, details: makeDetails(3) },
  103. ],
  104. },
  105. ];
  106. },
  107. },
  108. };
  109. </script>
  110. <style scoped>
  111. .nav {
  112. position: fixed;
  113. top: 0;
  114. left: 0;
  115. right: 0;
  116. height: 44px;
  117. background-color: #2c69ff;
  118. display: flex;
  119. align-items: center;
  120. justify-content: center;
  121. z-index: 10;
  122. }
  123. .nav-title {
  124. font-size: 36rpx;
  125. color: #fff;
  126. font-weight: 700;
  127. }
  128. .nav-back {
  129. position: absolute;
  130. left: 40rpx;
  131. top: 12rpx;
  132. width: 20rpx;
  133. height: 20rpx;
  134. color: #fff;
  135. border-left: 3rpx solid #fff;
  136. border-bottom: 3rpx solid #fff;
  137. transform: rotate(45deg) translateY(56rpx);
  138. margin-left: 40rpx;
  139. margin-top: -6rpx;
  140. }
  141. .page {
  142. min-height: 100vh;
  143. background: #f3f6f9;
  144. }
  145. .section-title {
  146. position: relative;
  147. font-size: 30rpx;
  148. font-weight: bold;
  149. color: #2c69ff;
  150. margin-left: 24rpx;
  151. }
  152. .section-title::after {
  153. content: "";
  154. position: absolute;
  155. left: -20rpx;
  156. bottom: 11rpx;
  157. width: 8rpx;
  158. height: 50%;
  159. background: #2c69ff;
  160. border-radius: 10px;
  161. }
  162. .tip {
  163. font-size: 24rpx;
  164. color: #999;
  165. padding: 24rpx;
  166. }
  167. .list-container {
  168. padding: 0 24rpx 24rpx;
  169. box-sizing: border-box;
  170. }
  171. .card {
  172. margin: 24rpx;
  173. background: #fff;
  174. border-radius: 16rpx;
  175. font-size: 30rpx;
  176. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
  177. }
  178. .product-card {
  179. padding: 24rpx;
  180. }
  181. .product-title {
  182. font-size: 32rpx;
  183. font-weight: bold;
  184. color: #333;
  185. margin-bottom: 16rpx;
  186. }
  187. .customer-row {
  188. display: flex;
  189. align-items: center;
  190. padding: 12rpx 0;
  191. border-bottom: 1rpx solid #f0f0f0;
  192. }
  193. .customer-row:last-child {
  194. border-bottom: none;
  195. }
  196. .customer-label {
  197. font-size: 28rpx;
  198. color: #666;
  199. margin-right: 10rpx;
  200. }
  201. .customer-name {
  202. font-size: 28rpx;
  203. color: #2c69ff;
  204. }
  205. .expand-tag {
  206. margin-left: auto;
  207. font-size: 26rpx;
  208. color: #2c69ff;
  209. }
  210. .table-card {
  211. padding: 0;
  212. overflow: hidden;
  213. margin-top: 16rpx;
  214. }
  215. .table-scroll {
  216. width: 100%;
  217. }
  218. .blk-table {
  219. min-width: 1060rpx;
  220. border-top: 1rpx solid #eee;
  221. border-left: 1rpx solid #eee;
  222. }
  223. .blk-header {
  224. display: flex;
  225. background: #f5f7fa;
  226. font-size: 26rpx;
  227. font-weight: bold;
  228. color: #333;
  229. }
  230. .blk-body {
  231. font-size: 26rpx;
  232. color: #666;
  233. }
  234. .blk-row {
  235. display: flex;
  236. border-bottom: 1rpx solid #eee;
  237. }
  238. .th,
  239. .td {
  240. padding: 16rpx 10rpx;
  241. border-right: 1rpx solid #eee;
  242. display: flex;
  243. align-items: center;
  244. justify-content: center;
  245. text-align: center;
  246. word-break: break-all;
  247. box-sizing: border-box;
  248. flex-shrink: 0;
  249. }
  250. .th {
  251. border-bottom: 1rpx solid #eee;
  252. }
  253. .empty-row {
  254. padding: 30rpx;
  255. text-align: center;
  256. color: #999;
  257. }
  258. .col-region {
  259. width: 200rpx;
  260. }
  261. .col-qty {
  262. width: 140rpx;
  263. }
  264. .col-batch {
  265. width: 200rpx;
  266. }
  267. .col-sample {
  268. width: 300rpx;
  269. }
  270. .col-terminal {
  271. width: 220rpx;
  272. }
  273. </style>