租房小程序前端代码
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.

520 lines
18 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year 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. export default{
  117. components:{
  118. citySelect
  119. },
  120. data(){
  121. return{
  122. id:"",
  123. form:{
  124. title:"这是标题",//标题
  125. price:"32.34",//价格
  126. house:"这是户型",//户型
  127. proportion:"89",//面积
  128. address:"湖南长沙岳麓区",//所属位置
  129. number:"2006",//编号
  130. perimeter:"商场,地铁",//房屋周边
  131. iconTitle:"商场,地铁,学校",//标签
  132. housesNumber:1,//房间数量
  133. revamp:0,//房屋主体是否改造
  134. resettle:0,//是否经过安置
  135. yardProportion:"无",//院子总面积
  136. noise:"大",//噪音
  137. net:"有",//水电气网
  138. park:"有一个停车位",//停车
  139. deposit:"1200",//押金
  140. archival:"档案查询",//档案查询
  141. tenancy:"租期",//租期
  142. evaluate:"评价",//评价
  143. death:"非正常死亡",//非正常死亡
  144. key:"1",//钥匙
  145. commission:"230",//佣金
  146. timeGo:"",//年限
  147. procedures:"20",//手续
  148. isOwnershipList:"1",
  149. ownershipList:[
  150. {
  151. url:"https://tennis-oss.xzaiyp.top/2024-12-04/61d46ae3-bf72-430f-8046-698b92b18f81.jpg"
  152. },
  153. {
  154. url:"https://tennis-oss.xzaiyp.top/2024-12-04/3987c047-1c50-43e4-940d-9ce96cd06225.jpg"
  155. }
  156. ],
  157. isHouseList:"1",
  158. houseList:[
  159. {
  160. url:"https://tennis-oss.xzaiyp.top/2024-12-04/61d46ae3-bf72-430f-8046-698b92b18f81.jpg"
  161. },
  162. {
  163. url:"https://tennis-oss.xzaiyp.top/2024-12-04/3987c047-1c50-43e4-940d-9ce96cd06225.jpg"
  164. }
  165. ],
  166. isMp4List:"1",
  167. mp4List:[],
  168. remark:""
  169. },
  170. rules:{
  171. title:[
  172. {
  173. type: 'string',
  174. required: true,
  175. message: '请输入账号',
  176. trigger: ['blur', 'change']
  177. }
  178. ],
  179. price:[
  180. {
  181. type: 'string',
  182. required: true,
  183. message: '请输入价格',
  184. trigger: ['blur', 'change']
  185. }
  186. ],
  187. house:[
  188. {
  189. type: 'string',
  190. required: true,
  191. message: '请输入户型',
  192. trigger: ['blur', 'change']
  193. }
  194. ],
  195. proportion:[
  196. {
  197. type: 'string',
  198. required: true,
  199. message: '请输入面积',
  200. trigger: ['blur', 'change']
  201. }
  202. ],
  203. number:[
  204. {
  205. type: 'string',
  206. required: true,
  207. message: '请输入编号',
  208. trigger: ['blur', 'change']
  209. }
  210. ],
  211. perimeter:[
  212. {
  213. type: 'string',
  214. required: true,
  215. message: '请输入房屋周边',
  216. trigger: ['blur', 'change']
  217. }
  218. ],
  219. iconTitle:[
  220. {
  221. type: 'string',
  222. required: true,
  223. message: '请输入标签用,隔开',
  224. trigger: ['blur', 'change']
  225. }
  226. ],
  227. yardProportion:[
  228. {
  229. type: 'string',
  230. required: true,
  231. message: '请输入院子总面积',
  232. trigger: ['blur', 'change']
  233. }
  234. ],
  235. noise:[
  236. {
  237. type: 'string',
  238. required: true,
  239. message: '请输入坟包及电塔工厂噪音',
  240. trigger: ['blur', 'change']
  241. }
  242. ],
  243. net:[
  244. {
  245. type: 'string',
  246. required: true,
  247. message: '请输入水电气网',
  248. trigger: ['blur', 'change']
  249. }
  250. ],
  251. park:[
  252. {
  253. type: 'string',
  254. required: true,
  255. message: '请输入停车',
  256. trigger: ['blur', 'change']
  257. }
  258. ],
  259. deposit:[
  260. {
  261. type: 'string',
  262. required: true,
  263. message: '请输入押金',
  264. trigger: ['blur', 'change']
  265. }
  266. ],
  267. archival:[
  268. {
  269. type: 'string',
  270. required: true,
  271. message: '请输入天府市民云房屋信息档案查询',
  272. trigger: ['blur', 'change']
  273. }
  274. ],
  275. tenancy:[
  276. {
  277. type: 'string',
  278. required: true,
  279. message: '请输入租期',
  280. trigger: ['blur', 'change']
  281. }
  282. ],
  283. evaluate:[
  284. {
  285. type: 'string',
  286. required: true,
  287. message: '请输入邻居对房东的评价',
  288. trigger: ['blur', 'change']
  289. }
  290. ],
  291. death:[
  292. {
  293. type: 'string',
  294. required: true,
  295. message: '请输入非正常死亡',
  296. trigger: ['blur', 'change']
  297. }
  298. ],
  299. key:[
  300. {
  301. type: 'string',
  302. required: true,
  303. message: '请输入钥匙',
  304. trigger: ['blur', 'change']
  305. }
  306. ],
  307. commission:[
  308. {
  309. type: 'string',
  310. required: true,
  311. message: '请输入佣金',
  312. trigger: ['blur', 'change']
  313. }
  314. ],
  315. timeGo:[
  316. {
  317. type: 'string',
  318. required: true,
  319. message: '请输入年限',
  320. trigger: ['blur', 'change']
  321. }
  322. ],
  323. procedures:[
  324. {
  325. type: 'string',
  326. required: true,
  327. message: '请输入报建手续',
  328. trigger: ['blur', 'change']
  329. }
  330. ],
  331. }
  332. }
  333. },
  334. watch: {
  335. 'form.ownershipList'(newValue, oldValue) {
  336. if (newValue.length > 0) {
  337. this.form.isOwnershipList = '有'
  338. } else {
  339. this.form.isOwnershipList = ''
  340. }
  341. },
  342. 'form.houseList'(newValue, oldValue) {
  343. if (newValue.length > 0) {
  344. this.form.isHouseList = '有'
  345. } else {
  346. this.form.isHouseList = ''
  347. }
  348. },
  349. 'form.mp4List'(newValue, oldValue) {
  350. if (newValue.length > 0) {
  351. this.form.isMp4List = '有'
  352. } else {
  353. this.form.isMp4List = ''
  354. }
  355. }
  356. },
  357. onReady() {
  358. this.$refs.form.setRules(this.rules)
  359. },
  360. onLoad(options) {
  361. this.id = options.id
  362. },
  363. mounted() {
  364. },
  365. methods:{
  366. deleteHousePic(event) {
  367. this.form.houseList.splice(event.index, 1)
  368. },
  369. async afterHouseRead(e) {
  370. let self = this
  371. e.file.forEach(file => {
  372. self.$Oss.ossUpload(file.url).then(url => {
  373. self.form.houseList.push({
  374. url
  375. })
  376. })
  377. })
  378. },
  379. deleteOwnershipPic(event) {
  380. this.form.ownershipList.splice(event.index, 1)
  381. },
  382. async afterOwnershipRead(e) {
  383. let self = this
  384. e.file.forEach(file => {
  385. self.$Oss.ossUpload(file.url).then(url => {
  386. self.form.ownershipList.push({
  387. url
  388. })
  389. })
  390. })
  391. },
  392. deletemp4Pic(event) {
  393. this.form.mp4List.splice(event.index, 1)
  394. },
  395. async aftermp4Read(e) {
  396. let self = this
  397. e.file.forEach(file => {
  398. self.$Oss.ossUpload(file.url).then(url => {
  399. self.form.mp4List.push({
  400. url
  401. })
  402. })
  403. })
  404. },
  405. handleAreaChange(){
  406. this.$refs.citySelectRef.open()
  407. },
  408. handleCityChange(e) {
  409. this.form.address = e.province.label + '-' + e.city.label + '-' + e.area.label;
  410. },
  411. submit() {
  412. // price:"",//价格
  413. // house:"",//户型
  414. // proportion:"",//面积
  415. // address:"",//所属位置
  416. // number:"",//编号
  417. // perimeter:"",//房屋周边
  418. // housesNumber:1,//房间数量
  419. // revamp:0,//房屋主体是否改造
  420. // resettle:0,//是否经过安置
  421. // yardProportion:"",//院子总面积
  422. // noise:"",//噪音
  423. // net:"",//水电气网
  424. // park:"",//停车
  425. // deposit:"",//押金
  426. // archival:"",//档案查询
  427. // tenancy:"",//租期
  428. // evaluate:"",//评价
  429. // death:"",//非正常死亡
  430. // key:"",//钥匙
  431. // commission:"",//佣金
  432. // procedures:"",//手续
  433. // isOwnershipList:"",
  434. // ownershipList:[],
  435. // isHouseList:"",
  436. // houseList:[],
  437. // remark:""
  438. let that = this
  439. that.$refs.form.validate().then(res => {
  440. let params={
  441. userId:"",
  442. id:"",
  443. classId:"",//分类标识
  444. commonClass:"",//所属分类
  445. address:that.form.address,//地址
  446. homeAge:"",//户主年龄
  447. homeAz:"",//是否经过安置
  448. homeBian:"",//房屋周边
  449. homeBjsx:"",//报建手续
  450. homeCai:"",//菜地
  451. homeCat:that.form.park,//停车
  452. homeGz:that.form.revamp,//房屋主体是否改造
  453. homeHb:"",//房屋朝向及海拔
  454. homeBz:that.form.remark,//备注
  455. homeJg:"",//房屋结构
  456. homeJl:"",//距离场镇距离
  457. homeJt:"",//交通
  458. homeJtzy:"",//户主家庭职业
  459. homeMi:"",//面积
  460. homeMj:that.form.proportion,//房屋面积
  461. homeMoney:that.form.commission,//佣金
  462. homeNo:"",//房屋编号
  463. homeNum:that.form.housesNumber,//房间数量
  464. homePay:that.form.deposit,//付款方式及押金
  465. homePj:that.form.evaluate,//邻居对房东评价
  466. homeSd:that.form.net,//水电气网
  467. homeShjl:"",//距离成都西三环
  468. homeSw:that.form.death,//非正常死亡
  469. homeTf:"",//府市民云房屋信息档案查询
  470. homeTime:that.form.tenancy,//租期
  471. homeType:that.form.house,//户型
  472. homeYs:that.form.key,//钥匙
  473. homeYzmj:that.form.yardProportion,//院子总面积
  474. homeZy:that.form.noise,//坟包及电塔 工厂噪音
  475. iconName:"",//热点名称
  476. iconTitle:that.form.iconTitle,//标签
  477. num:"",//浏览量
  478. price:that.form.price,//价格
  479. timeGo:that.form.timeGo,//年限
  480. title:that.form.title,//标题
  481. unit:"",//单位
  482. image:that.form.ownershipList.map(item => item.url).join(','),//图片
  483. iconImage:"",//左上角图标
  484. homeImage:that.form.houseList.map(item => item.url).join(','),//产权证照片
  485. homeMp4:"",//视频
  486. }
  487. saveOrUpdateHouse(params).then(response=>{
  488. console.info('response',response)
  489. uni.showToast({
  490. title: response.message,
  491. mask: false,
  492. icon: 'none',
  493. duration: 2000
  494. })
  495. setTimeout(()=>{
  496. uni.redirectTo({
  497. url:"/pages_subpack/successful-apply/index"
  498. })
  499. },2000)
  500. }).catch(error=>{
  501. })
  502. }).catch(errors => {
  503. console.info('errors',errors)
  504. })
  505. }
  506. }
  507. }
  508. </script>
  509. <style>
  510. page{
  511. background-color: #f5f5f5;
  512. }
  513. </style>