Explorar el Código

fix: 对接报价

lxf hace 21 horas
padre
commit
6df83a5332

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

@@ -10,4 +10,16 @@ module.exports = {
         url: url + "/detail-list",
         type: "get",
     },
+    acceptFarmWorkRecord: {
+        url: url + "/acceptFarmWorkRecord",
+        type: "post",
+    },
+    issueFarmWorkRecord: {
+        url: url + "/issueFarmWorkRecord",
+        type: "post",
+    },
+    updateFlowStatus: {
+        url: url + "/updateFlowStatus",
+        type: "post",
+    },
 }

+ 16 - 11
src/components/popup/priceSheetPopup.vue

@@ -70,15 +70,15 @@
                     <div class="service-cost-section">
                         <div class="section-header">
                             <div class="section-title">服务费用</div>
-                            <div class="section-total">{{ quotationData?.farmWorkServiceCost || '1582' }}<span class="unit-text">元</span></div>
+                            <div class="section-total">{{ priceData?.farmWorkServiceCost || '--' }}<span class="unit-text">元</span></div>
                         </div>
                         <div class="service-details">
                             <div class="detail-item">
-                                <div class="detail-value">{{ quotationData?.executionMethod || '--' }}</div>
+                                <div class="detail-value">{{ priceData?.executionMethodName || '--' }}</div>
                                 <div class="detail-label">执行方式</div>
                             </div>
                             <div class="detail-item">
-                                <div class="detail-value">{{ quotationData?.muPrice || '--元/亩' }}</div>
+                                <div class="detail-value">{{ (priceData?.farmWorkServiceCost + '元/亩') || '--元/亩' }}</div>
                                 <div class="detail-label">亩单价</div>
                             </div>
                             <div class="detail-item">
@@ -124,7 +124,8 @@
 <script setup>
 import { Popup } from "vant";
 import { ref, computed } from "vue";
-
+import { useRouter } from "vue-router";
+const router = useRouter();
 const showPopup = ref(false);
 
 // 报价数据
@@ -141,17 +142,18 @@ const processedPrescriptionList = computed(() => {
     const priceMap = new Map();
     if (priceData.value?.itemsList && Array.isArray(priceData.value.itemsList)) {
         priceData.value.itemsList.forEach(item => {
-            priceMap.set(String(item.pesticideFertilizerId), item.price);
+            priceMap.set(String(item.pesticideFertilizerId), { price: item.price, brand: item.brand });
         });
     }
-
     // 展平 prescriptionList 中的所有 pesticideFertilizerList
     const result = [];
     quotationData.value.prescriptionList.forEach(prescription => {
         if (prescription.pesticideFertilizerList && Array.isArray(prescription.pesticideFertilizerList)) {
             prescription.pesticideFertilizerList.forEach(item => {
                 const pesticideFertilizerId = String(item.pesticideFertilizerId || '');
-                const price = priceMap.get(pesticideFertilizerId) || 0;
+                const mapped = priceMap.get(pesticideFertilizerId) || {};
+                const price = mapped.price || 0;
+                const brand = mapped.brand || item.brand || '';
                 const muUsage = item.muUsage || 0;
                 const unit = item.unit || '';
                 
@@ -161,7 +163,7 @@ const processedPrescriptionList = computed(() => {
                 result.push({
                     typeName: item.typeName || '--',
                     defaultName: item.defaultName || item.pesticideFertilizerName || '--',
-                    brand: item.brand || '--',
+                    brand: brand,
                     price: price,
                     unit: unit,
                     muUsage: muUsage,
@@ -180,7 +182,6 @@ const processedPrescriptionList = computed(() => {
 
 const handleShowPopup = (data) => {
     if (data) {
-        console.log("dhandleShowPopuphandleShowPopuphandleShowPopupata", data);
         quotationData.value = data;
         fetchPriceData();
     }
@@ -195,14 +196,18 @@ function fetchPriceData() {
         if (data && data.length > 0) {
             priceData.value = data[0];
         }
-    }).catch((error) => {
-        console.error('获取价格数据失败:', error);
+    }).catch(() => {
+        // 获取价格数据失败
     });
 }
 
 const handleEdit = () => {
     // 编辑报价逻辑
     // 可以触发编辑事件或打开编辑页面
+    router.push({
+        path: "/price_detail",
+        query: { data: JSON.stringify(quotationData.value), priceData: JSON.stringify(priceData.value) },
+    });
 };
 
 const handleCancel = () => {

+ 113 - 8
src/views/old_mini/modify_work/completedWork.vue

@@ -1,7 +1,7 @@
 <template>
     <div class="completed-work">
         <custom-header name="农事详情"></custom-header>
-        <div class="work-content" :class="{ hasBottom: curRole == 0 }">
+        <div class="work-content">
             <div class="step-wrap" v-show="query.status !== 'warning'">
                 <farm-steps :currentStep="currentStep" />
             </div>
@@ -233,14 +233,16 @@
             </div>
             <div
                 class="fixed-btn-wrap"
-                :class="{ center: currentStep == 0 || (currentStep == 1 && curRole == 1) || (currentStep == 2 && curRole == 2)}"
+                :class="{ center: currentStep == 0 || (detailData?.flowStatus == 3 && curRole == 0) || (detailData?.flowStatus == 4 && curRole == 2) || (detailData?.flowStatus == 2 && curRole == 0)}"
                 v-if="query.status !== 'warning'"
             >
                 <div class="fixed-btn expert" v-if="currentStep == 0">提醒农事确认</div>
-                <div class="fixed-btn expert" v-if="currentStep == 1 && curRole == 1">确认对方完成</div>
+                <div class="fixed-btn expert excute" v-if="detailData?.flowStatus == 3 && curRole == 0">确认对方执行</div>
+                <div class="fixed-btn expert" v-if="detailData?.flowStatus == 5 && curRole == 0">确认对方完成</div>
                 <div class="fixed-btn expert" v-if="currentStep == 2 && curRole == 2">请求确认</div>
-                <div class="fixed-btn orange" v-if="currentStep == 1 && curRole == 0" @click="handleDemand">发起需求</div>
-                <div class="fixed-btn" v-if="currentStep == 1 && curRole == 0" @click="handleOk">我已完成</div>
+                <div class="fixed-btn orange" v-if="detailData?.flowStatus == 1 && curRole == 0" @click="handleDemand">发起需求</div>
+                <div class="fixed-btn orange" v-if="detailData?.flowStatus == 2 && curRole == 0" @click="cancelDemand">取消发起</div>
+                <div class="fixed-btn" v-if="detailData?.flowStatus == 1 && curRole == 0" @click="handleOk">我已完成</div>
             </div>
 
             <!-- 农资,步骤:农事已确认 -->
@@ -257,6 +259,20 @@
     <offer-popup :showPopup="showPopup" :executionData="executionData"></offer-popup>
     <!-- 服务报价单 -->
     <price-sheet-popup ref="priceSheetPopupRef"></price-sheet-popup>
+    <!-- 需求发送成功 -->
+    <popup v-model:show="showTaskPopup" round class="task-tips-popup">
+        <template v-if="taskPopupType === 'warning'">
+            <img  class="create-farm-icon" src="@/assets/img/home/create-farm-icon.png" alt="" />
+            <div class="create-farm-text">
+                <div>您确认取消已发起的农事需求吗</div>
+            </div>
+        </template>
+        <template v-else>
+            <img class="farm-check-icon" src="@/assets/img/home/right.png" alt="">
+            <div class="create-farm-text success-text">需求已发送成功</div>
+        </template>
+        <div class="create-farm-btn" @click="handlePopupBtn">{{ taskPopupType === 'warning' ? '确认' : '我知道了' }}</div>
+    </popup>
 </template>
 
 <script setup>
@@ -264,6 +280,7 @@ import customHeader from "@/components/customHeader.vue";
 import { onMounted, ref } from "vue";
 // import NewFarmMap from "./newFarmMap";
 import { useStore } from "vuex";
+import { Popup } from "vant";
 import offerPopup from "@/components/popup/offerPopup.vue";
 import { useRouter, useRoute } from "vue-router";
 import farmSteps from "@/components/farmSteps.vue";
@@ -275,8 +292,9 @@ const store = useStore();
 const query = useRoute().query;
 // 角色
 // const curRole = store.state.app.curRole
-const currentStep = ref(1);
-const curRole = 2;
+const currentStep = ref(0);
+const curRole = ref(localStorage.getItem("SET_USER_CUR_ROLE"));
+// const curRole = 2;
 
 // 农资待生成报价单--currentStep:1;curRole:2
 // 农资已执行,有执行照片,请求确认--currentStep:2;curRole:2
@@ -296,9 +314,38 @@ const handleOk = () => {
 };
 
 const handleDemand = () => {
-    router.push("/share_page");
+    // router.push("/share_page");
+    VE_API.z_farm_work_record.updateFlowStatus({ id: query.id, targetFlowStatus: 2 }).then((res) => {
+        if (res.code === 0) {
+            taskPopupType.value = 'success';
+            showTaskPopup.value = true;
+        }
+    })
 };
 
+const showTaskPopup = ref(false);
+const taskPopupType = ref('');
+const handlePopupBtn = () => {
+    showTaskPopup.value = false;
+    if (taskPopupType.value === 'warning') {
+        // 确认忽略
+        VE_API.z_farm_work_record.updateFlowStatus({ id: query.id, targetFlowStatus: 1 }).then((res) => {
+            if (res.code === 0) {
+                getDetail(query.id);
+                currentStep.value = 1
+            }
+        })
+    } else {
+        getDetail(query.id);
+        currentStep.value = 2
+    }
+}
+
+const cancelDemand = () => {
+    taskPopupType.value = 'warning';
+    showTaskPopup.value = true;
+}
+
 const priceSheetPopupRef = ref(null);
 const showPriceSheetPopup = () => {
     priceSheetPopupRef.value.handleShowPopup(detailData.value);
@@ -328,9 +375,20 @@ const getDetail = (id) => {
     VE_API.z_farm_work_record.getDetail({ id }).then(({ data }) => {
         const res = data[0];
         detailData.value = res;
+        currentStep.value = getCurrentStep(detailData.value.flowStatus);
     });
 };
 
+function getCurrentStep(flowStatus) {
+    if (flowStatus === 1 || flowStatus === 2 || flowStatus === 3) {
+        return 1;
+    } else if (flowStatus === 4) {
+        return 2;
+    } else {
+        return 0;
+    }
+}
+
 // 农场分区列表
 const areaList = ref([]);
 const regionId = ref(null);
@@ -514,6 +572,9 @@ const changeRegion = (e) => {
                     border: 1px solid #ff953d;
                     background: #fff;
                 }
+                &.excute {
+                    background: linear-gradient(180deg, #FFD887, #ED9E1E);
+                }
                 &.second {
                     background: #FFFFFF;
                     border: 1px solid rgba(153, 153, 153, 0.5);
@@ -921,4 +982,48 @@ const changeRegion = (e) => {
         }
     }
 }
+
+
+.task-tips-popup {
+    width: 75%;
+    padding: 28px 28px 20px;
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    justify-content: center;
+    .create-farm-icon{
+        width: 40px;
+        height: 40px;
+        margin-bottom: 12px;
+    }
+    .farm-check-icon{
+        width: 68px;
+        height: 68px;
+        margin-bottom: 12px;
+    }
+    .create-farm-text{
+        font-size: 20px;
+        font-weight: 500;
+        line-height: 40px;
+        margin-bottom: 32px;
+        text-align: center;
+        &.success-text{
+            font-size: 23px;
+            font-weight: 400;
+        }
+    }
+    .main-text {
+        color: #2199F8;
+    }
+    .create-farm-btn{
+        width: 100%;
+        box-sizing: border-box;
+        padding: 8px;
+        border-radius: 25px;
+        font-size: 16px;
+        background: #2199F8;
+        color: #fff;
+        text-align: center;
+    }
+}
 </style>

+ 28 - 33
src/views/old_mini/modify_work/index.vue

@@ -207,7 +207,7 @@
                                             <div class="form-title">人工方式</div>
                                             <div class="box-item sub-item">
                                                 <div class="form-l has-sub">
-                                                    <div class="main-name">肥药配比</div>
+                                                    <div class="main-name">亩兑水量</div>
                                                     <div class="sub-name">(药剂:兑水量)</div>
                                                 </div>
                                                 <div class="form-r input-box text-center">
@@ -252,7 +252,7 @@
                                                 <div class="form-title">无人机</div>
                                                 <div class="box-item sub-item">
                                                     <div class="form-l has-sub">
-                                                        <div class="main-name">肥药配比</div>
+                                                        <div class="main-name">亩兑水量</div>
                                                         <div class="sub-name">(药剂:兑水量)</div>
                                                     </div>
                                                     <div class="form-r input-box text-center">
@@ -739,9 +739,6 @@ const submitForm = (formEl) => {
     formEl.validate((valid) => {
         if (valid) {
 
-            taskPopupType.value = 'success';
-            showTaskPopup.value = true;
-
             // router.push({
             //     path: "/completed_work",
             //     query: {
@@ -749,7 +746,7 @@ const submitForm = (formEl) => {
             //         status: 1,
             //     },
             // });
-            // submit();
+            submit();
         } else {
             console.log("error submit!");
         }
@@ -757,10 +754,10 @@ const submitForm = (formEl) => {
 };
 
 const submit = () => {
-    let executeBlueZones = null
-    if (!(curRole==1 && isAdd.value)) {
-        executeBlueZones = newFarmMap.getSelectedBlueRegion();
-    }
+    // let executeBlueZones = null
+    // if (!(curRole==1 && isAdd.value)) {
+    //     executeBlueZones = newFarmMap.getSelectedBlueRegion();
+    // }
     // if (!executeBlueZones || !executeBlueZones.length) {
     //     ElMessage({
     //         message: "请选择执行区域",
@@ -769,7 +766,6 @@ const submit = () => {
     //     return false
     // }
 
-    console.log("dynamicValidateForm.prescriptionList", dynamicValidateForm.prescriptionList);
     // 检查药物所有项是否都包含特定的字段
     // const hasRequiredFields = dynamicValidateForm.prescriptionList.every(item => {
     //     return item.pesticideFertilizerList.every(domain  => {
@@ -793,29 +789,28 @@ const submit = () => {
 
     // const flattenedDomains = flattenDomains(dynamicValidateForm.prescription)
     const data = {
+        id: route.query.id,
         ...dynamicValidateForm,
-        // prescription: flattenedDomains,
-        farmWorkType: farmWorkTypeVal.value,
-        farmId: gardenId.value,
-        regionId: regionId.value,
-        executeBlueZones,
-        // weatherWarningMsg: warningMsg.value,
-        // allUsageMode: allUsageMode.value,
     };
-    console.log("ddddaaaaa", data);
-    // 新增农事
-    VE_API.farm.saveFarmWork(data).then(({ code }) => {
-        if (code === 0) {
-            ElMessage({
-                message: "保存成功",
-                type: "success",
-            });
-            setTimeout(() => {
-                // router.go(-1);
-                router.replace("/expert_album?reload=true");
-            }, 500);
+    VE_API.z_farm_work_record.issueFarmWorkRecord(data).then((res) => {
+        if (res.code === 0) {
+            taskPopupType.value = 'success';
+            showTaskPopup.value = true;
         }
-    });
+    })
+    // 新增农事
+    // VE_API.farm.saveFarmWork(data).then(({ code }) => {
+    //     if (code === 0) {
+    //         ElMessage({
+    //             message: "保存成功",
+    //             type: "success",
+    //         });
+    //         setTimeout(() => {
+    //             // router.go(-1);
+    //             router.replace("/expert_album?reload=true");
+    //         }, 500);
+    //     }
+    // });
     // const data = {
     //     orderId: props.prescriptioData.orderId,
     //     orderStatus: 1,
@@ -1423,8 +1418,8 @@ const handleExpertDiagnosis = () => {
         margin-bottom: 32px;
         text-align: center;
         &.success-text{
-            font-size: 23px;
-            font-weight: 400;
+            font-size: 24px;
+            font-weight: 500;
         }
     }
     .main-text {

+ 24 - 0
src/views/old_mini/monitor/subPages/plan.vue

@@ -46,6 +46,7 @@
                                         :key="fw.id ?? aIdx"
                                         class="arrange-box"
                                         :class="getArrangeStatusClass(fw)"
+                                        @click="handleRowClick(fw)"
                                     >
                                         <span class="arrange-text">{{ fw.farmWorkName }}</span>
                                         <div
@@ -190,6 +191,29 @@ const addNewTask = () => {
     });
 };
 
+
+const handleRowClick = (item) => {
+    console.log("item", item);
+    // 0:默认,1-4:正常,5:完成,6:预警
+    if (item.flowStatus === 5) {
+        router.push({
+            path: "/review_work",
+            query: {
+                id: item.farmWorkRecordId,
+            },
+        });
+    } else if (item.type !== "term" && item.flowStatus === "default") {
+        detailDialogRef.value.showDialog();
+    } else if (item.flowStatus === 6 || item.flowStatus < 5 && item.flowStatus > 0) {
+        router.push({
+            path: "/completed_work",
+            query: {
+                id: item.farmWorkRecordId,
+            },
+        });
+    }
+};
+
 const manageTask = () => {
     router.push({
         path: "/agri_services_manage",

+ 191 - 60
src/views/old_mini/price_detail/index.vue

@@ -19,55 +19,64 @@
                 </div>
                 <div class="price-info">
                     <div class="info-title">施肥方式</div>
-                    <div class="info-val">叶面肥</div>
+                    <div class="info-val">{{ detailData?.usageMode }}</div>
                 </div>
             </div>
             <div class="medicine-wrap">
-                <div class="medicine-box" v-for="(item) in 2" :key="item">
-                    <div class="item-title">肥药{{ item }}</div>
-                    <div class="box-wrap">
-                        <div class="medicine-item">
-                            <div class="item-name">肥药名称</div>
-                            <div class="item-val">乙烯利</div>
-                        </div>
-                        <div class="medicine-item">
-                            <div class="item-name">肥药品牌</div>
-                            <div class="item-val">
-                                <el-select
-                                    class="select-item"
-                                    v-model="brandVal"
-                                    placeholder="肥药品牌"
-                                    style="width: 132px"
-                                >
-                                    <el-option
-                                        v-for="(item, index) in brandList"
-                                        :key="index"
-                                        :label="item.name"
-                                        :value="item.value"
+                <template v-for="(prescription, pIndex) in detailData?.prescriptionList" :key="pIndex">
+                    <div class="medicine-box" v-for="(pesticide, mIndex) in prescription.pesticideFertilizerList" :key="mIndex">
+                        <div class="item-title">肥药{{ mIndex + 1 }}</div>
+                        <div class="box-wrap">
+                            <div class="medicine-item">
+                                <div class="item-name">肥药名称</div>
+                                <div class="item-val">{{ pesticide.pesticideFertilizerName }}</div>
+                            </div>
+                            <div class="medicine-item">
+                                <div class="item-name">肥药品牌</div>
+                                <div class="item-val">
+                                    <el-input v-model="pesticide.brand" placeholder="肥药品牌" style="width: 132px" />
+                                    <!-- <el-select
+                                        class="select-item"
+                                        v-model="pesticide.brand"
+                                        placeholder="肥药品牌"
+                                        style="width: 132px"
+                                    >
+                                        <el-option
+                                            v-for="(brand, bIndex) in brandList"
+                                            :key="bIndex"
+                                            :label="brand.name"
+                                            :value="brand.value"
+                                        />
+                                    </el-select> -->
+                                </div>
+                            </div>
+                            <div class="medicine-item mt-8">
+                                <div class="item-name">肥药单价</div>
+                                <div class="item-val">
+                                    <el-input-number 
+                                        style="width: 132px" 
+                                        v-model="pesticide.price" 
+                                        :min="0"
+                                        :precision="2"
                                     />
-                                </el-select>
+                                    <!-- <span class="price-unit">元/{{ pesticide.unit }}</span> -->
+                                </div>
                             </div>
-                        </div>
-                        <div class="medicine-item mt-8">
-                            <div class="item-name">肥药单价</div>
-                            <div class="item-val">
-                                 <el-input-number style="width: 132px" v-model="priceVal" :min="1" />
+                            <div class="medicine-item">
+                                <div class="item-name">单亩用量</div>
+                                <div class="item-val">{{ pesticide.muUsage }}{{ pesticide.unit }}</div>
+                            </div>
+                            <div class="medicine-item">
+                                <div class="item-name">亩数</div>
+                                <div class="item-val">{{ detailData?.area }}亩</div>
+                            </div>
+                            <div class="medicine-item">
+                                <div class="item-total">总计:</div>
+                                <div class="item-price">{{ getPesticideTotal(pesticide) }}<span class="item-unit">元</span></div>
                             </div>
-                        </div>
-                        <div class="medicine-item">
-                            <div class="item-name">单亩用量</div>
-                            <div class="item-val">500斤</div>
-                        </div>
-                        <div class="medicine-item">
-                            <div class="item-name">亩数</div>
-                            <div class="item-val">50亩</div>
-                        </div>
-                        <div class="medicine-item">
-                            <div class="item-total">总计:</div>
-                            <div class="item-price">1582<span class="item-unit">元</span></div>
                         </div>
                     </div>
-                </div>
+                </template>
             </div>
             <div class="service-wrap">
                 <div class="medicine-box">
@@ -94,16 +103,22 @@
                         <div class="medicine-item mt-8">
                             <div class="item-name">亩单价</div>
                             <div class="item-val">
-                                 <el-input-number style="width: 132px" v-model="priceVal" :min="1" />
+                                 <el-input-number 
+                                     style="width: 132px" 
+                                     v-model="servicePricePerMu" 
+                                     :min="0"
+                                     :precision="2"
+                                 />
+                                 <!-- <span class="price-unit">元/亩</span> -->
                             </div>
                         </div>
                         <div class="medicine-item">
                             <div class="item-name">亩数</div>
-                            <div class="item-val">50亩</div>
+                            <div class="item-val">{{ detailData?.area }}亩</div>
                         </div>
                         <div class="medicine-item">
                             <div class="item-total">总计:</div>
-                            <div class="item-price">1582<span class="item-unit">元</span></div>
+                            <div class="item-price">{{ getServiceTotal() }}<span class="item-unit">元</span></div>
                         </div>
                     </div>
                 </div>
@@ -111,31 +126,133 @@
         </div>
         <div class="bottom-btn">
             <div class="bottom-l">
-                合计:<span class="main-val">1258</span>元
+                合计:<span class="main-val">{{ getTotalCost() }}</span>元
             </div>
-            <div class="bottom-r">确认报价</div>
+            <div class="bottom-r" @click="confirmPrice">确认报价</div>
         </div>
     </div>
 </template>
 
 <script setup>
 import customHeader from "@/components/customHeader.vue";
-import { ref } from "vue";
-const executeDate = ref(null);
+import { ElMessage } from "element-plus";
+import { ref, onMounted } from "vue";
+import { useRoute, useRouter } from "vue-router";
 
-const brandVal = ref(null)
-const brandList = ref([
-    {name: "国光", value: "国光"},
-    {name: "国光1", value: "国光1"},
-    {name: "国光2", value: "国光2"},
-])
+const router = useRouter();
+const executeDate = ref(null);
+const query = useRoute().query;
+const detailData = ref(JSON.parse(query.data));
+const priceData = ref({});
 
-const priceVal = ref(null)
-const modeVal = ref(null)
+const servicePricePerMu = ref(0);
+const modeVal = ref(null);
 const modeList = ref([
-    {name: "无人机", value: "无人机"},
-    {name: "人工", value: "人工"},
+    {name: "无人机", value: 1},
+    {name: "人工", value: 2},
 ])
+
+// 初始化数据
+onMounted(() => {
+    console.log("query", query);
+    executeDate.value = detailData.value.executeDate;
+    priceData.value = JSON.parse(query?.priceData || '{}');
+    
+    // 从 priceData 中匹配价格和品牌到对应的药肥
+    if (priceData.value.itemsList && detailData.value.prescriptionList) {
+        detailData.value.prescriptionList.forEach(prescription => {
+            if (prescription.pesticideFertilizerList) {
+                prescription.pesticideFertilizerList.forEach(pesticide => {
+                    const priceItem = priceData.value.itemsList.find(
+                        item => item.pesticideFertilizerId === pesticide.pesticideFertilizerId
+                    );
+                    if (priceItem) {
+                        pesticide.price = priceItem.price || 0;
+                        pesticide.brand = priceItem.brand || '';
+                    } else {
+                        pesticide.price = 0;
+                        pesticide.brand = '';
+                    }
+                });
+            }
+        });
+    }
+    
+    // 初始化服务费用
+    if (priceData.value.farmWorkServiceCost && detailData.value.area) {
+        servicePricePerMu.value = Number((priceData.value.farmWorkServiceCost / detailData.value.area).toFixed(2));
+    }
+});
+
+// 计算单个药肥的总计:单价 * 单亩用量 * 亩数
+const getPesticideTotal = (pesticide) => {
+    if (!pesticide.price || !pesticide.muUsage || !detailData.value.area) return '0.00';
+    const total = (pesticide.price * pesticide.muUsage * detailData.value.area).toFixed(2);
+    return total;
+}
+
+// 计算服务费用总计:亩单价 * 亩数
+const getServiceTotal = () => {
+    if (!servicePricePerMu.value || !detailData.value.area) return '0.00';
+    const total = (servicePricePerMu.value * detailData.value.area).toFixed(2);
+    return total;
+}
+
+// 计算总合计:所有药肥总计 + 服务费用总计
+const getTotalCost = () => {
+    let pesticideTotal = 0;
+    if (detailData.value.prescriptionList) {
+        detailData.value.prescriptionList.forEach(prescription => {
+            if (prescription.pesticideFertilizerList) {
+                prescription.pesticideFertilizerList.forEach(pesticide => {
+                    if (pesticide.price && pesticide.muUsage && detailData.value.area) {
+                        pesticideTotal += pesticide.price * pesticide.muUsage * detailData.value.area;
+                    }
+                });
+            }
+        });
+    }
+    
+    const serviceTotal = servicePricePerMu.value && detailData.value.area 
+        ? servicePricePerMu.value * detailData.value.area 
+        : 0;
+    
+    return (pesticideTotal + serviceTotal).toFixed(2);
+}
+
+const confirmPrice = () => {
+    if (!modeVal.value) {
+        ElMessage.error("请选择执行方式");
+        return;
+    }
+    const pesticideFertilizerQuoteList = [];
+    if (detailData.value?.prescriptionList) {
+        detailData.value.prescriptionList.forEach(prescription => {
+            (prescription.pesticideFertilizerList || []).forEach(pesticide => {
+                pesticideFertilizerQuoteList.push({
+                    pesticideFertilizerId: pesticide.pesticideFertilizerId,
+                    price: Number(pesticide.price || 0),
+                    brand: pesticide.brand || ''
+                });
+            })
+        })
+    }
+    const payload = {
+        farmWorkRecordId: detailData.value?.id,
+        pesticideFertilizerQuoteList,
+        servicePrice: servicePricePerMu.value,
+        executionMethod: modeVal.value,
+    };
+    console.log('confirmPrice payload =>', payload);
+    VE_API.z_farm_work_record.acceptFarmWorkRecord(payload).then(({ data }) => {
+        if (data) {
+            ElMessage.success("确认报价成功");
+            router.push({
+                path: "/home",
+            });
+        }
+    })
+}
 </script>
 
 <style lang="scss" scoped>
@@ -154,8 +271,13 @@ const modeList = ref([
             .el-input__wrapper, .el-select__wrapper {
                 box-shadow: 0 0 0 1px rgba(33, 153, 248, 0.3) inset;
             }
-            .el-input__inner, .el-select__placeholder {
+            .el-input__inner {
                 color: #2199f8;
+                text-align: center;
+            }
+            .el-select__placeholder {
+                color: rgba(33, 153, 248, 0.6);
+                text-align: center;
             }
             .el-input__prefix {
                 color: #2199f8;
@@ -164,7 +286,7 @@ const modeList = ref([
                 color: #2199f8;
             }
             .el-input {
-                --el-input-placeholder-color: #2199f8;
+                --el-input-placeholder-color: rgba(33, 153, 248, 0.6);
             }
             .el-input-number__decrease, .el-input-number__increase {
                 display: none;
@@ -216,6 +338,15 @@ const modeList = ref([
                 min-width: 142px;
                 text-align: center;
                 color: #474747;
+                display: flex;
+                align-items: center;
+                justify-content: center;
+                gap: 4px;
+                .price-unit {
+                    font-size: 12px;
+                    color: rgba(0, 0, 0, 0.4);
+                    white-space: nowrap;
+                }
             }
             .item-total {
                 font-size: 16px;

+ 4 - 0
src/views/old_mini/task_condition/components/calendar.vue

@@ -231,6 +231,10 @@ const selectedDate = ref(null);
             align-items: center;
             justify-content: space-between;
             width: 100%;
+            .top-c {
+                flex: 1;
+                text-align: center;
+            }
             .header-text {
                 color: #000;
                 font-size: 16px;