index.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <view class='container' >
  3. <view class='content' style="height: 1000rpx;">
  4. <view >
  5. <text class='title'>当前箱号</text>
  6. <view class="vehicleList uni-row" style="height: 100%;">
  7. <view class="vehicleNo uni-row" v-for="(item,index) in vehicleList">
  8. <text>{{item}}</text>
  9. <text @click="handleDelVehicleNo(item)">×</text>
  10. </view>
  11. </view>
  12. </view>
  13. <view class="btn">
  14. <button class='submit code' @click="handleScanCode()" >扫码</button>
  15. </view>
  16. </view>
  17. <view class='bottom uni-row'>
  18. <button class='submit' type=primary>提交</button>
  19. </view>
  20. </view>
  21. </template>
  22. <script setup>
  23. import {
  24. ref
  25. } from 'vue'
  26. import {
  27. onLoad,
  28. onReady
  29. } from '@dcloudio/uni-app'
  30. onLoad(() => {
  31. })
  32. const vehicleList = ref(['X1234','X1654','X2458','X1698','X7895'])
  33. function handleDelVehicleNo(item) {
  34. vehicleList.value.splice(item,1);
  35. }
  36. function handleScanCode() {
  37. uni.scanCode({
  38. scanType: ['qrCode'], // 条形码扫描
  39. onlyFromCamera: true, // 只允许相机扫码
  40. success: function(res) {
  41. vehicleList.value.push(res.result);
  42. }
  43. });
  44. }
  45. </script>
  46. <style lang="scss">
  47. .container {
  48. height: 100%;
  49. background-color: #f5f5f5;
  50. }
  51. .bottom {
  52. background-color: white;
  53. width: 100%;
  54. height: 10%;
  55. position: absolute;
  56. bottom: 0;
  57. align-items: center;
  58. }
  59. .submit {
  60. margin: 0 auto;
  61. width: 80%;
  62. height: 80rpx;
  63. line-height: 80rpx;
  64. padding-left: 0;
  65. }
  66. .code {
  67. background-color: rgba(0, 226, 166,1);
  68. color: white;
  69. }
  70. .content {
  71. width: 90%;
  72. // height: auto;
  73. background-color: rgba(255, 255, 255, 1);
  74. margin: 50rpx auto;
  75. padding-bottom: 50rpx;
  76. border-radius: 12rpx;
  77. .vehicleList {
  78. justify-content: flex-start;
  79. flex-wrap: wrap;
  80. width: 100%;
  81. height: 120rpx;
  82. overflow: auto;
  83. padding: 0 80rpx;
  84. .vehicleNo {
  85. padding: 0 10rpx;
  86. margin: 10rpx;
  87. justify-content: space-between;
  88. align-items: center;
  89. width: 230rpx;
  90. height: 60rpx;
  91. border: 1px solid rgba(213, 213, 213, 1);
  92. border-radius: 6rpx;
  93. }
  94. }
  95. }
  96. .title {
  97. margin: 30rpx auto;
  98. width: 30%;
  99. font-size: 36rpx;
  100. font-weight: bold;
  101. }
  102. .btn {
  103. position: fixed;
  104. top: 940rpx;
  105. left: 0;
  106. right: 0;
  107. }
  108. .segment {
  109. width: 280rpx;
  110. height: 1rpx;
  111. border: 1px solid rgba(187, 187, 187, 1);
  112. }
  113. </style>