Commit 793dde091fe7ab51a7e9437d550bab10cc4d896c

Authored by liujun001
1 parent 6ff911b1

H5识别二维码

garbage-removal/src/components/next-tree/next-tree.vue
... ... @@ -747,7 +747,7 @@ export default {
747 747 initUiModePopup(watched) {
748 748 uni.getSystemInfo({
749 749 success: (res) => {
750   - this.top = (res.windowHeight - this.height) + 'px';
  750 + this.top = (res.windowHeight - this.height+100) + 'px';
751 751 }
752 752 });
753 753 watched && watched();
... ...
garbage-removal/src/pages/order-info/order-other/detail/index.vue
... ... @@ -577,8 +577,8 @@ const handlerUpdateOrderClick = () => {
577 577 candidates.value = [[...new Set(res.data.rows
578 578 .filter(item => item.containerVolume)
579 579 .map(item => {
580   - garCarLabelInfoList.value[item.containerVolume + "方车"] = item
581   - return item.containerVolume + "方车"
  580 + garCarLabelInfoList.value[item.carType] = item
  581 + return item.carType
582 582 }))
583 583 ]];
584 584 // 设置初始车辆数量
... ...
garbage-removal/src/pages/order/order-disposal/index.vue
... ... @@ -34,7 +34,11 @@
34 34 <view class="scan-box">
35 35 <view class="scan-btn">
36 36 <view class="scan-icon">
37   - <u-icon @click="handleScan" name="scan" :size="80" color="#fff"></u-icon>
  37 +
  38 +
  39 + <!-- #ifdef H5 -->
  40 + <u-icon @click="handleScanH5" name="scan" :size="80" color="#fff"></u-icon>
  41 + <!-- #endif -->
38 42 </view>
39 43 </view>
40 44 </view>
... ... @@ -44,6 +48,7 @@
44 48 import { checkCode } from '@/apis/order.js';
45 49 import { nextTick, onMounted, ref } from 'vue';
46 50 import swiperListItem from './swiper-list-item/index.vue';
  51 +import { useMainStore } from '@/stores';
47 52 const list = ref([{ name: '处理中' }, { name: '已完成' }])
48 53 const current = ref(0);
49 54 const swiperCurrent = ref(0);
... ... @@ -51,6 +56,8 @@ const uTabsElement = ref();
51 56 const title = ref('处置场所');
52 57 const topMargin = ref();
53 58 const lightHeight = ref();
  59 +const store = useMainStore();
  60 +
54 61 const tabsChange = (el) => {
55 62 console.log("tabsChange", el);
56 63 swiperCurrent.value = Number(el.index)
... ... @@ -66,6 +73,8 @@ const translation = (e) =&gt; {
66 73 }
67 74  
68 75 const handleScan = () => {
  76 +
  77 +
69 78 uni.scanCode({
70 79 success: function (res) {
71 80 console.log('条码类型:' + res.scanType);
... ... @@ -88,14 +97,63 @@ const handleScan = () =&gt; {
88 97 }
89 98 } catch (error) {
90 99 uni.$u.toast("无法确认当前二维码趟次,请扫描正在进行的运输趟次");
  100 + console.log("===================>weixin");
91 101 }
92 102 },
93 103 fail:function (res) {
94 104 uni.$u.toast("图片扫码失败,请检查二维码图片");
  105 + console.log("===================>weixin");
95 106 }
96 107 });
97 108 }
98 109  
  110 +const handleScanH5 = () => {
  111 + uni.chooseImage({
  112 + count:1,
  113 + sizeType:['original','compressed'],
  114 + sourceType:['camera','album'],
  115 + success:(res)=>{
  116 + console.log(res.tempFilePaths[0]);
  117 + uni.uploadFile({
  118 + url:import.meta.env.VITE_BASE_URL+"/QRCode/ocr/pric",
  119 + header: {
  120 + "Authorization": store.token
  121 + },
  122 + fileType:'image',
  123 + filePath:res.tempFilePaths[0],
  124 + name:'file',
  125 + success:(uploadRes)=>{
  126 + if (uploadRes.statusCode == 200) {
  127 + if("" == uploadRes.data || undefined == uploadRes.data || null == uploadRes.data){
  128 + uni.$u.toast("二维码图片识别失败,请检查二维码图片");
  129 + return;
  130 + }else{
  131 + checkCode(uploadRes.data).then(res => {
  132 + if (res.data&& res.data.code == 200) {
  133 + uni.$u.route({
  134 + url: `pages/order-info/order-disposal/scan-detail/index`,
  135 + params: {
  136 + data: encodeURIComponent(JSON.stringify(res.data.data))
  137 + }
  138 + })
  139 + return
  140 + }
  141 + uni.$u.toast(res.data.msg);
  142 + })
  143 + }
  144 + }else{
  145 + uni.$u.toast("二维码图片识别失败,请检查二维码图片");
  146 + }
  147 +
  148 + }
  149 + })
  150 +
  151 + }
  152 + })
  153 +}
  154 +
  155 +
  156 +
99 157  
100 158 onMounted(() => {
101 159 console.log("处理场所");
... ...