index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template>
  2. <view class="uni-column" style="height: 100%; background-color: #f5f5f5;">
  3. <scroll-view class="scroll-container" scroll-y>
  4. <view v-for="(item, index) in listData" :key="index" :class="{'list-item':true,'selected':isSelected(index)}"
  5. @click="handleSelection(index)">
  6. <view class="title-container uni-row">
  7. <view class="title uni-row">
  8. <text class="label">{{ item['door'] }}</text>
  9. <text class="label code">{{ item['process'] }}</text>
  10. <text class="label code" style="margin-left: 16rpx;">→</text>
  11. <text class="label code" style="margin-left: 16rpx;">{{ item['car'] }}</text>
  12. </view>
  13. <view class="right-info uni-row">
  14. <view class="uni-row"><text class="label right">删除</text></view>
  15. </view>
  16. </view>
  17. <view class="item-info uni-row"> <text class="label ">产品描述</text>
  18. <text class="label right" style="color: #000000;">{{ item['description'] }}</text>
  19. </view>
  20. <view class="item-info uni-row"> <text class="label">批次</text>
  21. <text class="label right ">{{ item['batch'] }}</text>
  22. </view>
  23. <view class="item-info uni-row">
  24. <text class="label">箱数</text>
  25. <text class="label right">{{ item['cases'] }}</text>
  26. </view>
  27. <view class="item-info uni-row">
  28. <text class="label">箱号</text>
  29. <text class="label right">{{ item['caseNumber']}}</text>
  30. </view>
  31. </view>
  32. </scroll-view>
  33. <view class="bottom uni-row">
  34. <button class="bottom-btn left-btn ">继续扫码</button>
  35. <button class="bottom-btn right-btn" @click="handleTurnoverTask(null)">确认周转</button>
  36. </view>
  37. <dialog-turnoverTask ref="turnoverTaskDialog" />
  38. </view>
  39. </template>
  40. <script setup>
  41. import {
  42. ref
  43. } from 'vue'
  44. import {
  45. onLoad,
  46. onReady
  47. } from '@dcloudio/uni-app'
  48. onLoad(() => {
  49. })
  50. const active = ref(false)
  51. const selection =ref([])
  52. const turnoverTaskDialog = ref(null)
  53. const listData = ref([{
  54. door: "A门",
  55. process: "粗磨",
  56. car: "NC车",
  57. description: "万博_039561419_15*110.1",
  58. batch: "DC23727410070",
  59. cases: 5,
  60. caseNumber: "X12522、X55222、X15522、J5211、J5211"
  61. },
  62. {
  63. door: "A门",
  64. process: "粗磨",
  65. car: "NC车",
  66. description: "万博_039561419_15*110.1",
  67. batch: "DC23727410070",
  68. cases: 5,
  69. caseNumber: "X12522、X55222、X15522、J5211、J5211"
  70. },
  71. {
  72. door: "A门",
  73. process: "粗磨",
  74. car: "NC车",
  75. description: "万博_039561419_15*110.1",
  76. batch: "DC23727410070",
  77. cases: 5,
  78. caseNumber: "X12522、X55222、X15522、J5211、J5211"
  79. },
  80. {
  81. door: "A门",
  82. process: "粗磨",
  83. car: "NC车",
  84. description: "万博_039561419_15*110.1",
  85. batch: "DC23727410070",
  86. cases: 5,
  87. caseNumber: "X12522、X55222、X15522、J5211、J5211"
  88. },
  89. {
  90. door: "A门",
  91. process: "粗磨",
  92. car: "NC车",
  93. description: "万博_039561419_15*110.1",
  94. batch: "DC23727410070",
  95. cases: 5,
  96. caseNumber: "X12522、X55222、X15522、J5211、J5211"
  97. }
  98. ])
  99. const handleStartTurnover = (data) => {
  100. let _data = data ?? {}
  101. // 调用子组件中的方法
  102. turnoverTaskDialog.value.open(_data)
  103. }
  104. const isSelected = (index) => {
  105. return selection.value.includes(index)
  106. }
  107. const handleSelection = (index) => {
  108. console.log(index)
  109. const buttonIndex = selection.value.indexOf(index);
  110. if (buttonIndex > -1) {
  111. selection.value.splice(buttonIndex, 1); // 取消选中
  112. } else {
  113. selection.value.push(index); // 选中
  114. }
  115. console.log(selection.value)
  116. }
  117. </script>
  118. <style lang="scss">
  119. .scroll-container {
  120. position: absolute;
  121. top: 24rpx;
  122. right: 0;
  123. bottom: 160rpx;
  124. left: 0;
  125. }
  126. .selected {
  127. border: 1px solid #1684fc;
  128. }
  129. .list-item {
  130. background-color: #fff;
  131. position: relative;
  132. padding: 16rpx;
  133. padding-bottom: 24rpx;
  134. margin: 0 24rpx;
  135. margin-bottom: 24rpx;
  136. border-radius: 8rpx;
  137. .title-container {
  138. justify-content: space-between;
  139. margin-top: 8rpx;
  140. margin-bottom: 16rpx;
  141. .title {
  142. height: 48rpx;
  143. align-items: center;
  144. .label {
  145. color: #1684fc;
  146. font-size: 32rpx;
  147. font-weight: bold;
  148. &.code {
  149. color: #000000;
  150. margin-left: 32rpx;
  151. }
  152. }
  153. }
  154. }
  155. .item-info {
  156. margin-bottom: 16rpx;
  157. .label {
  158. font-size: 28rpx;
  159. width: 152rpx;
  160. color: #808080;
  161. &.right {
  162. flex: 1;
  163. color: #808080;
  164. }
  165. }
  166. }
  167. .right-info {
  168. justify-content: flex-end;
  169. margin-top: 2rpx;
  170. .label {
  171. font-size: 28rpx;
  172. color: #ff0000;
  173. }
  174. }
  175. }
  176. .bottom {
  177. position: absolute;
  178. right: 0;
  179. bottom: 0;
  180. left: 0;
  181. height: 100rpx;
  182. padding: 16rpx 24rpx;
  183. align-items: center;
  184. background-color: #FFFFFF;
  185. justify-content: space-between;
  186. .bottom-btn {
  187. flex: 1;
  188. font-size: 28rpx;
  189. color: #FFFFFF;
  190. &.left-btn {
  191. background-color: #1684fc;
  192. }
  193. &.right-btn {
  194. background-color: rgb(255, 121, 1);
  195. margin-left: 24rpx;
  196. }
  197. }
  198. }
  199. </style>