2023-10-26 19:02:26 +08:00
|
|
|
<template>
|
|
|
|
<view class="content">
|
|
|
|
|
|
|
|
<view class="card">
|
|
|
|
<view class="card-li">
|
|
|
|
<view class="card-li-tit">
|
|
|
|
养殖种类
|
|
|
|
</view>
|
|
|
|
<view class="">
|
|
|
|
<up-input placeholder="请输入品种" border="surround" v-model="formData.kind"></up-input>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="card-li">
|
|
|
|
<view class="card-li-tit">
|
|
|
|
具体品种
|
|
|
|
</view>
|
|
|
|
<view class="">
|
|
|
|
<up-input placeholder="请输入品种" border="surround" v-model="formData.breed"></up-input>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="card-li">
|
|
|
|
<view class="card-li-tit">
|
|
|
|
具体数量
|
|
|
|
</view>
|
|
|
|
<view class="">
|
|
|
|
<up-input placeholder="请输入品种" border="surround" v-model="formData.number"></up-input>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="card-li">
|
|
|
|
<view class="card-li-tit">
|
2023-10-30 19:09:40 +08:00
|
|
|
鱼苗购入时间
|
2023-10-26 19:02:26 +08:00
|
|
|
</view>
|
|
|
|
<view class="">
|
2023-10-30 19:09:40 +08:00
|
|
|
<up-input placeholder="点击选择时间" @focus="choseDateFn" border="surround"
|
|
|
|
v-model="formData.buy_info"></up-input>
|
2023-10-26 19:02:26 +08:00
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view class="card-li">
|
|
|
|
<view class="card-li-tit">
|
|
|
|
导入凭证
|
|
|
|
</view>
|
|
|
|
<view class="code-img">
|
|
|
|
<view class="" @click="updateImgFn">
|
|
|
|
<view class="" v-if="formData.buy_cert">
|
|
|
|
<u--image :src="formData.buy_cert" width="637.85rpx" height="350.47rpx"></u--image>
|
|
|
|
</view>
|
|
|
|
<view class="carime-icon" v-else>
|
|
|
|
<u--image src="/static/img/DJSC.png" width="91.12rpx" height="91.12rpx"></u--image>
|
|
|
|
<view class="">
|
|
|
|
点击上传图片
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<!-- <view class="up-img confim-btn">
|
|
|
|
+上传播种图片
|
|
|
|
</view> -->
|
|
|
|
<view class="confirm">
|
2023-10-30 19:09:40 +08:00
|
|
|
<view class="confirm-btn" style="color: white;background-color: #0AA565;" @click="addFn">
|
2023-10-26 19:02:26 +08:00
|
|
|
完成添加
|
|
|
|
</view>
|
|
|
|
<view class="confirm-btn" style="color: #0AA565;" @click="nextFn">
|
|
|
|
下一个
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<!-- <view class="today-btn confim-btn" @tap="sowFn">
|
|
|
|
今日播种
|
|
|
|
</view> -->
|
|
|
|
|
|
|
|
<!-- 组件 -->
|
2023-10-30 19:09:40 +08:00
|
|
|
<uni-calendar :insert="false" ref="calendar" :lunar="true" @confirm="confirm" />
|
2023-10-26 19:02:26 +08:00
|
|
|
</view>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
import {
|
|
|
|
addFishAPI
|
|
|
|
} from "@/api/aquatic.js"
|
|
|
|
import uplodeImg from "@/utils/uplodeImg.js"
|
|
|
|
import {
|
|
|
|
reactive,
|
|
|
|
ref
|
|
|
|
} from "vue";
|
|
|
|
import {
|
|
|
|
onLoad
|
|
|
|
} from "@dcloudio/uni-app"
|
|
|
|
import {
|
|
|
|
userInfoStore
|
|
|
|
} from '@/store/userInfo'
|
|
|
|
const userInfo = userInfoStore()
|
2023-10-30 19:09:40 +08:00
|
|
|
// console.log()
|
2023-10-26 19:02:26 +08:00
|
|
|
const formData = reactive({})
|
|
|
|
const baseData = reactive({
|
2023-10-30 19:09:40 +08:00
|
|
|
user_id: userInfo.userInfo.id,
|
2023-10-26 19:02:26 +08:00
|
|
|
pond_id: "",
|
|
|
|
kind: "",
|
|
|
|
breed: "",
|
|
|
|
number: "",
|
|
|
|
buy_info: "",
|
|
|
|
buy_cert: ""
|
|
|
|
})
|
|
|
|
const objFn = (res, obj) => {
|
|
|
|
for (let key in res) {
|
|
|
|
obj[key] = res[key]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const navgo = (url) => {
|
|
|
|
uni.navigateTo({
|
|
|
|
url
|
|
|
|
})
|
|
|
|
}
|
2023-10-30 19:09:40 +08:00
|
|
|
const addFn = () => {
|
|
|
|
if (formData.kind) {
|
|
|
|
nextFn()
|
|
|
|
}
|
|
|
|
navgo('/pages/index/index')
|
|
|
|
}
|
2023-10-26 19:02:26 +08:00
|
|
|
const nextFn = async () => {
|
|
|
|
let res = await addFishAPI({
|
|
|
|
...formData
|
|
|
|
})
|
|
|
|
uni.showToast({
|
|
|
|
title: res.msg,
|
|
|
|
icon: 'none'
|
|
|
|
})
|
|
|
|
objFn(baseData, formData)
|
|
|
|
}
|
|
|
|
const updateImgFn = async () => {
|
|
|
|
let res = await uplodeImg()
|
|
|
|
formData.buy_cert = res.data.image
|
|
|
|
}
|
|
|
|
onLoad((options) => {
|
|
|
|
baseData.pond_id = options.pond_id
|
|
|
|
objFn(baseData, formData)
|
|
|
|
})
|
2023-10-30 19:09:40 +08:00
|
|
|
const calendar = ref()
|
|
|
|
const choseDateFn = () => {
|
|
|
|
calendar.value.open()
|
|
|
|
}
|
|
|
|
const confirm = (e) => {
|
|
|
|
formData.buy_info = e.fulldate
|
|
|
|
}
|
2023-10-26 19:02:26 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang='scss' scoped>
|
|
|
|
.tit {
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
}
|
|
|
|
|
|
|
|
.card-li-tit {
|
|
|
|
margin-bottom: 20rpx;
|
|
|
|
}
|
|
|
|
|
|
|
|
.confim-btn {
|
|
|
|
margin: 0 auto;
|
|
|
|
width: 196.26rpx;
|
|
|
|
height: 66.59rpx;
|
|
|
|
/* border: ; */
|
|
|
|
border: #00A15E 1px solid;
|
|
|
|
color: #00A15E;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
border-radius: 42.06rpx 42.06rpx 42.06rpx 42.06rpx;
|
|
|
|
}
|
|
|
|
|
|
|
|
.up-img {
|
|
|
|
width: 341.71rpx
|
|
|
|
}
|
|
|
|
|
|
|
|
.today-btn {
|
|
|
|
width: 588.79rpx;
|
|
|
|
background-color: #00A15E;
|
|
|
|
color: white;
|
|
|
|
position: fixed;
|
|
|
|
bottom: 40rpx;
|
|
|
|
/* transform: ; */
|
|
|
|
left: 50%;
|
|
|
|
transform: translateX(-50%);
|
|
|
|
background: linear-gradient(to right, #00A15E, #4CC593);
|
|
|
|
/* margin: 0 auto; */
|
|
|
|
}
|
|
|
|
|
|
|
|
.code-img {
|
|
|
|
background-color: #F4F4F4;
|
|
|
|
height: 350.47rpx;
|
|
|
|
position: relative;
|
|
|
|
margin-bottom: 100rpx;
|
|
|
|
|
|
|
|
.carime-icon {
|
|
|
|
position: absolute;
|
|
|
|
top: 50%;
|
|
|
|
left: 50%;
|
|
|
|
transform: translate(-50%, -50%);
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.confirm {
|
|
|
|
position: fixed;
|
|
|
|
height: 84.11rpx;
|
|
|
|
margin: 0 auto;
|
|
|
|
display: flex;
|
|
|
|
bottom: 80rpx;
|
|
|
|
|
|
|
|
.confirm-btn {
|
|
|
|
width: 315.42rpx;
|
|
|
|
height: 84.11rpx;
|
|
|
|
border: #00A15E 1px solid;
|
|
|
|
margin-right: 20rpx;
|
|
|
|
border-radius: 80rpx;
|
|
|
|
text-align: center;
|
|
|
|
line-height: 84rpx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|