|
|
@@ -19,11 +19,11 @@
|
|
|
<div class="quotation-info">
|
|
|
<div class="info-item">
|
|
|
<span class="info-label">报价组织</span>
|
|
|
- <span class="info-value">{{ quotationData.serviceMain || '--' }}</span>
|
|
|
+ <span class="info-value">{{ priceData.serviceMain || '--' }}</span>
|
|
|
</div>
|
|
|
<div class="info-item">
|
|
|
<span class="info-label">报价农事</span>
|
|
|
- <span class="info-value">{{ quotationData?.farmWorkName || '--' }}</span>
|
|
|
+ <span class="info-value">{{ priceData?.name || '--' }}</span>
|
|
|
</div>
|
|
|
<div class="info-item">
|
|
|
<span class="info-label">执行时间</span>
|
|
|
@@ -100,24 +100,24 @@
|
|
|
<!-- 底部操作按钮 -->
|
|
|
<div class="bottom-actions" @click.stop="showPopup = false">
|
|
|
<div class="action-buttons">
|
|
|
- <div class="action-btn blue-btn" @click.stop="handleShare">
|
|
|
+ <!-- <div class="action-btn blue-btn" @click.stop="handleShare">
|
|
|
<div class="icon-circle">
|
|
|
<img src="@/assets/img/home/bird.png" alt="" />
|
|
|
</div>
|
|
|
<span class="btn-label">飞鸟用户</span>
|
|
|
- </div>
|
|
|
+ </div> -->
|
|
|
<div class="action-btn green-btn" @click.stop="handleWechat">
|
|
|
<div class="icon-circle">
|
|
|
<img src="@/assets/img/home/wechat.png" alt="" />
|
|
|
</div>
|
|
|
<span class="btn-label">微信</span>
|
|
|
</div>
|
|
|
- <!-- <div class="action-btn orange-btn">
|
|
|
+ <div class="action-btn orange-btn" @click.stop="handleSaveImage">
|
|
|
<div class="icon-circle">
|
|
|
<el-icon :size="24"><Download /></el-icon>
|
|
|
</div>
|
|
|
<span class="btn-label">保存图片</span>
|
|
|
- </div> -->
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div class="cancel-btn" @click="handleCancel">取消</div>
|
|
|
</div>
|
|
|
@@ -148,7 +148,7 @@ onActivated(() => {
|
|
|
|
|
|
// 处理后的处方列表(展平并匹配价格)
|
|
|
const processedPrescriptionList = computed(() => {
|
|
|
- if (!quotationData.value?.prescriptionList || !Array.isArray(quotationData.value.prescriptionList)) {
|
|
|
+ if (!priceData.value?.prescriptionList || !Array.isArray(priceData.value.prescriptionList)) {
|
|
|
return [];
|
|
|
}
|
|
|
|
|
|
@@ -161,7 +161,7 @@ const processedPrescriptionList = computed(() => {
|
|
|
}
|
|
|
// 展平 prescriptionList 中的所有 pesticideFertilizerList
|
|
|
const result = [];
|
|
|
- quotationData.value.prescriptionList.forEach(prescription => {
|
|
|
+ priceData.value.prescriptionList.forEach(prescription => {
|
|
|
if (prescription.pesticideFertilizerList && Array.isArray(prescription.pesticideFertilizerList)) {
|
|
|
prescription.pesticideFertilizerList.forEach(item => {
|
|
|
const pesticideFertilizerId = String(item.pesticideFertilizerId || '');
|
|
|
@@ -169,7 +169,7 @@ const processedPrescriptionList = computed(() => {
|
|
|
const price = mapped.price || 0;
|
|
|
const brand = mapped.brand || item.brand || '';
|
|
|
const total = mapped.totalPrice || item.total || '';
|
|
|
- const muUsage = quotationData.value.usageMode === "叶面施" ? (item.muUsage2 || item.muUsage) : item.muUsage
|
|
|
+ const muUsage = priceData.value.usageMode === "叶面施" ? (item.muUsage2 || item.muUsage) : item.muUsage
|
|
|
const unit = item.unit || '';
|
|
|
|
|
|
result.push({
|
|
|
@@ -199,29 +199,48 @@ function getServiceCost(cost, area) {
|
|
|
return (parseFloat(cost) * parseFloat(area)).toFixed(2);
|
|
|
}
|
|
|
|
|
|
-const handleShowPopup = (data) => {
|
|
|
- if (data) {
|
|
|
- quotationData.value = data;
|
|
|
- fetchPriceData();
|
|
|
+const handleShowPopup = ({id, farmId, agriculturalId}) => {
|
|
|
+ if (id) {
|
|
|
+ loading.value = true;
|
|
|
+ getDetail(id, farmId, agriculturalId);
|
|
|
}
|
|
|
showPopup.value = true;
|
|
|
};
|
|
|
|
|
|
const loading = ref(false);
|
|
|
-function fetchPriceData() {
|
|
|
- if (!quotationData.value?.id) {
|
|
|
- return;
|
|
|
- }
|
|
|
- loading.value = true;
|
|
|
- VE_API.z_farm_work_record_cost.getByRecordId({ farmWorkRecordId: quotationData.value.id }).then(({ data }) => {
|
|
|
+function fetchPriceData(id) {
|
|
|
+
|
|
|
+ // VE_API.z_farm_work_record_cost.getByRecordId({ farmWorkRecordId: quotationData.value.id }).then(({ data }) => {
|
|
|
+ // priceData.value = data;
|
|
|
+ // }).catch(() => {
|
|
|
+ // // 获取价格数据失败
|
|
|
+ // }).finally(() => {
|
|
|
+ // loading.value = false;
|
|
|
+ // });
|
|
|
+}
|
|
|
+
|
|
|
+const getDetail = async (id, farmId, agriculturalId) => {
|
|
|
+ const { data, code } = await VE_API.farm.getFarmWorkLib({ id, farmId, agriculturalId });
|
|
|
+ if(code === 0) {
|
|
|
priceData.value = data;
|
|
|
- }).catch(() => {
|
|
|
- // 获取价格数据失败
|
|
|
- }).finally(() => {
|
|
|
+ const pesticideFertilizerCodes = data.prescription.pesticideFertilizerList.map(item => item.code);
|
|
|
+ getPriceList(data.schemeId, pesticideFertilizerCodes);
|
|
|
loading.value = false;
|
|
|
- });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+const getPriceList = async (schemeId, pesticideFertilizerCodes) => {
|
|
|
+ const { data } = await VE_API.farm.getPriceList({ schemeId, pesticideFertilizerCodes });
|
|
|
+ if (!data || !Array.isArray(data)) return;
|
|
|
+
|
|
|
+ priceData.value.prescription.pesticideFertilizerList.forEach((item) => {
|
|
|
+ const priceInfo = data.find((p) => p.pesticideFertilizerCode === item.code);
|
|
|
+ if (!priceInfo) return;
|
|
|
+ item.price = priceInfo.price ?? item.price;
|
|
|
+ item.brand = priceInfo.brand ?? item.brand;
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
// 检查 itemsList 是否都有价格和品牌
|
|
|
function checkItemsListHasPrice() {
|
|
|
if (!priceData.value?.itemsList || !Array.isArray(priceData.value.itemsList) || priceData.value.itemsList.length === 0) {
|
|
|
@@ -393,9 +412,20 @@ const handleEdit = () => {
|
|
|
// 编辑报价逻辑
|
|
|
// 可以触发编辑事件或打开编辑页面
|
|
|
router.push({
|
|
|
- path: "/price_detail",
|
|
|
- query: { data: JSON.stringify(quotationData.value), priceData: JSON.stringify(priceData.value) },
|
|
|
+ path: "/modify",
|
|
|
+ query: {
|
|
|
+ isEdit: true,
|
|
|
+ id: priceData.value.id,
|
|
|
+ farmId: priceData.value.farm.id,
|
|
|
+ farmWorkId: priceData.value.id,
|
|
|
+ containerSpaceTimeId: priceData.value.containerSpaceTimeId,
|
|
|
+ agriculturalStoreId: priceData.value.agriculturalStoreId,
|
|
|
+ },
|
|
|
});
|
|
|
+ // router.push({
|
|
|
+ // path: "/price_detail",
|
|
|
+ // query: { data: JSON.stringify(quotationData.value), priceData: JSON.stringify(priceData.value) },
|
|
|
+ // });
|
|
|
};
|
|
|
|
|
|
// 清空数据
|