Просмотр исходного кода

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

wangsisi 2 недель назад
Родитель
Сommit
276510463c

+ 8 - 8
src/components/popup/priceSheetPopup.vue

@@ -1,5 +1,5 @@
 <template>
-    <popup class="price-sheet-popup" v-model:show="showPopup">
+    <popup class="price-sheet-popup" :overlay-style="{'z-index': 9999}" v-model:show="showPopup" teleport="body">
         <div class="price-sheet-content">
             <div class="price-sheet-content-inner" ref="contentEl">
                 <!-- 顶部标题区域 -->
@@ -64,7 +64,7 @@
                                 :key="index"
                             >
                                 <div class="col-1">{{ item.typeName || '--' }}</div>
-                                <div class="col-2">{{ item.defaultName || '--' }}</div>
+                                <div class="col-2">{{ item.defaultName || item.pesticideFertilizerName || '--' }}</div>
                                 <div class="col-3">{{ item.brand || '--' }}</div>
                                 <div class="col-4">{{ item.price || '--' }}</div>
                                 <div class="col-5">{{ item.usageDisplay || '--' }}</div>
@@ -143,6 +143,7 @@ const quotationData = ref({});
 const priceData = ref({});
 
 onActivated(() => {
+    console.log('onActivated')
     fetchPriceData()
 })
 
@@ -170,11 +171,10 @@ const processedPrescriptionList = computed(() => {
                 const brand = mapped.brand || item.brand || '';
                 const total = mapped.totalPrice || item.total || '';
                 const muUsage = quotationData.value.usageMode === "叶面施" ? (item.muUsage2 || item.muUsage) : item.muUsage
-                console.log('muUsage', muUsage)
                 const unit = item.unit || '';
 
                 result.push({
-                    typeName: item.typeName || '--',
+                    typeName: item.typeName || item.pesticideFertilizerTypeName || '--',
                     defaultName: item.defaultName || item.pesticideFertilizerName || '--',
                     brand: brand,
                     price: price ? `${price}元` : '--',
@@ -240,7 +240,6 @@ const handleShare = () => {
 };
 
 const handleWechat = () => {
-    console.log("handleWechat", quotationData.value, priceData.value);
     if (!priceData.value?.id || !priceData.value?.itemsList || priceData.value?.itemsList?.length === 0) {
         ElMessage.warning('请补全报价数据')
         return;
@@ -338,7 +337,7 @@ const clearData = () => {
 // 监听弹窗关闭,清空数据
 watch(showPopup, (newVal) => {
     if (!newVal) {
-        clearData();
+        // clearData();
     }
 });
 
@@ -353,8 +352,9 @@ defineExpose({
 
 <style lang="scss" scoped>
 .price-sheet-popup {
+    z-index: 9999 !important;
     width: 90%;
-    max-height: 82vh;
+    max-height: 90vh;
     background: none;
     border-radius: 12px;
     overflow: hidden;
@@ -375,7 +375,7 @@ defineExpose({
 .price-sheet-content {
     display: flex;
     flex-direction: column;
-    max-height: 82vh;
+    max-height: 90vh;
     // height: 95vh;
     .price-sheet-content-inner {
         background: #fff;

+ 10 - 3
src/components/taskItem.vue

@@ -217,11 +217,17 @@ const getTriggerImg = async () => {
 
 // 更新触发图片(上传成功后调用)
 const updateTriggerImg = async () => {
-    if (props.status === 1 && props.itemData?.id) {
-        // 重新获取详情和图片
-        await getItemDetail(props.itemData.id);
+    console.log('updateTriggerImg', props.itemData.id)
+    if (!props.itemData?.id) return;
+    
+    // 重新获取详情
+    await getItemDetail(props.itemData.id);
+    
+    // 如果是已完成状态(status === 1),需要重新获取触发图片
+    if (props.status === 1) {
         await getTriggerImg();
     }
+    // 如果是待完成状态(status === 0),详情已经更新,itemData 会在 getSimpleList 后更新
 }
 
 const handleUploadSuccess = async () => { 
@@ -264,6 +270,7 @@ function buildPrescriptionText(list) {
 async function getItemDetail(id) {
     const { data } = await VE_API.z_farm_work_record.getDetail({ id });
     detailItem.value = data[0];
+    console.log('detailItem', detailItem.value)
 }
 
 // 保留方法名以兼容,但同步返回已生成的文案

+ 1 - 1
src/views/old_mini/agri_work/components/priceTable.vue

@@ -22,7 +22,7 @@
                     <div class="new-table">
                         <div class="line-l">
                             <div class="line-1 title-1">{{ subP.typeName }}</div>
-                            <div class="line-2">{{ subP.defaultName }}</div>
+                            <div class="line-2">{{ subP.defaultName || subP.pesticideFertilizerName }}</div>
                             <div class="title-3">{{ subP.brand }}</div>
                             <div class="title-4">{{ subP.price }}</div>
                             <div class="title-5">{{ subP.dosage }}</div>

+ 8 - 3
src/views/old_mini/dev_login.vue

@@ -22,7 +22,9 @@ onMounted(async () => {
         const { data } = await VE_API.system.devLogin({ userId: userId });
         store.dispatch(`app/${SET_TOKEN}`, data.token);
         store.dispatch(`app/${SET_USER_ROLES}`, data.roles);
-        store.dispatch(`app/${SET_USER_CUR_ROLE}`, data.roles[0] || 0);
+        // 如果 roles 中包含 2,赋值 2,否则赋值 0
+        const curRole = Array.isArray(data.roles) && data.roles.includes(2) ? 2 : 0;
+        store.dispatch(`app/${SET_USER_CUR_ROLE}`, curRole);
         localStorage.setItem("localUserInfo", JSON.stringify(data));
     }
     // 存userId
@@ -31,8 +33,11 @@ onMounted(async () => {
     localStorage.setItem("MINI_USER_ID", userId)
     route.query?.userInfo && localStorage.setItem("localUserInfo", route.query.userInfo);
     if(route.query.roles){
-        store.dispatch(`app/${SET_USER_ROLES}`,JSON.parse(route.query.roles));
-        store.dispatch(`app/${SET_USER_CUR_ROLE}`, JSON.parse(route.query.roles)[0] || 0);
+        const roles = JSON.parse(route.query.roles);
+        store.dispatch(`app/${SET_USER_ROLES}`, roles);
+        // 如果 roles 中包含 2,赋值 2,否则赋值 0
+        const curRole = Array.isArray(roles) && roles.includes(2) ? 2 : 0;
+        store.dispatch(`app/${SET_USER_CUR_ROLE}`, curRole);
     }
     localStorage.setItem("MINI_USER_LOCATION", route.query.point)
     localStorage.setItem("MINI_USER_LOCATION_POINT", `POINT(${pointXy[0]} ${pointXy[1]})`)

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

@@ -368,8 +368,8 @@
                 <div class="fixed-btn" @click="showPriceSheetPopup">生成报价单</div>
             </div>
             <!-- 农资,步骤:农资已执行,请求确认 -->
-            <div class="fixed-btn-wrap" v-if="curRole == 2 && currentStep == 2">
-                <div class="fixed-btn second" @click="handleShare">转发给客户</div>
+            <div class="fixed-btn-wrap center" v-if="curRole == 2 && currentStep == 2">
+                <!-- <div class="fixed-btn second" @click="handleShare">转发给客户</div> -->
                 <div class="fixed-btn" @click="showUploadExecutePopup">请求确认</div>
             </div>
         </div>

+ 12 - 3
src/views/old_mini/modify_work/reviewWork.vue

@@ -1,7 +1,7 @@
 <template>
     <div class="work-wrap">
         <custom-header name="农事成效"></custom-header>
-        <div class="work-content recheck-title" v-loading="loading">
+        <div class="work-content recheck-title" :class="{ 'no-bottom': curRole == '0' && (!workItem.reviewImage ||!workItem.reviewImage.length) }" v-loading="loading">
             <div class="tabs-content-item">
                 <div class="common-card-title">
                     <img class="icon" src="@/assets/img/home/label-icon.png" alt="" />
@@ -33,7 +33,7 @@
                                             v-for="(pest, pestI) in fertilizer.pesticideFertilizerList"
                                             :key="'sub' + pestI"
                                         >
-                                            {{ pest.defaultName }}
+                                            {{ pest.defaultName || pest.pesticideFertilizerName }}
                                             <span
                                                 v-if="
                                                     pestI !== fertilizer.pesticideFertilizerList.length - 1 ||
@@ -255,9 +255,15 @@
                 class="fixed-btn-wrap center"
                  v-if="curRole == '2'"
             >
-            <div class="fixed-btn excute" @click="handleShare" v-if="workItem.reviewImage && workItem.reviewImage.length">分享成果</div>
+                <div class="fixed-btn excute" @click="handleShare" v-if="workItem.reviewImage && workItem.reviewImage.length">分享成果</div>
                 <div class="fixed-btn second" @click="handleRemindUser" v-else>提醒农户拍照</div>
             </div>
+            <div
+                class="fixed-btn-wrap center"
+                 v-if="curRole == '0' && workItem.reviewImage && workItem.reviewImage.length"
+            >
+                <div class="fixed-btn excute" @click="handleShare">转发</div>
+            </div>
         </div>
         <!-- 上传图片弹窗 -->
         <upload-popup :executionData="workItem"></upload-popup>
@@ -418,6 +424,9 @@ const handleUpload = ({ imgArr }) => {
                     padding-right: 6px;
                 }
             }
+            &.no-bottom {
+                padding-bottom: 26px;
+            }
         }
         .up-btn-group {
             position: fixed;

+ 5 - 4
src/views/old_mini/offer_price/component/editPrice.vue

@@ -15,12 +15,12 @@
 
                 <el-form-item label="药肥类型" required prop="typeId">
                     <div class="row-3-selects">
-                        <el-cascader
+                        <cascader
                             v-model="form.typeId"
                             style="width: 100%"
+                             title="请选择药肥类型"
                             :options="typeOptions"
-                            :props="cascaderProps"
-                            :show-all-levels="false"
+                            :field-names="cascaderProps"
                             />
                     </div>
                 </el-form-item>
@@ -95,6 +95,7 @@ import customHeader from "@/components/customHeader.vue";
 import { ElMessage, ElMessageBox } from 'element-plus'
 import { useRouter, useRoute } from "vue-router";
 import { ref, reactive, onMounted, onActivated } from 'vue'
+import { Cascader } from 'vant';
 
 const router = useRouter();
 const route = useRoute();
@@ -175,7 +176,7 @@ const cascaderProps = {
   checkStrictly: true,
   emitPath: false,
   value: 'id',
-  label: 'name',
+  text: 'name',
   children: 'children'
 };
 

+ 3 - 0
src/views/old_mini/price_detail/index.vue

@@ -166,6 +166,9 @@ onActivated(() => {
     // 从 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 => {
             if (prescription.pesticideFertilizerList) {
                 prescription.pesticideFertilizerList.forEach(pesticide => {

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

@@ -309,6 +309,7 @@ const selectedDate = ref(null);
         cursor: pointer;
         position: relative;
         &.today {
+            min-height: 70px;
             .day-box {
                 color: #2199f8;
             }

+ 4 - 3
src/views/old_mini/task_condition/components/reviewPopup.vue

@@ -1,5 +1,5 @@
 <template>
-    <popup class="price-sheet-popup" v-model:show="showPopup">
+    <popup class="price-sheet-popup" :overlay-style="{'z-index': 9999}" teleport="body" v-model:show="showPopup">
         <div class="price-sheet-content">
             <div class="price-sheet-content-inner">
                 <div class="sheet-content">
@@ -225,8 +225,9 @@ defineExpose({
 
 <style lang="scss" scoped>
 .price-sheet-popup {
+    z-index: 9999 !important;
     width: 90%;
-    max-height: 84vh;
+    max-height: 90vh;
     background: none;
     border-radius: 12px;
     overflow: hidden;
@@ -247,7 +248,7 @@ defineExpose({
 .price-sheet-content {
     display: flex;
     flex-direction: column;
-    max-height: 84vh;
+    max-height: 90vh;
     // height: 95vh;
     .price-sheet-content-inner {
         background: #fff;

+ 19 - 4
src/views/old_mini/task_condition/components/task.vue

@@ -36,7 +36,7 @@
             </div> -->
             <div class="task-content" v-loading="loading">
                 <div class="task-item" v-for="(item, index) in taskList" :key="item.id || item.workRecordId">
-                    <task-item :key="activeIndex + '-' + index" :status="activeIndex === 3 ? 1 : 0" :item-data="item" @handleUploadSuccess="handleUploadSuccess" ref="taskItemRef">
+                    <task-item :key="activeIndex + '-' + index" :status="activeIndex === 3 ? 1 : 0" :item-data="item" @handleUploadSuccess="handleUploadSuccess" :ref="el => setTaskItemRef(el, index)">
                         <template #footer>
                             <div class="item-footer" v-if="activeIndex === 0 || activeIndex === 2">
                                 <div class="footer-l" @click="toDetail(item)">
@@ -71,7 +71,7 @@
             </div>
         </div>
     </div>
-    <upload-execute ref="uploadExecuteRef" :onlyShare="onlyShare" />
+    <upload-execute ref="uploadExecuteRef" :onlyShare="onlyShare" @uploadSuccess="handleUploadSuccess" />
 
     <popup v-model:show="showTaskPopup" round class="task-tips-popup">
         <template v-if="taskPopupType === 'warning'">
@@ -175,10 +175,23 @@ function getTaskCount(flowStatus, index) {
     });
 }
 
-const taskItemRef = ref(null);
+const taskItemRefs = ref([]);
+const setTaskItemRef = (el, index) => {
+    if (el) {
+        taskItemRefs.value[index] = el;
+    }
+};
+
 const handleUploadSuccess = () =>{
+    console.log('handleUploadSuccess', taskItemRefs.value)
     getSimpleList();
-    taskItemRef.value.updateTriggerImg();
+    // 更新所有task-item的triggerImg
+    taskItemRefs.value.forEach(ref => {
+        if (ref && ref.updateTriggerImg) {
+            ref.updateTriggerImg();
+            console.log('updateTriggerImg', ref)
+        }
+    });
 }
 
 // 初始化时获取所有状态的任务数量
@@ -212,6 +225,8 @@ watch(activeIndex, () => {
 function getSimpleList() {
     loading.value = true;
     noData.value = false;
+    // 清空refs数组,避免索引错乱
+    taskItemRefs.value = [];
     const location = store.state.home.miniUserLocationPoint;
     const startFlowStatus = getStartFlowStatus(activeIndex.value);
     VE_API.z_farm_work_record.getSimpleList({ role: 2, location, flowStatus: startFlowStatus }).then(({data}) => {

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

@@ -38,6 +38,8 @@ const props = defineProps({
     },
 });
 
+const emit = defineEmits(['uploadSuccess']);
+
 const show = ref(false);
 const className = ref(null);
 const farmWorkRecordId = ref(null);
@@ -78,6 +80,8 @@ function handleConfirm() {
                     id: dataItem.id,
                 }
                 farmData.value.type = 'confirmExecute'
+                // 通知父组件上传成功,需要刷新数据
+                emit('uploadSuccess', farmData.value.id);
                 showShare.value = true;
             });
         }