detailDailog.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. <template>
  2. <el-dialog v-model="winDialogVisible" lock-scroll modal-class="album-detail-modal" :showClose="false" width="86%" align-center @close="closeDialog">
  3. <div class="detail-log">
  4. <div class="congratulation-wrap">
  5. <div class="congratulation-box">
  6. <div class="win-des">
  7. <!-- <img src="@/assets/img/weather_index/box-top.png" class="win-icon" /> -->
  8. </div>
  9. <div class="album-detail-box">
  10. <div class="detail-title">{{ dialogData.farmWorkName }}</div>
  11. <div class="detail-desc-box">
  12. <!-- <div class="desc-item" v-if="dialogData?.conditionList && dialogData.conditionList.length">
  13. <span class="item-name">{{ $t('触发条件') }}</span>
  14. {{ dialogData.condition || dialogData.conditionList[0].name + dialogData.conditionList[0].value }}
  15. </div> -->
  16. <div class="desc-item">
  17. <span class="item-name">{{ $t('农事编号') }}</span>
  18. {{ dialogData.code }}
  19. </div>
  20. <div class="desc-item">
  21. <span class="item-name">{{ $t('推荐时间') }}</span>
  22. {{ dialogData.executeDate }}
  23. </div>
  24. <!-- <div class="desc-item">
  25. <span class="item-name">{{ $t('农事宗旨') }}</span>
  26. {{ dialogData.purpose || dialogData.condition }}
  27. </div> -->
  28. <div class="desc-item">
  29. <div class="item-name">{{ $t('药物处方') }}</div>
  30. <div class="item-table">
  31. <el-table :data="pesticideFertilizers" style="width: 100%" :header-cell-style="{background: '#F5F5F5'}">
  32. <el-table-column prop="pesticideFertilizerCode" :label="$t('类型')" width="62">
  33. <template #default="scope">
  34. {{scope.row.typeName}}
  35. </template>
  36. </el-table-column>
  37. <el-table-column prop="defaultName" :label="$t('名称')" />
  38. <!-- <el-table-column prop="ratio" :label="$t('配比')" width="50">
  39. <template #default="scope">
  40. {{scope.row.ratio ? scope.row.ratio : "--"}}
  41. </template>
  42. </el-table-column> -->
  43. <el-table-column prop="ratio" :label="$t('方式')" width="62">
  44. <template #default="scope">
  45. {{scope.row.executeStyle ? (scope.row.executeStyle === 2 ? "无人机" : "人工") : "--"}}
  46. </template>
  47. </el-table-column>
  48. </el-table>
  49. </div>
  50. </div>
  51. <div class="card-link">
  52. <img :src="dialogData.expertIcon || dialogData.expertUserIcon" />
  53. <div class="expert-name">
  54. {{ dialogData.expertUserName || dialogData.expertName }}
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. <div class="close-btn" v-show="dialogData.isBtn" @click.stop="winDialogVisible=false">
  62. <!-- <el-icon size="32" color="#fff"><CircleCloseFilled /></el-icon> -->
  63. <el-button v-show="dialogData.typeStr === 'export'" type="primary" class="one-btn" @click.stop="toPage">{{ $t('邀请专家诊断') }}</el-button>
  64. <el-button v-show="dialogData.typeStr === 'activate'" type="primary" class="one-btn" @click.stop="handleAct">{{ $t('立即激活专家农事') }}</el-button>
  65. <!-- <el-button type="primary" class="one-btn" @click.stop="toShare">{{ $t('立即分享') }}</el-button> -->
  66. </div>
  67. </div>
  68. <template #footer>
  69. <div class="dialog-footer">
  70. <div class="close-btn">
  71. <!-- <el-icon size="32" color="#fff"><CircleCloseFilled /></el-icon> -->
  72. <!-- <el-button type="primary" class="one-btn" @click="toShare">{{ $t('立即分享') }}</el-button> -->
  73. </div>
  74. </div>
  75. </template>
  76. </el-dialog>
  77. </template>
  78. <script setup>
  79. import { onActivated, onDeactivated, onMounted, ref } from "vue";
  80. import eventBus from "@/api/eventBus";
  81. import wx from "weixin-js-sdk";
  82. import { useRoute, useRouter } from "vue-router";
  83. const props = defineProps({
  84. initReload: {
  85. type: Boolean,
  86. default: false
  87. }
  88. })
  89. const winDialogVisible = ref(false);
  90. const route = useRoute();
  91. const router = useRouter();
  92. const sampleId = route.query.sampleId
  93. const farmId = route.query.farmId;
  94. const dialogData = ref({});
  95. const currentCard = ref({});
  96. const showDialog = (pageParams) => {
  97. dialogData.value = pageParams.card;
  98. currentCard.value = {
  99. activeIndex: pageParams.activeIndex,
  100. farmWorkName: dialogData.value.farmWorkName,
  101. farmId: farmId,
  102. sampleId: sampleId,
  103. };
  104. settingData()
  105. winDialogVisible.value = true;
  106. };
  107. onMounted(() => {
  108. if (props.initReload) {
  109. eventBus.on("detailDialog:showDialog", showDialog);
  110. }
  111. })
  112. onActivated(()=>{
  113. eventBus.on("detailDialog:showDialog", showDialog);
  114. })
  115. onDeactivated(()=>{
  116. eventBus.off("detailDialog:showDialog", showDialog);
  117. })
  118. //邀请专家诊断
  119. const toPage = () =>{
  120. router.push('/prescription')
  121. }
  122. //立即激活
  123. const handleAct = () =>{
  124. winDialogVisible.value = false
  125. eventBus.emit("uploadUopup:show",{gardenIdVal:dialogData.value.farmId,orderIdVal:dialogData.value.orderId,textVal:dialogData.value.consequenceText});
  126. }
  127. // 弹窗关闭
  128. eventBus.on("detailDialog:toCloseDialog", closeDialog);
  129. const pesticideFertilizers = ref([])
  130. const settingData = () => {
  131. pesticideFertilizers.value = flattenDomains(dialogData.value.prescriptionList)
  132. };
  133. function flattenDomains(data) {
  134. return data.reduce((acc, item) => {
  135. return acc.concat(item.pesticideFertilizerList);
  136. }, []);
  137. }
  138. function closeDialog() {
  139. winDialogVisible.value = false
  140. eventBus.emit("detailDialog:closeDialog")
  141. }
  142. const toShare = () => {
  143. wx.miniProgram.navigateTo({
  144. url: `/pages/subPages/share_page/index?pageParams=${JSON.stringify(currentCard.value)}&type=album`,
  145. });
  146. }
  147. </script>
  148. <style lang="less" scoped>
  149. .congratulation-wrap {
  150. border-radius: 12px;
  151. background: #f4f5f4;
  152. width: 100%;
  153. }
  154. .detail-log {
  155. width: 100%;
  156. }
  157. .close-btn {
  158. text-align: center;
  159. margin-top: 20px;
  160. }
  161. .congratulation-box {
  162. border-radius: 12px;
  163. background: url("@/assets/img/weather_index/box-top.png") no-repeat top center /contain;
  164. .el-message-box__message {
  165. padding: 12px 0 24px 0;
  166. }
  167. .win-title {
  168. color: #1d1e1f;
  169. font-family: "PangMenZhengDao", sans-serif; /* 使用自定义字体 */
  170. text-align: center;
  171. font-size: 24px;
  172. line-height: 32px;
  173. }
  174. .win-detail {
  175. text-align: center;
  176. color: #252525;
  177. padding-top: 6px;
  178. font-size: 16px;
  179. span {
  180. font-size: 22px;
  181. color: #2199f8;
  182. padding: 0 6px;
  183. font-weight: bold;
  184. }
  185. }
  186. .win-des {
  187. height: 180px;
  188. text-align: center;
  189. }
  190. .win-icon {
  191. width: 100%;
  192. border-radius: 12px 12px 0 0;
  193. }
  194. }
  195. .album-detail-box {
  196. padding: 0 10px 16px 10px;
  197. color: #000;
  198. position: relative;
  199. // top: -58px;
  200. .detail-title {
  201. font-size: 24px;
  202. font-weight: bold;
  203. padding-bottom: 8px;
  204. letter-spacing: 1.6px;
  205. }
  206. .detail-desc-box {
  207. position: relative;
  208. .desc-item {
  209. font-size: 14px;
  210. .item-name {
  211. color: #999999;
  212. margin-right: 12px;
  213. }
  214. .item-table {
  215. margin-top: 8px;
  216. border: 1px solid rgba(255, 255, 255, 0.6);
  217. border-radius: 4px;
  218. ::v-deep {
  219. .el-table th.el-table__cell {
  220. padding: 6px 0;
  221. }
  222. .el-table--default .el-table__cell {
  223. padding: 6px 0;
  224. }
  225. .el-table--default .cell {
  226. padding: 0px 6px;
  227. }
  228. }
  229. }
  230. }
  231. .desc-item + .desc-item {
  232. padding-top: 8px;
  233. }
  234. .card-link {
  235. display: flex;
  236. flex-direction: column;
  237. align-items: center;
  238. justify-content: center;
  239. color: #2199f8;
  240. font-size: 12px;
  241. position: absolute;
  242. right: 6px;
  243. top: 0px;
  244. .expert-name {
  245. background: #d3e8ff;
  246. border-radius: 4px;
  247. padding: 1px 12px;
  248. margin-top: 4px;
  249. display: flex;
  250. align-items: center;
  251. }
  252. img {
  253. width: 62px;
  254. height: 62px;
  255. border-radius: 50%;
  256. object-fit: cover;
  257. }
  258. .icon {
  259. padding-right: 2px;
  260. }
  261. }
  262. }
  263. }
  264. .dialog-footer {
  265. position: relative;
  266. .close-btn {
  267. position: absolute;
  268. bottom: -58px;
  269. left: 0;
  270. right: 0;
  271. margin: 0 auto;
  272. text-align: center;
  273. }
  274. }
  275. </style>
  276. <style lang="less">
  277. .album-detail-modal {
  278. .el-overlay-dialog {
  279. .el-dialog {
  280. padding: 0;
  281. border-radius: 12px;
  282. background: none;
  283. box-shadow: none;
  284. margin-bottom: 70px;
  285. margin-top: 10px;
  286. overflow: auto;
  287. scrollbar-width: none;
  288. display: flex;
  289. flex-direction: column;
  290. align-items: center;
  291. justify-content: center;
  292. pointer-events: none;
  293. .el-dialog__header {
  294. padding: 0;
  295. }
  296. .el-dialog__body {
  297. pointer-events: all;
  298. width: 100%;
  299. }
  300. }
  301. .one-btn {
  302. width: 210px;
  303. height: 40px;
  304. line-height: 40px;
  305. }
  306. }
  307. }
  308. </style>