Explorar o código

Merge branch 'master' of http://www.sysuimars.cn:3000/feiniao/feiniao-farm-h5

wangsisi hai 1 semana
pai
achega
282f77425b

+ 11 - 11
src/views/old_mini/offer_price/component/editPrice.vue

@@ -646,6 +646,16 @@ const handleSave = async () => {
             .el-radio {
                 margin-right: 16px;
             }
+            .has-border,
+            .el-cascader {
+                .el-input__wrapper {
+                    box-shadow: 0 0 0 1px rgba(33, 153, 248, 0.3) inset;
+                }
+            }
+            .el-tag.el-tag--info {
+                --el-tag-text-color: #2199f8;
+                --el-tag-bg-color: rgba(33, 153, 248, 0.1);
+            }
             .el-input__wrapper {
                 box-shadow: none;
             }
@@ -653,24 +663,14 @@ const handleSave = async () => {
                 color: #2199f8;
                 --el-input-placeholder-color: rgba(33, 153, 248, 0.43);
             }
-            .has-border,
-            .el-cascader {
-                .el-input__wrapper {
-                    box-shadow: 0 0 0 1px rgba(33, 153, 248, 0.3) inset;
-                }
-            }
             .el-input-group__append {
-                padding: 0 10px;
+                padding: 0 6px;
                 background: none;
                 box-shadow: none;
             }
             .el-input-group__append {
                 color: rgba(33, 153, 248, 0.5);
             }
-            .el-tag.el-tag--info {
-                --el-tag-text-color: #2199f8;
-                --el-tag-bg-color: rgba(33, 153, 248, 0.1);
-            }
             .input-unit {
                 .el-input {
                     border: 1px solid rgba(33, 153, 248, 0.3);

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

@@ -50,13 +50,23 @@
                         <div class="medicine-item mt-8">
                             <div class="item-name">亩单价</div>
                             <div class="item-val">
-                                 <el-input-number 
+                                <!-- <el-input-number 
                                      style="width: 132px"
                                      placeholder="服务单价"
                                      v-model="servicePricePerMu" 
                                      :min="0.0001"
-                                 />
-                                 <!-- <span class="price-unit">元/亩</span> -->
+                                 /> -->
+                                <!-- <span class="price-unit">元/亩</span> -->
+
+                                <el-input
+                                    style="width: 132px"
+                                    v-model="servicePricePerMu"
+                                    type="number"
+                                    step="0.01"
+                                    placeholder="服务单价"
+                                >
+                                    <template #append>元/亩</template>
+                                </el-input>
                             </div>
                         </div>
                         <div class="medicine-item">
@@ -72,7 +82,11 @@
             </div>
             <div class="medicine-wrap">
                 <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="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">
@@ -101,13 +115,23 @@
                             <div class="medicine-item mt-8">
                                 <div class="item-name">肥药单价</div>
                                 <div class="item-val">
-                                    <el-input-number 
+                                    <!-- <el-input-number
                                         style="width: 132px"
                                         placeholder="单价"
-                                        v-model="pesticide.price" 
+                                        v-model="pesticide.price"
                                         :min="0.0000000001"
-                                    />
+                                    /> -->
                                     <!-- <span class="price-unit">元/{{ pesticide.unit }}</span> -->
+
+                                    <el-input
+                                        style="width: 132px"
+                                        v-model="pesticide.price"
+                                        type="number"
+                                        step="0.01"
+                                        placeholder="单价"
+                                    >
+                                        <template #append>元/{{ pesticide.unit }}</template>
+                                    </el-input>
                                 </div>
                             </div>
                             <div class="medicine-item">
@@ -120,7 +144,9 @@
                             </div>
                             <div class="medicine-item">
                                 <div class="item-total">总计:</div>
-                                <div class="item-price">{{ getPesticideTotal(pesticide) }}<span class="item-unit">元</span></div>
+                                <div class="item-price">
+                                    {{ getPesticideTotal(pesticide) }}<span class="item-unit">元</span>
+                                </div>
                             </div>
                         </div>
                     </div>
@@ -129,7 +155,8 @@
         </div>
         <div class="bottom-btn">
             <div class="bottom-l">
-                合计:<span class="main-val">{{ getTotalCost() }}</span>元
+                合计:<span class="main-val">{{ getTotalCost() }}</span
+                >元
             </div>
             <div class="bottom-r" @click="confirmPrice">确认报价</div>
         </div>
@@ -152,44 +179,44 @@ const priceData = ref({});
 const servicePricePerMu = ref(null);
 const executionMethod = ref(null);
 const modeList = ref([
-    {name: "无人机", value: 1},
-    {name: "人工", value: 2},
-])
+    { name: "无人机", value: 1 },
+    { name: "人工", value: 2 },
+]);
 
 // 初始化数据
 onActivated(() => {
     query = useRoute().query;
     detailData.value = JSON.parse(query.data);
-    executeDate.value = detailData.value.executeDate;
     if (detailData.value.usageMode === "根部施") {
         executionMethod.value = 2;
     }
-    priceData.value = JSON.parse(query?.priceData || '{}');
-    
+    priceData.value = JSON.parse(query?.priceData || "{}");
+    executeDate.value = priceData.value.executeDate;
+
     // 从 priceData 中匹配价格和品牌到对应的药肥
     if (priceData.value?.itemsList && detailData.value?.prescriptionList) {
         executionMethod.value = priceData.value.executionMethod;
         if (detailData.value.usageMode === "根部施") {
             executionMethod.value = 2;
         }
-        detailData.value.prescriptionList.forEach(prescription => {
+        detailData.value.prescriptionList.forEach((prescription) => {
             if (prescription.pesticideFertilizerList) {
-                prescription.pesticideFertilizerList.forEach(pesticide => {
+                prescription.pesticideFertilizerList.forEach((pesticide) => {
                     const priceItem = priceData.value.itemsList.find(
-                        item => item.pesticideFertilizerId === pesticide.pesticideFertilizerId
+                        (item) => item.pesticideFertilizerId === pesticide.pesticideFertilizerId
                     );
                     if (priceItem) {
                         pesticide.price = Number(priceItem.price) || null;
-                        pesticide.brand = priceItem.brand || '';
+                        pesticide.brand = priceItem.brand || "";
                     } else {
                         pesticide.price = null;
-                        pesticide.brand = '';
+                        pesticide.brand = "";
                     }
                 });
             }
         });
     }
-    
+
     // 初始化服务费用
     if (priceData.value?.farmWorkServiceCost && detailData.value?.area) {
         servicePricePerMu.value = priceData.value.farmWorkServiceCost || null;
@@ -218,7 +245,11 @@ onDeactivated(() => {
 const getMuUsage = (pesticide) => {
     if (!pesticide) return 0;
     // 如果是叶面施且有执行方式选择,根据执行方式判断
-    if (detailData.value?.usageMode === '叶面施' && executionMethod.value !== null && executionMethod.value !== undefined) {
+    if (
+        detailData.value?.usageMode === "叶面施" &&
+        executionMethod.value !== null &&
+        executionMethod.value !== undefined
+    ) {
         // 1 = 无人机,使用 muUsage2
         if (executionMethod.value == 1) {
             return pesticide.muUsage2 || pesticide.muUsage || 0;
@@ -230,30 +261,30 @@ const getMuUsage = (pesticide) => {
     }
     // 默认使用 muUsage(非叶面施的情况)
     return pesticide.muUsage || 0;
-}
+};
 
 // 计算单个药肥的总计:单价 * 单亩用量 * 亩数
 const getPesticideTotal = (pesticide) => {
     const muUsage = getMuUsage(pesticide);
-    if (!pesticide.price || !muUsage || !detailData.value.area) return '0.00';
+    if (!pesticide.price || !muUsage || !detailData.value.area) return "0.00";
     const total = (pesticide.price * muUsage * detailData.value.area).toFixed(2);
     return total;
-}
+};
 
 // 计算服务费用总计:亩单价 * 亩数
 const getServiceTotal = () => {
-    if (!servicePricePerMu.value || !detailData.value.area) return '0.00';
+    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 => {
+        detailData.value.prescriptionList.forEach((prescription) => {
             if (prescription.pesticideFertilizerList) {
-                prescription.pesticideFertilizerList.forEach(pesticide => {
+                prescription.pesticideFertilizerList.forEach((pesticide) => {
                     const muUsage = getMuUsage(pesticide);
                     if (pesticide.price && muUsage && detailData.value.area) {
                         pesticideTotal += pesticide.price * muUsage * detailData.value.area;
@@ -262,37 +293,36 @@ const getTotalCost = () => {
             }
         });
     }
-    
-    const serviceTotal = servicePricePerMu.value && detailData.value.area 
-        ? servicePricePerMu.value * detailData.value.area 
-        : 0;
-    
+
+    const serviceTotal =
+        servicePricePerMu.value && detailData.value.area ? servicePricePerMu.value * detailData.value.area : 0;
+
     return (pesticideTotal + serviceTotal).toFixed(2);
-}
+};
 
 const confirmPrice = () => {
     if (!executionMethod.value) {
         ElMessage.error("请选择执行方式");
         return;
     }
-    
+
     // 检查服务费用是否有价格
     if (!servicePricePerMu.value || servicePricePerMu.value <= 0) {
         ElMessage.error("请填写服务费用");
         return;
     }
-    
+
     // 检查是否所有药肥都有价格和品牌
     if (detailData.value?.prescriptionList) {
         const emptyItems = [];
-        detailData.value.prescriptionList.forEach(prescription => {
-            (prescription.pesticideFertilizerList || []).forEach(pesticide => {
-                const pesticideName = pesticide.pesticideFertilizerName || '药肥';
+        detailData.value.prescriptionList.forEach((prescription) => {
+            (prescription.pesticideFertilizerList || []).forEach((pesticide) => {
+                const pesticideName = pesticide.pesticideFertilizerName || "药肥";
                 const hasPrice = pesticide.price && pesticide.price > 0;
-                const hasBrand = pesticide.brand && pesticide.brand.trim() !== '';
-                
+                const hasBrand = pesticide.brand && pesticide.brand.trim() !== "";
+
                 if (!hasPrice || !hasBrand) {
-                    let errorMsg = '';
+                    let errorMsg = "";
                     if (!hasPrice && !hasBrand) {
                         errorMsg = `${pesticideName}的品牌和单价`;
                     } else if (!hasPrice) {
@@ -304,24 +334,24 @@ const confirmPrice = () => {
                 }
             });
         });
-        
+
         if (emptyItems.length > 0) {
             ElMessage.error(`请填写${emptyItems[0]}`);
             return;
         }
     }
-    
+
     const pesticideFertilizerQuoteList = [];
     if (detailData.value?.prescriptionList) {
-        detailData.value.prescriptionList.forEach(prescription => {
-            (prescription.pesticideFertilizerList || []).forEach(pesticide => {
+        detailData.value.prescriptionList.forEach((prescription) => {
+            (prescription.pesticideFertilizerList || []).forEach((pesticide) => {
                 pesticideFertilizerQuoteList.push({
                     pesticideFertilizerId: pesticide.pesticideFertilizerId,
                     price: Number(pesticide.price || 0),
-                    brand: pesticide.brand || ''
+                    brand: pesticide.brand || "",
                 });
-            })
-        })
+            });
+        });
     }
     const payload = {
         farmWorkRecordId: detailData.value?.id,
@@ -340,16 +370,16 @@ const confirmPrice = () => {
         } else {
             ElMessage.error(msg);
         }
-    })
-}
+    });
+};
 
 const handleExecutionMethodChange = (val) => {
     if (val == 1) {
-        servicePricePerMu.value = priceData.value.uavServicePrice
+        servicePricePerMu.value = priceData.value.uavServicePrice;
     } else {
-        servicePricePerMu.value = priceData.value.manualServicePrice
+        servicePricePerMu.value = priceData.value.manualServicePrice;
     }
-}
+};
 </script>
 
 <style lang="scss" scoped>
@@ -365,7 +395,8 @@ const handleExecutionMethodChange = (val) => {
         height: calc(100% - 40px - 74px);
         overflow: auto;
         ::v-deep {
-            .el-input__wrapper, .el-select__wrapper {
+            .el-input__wrapper,
+            .el-select__wrapper {
                 box-shadow: 0 0 0 1px rgba(33, 153, 248, 0.3) inset;
             }
             .el-input__inner {
@@ -388,7 +419,8 @@ const handleExecutionMethodChange = (val) => {
             .el-input {
                 --el-input-placeholder-color: rgba(33, 153, 248, 0.6);
             }
-            .el-input-number__decrease, .el-input-number__increase {
+            .el-input-number__decrease,
+            .el-input-number__increase {
                 display: none;
             }
             .el-input-number .el-input__wrapper {
@@ -447,13 +479,46 @@ const handleExecutionMethodChange = (val) => {
                     color: rgba(0, 0, 0, 0.4);
                     white-space: nowrap;
                 }
+                ::v-deep {
+                    .el-input__wrapper {
+                        box-shadow: none;
+                    }
+                    .el-input-group__append {
+                        padding: 0 10px;
+                        background: none;
+                        box-shadow: none;
+                    }
+                    .el-input-group__append {
+                        color: rgba(33, 153, 248, 0.5);
+                    }
+                    .el-input {
+                        border: 1px solid rgba(33, 153, 248, 0.3);
+                        border-radius: 5px;
+                        height: 30px;
+                        box-sizing: border-box;
+                    }
+                    .el-input__wrapper {
+                        padding: 0 2px 0 10px;
+                        height: 28px;
+                        line-height: 28px;
+                        min-height: 28px;
+                    }
+                    .el-input__inner {
+                        --el-input-inner-height: 28px;
+                        height: 28px;
+                        line-height: 28px;
+                        min-height: 28px;
+                        color: #2199f8;
+                        --el-input-placeholder-color: rgba(33, 153, 248, 0.43);
+                    }
+                }
             }
             .item-total {
                 font-size: 16px;
                 color: #000;
             }
             .item-price {
-                color: #2199F8;
+                color: #2199f8;
                 font-size: 20px;
                 font-weight: bold;
                 .item-unit {
@@ -485,14 +550,14 @@ const handleExecutionMethodChange = (val) => {
             color: #000000;
             font-size: 16px;
             .main-val {
-                color: #2199F8;
+                color: #2199f8;
                 font-size: 24px;
                 font-weight: bold;
                 padding-right: 4px;
             }
         }
         .bottom-r {
-            background: linear-gradient(136deg, #9FD5FF, #2199F8);
+            background: linear-gradient(136deg, #9fd5ff, #2199f8);
             padding: 8px 32px;
             border-radius: 20px;
             color: #fff;