|
@@ -29,8 +29,8 @@
|
|
|
<div class="status-r" v-if="curRole == 2">{{ status === 0 ? "提醒执行" : "提醒复核" }}</div>
|
|
<div class="status-r" v-if="curRole == 2">{{ status === 0 ? "提醒执行" : "提醒复核" }}</div>
|
|
|
</template>
|
|
</template>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="work-wrap" v-if="detailData?.orderStatus === 4 || detailData?.orderStatus === 5">
|
|
|
|
|
- <div class="box-wrap executor-info" v-if="query.status === 'warning' || curRole == 1 || curRole == 2">
|
|
|
|
|
|
|
+ <div class="work-wrap" v-if="query?.farmWorkOrderId || detailData?.flowStatus === 4">
|
|
|
|
|
+ <div class="box-wrap executor-info" v-if="query.status === 'warning' || curRole == 0 || curRole == 2">
|
|
|
<!-- <div class="executor-title">执行人</div> -->
|
|
<!-- <div class="executor-title">执行人</div> -->
|
|
|
<div class="executor-content">
|
|
<div class="executor-content">
|
|
|
<div class="executor-info mt-0">
|
|
<div class="executor-info mt-0">
|
|
@@ -42,7 +42,7 @@
|
|
|
</div>
|
|
</div>
|
|
|
<div class="executor-details">
|
|
<div class="executor-details">
|
|
|
<div class="org-name">
|
|
<div class="org-name">
|
|
|
- <span class="name">河南农资农服组织</span>
|
|
|
|
|
|
|
+ <span class="name">{{ quotationData.agriculturalStoreName || '--' }}</span>
|
|
|
<span class="rating">5.0分</span>
|
|
<span class="rating">5.0分</span>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="service-info">
|
|
<div class="service-info">
|
|
@@ -56,23 +56,23 @@
|
|
|
<div class="farm-info">
|
|
<div class="farm-info">
|
|
|
<div class="info-title-wrap">
|
|
<div class="info-title-wrap">
|
|
|
<div class="sub-title">肥药费用</div>
|
|
<div class="sub-title">肥药费用</div>
|
|
|
- <div class="info-more">1582<span class="unit-text">元</span></div>
|
|
|
|
|
|
|
+ <div class="info-more">{{ quotationData.pesticideFertilizerCost || '--' }}<span class="unit-text">元</span></div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="info-content-wrap">
|
|
<div class="info-content-wrap">
|
|
|
- <price-table>
|
|
|
|
|
|
|
+ <price-table :prescriptionData="quotationData.prescriptionList">
|
|
|
<template #bottomContent>
|
|
<template #bottomContent>
|
|
|
<div class="price-bottom">
|
|
<div class="price-bottom">
|
|
|
<div class="info-title-wrap">
|
|
<div class="info-title-wrap">
|
|
|
<div class="sub-title">服务费用</div>
|
|
<div class="sub-title">服务费用</div>
|
|
|
- <div class="info-more">1582<span class="unit-text">元</span></div>
|
|
|
|
|
|
|
+ <div class="info-more">{{ quotationData.farmWorkServiceCost || '--' }}<span class="unit-text">元</span></div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="price-info">
|
|
<div class="price-info">
|
|
|
- <div class="info-l">执行方式<span class="main-text">无人机</span></div>
|
|
|
|
|
- <div class="info-c">亩单价<span class="main-text">500元/亩</span></div>
|
|
|
|
|
- <div class="info-r">亩数<span class="main-text">10亩</span></div>
|
|
|
|
|
|
|
+ <div class="info-l">执行方式<span class="main-text">{{ quotationData.executionMethodName || '--' }}</span></div>
|
|
|
|
|
+ <div class="info-c">亩单价<span class="main-text">{{ quotationData.farmWorkServiceCost ? (quotationData.farmWorkServiceCost + '元/亩') : '--' }}</span></div>
|
|
|
|
|
+ <div class="info-r">亩数<span class="main-text">{{ quotationData.area ? (quotationData.area + '亩') : '--' }}</span></div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="price-total">
|
|
<div class="price-total">
|
|
|
- 报价合计:<span class="main-val">1258</span>元
|
|
|
|
|
|
|
+ 报价合计:<span class="main-val">{{ quotationData.totalCost || '--' }}</span>元
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
@@ -233,15 +233,16 @@
|
|
|
</div>
|
|
</div>
|
|
|
<div
|
|
<div
|
|
|
class="fixed-btn-wrap"
|
|
class="fixed-btn-wrap"
|
|
|
- :class="{ center: currentStep == 0 || (detailData?.flowStatus == 3 && curRole == 0) || (detailData?.flowStatus == 4 && curRole == 2) || (detailData?.flowStatus == 2 && curRole == 0)}"
|
|
|
|
|
|
|
+ :class="{ center: currentStep == 0 || (detailData?.flowStatus == 3 && curRole == 0) || (detailData?.flowStatus == 4 && curRole == 2) || (detailData?.flowStatus == 2 && curRole == 0) || (detailData?.flowStatus == 4 && curRole == 0)}"
|
|
|
v-if="query.status !== 'warning'"
|
|
v-if="query.status !== 'warning'"
|
|
|
>
|
|
>
|
|
|
- <div class="fixed-btn expert" v-if="currentStep == 0">提醒农事确认</div>
|
|
|
|
|
- <div class="fixed-btn expert excute" v-if="detailData?.flowStatus == 3 && curRole == 0">确认对方执行</div>
|
|
|
|
|
|
|
+ <!-- <div class="fixed-btn expert">提醒农事确认</div> -->
|
|
|
|
|
+ <div class="fixed-btn expert excute" v-if="detailData?.flowStatus == 2 && query?.farmWorkOrderId && curRole == 0" @click="handleConfirmExecute">确认对方执行</div>
|
|
|
<div class="fixed-btn expert" v-if="detailData?.flowStatus == 5 && curRole == 0">确认对方完成</div>
|
|
<div class="fixed-btn expert" v-if="detailData?.flowStatus == 5 && curRole == 0">确认对方完成</div>
|
|
|
|
|
+ <div class="fixed-btn expert" v-if="detailData?.flowStatus == 4 && curRole == 0">提醒对方执行</div>
|
|
|
<div class="fixed-btn expert" v-if="currentStep == 2 && curRole == 2">请求确认</div>
|
|
<div class="fixed-btn expert" v-if="currentStep == 2 && curRole == 2">请求确认</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 == 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 orange" v-if="detailData?.flowStatus == 2 && !(query?.farmWorkOrderId) && curRole == 0" @click="cancelDemand">取消发起</div>
|
|
|
<div class="fixed-btn" v-if="detailData?.flowStatus == 1 && curRole == 0" @click="handleOk">我已完成</div>
|
|
<div class="fixed-btn" v-if="detailData?.flowStatus == 1 && curRole == 0" @click="handleOk">我已完成</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
@@ -269,7 +270,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
<template v-else>
|
|
<template v-else>
|
|
|
<img class="farm-check-icon" src="@/assets/img/home/right.png" alt="">
|
|
<img class="farm-check-icon" src="@/assets/img/home/right.png" alt="">
|
|
|
- <div class="create-farm-text success-text">需求已发送成功</div>
|
|
|
|
|
|
|
+ <div class="create-farm-text success-text">{{ successText }}</div>
|
|
|
</template>
|
|
</template>
|
|
|
<div class="create-farm-btn" @click="handlePopupBtn">{{ taskPopupType === 'warning' ? '确认' : '我知道了' }}</div>
|
|
<div class="create-farm-btn" @click="handlePopupBtn">{{ taskPopupType === 'warning' ? '确认' : '我知道了' }}</div>
|
|
|
</popup>
|
|
</popup>
|
|
@@ -286,6 +287,7 @@ import { useRouter, useRoute } from "vue-router";
|
|
|
import farmSteps from "@/components/farmSteps.vue";
|
|
import farmSteps from "@/components/farmSteps.vue";
|
|
|
import priceTable from "../agri_work/components/priceTable.vue";
|
|
import priceTable from "../agri_work/components/priceTable.vue";
|
|
|
import priceSheetPopup from "@/components/popup/priceSheetPopup.vue";
|
|
import priceSheetPopup from "@/components/popup/priceSheetPopup.vue";
|
|
|
|
|
+import { ElMessage } from "element-plus";
|
|
|
|
|
|
|
|
const router = useRouter();
|
|
const router = useRouter();
|
|
|
const store = useStore();
|
|
const store = useStore();
|
|
@@ -313,11 +315,13 @@ const handleOk = () => {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+const successText = ref('');
|
|
|
const handleDemand = () => {
|
|
const handleDemand = () => {
|
|
|
// router.push("/share_page");
|
|
// router.push("/share_page");
|
|
|
VE_API.z_farm_work_record.updateFlowStatus({ id: query.id, targetFlowStatus: 2 }).then((res) => {
|
|
VE_API.z_farm_work_record.updateFlowStatus({ id: query.id, targetFlowStatus: 2 }).then((res) => {
|
|
|
if (res.code === 0) {
|
|
if (res.code === 0) {
|
|
|
taskPopupType.value = 'success';
|
|
taskPopupType.value = 'success';
|
|
|
|
|
+ successText.value = '需求已发送成功';
|
|
|
showTaskPopup.value = true;
|
|
showTaskPopup.value = true;
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
@@ -351,13 +355,85 @@ const showPriceSheetPopup = () => {
|
|
|
priceSheetPopupRef.value.handleShowPopup(detailData.value);
|
|
priceSheetPopupRef.value.handleShowPopup(detailData.value);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+const handleConfirmExecute = () => {
|
|
|
|
|
+ VE_API.z_farm_work_record_cost.selectQuote({ farmWorkRecordId: query.id, agriculturalId: quotationData.value.agriculturalId }).then((res) => {
|
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
|
+ taskPopupType.value = 'success';
|
|
|
|
|
+ successText.value = '农事已锁单成功';
|
|
|
|
|
+ showTaskPopup.value = true;
|
|
|
|
|
+ }
|
|
|
|
|
+})
|
|
|
|
|
+};
|
|
|
// 地图
|
|
// 地图
|
|
|
// const areaRef = ref(null);
|
|
// const areaRef = ref(null);
|
|
|
// let newFarmMap = new NewFarmMap();
|
|
// let newFarmMap = new NewFarmMap();
|
|
|
-onMounted(() => {
|
|
|
|
|
|
|
+const quotationData = ref({});
|
|
|
|
|
+onMounted(async () => {
|
|
|
const id = query.id;
|
|
const id = query.id;
|
|
|
if (id) {
|
|
if (id) {
|
|
|
- getDetail(id);
|
|
|
|
|
|
|
+ await getDetail(id);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (query.farmWorkOrderId || detailData.value?.flowStatus === 4) {
|
|
|
|
|
+ const farmWorkOrderId = query.farmWorkOrderId || detailData.value.orderId;
|
|
|
|
|
+ const { data } = await VE_API.z_farm_work_record_cost.listByOrderId({ farmWorkOrderId });
|
|
|
|
|
+ if (data && data.length > 0) {
|
|
|
|
|
+ const priceDataObj = data[0];
|
|
|
|
|
+
|
|
|
|
|
+ // 合并外层字段
|
|
|
|
|
+ quotationData.value = {
|
|
|
|
|
+ ...detailData.value,
|
|
|
|
|
+ ...priceDataObj,
|
|
|
|
|
+ agriculturalId: priceDataObj.agriculturalId,
|
|
|
|
|
+ };
|
|
|
|
|
+ console.log("quotationData.value", quotationData.value);
|
|
|
|
|
+
|
|
|
|
|
+ // 根据 itemsList 的 pesticideFertilizerId 匹配并赋值品牌和价格
|
|
|
|
|
+ if (priceDataObj.itemsList && Array.isArray(priceDataObj.itemsList) && detailData.value.prescriptionList) {
|
|
|
|
|
+ // 创建价格映射表
|
|
|
|
|
+ const priceMap = new Map();
|
|
|
|
|
+ priceDataObj.itemsList.forEach(item => {
|
|
|
|
|
+ priceMap.set(String(item.pesticideFertilizerId), {
|
|
|
|
|
+ brand: item.brand || '',
|
|
|
|
|
+ price: item.price || 0,
|
|
|
|
|
+ totalPrice: item.totalPrice || null
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ // 遍历处方列表,赋值品牌和价格,并计算格式化字段供 price-table 使用
|
|
|
|
|
+ quotationData.value.prescriptionList = detailData.value.prescriptionList.map(prescription => {
|
|
|
|
|
+ return {
|
|
|
|
|
+ ...prescription,
|
|
|
|
|
+ pesticideFertilizerList: prescription.pesticideFertilizerList.map(pesticide => {
|
|
|
|
|
+ const pesticideId = String(pesticide.pesticideFertilizerId || '');
|
|
|
|
|
+ const priceInfo = priceMap.get(pesticideId);
|
|
|
|
|
+
|
|
|
|
|
+ if (priceInfo) {
|
|
|
|
|
+ const price = priceInfo.price || 0;
|
|
|
|
|
+ const muUsage = pesticide.muUsage || 0;
|
|
|
|
|
+ const unit = pesticide.unit || '';
|
|
|
|
|
+ const area = detailData.value.area || 0;
|
|
|
|
|
+
|
|
|
|
|
+ // 计算总价:优先使用 totalPrice,否则计算 price * muUsage * area
|
|
|
|
|
+ const total = priceInfo.totalPrice !== null && priceInfo.totalPrice !== undefined
|
|
|
|
|
+ ? priceInfo.totalPrice
|
|
|
|
|
+ : (price * muUsage * area);
|
|
|
|
|
+
|
|
|
|
|
+ return {
|
|
|
|
|
+ ...pesticide,
|
|
|
|
|
+ brand: priceInfo.brand || '--',
|
|
|
|
|
+ totalPrice: priceInfo.totalPrice,
|
|
|
|
|
+ // 格式化字段供 price-table 组件使用
|
|
|
|
|
+ price: price > 0 ? `${price}元/${unit}` : '--', // 格式化单价显示
|
|
|
|
|
+ dosage: muUsage > 0 ? `${muUsage}${unit}` : '--', // 格式化用量显示
|
|
|
|
|
+ total: total > 0 ? total.toFixed(2) : '--' // 格式化总价显示
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+ return pesticide;
|
|
|
|
|
+ })
|
|
|
|
|
+ };
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
// const point = store.state.home.miniUserLocationPoint;
|
|
// const point = store.state.home.miniUserLocationPoint;
|
|
|
// if (areaRef.value) {
|
|
// if (areaRef.value) {
|
|
@@ -371,12 +447,12 @@ onMounted(() => {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
const detailData = ref({});
|
|
const detailData = ref({});
|
|
|
-const getDetail = (id) => {
|
|
|
|
|
- VE_API.z_farm_work_record.getDetail({ id }).then(({ data }) => {
|
|
|
|
|
- const res = data[0];
|
|
|
|
|
- detailData.value = res;
|
|
|
|
|
|
|
+const getDetail = async (id) => {
|
|
|
|
|
+ const { data } = await VE_API.z_farm_work_record.getDetail({ id });
|
|
|
|
|
+ if (data && data.length > 0) {
|
|
|
|
|
+ detailData.value = data[0];
|
|
|
currentStep.value = getCurrentStep(detailData.value.flowStatus);
|
|
currentStep.value = getCurrentStep(detailData.value.flowStatus);
|
|
|
- });
|
|
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
function getCurrentStep(flowStatus) {
|
|
function getCurrentStep(flowStatus) {
|