|
|
@@ -17,10 +17,11 @@
|
|
|
onlyRecipeName
|
|
|
:content-mode="farmServiceActiveTab === 0 ? 'serviceDetail' : ''"
|
|
|
title-mode="default"
|
|
|
- :title-right-text="farmServiceActiveTab === 0 ? '分享成果' : ''"
|
|
|
+ :title-right-text="farmServiceActiveTab === 0 ? '生成成果报告' : ''"
|
|
|
:title-right-type="farmServiceActiveTab === 1 ? 'dot' : null"
|
|
|
:title-right-dot-text="farmServiceActiveTab === 1 ? '2区' : ''"
|
|
|
class="recipe-item"
|
|
|
+ @titleRightClick="handleTitleRightClick"
|
|
|
/>
|
|
|
<empty
|
|
|
v-show="detailList.length === 0"
|
|
|
@@ -39,11 +40,12 @@ import tabList from "@/components/pageComponents/TabList.vue";
|
|
|
import StatsBox from "@/components/pageComponents/StatsBox.vue";
|
|
|
import recordItem from "@/components/recordItem.vue";
|
|
|
import { Empty } from "vant";
|
|
|
-import { useRoute } from "vue-router";
|
|
|
+import { useRoute, useRouter } from "vue-router";
|
|
|
import { ref, onMounted } from "vue";
|
|
|
|
|
|
const route = useRoute();
|
|
|
const farmIdVal = ref(null);
|
|
|
+const router = useRouter();
|
|
|
onMounted(() => {
|
|
|
farmIdVal.value = route.query.farmId;
|
|
|
getDetailList();
|
|
|
@@ -60,23 +62,27 @@ const handleFarmServiceTabChange = (index) => {
|
|
|
getDetailList();
|
|
|
} else {
|
|
|
getFutureFarmWorkList();
|
|
|
- serviceStatsData.value = [
|
|
|
- { value: "1258", unit: "元", desc: "预计成交额" },
|
|
|
- { value: "5", unit: "次", desc: "预计服务次数" },
|
|
|
- ];
|
|
|
+ getFutureFarmWorkWarning()
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
+const getFutureFarmWorkWarning = async () => {
|
|
|
+ const {data} = await VE_API.home.listFutureFarmWorkWarning({ farmId: farmIdVal.value });
|
|
|
+ let totalCost = 0;
|
|
|
+ if (data.length > 0) {
|
|
|
+ totalCost = data.reduce((acc, item) => acc + item.estimatedCost, 0);
|
|
|
+ }
|
|
|
+ serviceStatsData.value = [
|
|
|
+ { value: totalCost || 0, unit: "元", desc: "预计成交额" },
|
|
|
+ { value: data.length || 0, unit: "次", desc: "预计服务次数" },
|
|
|
+ ];
|
|
|
+};
|
|
|
+
|
|
|
const paramsPage = ref(1);
|
|
|
const paramsLimit = ref(99);
|
|
|
const detailList = ref([]);
|
|
|
const getDetailList = () => {
|
|
|
- const params = {
|
|
|
- farmId: farmIdVal.value,
|
|
|
- flowStatus: '4,5',
|
|
|
- limit: paramsLimit.value,
|
|
|
- page: paramsPage.value,
|
|
|
- };
|
|
|
- VE_API.user.getDetailList(params).then(({ data }) => {
|
|
|
+ VE_API.user.farmServiceRecord({ farmId: farmIdVal.value }).then(({ data }) => {
|
|
|
detailList.value = data || [];
|
|
|
});
|
|
|
};
|
|
|
@@ -99,6 +105,13 @@ const getFarmPastServiceCost = () => {
|
|
|
];
|
|
|
});
|
|
|
};
|
|
|
+
|
|
|
+const handleTitleRightClick = (section) => {
|
|
|
+ router.push({
|
|
|
+ path: "/achievement_report",
|
|
|
+ query: { miniJson: JSON.stringify({ id: section.id }) },
|
|
|
+ });
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|