|
|
@@ -15,39 +15,63 @@
|
|
|
<record-item
|
|
|
:record-item-data="section"
|
|
|
title-mode="default"
|
|
|
- title-right-type="dot"
|
|
|
- title-right-dot-text="2区"
|
|
|
+ onlyRecipeName
|
|
|
+ titleRightDotText="全区"
|
|
|
+ titleRightType="dot"
|
|
|
class="recipe-item"
|
|
|
- :showFarmImage="activePlanIndex == 5?true:false"
|
|
|
- :content-mode="activePlanIndex == 5?'serviceDetail':''"
|
|
|
+ :showFarmImage="activePlanIndex == 5 ? true : false"
|
|
|
+ :content-mode="activePlanIndex == 5 ? 'serviceDetail' : ''"
|
|
|
@click="handleClick(section)"
|
|
|
>
|
|
|
<template #footer>
|
|
|
- <div class="action-group" v-if="activePlanIndex === 4">
|
|
|
+ <div class="action-group">
|
|
|
<div class="action-l">查看详情</div>
|
|
|
- <!-- <div class="action-r" v-if="section.orderStatus === 0">
|
|
|
- <div class="action-item second-item">拍照识别</div>
|
|
|
- <div class="action-item primary-item">去确认</div>
|
|
|
- </div> -->
|
|
|
- <!-- <div class="action-r" v-if="activePlanIndex === 4">
|
|
|
+ <div class="action-r" v-if="section.farmWorkDetail?.flowStatus === 1">
|
|
|
+ <div class="action-item warning-item" @click.stop="handleApply(section)">
|
|
|
+ 发起需求
|
|
|
+ </div>
|
|
|
+ <div class="action-item primary-item">我已完成</div>
|
|
|
+ </div>
|
|
|
+ <div class="action-r" v-else-if="section.farmWorkDetail?.flowStatus === 2">
|
|
|
<div
|
|
|
- class="action-item warning-item"
|
|
|
- :class="{ 'has-applied': section.hasApplied }"
|
|
|
- @click="handleApply(section, index)"
|
|
|
+ class="action-item second-item"
|
|
|
+ @click.stop="handleOperation(section, 'cancel')"
|
|
|
>
|
|
|
- {{ section.hasApplied ? "已发起需求" : "发起需求" }}
|
|
|
+ 取消发起
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="action-r" v-else-if="section.farmWorkDetail?.flowStatus === 4">
|
|
|
+ <div class="action-item warning-item has-applied">已锁单</div>
|
|
|
+ <div
|
|
|
+ v-if="section.executeEvidence?.length"
|
|
|
+ class="action-item primary-item"
|
|
|
+ @click.stop="handleOperation(section, 'confirmComplete')"
|
|
|
+ >
|
|
|
+ 确认执行完成
|
|
|
</div>
|
|
|
- <div class="action-item primary-item">确认完成</div>
|
|
|
- </div> -->
|
|
|
- <div class="action-r" v-if="activePlanIndex === 1">
|
|
|
<div
|
|
|
+ v-else
|
|
|
+ class="action-item primary-item"
|
|
|
+ @click.stop="handleApply(section, 'remindExecute')"
|
|
|
+ >
|
|
|
+ 提醒对方执行
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="action-r" v-else-if="activePlanIndex == 5">
|
|
|
+ <!-- <div
|
|
|
class="action-item warning-item"
|
|
|
:class="{ 'has-applied': section.hasApplied }"
|
|
|
@click="handleApply(section, index)"
|
|
|
>
|
|
|
{{ section.hasApplied ? "已发起需求" : "发起需求" }}
|
|
|
+ </div> -->
|
|
|
+ <div
|
|
|
+ class="action-item primary-item"
|
|
|
+ v-if="!section.farmWorkDetail?.reviewImage?.length"
|
|
|
+ @click.stop="handleUploadPhoto(section)"
|
|
|
+ >
|
|
|
+ 上传照片
|
|
|
</div>
|
|
|
- <div class="action-item primary-item">上传照片</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -57,20 +81,99 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 需求发送成功弹窗 -->
|
|
|
- <popup v-model:show="showApplyPopup" round class="apply-popup">
|
|
|
- <img class="check-icon" src="@/assets/img/home/right.png" alt="" />
|
|
|
- <div class="apply-text">需求发送成功</div>
|
|
|
- <div class="apply-btn" @click="showApplyPopup = false">我知道了</div>
|
|
|
- </popup>
|
|
|
+ <tip-popup v-model:show="showApplyPopup" type="success" text="需求发送成功" />
|
|
|
+ <!-- 发起需求成功弹窗 -->
|
|
|
+ <fn-share-sheet class="share-sheet" v-model:show="showShare" @select="onSelect" :options="options" />
|
|
|
+ <!-- 提醒对方执行弹窗 -->
|
|
|
+ <upload-execute ref="uploadExecuteRef" onlyShare />
|
|
|
+ <!-- 上传照片弹窗 -->
|
|
|
+ <review-upload-popup v-model="showUpload" :record-id="sectionId" @success="getContentData" />
|
|
|
</template>
|
|
|
<script setup>
|
|
|
import { ref, onMounted } from "vue";
|
|
|
import recordItem from "@/components/recordItem.vue";
|
|
|
import tabList from "@/components/pageComponents/TabList.vue";
|
|
|
-import { Popup ,Empty} from "vant";
|
|
|
+import { Popup, Empty } from "vant";
|
|
|
import { useRouter } from "vue-router";
|
|
|
+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 { base_img_url2 } from "@/api/config";
|
|
|
+import reviewUploadPopup from "@/components/popup/reviewUploadPopup.vue";
|
|
|
const router = useRouter();
|
|
|
+
|
|
|
const showApplyPopup = ref(false);
|
|
|
+const uploadExecuteRef = ref(null);
|
|
|
+
|
|
|
+const showShare = ref(false);
|
|
|
+const options = ref([
|
|
|
+ {
|
|
|
+ name: "需求大厅",
|
|
|
+ icon: "https://birdseye-img.sysuimars.com/birdseye-look-mini/xuqiu-icon.png",
|
|
|
+ type: "demandHall",
|
|
|
+ },
|
|
|
+ { name: "微信", icon: "wechat", type: "wechat" },
|
|
|
+]);
|
|
|
+
|
|
|
+// 获取触发图片
|
|
|
+const triggerImg = ref([]);
|
|
|
+const getTriggerImg = async () => {
|
|
|
+ const { data } = await VE_API.z_farm_work_record.getTriggerImg({ farmWorkRecordId: currentSection.value.id });
|
|
|
+ triggerImg.value = data || [];
|
|
|
+}
|
|
|
+
|
|
|
+const onSelect = async (option) => {
|
|
|
+ if (option.type === "wechat") {
|
|
|
+ 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`,
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ updateFlowStatus(2);
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+const updateFlowStatus = (targetFlowStatus) => {
|
|
|
+ return VE_API.z_farm_work_record.updateFlowStatus({ id: currentSection.value.id, targetFlowStatus }).then((res) => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ if (targetFlowStatus === 2) {
|
|
|
+ showApplyPopup.value = true;
|
|
|
+ }
|
|
|
+ getContentData();
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+// 取消发起需求/确认执行完成
|
|
|
+const handleOperation = (section, type) => {
|
|
|
+ currentSection.value = section;
|
|
|
+ ElMessageBox.confirm(type === "cancel" ? "确认取消发起需求吗?" : "确认执行完成吗?", "提示", {
|
|
|
+ confirmButtonText: "确认",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ updateFlowStatus(type === "cancel" ? 1 : 5);
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+};
|
|
|
+
|
|
|
+const showUpload = ref(false);
|
|
|
+const sectionId = ref(null);
|
|
|
+// 上传照片处理函数
|
|
|
+const handleUploadPhoto = ({ id }) => {
|
|
|
+ showUpload.value = true;
|
|
|
+ sectionId.value = id;
|
|
|
+};
|
|
|
|
|
|
const filterType = ref([
|
|
|
{
|
|
|
@@ -94,37 +197,60 @@ onMounted(() => {
|
|
|
});
|
|
|
|
|
|
const contentData = ref([]);
|
|
|
-const getContentData = () => {
|
|
|
- VE_API.z_farm_work_record
|
|
|
- .getSimpleList({
|
|
|
- role: localStorage.getItem("SET_USER_CUR_ROLE"),
|
|
|
- status: activePlanIndex.value === 4 ? "1,2,3,4" : activePlanIndex.value,
|
|
|
- })
|
|
|
- .then((res) => {
|
|
|
- contentData.value = res.data;
|
|
|
+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,
|
|
|
+ });
|
|
|
+ contentData.value = res.data;
|
|
|
+
|
|
|
+ // 遍历数组,获取每一项的详情并合并
|
|
|
+ if (res.data && res.data.length > 0) {
|
|
|
+ const detailPromises = res.data.map((item) => getItemDetail(item.id));
|
|
|
+ const detailResults = await Promise.all(detailPromises);
|
|
|
+
|
|
|
+ // 将详情数据合并到对应的数组项中
|
|
|
+ contentData.value = res.data.map((item, index) => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ farmWorkDetail: detailResults[index][0],
|
|
|
+ prescriptionList: detailResults[index][0]?.prescriptionList,
|
|
|
+ reviewImage: detailResults[index][0]?.reviewImage,
|
|
|
+ };
|
|
|
});
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
-const handleApply = (section, index) => {
|
|
|
- // 更新当前项的发起需求状态
|
|
|
- // showApplyPopup.value = true;
|
|
|
- // section.hasApplied = true;
|
|
|
-};
|
|
|
+async function getItemDetail(id) {
|
|
|
+ const { data } = await VE_API.z_farm_work_record.getDetail({ id });
|
|
|
+ return data || {};
|
|
|
+}
|
|
|
|
|
|
-const hasUploadedPhotos = (section) => {
|
|
|
- // 检查是否上传了图片,通过confirmPicture和executeEvidence字段判断
|
|
|
- const hasConfirmPictures = section.confirmPicture && section.confirmPicture.length > 0;
|
|
|
- const hasExecuteEvidence = section.executeEvidence && section.executeEvidence.length > 0;
|
|
|
- return hasConfirmPictures || hasExecuteEvidence;
|
|
|
+const currentSection = ref({});
|
|
|
+const handleApply = (section, type) => {
|
|
|
+ currentSection.value = section;
|
|
|
+ if (type === "remindExecute") {
|
|
|
+ const params = {
|
|
|
+ id: section.id,
|
|
|
+ farmMiniUserId: section.farmWorkDetail?.users[0]?.userId,
|
|
|
+ farmWorkOrderId: section?.orderId,
|
|
|
+ farmId: section?.farmId,
|
|
|
+ farmWorkName: section?.farmWorkName,
|
|
|
+ type: "remindExecute",
|
|
|
+ };
|
|
|
+ uploadExecuteRef.value.showPopup(params);
|
|
|
+ } else {
|
|
|
+ showShare.value = true;
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
const handleClick = (section) => {
|
|
|
- if(activePlanIndex.value == 5){
|
|
|
- router.push(`/review_work?json=${JSON.stringify({id:section.id, goBack: true})}`);
|
|
|
- }else{
|
|
|
+ if (activePlanIndex.value == 5) {
|
|
|
+ router.push(`/review_work?json=${JSON.stringify({ id: section.id, goBack: true })}`);
|
|
|
+ } else {
|
|
|
router.push({
|
|
|
path: "/completed_work",
|
|
|
- query: { json: JSON.stringify({ id: section.id }) }
|
|
|
+ query: { json: JSON.stringify({ id: section.id }) },
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
@@ -267,8 +393,8 @@ const handleClick = (section) => {
|
|
|
border-radius: 20px;
|
|
|
font-size: 12px;
|
|
|
&.second-item {
|
|
|
- border: 1px solid #2199f8;
|
|
|
- color: #2199f8;
|
|
|
+ background: rgba(137, 137, 137, 0.1);
|
|
|
+ color: #898989;
|
|
|
}
|
|
|
&.primary-item {
|
|
|
background: #2199f8;
|
|
|
@@ -280,7 +406,6 @@ const handleClick = (section) => {
|
|
|
&.has-applied {
|
|
|
background: transparent;
|
|
|
color: #afafaf;
|
|
|
- pointer-events: none;
|
|
|
}
|
|
|
}
|
|
|
&.cancel-item {
|
|
|
@@ -303,33 +428,4 @@ const handleClick = (section) => {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-.apply-popup {
|
|
|
- width: 75%;
|
|
|
- padding: 28px 28px 20px;
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- align-items: center;
|
|
|
- justify-content: center;
|
|
|
- .check-icon {
|
|
|
- width: 68px;
|
|
|
- height: 68px;
|
|
|
- margin-bottom: 12px;
|
|
|
- }
|
|
|
- .apply-text {
|
|
|
- font-size: 24px;
|
|
|
- font-weight: 500;
|
|
|
- margin-bottom: 32px;
|
|
|
- text-align: center;
|
|
|
- }
|
|
|
- .apply-btn {
|
|
|
- width: 100%;
|
|
|
- box-sizing: border-box;
|
|
|
- padding: 8px;
|
|
|
- border-radius: 25px;
|
|
|
- font-size: 16px;
|
|
|
- background: #2199f8;
|
|
|
- color: #fff;
|
|
|
- text-align: center;
|
|
|
- }
|
|
|
-}
|
|
|
</style>
|