2 Commits b7fc932258 ... c70a7763ef

Author SHA1 Message Date
  wangsisi c70a7763ef Merge branch 'master' of http://www.sysuimars.cn:3000/feiniao/feiniao-farm-h5 5 days ago
  wangsisi f463701066 fix:对接农事服务接口和修改报告样式UI兼容 5 days ago

+ 5 - 0
src/api/modules/user.js

@@ -41,4 +41,9 @@ module.exports = {
         url: config.base_dev_url + "container_farm_work_arrange/listWithAnswer",
         type: "get",
     },
+    //农场服务记录
+    farmServiceRecord: {
+        url: config.base_dev_url + "z_farm_work_record/farmServiceRecord",
+        type: "get",
+    },
 }

+ 5 - 3
src/components/recordItem.vue

@@ -32,18 +32,20 @@
                 <div class="info-line">
                     药物处方:<span class="info-val">{{ getPrescriptionInfo(recordItemData) }}</span>
                 </div>
-                <div class="review-image" v-if="showFarmImage && recordItemData.executeEvidence.length">
+                <div class="review-image" v-if="showFarmImage && recordItemData.executeEvidence.length || recordItemData.executeEvidenceList.length">
                     <!-- <div class="image-wrapper" v-if="currentImageUrl">
                         <span class="image-label">执行照片</span>
                         <img :src="currentImageUrl" alt="" />
                     </div> -->
                     <div class="image-wrapper">
                         <span class="image-label">执行照片</span>
-                        <img :src="base_img_url2 + recordItemData.executeEvidence[0]" alt="" />
+                        <img v-if="recordItemData.executeEvidence?.[0]" :src="base_img_url2 + recordItemData.executeEvidence[0]" alt="" />
+                        <img v-else :src="base_img_url2 + recordItemData.executeEvidenceList[0]" alt="" />
                     </div>
                     <div class="image-wrapper">
                         <span class="image-label">执行照片</span>
-                        <img :src="base_img_url2 + recordItemData.executeEvidence[1]" alt="" />
+                        <img v-if="recordItemData.executeEvidence?.[1]" :src="base_img_url2 + recordItemData.executeEvidence[1]" alt="" />
+                        <img v-else :src="base_img_url2 + recordItemData.executeEvidenceList[1]" alt="" />
                     </div>
                 </div>
             </div>

+ 6 - 1
src/views/old_mini/achievement_report/index.vue

@@ -525,9 +525,14 @@ onUnmounted(() => {
             position: relative;
             .report-box-item {
                 flex: 1;
-                padding: 10px 2px;
                 background: rgba(33, 153, 248, 0.1);
                 border-radius: 8px;
+                min-height: 62px;
+                box-sizing: border-box;
+                padding: 2px 4px;
+                display: flex;
+                flex-direction: column;
+                justify-content: center;
                 .item-content {
                     color: #2199f8;
                     font-size: 14px;

+ 24 - 12
src/views/old_mini/user/farmDetails.vue

@@ -89,10 +89,11 @@
                                 onlyRecipeName
                                 :content-mode="farmServiceActiveTab === 0 ? 'serviceDetail' : ''"
                                 title-mode="default"
-                                :title-right-text="farmServiceActiveTab === 0 ? '分享成果' : ''"
+                                :title-right-text="farmServiceActiveTab === 0 ? '生成成果报告' : ''"
                                 :title-right-type="farmServiceActiveTab === 1 ? 'dot' : null"
                                 :title-right-dot-text="farmServiceActiveTab === 1 ? '2区' : ''"
                                 class="recipe-item"
+                                @titleRightClick="handleTitleRightClick"
                             />
                         </div>
                         <empty
@@ -174,14 +175,23 @@ const handleFarmServiceTabChange = (index) => {
         getFarmPastServiceCost();
         getDetailList();
     } else {
+        getFutureFarmWorkWarning()
         getFutureFarmWorkList();
-        serviceStatsData.value = [
-            { value: "1258", unit: "元", desc: "预计成交额" },
-            { value: "5", unit: "次", desc: "预计服务次数" },
-        ];
     }
 };
 
+const getFutureFarmWorkWarning = async () => {
+    const {data} = await VE_API.home.listFutureFarmWorkWarning({ farmId: farmIdVal.value });
+    let totalCost = 0;
+    if (data.length > 0) {
+        totalCost = data.reduce((acc, item) => acc + item.estimatedCost, 0);
+    }
+    serviceStatsData.value = [
+        { value: totalCost || 0, unit: "元", desc: "预计成交额" },
+        { value: data.length || 0, unit: "次", desc: "预计服务次数" },
+    ];
+};
+
 const serviceStatsData = ref([]);
 
 onMounted(() => {
@@ -206,7 +216,6 @@ const paramsPage = ref({});
 const getFarmDetail = () => {
     VE_API.user.getFarmDetail({ farmId: farmIdVal.value }).then(({ data }) => {
         farmDetail.value = data || {};
-        console.log(farmDetail.value);
     });
 };
 
@@ -296,12 +305,8 @@ const getFarmPhoto = async () => {
 
 const detailList = ref([]);
 const getDetailList = () => {
-    const params = {
-        ...paramsPage.value,
-        flowStatus: "4,5",
-    };
-    VE_API.user.getDetailList(params).then(({ data }) => {
-        detailList.value = data || [];
+    VE_API.user.farmServiceRecord({ farmId: farmIdVal.value }).then(({ data }) => {
+        detailList.value = [data[0]] || [];
     });
 };
 const getFutureFarmWorkList = () => {
@@ -357,6 +362,13 @@ const onSelect = () => {
         url: `/pages/subPages/share_page/index?pageParams=${JSON.stringify(query)}&type=shareFarm`,
     });
 };
+
+const handleTitleRightClick = (section) => {
+    router.push({
+        path: "/achievement_report",
+        query: { miniJson: JSON.stringify({ id: section.id }) },
+    });
+};
 </script>
 
 <style scoped lang="scss">

+ 26 - 13
src/views/old_mini/user/subPages/serviceList.vue

@@ -17,10 +17,11 @@
                     onlyRecipeName
                     :content-mode="farmServiceActiveTab === 0 ? 'serviceDetail' : ''"
                     title-mode="default"
-                    :title-right-text="farmServiceActiveTab === 0 ? '分享成果' : ''"
+                    :title-right-text="farmServiceActiveTab === 0 ? '生成成果报告' : ''"
                     :title-right-type="farmServiceActiveTab === 1 ? 'dot' : null"
                     :title-right-dot-text="farmServiceActiveTab === 1 ? '2区' : ''"
                     class="recipe-item"
+                    @titleRightClick="handleTitleRightClick"
                 />
                 <empty
                     v-show="detailList.length === 0"
@@ -39,11 +40,12 @@ import tabList from "@/components/pageComponents/TabList.vue";
 import StatsBox from "@/components/pageComponents/StatsBox.vue";
 import recordItem from "@/components/recordItem.vue";
 import { Empty } from "vant";
-import { useRoute } from "vue-router";
+import { useRoute, useRouter } from "vue-router";
 import { ref, onMounted } from "vue";
 
 const route = useRoute();
 const farmIdVal = ref(null);
+const router = useRouter();
 onMounted(() => {
     farmIdVal.value = route.query.farmId;
     getDetailList();
@@ -60,23 +62,27 @@ const handleFarmServiceTabChange = (index) => {
         getDetailList();
     } else {
         getFutureFarmWorkList();
-        serviceStatsData.value = [
-            { value: "1258", unit: "元", desc: "预计成交额" },
-            { value: "5", unit: "次", desc: "预计服务次数" },
-        ];
+        getFutureFarmWorkWarning()
     }
 };
+
+const getFutureFarmWorkWarning = async () => {
+    const {data} = await VE_API.home.listFutureFarmWorkWarning({ farmId: farmIdVal.value });
+    let totalCost = 0;
+    if (data.length > 0) {
+        totalCost = data.reduce((acc, item) => acc + item.estimatedCost, 0);
+    }
+    serviceStatsData.value = [
+        { value: totalCost || 0, unit: "元", desc: "预计成交额" },
+        { value: data.length || 0, unit: "次", desc: "预计服务次数" },
+    ];
+};
+
 const paramsPage = ref(1);
 const paramsLimit = ref(99);
 const detailList = ref([]);
 const getDetailList = () => {
-    const params = {
-        farmId: farmIdVal.value,
-        flowStatus: '4,5',
-        limit: paramsLimit.value,
-        page: paramsPage.value,
-    };
-    VE_API.user.getDetailList(params).then(({ data }) => {
+    VE_API.user.farmServiceRecord({ farmId: farmIdVal.value }).then(({ data }) => {
         detailList.value = data || [];
     });
 };
@@ -99,6 +105,13 @@ const getFarmPastServiceCost = () => {
         ];
     });
 };
+
+const handleTitleRightClick = (section) => {
+    router.push({
+        path: "/achievement_report",
+        query: { miniJson: JSON.stringify({ id: section.id }) },
+    });
+};
 </script>
 
 <style scoped lang="scss">