index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  1. <template>
  2. <view :class="[AppTheme]" class="all_box">
  3. <view class="content_box">
  4. <view class="content_detail_1">
  5. <view class="detail_title_1">
  6. <view class="detail_title_p1">
  7. <image class="image" :src="soil.soil_cover_pic" mode=""></image>
  8. </view>
  9. <view class="detail_title_p2">
  10. <view class="detail_title_p3">{{soil.soil_name}}</view>
  11. <view class="detail_title_p4">
  12. 地块—{{soil.name}} ,面积 {{soil.area}} m²
  13. </view>
  14. </view>
  15. </view>
  16. <view class="detail_text_p1">
  17. <view class="detail_text_p2">巡检日期:{{soil.ntime}}</view>
  18. <view class="detail_text_p2">巡检土地:{{soil.soil_name}}</view>
  19. <view class="detail_text_p2">巡检地块:{{soil.name}}</view>
  20. <view class="detail_text_p2">巡检作物:{{soil.seed_name}}</view>
  21. <view class="detail_text_p2">巡检面积:{{soil.seed_num}} m²</view>
  22. <view class="detail_text_p2">巡检内容:{{soil.ipqc_name}}</view>
  23. </view>
  24. </view>
  25. <view class="farm_name_4" @click="pkxunzhe">
  26. <view class="farm_name_5">
  27. 成熟度
  28. </view>
  29. <view class="farm_name_6">
  30. {{seedname}}
  31. <u-icon name="arrow-right" :bold="true" color="#999" size="18" ></u-icon>
  32. </view>
  33. </view>
  34. <view class="content_detail">
  35. <!-- <view class="detail_title">备注说明</view> -->
  36. <view class="detail_text">
  37. <textarea v-model="form.describe" class="detail_ipt" type="text" placeholder="请输入巡检备注" />
  38. </view>
  39. <view class="content_detail_img">
  40. <view v-if="detailimg.length!=0" class="detail_img" v-for="(item,index) in detailimg" :key="index"
  41. @click="preview(item,index)">
  42. <image class="image" :src="item" mode=""></image>
  43. <u-icon @click="deleteimg(index)" class="delete_img" name="close-circle" color="#fff" size="20">
  44. </u-icon>
  45. </view>
  46. <view class="detail_img" @click="uploadlogo(2)">
  47. <u-icon class="icon_plus" name="plus" size="50"></u-icon>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="submit bg-linear-gradient" @click="submit">记录</view>
  52. </view>
  53. <u-picker :show="show" :columns="columns" @cancel='cancel' @confirm='confirm' keyName="label"></u-picker>
  54. <u-modal :show="show1" :title="title" :content='content' @confirm='confirmmodel'></u-modal>
  55. </view>
  56. </template>
  57. <script>
  58. import mineApi from "@/api/mine/index.js"
  59. import {
  60. pathToBase64
  61. } from "@/js/pathto64.js"
  62. export default {
  63. data() {
  64. return {
  65. primary: this.$theme.primary,
  66. settingFile: getApp().globalData.siteinfo,
  67. soil: '',
  68. detailimg: [], //农场描述附加图
  69. //表单数据
  70. form: {
  71. describe: "", //农场描述
  72. detailimg: [] //农场描述附加图
  73. },
  74. columns: [
  75. [{
  76. label: '幼苗期',
  77. id: 6
  78. }, {
  79. label: '生长期',
  80. id: 7
  81. }, {
  82. label: '成熟期',
  83. id: 3
  84. }, {
  85. label: '枯萎',
  86. id: 8
  87. }]
  88. ],
  89. show: false,
  90. seed_status: '',
  91. show1: false,
  92. title: '提示',
  93. content: '暂无作物信息,无需记录',
  94. seedname:''
  95. }
  96. },
  97. onLoad(options) {
  98. console.log(JSON.parse(options.item), 'jsadfjkd')
  99. this.soil = JSON.parse(options.item)
  100. console.log(this.soil, 'this.soil')
  101. this.seedname=this.soil.seed_status
  102. if(this.soil.seed_status==''){
  103. this.show1=true
  104. }
  105. },
  106. methods: {
  107. confirmmodel(){
  108. this.show1=false
  109. uni.navigateTo({
  110. url:'/pagesD/pages/inspection/inspection'
  111. })
  112. },
  113. confirm(e) {
  114. console.log(e, 'eeeeeee')
  115. this.show = false
  116. this.seed_status = e.value[0].id
  117. this.seedname=e.value[0].label
  118. // console.log(orderid, 'orderidorderid')
  119. // this.lookorderbyid(orderid)
  120. },
  121. cancel() {
  122. this.show = false
  123. },
  124. pkxunzhe() {
  125. this.show = true
  126. },
  127. preview(url, idx) { //预览图片
  128. uni.previewImage({
  129. current: idx,
  130. urls: this.detailimg,
  131. success: function(res) {
  132. console.log(res, '预览')
  133. },
  134. fail: function(res) {
  135. console.log(res, '00000')
  136. }
  137. })
  138. },
  139. deleteimg(idx) { //图片删除
  140. this.detailimg.splice(idx, 1)
  141. this.form.detailimg.splice(idx, 1)
  142. },
  143. //提交资料
  144. submit() {
  145. let data = {
  146. id: this.soil.id,
  147. farm_detail: this.form.describe,
  148. seed_status: this.seed_status,
  149. detail_img: this.form.detailimg,
  150. seedid: this.soil.seedid,
  151. }
  152. mineApi.goinspection(data)
  153. .then(res => {
  154. if (res.status === 1) {
  155. uni.showToast({
  156. title: res.msg,
  157. icon: "none"
  158. })
  159. setTimeout(() => {
  160. uni.redirectTo({
  161. url: '/pagesD/pages/inspection/inspection'
  162. })
  163. }, 1000)
  164. } else {
  165. uni.showToast({
  166. title: res.msg,
  167. icon: "none"
  168. })
  169. }
  170. })
  171. .catch(error => {
  172. console.log(error, 'error')
  173. })
  174. },
  175. //上传Logo和农场描述附加图
  176. uploadlogo(num) {
  177. let that = this
  178. // #ifdef MP
  179. uni.chooseImage({
  180. count: 9,
  181. success: function(res) {
  182. res.tempFilePaths.forEach(ele => {
  183. that.detailimg.push(ele)
  184. uni.getFileSystemManager().readFile({
  185. filePath: ele,
  186. encoding: 'base64',
  187. success: function(ress) {
  188. //返回不带data:image/jpeg;base64,'头的base64格式
  189. let imageurl = 'data:image/jpeg;base64,' + ress
  190. .data;
  191. that.form.detailimg.push(imageurl)
  192. }
  193. })
  194. })
  195. }
  196. })
  197. // #endif
  198. // #ifdef APP||H5
  199. uni.chooseImage({
  200. count: 9,
  201. success: function(res) {
  202. res.tempFilePaths.forEach(ele => {
  203. that.detailimg.push(ele)
  204. pathToBase64(res.tempFilePaths[0]).then(base64 => {
  205. console.log(base64, "base64")
  206. that.form.detailimg.push(base64)
  207. })
  208. })
  209. },
  210. fail: function(res) {
  211. }
  212. })
  213. // #endif
  214. },
  215. }
  216. }
  217. </script>
  218. <style lang="scss" scoped>
  219. .all_box {
  220. // background-color: #ffffff;
  221. .step_bar {
  222. padding: 50rpx;
  223. padding-bottom: 80rpx;
  224. color: #fff;
  225. }
  226. .reason {
  227. background-color: #f97c00;
  228. color: #fff;
  229. line-height: 50rpx;
  230. padding: 0 20rpx;
  231. .reason_text {
  232. overflow: hidden;
  233. text-overflow: ellipsis;
  234. white-space: nowrap;
  235. }
  236. }
  237. .content_box {
  238. padding-bottom: 20rpx;
  239. .farm_name_4 {
  240. width: 90%;
  241. margin-left: 2.5%;
  242. display: flex;
  243. justify-content: space-between;
  244. align-items: center;
  245. padding: 20rpx 20rpx;
  246. background: #fff;
  247. border-radius: 10upx;
  248. margin-top: 20rpx;
  249. .farm_name_5 {
  250. display: flex;
  251. justify-content: flex-start;
  252. align-items: center;
  253. image {
  254. width: 45rpx;
  255. height: 45rpx;
  256. }
  257. font-size: 32rpx;
  258. }
  259. .farm_name_6 {
  260. display: flex;
  261. justify-content: flex-start;
  262. align-items: center;
  263. color: #999;
  264. font-size: 26rpx;
  265. margin-right: 2vh;
  266. }
  267. }
  268. .content_detail_1 {
  269. width: 90%;
  270. margin-left: 2.5%;
  271. margin-top: 20rpx;
  272. border-radius: 10upx;
  273. background-color: #ffffff;
  274. padding: 20rpx;
  275. .detail_text_p1 {
  276. padding: 30rpx 0 0 0;
  277. // color: #999;
  278. .detail_text_p2 {
  279. padding: 20rpx 0;
  280. }
  281. }
  282. .detail_title_1 {
  283. display: flex;
  284. justify-content: flex-start;
  285. align-items: center;
  286. .detail_title_p1 {
  287. .image {
  288. border-radius: 10rpx;
  289. width: 150rpx;
  290. height: 150rpx;
  291. }
  292. }
  293. .detail_title_p2 {
  294. margin-left: 2vh;
  295. // color: #999;
  296. .detail_title_p3 {
  297. padding: 30rpx 0;
  298. }
  299. .detail_title_p4 {
  300. -webkit-line-clamp: 2;
  301. display: -webkit-box;
  302. -webkit-box-orient: vertical;
  303. overflow: hidden;
  304. text-overflow: ellipsis;
  305. }
  306. }
  307. }
  308. }
  309. // margin: 20rpx;
  310. .content_detail {
  311. margin: 15rpx;
  312. background: #fff;
  313. border-radius: 10upx;
  314. .detail_title {
  315. font-weight: 700;
  316. font-size: 30rpx;
  317. color: #999;
  318. // margin: 15rpx;
  319. }
  320. .detail_text {
  321. // font-size: 25rpx;
  322. margin-top: 20rpx;
  323. display: flex;
  324. .input {
  325. width: 100%;
  326. padding-left: 10rpx;
  327. height: 80rpx;
  328. border-radius: 5rpx;
  329. overflow: hidden;
  330. text-overflow: ellipsis;
  331. white-space: nowrap;
  332. border: 1rpx solid #eae8e9;
  333. }
  334. .detail_ipt {
  335. border: 1rpx solid #eae8e9;
  336. padding: 15rpx;
  337. width: 100%;
  338. .text {
  339. margin-bottom: 20rpx;
  340. }
  341. .detail_logo {
  342. margin-top: 20rpx;
  343. .img {
  344. width: 120rpx;
  345. height: 120rpx;
  346. }
  347. }
  348. .choose_img {
  349. margin-top: 20rpx;
  350. width: 120rpx;
  351. height: 120rpx;
  352. text-align: center;
  353. overflow: hidden;
  354. border: 1rpx solid #eae8e9;
  355. .icon_plus {
  356. margin: 15rpx;
  357. }
  358. }
  359. }
  360. .detail_ipt1 {
  361. border: 1rpx solid #eae8e9;
  362. padding: 15rpx;
  363. height: 70rpx;
  364. }
  365. .icon {
  366. position: absolute;
  367. top: 10rpx;
  368. right: 20rpx;
  369. z-index: 10;
  370. }
  371. }
  372. .detail_text_address {
  373. width: 100%;
  374. margin-top: 20rpx;
  375. height: 80rpx;
  376. border-radius: 5rpx;
  377. border: 1rpx solid #eae8e9;
  378. display: flex;
  379. align-items: center;
  380. justify-content: flex-start;
  381. .input {
  382. padding-left: 10rpx;
  383. width: 92%;
  384. overflow: hidden;
  385. text-overflow: ellipsis;
  386. white-space: nowrap;
  387. }
  388. .icon {}
  389. }
  390. .content_detail_img {
  391. display: flex;
  392. justify-content: space-between;
  393. align-items: center;
  394. flex-wrap: wrap;
  395. .detail_img {
  396. position: relative;
  397. margin-top: 10rpx;
  398. width: 200rpx;
  399. height: 200rpx;
  400. display: flex;
  401. justify-content: center;
  402. align-items: center;
  403. border: 1rpx solid #eae8e9;
  404. // margin-right: 20rpx;
  405. .image {
  406. width: 200rpx;
  407. height: 200rpx;
  408. }
  409. .delete_img {
  410. position: absolute;
  411. top: 5rpx;
  412. right: 5rpx;
  413. }
  414. }
  415. }
  416. }
  417. .agree_terms {
  418. display: flex;
  419. justify-content: center;
  420. align-items: center;
  421. .agree_dot {
  422. margin-right: 10rpx;
  423. }
  424. text {
  425. color: #2375f4;
  426. }
  427. }
  428. .submit {
  429. font-size: 30rpx;
  430. color: #ffffff;
  431. padding: 25rpx 0;
  432. border-radius: 35rpx;
  433. text-align: center;
  434. width: 90%;
  435. margin: 20rpx auto;
  436. margin-bottom: 40rpx;
  437. }
  438. }
  439. .under_review {
  440. margin-top: 100rpx;
  441. text-align: center;
  442. image {
  443. width: 150rpx;
  444. height: 150rpx;
  445. }
  446. .text {
  447. margin-top: 20rpx;
  448. }
  449. }
  450. }
  451. </style>