quick-check.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <view class="container">
  3. <!-- 批次选择区域 -->
  4. <view class="select-section">
  5. <view class="batch-select">
  6. <text class="required">*</text>
  7. <text>批次:</text>
  8. <u-input v-model="selectedBatch" placeholder="请选择/新建批次" readonly border="surround"
  9. @click="openBatchSelector">
  10. <template #suffix>
  11. <u-icon name="arrow-down" size="14" />
  12. </template>
  13. </u-input>
  14. </view>
  15. </view>
  16. <!-- 数量显示 -->
  17. <view class="count-badge">
  18. 数量{{ count }}
  19. </view>
  20. <!-- 底部按钮 -->
  21. <view class="footer">
  22. <!-- 查询区域 -->
  23. <view class="query-section">
  24. <u-radio-group v-model="queryType">
  25. <u-radio label="查订单" name="order" />
  26. <u-radio label="查物流" custom-style="margin-left:20px" name="logistics" />
  27. </u-radio-group>
  28. <view class="search-box">
  29. <u-input custom-style="width:100rpx" v-model="searchKeyword" placeholder="扫描/输入物流单号"
  30. border="surround" clearable>
  31. </u-input>
  32. <u-button color="#c8c8c8" text="查询" @click="handleSearch" />
  33. </view>
  34. </view>
  35. <u-divider></u-divider>
  36. <view style="display: flex;">
  37. <u-button size="large" type="warning" text="验收扫码" @click="handleScan" />
  38. <u-button size="large" type="primary" text="提交批次" @click="handleSubmitBatch" />
  39. </view>
  40. </view>
  41. <!-- 批次选择弹窗 -->
  42. <u-popup :show="showBatchSelector" mode="bottom" @close="showBatchSelector = false">
  43. <view class="batch-popup">
  44. <view class="popup-header">
  45. <text>批次</text>
  46. <view class="header-right">
  47. <text class="new-batch">新建批次</text>
  48. <u-button type="primary" text="确定" @click="confirmBatch" />
  49. </view>
  50. </view>
  51. <scroll-view scroll-y class="batch-list">
  52. <view v-for="batch in batchList" :key="batch.id" class="batch-item"
  53. :class="{ active: selectedBatchId === batch.id }" @click="selectBatch(batch)">
  54. <text>{{ batch.date }}</text>
  55. <text>{{ batch.count }}</text>
  56. </view>
  57. </scroll-view>
  58. </view>
  59. </u-popup>
  60. </view>
  61. </template>
  62. <script setup>
  63. import {
  64. ref
  65. } from 'vue';
  66. const queryType = ref('order');
  67. const searchKeyword = ref('');
  68. const selectedBatch = ref('');
  69. const selectedBatchId = ref('');
  70. const showBatchSelector = ref(false);
  71. const count = ref(0);
  72. // 批次列表数据
  73. const batchList = ref([{
  74. id: '1',
  75. date: '202401601',
  76. count: '0'
  77. },
  78. {
  79. id: '2',
  80. date: '202401605',
  81. count: '265'
  82. },
  83. {
  84. id: '3',
  85. date: '202405601',
  86. count: '111'
  87. },
  88. {
  89. id: '4',
  90. date: '202405601',
  91. count: '111'
  92. }
  93. ]);
  94. // 打开批次选择器
  95. const openBatchSelector = () => {
  96. showBatchSelector.value = true;
  97. };
  98. // 选择批次
  99. const selectBatch = (batch) => {
  100. selectedBatchId.value = batch.id;
  101. selectedBatch.value = `${batch.date} ${batch.count}`;
  102. count.value = Number(batch.count);
  103. };
  104. // 确认批次选择
  105. const confirmBatch = () => {
  106. showBatchSelector.value = false;
  107. };
  108. // 处理查询
  109. const handleSearch = () => {
  110. console.log('查询:', searchKeyword.value);
  111. };
  112. // 处理扫码
  113. const handleScan = () => {
  114. uni.scanCode({
  115. success: (res) => {
  116. searchKeyword.value = res.result;
  117. handleSearch();
  118. }
  119. });
  120. };
  121. // 提交批次
  122. const handleSubmitBatch = () => {
  123. console.log('提交批次');
  124. };
  125. </script>
  126. <style lang="scss" scoped>
  127. @import "../components/common.scss"
  128. </style>