| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446 |
- <template>
- <el-dialog
- v-model="winDialogVisible"
- lock-scroll
- modal-class="album-detail-modal"
- :showClose="false"
- width="86%"
- align-center
- @close="closeDialog"
- >
- <div class="detail-log">
- <div class="congratulation-wrap">
- <div class="congratulation-box">
- <div class="win-des">
- <!-- <img src="@/assets/img/weather_index/box-top.png" class="win-icon" /> -->
- </div>
- <div class="album-detail-box">
- <div class="detail-title">{{ dialogData.name }}</div>
- <div class="detail-desc-box">
- <!-- <div class="desc-item van-ellipsis" v-if="dialogData?.conditionList && dialogData.conditionList.length">
- <span class="item-name">触发条件</span>
- {{
- dialogData.condition ||
- dialogData.conditionList[0].name + dialogData.conditionList[0].value
- }}
- </div> -->
- <div class="desc-item van-ellipsis">
- <span class="item-name">农事编号</span>
- {{ dialogData.code }}
- </div>
- <div class="desc-item">
- <span class="item-name">推荐时间</span>
- {{ dialogData.executeDate }}
- </div>
- <div class="desc-item">
- <div class="item-name">药物处方
- <span class="no-prescription" v-if="!hasPrescription">暂无处方</span>
- </div>
- <div class="item-table" v-if="hasPrescription">
- <div class="table">
- <div class="th">
- <div class="td">类型</div>
- <div class="td width">名称</div>
- <div class="td">配比</div>
- <div class="td">方式</div>
- </div>
- <div
- class="tr"
- v-for="(subP, subI) in dialogData.prescription?.pesticideFertilizerList"
- :key="subI"
- >
- <div class="td">{{ subP.typeName }}</div>
- <div class="td width">{{ subP.name }}</div>
- <div class="td">{{ subP.ratio }}</div>
- <div class="td">人工</div>
- </div>
- </div>
- </div>
- </div>
- <div class="card-link">
- <img :src="dialogData.expertIcon || dialogData.expertUserIcon" />
- <div class="expert-name">
- {{ dialogData.expertUserName || dialogData.expertName }}
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="bottom-btn" v-if="showBtn">
- <div class="btn-item secondary-btn" @click="toPage">{{ btnText }}</div>
- <div class="btn-item primary-btn" @click="triggerClick">{{ curRole == 0 ? "触发农事" : "下发农事" }}</div>
- </div>
- </div>
- <template #footer>
- <div class="dialog-footer">
- <div class="close-btn">
- <!-- <el-icon size="32" color="#fff"><CircleCloseFilled /></el-icon> -->
- <!-- <el-button type="primary" class="one-btn" @click="toShare"> 立即分享 </el-button> -->
- </div>
- </div>
- </template>
- </el-dialog>
- <Popup v-model:show="noShow" class="no-popup">
- <div class="right-icon">
- <img class="right-img" src="@/assets/img/home/right.png" alt="" />
- </div>
- <div class="no-popup-title">
- <span>{{ curRole == 0 ? "好的,感谢您的配合" : "农事下发成功" }}</span>
- <div class="no-popup-title-sub" v-if="curRole == 0">请您耐心等待 农事确认</div>
- </div>
- <div class="no-popup-btn" @click="handleNoPopupBtn">{{ curRole == 0 ? "我知道了" : "我知道了" }}</div>
- </Popup>
- </template>
- <script setup>
- import { ref, computed } from "vue";
- import eventBus from "@/api/eventBus";
- import { Popup } from "vant";
- import { useRoute, useRouter } from "vue-router";
- import { ElMessage } from "element-plus";
- const props = defineProps({
- showSuccessOnly: {
- type: Boolean,
- default: false,
- },
- });
- const curRole = localStorage.getItem("SET_USER_CUR_ROLE");
- const winDialogVisible = ref(false);
- const noShow = ref(false);
- const btnText = ref('');
- const route = useRoute();
- const router = useRouter();
- const triggerClick = () => {
- winDialogVisible.value = false;
- // 如果只显示成功弹窗(来自 album_recognize 页面)
- if (props.showSuccessOnly) {
- noShow.value = true;
- }
- emit("triggerFarmWork");
- };
- const emit = defineEmits(["triggerFarmWork", "noPopupBtn"]);
- const dialogData = ref({})
- const showBtn = ref(true);
- const showDialog = (id,btnTextVal = '转发', showBtnVal = true) => {
- btnText.value = btnTextVal;
- showBtn.value = showBtnVal;
- if (id) {
- VE_API.farm
- .getFarmWorkLib({ id })
- .then(({ code, data }) => {
- if (code === 0 && data) {
- // 将接口返回的数据更新到 dialogData
- dialogData.value = data || {};
- settingData();
- }
- })
- .catch((error) => {
- console.error("获取农事详情失败:", error);
- });
- }
- winDialogVisible.value = true;
- };
- defineExpose({ showDialog });
- //立即激活
- const handleAct = () => {
- winDialogVisible.value = false;
- eventBus.emit("uploadUopup:show", {
- gardenIdVal: dialogData.value.farmId,
- orderIdVal: dialogData.value.orderId,
- textVal: dialogData.value.consequenceText,
- });
- };
- const pesticideFertilizers = ref([]);
- // 判断是否有处方数据
- const hasPrescription = computed(() => {
- const pesticideFertilizerList = dialogData.value.prescription?.pesticideFertilizerList;
- return pesticideFertilizerList && Array.isArray(pesticideFertilizerList) && pesticideFertilizerList.length > 0;
- });
- const settingData = () => {
- const pesticideFertilizerList = dialogData.value.prescription?.pesticideFertilizerList;
- pesticideFertilizers.value = pesticideFertilizerList || [];
- };
- function closeDialog() {
- winDialogVisible.value = false;
- }
- function toPage() {
- if(btnText.value!='转发'){
- router.push("/expert_list");
- }
- ElMessage.warning("该功能正在升级中,敬请期待");
- }
- const handleNoPopupBtn = () => {
- noShow.value = false;
- // if(curRole == 0){
- // noShow.value = false;
- // }else{
- // noShow.value = false;
- // emit("noPopupBtn");
- // }
- };
- </script>
- <style lang="scss" scoped>
- .congratulation-wrap {
- border-radius: 12px;
- background: #f4f5f4;
- width: 100%;
- }
- .detail-log {
- width: 100%;
- }
- .close-btn {
- text-align: center;
- margin-top: 20px;
- }
- .bottom-btn {
- position: absolute;
- width: 100%;
- text-align: center;
- margin-top: 20px;
- display: flex;
- .btn-item {
- flex: 1;
- text-align: center;
- height: 38px;
- line-height: 38px;
- border-radius: 30px;
- font-size: 14px;
- &.secondary-btn {
- background: #ffffff;
- color: #000000;
- }
- &.primary-btn {
- background: linear-gradient(180deg, #76c3ff, #2199f8);
- color: #ffffff;
- }
- }
- .btn-item + .btn-item {
- margin-left: 12px;
- }
- }
- .congratulation-box {
- border-radius: 12px;
- background: url("@/assets/img/home/sd-bg.png") no-repeat top center / contain;
- // background: url("@/assets/img/home/box-top.png") no-repeat top center / contain;
- .el-message-box__message {
- padding: 12px 0 24px 0;
- }
- .win-title {
- color: #1d1e1f;
- font-family: "PangMenZhengDao", sans-serif; /* 使用自定义字体 */
- text-align: center;
- font-size: 24px;
- line-height: 32px;
- }
- .win-detail {
- text-align: center;
- color: #252525;
- padding-top: 6px;
- font-size: 16px;
- span {
- font-size: 22px;
- color: #2199f8;
- padding: 0 6px;
- font-weight: bold;
- }
- }
- .win-des {
- height: 180px;
- text-align: center;
- }
- .win-icon {
- width: 100%;
- border-radius: 12px 12px 0 0;
- }
- }
- .album-detail-box {
- padding: 0 10px 16px 10px;
- color: #000;
- position: relative;
- // top: -58px;
- .detail-title {
- font-size: 24px;
- font-weight: bold;
- padding-bottom: 8px;
- letter-spacing: 1.6px;
- }
- .detail-desc-box {
- position: relative;
- .desc-item {
- font-size: 14px;
- &.van-ellipsis{
- max-width: calc(100% - 86px);
- }
- .item-name {
- color: #999999;
- margin-right: 12px;
- }
- .no-prescription {
- margin-left: 12px;
- color: #000;
- }
- .item-table {
- margin-top: 8px;
- .table {
- border: 1px solid rgba(196, 196, 196, 0.8);
- border-radius: 4px;
- font-size: 13px;
- .th {
- background: #f5f5f5;
- color: #999999;
- display: flex;
- justify-content: space-between;
- border-radius: 4px 4px 0 0;
- padding: 4px 0;
- }
- .tr {
- display: flex;
- justify-content: space-between;
- align-items: center;
- color: #333333;
- padding: 6px 0;
- }
- .tr + .tr {
- border-top: 1px solid rgba(0, 0, 0, 0.08);
- }
- .td {
- width: 25%;
- padding: 0 2px;
- text-align: center;
- }
- .width {
- width: 55%;
- }
- }
- }
- }
- .desc-item + .desc-item {
- padding-top: 4px;
- }
- .card-link {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- color: #2199f8;
- font-size: 12px;
- position: absolute;
- right: 6px;
- top: 0px;
- .expert-name {
- background: #d3e8ff;
- border-radius: 4px;
- padding: 1px 12px;
- margin-top: 4px;
- display: flex;
- align-items: center;
- }
- img {
- width: 48px;
- height: 48px;
- border-radius: 50%;
- object-fit: cover;
- }
- .icon {
- padding-right: 2px;
- }
- }
- }
- }
- .dialog-footer {
- position: relative;
- .close-btn {
- position: absolute;
- bottom: -58px;
- left: 0;
- right: 0;
- margin: 0 auto;
- text-align: center;
- }
- }
- .no-popup {
- width: 300px;
- border-radius: 14px;
- padding: 28px 15px 20px;
- box-sizing: border-box;
- .right-icon {
- text-align: center;
- padding-bottom: 12px;
- .right-img {
- width: 68px;
- }
- }
- .no-popup-title {
- font-size: 24px;
- font-weight: 500;
- text-align: center;
- .no-popup-title-sub {
- font-size: 14px;
- margin-top: 8px;
- }
- }
- .no-popup-btn {
- background-color: #2199f8;
- padding: 8px;
- border-radius: 20px;
- color: #fff;
- font-size: 16px;
- margin-top: 32px;
- text-align: center;
- }
- }
- </style>
- <style lang="scss">
- .album-detail-modal {
- .el-overlay-dialog {
- .el-dialog {
- padding: 0;
- border-radius: 12px;
- background: none;
- box-shadow: none;
- margin-bottom: 70px;
- margin-top: 10px;
- overflow: auto;
- scrollbar-width: none;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- pointer-events: none;
- .el-dialog__header {
- padding: 0;
- }
- .el-dialog__body {
- pointer-events: all;
- width: 100%;
- }
- }
- .one-btn {
- width: 210px;
- height: 40px;
- line-height: 40px;
- }
- }
- }
- </style>
|