cultivationApp/components/plant/landInfo.vue

106 lines
1.8 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,
defineEmits
} from "vue";
const props = defineProps({
land_id: String,
is_cropped: Boolean,
})
const emit = defineEmits(['child-click'])
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)
emit('getcropid', {
cropid: res.data.crop_id
})
})
}
}, {
immediate: true
})
</script>
<style lang="scss" scoped>
.card {
// width: 710rpx;
margin: 0 auto;
.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>