| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172 |
- <template>
- <div class="completed-work">
- <custom-header name="农事详情" :isClose="showBack" :showClose="false"></custom-header>
- <div class="work-content">
- <!-- <div class="step-wrap" v-show="query.status !== 'warning'">
- <farm-steps :currentStep="currentStep" />
- </div> -->
- <div class="content-status">
- <div class="status-l">
- <div class="stauts-text">待完成</div>
- <div class="stauts-sub-text" v-if="detailData?.executeDeadlineDate && !detailData?.expectedExecuteDate">
- 截止到 <span class="time-text">{{ detailData?.executeDeadlineDate }}</span>
- </div>
- <div class="stauts-sub-text" v-if="detailData?.expectedExecuteDate">
- <template v-if="daysDiff > 0">
- 距离执行时间还剩 <span class="time-text">{{ daysDiff }} 天</span>
- </template>
- <template v-else-if="daysDiff === 0">
- 执行时间为今天
- </template>
- <template v-else>
- 执行时间已过
- </template>
- </div>
- </div>
- <!-- <template v-if="query.status !== 'warning'">
- <div class="status-r" v-if="curRole == 0">{{ status === 0 ? "设置提醒" : "去评价" }}</div>
- <div class="status-r" v-if="curRole == 1">{{ status === 0 ? "提醒执行" : "提醒复核" }}</div>
- <div class="status-r" v-if="curRole == 2">{{ status === 0 ? "提醒执行" : "提醒复核" }}</div>
- </template> -->
- </div>
- <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-content">
- <div class="executor-info mt-0">
- <div class="executor-avatar">
- <img
- src="https://birdseye-img-ali-cdn.sysuimars.com/16926861-1e20-4cbd-8bf2-90208db5a2d0/806080da-1a30-4b5b-b64b-b22e722c6cb6/DJI_202509010800_001_806080da-1a30-4b5b-b64b-b22e722c6cb6/DJI_20250901080536_0045_V_code-ws0fsmge97gh.jpeg?x-oss-process=image/resize,w_500"
- alt="执行人"
- />
- </div>
- <div class="executor-details">
- <div class="org-name">
- <span class="name">{{ quotationData.agriculturalStoreName || "--" }}</span>
- <span class="rating">{{
- quotationData.score ? quotationData.score + "分" : ""
- }}</span>
- </div>
- <div class="service-info">
- <div class="service-item">
- 服务品种:
- <span v-if="speciesList.length">
- <span v-for="(sp, sIdx) in speciesList" :key="sIdx">
- {{ sp }}<template v-if="sIdx < speciesList.length - 1">、</template>
- </span>
- </span>
- <span v-else>--</span>
- </div>
- <div class="service-item">
- 服务设备:
- <span v-if="equipmentList.length">
- <span v-for="(eq, eIdx) in equipmentList" :key="eIdx">
- {{ eq }}<template v-if="eIdx < equipmentList.length - 1">、</template>
- </span>
- </span>
- <span v-else>--</span>
- </div>
- </div>
- </div>
- </div>
- <div class="farm-info">
- <div class="info-title-wrap">
- <div class="sub-title">药肥费用</div>
- <div class="info-more">
- {{ pesticideCostTotal ? formatArea(pesticideCostTotal) : "--"
- }}<span class="unit-text">元</span>
- </div>
- </div>
- <div class="info-content-wrap">
- <price-table
- :prescriptionData="quotationData.prescriptionList"
- :area="detailData?.area"
- :isArrList="true"
- >
- <template #bottomContent>
- <div class="price-bottom">
- <div class="info-title-wrap">
- <div class="sub-title">服务费用</div>
- <div class="info-more">
- {{ detailData?.serviceMuPrice ? serviceCostTotal : "--" }}
- <span class="unit-text">元</span>
- </div>
- </div>
- <div class="price-info">
- <div class="info-l">
- 单亩价格<span class="main-text">{{
- detailData?.serviceMuPrice
- ? detailData?.serviceMuPrice + "元/亩"
- : "--"
- }}</span>
- </div>
- </div>
- <div class="price-total">
- 报价合计:<span class="main-val">
- {{ totalCost ? formatArea(totalCost) : "--" }} </span
- >元
- </div>
- </div>
- </template>
- </price-table>
- </div>
- </div>
- <!-- <div class="contact-buttons">
- <button class="contact-btn">电话联系</button>
- <button class="contact-btn">在线联系</button>
- </div> -->
- </div>
- </div>
- </div>
- <div class="work-wrap info-wrap">
- <div class="box-wrap farm-data">
- <div class="card-title">
- <div>{{ detailData?.farmWorkName }}<span class="type-tag">标准农事</span></div>
- <!-- <div class="point-wrap">
- <div class="point"></div>
- <span>2区</span>
- </div> -->
- <div class="tag-text">托管农事</div>
- </div>
- <div class="data-content">
- <div class="form-item">
- <div class="item-name">农事编号</div>
- <div class="item-text">{{ detailData?.code }}</div>
- </div>
- <div class="form-item">
- <div class="item-name">服务亩数</div>
- <div class="item-text">
- {{ detailData?.area ? formatArea(detailData?.area) + "亩" : "--" }}
- </div>
- </div>
- <div class="form-item">
- <div class="item-name">服务区域</div>
- <div class="item-text">{{ detailData?.serviceRegion }}</div>
- </div>
- <!-- <div class="form-item">
- <div class="item-name">触发条件</div>
- <div class="item-text">{{ detailData?.condition }}</div>
- </div> -->
- <div class="form-item" v-if="detailData?.expectedExecuteDate">
- <div class="item-name">执行时间</div>
- <div class="item-text">
- {{detailData?.expectedExecuteDate}}
- </div>
- </div>
- <div class="form-item" v-else-if="detailData?.executeDeadlineDate">
- <div class="item-name">截止日期</div>
- <div class="item-text">
- {{detailData?.executeDeadlineDate}}
- </div>
- </div>
- </div>
- </div>
- <div class="box-wrap farm-table">
- <div class="card-title">药物处方</div>
- <div class="table-item">
- <div class="form-item">
- <div class="item-name">施用方式</div>
- <div class="item-text">{{ detailData?.usageMode }}</div>
- </div>
- <div class="form-item">
- <div class="item-name">执行方式</div>
- <div class="item-text">
- {{ quotationData?.executionMethodName }}
- </div>
- </div>
- </div>
- <div class="new-wrap">
- <div class="new-title">
- <div class="title-1"><div class="table-name">药肥类型</div></div>
- <div class="title-2"><div class="table-name">药肥名称</div></div>
- <div class="title-4"><div class="table-name">药肥配比</div></div>
- <div class="title-5"><div class="table-name">单亩用量</div></div>
- </div>
- <div
- class="new-table-wrap"
- v-for="(prescriptionItem, prescriptionI) in detailData?.prescriptionList"
- :key="prescriptionI"
- >
- <div
- class="new-prescription"
- v-for="(subP, subI) in prescriptionItem.pesticideFertilizerList"
- :key="subI"
- >
- <div class="new-table">
- <div class="line-l">
- <div class="line-1 title-1">{{ subP.typeName }}</div>
- <div class="line-2">{{ subP.defaultName || subP.pesticideFertilizerName }}</div>
- </div>
- <div class="line-r">
- <div class="line-3">
- <div class="sub-line title-4">{{ quotationData.executionMethod === 1 ? subP.ratio2 : subP.ratio }}倍</div>
- <div class="sub-line title-5">{{ quotationData.executionMethod === 1 ? subP.muUsage2 : subP.muUsage }}{{ subP.unit }}</div>
- </div>
- </div>
- </div>
- <div class="note-text" v-if="subP.remark">{{ subP.remark }}</div>
- </div>
- </div>
- </div>
- </div>
- <!-- <div class="work-map">
- <div class="card-title">执行农事区域</div>
- <div class="map-content">
- <div class="map-dom" ref="areaRef"></div>
- </div>
- </div> -->
- </div>
- <!-- 农资,步骤:农资已执行,请求确认 -->
- <div class="fixed-btn-wrap" :class="{ 'center': !getButtonText() }" v-if="curRole == 2 && !detailData?.expectedExecuteDate">
- <div class="fixed-btn orange primary-text" @click="handleRemindExecuteTime" v-if="getButtonText()">提醒确认执行时间</div>
- <div class="fixed-btn orange" @click="selectExecuteTime">确认执行时间</div>
- </div>
- <div class="fixed-btn-wrap" :class="{ 'center': !getButtonText() }" v-if="curRole == 2 && detailData?.expectedExecuteDate">
- <div class="fixed-btn primary primary-text width-120" @click="handleExecute" v-if="getButtonText()">提醒执行</div>
- <div class="fixed-btn primary" @click="showOfferPopup(detailData)">上传照片</div>
- </div>
- <!-- 农资,步骤:农事已确认 -->
- <!-- <div class="fixed-btn-wrap" v-if="curRole == 2 && detailData?.expectedExecuteDate">
- <div class="fixed-btn second" @click="showPriceSheetPopup">生成报价单</div>
- <div class="fixed-btn" @click="handleTimelineAction(detailData)">转入农事任务</div>
- </div> -->
- </div>
- </div>
- <!-- 报价弹窗 -->
- <!-- <offer-popup :showPopup="showPopup" :executionData="executionData"></offer-popup> -->
- <!-- 服务报价单 -->
- <price-sheet-popup ref="priceSheetPopupRef"></price-sheet-popup>
- <!-- 需求发送成功 -->
- <popup v-model:show="showTaskPopup" round class="task-tips-popup">
- <template v-if="taskPopupType === 'warning'">
- <img class="create-farm-icon" src="@/assets/img/home/create-farm-icon.png" alt="" />
- <div class="create-farm-text">
- <div>您确认取消已发起的农事需求吗</div>
- </div>
- </template>
- <template v-else-if="taskPopupType === 'warningIgnore'">
- <img class="create-farm-icon" src="@/assets/img/home/create-farm-icon.png" alt="" />
- <div class="create-farm-text">
- <div>
- 您确认忽略 <span class="main-text">{{ detailData?.farmName }}</span> 的
- <span class="main-text">{{ detailData?.farmWorkName }}</span> 农事吗
- </div>
- </div>
- </template>
- <template v-else>
- <img class="farm-check-icon" src="@/assets/img/home/right.png" alt="" />
- <div class="create-farm-text success-text">{{ successText }}</div>
- </template>
- <div class="create-farm-btn" @click="handlePopupBtn">
- {{ taskPopupType === "warning" ? "确认" : taskPopupType === "warningIgnore" ? "确认忽略" : "我知道了" }}
- </div>
- </popup>
- <!-- 确认执行时间 -->
- <calendar v-model:show="showCalendar" @confirm="onConfirmExecuteTime" :min-date="minDate" :max-date="maxDate" />
- <!-- 上传照片弹窗 -->
- <review-upload-popup :key="10" v-model="showUpload" :record-id="sectionId" @success="handleSelfDone" />
- <!-- 新增:激活上传弹窗 -->
- <active-upload-popup ref="activeUploadPopupRef" @handleUploadSuccess="handleUploadSuccess"></active-upload-popup>
- <offer-popup ref="offerPopupRef" @uploadSuccess="handleUploadSuccess"></offer-popup>
- </template>
- <script setup>
- import customHeader from "@/components/customHeader.vue";
- import { ref, computed, onActivated, onDeactivated } from "vue";
- // import NewFarmMap from "./newFarmMap";
- import { useStore } from "vuex";
- import { Popup, Calendar } from "vant";
- import offerPopup from "@/components/popup/offerPopup.vue";
- import { useRouter, useRoute } from "vue-router";
- import farmSteps from "@/components/farmSteps.vue";
- import priceTable from "../agri_work/components/priceTable.vue";
- import priceSheetPopup from "@/components/popup/priceSheetPopup.vue";
- import uploadExecute from "@/views/old_mini/task_condition/components/uploadExecute.vue";
- import { base_img_url2 } from "@/api/config";
- import { ElMessage } from "element-plus";
- import { formatArea, formatDate } from "@/common/commonFun";
- import wx from "weixin-js-sdk";
- import reviewUploadPopup from "@/components/popup/reviewUploadPopup.vue";
- import FnShareSheet from "@/components/pageComponents/FnShareSheet.vue";
- import activeUploadPopup from "@/components/popup/activeUploadPopup.vue";
- import eventBus from "@/api/eventBus";
- const router = useRouter();
- const store = useStore();
- const query = ref({});
- // 角色
- // const curRole = store.state.app.curRole
- const curRole = ref(localStorage.getItem("SET_USER_CUR_ROLE"));
- // const curRole = 2;
- // 农资待生成报价单--currentStep:1;curRole:2
- // 农资已执行,有执行照片,请求确认--currentStep:2;curRole:2
- const showUpload = ref(false);
- const sectionId = ref(null);
- // 上传照片处理函数
- const handleUploadPhoto = ({ id }) => {
- showUpload.value = true;
- sectionId.value = id;
- };
- onDeactivated(() => {
- showUpload.value = false;
- sectionId.value = null;
- });
- const handleSelfDone = () => {
- VE_API.z_farm_work_record.updateFlowStatus({ id: query.value.id, targetFlowStatus: 5 }).then((res) => {
- if (res.code === 0) {
- showUpload.value = false;
- sectionId.value = null;
- setTimeout(() => {
- router.replace({
- path: "/review_work",
- query: {
- miniJson: JSON.stringify({ id: query.value.id, goBack: true }),
- },
- });
- }, 500);
- }
- });
- };
- const successText = ref("");
- const taskPopupActionType = ref(0);
- const showTaskPopup = ref(false);
- const taskPopupType = ref("");
- const handlePopupBtn = () => {
- showTaskPopup.value = false;
- if (taskPopupType.value === "warning") {
- // 取消发起
- VE_API.z_farm_work_record.updatePublicStatus({ recordId: query.value.id, isPublic: 0 }).then((res) => {
- if (res.code === 0) {
- getDetail(query.value.id);
- }
- });
- } else if (taskPopupType.value === "warningIgnore") {
- // 确认忽略
- VE_API.z_farm_work_record.ignoreFarmWorkRecord({ farmWorkRecordId: query.value.id }).then((res) => {
- if (res.code === 0) {
- ElMessage.success("操作成功");
- router.back();
- }
- });
- } else {
- if (taskPopupActionType.value === 0) {
- getDetail(query.value.id);
- } else {
- showUpload.value = false;
- sectionId.value = null;
- setTimeout(() => {
- router.replace({
- path: "/review_work",
- query: {
- miniJson: JSON.stringify({ id: query.value.id, goBack: true }),
- },
- });
- }, 500);
- }
- }
- };
- const cancelDemand = () => {
- taskPopupType.value = "warning";
- showTaskPopup.value = true;
- };
- const priceSheetPopupRef = ref(null);
- const showPriceSheetPopup = () => {
- priceSheetPopupRef.value.handleShowPopup(detailData.value);
- };
- const getButtonText = () => {
- return agriculturalRole.value === 1 || (agriculturalRole.value === 2 && detailData.value.executorUserId != userId.value);
- };
- const offerPopupRef = ref(null);
- const isGoBack = ref(false);
- const showOfferPopup = (item) => {
- isGoBack.value = true;
- offerPopupRef.value.openPopup(item);
- };
- const handleExecute = () => {
- const query = {
- askInfo: { title: "农事提醒", content: "是否分享该农事提醒给好友" },
- shareText: '向您分享了一条农事执行提醒,请您尽快执行',
- targetUrl: `completed_work`,
- paramsPage: JSON.stringify({id: detailData.value.id}),
- imageUrl: 'https://birdseye-img.sysuimars.com/birdseye-look-mini/invite_bg.png',
- };
- wx.miniProgram.navigateTo({
- url: `/pages/subPages/share_page/index?pageParams=${JSON.stringify(query)}&type=sharePage`,
- });
- };
- const showCalendar = ref(false);
- const maxDate = ref(new Date());
- // 最小日期设置为今天,今天可以选择
- const minDate = new Date();
- const selectExecuteTime = () => {
- maxDate.value = new Date(detailData.value.executeDeadlineDate);
- showCalendar.value = true;
- };
- const handleRemindExecuteTime = () => {
- const query = {
- askInfo: { title: "农事提醒", content: "是否分享该农事提醒给好友" },
- shareText: '向您分享了一条农事提醒,请您尽快确认执行时间',
- targetUrl: `completed_work`,
- paramsPage: JSON.stringify({id: detailData.value.id}),
- imageUrl: 'https://birdseye-img.sysuimars.com/birdseye-look-mini/invite_bg.png',
- };
- wx.miniProgram.navigateTo({
- url: `/pages/subPages/share_page/index?pageParams=${JSON.stringify(query)}&type=sharePage`,
- });
- };
- const onConfirmExecuteTime = (date) => {
- showCalendar.value = false;
- VE_API.z_farm_work_record
- .updateExpectedExecuteDate({ recordId: query.value.id, expectedExecuteDate: formatDate(date) })
- .then((res) => {
- if (res.code === 0) {
- getDetail(query.value.id);
- }
- });
- };
- const handleUploadSuccess = () => {
- if (isGoBack.value) {
- isGoBack.value = false;
- router.back();
- } else {
- getDetail(query.value.id);
- }
- };
- const quotationData = ref({});
- const toList = (val) => {
- if (!val) return [];
- return JSON.parse(val);
- };
- const speciesList = computed(() => toList(quotationData.value.serviceSpecies));
- const equipmentList = computed(() => toList(quotationData.value.serviceEquipment));
- const showBack = ref(false);
- const agriculturalRole = ref(null);
- const userId = ref(null);
- onActivated(async () => {
- //
- const userInfo = JSON.parse(localStorage.getItem("localUserInfo"));
- agriculturalRole.value = userInfo.agriculturalRole;
- userId.value = userInfo.id;
- //
- query.value = useRoute().query?.miniJson ? JSON.parse(useRoute().query?.miniJson) : {};
- let id = null;
- if(query.value?.id){
- id = query.value?.id;
- showBack.value = false;
- }else{
- const data = JSON.parse(query.value?.paramsPage);
- id = data?.id;
- showBack.value = true;
- }
- if (id) {
- await getDetail(id);
- //查询农场状态信息
- getFarmWorkArrangeDetail(detailData.value.farmWorkArrangeId);
- }
- });
- const farmStatusText = ref("");
- const getFarmWorkArrangeDetail = (id) => {
- VE_API.farm.getFarmWorkArrangeDetail({ id }).then(({ data }) => {
- farmStatusText.value = data.farmStatus;
- });
- };
- // 药肥费用总计:∑(单价 * 单亩用量 * 亩数)
- const pesticideCostTotal = computed(() => {
- const list = settingData();
- const area = Number(detailData.value?.area || 0);
- if (!list.length || !area) return 0;
- const sum = list.reduce((acc, item) => {
- const price = Number(item?.muPrice || 0);
- const dosage = Number(quotationData.value.executionMethod === 1 ? item?.muUsage2 : item?.muUsage || 0);
- if (!price || !dosage) return acc;
- return acc + price * dosage * area;
- }, 0);
- return Number(sum.toFixed(2));
- });
- // 报价合计 = 药肥费用 + 服务费用
- const totalCost = computed(() => {
- const pesticide = Number(pesticideCostTotal.value || 0);
- const service = Number(serviceCostTotal.value || 0);
- if (!pesticide && !service) return '--';
- return Number((pesticide + service).toFixed(2));
- });
- // 服务费用总计(数值):亩单价 * 亩数
- const serviceCostTotal = computed(() => {
- const price = Number(detailData.value?.serviceMuPrice || 0);
- const area = Number(detailData.value?.area || 0);
- if (!price || !area) return 0;
- return Number((price * area).toFixed(2));
- });
- const settingData = () => {
- return flattenDomains(quotationData.value.prescriptionList);
- };
- function flattenDomains(data) {
- if (!data || !Array.isArray(data)) return [];
- // 将所有 prescriptionList 中的 pesticideFertilizerList 合并成一个数组
- return data.reduce((acc, item) => {
- const list = item?.pesticideFertilizerList || [];
- return acc.concat(list);
- }, []);
- }
- const detailData = ref({});
- // 计算距离执行时间的天数差
- const daysDiff = computed(() => {
- if (!detailData.value?.expectedExecuteDate) {
- return 0;
- }
- const executeDate = new Date(detailData.value.expectedExecuteDate);
- const today = new Date();
- // 将时间设置为 00:00:00,只比较日期
- executeDate.setHours(0, 0, 0, 0);
- today.setHours(0, 0, 0, 0);
- // 计算天数差(毫秒转天数)
- const diffTime = executeDate.getTime() - today.getTime();
- const diffDays = Math.floor(diffTime / (1000 * 60 * 60 * 24));
- return diffDays;
- });
- const getDetail = async (id) => {
- const { data } = await VE_API.z_farm_work_record.getDetail({ id });
- if (data && data.length > 0) {
- detailData.value = data[0];
- // 报价信息
- handlePriceInfo();
- }
- };
- const handlePriceInfo = async () => {
- let priceDataObj = {};
- const { data } = await VE_API.z_farm_work_record_cost.getByRecordId({ farmWorkRecordId: detailData.value.id });
- priceDataObj = data;
- // 执行方式为1:无人机,则使用无人机价格,否则使用人工价格
- detailData.value.serviceMuPrice = data?.executionMethod === 1 ? data?.uavServicePrice : data?.manualServicePrice;
- if (priceDataObj && Object.keys(priceDataObj).length > 0) {
- // 合并外层字段
- quotationData.value = {
- ...detailData.value,
- ...priceDataObj,
- };
- // 根据 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,
- });
- });
- // 遍历处方列表,赋值品牌和价格,并计算格式化字段供 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 = price * muUsage * area;
- return {
- ...pesticide,
- brand: priceInfo.brand || "--",
- // 格式化字段供 price-table 组件使用
- price: price > 0 ? `${price}元/${unit}` : "--", // 格式化单价显示
- dosage: muUsage > 0 ? `${muUsage}${unit}` : "--", // 格式化用量显示
- total: total > 0 ? total.toFixed(2) : "--", // 格式化总价显示
- };
- }
- return pesticide;
- }),
- };
- });
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .completed-work {
- height: 100vh;
- position: relative;
- overflow: auto;
- font-size: 14px;
- background: #f2f3f5;
- .work-content {
- height: calc(100% - 40px);
- overflow: auto;
- box-sizing: border-box;
- &.hasBottom {
- padding-bottom: 60px;
- }
- .info-wrap {
- margin-bottom: 80px;
- }
- .work-wrap {
- position: relative;
- z-index: 3;
- padding: 0 12px;
- top: -16px;
- }
- .pt-10 {
- padding-top: 10px;
- }
- .fixed-btn-wrap {
- position: fixed;
- z-index: 10;
- bottom: 0;
- left: 0;
- width: 100%;
- padding: 10px 12px 25px;
- box-sizing: border-box;
- display: flex;
- align-items: center;
- justify-content: space-between;
- background: #fff;
- box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.4);
- &.center {
- justify-content: center;
- }
- .fixed-btn {
- width: 120px;
- text-align: center;
- height: 40px;
- line-height: 40px;
- background: linear-gradient(180deg, #70bffe, #2199f8);
- border-radius: 25px;
- color: #fff;
- font-size: 14px;
- box-sizing: border-box;
- &.orange {
- color: #ff953d;
- border: 1px solid #ff953d;
- background: rgba(255, 149, 61, 0.1);
- }
- &.excute {
- background: linear-gradient(180deg, #ffd887, #ed9e1e);
- }
- &.second {
- background: #ffffff;
- border: 1px solid rgba(153, 153, 153, 0.5);
- color: #666666;
- }
- &.primary-text {
- width: 160px;
- background: rgba(33, 153, 248, 0.1);
- color: #2199f8;
- border: 1px solid #2199f8;
- }
- &.width-120 {
- width: 120px;
- }
- }
- }
- .card-title {
- font-size: 16px;
- font-weight: bold;
- color: #000;
- display: flex;
- align-items: center;
- justify-content: space-between;
- .tag-text {
- color: #2199f8;
- font-size: 12px;
- font-weight: normal;
- }
- .point-wrap {
- display: flex;
- align-items: center;
- color: #393939;
- font-size: 12px;
- font-weight: normal;
- .point {
- width: 6px;
- height: 6px;
- border-radius: 50%;
- background: #393939;
- margin-right: 4px;
- }
- }
- .type-tag {
- margin-left: 5px;
- font-size: 12px;
- color: #000000;
- padding: 4px 10px;
- background: rgba(119, 119, 119, 0.1);
- border-radius: 20px;
- font-weight: normal;
- height: 26px;
- line-height: 26px;
- }
- }
- .box-wrap {
- background: #fff;
- padding: 10px;
- border-radius: 8px;
- }
- .step-wrap {
- padding: 18px 0;
- }
- .content-status {
- position: relative;
- padding: 26px 12px 20px 12px;
- color: #fff;
- z-index: 2;
- display: flex;
- justify-content: space-between;
- align-items: center;
- &::after {
- content: "";
- z-index: -1;
- position: absolute;
- left: 0;
- top: 0;
- height: 136px;
- background: #2199f8;
- width: 100%;
- }
- .status-l {
- .stauts-text {
- font-size: 22px;
- display: flex;
- align-items: center;
- .status-icon {
- width: 24px;
- height: 24px;
- background: #ffffff;
- border-radius: 50%;
- margin-right: 8px;
- }
- }
- .stauts-sub-text {
- // color: rgba(255, 255, 255, 0.51);
- font-size: 14px;
- }
- .time-text {
- color: #ffff;
- }
- }
- &.warning {
- &::after {
- background: #ff953d;
- }
- .stauts-sub-text {
- color: #fff;
- }
- }
- .status-r {
- height: 32px;
- line-height: 32px;
- padding: 0 16px;
- color: #2199f8;
- font-size: 16px;
- background: #fff;
- border-radius: 20px;
- }
- }
- .info-content {
- padding: 10px 0;
- position: relative;
- }
- .info-title-wrap {
- display: flex;
- align-items: center;
- justify-content: space-between;
- color: #000;
- .info-more {
- font-size: 18px;
- }
- .unit-text {
- font-size: 12px;
- }
- }
- .info-content-wrap {
- .price-bottom {
- padding-top: 8px;
- .price-info {
- padding: 8px 0;
- display: flex;
- align-items: center;
- justify-content: space-between;
- color: rgba(0, 0, 0, 0.2);
- .main-text {
- padding-left: 20px;
- color: rgba(0, 0, 0, 0.8);
- }
- .info-c {
- flex: 1;
- text-align: center;
- }
- }
- .price-total {
- height: 38px;
- display: flex;
- align-items: center;
- justify-content: center;
- border: 1px solid rgba(33, 153, 248, 0.5);
- background: rgba(33, 153, 248, 0.1);
- color: #000000;
- border-radius: 4px;
- .main-val {
- font-size: 20px;
- font-weight: bold;
- color: #2199f8;
- padding-right: 2px;
- }
- }
- }
- }
- .executor-info {
- margin-top: 14px;
- &.mt-0 {
- margin-top: 0;
- }
- .executor-title {
- font-size: 18px;
- font-weight: bold;
- color: #000;
- margin-bottom: 12px;
- }
- .executor-content {
- .executor-info {
- display: flex;
- align-items: flex-start;
- gap: 12px;
- }
- .executor-avatar {
- flex-shrink: 0;
- img {
- width: 60px;
- height: 60px;
- border-radius: 8px;
- object-fit: cover;
- }
- }
- .executor-details {
- flex: 1;
- .org-name {
- display: flex;
- align-items: center;
- gap: 8px;
- margin-bottom: 3px;
- .name {
- font-size: 16px;
- font-weight: bold;
- color: #000;
- }
- .rating {
- font-size: 16px;
- color: #ff953d;
- font-weight: bold;
- }
- }
- .service-info {
- .service-item {
- font-size: 12px;
- color: #b6b6b6;
- line-height: 1.3;
- margin-bottom: 2px;
- span {
- color: #666666;
- }
- }
- }
- }
- }
- .contact-buttons {
- display: flex;
- justify-content: flex-end;
- gap: 8px;
- margin-top: 16px;
- .contact-btn {
- width: 88px;
- height: 32px;
- border-radius: 20px;
- color: rgba(0, 0, 0, 0.5);
- background: #fff;
- border: 1px solid rgba(0, 0, 0, 0.1);
- }
- }
- }
- .farm-info {
- color: rgba(0, 0, 0, 0.6);
- font-size: 14px;
- margin-top: 14px;
- .info-title {
- display: flex;
- align-items: center;
- justify-content: space-between;
- color: rgba(41, 41, 41, 0.3);
- .info-more {
- display: flex;
- align-items: center;
- }
- }
- }
- .farm-photo {
- margin-top: 10px;
- .photo-list {
- display: flex;
- align-items: center;
- width: 100%;
- overflow: auto;
- padding-bottom: 10px;
- .photo-item {
- width: 92px;
- height: 92px;
- border-radius: 8px;
- object-fit: cover;
- }
- .img-item {
- img {
- width: 92px;
- height: 92px;
- border-radius: 8px;
- object-fit: cover;
- margin-right: 12px;
- }
- }
- .view-box {
- width: 92px;
- height: 92px;
- border-radius: 8px;
- object-fit: cover;
- }
- }
- .list-text {
- text-align: center;
- color: rgba(0, 0, 0, 0.5);
- padding-top: 2px;
- }
- }
- .farm-data {
- margin-top: 10px;
- .data-content {
- margin-top: 8px;
- border-top: 1px solid #f5f5f5;
- padding: 8px 0;
- }
- }
- .form-item {
- display: flex;
- align-items: center;
- font-size: 14px;
- color: #767676;
- height: 24px;
- .item-name {
- width: 80px;
- color: rgba(0, 0, 0, 0.2);
- }
- }
- .form-item + .form-item {
- padding-top: 2px;
- }
- .farm-table {
- margin-top: 10px;
- .table-item {
- padding: 10px 0 12px 0;
- }
- }
- .new-wrap {
- border-radius: 5px;
- text-align: center;
- border: 1px solid rgba(225, 225, 225, 0.5);
- .new-title {
- background: rgba(241, 241, 241, 0.4);
- border-radius: 5px 5px 0 0;
- border-bottom: 1px solid rgba(225, 225, 225, 0.5);
- display: flex;
- color: #767676;
- // justify-content: space-around;
- padding: 5px 6px;
- font-size: 12px;
- .table-name {
- width: 24px;
- font-size: 12px;
- margin: 0 auto;
- }
- }
- .title-1 {
- width: 46px;
- }
- .title-2 {
- flex: 1;
- }
- .title-3 {
- width: 52px;
- }
- .title-4 {
- width: 56px;
- }
- .title-5 {
- width: 52px;
- }
- .new-table-wrap {
- .new-prescription {
- .new-table {
- height: 45px;
- display: flex;
- align-items: center;
- background: #fff;
- border-radius: 5px;
- color: rgba(0, 0, 0, 0.6);
- font-size: 11px;
- .line-l {
- display: flex;
- flex: 1;
- .line-2 {
- flex: 1;
- padding: 0 2px;
- }
- }
- .line-r {
- &.has-border {
- border-left: 1px solid rgba(225, 225, 225, 0.8);
- }
- .line-3 {
- display: flex;
- align-items: center;
- }
- .sub-line {
- padding: 10px 0;
- }
- .line-4 {
- display: flex;
- align-items: center;
- border-top: 1px solid rgba(225, 225, 225, 0.8);
- }
- .execute-line {
- border-right: 1px solid rgba(225, 225, 225, 0.8);
- }
- }
- }
- .note-text {
- margin: 8px 0 4px 0;
- color: rgba(0, 0, 0, 0.4);
- background: #fff;
- padding: 6px 8px;
- border-radius: 5px;
- text-align: left;
- font-size: 11px;
- }
- }
- .new-prescription + .new-prescription {
- .new-table {
- border-top: 1px solid rgba(0, 0, 0, 0.08);
- }
- }
- }
- }
- .work-map {
- padding: 10px 0;
- .map-content {
- padding-top: 8px;
- .map-dom {
- height: 166px;
- width: 100%;
- clip-path: inset(0px round 8px);
- }
- }
- }
- }
- }
- .task-tips-popup {
- width: 75%;
- padding: 28px 28px 20px;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- .create-farm-icon {
- width: 40px;
- height: 40px;
- margin-bottom: 12px;
- }
- .farm-check-icon {
- width: 68px;
- height: 68px;
- margin-bottom: 12px;
- }
- .create-farm-text {
- font-size: 20px;
- font-weight: 500;
- line-height: 40px;
- margin-bottom: 32px;
- text-align: center;
- &.success-text {
- font-size: 23px;
- font-weight: 400;
- }
- }
- .main-text {
- color: #2199f8;
- }
- .create-farm-btn {
- width: 100%;
- box-sizing: border-box;
- padding: 8px;
- border-radius: 25px;
- font-size: 16px;
- background: #2199f8;
- color: #fff;
- text-align: center;
- }
- }
- </style>
|