task-detail.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <template>
  2. <view class="container">
  3. <!-- 顶部导航栏 -->
  4. <u-navbar title="下架任务" :border="false" fixed safe-area-inset-top>
  5. <template #left>
  6. <u-icon name="arrow-left" color="#333333" size="20" @click="goBack"></u-icon>
  7. </template>
  8. <template #right>
  9. <u-text type="primary" text="提交" @click="onSubmit"></u-text>
  10. </template>
  11. </u-navbar>
  12. <!-- 任务进度 -->
  13. <view class="progress-section">
  14. <u-alert title="当前任务" type="info" center></u-alert>
  15. <view class="flex flex-j-b pad-10" style="padding-right:40rpx">
  16. <view class="next-task" @click="handleNextTask">
  17. <text>上一个</text>
  18. </view>
  19. <view class="flex-c">
  20. <text>{{ currentTask }}<text class="progress-text font-18 color-green">/{{ totalTasks
  21. }}</text></text>
  22. </view>
  23. <view class="color-green" @click="handleNextTask">
  24. <text>下一个</text>
  25. </view>
  26. </view>
  27. </view>
  28. <!-- 库位信息 -->
  29. <view class="flex flex-j-b pad-10 next-location" style="padding-right:40rpx;align-items: center;">
  30. <view class="font-14 mb-20">{{ currentIndex }}/{{ totalTasks }}</view>
  31. <view class="flex-d">
  32. <view class="font-20 text-center">
  33. {{ nextLocation }}
  34. </view>
  35. <view class="location-detail font-13 mt-10">下一库位 {{ nextLocation }}</view>
  36. </view>
  37. <u-icon name="attach" size="28"></u-icon>
  38. </view>
  39. <!-- 订单信息 -->
  40. <view class="order-info">
  41. <view class="info-item">订单编号:{{ orderInfo.orderNo }}</view>
  42. <view class="info-item">物流单号:{{ orderInfo.logisticsNo }}</view>
  43. <view class="info-item">不良数量:{{ orderInfo.badCount }}</view>
  44. </view>
  45. <!-- 极差商品列表 -->
  46. <view class="bad-list">
  47. <view class="list-title mb-6 mt-20">极差</view>
  48. <view v-for="(item, index) in badList" :key="index">
  49. <BadOutCard :item="item" />
  50. </view>
  51. </view>
  52. <!-- 底部搜索框 -->
  53. <view class="fixed-bottom pad-20" style="background: #ffffff;">
  54. <u-search v-model="searchText" placeholder="请输入订单编号" :show-action="false" :clearabled="true"
  55. @change="onSearch" height="40">
  56. </u-search>
  57. <u-icon name="scan" size="28" color="#19be6b" @click="openScan"></u-icon>
  58. </view>
  59. </view>
  60. </template>
  61. <script setup>
  62. import {
  63. ref,onMounted
  64. } from 'vue'
  65. import BadOutCard from '@/pages/index/wms/components/BadOutCard.vue'
  66. import VolumeTTS from '@/utils/VolumeTTS.js'
  67. // 任务进度
  68. const currentTask = ref(0)
  69. const totalTasks = ref(77)
  70. const currentIndex = ref(1)
  71. const nextLocation = ref('K01-02-4A')
  72. // 订单信息
  73. const orderInfo = ref({
  74. orderNo: '4571211',
  75. logisticsNo: 'DPK203156442584',
  76. badCount: 10
  77. })
  78. const ttsModule = ref(null)
  79. onMounted(() => {
  80. ttsModule.value = new VolumeTTS()
  81. })
  82. // 搜索文本
  83. const searchText = ref('')
  84. // 极差商品列表
  85. const badList = ref([{
  86. image: 'https://img20.360buyimg.com/da/jfs/t1/141592/25/8861/261559/5f68d8c1E33ed78ab/698ad655bfcfbaed.png',
  87. title: '公文写作教程',
  88. isbn: '978704051555',
  89. price: 49.5,
  90. discount: 0.85,
  91. quantity: 5,
  92. set: '不是',
  93. good: 0,
  94. average: 0,
  95. bad: 1,
  96. reason: '明显泛黄水印/发霉/明显异味'
  97. }])
  98. // 处理下一个任务
  99. const handleNextTask = () => {
  100. if (currentTask.value < totalTasks.value) {
  101. currentTask.value++
  102. VolumeTTS.speak(nextLocation.value)
  103. }
  104. }
  105. // 搜索处理
  106. const onSearch = () => {
  107. // 实现搜索逻辑
  108. }
  109. // 提交处理
  110. const onSubmit = () => {
  111. uni.showModal({
  112. title: '确认提示',
  113. content: '是否确认提交本次下架?',
  114. success: (res) => {
  115. if (res.confirm) {
  116. // 处理提交逻辑
  117. uni.showToast({
  118. title: '提交成功',
  119. icon: 'success'
  120. })
  121. ttsModule.value.speak('任务已提交')
  122. }
  123. }
  124. })
  125. }
  126. function goBack() {
  127. uni.showModal({
  128. title: '确认提示',
  129. content: '是否确认放弃本次下架?',
  130. success: (res) => {
  131. if (res.confirm) {
  132. uni.navigateBack()
  133. ttsModule.value.speak('任务已放弃')
  134. }
  135. }
  136. })
  137. }
  138. // 打开扫码
  139. const openScan = () => {
  140. // #ifdef APP-PLUS || MP-WEIXIN
  141. uni.scanCode({
  142. success: (res) => {
  143. searchText.value = res.result
  144. onSearch()
  145. },
  146. fail: (err) => {
  147. uni.showToast({
  148. title: '扫码失败',
  149. icon: 'error'
  150. })
  151. }
  152. })
  153. // #endif
  154. // #ifdef H5
  155. uni.showToast({
  156. title: 'H5环境不支持扫码',
  157. icon: 'none'
  158. })
  159. // #endif
  160. }
  161. </script>
  162. <style scoped>
  163. .progress-section {
  164. background-color: #fff;
  165. display: flex;
  166. flex-direction: column;
  167. justify-content: center;
  168. padding: 10rpx;
  169. padding-top: 56px;
  170. }
  171. .next-location{
  172. background-color: #fff;
  173. border-bottom: 1rpx solid #f0f0f0;
  174. border-top: 1rpx solid #f0f0f0;
  175. padding: 20rpx;
  176. }
  177. .color-green {
  178. color: #4CAF50;
  179. }
  180. .location-info {
  181. background-color: #fff;
  182. padding: 20rpx;
  183. margin-top: 2rpx;
  184. }
  185. .location-detail {
  186. color: #666;
  187. }
  188. .order-info {
  189. background-color: #fff;
  190. padding: 20rpx;
  191. }
  192. .info-item {
  193. line-height: 1.8;
  194. }
  195. .list-title {
  196. font-size: 32rpx;
  197. font-weight: bold;
  198. background-color: rgb(222, 134, 143, 0.5);
  199. padding: 10rpx 0;
  200. padding-left: 30rpx;
  201. }
  202. </style>