bad-out-order.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <view class="container">
  3. <!-- 搜索框 -->
  4. <u-sticky>
  5. <view class="search-area flex-c mb-20">
  6. <u-search v-model="searchText" placeholder="请输入运单号/订单编号" :show-action="false" :clearabled="true"
  7. @change="onSearch" height="40">
  8. </u-search>
  9. <u-icon name="scan" size="28" color="#19be6b" @click="openScan"></u-icon>
  10. </view>
  11. </u-sticky>
  12. <view class="content">
  13. <!-- 基本信息 -->
  14. <view class="info-section">
  15. <view class="info-item">库位:{{ locationInfo.location }}</view>
  16. <view class="info-item">物流单号:{{ locationInfo.logisticsNo }}</view>
  17. <view class="info-item">订单编号:{{ locationInfo.orderNo }}</view>
  18. <view class="info-item">订单商品:{{ locationInfo.goodsCount }}</view>
  19. <view class="info-item">备注信息:{{ locationInfo.remark }}</view>
  20. </view>
  21. <!-- 极差商品列表 -->
  22. <view class="bad-list">
  23. <view class="list-title mb-6">极差</view>
  24. <view v-for="(item, index) in badList" :key="index">
  25. <BadOutCard :item="item" />
  26. </view>
  27. </view>
  28. </view>
  29. <!-- 底部按钮 -->
  30. <view class="fixed-bottom">
  31. <u-button size="large" type="warning" text="反馈" @click="openRemarkDialog" />
  32. <u-button size="large" type="primary" text="确定出库" @click="onConfirm" />
  33. </view>
  34. <!-- 备注弹窗 -->
  35. <remark-dialog v-model:visible="remarkVisible" :initial-value="currentRemark"
  36. @confirm="handleRemarkConfirm"></remark-dialog>
  37. </view>
  38. </template>
  39. <script setup>
  40. import { ref, onMounted } from 'vue'
  41. import BadOutCard from './components/BadOutCard.vue'
  42. import RemarkDialog from './components/RemarkDialog.vue';
  43. import VolumeTTS from '@/utils/VolumeTTS.js';
  44. const ttsModule = ref(null)
  45. // 搜索文本
  46. const searchText = ref('')
  47. // 位置信息
  48. const locationInfo = ref({
  49. location: 'K01-01-1A',
  50. logisticsNo: 'DPK20232154221',
  51. orderNo: '7516531',
  52. goodsCount: '10',
  53. remark: ''
  54. })
  55. // 极差商品列表
  56. const badList = ref([
  57. {
  58. image: 'https://img20.360buyimg.com/da/jfs/t1/141592/25/8861/261559/5f68d8c1E33ed78ab/698ad655bfcfbaed.png',
  59. title: '公文写作教程',
  60. isbn: '978704051555',
  61. price: 49.5,
  62. discount: 0.85,
  63. quantity: 5,
  64. set: '不是',
  65. estimate: 4.11,
  66. review: 0,
  67. good: 0,
  68. average: 0,
  69. bad: 1,
  70. reason: '明显泛黄水印/发霉/明显异味'
  71. },
  72. {
  73. image: 'https://img20.360buyimg.com/da/jfs/t1/141592/25/8861/261559/5f68d8c1E33ed78ab/698ad655bfcfbaed.png',
  74. title: '公文写作教程',
  75. isbn: '978704051555',
  76. price: 49.5,
  77. discount: 0.85,
  78. quantity: 5,
  79. set: '不是',
  80. estimate: 4.11,
  81. review: 0,
  82. good: 0,
  83. average: 0,
  84. bad: 1,
  85. reason: '明显泛黄水印/发霉/明显异味'
  86. }
  87. ])
  88. onMounted(() => {
  89. ttsModule.value = new VolumeTTS()
  90. })
  91. // 搜索处理
  92. const onSearch = () => {
  93. // 实现搜索逻辑
  94. }
  95. // 打开扫码
  96. const openScan = () => {
  97. // #ifdef APP-PLUS || MP-WEIXIN
  98. uni.scanCode({
  99. success: (res) => {
  100. searchText.value = res.result
  101. onSearch()
  102. },
  103. fail: (err) => {
  104. uni.showToast({
  105. title: '扫码失败',
  106. icon: 'error'
  107. })
  108. }
  109. })
  110. // #endif
  111. // #ifdef H5
  112. uni.showToast({
  113. title: 'H5环境不支持扫码',
  114. icon: 'none'
  115. })
  116. // #endif
  117. }
  118. // 确认出库
  119. const onConfirm = () => {
  120. uni.showModal({
  121. title: '确认提示',
  122. content: '是否确认出库?',
  123. success: (res) => {
  124. if (res.confirm) {
  125. // 处理确认出库逻辑
  126. uni.showToast({
  127. title: '出库成功',
  128. icon: 'success'
  129. })
  130. ttsModule.value.speak('出库成功')
  131. }
  132. }
  133. })
  134. }
  135. // 备注弹窗相关
  136. const remarkVisible = ref(false)
  137. const currentRemark = ref('')
  138. const currentEditIndex = ref(-1)
  139. // 打开备注弹窗
  140. const openRemarkDialog = (index, remark = '') => {
  141. currentEditIndex.value = index
  142. currentRemark.value = remark
  143. remarkVisible.value = true
  144. }
  145. // 处理备注确认
  146. const handleRemarkConfirm = (remark) => {
  147. if (currentEditIndex.value >= 0) {
  148. orders.value[currentEditIndex.value].remark = remark
  149. }
  150. currentEditIndex.value = -1
  151. currentRemark.value = ''
  152. }
  153. </script>
  154. <style scoped>
  155. .container {
  156. padding-bottom: 120rpx;
  157. }
  158. .info-section {
  159. background-color: #fff;
  160. padding: 20rpx;
  161. border-radius: 8rpx;
  162. margin-bottom: 20rpx;
  163. }
  164. .info-item {
  165. line-height: 1.8;
  166. }
  167. .list-title {
  168. font-size: 32rpx;
  169. font-weight: bold;
  170. background-color: rgb(222, 134, 143, 0.5);
  171. padding: 10rpx 0;
  172. padding-left: 30rpx;
  173. }
  174. .bad-list {
  175. margin-bottom: 20rpx;
  176. }
  177. .footer {
  178. position: fixed;
  179. bottom: 100rpx;
  180. left: 0;
  181. right: 0;
  182. background-color: #fff;
  183. padding: 20rpx;
  184. }
  185. .btn-group {
  186. display: flex;
  187. justify-content: space-around;
  188. }
  189. .search-wrapper {
  190. position: fixed;
  191. bottom: 0;
  192. left: 0;
  193. right: 0;
  194. background-color: #fff;
  195. padding: 20rpx;
  196. box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);
  197. }
  198. </style>