index.vue 7.8 KB

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