Selaa lähdekoodia

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

wangsisi 2 päivää sitten
vanhempi
commit
27cd5da076

+ 4 - 3
src/components/detailDialog.vue

@@ -68,7 +68,7 @@
                 </div>
             </div>
 
-            <div class="bottom-btn">
+            <div class="bottom-btn" v-if="showBtn">
                 <div class="btn-item secondary-btn" @click="toPage">{{ btnText }}</div>
                 <div class="btn-item primary-btn" @click="triggerClick">触发农事</div>
             </div>
@@ -97,7 +97,6 @@
 <script setup>
 import { ref, computed } from "vue";
 import eventBus from "@/api/eventBus";
-import wx from "weixin-js-sdk";
 import { Popup } from "vant";
 import { useRoute, useRouter } from "vue-router";
 
@@ -130,8 +129,10 @@ const triggerClick = () => {
 const emit = defineEmits(["triggerFarmWork"]);
 
 const dialogData = ref({})
-const showDialog = (id,btnTextVal = '转发') => {
+const showBtn = ref(true);
+const showDialog = (id,btnTextVal = '转发', showBtnVal = true) => {
     btnText.value = btnTextVal;
+    showBtn.value = showBtnVal;
     if (id) {
         VE_API.farm
             .getFarmWorkLib({ id })

+ 23 - 17
src/components/popup/priceSheetPopup.vue

@@ -15,7 +15,6 @@
                     </div>
                 </div>
                 <div class="sheet-content">
-                    
                     <!-- 报价详情区域 -->
                     <div class="quotation-info">
                         <div class="info-item">
@@ -32,6 +31,10 @@
                         </div>
                         <div class="info-item catalog-label">
                             <span class="info-label">报价目录</span>
+
+                            <div class="edit-btn-box">
+                                <div class="edit-btn" @click="handleEdit">编辑报价</div>
+                            </div>
                         </div>
                         <div class="total-bar">
                             <span class="total-label">报价合计:</span>
@@ -90,9 +93,6 @@
                                 <div class="detail-label">亩数</div>
                             </div>
                         </div>
-                        <div class="edit-btn-box">
-                            <div class="edit-btn" @click="handleEdit">编辑报价</div>
-                        </div>
                     </div>
                 </div>
             </div>
@@ -417,6 +417,7 @@ defineExpose({
     flex: 1;
     overflow-y: auto;
     overflow-x: hidden;
+    position: relative;
 }
 
 // 报价详情区域
@@ -441,6 +442,7 @@ defineExpose({
             font-weight: bold;
             margin-top: 10px;
             margin-bottom: 10px;
+            position: relative;
 
             .info-label {
                 color: #000;
@@ -662,19 +664,23 @@ defineExpose({
             }
         }
     }
-    .edit-btn-box {
-        display: flex;
-        justify-content: end;
-    }
-    .edit-btn {
-        background: rgba(33, 153, 248, 0.1);
-        color: #2199F8;
-        padding: 6px 16px;
-        border-radius: 20px;
-        font-size: 14px;
-        width: fit-content;
-        cursor: pointer;
-    }
+}
+.edit-btn-box {
+    display: flex;
+    justify-content: end;
+    position: absolute;
+    right: 0;
+    top: -8px;
+    z-index: 10;
+}
+.edit-btn {
+    background: rgba(33, 153, 248, 0.1);
+    color: #2199F8;
+    padding: 6px 16px;
+    border-radius: 20px;
+    font-size: 14px;
+    width: fit-content;
+    cursor: pointer;
 }
 
 // 底部操作按钮

+ 9 - 2
src/components/taskItem.vue

@@ -5,7 +5,7 @@
                 <div class="item-name">{{ itemData?.farmWorkName }}</div>
                 <div class="item-time">{{ itemData?.executeDate }}</div>
             </div>
-            <div class="top-r" @click="toDetail(status, itemData.id)">{{ status === 0 ? "查看处方" : "查看详情" }}</div>
+            <div class="top-r" @click="toDetail(status, itemData.id, itemData.farmWorkId)">{{ status === 0 ? "查看处方" : "查看详情" }}</div>
         </div>
         <div class="item-box" v-if="status === 0">
             <!-- <div class="title-wrap">
@@ -132,6 +132,9 @@
             </div>
         </div>
     </div>
+    
+    <!-- 处方卡片 -->
+    <detail-dialog ref="detailDialogRef" />
 </template>
 
 <script setup>
@@ -139,6 +142,7 @@ import { onMounted, ref } from 'vue';
 import { useRouter } from "vue-router";
 import { base_img_url2 } from "@/api/config";
 import wx from 'weixin-js-sdk';
+import detailDialog from "@/components/detailDialog.vue";
 
 const props = defineProps({
     status: {
@@ -158,6 +162,7 @@ const props = defineProps({
 const expiredDay = ref(0) // 过期天数
 
 const router = useRouter();
+const detailDialogRef = ref(null);
 const toPage = () => {
     router.push("/report_detail")
 }
@@ -213,13 +218,15 @@ function formatArea(val) {
     return Number.isInteger(num) ? num : num.toFixed(2);
 }
 
-const toDetail = (status, id) => {
+const toDetail = (status, id, farmWorkId) => {
     if (status === 1) {
         // 复核成效
         router.push({
             path: "/review_work",
             query: { json: JSON.stringify({ id }) }
         });
+    } else {
+        detailDialogRef.value.showDialog(farmWorkId, '', false);
     }
 }
 </script>

+ 27 - 6
src/views/old_mini/price_detail/index.vue

@@ -136,12 +136,12 @@
 <script setup>
 import customHeader from "@/components/customHeader.vue";
 import { ElMessage } from "element-plus";
-import { ref, onMounted } from "vue";
+import { ref, onMounted, onActivated, onBeforeUnmount, onDeactivated } from "vue";
 import { useRoute, useRouter } from "vue-router";
 
 const router = useRouter();
 const executeDate = ref(null);
-const query = useRoute().query;
+let query = useRoute().query;
 const detailData = ref(JSON.parse(query.data));
 const priceData = ref({});
 
@@ -153,7 +153,9 @@ const modeList = ref([
 ])
 
 // 初始化数据
-onMounted(() => {
+onActivated(() => {
+    query = useRoute().query;
+    detailData.value = JSON.parse(query.data);
     executeDate.value = detailData.value.executeDate;
     priceData.value = JSON.parse(query?.priceData || '{}');
     
@@ -184,6 +186,24 @@ onMounted(() => {
     }
 });
 
+// 清空数据
+const clearData = () => {
+    executeDate.value = null;
+    detailData.value = {};
+    priceData.value = {};
+    servicePricePerMu.value = 0;
+    executionMethod.value = null;
+};
+
+// 离开页面时清空数据
+onBeforeUnmount(() => {
+    clearData();
+});
+
+onDeactivated(() => {
+    clearData();
+});
+
 // 计算单个药肥的总计:单价 * 单亩用量 * 亩数
 const getPesticideTotal = (pesticide) => {
     if (!pesticide.price || !pesticide.muUsage || !detailData.value.area) return '0.00';
@@ -246,9 +266,10 @@ const confirmPrice = () => {
     VE_API.z_farm_work_record.acceptFarmWorkRecord(payload).then(({ data, code, msg }) => {
         if (code === 0) {
             ElMessage.success("确认报价成功");
-            router.push({
-                path: "/task_condition",
-            });
+            // router.push({
+            //     path: "/task_condition",
+            // });
+            router.back();
         } else {
             ElMessage.error(msg);
         }

+ 1 - 0
src/views/old_mini/task_condition/components/task.vue

@@ -88,6 +88,7 @@
     </popup>
     <!-- 服务报价单 -->
     <price-sheet-popup ref="priceSheetPopupRef"></price-sheet-popup>
+
 </template>
 
 <script setup>