index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <view class="page-container uni-column">
  3. <view class="search-container uni-row">
  4. <input type="text" v-model="keywords" placeholder="请输入箱号" />
  5. <view class="btn uni-row">搜索</view>
  6. <!-- <uni-icons type="scan" size="24" /> -->
  7. </view>
  8. <view class="scan-btn uni-row" @click.stop="handleScanCode">扫描箱号</view>
  9. <view class="daywork-item uni-column" v-for="(item, index) in dayworkList" :key="index">
  10. <view class="lot-code uni-row">
  11. <text>批次号:{{ item.lot_code }}</text>
  12. <uni-icons type="right" size="16" />
  13. </view>
  14. <view class="info">
  15. <view class="info-row uni-row">
  16. <view class="label">序检箱号:</view>
  17. <view class="value">{{ item.carrier_code }}</view>
  18. <view class="label">检察员:</view>
  19. <view class="value">{{ item.inspector }}</view>
  20. </view>
  21. <view class="info-row uni-row">
  22. <view class="label">检查数量:</view>
  23. <view class="value">{{ item.checks_number }}</view>
  24. <view class="label">不合格数:</view>
  25. <view class="value">{{ item.unacceptable_amount }}</view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script setup>
  32. import { ref } from 'vue'
  33. import { onLoad, onReady, onUnload, onShow } from '@dcloudio/uni-app'
  34. const keywords = ref('')
  35. const dayworkList = ref([])
  36. /***************************** 页面生命周期函数 *****************************/
  37. onShow(() => {
  38. dayworkList.value = [
  39. {
  40. lot_code: 'D2423156000691',
  41. carrier_code: '000010',
  42. inspector: '张蕾',
  43. checks_number: 20,
  44. unacceptable_amount: 3
  45. },
  46. {
  47. lot_code: 'D2423156000691',
  48. carrier_code: '000010',
  49. inspector: '张蕾',
  50. checks_number: 20,
  51. unacceptable_amount: 3
  52. }
  53. ]
  54. })
  55. /***************************** 定义了一些方法 *****************************/
  56. const addProcessInspection = (data) => {
  57. const info = {
  58. title: data.title,
  59. standard: data.standard,
  60. result: '',
  61. number: 1
  62. }
  63. unfitInfos.value.push(info)
  64. }
  65. /***************************** 定义了一些事件 *****************************/
  66. // 扫码
  67. const handleScanCode = () => {
  68. uni.scanCode({
  69. onlyFromCamera: true,
  70. success: function (res) {
  71. if (res.scanType !== 'QR_CODE') {
  72. uni.showToast({
  73. icon: 'none',
  74. title: '二维码未识别成功',
  75. duration: 2000
  76. })
  77. return
  78. }
  79. console.log(res)
  80. const result = JSON.parse(res.result)
  81. uni.navigateTo({
  82. url: '/pages/processInspection/scan?carrierId=' + result.carrierId + '&carrierCode=' + result.carrierCode
  83. })
  84. }
  85. });
  86. }
  87. // 添加不合格信息
  88. const handleShowUnfit = () => {
  89. uni.navigateTo({
  90. url: "/pages/processInspection/form"
  91. })
  92. }
  93. </script>
  94. <style lang="scss">
  95. .page-container {
  96. height: 100%;
  97. background-color: #ececec;
  98. font-size: 28rpx;
  99. padding: 24rpx;
  100. box-sizing: border-box;
  101. }
  102. .search-container {
  103. border-radius: 12rpx;
  104. align-items: center;
  105. input {
  106. flex: 1;
  107. background-color: #ffffff;
  108. height: 64rpx;
  109. box-sizing: border-box;
  110. padding: 0 16rpx;
  111. }
  112. .btn {
  113. width: 120rpx;
  114. height: 64rpx;
  115. background-color: #1684FC;
  116. justify-content: center;
  117. font-size: 24rpx;
  118. color: #ffffff;
  119. justify-content: center;
  120. align-items: center;
  121. }
  122. }
  123. .scan-btn {
  124. height: 64rpx;
  125. margin: 32rpx 32rpx 0 32rpx;
  126. color: #ffffff;
  127. background-color: #00D068;
  128. align-items: center;
  129. justify-content: center;
  130. border-radius: 8rpx;
  131. }
  132. .daywork-item {
  133. padding: 24rpx;
  134. background-color: #ffffff;
  135. margin-top: 24rpx;
  136. border-radius: 8rpx;
  137. .lot-code {
  138. align-items: center;
  139. justify-content: space-between;
  140. font-weight: 700;
  141. }
  142. .info {
  143. font-size: 24rpx;
  144. color: #767676;
  145. .info-row {
  146. margin-top: 16rpx;
  147. .label {
  148. width: 120rpx;
  149. }
  150. .value {
  151. flex: 1;
  152. }
  153. }
  154. }
  155. }
  156. </style>