Browse Source

feat:修改页面显示UI和农事详情未来农事接口对接

wangsisi 4 days ago
parent
commit
b7ed12990f

+ 1 - 2
src/components/pageComponents/AgriculturalInteractionCard.vue

@@ -29,7 +29,7 @@
     <!-- 服务报价单 -->
     <price-sheet-popup ref="priceSheetPopupRef"></price-sheet-popup>
 
-    <popup v-model:show="showTaskPopup" round class="task-tips-popup">
+    <popup v-model:show="showTaskPopup" z-index="10000" round class="task-tips-popup">
         <img class="create-farm-icon" src="@/assets/img/home/create-farm-icon.png" alt="" />
         <div class="create-farm-text">
             <div>
@@ -206,7 +206,6 @@ const showPriceSheetPopup = (id, item) => {
     }
 }
 .task-tips-popup {
-    z-index: 1000 !important;
     width: 90%;
     padding: 28px 28px 20px;
     display: flex;

+ 9 - 9
src/components/recordItem.vue

@@ -5,8 +5,8 @@
             <div v-if="titleMode === 'default'" class="box-title">
                 <div class="title-l">
                     {{ recordItemData.farmWorkName || recordItemData.name }}
-                    <span class="parent-text" v-if="recordItemData.type || recordItemData.farmWorkType">
-                        {{ farmWorkType[recordItemData.type || recordItemData.farmWorkType] }}
+                    <span class="parent-text" v-if="recordItemData.type!=null || recordItemData.farmWorkType!=null">
+                        {{ farmWorkType[recordItemData.type!=null ? recordItemData.type : recordItemData.farmWorkType] }}
                     </span>
                 </div>
                 <!-- 按钮样式 -->
@@ -70,7 +70,7 @@
         <div class="record-content" v-else>
             <div class="info-item">
                 推荐时间:
-                <span class="info-val">{{ recordItemData?.executeDate || recordItemData?.recommendDate || "--" }}</span>
+                <span class="info-val">{{ recordItemData?.executeDate || recordItemData?.interactionTime || "--" }}</span>
             </div>
             <div
                 class="info-item recipe-name"
@@ -147,12 +147,12 @@
                     </div>
                 </div>
             </div>
-            <!-- <div class="info-item">
-                触发条件
+            <div class="info-item" v-if="recordItemData?.estimatedCost">
+                预计报价
                 <span class="info-val">{{
-                    recordItemData?.farmWorkDetail?.condition || recordItemData?.condition || "暂无触发条件"
-                }}</span>
-            </div> -->
+                    recordItemData?.estimatedCost || 0
+                }}</span>
+            </div>
             <div class="info-item one-text">
                 农事编号:
                 <span class="info-val">{{
@@ -225,7 +225,7 @@ const getPrescriptionInfo = (section) => {
             return names.join("+");
         }
     }
-    return "";
+    return "暂无处方";
 };
 
 const farmWorkType = {

+ 50 - 33
src/views/old_mini/home/subPages/warningDetail.vue

@@ -17,7 +17,36 @@
                 <img :src="warningDetail?.media && warningDetail?.media[0]" alt="荔枝开花图片" />
             </div>
 
-            <div class="article-box" v-if="pageParams.questTitle">
+            <!-- <div class="photo-img-wrap-container" v-if="cropAlbum.length">
+                <div class="photo-img-wrap-title">
+                    <div class="title-text">
+                        <span>作物相册</span>
+                        <span class="count">({{ cropAlbum.length }})</span>
+                    </div>
+                    <span class="more" @click="handleSeeMore">查看更多</span>
+                </div>
+                <div class="photo-img-wrap">
+                    <photo-provider :photo-closable="true">
+                        <photo-consumer
+                            v-for="(src, index) in cropAlbum"
+                            intro="执行照片"
+                            :key="index"
+                            :src="base_img_url2 + src.filename"
+                        >
+                            <div class="photo-img">
+                                <img :src="base_img_url2 + src.filename + resize_300" />
+                            </div>
+                        </photo-consumer>
+                    </photo-provider>
+                </div>
+            </div> -->
+
+            <div class="article-text">
+                <span v-html="warningDetail.content"></span>
+            </div>
+
+            <div class="article-box" :style="{ bottom: isLink ? '10px' : '70px' }" v-if="pageParams.questTitle && showArticleBox">
+                <el-icon class="close-icon" @click="showArticleBox = false"><CloseBold /></el-icon>
                 <div class="box-top">
                     <img class="icon" src="@/assets/img/home/ask-icon.png" alt="" />
                     <div class="title">{{ pageParams.questTitle }}</div>
@@ -53,34 +82,6 @@
                 </div>
             </div>
 
-            <div class="photo-img-wrap-container" v-if="cropAlbum.length">
-                <div class="photo-img-wrap-title">
-                    <div class="title-text">
-                        <span>作物相册</span>
-                        <span class="count">({{ cropAlbum.length }})</span>
-                    </div>
-                    <span class="more" @click="handleSeeMore">查看更多</span>
-                </div>
-                <div class="photo-img-wrap">
-                    <photo-provider :photo-closable="true">
-                        <photo-consumer
-                            v-for="(src, index) in cropAlbum"
-                            intro="执行照片"
-                            :key="index"
-                            :src="base_img_url2 + src.filename"
-                        >
-                            <div class="photo-img">
-                                <img :src="base_img_url2 + src.filename + resize_300" />
-                            </div>
-                        </photo-consumer>
-                    </photo-provider>
-                </div>
-            </div>
-
-            <div class="article-text">
-                <span v-html="warningDetail.content"></span>
-            </div>
-
             <div class="custom-bottom-fixed-btns" v-if="!isLink">
                 <div class="bottom-btn primary-btn" @click="showShareSheet = true">转发</div>
             </div>
@@ -168,6 +169,7 @@ const isLink = ref(true);
 const warningDetail = ref({});
 const showImage = ref(false);
 const pageParams = ref({});
+const showArticleBox = ref(true);
 
 onActivated(() => {
     showImage.value = route.query.showImage === "true" ? true : false;
@@ -181,7 +183,7 @@ onActivated(() => {
     }
     getAnswer();
     // 获取图片数据
-    getFarmPhoto();
+    // getFarmPhoto();
     getWarningDetail();
 });
 
@@ -417,13 +419,28 @@ const handleEditQuestion = () => {
         }
 
         .article-box {
-            margin-bottom: 12px;
-            border-radius: 8px;
-            border: 1px solid #2199f8;
+            position: fixed;
+            bottom: 70px;
+            left: 15px;
+            right: 0;
             padding: 10px;
+            background: #fff;
+            box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.05);
+            border-radius: 5px;
+            border: 1px solid #F0F0F0;
+            width: calc(100% - 30px);
+            box-sizing: border-box;
+            .close-icon{
+                position: absolute;
+                right: 6px;
+                top: 6px;
+                font-size: 18px;
+                color: #000;
+            }
             .box-top {
                 display: flex;
                 gap: 8px;
+                width: 94%;
 
                 .icon {
                     width: 20px;

+ 15 - 5
src/views/old_mini/mine/pages/message.vue

@@ -12,7 +12,9 @@
                 <div class="message-item" v-for="(item, index) in messageList" :key="index" @click="handleItem(item)">
                     <el-badge class="badge" is-dot v-if="!item.status"> </el-badge>
                     <div class="message-content">
-                        <div class="title">收到来自{{ item.farmData?.farmName }}的{{ item.farmData?.farmWorkName }}农事提醒</div>
+                        <div class="title">
+                            收到来自{{ item.farmData?.farmName }}的{{ item.farmData?.farmWorkName }}农事提醒
+                        </div>
                         <div class="desc">{{ item.desc }}</div>
                         <div class="footer">
                             <div class="footer-left">
@@ -37,10 +39,18 @@ import customHeader from "@/components/customHeader.vue";
 
 const router = useRouter();
 
-const handleItem = (item) => {
-    VE_API.mine.confirmCard({ id: item.id }).then((res) => {
+const handleItem = async (item) => {
+    VE_API.mine.confirmCard({ id: item.id }).then(async (res) => {
         if (res.code === 0) {
-            router.push("/completed_work?miniJson=" + JSON.stringify({ id: item.farmData.farmWorkRecordId }));
+            const { data } = await VE_API.z_farm_work_record.getDetail({ id: item.farmData.farmWorkRecordId });
+            if (data && data.length > 0) {
+                const imgLength = data[0].executeEvidence.length;
+                if (imgLength > 0) {
+                    router.push("/review_work?miniJson=" + JSON.stringify({ id: data[0].id }));
+                } else {
+                    router.push("/completed_work?miniJson=" + JSON.stringify({ id: item.farmData.farmWorkRecordId }));
+                }
+            }
         }
     });
 };
@@ -148,7 +158,7 @@ const formatDate = (dateStr) => {
             border-radius: 14px;
             padding: 16px;
             position: relative;
-            .badge{
+            .badge {
                 position: absolute;
                 top: 0;
                 right: 0;

+ 4 - 2
src/views/old_mini/mine/pages/serviceRecords.vue

@@ -77,13 +77,15 @@ const getPrescriptionText = (item) => {
 <style lang="scss" scoped>
 .service-records-page {
     width: 100%;
-    min-height: 100vh;
+    height: 100vh;
     background: #f5f5f5;
     .record-list {
-        padding: 10px 12px 20px;
+        padding: 10px 12px;
         display: flex;
         flex-direction: column;
         gap: 14px;
+        height: calc(100% - 60px);
+        overflow-y: auto;
         .empty-data {
             text-align: center;
             padding: 60px 0;

+ 1 - 1
src/views/old_mini/task_condition/components/remindCustomer.vue

@@ -7,7 +7,7 @@
                 <div class="card-body" @click="handleItemClick(item)">
                     <div class="card-body-left">
                         <div class="title van-multi-ellipsis--l2">{{ item.postInfo.title }}</div>
-                        <div class="date">{{ formatDate(item.postInfo.createTime) }}</div>
+                        <div class="date">{{item.interactionTime }}</div>
                     </div>
                     <div class="forward-btn" @click.stop="handleShare(item)">转发</div>
                 </div>

+ 2 - 7
src/views/old_mini/user/farmDetails.vue

@@ -91,7 +91,7 @@
                                 title-mode="default"
                                 :title-right-text="farmServiceActiveTab === 0 ? '生成成果报告' : ''"
                                 :title-right-type="farmServiceActiveTab === 1 ? 'dot' : null"
-                                :title-right-dot-text="farmServiceActiveTab === 1 ? '2区' : ''"
+                                :title-right-dot-text="farmServiceActiveTab === 1 ? '区' : ''"
                                 class="recipe-item"
                                 @titleRightClick="handleTitleRightClick"
                             />
@@ -176,7 +176,6 @@ const handleFarmServiceTabChange = (index) => {
         getDetailList();
     } else {
         getFutureFarmWorkWarning()
-        getFutureFarmWorkList();
     }
 };
 
@@ -185,6 +184,7 @@ const getFutureFarmWorkWarning = async () => {
     let totalCost = 0;
     if (data.length > 0) {
         totalCost = data.reduce((acc, item) => acc + item.estimatedCost, 0);
+        detailList.value = data.slice(0, 1);
     }
     serviceStatsData.value = [
         { value: totalCost || 0, unit: "元", desc: "预计成交额" },
@@ -313,11 +313,6 @@ const getDetailList = () => {
         }
     });
 };
-const getFutureFarmWorkList = () => {
-    VE_API.user.getFutureFarmWorkList(paramsPage.value).then(({ data }) => {
-        detailList.value = data || [];
-    });
-};
 
 const getFarmPastServiceCost = () => {
     VE_API.user.getFarmPastServiceCost({ farmId: farmIdVal.value }).then(({ data }) => {

+ 23 - 16
src/views/old_mini/user/subPages/serviceList.vue

@@ -19,9 +19,10 @@
                     title-mode="default"
                     :title-right-text="farmServiceActiveTab === 0 ? '生成成果报告' : ''"
                     :title-right-type="farmServiceActiveTab === 1 ? 'dot' : null"
-                    :title-right-dot-text="farmServiceActiveTab === 1 ? '2区' : ''"
+                    :title-right-dot-text="farmServiceActiveTab === 1 ? '区' : ''"
                     class="recipe-item"
                     @titleRightClick="handleTitleRightClick"
+                    @click="handleClick(section)"
                 />
                 <empty
                     v-show="detailList.length === 0"
@@ -48,8 +49,11 @@ const farmIdVal = ref(null);
 const router = useRouter();
 onMounted(() => {
     farmIdVal.value = route.query.farmId;
-    getDetailList();
-    getFarmPastServiceCost();
+    if(sessionStorage.getItem("activeSection")){
+        farmServiceActiveTab.value = Number(sessionStorage.getItem("activeSection"));
+        sessionStorage.removeItem("activeSection");
+    }
+    handleFarmServiceTabChange(farmServiceActiveTab.value);
 });
 
 const farmServiceTabs = ["过往服务", "未来服务"];
@@ -61,7 +65,6 @@ const handleFarmServiceTabChange = (index) => {
         getFarmPastServiceCost();
         getDetailList();
     } else {
-        getFutureFarmWorkList();
         getFutureFarmWorkWarning()
     }
 };
@@ -76,26 +79,15 @@ const getFutureFarmWorkWarning = async () => {
         { value: totalCost || 0, unit: "元", desc: "预计成交额" },
         { value: data.length || 0, unit: "次", desc: "预计服务次数" },
     ];
+    detailList.value = data || [];
 };
 
-const paramsPage = ref(1);
-const paramsLimit = ref(99);
 const detailList = ref([]);
 const getDetailList = () => {
     VE_API.user.farmServiceRecord({ farmId: farmIdVal.value }).then(({ data }) => {
         detailList.value = data || [];
     });
 };
-const getFutureFarmWorkList = () => {
-    const params = {
-        farmId: farmIdVal.value,
-        limit: paramsLimit.value,
-        page: paramsPage.value,
-    };
-    VE_API.user.getFutureFarmWorkList(params).then(({ data }) => {
-        detailList.value = data || [];
-    });
-};
 
 const getFarmPastServiceCost = () => {
     VE_API.user.getFarmPastServiceCost({ farmId: farmIdVal.value }).then(({ data }) => {
@@ -112,6 +104,21 @@ const handleTitleRightClick = (section) => {
         query: { miniJson: JSON.stringify({ id: section.id }) },
     });
 };
+
+const handleClick = (section) => {
+    sessionStorage.setItem("activeSection", farmServiceActiveTab.value);
+    if(farmServiceActiveTab.value === 0){
+        router.push({
+            path: "/review_work",
+            query: { miniJson: JSON.stringify({ id: section.id }) },
+        });
+    } else {
+        router.push({
+            path: "/detail_work",
+            query: { miniJson: JSON.stringify({ id: section.farmWorkId,arrangeId: section.arrangeId,farmId: farmIdVal.value }) },
+        });
+    }
+};
 </script>
 
 <style scoped lang="scss">