treeDetail.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  1. <template>
  2. <div class="detail-page">
  3. <chart-box :name="t('treeDetail.title')" arrow="">
  4. <template v-slot:title-right>
  5. <div class="back" @click="backToHome">{{ t('treeDetail.back') }}</div>
  6. </template>
  7. <div class="detail-content">
  8. <div class="detail-main">
  9. <div class="bubble-box">
  10. <div class="bubble old">
  11. <span>{{ t('treeDetail.treeAgeValue') }}</span>
  12. <div>{{ t('treeDetail.treeAge') }}</div>
  13. </div>
  14. <div class="bubble pz">
  15. <span>{{ t('gardenIntroduce.cropType') }}</span>
  16. <div>{{ t('treeDetail.variety') }}</div>
  17. </div>
  18. <div class="bubble code">
  19. <span>A1158</span>
  20. <div>{{ t('treeDetail.uniqueCode') }}</div>
  21. </div>
  22. <div class="bubble cl big">
  23. <span>{{ t('treeDetail.highYieldValue') }}</span>
  24. <div>{{ t('treeDetail.highYield') }}</div>
  25. </div>
  26. <div class="bubble date big">
  27. <span>2025.06.08</span>
  28. <div>{{ t('treeDetail.marketDate') }}</div>
  29. </div>
  30. <div class="bubble zb big">
  31. <span>92{{ locale === 'zh' ? '分' : ' pts' }}</span>
  32. <div>{{ t('treeDetail.ecologyIndex') }}</div>
  33. </div>
  34. <div class="progress-wrap" v-show="ROLE == 2 && isProgress === 1">
  35. <div class="progress-text"><span class="over">150</span>/215</div>
  36. <el-progress class="progress-val" :percentage="60" color="#FFD887"></el-progress>
  37. </div>
  38. <div class="progress-wrap done-progress" v-show="ROLE == 2 && isProgress === 0">
  39. <div class="progress-text">{{ t('treeDetail.progressEnded') }}</div>
  40. </div>
  41. </div>
  42. <img class="tree" src="@/assets/images/foster-home/tree.png" alt="" />
  43. <div class="photo-box">
  44. <div class="photo-title">
  45. <span>{{ t('treeDetail.tracePhotos') }}</span>
  46. <span class="more" @click="handleMore">{{ t('treeDetail.more') }}</span>
  47. </div>
  48. <div class="photo-list">
  49. <div class="photo-item" v-for="(item, index) in photoList" :key="index">
  50. <photo-provider>
  51. <photo-consumer
  52. :src="require(`@/assets/images/foster-home/tree/photo-img-${index}.jpeg`)"
  53. >
  54. <img
  55. class="img"
  56. :src="require(`@/assets/images/foster-home/tree/photo-img-${index}.jpeg`)"
  57. alt=""
  58. />
  59. </photo-consumer>
  60. </photo-provider>
  61. <div class="date">{{ item.date }}</div>
  62. </div>
  63. </div>
  64. </div>
  65. </div>
  66. <div class="source-wrap">
  67. <div class="source-title">
  68. <sub-title :name="t('gardenIntroduce.farmRecord')">
  69. <template v-slot:title-right>
  70. <div class="title-right">
  71. {{ t('gardenIntroduce.more') }}
  72. <el-icon class="sub-icon"><ArrowRight /></el-icon>
  73. </div>
  74. </template>
  75. </sub-title>
  76. </div>
  77. <div class="tabs">
  78. <div
  79. class="tabs-item"
  80. :class="{ active: active === index }"
  81. v-for="(item, index) in tabsList"
  82. :key="index"
  83. @click="handleActive(index)"
  84. >
  85. {{ item }}
  86. </div>
  87. </div>
  88. <div class="list-item" v-for="(ele, idx) in displaySourceList" :key="idx">
  89. <div class="item-flex">
  90. <div class="photo">
  91. <img src="@/assets/images/foster-home/tree/source.png" alt="" />
  92. <div class="date">{{ ele.date }}</div>
  93. </div>
  94. <div class="item-text">
  95. <div class="item-title">{{ ele.name }}</div>
  96. <div class="name">
  97. {{ t('treeDetail.farmEffect') }}<span class="val">{{ ele.effect }}</span>
  98. </div>
  99. </div>
  100. </div>
  101. </div>
  102. </div>
  103. <div class="center-btn" @click="toCustomPage">{{ t('treeDetail.customBtn') }}</div>
  104. </div>
  105. </chart-box>
  106. </div>
  107. </template>
  108. <script setup>
  109. import { computed, ref } from "vue";
  110. import { useRouter } from "vue-router";
  111. import { useStore } from "vuex";
  112. import chartBox from "@/components/chartBox.vue";
  113. import subTitle from "@/components/subTitle.vue";
  114. import { useI18n } from "@/i18n";
  115. const { t, locale } = useI18n();
  116. const router = useRouter();
  117. const store = useStore();
  118. const ROLE = store.state.home.userRole;
  119. const isProgress = ref(1);
  120. const active = ref(0);
  121. const tabsList = computed(() => [
  122. t("treeDetail.tabs.all"),
  123. t("treeDetail.tabs.standard"),
  124. t("treeDetail.tabs.weather"),
  125. ]);
  126. const emit = defineEmits(["backHome"]);
  127. function translateRecord(record) {
  128. return {
  129. name: t(`treeDetail.records.${record.id}.name`),
  130. effect: t(`treeDetail.records.${record.id}.effect`),
  131. date: record.date,
  132. };
  133. }
  134. const MAIN_RECORDS = [
  135. { id: "fruitNutrition", date: "2025.04.04" },
  136. { id: "shakeFlower", date: "2025.03.28" },
  137. { id: "killSmallLeaf", date: "2025.02.09" },
  138. { id: "strongFlowerNutrition", date: "2025.02.03" },
  139. { id: "wakeNutrition", date: "2025.01.03" },
  140. { id: "shootKill", date: "2024.12.27" },
  141. { id: "clearGarden", date: "2024.12.15" },
  142. { id: "baseFertilizer", date: "2024.12.15" },
  143. { id: "shootControl", date: "2024.12.03" },
  144. { id: "shootPestControl", date: "2024.08.15" },
  145. { id: "shootNutrition", date: "2024.08.01" },
  146. ];
  147. const ALT_RECORDS = [
  148. { id: "shootRootFertilizer", date: "2024.07.14" },
  149. { id: "fruitRootFertilizer", date: "2024.05.07" },
  150. { id: "strongFlowerTopDress", date: "2024.03.07" },
  151. { id: "shootHeatDrought", date: "2024.10.26" },
  152. { id: "fruitRainShade", date: "2024.05.24" },
  153. { id: "flowerRain", date: "2024.04.01" },
  154. ];
  155. const currentRecords = ref([...MAIN_RECORDS]);
  156. const displaySourceList = computed(() => currentRecords.value.map(translateRecord));
  157. const handleActive = (index) => {
  158. active.value = index;
  159. handleItem(index);
  160. };
  161. function backToHome() {
  162. emit("backHome");
  163. }
  164. function toCustomPage() {
  165. router.push("/customTree");
  166. }
  167. const photoList = ref([
  168. { date: "2026.04.10" },
  169. { date: "2026.04.03" },
  170. { date: "2026.03.26" },
  171. { date: "2026.03.15" },
  172. { date: "2026.03.08" },
  173. ]);
  174. const handleItem = (index) => {
  175. if (index === 0) {
  176. currentRecords.value = [...ALT_RECORDS];
  177. } else if (index === 1) {
  178. currentRecords.value = ALT_RECORDS.slice(0, 3);
  179. } else if (index === 2) {
  180. currentRecords.value = ALT_RECORDS.slice(3);
  181. }
  182. };
  183. const handleMore = () => {
  184. // router.push("/photo");
  185. };
  186. </script>
  187. <style lang="scss" scoped>
  188. .detail-page {
  189. position: relative;
  190. width: 100%;
  191. height: 100%;
  192. .back {
  193. background: #4f4f4f;
  194. border-radius: 4px;
  195. padding: 6px 22px;
  196. font-size: 12px;
  197. cursor: pointer;
  198. }
  199. .center-btn {
  200. position: absolute;
  201. bottom: 64px;
  202. left: 50%;
  203. transform: translateX(-50%);
  204. color: #000000;
  205. border-radius: 20px;
  206. font-size: 14px;
  207. padding: 7px 10px;
  208. cursor: pointer;
  209. border: 1px solid #fff;
  210. background: linear-gradient(180deg, #ffd887, #ed9e1e);
  211. width: 194px;
  212. box-sizing: border-box;
  213. text-align: center;
  214. }
  215. .detail-content {
  216. height: 100%;
  217. overflow: auto;
  218. .detail-main {
  219. width: 100%;
  220. height: 466px;
  221. display: flex;
  222. flex-direction: column;
  223. align-items: center;
  224. justify-content: flex-end;
  225. .bubble-box {
  226. position: relative;
  227. width: 100%;
  228. .bubble {
  229. font-size: 10px;
  230. text-align: center;
  231. width: 60px;
  232. height: 60px;
  233. display: flex;
  234. flex-direction: column;
  235. justify-content: center;
  236. align-items: center;
  237. color: rgba(255, 255, 255, 0.55);
  238. background: url("@/assets/images/foster-home/tree/bubble-bg.png") no-repeat center center / 100%
  239. 100%;
  240. span {
  241. font-size: 14px;
  242. font-weight: 500;
  243. color: #fff;
  244. }
  245. &.big {
  246. width: 76px;
  247. height: 76px;
  248. }
  249. &.pz {
  250. position: absolute;
  251. bottom: -96px;
  252. left: 0;
  253. }
  254. &.old {
  255. position: absolute;
  256. right: 8px;
  257. bottom: -100px;
  258. }
  259. &.code {
  260. position: absolute;
  261. right: 84px;
  262. bottom: -12px;
  263. }
  264. &.cl {
  265. position: absolute;
  266. right: 4px;
  267. bottom: -38px;
  268. }
  269. &.date {
  270. position: absolute;
  271. left: 40px;
  272. bottom: -26px;
  273. span {
  274. font-size: 12px;
  275. }
  276. }
  277. &.zb {
  278. position: absolute;
  279. left: 128px;
  280. bottom: -4px;
  281. }
  282. }
  283. }
  284. .progress-wrap {
  285. position: absolute;
  286. top: 40px;
  287. left: 50%;
  288. transform: translateX(-50%);
  289. width: 110px;
  290. &.done-progress {
  291. top: 50px;
  292. .progress-text {
  293. color: #CFCFCF;
  294. }
  295. }
  296. .progress-text {
  297. font-size: 12px;
  298. color: #999999;
  299. background: rgba(0, 0, 0, 0.6);
  300. padding: 2px 8px 3px 8px;
  301. border-radius: 20px;
  302. width: max-content;
  303. margin: 0 auto;
  304. margin-bottom: 5px;
  305. .over {
  306. font-size: 14px;
  307. color: #ffd489;
  308. }
  309. }
  310. ::v-deep {
  311. .el-progress-bar__outer {
  312. width: 108px;
  313. background: rgba(0, 0, 0, 0.8);
  314. }
  315. .progress-val {
  316. .el-progress__text {
  317. display: none;
  318. }
  319. }
  320. }
  321. }
  322. .tree {
  323. width: 258px;
  324. height: 258px;
  325. }
  326. .photo-box {
  327. width: 100%;
  328. box-sizing: border-box;
  329. margin-top: 2px;
  330. margin-bottom: 22px;
  331. padding: 12px 8px;
  332. background: rgba(255, 255, 255, 0.08);
  333. border-radius: 12px;
  334. .photo-title {
  335. display: flex;
  336. justify-content: space-between;
  337. color: #ffffff;
  338. font-size: 12px;
  339. margin-bottom: 6px;
  340. .more {
  341. color: #bbbbbb;
  342. }
  343. }
  344. .photo-list {
  345. display: flex;
  346. .photo-item {
  347. position: relative;
  348. .img {
  349. width: 58px;
  350. height: 58px;
  351. border: 1px solid rgba(255, 255, 255, 0.6);
  352. border-radius: 10px;
  353. object-fit: cover;
  354. }
  355. .date {
  356. position: absolute;
  357. color: #dddddd;
  358. font-size: 10px;
  359. bottom: 1px;
  360. left: 1px;
  361. background: rgba(0, 0, 0, 0.6);
  362. width: calc(100% - 2px);
  363. padding: 2px 4px;
  364. box-sizing: border-box;
  365. border-radius: 0 0 10px 10px;
  366. }
  367. }
  368. .photo-item + .photo-item {
  369. margin-left: 8px;
  370. }
  371. }
  372. }
  373. }
  374. .source-wrap {
  375. background: rgba(255, 255, 255, 0.08);
  376. border-radius: 10px 10px 0 0;
  377. .source-title {
  378. padding: 10px 10px 0 10px;
  379. .title-right {
  380. background: rgba(255, 212, 137, 0.1);
  381. border-radius: 20px;
  382. font-size: 12px;
  383. color: #ffd489;
  384. padding: 2px 8px;
  385. display: flex;
  386. align-items: center;
  387. cursor: pointer;
  388. .sub-edit {
  389. width: 12px;
  390. padding-right: 4px;
  391. }
  392. .sub-icon {
  393. padding-left: 2px;
  394. }
  395. }
  396. }
  397. .tabs {
  398. background: transparent;
  399. border-radius: 10px 10px 0 0;
  400. display: flex;
  401. padding: 12px 11px 12px 11px;
  402. .tabs-item {
  403. padding: 6px;
  404. border-radius: 20px;
  405. color: #ffffff;
  406. flex: 1;
  407. text-align: center;
  408. cursor: pointer;
  409. background: rgba(255, 255, 255, 0.08);
  410. &.active {
  411. background: linear-gradient(180deg, #ffd887, #ed9e1e);
  412. color: #1d1d1d;
  413. }
  414. }
  415. .tabs-item + .tabs-item {
  416. margin-left: 8px;
  417. }
  418. }
  419. .item-flex {
  420. background: rgba(255, 255, 255, 0.04);
  421. padding: 12px;
  422. border-radius: 5px;
  423. .item-title {
  424. font-size: 16px;
  425. color: #ffffff;
  426. }
  427. }
  428. .list-item {
  429. margin-top: 12px;
  430. }
  431. }
  432. .item-flex {
  433. display: flex;
  434. align-items: center;
  435. }
  436. .photo {
  437. width: 76px;
  438. height: 65px;
  439. margin-right: 12px;
  440. position: relative;
  441. img {
  442. width: 100%;
  443. height: 100%;
  444. object-fit: cover;
  445. border-radius: 8px;
  446. }
  447. .date {
  448. position: absolute;
  449. bottom: 0;
  450. color: #fff;
  451. font-size: 10px;
  452. padding: 2px 13px;
  453. background: rgba(0, 0, 0, 0.6);
  454. border-radius: 0 0 8px 8px;
  455. backdrop-filter: blur(2px);
  456. }
  457. }
  458. .item-text {
  459. color: #999999;
  460. font-size: 12px;
  461. line-height: 1.6;
  462. flex: 1;
  463. .name {
  464. color: #6c6c6c;
  465. font-size: 12px;
  466. .val {
  467. flex: 1;
  468. color: rgba(255, 255, 255, 0.8);
  469. }
  470. }
  471. .van-ellipsis {
  472. width: 200px;
  473. }
  474. .txt {
  475. span {
  476. color: #000;
  477. }
  478. }
  479. .time {
  480. display: flex;
  481. align-items: center;
  482. .icon {
  483. margin-right: 4px;
  484. }
  485. span {
  486. color: #f87321;
  487. }
  488. }
  489. }
  490. }
  491. }
  492. </style>