quick-check.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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. .select-section {
  128. background-color: #fff;
  129. padding: 12px;
  130. border-radius: 4px;
  131. margin-bottom: 12px;
  132. position: relative;
  133. }
  134. .batch-select {
  135. display: flex;
  136. align-items: center;
  137. .required {
  138. color: #ff0000;
  139. margin-right: 4px;
  140. }
  141. }
  142. .count-badge {
  143. position: absolute;
  144. right: 0;
  145. top: 50%;
  146. background-color: #4CAF50;
  147. color: #fff;
  148. padding: 8px;
  149. font-size: 13px;
  150. }
  151. .query-section {
  152. background-color: #fff;
  153. padding: 12px;
  154. border-radius: 4px;
  155. }
  156. .search-box {
  157. display: flex;
  158. gap: 12px;
  159. margin-top: 12px;
  160. }
  161. .footer {
  162. position: fixed;
  163. left: 0;
  164. right: 0;
  165. bottom: 0;
  166. display: flex;
  167. flex-direction: column;
  168. background-color: #fff;
  169. .u-button {
  170. flex: 1;
  171. border-radius: 0;
  172. }
  173. }
  174. .batch-popup {
  175. background-color: #fff;
  176. border-radius: 16px 16px 0 0;
  177. .popup-header {
  178. padding: 12px;
  179. display: flex;
  180. justify-content: space-between;
  181. align-items: center;
  182. border-bottom: 1px solid #eee;
  183. box-sizing: border-box;
  184. .header-right {
  185. display: flex;
  186. align-items: center;
  187. gap: 12px;
  188. .new-batch {
  189. color: #2979ff;
  190. min-width: 70px;
  191. }
  192. .u-button{
  193. height: 64rpx;
  194. }
  195. }
  196. }
  197. .batch-list {
  198. max-height: 60vh;
  199. padding: 0 16px;
  200. box-sizing: border-box;
  201. }
  202. .batch-item {
  203. padding: 13px 0;
  204. box-sizing: border-box;
  205. display: flex;
  206. justify-content: space-between;
  207. border-bottom: 1px solid #eee;
  208. &.active {
  209. color: #2979ff;
  210. }
  211. }
  212. }
  213. </style>