task.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  1. <template>
  2. <view class="total-page page-box task-bg">
  3. <Nav title="资产评估" :genre="1" :toBack="true" is_fixed></Nav>
  4. <view class="p-b40">
  5. <!-- 身份认证start -->
  6. <view class="m-t20 m-lr30 text-color-12">
  7. <view class="sys-background-fff r-20 p-lr30 p-t30">
  8. <en-select v-model="propertyData.modelType" :local-data="typeOption" label="评估模型"
  9. placeholder="请选择评估模型"></en-select>
  10. <en-input v-model="propertyData.address" label="评估地址" disabled="disabled" placeholder="请输入评估地址"
  11. @inputBut="inputBut"></en-input>
  12. <en-input v-model="propertyData.complexName" :label="'小区名称'" disabled="disabled"
  13. placeholder="请输入小区名称"> </en-input>
  14. <en-input :value="propertyData.lng+','+propertyData.lat" disabled="disabled" label="评估坐标"
  15. placeholder="地址经纬度"></en-input>
  16. <en-input v-model="propertyData.area" :label="'建筑面积'" placeholder="请输入建筑面积"> </en-input>
  17. <en-select v-model="propertyData.district" :local-data="districtOption" :label="'所属区域'"
  18. placeholder="请选择所属区域"> </en-select>
  19. </view>
  20. </view>
  21. <view class="m-t20 m-lr30 text-color-12">
  22. <view class="sys-background-fff r-20 m-t20 p-lr30" v-if="propertyData.modelType*1===1">
  23. <en-select v-model="propertyData.houseType" :local-data="houseTypeOption" label="房屋类型"
  24. placeholder="请选择房屋类型"></en-select>
  25. </view>
  26. </view>
  27. <view class="m-t20 m-lr30 text-color-12">
  28. <view class="sys-background-fff r-20 m-t20 p-lr30" v-if="propertyData.modelType*1===2">
  29. <EnRadio v-model="propertyData.is_rent" label="是否出租" :list="statusOption"> </EnRadio>
  30. <EnRadio v-model="propertyData.is_morgaged" label="是否抵押" :list="statusOption"> </EnRadio>
  31. <EnRadio v-model="propertyData.is_occupied" label="是否占用" :list="statusOption"> </EnRadio>
  32. <EnRadio v-model="propertyData.is_seizured" label="是否查封" :list="statusOption"> </EnRadio>
  33. </view>
  34. </view>
  35. <view class="m-t20 m-lr30 text-color-12">
  36. <view class="sys-background-fff r-20 m-t20 p-lr30" v-if="propertyData.modelType*1===3">
  37. <en-select v-model="propertyData.level_id" :local-data="levelOption" :label="'土地等级'"
  38. placeholder="请选择土地等级"> </en-select>
  39. <en-select v-model="propertyData.transfer_method" :local-data="transferMethodOption" :label="'出让方式'"
  40. placeholder="请选择出让方式"> </en-select>
  41. <en-select v-model="propertyData.land_use" :local-data="landUseOption" :label="'土地用途'"
  42. placeholder="请选择土地用途"> </en-select>
  43. <en-select v-model="propertyData.land_source" :local-data="landSourceOption" :label="'土地来源'"
  44. placeholder="请选择土地来源"> </en-select>
  45. <en-input v-model="propertyData.age_limit" :label="'出让年限'" placeholder="请输入出让年限"> </en-input>
  46. <en-input v-model="propertyData.investment" :label="'投资强度'" placeholder="请输入投资强度"> </en-input>
  47. <en-input v-model="propertyData.plot_mix" :label="'最小容积'" placeholder="请输入最小容积率"> </en-input>
  48. <en-input v-model="propertyData.plot_max" :label="'最大容积'" placeholder="请输入最大容积率"> </en-input>
  49. <en-input v-model="propertyData.greening_mix" :label="'最小绿化'" placeholder="请输入最小绿化面积"> </en-input>
  50. <en-input v-model="propertyData.greening_max" :label="'最大绿化'" placeholder="请输入最大绿化面积"> </en-input>
  51. <en-input v-model="propertyData.height_mix" :label="'最小高度'" placeholder="请输入最小建筑高度"> </en-input>
  52. <en-input v-model="propertyData.height_max" :label="'最大高度'" placeholder="请输入最大建筑高度"> </en-input>
  53. </view>
  54. </view>
  55. <view class="m-t20 m-lr30 text-color-12">
  56. <view class="sys-background-fff r-20 m-t20 p-lr30">
  57. <view class="align-items-center p-tb20">
  58. <view class="left-w">
  59. 支付方式
  60. </view>
  61. <view class="align-items-center" >
  62. <uni-icons class="mr-10" type="checkbox-filled" size="20" color='#0FB160'></uni-icons>
  63. <view class="size-26">
  64. 余额支付(¥:10.00)
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. <EnButton class="m-b50" :is_fixed="false" :text="'评估'" @onSubmit="onSubmit"></EnButton>
  72. <popupModuleVue ref="popupModuleRef"></popupModuleVue>
  73. </view>
  74. </template>
  75. <script>
  76. import EnUpload from "@/components/en-from/en-upload/en-upload.vue";
  77. import EnSelect from "@/components/en-from/en-select/en-select.vue";
  78. import EnRadio from "@/components/en-from/en-radio/en-radio.vue";
  79. import EnInput from "@/components/en-from/en-input/en-input.vue";
  80. import {
  81. getValuationOption,
  82. predictProperty
  83. } from "@/api/valuation.js"
  84. import tools from "@/service/tools";
  85. import popupModuleVue from "@/pages/index/module/popup-module.vue";
  86. export default {
  87. components: {
  88. popupModuleVue,
  89. EnInput,
  90. EnSelect,
  91. EnRadio,
  92. EnUpload,
  93. },
  94. data() {
  95. return {
  96. typeOption: [{
  97. value: 1,
  98. text: '住宅模型'
  99. }, {
  100. value: 2,
  101. text: '公建模型'
  102. }, {
  103. value: 3,
  104. text: '土地模型'
  105. }, {
  106. value: 4,
  107. text: '工业模型'
  108. }],
  109. statusOption: [{
  110. value: 1,
  111. text: '是'
  112. }, {
  113. value: 0,
  114. text: '否'
  115. }],
  116. houseTypeOption: [],
  117. levelOption: [],
  118. transferMethodOption: [],
  119. landUseOption: [],
  120. landSourceOption: [],
  121. districtOption: [{
  122. value: 1,
  123. text: '甘井子区'
  124. }, {
  125. value: 2,
  126. text: '中山区'
  127. }, {
  128. value: 3,
  129. text: '西岗区'
  130. }, {
  131. value: 4,
  132. text: '沙河口区'
  133. }, {
  134. value: 5,
  135. text: '旅顺口区'
  136. }, {
  137. value: 6,
  138. text: '金州区'
  139. }, {
  140. value: 7,
  141. text: '瓦房店市'
  142. }, {
  143. value: 8,
  144. text: '庄河市'
  145. }, {
  146. value: 9,
  147. text: '普兰店区'
  148. }],
  149. propertyData: {
  150. level_id: 1,
  151. transfer_method: 1,
  152. land_use: 1,
  153. land_source: 1,
  154. investment: 0,
  155. plot_mix: 0,
  156. plot_max: 0,
  157. height_mix: 0,
  158. height_max: 0,
  159. greening_mix: 0,
  160. greening_max: 0,
  161. age_limit: 0,
  162. floor_area: 0,
  163. lat: 0,
  164. lng: 0,
  165. is_sold: 0,
  166. is_rent: 0,
  167. is_morgaged: 0,
  168. is_occupied: 0,
  169. is_seizured: 0,
  170. address: '',
  171. modelType: '',
  172. area: '',
  173. district: '',
  174. houseType: '',
  175. complexName: '',
  176. },
  177. propertyRes: {
  178. unit_price: '',
  179. total_price: '',
  180. predict_msg: '',
  181. },
  182. location: {
  183. lat: 0,
  184. lng: 0,
  185. address: '',
  186. districtName: '',
  187. complexName: ''
  188. },
  189. };
  190. },
  191. onLoad(options) {},
  192. onShow() {},
  193. watch: {
  194. 'propertyData.modelType':function(){
  195. if(this.propertyData.modelType>0){
  196. this.getValuationOption()
  197. }
  198. }
  199. },
  200. mounted() {},
  201. methods: {
  202. async inputBut() {
  203. let that = this;
  204. try {
  205. // 选择位置
  206. uni.chooseLocation({
  207. latitude:38.913943,
  208. longitude:121.614794,
  209. success: function(res) {
  210. console.log(res)
  211. // 更新数据
  212. that.propertyData.lng = res.longitude;
  213. that.propertyData.lat = res.latitude;
  214. that.propertyData.address = res.address;
  215. that.propertyData.complexName = res.name || '';
  216. // 根据地址信息设置区域
  217. that.setDistrictByAddress(res.address);
  218. console.log('当前位置的经度:' + res.longitude);
  219. console.log('当前位置的纬度:' + res.latitude);
  220. },
  221. fail: async function(err) {
  222. console.log('获取位置失败:', err);
  223. // 如果是授权被拒绝
  224. if (err.errMsg.indexOf('auth deny') !== -1) {
  225. try {
  226. // 引导用户手动开启授权
  227. await showAuthorizeGuide();
  228. } catch (e) {
  229. console.log('授权引导失败:', e);
  230. }
  231. }
  232. }
  233. });
  234. } catch (err) {
  235. console.log('获取位置失败:', err);
  236. if (err.errMsg && (err.errMsg.includes('auth deny') || err.errMsg.includes('fail cancel'))) {
  237. uni.showToast({
  238. title: '需要位置权限才能选择地址',
  239. icon: 'none'
  240. });
  241. }
  242. }
  243. },
  244. // 检查位置权限
  245. checkLocationAuth() {
  246. return new Promise((resolve) => {
  247. uni.getSetting({
  248. success: (res) => {
  249. const authSetting = res.authSetting;
  250. resolve(authSetting['scope.userLocation'] || false);
  251. },
  252. fail: () => {
  253. resolve(false);
  254. }
  255. });
  256. });
  257. },
  258. // 选择位置
  259. // chooseLocation() {
  260. // return new Promise((resolve, reject) => {
  261. // uni.chooseLocation({
  262. // success: resolve,
  263. // fail: reject
  264. // });
  265. // });
  266. // },
  267. showAuthorizeGuide() {
  268. return new Promise((resolve, reject) => {
  269. uni.showModal({
  270. title: '位置权限未开启',
  271. content: '需要您授权位置信息才能提供此服务,请到设置中开启权限',
  272. confirmText: '去设置',
  273. success: (modalRes) => {
  274. if (modalRes.confirm) {
  275. // 打开小程序设置页面
  276. uni.openSetting({
  277. success: (openRes) => {
  278. if (openRes.authSetting['scope.userLocation']) {
  279. uni.showToast({
  280. title: '授权成功',
  281. icon: 'success'
  282. });
  283. resolve();
  284. } else {
  285. uni.showToast({
  286. title: '授权失败',
  287. icon: 'none'
  288. });
  289. reject();
  290. }
  291. }
  292. });
  293. } else {
  294. reject();
  295. }
  296. }
  297. });
  298. });
  299. },
  300. // 根据地址设置区域
  301. setDistrictByAddress(address) {
  302. if (!address) return;
  303. const districtText = this.extractDistrictFromAddress(address);
  304. if (districtText) {
  305. const district = this.districtOption.find(item =>
  306. districtText.includes(item.text) || item.text.includes(districtText)
  307. );
  308. if (district) {
  309. this.propertyData.district = district.value;
  310. }
  311. }
  312. },
  313. // 从地址中提取区域信息
  314. extractDistrictFromAddress(address) {
  315. if (!address) return '';
  316. // 简单的区域提取逻辑,可以根据实际需求调整
  317. for (let district of this.districtOption) {
  318. if (address.includes(district.text)) {
  319. return district.text;
  320. }
  321. }
  322. return '';
  323. },
  324. setLocation(res) {
  325. console.log("收到监听", res)
  326. this.propertyData.address = res.address
  327. this.propertyData.lat = res.lat
  328. this.propertyData.lng = res.lng
  329. this.propertyData.complexName = res.complexName
  330. this.setDistrictByAddress(res.address);
  331. // this.districtOption.forEach(item => {
  332. // if (res.districtName === item.text) {
  333. // this.propertyData.district = item.value
  334. // }
  335. // })
  336. },
  337. getValuationOption() {
  338. if (this.propertyData.houseType === "") {
  339. this.propertyData.houseType = 0
  340. }
  341. getValuationOption({
  342. "modelType": this.propertyData.modelType*1
  343. }).then(res => {
  344. if (res.code === 0) {
  345. if (this.propertyData.modelType*1 === 1) {
  346. // res.data.houseTypeOption.
  347. this.houseTypeOption = res.data.houseTypeOption.map(({ id,name }) => ({
  348. value: id,
  349. text: name
  350. }));
  351. console.log(this.houseTypeOption)
  352. } else if (this.propertyData.modelType*1 === 3) {
  353. this.levelOption = res.data.levelOption.map(({ id,name }) => ({
  354. value: id,
  355. text: name
  356. }));
  357. this.transferMethodOption = res.data.transferMethodOption.map(({ id,name }) => ({
  358. value: id,
  359. text: name
  360. }));
  361. this.landUseOption = res.data.landUseOption.map(({ id,name }) => ({
  362. value: id,
  363. text: name
  364. }));
  365. this.landSourceOption = res.data.landSourceOption.map(({ id,name }) => ({
  366. value: id,
  367. text: name
  368. }));
  369. this.propertyData.land_source = this.landSourceOption[0].value
  370. }
  371. }
  372. })
  373. },
  374. onSubmit() {
  375. console.log('提交评估数据', this.propertyData)
  376. predictProperty({
  377. level_id: this.propertyData.level_id*1,
  378. transfer_method: this.propertyData.transfer_method*1,
  379. land_use: this.propertyData.land_use*1,
  380. land_source: this.propertyData.land_source*1,
  381. investment: this.propertyData.investment*1,
  382. plot_mix: this.propertyData.plot_mix*1,
  383. plot_max: this.propertyData.plot_max*1,
  384. height_mix: this.propertyData.height_mix*1,
  385. height_max: this.propertyData.height_max*1,
  386. greening_mix: this.propertyData.greening_mix*1,
  387. greening_max: this.propertyData.greening_max*1,
  388. age_limit: this.propertyData.age_limit*1,
  389. floor_area: this.propertyData.floor_area*1,
  390. lat: this.propertyData.lat*1,
  391. lng: this.propertyData.lng*1,
  392. is_sold: this.propertyData.is_sold*1,
  393. is_rent: this.propertyData.is_rent*1,
  394. is_morgaged: this.propertyData.is_morgaged*1,
  395. is_occupied: this.propertyData.is_occupied*1,
  396. is_seizured: this.propertyData.is_seizured*1,
  397. address: this.propertyData.address,
  398. modelType: this.propertyData.modelType*1,
  399. area: this.propertyData.area*1,
  400. district: this.propertyData.district*1,
  401. houseType: this.propertyData.houseType*1,
  402. complexName:this.propertyData.complexName,
  403. }).then(res => {
  404. if (res.code === 0) {
  405. console.log(res, 'res');
  406. this.propertyRes = res.data
  407. this.propertyRes.total_price = (res.data.unit_price*this.propertyData.area).toFixed(2)
  408. this.$refs.popupModuleRef.openPop(6,this.propertyRes)
  409. } else {
  410. tools.error(res.msg)
  411. }
  412. })
  413. },
  414. setMapMarker(lng, lat, status) {
  415. if (this.marker === undefined) {
  416. this.marker = new AMap.Marker({
  417. position: new AMap.LngLat(lng, lat),
  418. offset: new AMap.Pixel(-10, -10),
  419. icon: "//vdata.amap.com/icons/b18/1/2.png", //添加 icon 图标 URL
  420. title: "标记位",
  421. });
  422. this.map.add(this.marker);
  423. } else {
  424. this.marker.setPosition(new AMap.LngLat(lng, lat));
  425. }
  426. if (status) {
  427. this.location.lat = lat
  428. this.location.lng = lng
  429. AMap.plugin("AMap.Geocoder", () => {
  430. let geocoder = new AMap.Geocoder({
  431. city: "大连市", // city 指定进行编码查询的城市,支持传入城市名、adcode 和 citycode
  432. extensions: "all"
  433. });
  434. let lnglat = [this.location.lng, this.location.lat];
  435. geocoder.getAddress(lnglat, (status, result) => {
  436. if (status === "complete" && result.info === "OK") {
  437. // result为对应的地理位置详细信息
  438. console.log(result.regeocode)
  439. if (result.regeocode.formattedAddress !== undefined && result.regeocode
  440. .formattedAddress !== "") {
  441. this.location.address = result.regeocode.formattedAddress;
  442. this.location.districtName = result.regeocode.addressComponent
  443. .district;
  444. if (result.regeocode.pois !== undefined && result.regeocode.pois
  445. .length > 0) {
  446. this.location.complexName = result.regeocode.pois[0].name
  447. }
  448. }
  449. }
  450. });
  451. });
  452. }
  453. },
  454. },
  455. }
  456. </script>
  457. <style lang="scss" scoped>
  458. .input-item:last-child {
  459. margin-top: 30rpx;
  460. }
  461. .input-send {
  462. display: flex;
  463. justify-content: flex-start;
  464. align-items: center;
  465. border-bottom: 1px solid #E5E5E5;
  466. .login-input {
  467. width: calc(100% - 150rpx);
  468. }
  469. .login-send {
  470. width: 100rpx;
  471. text-align: center;
  472. margin-left: 20rpx;
  473. border: 1rpx solid #0FB160;
  474. border-radius: 50rpx;
  475. }
  476. }
  477. .left-w {
  478. width: 210rpx;
  479. min-width: 210rpx;
  480. color: #333333;
  481. }
  482. .iconfont {
  483. font-size: 36rpx;
  484. color: #333333;
  485. }
  486. .class-c-6C6F93 {
  487. color: #0FB160;
  488. }
  489. .agreement-data {
  490. border-radius: 30rpx 30rpx 0 0;
  491. .data-title {
  492. width: 100%;
  493. border-radius: 30rpx 30rpx 0 0;
  494. }
  495. .data-content {
  496. padding: 20rpx 40rpx;
  497. .content-box {
  498. height: 600rpx;
  499. }
  500. }
  501. .data-but {
  502. height: 96rpx;
  503. line-height: 96rpx;
  504. text-align: center;
  505. margin: 0 75rpx;
  506. }
  507. }
  508. </style>