cultivationApp/components/plant/landInfo.vue

106 lines
1.8 KiB
Vue
Raw Normal View History

2023-10-25 19:55:18 +08:00
<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>
2023-10-26 19:02:26 +08:00
<view class="card-li" v-if="land.crop_yield">
2023-10-25 19:55:18 +08:00
<view class="">
预计产量: {{land.crop_yield}}
</view>
2023-10-26 19:02:26 +08:00
<!-- <view class="">
2023-10-25 19:55:18 +08:00
已出售: ???
2023-10-26 19:02:26 +08:00
</view> -->
2023-10-25 19:55:18 +08:00
</view>
<view class="card-li">
<view class="">
播种时间: {{land.seed_time}}
</view>
</view>
2023-11-21 18:54:33 +08:00
2023-10-25 19:55:18 +08:00
</view>
</template>
<script setup>
import {
landInfoAPI,
} from "@/api/plant.js"
import {
2023-10-26 19:02:26 +08:00
reactive,
2023-10-28 18:28:10 +08:00
watch,
defineEmits
2023-10-25 19:55:18 +08:00
} from "vue";
const props = defineProps({
2023-10-26 19:02:26 +08:00
land_id: String,
is_cropped: Boolean,
2023-10-25 19:55:18 +08:00
})
2023-10-28 18:28:10 +08:00
const emit = defineEmits(['child-click'])
2023-10-25 19:55:18 +08:00
const land = reactive({})
const objFn = (res, data) => {
for (let key in res) {
data[key] = res[key]
}
}
2023-10-26 19:02:26 +08:00
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)
2023-10-28 18:28:10 +08:00
emit('getcropid', {
cropid: res.data.crop_id
})
2023-10-26 19:02:26 +08:00
})
}
}, {
immediate: true
})
2023-10-25 19:55:18 +08:00
</script>
<style lang="scss" scoped>
.card {
2023-11-22 14:08:24 +08:00
// width: 710rpx;
margin: 0 auto;
2023-10-25 19:55:18 +08:00
.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>