detail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. <template>
  2. <view class="inventory-detail">
  3. <!-- 导航栏 -->
  4. <u-navbar
  5. :title="pageTitle"
  6. :autoBack="true"
  7. fixed
  8. safe-area-inset-top
  9. placeholder
  10. >
  11. <template #right>
  12. <view class="nav-right">
  13. <u-icon name="search" size="20" color="#333"></u-icon>
  14. </view>
  15. </template>
  16. </u-navbar>
  17. <!-- 基本信息 吸顶 -->
  18. <view class="info-card">
  19. <view class="info-item">
  20. <text class="info-label">盘点单号:</text>
  21. <text class="info-value">{{ inventoryInfo.code }}</text>
  22. </view>
  23. <view class="info-item">
  24. <text class="info-label">盘点人:</text>
  25. <text class="info-value">{{ inventoryInfo.operator }}</text>
  26. </view>
  27. <view class="progress-box">
  28. <view class="progress-label-box">
  29. <text class="progress-label">
  30. 盘点进度
  31. </text>
  32. <text class="progress-value"
  33. >{{ inventoryInfo.progress }}/{{ inventoryInfo.total }}</text
  34. >
  35. </view>
  36. <view class="progress-bar-wrap">
  37. <u-line-progress
  38. :percentage="getProgressPercentage"
  39. height="4"
  40. :show-text="false"
  41. activeColor="#4080FF"
  42. >
  43. </u-line-progress>
  44. </view>
  45. </view>
  46. </view>
  47. <!-- 筛选按钮 -->
  48. <u-sticky bgColor="#F5F6F7" :offsetTop="44">
  49. <view class="filter-wrap">
  50. <view class="filter-btn" @click="filterPopupVisible = true">
  51. <text>筛选</text>
  52. <u-icon name="arrow-down" size="12" color="#666"></u-icon>
  53. </view>
  54. </view>
  55. </u-sticky>
  56. <!-- 商品列表 -->
  57. <view class="goods-list">
  58. <view class="goods-item" v-for="(item, index) in goodsList" :key="index">
  59. <view class="location-row">
  60. <view class="location-left">
  61. <text class="location-label">库位:</text>
  62. <text class="location-value">{{ item.location }}</text>
  63. <u-icon name="arrow-right" size="14" color="#4080FF"></u-icon>
  64. </view>
  65. <text class="category-text">{{ item.category }}</text>
  66. </view>
  67. <view class="goods-content">
  68. <image
  69. class="goods-image"
  70. :src="item.image"
  71. mode="aspectFill"
  72. ></image>
  73. <view class="goods-info">
  74. <text class="goods-name u-line-2">{{ item.name }}</text>
  75. <view class="goods-spec half-w">
  76. <text class="spec-label">规格:</text>
  77. <text class="spec-value">{{ item.spec }}</text>
  78. </view>
  79. <view class="check-user half-w">
  80. <text class="check-label">盘点人:</text>
  81. <text class="check-value">{{ item.checkUser }}</text>
  82. </view>
  83. <view class="check-time">
  84. <text class="time-label">盘点时间:</text>
  85. <text class="time-value">{{ item.checkTime }}</text>
  86. </view>
  87. <view class="stock-row">
  88. <view class="stock-item half-w">
  89. <text class="stock-label">系统库存</text>
  90. <text class="stock-value">{{ item.systemStock }}瓶</text>
  91. </view>
  92. <view class="stock-item half-w">
  93. <text class="stock-label">已盘库存</text>
  94. <text
  95. class="stock-value"
  96. :class="{
  97. 'stock-value-zero': item.actualStock === '未盘',
  98. 'stock-value-warning': item.actualStock === '0瓶',
  99. }"
  100. >{{ item.actualStock }}</text
  101. >
  102. </view>
  103. </view>
  104. </view>
  105. </view>
  106. <view class="action-row">
  107. <u-button
  108. type="primary"
  109. size="mini"
  110. @click="handleCheck(item)"
  111. class="action-btn"
  112. >盘点</u-button
  113. >
  114. <u-button
  115. type="primary"
  116. size="mini"
  117. @click="handleRecheck(item)"
  118. class="action-btn"
  119. >重新盘点
  120. </u-button>
  121. <u-button
  122. type="warning"
  123. size="mini"
  124. plain
  125. @click="handleCheck2(item)"
  126. class="action-btn action-btn-secondary"
  127. >盘点2</u-button
  128. >
  129. </view>
  130. </view>
  131. <!-- 加载更多 -->
  132. <u-loadmore :status="loadMoreStatus" @loadmore="onLoadMore" />
  133. </view>
  134. <InventoryFilterPopup
  135. :show.sync="filterPopupVisible"
  136. :defaultValues="defaultFilterValues"
  137. @confirm="handleFilterConfirm"
  138. />
  139. <actionNumPopup :show.sync="actionPop.showNumPop" />
  140. <categoryPopup :show.sync="actionPop.showCategoryPop" />
  141. <error-pop v-model="actionPop.errorShow" isCenter cancelBtnText="取消" confirmBtnText="确定" @close="actionPop.errorShow = false" @confirm="confirm" :content="actionPop.errorText"></error-pop>
  142. </view>
  143. </template>
  144. <script>
  145. import InventoryFilterPopup from "./components/inventoryFilterPopup.vue";
  146. import actionNumPopup from "./components/actionNumPopup.vue";
  147. import categoryPopup from "./components/categoryPopup.vue";
  148. import errorPop from '@/components/error-pop/error-pop.vue'
  149. export default {
  150. components: {
  151. InventoryFilterPopup,
  152. actionNumPopup,
  153. errorPop,
  154. categoryPopup
  155. },
  156. data() {
  157. return {
  158. pageTitle: "2025年中心仓第三季度食品盘点",
  159. isRefreshing: false,
  160. loadMoreStatus: "loadmore",
  161. pageNum: 1,
  162. pageSize: 10,
  163. inventoryInfo: {
  164. code: "2024202244",
  165. operator: "刘双秀",
  166. progress: 105,
  167. total: 604,
  168. },
  169. goodsList: [
  170. {
  171. location: "C6-2-2",
  172. category: "母婴用品-家居旅行",
  173. image: "/static/demo/goods1.png",
  174. name: "4层汗巾儿童全棉幼儿类吸汗巾婴儿纱布毛巾1条装",
  175. spec: "4层-随机",
  176. checkUser: "刘双秀",
  177. checkTime: "2025-04-03",
  178. systemStock: "5瓶",
  179. actualStock: "未盘",
  180. isChecked: false,
  181. },
  182. {
  183. location: "C6-2-2",
  184. category: "母婴用品-家居旅行",
  185. image: "/static/demo/goods1.png",
  186. name: "4层汗巾儿童全棉幼儿类吸汗巾婴儿纱布毛巾1条装",
  187. spec: "4层-随机",
  188. checkUser: "刘双秀",
  189. checkTime: "2025-04-03",
  190. systemStock: "5瓶",
  191. actualStock: "0瓶",
  192. isChecked: true,
  193. },
  194. ],
  195. filterPopupVisible: false,
  196. defaultFilterValues: {
  197. goods: "",
  198. user: "",
  199. category: "",
  200. location: "",
  201. },
  202. actionPop:{
  203. // 盘点数量弹框状态
  204. showNumPop: false,
  205. // 警告提示弹框状态
  206. errorShow: false,
  207. errorText: '是否提交盘点?',
  208. // 修改库位弹框状态
  209. showCategoryPop: false
  210. }
  211. };
  212. },
  213. computed: {
  214. getProgressPercentage() {
  215. return (this.inventoryInfo.progress / this.inventoryInfo.total) * 100;
  216. },
  217. },
  218. onLoad() {
  219. // 初始化数据
  220. this.loadData();
  221. },
  222. onPullDownRefresh() {
  223. // 下拉刷新
  224. this.onRefresh();
  225. },
  226. onReachBottom() {
  227. // 触底加载更多
  228. this.onLoadMore();
  229. },
  230. methods: {
  231. async onRefresh() {
  232. try {
  233. await this.loadData(true);
  234. } finally {
  235. uni.stopPullDownRefresh();
  236. }
  237. },
  238. async onLoadMore() {
  239. if (this.loadMoreStatus !== "loadmore") return;
  240. this.loadMoreStatus = "loading";
  241. try {
  242. await this.loadData();
  243. } catch (e) {
  244. this.loadMoreStatus = "loadmore";
  245. }
  246. },
  247. async loadData(isRefresh = false) {
  248. if (isRefresh) {
  249. this.pageNum = 1;
  250. this.goodsList = [];
  251. }
  252. // 模拟数据加载
  253. await new Promise((resolve) => setTimeout(resolve, 1000));
  254. // 模拟新数据
  255. const mockData = [
  256. {
  257. location: "C6-2-2",
  258. category: "母婴用品-家居旅行",
  259. image: "/static/demo/goods1.png",
  260. name: "4层汗巾儿童全棉幼儿类吸汗巾婴儿纱布毛巾1条装",
  261. spec: "4层-随机",
  262. checkUser: "刘双秀",
  263. checkTime: "2025-04-03",
  264. systemStock: "5瓶",
  265. actualStock: isRefresh ? "未盘" : "0瓶",
  266. isChecked: !isRefresh,
  267. },
  268. ];
  269. this.goodsList = [...this.goodsList, ...mockData];
  270. this.pageNum++;
  271. // 模拟没有更多数据
  272. if (this.pageNum > 3) {
  273. this.loadMoreStatus = "nomore";
  274. } else {
  275. this.loadMoreStatus = "loadmore";
  276. }
  277. },
  278. handleCheck(item) {
  279. uni.showToast({
  280. title: "开始盘点",
  281. icon: "none",
  282. });
  283. },
  284. handleRecheck(item) {
  285. uni.showToast({
  286. title: "开始重新盘点",
  287. icon: "none",
  288. });
  289. },
  290. handleCheck2(item) {
  291. uni.showToast({
  292. title: "开始盘点2",
  293. icon: "none",
  294. });
  295. },
  296. handleFilterConfirm(values) {
  297. this.defaultFilterValues = values;
  298. this.filterPopupVisible = false;
  299. },
  300. },
  301. };
  302. </script>
  303. <style lang="scss">
  304. .inventory-detail {
  305. min-height: 100vh;
  306. background-color: #f0f6fb;
  307. padding-bottom: 40rpx;
  308. .half-w {
  309. width: 50%;
  310. }
  311. .nav-right {
  312. padding: 0 24rpx;
  313. }
  314. .info-card {
  315. background-color: #fff;
  316. border-radius: 16rpx;
  317. padding: 32rpx;
  318. .info-item {
  319. display: flex;
  320. font-size: 28rpx;
  321. margin-bottom: 24rpx;
  322. .info-label {
  323. color: #666;
  324. margin-right: 8rpx;
  325. }
  326. .info-value {
  327. color: #333;
  328. }
  329. }
  330. .progress-box {
  331. .progress-label-box{
  332. display: flex;
  333. justify-content: space-between;
  334. }
  335. .progress-label {
  336. font-size: 28rpx;
  337. color: #666;
  338. display: block;
  339. margin-bottom: 16rpx;
  340. }
  341. .progress-bar-wrap {
  342. margin-bottom: 16rpx;
  343. }
  344. .progress-value {
  345. font-size: 24rpx;
  346. color: #4080ff;
  347. display: block;
  348. text-align: right;
  349. }
  350. }
  351. }
  352. .filter-wrap {
  353. display: flex;
  354. justify-content: flex-end;
  355. padding: 20rpx;
  356. .filter-btn {
  357. display: flex;
  358. align-items: center;
  359. padding: 12rpx 24rpx;
  360. border-radius: 8rpx;
  361. font-size: 24rpx;
  362. color: #666;
  363. .u-icon {
  364. margin-left: 8rpx;
  365. }
  366. }
  367. }
  368. .goods-list {
  369. padding: 0 24rpx;
  370. .goods-item {
  371. background-color: #fff;
  372. border-radius: 16rpx;
  373. margin-bottom: 24rpx;
  374. overflow: hidden;
  375. .location-row {
  376. display: flex;
  377. justify-content: space-between;
  378. align-items: center;
  379. padding: 24rpx 32rpx;
  380. border-bottom: 1rpx solid #f5f6f7;
  381. .location-left {
  382. display: flex;
  383. align-items: center;
  384. .location-label {
  385. font-size: 28rpx;
  386. color: #333;
  387. }
  388. .location-value {
  389. font-size: 28rpx;
  390. color: #4080ff;
  391. margin: 0 8rpx;
  392. }
  393. }
  394. .category-text {
  395. font-size: 24rpx;
  396. color: #999;
  397. }
  398. }
  399. .goods-content {
  400. padding: 24rpx 32rpx;
  401. display: flex;
  402. .goods-image {
  403. width: 160rpx;
  404. height: 160rpx;
  405. border-radius: 8rpx;
  406. background-color: #f5f6f7;
  407. }
  408. .goods-info {
  409. display: flex;
  410. flex-wrap: wrap;
  411. flex: 1;
  412. margin-left: 24rpx;
  413. .goods-name {
  414. font-size: 28rpx;
  415. line-height: 1.4;
  416. color: #333;
  417. margin-bottom: 16rpx;
  418. }
  419. .goods-spec {
  420. font-size: 24rpx;
  421. color: #666;
  422. margin-bottom: 16rpx;
  423. .spec-label {
  424. color: #999;
  425. }
  426. .spec-value {
  427. color: #666;
  428. }
  429. }
  430. .check-user,
  431. .check-time {
  432. font-size: 24rpx;
  433. margin-bottom: 16rpx;
  434. .check-label,
  435. .time-label {
  436. color: #999;
  437. }
  438. .check-value,
  439. .time-value {
  440. color: #666;
  441. }
  442. }
  443. }
  444. }
  445. .stock-row {
  446. display: flex;
  447. padding: 24rpx;
  448. gap: 48rpx;
  449. width: 100%;
  450. background-color: #F6F8FA;
  451. border-radius: 8rpx;
  452. .stock-item {
  453. display: flex;
  454. flex-direction: column;
  455. .stock-label {
  456. font-size: 24rpx;
  457. color: #999;
  458. margin-bottom: 20rpx;
  459. }
  460. .stock-value {
  461. font-size: 24rpx;
  462. color: #333;
  463. &-zero {
  464. color: #999;
  465. }
  466. &-warning {
  467. color: #ff9900;
  468. }
  469. }
  470. }
  471. }
  472. .action-row {
  473. padding: 0 32rpx 32rpx;
  474. display: flex;
  475. justify-content: flex-end;
  476. gap: 24rpx;
  477. .action-btn {
  478. width: 140rpx;
  479. height: 56rpx;
  480. padding: 0;
  481. &-secondary {
  482. background-color: transparent;
  483. border-color: #ff9900;
  484. color: #ff9900;
  485. }
  486. }
  487. }
  488. }
  489. }
  490. }
  491. </style>