Просмотр исходного кода

Merge branch 'master' of http://git.yujin.shuziyunyao.com/yujin/forestry-wx

lisy 1 день назад
Родитель
Сommit
2119a73424

+ 5 - 6
src/components/ut-album/ut-album.vue

@@ -17,11 +17,11 @@
                             :src="item.url"
                             object-fit="cover"
                             :controls="false"
-                            :show-center-play-btn="true"
+                            :show-center-play-btn="false"
                             :show-play-btn="false"
-                            :enable-play-gesture="true"
+                            :enable-play-gesture="false"
                         />
-                        <view v-if="item.coverUrl" class="play-mask">
+                        <view class="play-mask">
                             <up-icon name="play-circle" color="#fff" size="48rpx"></up-icon>
                         </view>
                     </view>
@@ -152,7 +152,6 @@ const formatSize = (bytes) => {
 // 预览逻辑:图片/视频/文件
 const onItemClick = (item, displayIndex) => {
     if (!item) return;
-    if (item.type === 'video' && !item.coverUrl) return;
     if (item.type === 'image') return previewImages(item);
     if (item.type === 'video') return previewVideo(item, displayIndex);
     return previewFile(item);
@@ -170,10 +169,10 @@ const previewImages = (clickedItem) => {
 const previewVideo = (item, index) => {
     // #ifdef MP-WEIXIN
     const allVideos = items.value.filter((i) => i.type === 'video');
-    const sources = allVideos.map((i) => ({ url: i.url, type: 'video', poster: i.coverUrl || '' }));
+    const sources = allVideos.map((i) => ({ url: i.url, type: 'video', poster: i?.coverUrl || '' }));
     const current = allVideos.findIndex((i) => i.url === item.url);
     // @ts-ignore
-    wx.previewMedia({ sources, current: current >= 0 ? current : 0 });
+    uni.previewMedia({ sources, current: current >= 0 ? current : 0 });
     // #endif
     // #ifndef MP-WEIXIN
     uni.showToast({ title: '当前平台暂不支持视频预览', icon: 'none' });

+ 4 - 1
src/plant/base/base-edit/index.vue

@@ -663,7 +663,6 @@ const mapDrawArea = async () => {
     });
 };
 const clickPlotSwipe = (e: any, item: any, idx: number | string, title = '编辑地块') => {
-    console.log(e, item);
     const index = e.index;
     if (index == 0) {
         // 编辑
@@ -674,6 +673,10 @@ const clickPlotSwipe = (e: any, item: any, idx: number | string, title = '编辑
     }
     if (index == 1) {
         // 删除
+        // 判断删除的这条数据是否有id,如果有id则调用接口删除,没有id则直接在页面删除
+        if (item.id) {
+            form.value?.landDelIds?.push(item?.id)
+        }
         form.value.landInfoList.splice(idx, 1);
     }
 };

+ 64 - 7
src/plant/code/code-query/index.vue

@@ -3,34 +3,91 @@
         <template #top>
             <ut-navbar title="追溯码查询" :fixed="false"></ut-navbar>
         </template>
-        <view class="pd-20">
-            <up-button class="bg-fff" type="primary" plain>
+        <view class="pd-24">
+            <up-button class="bg-fff" type="primary" plain @click="handleScan">
                 <image class="w-36 h-36 mr-10" src="https://yujin-szyy.oss-cn-chengdu.aliyuncs.com/szyy/images-plt/common/primary_scan.png" mode="widthFix" />
                 <span>请扫描追溯码查询</span>
             </up-button>
         </view>
         <view v-if="!info">
-            <ut-empty class="mg-at" color="#ccc" size="28rpx"
-                image="https://yujin-szyy.oss-cn-chengdu.aliyuncs.com/szyy/images-plt/plant/noEmpty.png">
+            <ut-empty class="mg-at" color="#ccc" size="28rpx" image="https://yujin-szyy.oss-cn-chengdu.aliyuncs.com/szyy/images-plt/plant/noEmpty.png">
                 <view class="text-center">暂无查询结果</view>
                 <view class="text-center">点击上方按钮扫描追溯码查询</view>
             </ut-empty>
         </view>
-        <view v-if="info">
-            <view></view>
+        <view v-if="info" class="pd-24">
+            <view class="f-s-32 c-#333 f-w-5 mb-20">查询结果:</view>
+            <view class="bg-#fff b-radius">
+                <view>
+                    <view></view>
+                </view>
+                <view class="pd-24">
+                    <view class="mb-10">
+                        <span class="f-s-34 c-#333 f-w-5 mr-10">{{ info?.proName || '-' }}</span>
+                        <span class="f-s-24 c-#666">{{ info?.proLevel || '-' }}</span>
+                    </view>
+                    <view class="f-s-28 pd2-4-0">
+                        <span class="c-#666">成品批号:</span>
+                        <span class="c-#333 f-w-5">{{ info?.batchSn || '-' }}</span>
+                    </view>
+                    <view class="f-s-28 pd2-4-0">
+                        <span class="c-#666">包装批号:</span>
+                        <span class="c-#333 f-w-5">{{ info?.packSn || '-' }}</span>
+                    </view>
+                    <view class="d-flex flex-cln j-c a-c">
+                        <up-qrcode cid="ex4asdasdasdasewqeq" :size="uni.$u.getPx('200rpx')" :val="info?.packBatchUrl || ''" showLoading loadingText="loading..."></up-qrcode>
+                        <view class="f-s-26 c-#333 pt-10">点击查看追溯详情</view>
+                    </view>
+                </view>
+            </view>
         </view>
     </z-paging>
 </template>
 
 <script setup lang="ts">
 import { useClientRequest } from '@/utils/request';
+import { getUrlParams, isUrl } from '@/utils/ruoyi';
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 const { pt_code_downflag } = toRefs<any>(proxy?.useDict('pt_code_downflag'));
 const paging = ref();
 const info = ref<any>(null);
+// 获取追溯码信息
+const getInfo = async (traceCode: string) => {
+    try {
+        const res = await useClientRequest.get('/plt-api/app/packTask/getPackTraceSimpleInfoByTraceCode', { traceCode });
+        info.value = res.data;
+    } catch (error) {
+        console.error('查询追溯码信息失败:', error);
+        info.value = null;
+    }
+};
+const handleScan = () => {
+    // #ifdef MP-WEIXIN
+    uni.scanCode({
+        onlyFromCamera: true,
+        success: (res) => {
+            const result = (res.result || '').trim();
+            if (result) {
+                // 判断是否是url
+                if (isUrl(result)) {
+                    const urlParams = getUrlParams(result);
+                    const traceCode = urlParams['c'] || urlParams['code'];
+                    if (traceCode) {
+                        getInfo(traceCode);
+                    }
+                } else {
+                    getInfo(result);
+                }
+                return;
+            }
+        },
+        fail: () => {},
+    });
+    // #endif
+};
 
 onMounted(() => {
-
+    getInfo('PCC1W12603180000065C4');
 });
 </script>