detailDialog.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. <template>
  2. <el-dialog
  3. v-model="winDialogVisible"
  4. lock-scroll
  5. modal-class="album-detail-modal"
  6. :showClose="false"
  7. width="86%"
  8. align-center
  9. @close="closeDialog"
  10. >
  11. <div class="detail-log">
  12. <div class="congratulation-wrap">
  13. <div class="congratulation-box">
  14. <div class="win-des">
  15. <!-- <img src="@/assets/img/weather_index/box-top.png" class="win-icon" /> -->
  16. </div>
  17. <div class="album-detail-box">
  18. <div class="detail-title">{{ dialogData.name }}</div>
  19. <div class="detail-desc-box">
  20. <!-- <div class="desc-item van-ellipsis" v-if="dialogData?.conditionList && dialogData.conditionList.length">
  21. <span class="item-name">触发条件</span>
  22. {{
  23. dialogData.condition ||
  24. dialogData.conditionList[0].name + dialogData.conditionList[0].value
  25. }}
  26. </div> -->
  27. <div class="desc-item van-ellipsis">
  28. <span class="item-name">农事编号</span>
  29. {{ dialogData.code }}
  30. </div>
  31. <div class="desc-item">
  32. <span class="item-name">推荐时间</span>
  33. {{ dialogData.executeDate }}
  34. </div>
  35. <div class="desc-item">
  36. <div class="item-name">药物处方
  37. <span class="no-prescription" v-if="!hasPrescription">暂无处方</span>
  38. </div>
  39. <div class="item-table" v-if="hasPrescription">
  40. <div class="table">
  41. <div class="th">
  42. <div class="td">类型</div>
  43. <div class="td width">名称</div>
  44. <div class="td">配比</div>
  45. <div class="td">方式</div>
  46. </div>
  47. <div
  48. class="tr"
  49. v-for="(subP, subI) in dialogData.prescription?.pesticideFertilizerList"
  50. :key="subI"
  51. >
  52. <div class="td">{{ subP.typeName }}</div>
  53. <div class="td width">{{ subP.name }}</div>
  54. <div class="td">{{ subP.ratio }}</div>
  55. <div class="td">人工</div>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. <div class="card-link">
  61. <img :src="dialogData.expertIcon || dialogData.expertUserIcon" />
  62. <div class="expert-name">
  63. {{ dialogData.expertUserName || dialogData.expertName }}
  64. </div>
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. <div class="bottom-btn" v-if="showBtn">
  71. <div class="btn-item secondary-btn" @click="toPage">{{ btnText }}</div>
  72. <div class="btn-item primary-btn" @click="triggerClick">{{ curRole == 0 ? "触发农事" : "下发农事" }}</div>
  73. </div>
  74. </div>
  75. <template #footer>
  76. <div class="dialog-footer">
  77. <div class="close-btn">
  78. <!-- <el-icon size="32" color="#fff"><CircleCloseFilled /></el-icon> -->
  79. <!-- <el-button type="primary" class="one-btn" @click="toShare"> 立即分享 </el-button> -->
  80. </div>
  81. </div>
  82. </template>
  83. </el-dialog>
  84. <Popup v-model:show="noShow" class="no-popup">
  85. <div class="right-icon">
  86. <img class="right-img" src="@/assets/img/home/right.png" alt="" />
  87. </div>
  88. <div class="no-popup-title">
  89. <span>{{ curRole == 0 ? "好的,感谢您的配合" : "农事下发成功" }}</span>
  90. <div class="no-popup-title-sub" v-if="curRole == 0">请您耐心等待 农事确认</div>
  91. </div>
  92. <div class="no-popup-btn" @click="handleNoPopupBtn">{{ curRole == 0 ? "我知道了" : "我知道了" }}</div>
  93. </Popup>
  94. </template>
  95. <script setup>
  96. import { ref, computed } from "vue";
  97. import eventBus from "@/api/eventBus";
  98. import { Popup } from "vant";
  99. import { useRoute, useRouter } from "vue-router";
  100. import { ElMessage } from "element-plus";
  101. const props = defineProps({
  102. showSuccessOnly: {
  103. type: Boolean,
  104. default: false,
  105. },
  106. });
  107. const curRole = localStorage.getItem("SET_USER_CUR_ROLE");
  108. const winDialogVisible = ref(false);
  109. const noShow = ref(false);
  110. const btnText = ref('');
  111. const route = useRoute();
  112. const router = useRouter();
  113. const triggerClick = () => {
  114. winDialogVisible.value = false;
  115. // 如果只显示成功弹窗(来自 album_recognize 页面)
  116. if (props.showSuccessOnly) {
  117. noShow.value = true;
  118. }
  119. emit("triggerFarmWork");
  120. };
  121. const emit = defineEmits(["triggerFarmWork", "noPopupBtn"]);
  122. const dialogData = ref({})
  123. const showBtn = ref(true);
  124. const showDialog = (id,btnTextVal = '转发', showBtnVal = true) => {
  125. btnText.value = btnTextVal;
  126. showBtn.value = showBtnVal;
  127. if (id) {
  128. VE_API.farm
  129. .getFarmWorkLib({ id })
  130. .then(({ code, data }) => {
  131. if (code === 0 && data) {
  132. // 将接口返回的数据更新到 dialogData
  133. dialogData.value = data || {};
  134. settingData();
  135. }
  136. })
  137. .catch((error) => {
  138. console.error("获取农事详情失败:", error);
  139. });
  140. }
  141. winDialogVisible.value = true;
  142. };
  143. defineExpose({ showDialog });
  144. //立即激活
  145. const handleAct = () => {
  146. winDialogVisible.value = false;
  147. eventBus.emit("uploadUopup:show", {
  148. gardenIdVal: dialogData.value.farmId,
  149. orderIdVal: dialogData.value.orderId,
  150. textVal: dialogData.value.consequenceText,
  151. });
  152. };
  153. const pesticideFertilizers = ref([]);
  154. // 判断是否有处方数据
  155. const hasPrescription = computed(() => {
  156. const pesticideFertilizerList = dialogData.value.prescription?.pesticideFertilizerList;
  157. return pesticideFertilizerList && Array.isArray(pesticideFertilizerList) && pesticideFertilizerList.length > 0;
  158. });
  159. const settingData = () => {
  160. const pesticideFertilizerList = dialogData.value.prescription?.pesticideFertilizerList;
  161. pesticideFertilizers.value = pesticideFertilizerList || [];
  162. };
  163. function closeDialog() {
  164. winDialogVisible.value = false;
  165. }
  166. function toPage() {
  167. if(btnText.value!='转发'){
  168. router.push("/expert_list");
  169. }
  170. ElMessage.warning("该功能正在升级中,敬请期待");
  171. }
  172. const handleNoPopupBtn = () => {
  173. noShow.value = false;
  174. // if(curRole == 0){
  175. // noShow.value = false;
  176. // }else{
  177. // noShow.value = false;
  178. // emit("noPopupBtn");
  179. // }
  180. };
  181. </script>
  182. <style lang="scss" scoped>
  183. .congratulation-wrap {
  184. border-radius: 12px;
  185. background: #f4f5f4;
  186. width: 100%;
  187. }
  188. .detail-log {
  189. width: 100%;
  190. }
  191. .close-btn {
  192. text-align: center;
  193. margin-top: 20px;
  194. }
  195. .bottom-btn {
  196. position: absolute;
  197. width: 100%;
  198. text-align: center;
  199. margin-top: 20px;
  200. display: flex;
  201. .btn-item {
  202. flex: 1;
  203. text-align: center;
  204. height: 38px;
  205. line-height: 38px;
  206. border-radius: 30px;
  207. font-size: 14px;
  208. &.secondary-btn {
  209. background: #ffffff;
  210. color: #000000;
  211. }
  212. &.primary-btn {
  213. background: linear-gradient(180deg, #76c3ff, #2199f8);
  214. color: #ffffff;
  215. }
  216. }
  217. .btn-item + .btn-item {
  218. margin-left: 12px;
  219. }
  220. }
  221. .congratulation-box {
  222. border-radius: 12px;
  223. background: url("@/assets/img/home/sd-bg.png") no-repeat top center / contain;
  224. // background: url("@/assets/img/home/box-top.png") no-repeat top center / contain;
  225. .el-message-box__message {
  226. padding: 12px 0 24px 0;
  227. }
  228. .win-title {
  229. color: #1d1e1f;
  230. font-family: "PangMenZhengDao", sans-serif; /* 使用自定义字体 */
  231. text-align: center;
  232. font-size: 24px;
  233. line-height: 32px;
  234. }
  235. .win-detail {
  236. text-align: center;
  237. color: #252525;
  238. padding-top: 6px;
  239. font-size: 16px;
  240. span {
  241. font-size: 22px;
  242. color: #2199f8;
  243. padding: 0 6px;
  244. font-weight: bold;
  245. }
  246. }
  247. .win-des {
  248. height: 180px;
  249. text-align: center;
  250. }
  251. .win-icon {
  252. width: 100%;
  253. border-radius: 12px 12px 0 0;
  254. }
  255. }
  256. .album-detail-box {
  257. padding: 0 10px 16px 10px;
  258. color: #000;
  259. position: relative;
  260. // top: -58px;
  261. .detail-title {
  262. font-size: 24px;
  263. font-weight: bold;
  264. padding-bottom: 8px;
  265. letter-spacing: 1.6px;
  266. }
  267. .detail-desc-box {
  268. position: relative;
  269. .desc-item {
  270. font-size: 14px;
  271. &.van-ellipsis{
  272. max-width: calc(100% - 86px);
  273. }
  274. .item-name {
  275. color: #999999;
  276. margin-right: 12px;
  277. }
  278. .no-prescription {
  279. margin-left: 12px;
  280. color: #000;
  281. }
  282. .item-table {
  283. margin-top: 8px;
  284. .table {
  285. border: 1px solid rgba(196, 196, 196, 0.8);
  286. border-radius: 4px;
  287. font-size: 13px;
  288. .th {
  289. background: #f5f5f5;
  290. color: #999999;
  291. display: flex;
  292. justify-content: space-between;
  293. border-radius: 4px 4px 0 0;
  294. padding: 4px 0;
  295. }
  296. .tr {
  297. display: flex;
  298. justify-content: space-between;
  299. align-items: center;
  300. color: #333333;
  301. padding: 6px 0;
  302. }
  303. .tr + .tr {
  304. border-top: 1px solid rgba(0, 0, 0, 0.08);
  305. }
  306. .td {
  307. width: 25%;
  308. padding: 0 2px;
  309. text-align: center;
  310. }
  311. .width {
  312. width: 55%;
  313. }
  314. }
  315. }
  316. }
  317. .desc-item + .desc-item {
  318. padding-top: 4px;
  319. }
  320. .card-link {
  321. display: flex;
  322. flex-direction: column;
  323. align-items: center;
  324. justify-content: center;
  325. color: #2199f8;
  326. font-size: 12px;
  327. position: absolute;
  328. right: 6px;
  329. top: 0px;
  330. .expert-name {
  331. background: #d3e8ff;
  332. border-radius: 4px;
  333. padding: 1px 12px;
  334. margin-top: 4px;
  335. display: flex;
  336. align-items: center;
  337. }
  338. img {
  339. width: 48px;
  340. height: 48px;
  341. border-radius: 50%;
  342. object-fit: cover;
  343. }
  344. .icon {
  345. padding-right: 2px;
  346. }
  347. }
  348. }
  349. }
  350. .dialog-footer {
  351. position: relative;
  352. .close-btn {
  353. position: absolute;
  354. bottom: -58px;
  355. left: 0;
  356. right: 0;
  357. margin: 0 auto;
  358. text-align: center;
  359. }
  360. }
  361. .no-popup {
  362. width: 300px;
  363. border-radius: 14px;
  364. padding: 28px 15px 20px;
  365. box-sizing: border-box;
  366. .right-icon {
  367. text-align: center;
  368. padding-bottom: 12px;
  369. .right-img {
  370. width: 68px;
  371. }
  372. }
  373. .no-popup-title {
  374. font-size: 24px;
  375. font-weight: 500;
  376. text-align: center;
  377. .no-popup-title-sub {
  378. font-size: 14px;
  379. margin-top: 8px;
  380. }
  381. }
  382. .no-popup-btn {
  383. background-color: #2199f8;
  384. padding: 8px;
  385. border-radius: 20px;
  386. color: #fff;
  387. font-size: 16px;
  388. margin-top: 32px;
  389. text-align: center;
  390. }
  391. }
  392. </style>
  393. <style lang="scss">
  394. .album-detail-modal {
  395. .el-overlay-dialog {
  396. .el-dialog {
  397. padding: 0;
  398. border-radius: 12px;
  399. background: none;
  400. box-shadow: none;
  401. margin-bottom: 70px;
  402. margin-top: 10px;
  403. overflow: auto;
  404. scrollbar-width: none;
  405. display: flex;
  406. flex-direction: column;
  407. align-items: center;
  408. justify-content: center;
  409. pointer-events: none;
  410. .el-dialog__header {
  411. padding: 0;
  412. }
  413. .el-dialog__body {
  414. pointer-events: all;
  415. width: 100%;
  416. }
  417. }
  418. .one-btn {
  419. width: 210px;
  420. height: 40px;
  421. line-height: 40px;
  422. }
  423. }
  424. }
  425. </style>