cultivationApp/components/plant/landInfo.vue

96 lines
1.6 KiB
Vue

<template>
<view class="card">
<view class="tit">
<view class="">
{{land.crop_id}}号土地
</view>
<view class="">
溯源码: {{land.source_code}}
</view>
</view>
<view class="card-li">
<view class="">
当前种植: {{land.crop_name}}
</view>
<view class="">
种植品牌: {{land.crop_brand}}
</view>
</view>
<view class="card-li">
<view class="">
土地面积: {{land.land_area}}
</view>
<view class="">
种子品牌: {{land.crop_variety}}
</view>
</view>
<view class="card-li" v-if="land.crop_yield">
<view class="">
预计产量: {{land.crop_yield}}
</view>
<!-- <view class="">
已出售: ???
</view> -->
</view>
<view class="card-li">
<view class="">
播种时间: {{land.seed_time}}
</view>
</view>
</view>
</template>
<script setup>
import {
landInfoAPI,
} from "@/api/plant.js"
import {
reactive,
watch
} from "vue";
const props = defineProps({
land_id: String,
is_cropped: Boolean,
})
const land = reactive({})
const objFn = (res, data) => {
for (let key in res) {
data[key] = res[key]
}
}
watch(props, (newValue, oldVlaue) => {
// console.log(newValue, oldVlaue)
if (props?.land_id) {
landInfoAPI({
land_id: props.land_id,
user_id: 307
}).then(res => {
objFn(res.data, land)
})
}
}, {
immediate: true
})
</script>
<style lang="scss" scoped>
.card {
.tit {
display: flex;
justify-content: space-between;
padding-bottom: 20rpx;
border-bottom: 1px solid #EBF1EF;
}
.card-li {
margin-top: 20rpx;
display: flex;
justify-content: space-between;
}
}
</style>