租房小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

582 lines
20 KiB

8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
8 months ago
7 months ago
8 months ago
  1. <template>
  2. <view class="se-p-40 se-bgc-white">
  3. <uv-form labelPosition="left" :model="form" :rules="rules" ref="form" labelWidth="60" labelStyle="font-size:26rpx;">
  4. <uv-form-item label="标题" prop="title" >
  5. <uv-input v-model="form.title" type="text" placeholder="请输入标题" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
  6. </uv-form-item>
  7. <uv-form-item label="价格" prop="price">
  8. <uv-input v-model="form.price" type="text" placeholder="请输入价格" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
  9. </uv-form-item>
  10. <uv-form-item label="户型" prop="house">
  11. <uv-input v-model="form.house" type="text" placeholder="请输入户型" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
  12. </uv-form-item>
  13. <uv-form-item label="面积" prop="proportion">
  14. <uv-input v-model="form.proportion" type="text" placeholder="请输入面积" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
  15. </uv-form-item>
  16. <uv-form-item label="所属位置" prop="address" @click="handleAreaChange()">
  17. <uv-input v-model="form.address" @click="handleAreaChange()" disabled disabledColor="#ffffff" placeholder="选择所在位置" border="none">
  18. </uv-input>
  19. <template v-slot:right>
  20. <uv-icon name="arrow-right"></uv-icon>
  21. </template>
  22. </uv-form-item>
  23. <uv-form-item label="编号" prop="number">
  24. <uv-input v-model="form.number" type="text" placeholder="请输入编号" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
  25. </uv-form-item>
  26. <uv-form-item label="房屋周边" prop="perimeter">
  27. <uv-input v-model="form.perimeter" type="text" placeholder="请输入房屋周边" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
  28. </uv-form-item>
  29. <uv-form-item label="标签" prop="iconTitle">
  30. <uv-input v-model="form.iconTitle" type="text" placeholder="请输入标签用逗号隔开" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
  31. </uv-form-item>
  32. <uv-form-item label="房间数量" prop="housesNumber">
  33. <uv-number-box v-model="form.housesNumber" :min="1" :max="10"></uv-number-box>
  34. </uv-form-item>
  35. <uv-form-item label="房屋主体是否改造" labelWidth="200" prop="revamp">
  36. <uv-radio-group v-model="form.revamp" placement="row">
  37. <uv-radio name="1" label="是"></uv-radio>
  38. <uv-radio name="0" customStyle="margin-left:30rpx;" label="否"></uv-radio>
  39. </uv-radio-group>
  40. </uv-form-item>
  41. <uv-form-item label="是否经过安置" labelWidth="200" prop="resettle">
  42. <uv-radio-group v-model="form.resettle" placement="row">
  43. <uv-radio name="1" label="是"></uv-radio>
  44. <uv-radio name="0" customStyle="margin-left:30rpx;" label="否"></uv-radio>
  45. </uv-radio-group>
  46. </uv-form-item>
  47. <uv-form-item label="院子总面积" labelWidth="100" prop="yardProportion">
  48. <uv-input v-model="form.yardProportion" type="text" placeholder="请输入院子总面积" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
  49. </uv-form-item>
  50. <uv-form-item label="坟包及电塔工厂噪音" labelWidth="150" prop="noise">
  51. <uv-input v-model="form.noise" type="text" placeholder="请输入坟包及电塔工厂噪音" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
  52. </uv-form-item>
  53. <uv-form-item label="水电气网" prop="net">
  54. <uv-input v-model="form.net" type="text" placeholder="请输入水电气网" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
  55. </uv-form-item>
  56. <uv-form-item label="停车" prop="park">
  57. <uv-input v-model="form.park" type="text" placeholder="请输入停车" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
  58. </uv-form-item>
  59. <uv-form-item label="付款方式及押金" labelWidth="120" prop="deposit">
  60. <uv-input v-model="form.deposit" type="text" placeholder="请输入押金" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
  61. </uv-form-item>
  62. <uv-form-item label="天府市民云房屋信息档案查询" labelWidth="100" prop="archival" labelPosition="top">
  63. <uv-input v-model="form.archival" type="text" placeholder="请输入天府市民云房屋信息档案查询" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
  64. </uv-form-item>
  65. <uv-form-item label="租期" prop="tenancy">
  66. <uv-input v-model="form.tenancy" type="text" placeholder="请输入租期" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
  67. </uv-form-item>
  68. <uv-form-item label="邻居对房东的评价" labelWidth="120" prop="evaluate">
  69. <uv-input v-model="form.evaluate" type="text" placeholder="请输入邻居对房东的评价" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
  70. </uv-form-item>
  71. <uv-form-item label="非正常死亡" labelWidth="80" prop="death">
  72. <uv-input v-model="form.death" type="text" placeholder="请输入非正常死亡" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
  73. </uv-form-item>
  74. <uv-form-item label="钥匙" prop="key">
  75. <uv-radio-group v-model="form.key" placement="row">
  76. <uv-radio name="1" label="有"></uv-radio>
  77. <uv-radio name="0" customStyle="margin-left:30rpx;" label="无"></uv-radio>
  78. </uv-radio-group>
  79. <!-- <uv-input v-model="form.key" type="text" placeholder="请输入钥匙" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input> -->
  80. </uv-form-item>
  81. <uv-form-item label="佣金" prop="commission">
  82. <uv-input v-model="form.commission" type="text" placeholder="请输入佣金" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
  83. </uv-form-item>
  84. <uv-form-item label="年限" prop="timeGo">
  85. <uv-input v-model="form.timeGo" type="text" placeholder="请输入年限" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
  86. </uv-form-item>
  87. <uv-form-item label="报建手续" prop="procedures">
  88. <uv-input v-model="form.procedures" type="text" placeholder="请输入报建手续" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
  89. </uv-form-item>
  90. <uv-form-item label="产权证照片" labelWidth="250" prop="isOwnershipList" labelPosition="top">
  91. <uv-upload customStyle="margin-top:20rpx;" :fileList="form.ownershipList" @afterRead="afterOwnershipRead" @delete="deleteOwnershipPic" name="1"
  92. multiple :maxCount="10"></uv-upload>
  93. </uv-form-item>
  94. <uv-form-item label="房屋照片/视频" labelWidth="250" prop="isHouseList" labelPosition="top">
  95. <uv-upload customStyle="margin-top:20rpx;" :fileList="form.houseList" @afterRead="afterHouseRead" @delete="deleteHousePic" name="1"
  96. multiple :maxCount="10"></uv-upload>
  97. </uv-form-item>
  98. <uv-form-item label="视频" labelWidth="250" prop="isMp4List" labelPosition="top">
  99. <uv-upload customStyle="margin-top:20rpx;" :fileList="form.mp4List" @afterRead="aftermp4Read" @delete="deletemp4Pic" name="1"
  100. multiple :maxCount="10"></uv-upload>
  101. </uv-form-item>
  102. <uv-form-item label="备注" prop="remark" labelPosition="top">
  103. <uv-input v-model="form.remark" type="text" placeholder="请输入备注" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
  104. </uv-form-item>
  105. <uv-form-item>
  106. <uv-button type="primary" text="确认发布" customStyle="margin-top: 30px;background-color: #1EC77A;border-radius: 30px;" @click="submit"></uv-button>
  107. </uv-form-item>
  108. </uv-form>
  109. <!-- 地址 -->
  110. <citySelect ref="citySelectRef" :zIndex="0" @city-change="handleCityChange"></citySelect>
  111. </view>
  112. </template>
  113. <script>
  114. import { saveOrUpdateHouse } from "@/common/api.js"
  115. import citySelect from "@/components/cityselect/index.vue"
  116. import QQMapWX from "@/util/qqmap-wx-jssdk.min.js"
  117. export default{
  118. components:{
  119. citySelect
  120. },
  121. data(){
  122. return{
  123. id:"",
  124. form:{
  125. // title:"这是标题",//标题
  126. // price:"32.34",//价格
  127. // house:"这是户型",//户型
  128. // proportion:"89",//面积
  129. // address:"湖南长沙岳麓区",//所属位置
  130. // number:"2006",//编号
  131. // perimeter:"商场,地铁",//房屋周边
  132. // iconTitle:"商场,地铁,学校",//标签
  133. // housesNumber:1,//房间数量
  134. // revamp:0,//房屋主体是否改造
  135. // resettle:0,//是否经过安置
  136. // yardProportion:"无",//院子总面积
  137. // noise:"大",//噪音
  138. // net:"有",//水电气网
  139. // park:"有一个停车位",//停车
  140. // deposit:"1200",//押金
  141. // archival:"档案查询",//档案查询
  142. // tenancy:"租期",//租期
  143. // evaluate:"评价",//评价
  144. // death:"非正常死亡",//非正常死亡
  145. // key:"1",//钥匙
  146. // commission:"230",//佣金
  147. // timeGo:"",//年限
  148. // procedures:"20",//手续
  149. // isOwnershipList:"1",
  150. // ownershipList:[
  151. // {
  152. // url:"https://tennis-oss.xzaiyp.top/2024-12-04/61d46ae3-bf72-430f-8046-698b92b18f81.jpg"
  153. // },
  154. // {
  155. // url:"https://tennis-oss.xzaiyp.top/2024-12-04/3987c047-1c50-43e4-940d-9ce96cd06225.jpg"
  156. // }
  157. // ],
  158. // isHouseList:"1",
  159. // houseList:[
  160. // {
  161. // url:"https://tennis-oss.xzaiyp.top/2024-12-04/61d46ae3-bf72-430f-8046-698b92b18f81.jpg"
  162. // },
  163. // {
  164. // url:"https://tennis-oss.xzaiyp.top/2024-12-04/3987c047-1c50-43e4-940d-9ce96cd06225.jpg"
  165. // }
  166. // ],
  167. // isMp4List:"1",
  168. // mp4List:[],
  169. // remark:""
  170. title:"",//标题
  171. price:"",//价格
  172. house:"",//户型
  173. proportion:"",//面积
  174. address:"",//所属位置
  175. number:"",//编号
  176. perimeter:"",//房屋周边
  177. iconTitle:"",//标签
  178. housesNumber:1,//房间数量
  179. revamp:0,//房屋主体是否改造
  180. resettle:0,//是否经过安置
  181. yardProportion:"",//院子总面积
  182. noise:"",//噪音
  183. net:"",//水电气网
  184. park:"",//停车
  185. deposit:"",//押金
  186. archival:"",//档案查询
  187. tenancy:"",//租期
  188. evaluate:"",//评价
  189. death:"",//非正常死亡
  190. key:"1",//钥匙
  191. commission:"",//佣金
  192. timeGo:"",//年限
  193. procedures:"",//手续
  194. isOwnershipList:"",
  195. ownershipList:[],
  196. isHouseList:"",
  197. houseList:[],
  198. isMp4List:"",
  199. mp4List:[],
  200. remark:""
  201. },
  202. rules:{
  203. title:[
  204. {
  205. type: 'string',
  206. required: true,
  207. message: '请输入账号',
  208. trigger: ['blur', 'change']
  209. }
  210. ],
  211. price:[
  212. {
  213. type: 'string',
  214. required: true,
  215. message: '请输入价格',
  216. trigger: ['blur', 'change']
  217. }
  218. ],
  219. house:[
  220. {
  221. type: 'string',
  222. required: true,
  223. message: '请输入户型',
  224. trigger: ['blur', 'change']
  225. }
  226. ],
  227. proportion:[
  228. {
  229. type: 'string',
  230. required: true,
  231. message: '请输入面积',
  232. trigger: ['blur', 'change']
  233. }
  234. ],
  235. number:[
  236. {
  237. type: 'string',
  238. required: true,
  239. message: '请输入编号',
  240. trigger: ['blur', 'change']
  241. }
  242. ],
  243. perimeter:[
  244. {
  245. type: 'string',
  246. required: true,
  247. message: '请输入房屋周边',
  248. trigger: ['blur', 'change']
  249. }
  250. ],
  251. iconTitle:[
  252. {
  253. type: 'string',
  254. required: true,
  255. message: '请输入标签用,隔开',
  256. trigger: ['blur', 'change']
  257. }
  258. ],
  259. yardProportion:[
  260. {
  261. type: 'string',
  262. required: true,
  263. message: '请输入院子总面积',
  264. trigger: ['blur', 'change']
  265. }
  266. ],
  267. noise:[
  268. {
  269. type: 'string',
  270. required: true,
  271. message: '请输入坟包及电塔工厂噪音',
  272. trigger: ['blur', 'change']
  273. }
  274. ],
  275. net:[
  276. {
  277. type: 'string',
  278. required: true,
  279. message: '请输入水电气网',
  280. trigger: ['blur', 'change']
  281. }
  282. ],
  283. park:[
  284. {
  285. type: 'string',
  286. required: true,
  287. message: '请输入停车',
  288. trigger: ['blur', 'change']
  289. }
  290. ],
  291. deposit:[
  292. {
  293. type: 'string',
  294. required: true,
  295. message: '请输入押金',
  296. trigger: ['blur', 'change']
  297. }
  298. ],
  299. archival:[
  300. {
  301. type: 'string',
  302. required: true,
  303. message: '请输入天府市民云房屋信息档案查询',
  304. trigger: ['blur', 'change']
  305. }
  306. ],
  307. tenancy:[
  308. {
  309. type: 'string',
  310. required: true,
  311. message: '请输入租期',
  312. trigger: ['blur', 'change']
  313. }
  314. ],
  315. evaluate:[
  316. {
  317. type: 'string',
  318. required: true,
  319. message: '请输入邻居对房东的评价',
  320. trigger: ['blur', 'change']
  321. }
  322. ],
  323. death:[
  324. {
  325. type: 'string',
  326. required: true,
  327. message: '请输入非正常死亡',
  328. trigger: ['blur', 'change']
  329. }
  330. ],
  331. key:[
  332. {
  333. type: 'string',
  334. required: true,
  335. message: '请输入钥匙',
  336. trigger: ['blur', 'change']
  337. }
  338. ],
  339. commission:[
  340. {
  341. type: 'string',
  342. required: true,
  343. message: '请输入佣金',
  344. trigger: ['blur', 'change']
  345. }
  346. ],
  347. timeGo:[
  348. {
  349. type: 'string',
  350. required: true,
  351. message: '请输入年限',
  352. trigger: ['blur', 'change']
  353. }
  354. ],
  355. procedures:[
  356. {
  357. type: 'string',
  358. required: true,
  359. message: '请输入报建手续',
  360. trigger: ['blur', 'change']
  361. }
  362. ],
  363. }
  364. }
  365. },
  366. watch: {
  367. 'form.ownershipList'(newValue, oldValue) {
  368. if (newValue.length > 0) {
  369. this.form.isOwnershipList = '有'
  370. } else {
  371. this.form.isOwnershipList = ''
  372. }
  373. },
  374. 'form.houseList'(newValue, oldValue) {
  375. if (newValue.length > 0) {
  376. this.form.isHouseList = '有'
  377. } else {
  378. this.form.isHouseList = ''
  379. }
  380. },
  381. 'form.mp4List'(newValue, oldValue) {
  382. if (newValue.length > 0) {
  383. this.form.isMp4List = '有'
  384. } else {
  385. this.form.isMp4List = ''
  386. }
  387. }
  388. },
  389. onReady() {
  390. this.$refs.form.setRules(this.rules)
  391. },
  392. onLoad(options) {
  393. this.id = options.id
  394. },
  395. mounted() {
  396. },
  397. methods:{
  398. deleteHousePic(event) {
  399. this.form.houseList.splice(event.index, 1)
  400. },
  401. async afterHouseRead(e) {
  402. let self = this
  403. e.file.forEach(file => {
  404. self.$Oss.ossUpload(file.url).then(url => {
  405. self.form.houseList.push({
  406. url
  407. })
  408. })
  409. })
  410. },
  411. deleteOwnershipPic(event) {
  412. this.form.ownershipList.splice(event.index, 1)
  413. },
  414. async afterOwnershipRead(e) {
  415. let self = this
  416. e.file.forEach(file => {
  417. self.$Oss.ossUpload(file.url).then(url => {
  418. self.form.ownershipList.push({
  419. url
  420. })
  421. })
  422. })
  423. },
  424. deletemp4Pic(event) {
  425. this.form.mp4List.splice(event.index, 1)
  426. },
  427. async aftermp4Read(e) {
  428. let self = this
  429. e.file.forEach(file => {
  430. self.$Oss.ossUpload(file.url).then(url => {
  431. self.form.mp4List.push({
  432. url
  433. })
  434. })
  435. })
  436. },
  437. handleAreaChange(){
  438. const that = this;
  439. wx.chooseLocation({
  440. // type: 'wgs84',
  441. success: function (res) {
  442. console.log('当前位置的经度:' + res.longitude);
  443. console.log('当前位置的纬度:' + res.latitude);
  444. const qqmapsdk = new QQMapWX({
  445. key: 'TT7BZ-Z3LW4-KOAUB-KWHOA-SBJJ6-Y5B6R' // 必填
  446. });
  447. uni.showLoading({
  448. title:"获取中...."
  449. })
  450. qqmapsdk.reverseGeocoder({
  451. location: {
  452. latitude: res.latitude,
  453. longitude: res.longitude
  454. },
  455. success: function(res) {
  456. uni.hideLoading()
  457. that.form.address = res.result.address
  458. console.log('逆地理编码结果:', res);
  459. },
  460. fail: function(error) {
  461. uni.hideLoading()
  462. console.error('逆地理编码失败:', error);
  463. }
  464. });
  465. }
  466. })
  467. // this.$refs.citySelectRef.open()
  468. },
  469. handleCityChange(e) {
  470. this.form.address = e.province.label + '-' + e.city.label + '-' + e.area.label;
  471. },
  472. submit() {
  473. // price:"",//价格
  474. // house:"",//户型
  475. // proportion:"",//面积
  476. // address:"",//所属位置
  477. // number:"",//编号
  478. // perimeter:"",//房屋周边
  479. // housesNumber:1,//房间数量
  480. // revamp:0,//房屋主体是否改造
  481. // resettle:0,//是否经过安置
  482. // yardProportion:"",//院子总面积
  483. // noise:"",//噪音
  484. // net:"",//水电气网
  485. // park:"",//停车
  486. // deposit:"",//押金
  487. // archival:"",//档案查询
  488. // tenancy:"",//租期
  489. // evaluate:"",//评价
  490. // death:"",//非正常死亡
  491. // key:"",//钥匙
  492. // commission:"",//佣金
  493. // procedures:"",//手续
  494. // isOwnershipList:"",
  495. // ownershipList:[],
  496. // isHouseList:"",
  497. // houseList:[],
  498. // remark:""
  499. let that = this
  500. that.$refs.form.validate().then(res => {
  501. let params={
  502. userId:"",
  503. id:"",
  504. classId:"",//分类标识
  505. commonClass:"",//所属分类
  506. address:that.form.address,//地址
  507. homeAge:"",//户主年龄
  508. homeAz:"",//是否经过安置
  509. homeBian:that.form.perimeter,//房屋周边
  510. homeBjsx:"",//报建手续
  511. homeCai:"",//菜地
  512. homeCat:that.form.park,//停车
  513. homeGz:that.form.revamp,//房屋主体是否改造
  514. homeHb:"",//房屋朝向及海拔
  515. homeBz:that.form.remark,//备注
  516. homeJg:"",//房屋结构
  517. homeJl:"",//距离场镇距离
  518. homeJt:"",//交通
  519. homeJtzy:"",//户主家庭职业
  520. homeMi:"",//面积
  521. homeMj:that.form.proportion,//房屋面积
  522. homeMoney:that.form.commission,//佣金
  523. homeNo:"",//房屋编号
  524. homeNum:that.form.housesNumber,//房间数量
  525. homePay:that.form.deposit,//付款方式及押金
  526. homePj:that.form.evaluate,//邻居对房东评价
  527. homeSd:that.form.net,//水电气网
  528. homeShjl:"",//距离成都西三环
  529. homeSw:that.form.death,//非正常死亡
  530. homeTf:"",//府市民云房屋信息档案查询
  531. homeTime:that.form.tenancy,//租期
  532. homeType:that.form.house,//户型
  533. homeYs:that.form.key,//钥匙
  534. homeYzmj:that.form.yardProportion,//院子总面积
  535. homeZy:that.form.noise,//坟包及电塔 工厂噪音
  536. iconName:"",//热点名称
  537. iconTitle:that.form.iconTitle,//标签
  538. num:"",//浏览量
  539. price:that.form.price,//价格
  540. timeGo:that.form.timeGo,//年限
  541. title:that.form.title,//标题
  542. unit:"",//单位
  543. image:that.form.ownershipList.map(item => item.url).join(','),//图片
  544. iconImage:"",//左上角图标
  545. homeImage:that.form.houseList.map(item => item.url).join(','),//产权证照片
  546. homeMp4:"",//视频
  547. }
  548. saveOrUpdateHouse(params).then(response=>{
  549. console.info('response',response)
  550. uni.showToast({
  551. title: response.message,
  552. mask: false,
  553. icon: 'none',
  554. duration: 2000
  555. })
  556. setTimeout(()=>{
  557. uni.redirectTo({
  558. url:"/pages_subpack/successful-apply/index"
  559. })
  560. },2000)
  561. }).catch(error=>{
  562. })
  563. }).catch(errors => {
  564. console.info('errors',errors)
  565. })
  566. }
  567. }
  568. }
  569. </script>
  570. <style>
  571. page{
  572. background-color: #f5f5f5;
  573. }
  574. </style>