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,7 +747,7 @@ export default {
747 initUiModePopup(watched) { 747 initUiModePopup(watched) {
748 uni.getSystemInfo({ 748 uni.getSystemInfo({
749 success: (res) => { 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 watched && watched(); 753 watched && watched();
garbage-removal/src/pages/order-info/order-other/detail/index.vue
@@ -577,8 +577,8 @@ const handlerUpdateOrderClick = () => { @@ -577,8 +577,8 @@ const handlerUpdateOrderClick = () => {
577 candidates.value = [[...new Set(res.data.rows 577 candidates.value = [[...new Set(res.data.rows
578 .filter(item => item.containerVolume) 578 .filter(item => item.containerVolume)
579 .map(item => { 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,7 +34,11 @@
34 <view class="scan-box"> 34 <view class="scan-box">
35 <view class="scan-btn"> 35 <view class="scan-btn">
36 <view class="scan-icon"> 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 </view> 42 </view>
39 </view> 43 </view>
40 </view> 44 </view>
@@ -44,6 +48,7 @@ @@ -44,6 +48,7 @@
44 import { checkCode } from '@/apis/order.js'; 48 import { checkCode } from '@/apis/order.js';
45 import { nextTick, onMounted, ref } from 'vue'; 49 import { nextTick, onMounted, ref } from 'vue';
46 import swiperListItem from './swiper-list-item/index.vue'; 50 import swiperListItem from './swiper-list-item/index.vue';
  51 +import { useMainStore } from '@/stores';
47 const list = ref([{ name: '处理中' }, { name: '已完成' }]) 52 const list = ref([{ name: '处理中' }, { name: '已完成' }])
48 const current = ref(0); 53 const current = ref(0);
49 const swiperCurrent = ref(0); 54 const swiperCurrent = ref(0);
@@ -51,6 +56,8 @@ const uTabsElement = ref(); @@ -51,6 +56,8 @@ const uTabsElement = ref();
51 const title = ref('处置场所'); 56 const title = ref('处置场所');
52 const topMargin = ref(); 57 const topMargin = ref();
53 const lightHeight = ref(); 58 const lightHeight = ref();
  59 +const store = useMainStore();
  60 +
54 const tabsChange = (el) => { 61 const tabsChange = (el) => {
55 console.log("tabsChange", el); 62 console.log("tabsChange", el);
56 swiperCurrent.value = Number(el.index) 63 swiperCurrent.value = Number(el.index)
@@ -66,6 +73,8 @@ const translation = (e) =&gt; { @@ -66,6 +73,8 @@ const translation = (e) =&gt; {
66 } 73 }
67 74
68 const handleScan = () => { 75 const handleScan = () => {
  76 +
  77 +
69 uni.scanCode({ 78 uni.scanCode({
70 success: function (res) { 79 success: function (res) {
71 console.log('条码类型:' + res.scanType); 80 console.log('条码类型:' + res.scanType);
@@ -88,14 +97,63 @@ const handleScan = () =&gt; { @@ -88,14 +97,63 @@ const handleScan = () =&gt; {
88 } 97 }
89 } catch (error) { 98 } catch (error) {
90 uni.$u.toast("无法确认当前二维码趟次,请扫描正在进行的运输趟次"); 99 uni.$u.toast("无法确认当前二维码趟次,请扫描正在进行的运输趟次");
  100 + console.log("===================>weixin");
91 } 101 }
92 }, 102 },
93 fail:function (res) { 103 fail:function (res) {
94 uni.$u.toast("图片扫码失败,请检查二维码图片"); 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 onMounted(() => { 158 onMounted(() => {
101 console.log("处理场所"); 159 console.log("处理场所");