detail.vue 13 KB

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