|
|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<div class="interaction-page">
|
|
|
- <custom-header name="农情互动" :showClose="false" :isGoBack="false" />
|
|
|
+ <custom-header name="农情互动" bgColor="#f2f4f5" :isClose="true" :showClose="false" />
|
|
|
<div class="interaction-content">
|
|
|
<!-- 顶部说明 -->
|
|
|
<div class="intro-card">
|
|
|
@@ -17,9 +17,18 @@
|
|
|
<div v-for="variety in crop.varieties" :key="variety.id" class="variety-card">
|
|
|
<div class="field-row">
|
|
|
<div class="field-value">
|
|
|
- <el-select v-model="variety.variety" class="variety-input" placeholder="选择品种">
|
|
|
+ <el-select
|
|
|
+ v-model="variety.variety"
|
|
|
+ class="variety-input"
|
|
|
+ placeholder="选择品种"
|
|
|
+ >
|
|
|
<el-option v-for="item in varietyOptions" :key="item.value" :label="item.label"
|
|
|
:value="item.value" />
|
|
|
+ <template #footer>
|
|
|
+ <el-button text bg @click="onAddOption(variety)">
|
|
|
+ + 增加品种
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
</el-select>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -45,12 +54,42 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+
|
|
|
+ <!-- 底部按钮 -->
|
|
|
+ <div class="fixed-btn-wrap">
|
|
|
+ <div class="fixed-btn" @click="handleConfirm">
|
|
|
+ 确认信息
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
+
|
|
|
+ <qr-code-popup ref="qrCodePopupRef">
|
|
|
+ <template #success>
|
|
|
+ <div class="success-text">
|
|
|
+ <img class="success-icon" src="@/assets/img/home/right.png" alt="">
|
|
|
+ 您的作物信息已完善
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </qr-code-popup>
|
|
|
+
|
|
|
+
|
|
|
+ <popup class="add-tag-popup" :z-index="2500" round v-model:show="showAddPopup" @update:show="handlePopupClose">
|
|
|
+ <div class="tag-item">
|
|
|
+ <div class="popup-title">新增品种名称</div>
|
|
|
+ <el-input autofocus class="popup-input" v-model="newVarietyName" placeholder="请输入品种名称" size="large" />
|
|
|
+ </div>
|
|
|
+ <div class="popup-button">
|
|
|
+ <div class="cancel" @click="handleCancelAdd">取消</div>
|
|
|
+ <div @click="handleAddVariety">确认</div>
|
|
|
+ </div>
|
|
|
+ </popup>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref } from "vue";
|
|
|
+import { ref, nextTick } from "vue";
|
|
|
+import { Popup } from "vant";
|
|
|
import customHeader from "@/components/customHeader.vue";
|
|
|
+import qrCodePopup from "@/components/popup/qrCodePopup.vue";
|
|
|
|
|
|
// 简单示例数据,后续可替换为接口返回
|
|
|
const crops = ref([
|
|
|
@@ -105,6 +144,61 @@ const stageOptions = ref([
|
|
|
{ label: "抽梢期", value: "抽梢期" },
|
|
|
{ label: "坐果期", value: "坐果期" },
|
|
|
]);
|
|
|
+
|
|
|
+const qrCodePopupRef = ref(null);
|
|
|
+
|
|
|
+const handleConfirm = () => {
|
|
|
+ qrCodePopupRef.value.showPopup();
|
|
|
+}
|
|
|
+
|
|
|
+const showAddPopup = ref(false);
|
|
|
+const newVarietyName = ref("");
|
|
|
+const currentVariety = ref(null); // 记录当前正在添加品种的 variety 对象
|
|
|
+
|
|
|
+const handleAddVariety = () => {
|
|
|
+ if (!newVarietyName.value.trim()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const newOption = { label: newVarietyName.value, value: newVarietyName.value };
|
|
|
+ varietyOptions.value.push(newOption);
|
|
|
+
|
|
|
+ // 如果当前有正在添加品种的 variety,则自动选中新增的品种
|
|
|
+ if (currentVariety.value) {
|
|
|
+ currentVariety.value.variety = newVarietyName.value;
|
|
|
+ }
|
|
|
+
|
|
|
+ newVarietyName.value = "";
|
|
|
+ showAddPopup.value = false;
|
|
|
+ currentVariety.value = null;
|
|
|
+}
|
|
|
+
|
|
|
+const onAddOption = async (variety) => {
|
|
|
+ // 先关闭下拉菜单
|
|
|
+ if (document.activeElement) {
|
|
|
+ document.activeElement.blur();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 等待下拉菜单关闭后再显示弹窗
|
|
|
+ await nextTick();
|
|
|
+
|
|
|
+ // 记录当前 variety
|
|
|
+ currentVariety.value = variety;
|
|
|
+ showAddPopup.value = true;
|
|
|
+}
|
|
|
+
|
|
|
+const handleCancelAdd = () => {
|
|
|
+ newVarietyName.value = "";
|
|
|
+ showAddPopup.value = false;
|
|
|
+ currentVariety.value = null;
|
|
|
+}
|
|
|
+
|
|
|
+const handlePopupClose = (show) => {
|
|
|
+ if (!show) {
|
|
|
+ // 弹窗关闭时清空状态
|
|
|
+ newVarietyName.value = "";
|
|
|
+ currentVariety.value = null;
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
@@ -119,7 +213,7 @@ const stageOptions = ref([
|
|
|
.interaction-content {
|
|
|
height: calc(100% - 40px);
|
|
|
overflow: auto;
|
|
|
- padding: 10px;
|
|
|
+ padding: 12px 10px 70px 10px;
|
|
|
box-sizing: border-box;
|
|
|
}
|
|
|
|
|
|
@@ -245,6 +339,32 @@ const stageOptions = ref([
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+.fixed-btn-wrap {
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ position: fixed;
|
|
|
+ bottom: 0px;
|
|
|
+ left: 0;
|
|
|
+ right: 0;
|
|
|
+ background: #fff;
|
|
|
+ padding: 10px 12px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ // box-shadow: 0 -2px 8px rgba(15, 35, 52, 0.06);
|
|
|
+ box-shadow: 2px 2px 4.5px 0px #00000066;
|
|
|
+
|
|
|
+ .fixed-btn {
|
|
|
+ min-width: 110px;
|
|
|
+ height: 40px;
|
|
|
+ line-height: 40px;
|
|
|
+ text-align: center;
|
|
|
+ border-radius: 20px;
|
|
|
+ background: linear-gradient(180deg, #70bffe, #2199f8);
|
|
|
+ color: #ffffff;
|
|
|
+ font-size: 14px;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
.date-input {
|
|
|
height: 32px;
|
|
|
border-radius: 4px;
|
|
|
@@ -257,4 +377,72 @@ const stageOptions = ref([
|
|
|
color: #c0c4cc;
|
|
|
font-size: 14px;
|
|
|
}
|
|
|
+
|
|
|
+.success-text {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ font-size: 24px;
|
|
|
+ color: #000;
|
|
|
+ .success-icon {
|
|
|
+ width: 28px;
|
|
|
+ height: 28px;
|
|
|
+ margin-right: 5px;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+.add-tag-popup {
|
|
|
+ width: 90%;
|
|
|
+ padding: 24px 16px 20px 16px;
|
|
|
+ background: linear-gradient(360deg, #FFFFFF 74.2%, #D1EBFF 100%);
|
|
|
+
|
|
|
+ .popup-title {
|
|
|
+ font-size: 16px;
|
|
|
+ font-weight: 400;
|
|
|
+ margin-bottom: 12px;
|
|
|
+ color: #000000;
|
|
|
+ .name-text{
|
|
|
+ font-weight: 500;
|
|
|
+ color: #2199F8;
|
|
|
+ padding: 0 2px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .ml-2 {
|
|
|
+ margin-left: 3px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .popup-input {
|
|
|
+ margin-bottom: 24px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .popup-button {
|
|
|
+ display: flex;
|
|
|
+
|
|
|
+ div {
|
|
|
+ flex: 1;
|
|
|
+ font-size: 16px;
|
|
|
+ padding: 9px;
|
|
|
+ border-radius: 20px;
|
|
|
+ background: #2199F8;
|
|
|
+ color: #fff;
|
|
|
+ text-align: center;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+
|
|
|
+ .cancel {
|
|
|
+ margin-right: 13px;
|
|
|
+ color: #000;
|
|
|
+ background: #fff;
|
|
|
+ border: 1px solid #999999;
|
|
|
+ }
|
|
|
+ .delete {
|
|
|
+ margin-right: 13px;
|
|
|
+ color: #FF3D3D;
|
|
|
+ background: #fff;
|
|
|
+ border: 1px solid rgba(255, 61, 61, 0.4);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|