瀏覽代碼

feat:修改农事管理发起需求功能

wangsisi 2 周之前
父節點
當前提交
2c2168a64f

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

@@ -62,4 +62,9 @@ module.exports = {
         url: config.base_dev_url + "z_agricultural_store_farm/unfollow",
         type: "post",
     },
+    //修改农事记录公开状态
+    updatePublicStatus: {
+        url: url + "/updatePublicStatus",
+        type: "post",
+    },
 }

+ 9 - 2
src/components/detailDialog.vue

@@ -91,7 +91,7 @@
             <span>{{ curRole == 0 ? "好的,感谢您的配合" : "农事下发成功" }}</span>
             <div class="no-popup-title-sub" v-if="curRole == 0">请您耐心等待 农事确认</div>
         </div>
-        <div class="no-popup-btn" @click="noShow = false">{{ curRole == 0 ? "我知道了" : "转发给客户" }}</div>
+        <div class="no-popup-btn" @click="handleNoPopupBtn">{{ curRole == 0 ? "我知道了" : "转发给客户" }}</div>
     </Popup>
 </template>
 <script setup>
@@ -99,6 +99,7 @@ import { ref, computed } from "vue";
 import eventBus from "@/api/eventBus";
 import { Popup } from "vant";
 import { useRoute, useRouter } from "vue-router";
+import { ElMessage } from "element-plus";
 
 const props = defineProps({
     showSuccessOnly: {
@@ -124,7 +125,7 @@ const triggerClick = () => {
     emit("triggerFarmWork");
 };
 
-const emit = defineEmits(["triggerFarmWork"]);
+const emit = defineEmits(["triggerFarmWork", "noPopupBtn"]);
 
 const dialogData = ref({})
 const showBtn = ref(true);
@@ -181,7 +182,13 @@ function toPage() {
     if(btnText.value!='转发'){
         router.push("/expert_list");
     }
+    ElMessage.warning("该功能正在升级中,敬请期待");
 }
+
+const handleNoPopupBtn = () => {
+    noShow.value = false;
+    emit("noPopupBtn");
+};
 </script>
 
 <style lang="scss" scoped>

+ 28 - 8
src/views/old_mini/agri_services/components/farmDynamics.vue

@@ -26,13 +26,13 @@
                         <template #footer>
                             <div class="action-group">
                                 <div class="action-l">查看详情</div>
-                                <div class="action-r" v-if="section.farmWorkDetail?.flowStatus === 1">
+                                <div class="action-r" v-if="section.farmWorkDetail?.flowStatus === 0 && !section.isPublic">
                                     <div class="action-item warning-item" @click.stop="handleApply(section)">
                                         发起需求
                                     </div>
-                                    <div class="action-item primary-item">我已完成</div>
+                                    <div class="action-item primary-item" @click.stop="handleConfirmComplete(section)">确认并完成</div>
                                 </div>
-                                <div class="action-r" v-else-if="section.farmWorkDetail?.flowStatus === 2">
+                                <div class="action-r" v-else-if="section.farmWorkDetail?.flowStatus === 0 && section.isPublic">
                                     <div
                                         class="action-item second-item"
                                         @click.stop="handleOperation(section, 'cancel')"
@@ -99,11 +99,15 @@ import wx from "weixin-js-sdk";
 import uploadExecute from "@/views/old_mini/task_condition/components/uploadExecute.vue";
 import tipPopup from "@/components/popup/tipPopup.vue";
 import FnShareSheet from "@/components/pageComponents/FnShareSheet.vue";
-import { ElMessageBox } from "element-plus";
+import { ElMessageBox, ElMessage } from "element-plus";
 import { base_img_url2 } from "@/api/config";
 import reviewUploadPopup from "@/components/popup/reviewUploadPopup.vue";
 const router = useRouter();
 
+const handleConfirmComplete = (section) => {
+    ElMessage.warning("该功能正在升级中,敬请期待");
+};
+
 const showApplyPopup = ref(false);
 const uploadExecuteRef = ref(null);
 
@@ -138,10 +142,18 @@ const onSelect = async (option) => {
             url: `/pages/subPages/share_page/index?pageParams=${JSON.stringify(query)}&type=priceSheet`,
         });
     } else {
-        updateFlowStatus(2);
+        updatePublicStatus(1);
     }
 };
 
+const updatePublicStatus = (isPublic) => {
+    return VE_API.z_farm_work_record.updatePublicStatus({ recordId: currentSection.value.id, isPublic }).then((res) => {
+        if (res.code === 0) {
+            getContentData();
+        }
+    });
+};
+
 const updateFlowStatus = (targetFlowStatus) => {
     return VE_API.z_farm_work_record.updateFlowStatus({ id: currentSection.value.id, targetFlowStatus }).then((res) => {
         if (res.code === 0) {
@@ -162,7 +174,11 @@ const handleOperation = (section, type) => {
         type: "warning",
     })
         .then(() => {
-            updateFlowStatus(type === "cancel" ? 1 : 5);
+            if (type === "cancel") {
+                updatePublicStatus(0);
+            }else{
+                updateFlowStatus(5);
+            }
         })
         .catch(() => {});
 };
@@ -177,6 +193,10 @@ const handleUploadPhoto = ({ id }) => {
 
 const filterType = ref([
     {
+        title: "待确认",
+        value: '0',
+    },
+    {
         title: "待完成",
         value: 4,
     },
@@ -186,7 +206,7 @@ const filterType = ref([
     },
 ]);
 
-const activePlanIndex = ref(4);
+const activePlanIndex = ref('0');
 const handlePlanClick = (value) => {
     activePlanIndex.value = value;
     getContentData();
@@ -200,7 +220,7 @@ const contentData = ref([]);
 const getContentData = async () => {
     const res = await VE_API.z_farm_work_record.getSimpleList({
         role: localStorage.getItem("SET_USER_CUR_ROLE"),
-        flowStatus: activePlanIndex.value === 4 ? "1,2,3,4" : activePlanIndex.value,
+        flowStatus: activePlanIndex.value === 4 ? "3,4" : activePlanIndex.value,
     });
     contentData.value = res.data;
 

+ 1 - 2
src/views/old_mini/chat_frame/index.vue

@@ -1,6 +1,6 @@
 <template>
     <div class="dialogue">
-        <custom-header :name="nameVal" bgColor="#f2f3f5" isGoBack @goback="headerCallBack"></custom-header>
+        <custom-header :name="nameVal || '飞鸟种植助手'" bgColor="#f2f3f5" isGoBack @goback="headerCallBack"></custom-header>
         <chat-window :text="desc" :userId="userIdVal" :img="imgVal" @update:name="nameVal = $event"></chat-window>
     </div>
 </template>
@@ -10,7 +10,6 @@ import customHeader from "@/components/customHeader.vue";
 import { onActivated, ref } from "vue";
 import chatWindow from "@/components/chatWindow";
 import { useRoute, useRouter } from "vue-router";
-import eventBus from "@/api/eventBus";
 
 const route = useRoute();
 const router = useRouter();

+ 24 - 1
src/views/old_mini/home/components/problemReminder.vue

@@ -45,7 +45,7 @@
         <div class="no-popup-btn" @click="noShow = false">我知道了</div>
     </Popup>
     <!-- 农事信息弹窗 -->
-    <detail-dialog ref="detailDialogRef" showSuccessOnly @triggerFarmWork="triggerFarmWork"></detail-dialog>
+    <detail-dialog ref="detailDialogRef" showSuccessOnly @triggerFarmWork="triggerFarmWork" @noPopupBtn="noPopupBtn"></detail-dialog>
     <!-- 新增:激活上传弹窗 -->
     <active-upload-popup ref="activeUploadPopupRef" @handleUploadSuccess="handleUploadSuccess"></active-upload-popup>
 </template>
@@ -53,6 +53,7 @@
 import { Popup } from "vant";
 import { ref,onActivated } from "vue";
 import wx from "weixin-js-sdk";
+import { base_img_url2 } from "@/api/config";
 import activeUploadPopup from "@/components/popup/activeUploadPopup.vue";
 import detailDialog from "@/components/detailDialog.vue";
 import eventBus from "@/api/eventBus";
@@ -219,6 +220,28 @@ function triggerFarmWork() {
     activeUploadPopupRef.value.triggerFarmWork(currentParams.value);
     saveQuestPopup();
 }
+
+// 获取触发图片
+const triggerImg = ref([]);
+// const getTriggerImg = async () => {
+//     const { data } = await VE_API.z_farm_work_record.getTriggerImg({ farmWorkRecordId: currentSection.value.id });
+//     triggerImg.value = data || [];
+// }
+const noPopupBtn = async () => {
+    if(curRole == 2){
+        // await getTriggerImg();
+        // const query = {
+        //     askInfo: { title: "农事需求", content: "是否分享该农事需求给好友" },
+        //     shareText: `发起了 ${currentSection.value.farmWorkName} 的接单需求 请查看!`,
+        //     id: currentSection.value.id,
+        //     farmWorkOrderId: currentSection.value.orderId,
+        //     postImg: triggerImg.value.length ? base_img_url2 + triggerImg.value[triggerImg.value.length - 1].cloudFilename : ''
+        // };
+        // wx.miniProgram.navigateTo({
+        //     url: `/pages/subPages/share_page/index?pageParams=${JSON.stringify(query)}&type=priceSheet`,
+        // });
+    }
+};
 </script>
 <style lang="scss" scoped>
 .problem-reminder-popup {

+ 7 - 7
src/views/old_mini/modify_work/completedWork.vue

@@ -312,7 +312,7 @@
                 class="fixed-btn-wrap"
                 :class="{
                     center:
-                        currentStep == 0 ||
+                        (currentStep == 0 && detailData?.isPublic) ||
                         (detailData?.flowStatus == 3 && curRole == 0) ||
                         (detailData?.flowStatus == 4 && curRole == 2) ||
                         (detailData?.flowStatus == 2 && curRole == 0) ||
@@ -338,24 +338,24 @@
                 </div>
                 <div
                     class="fixed-btn orange"
-                    v-if="detailData?.flowStatus == 1 && curRole == 0 && !query?.isAssign"
+                    v-if="detailData?.flowStatus == 0 && curRole == 0 && !query?.isAssign && !detailData?.isPublic"
                     @click="handleDemand"
                 >
                     发起需求
                 </div>
                 <div
                     class="fixed-btn orange"
-                    v-if="detailData?.flowStatus == 2 && !query?.farmWorkOrderId && curRole == 0"
+                    v-if="detailData?.flowStatus == 0 && !query?.farmWorkOrderId && curRole == 0 && detailData?.isPublic"
                     @click="cancelDemand"
                 >
                     取消发起
                 </div>
                 <div
                     class="fixed-btn"
-                    v-if="detailData?.flowStatus == 1 && curRole == 0 && !query?.isAssign"
+                    v-if="detailData?.flowStatus == 0 && curRole == 0 && !query?.isAssign && !detailData?.isPublic"
                     @click="handleOk"
                 >
-                    我已完成
+                    确认并完成
                 </div>
             </div>
 
@@ -474,7 +474,7 @@ const onDemandSelect = (option) => {
             url: `/pages/subPages/share_page/index?pageParams=${JSON.stringify(query)}&type=priceSheet`,
         });
     }else{
-        VE_API.z_farm_work_record.updateFlowStatus({ id: query.value.id, targetFlowStatus: 2 }).then((res) => {
+        VE_API.z_farm_work_record.updatePublicStatus({ recordId: query.value.id, isPublic: 1 }).then((res) => {
             if (res.code === 0) {
                 taskPopupType.value = "success";
                 successText.value = "需求已发送成功";
@@ -495,7 +495,7 @@ const handlePopupBtn = () => {
     showTaskPopup.value = false;
     if (taskPopupType.value === "warning") {
         // 确认忽略
-        VE_API.z_farm_work_record.updateFlowStatus({ id: query.value.id, targetFlowStatus: 1 }).then((res) => {
+        VE_API.z_farm_work_record.updatePublicStatus({ recordId: query.value.id, isPublic: 0 }).then((res) => {
             if (res.code === 0) {
                 getDetail(query.value.id);
                 currentStep.value = 1;