瑶都万能墙
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.

443 lines
8.8 KiB

7 months ago
7 months ago
7 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
7 months ago
7 months ago
6 months ago
7 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
7 months ago
7 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
7 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
7 months ago
6 months ago
7 months ago
7 months ago
7 months ago
6 months ago
7 months ago
7 months ago
6 months ago
7 months ago
7 months ago
6 months ago
7 months ago
7 months ago
7 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
7 months ago
6 months ago
7 months ago
7 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
  1. <template>
  2. <view class="page">
  3. <navbar title="发布租房" leftClick @leftClick="$utils.navigateBack" />
  4. <view class="form">
  5. <view class="help-issue">
  6. <text>租房标题</text>
  7. <text style="color: #BD3624;">*</text>
  8. </view>
  9. <view class="form-sheet-cell">
  10. <input type="text" class="title-input" v-model="form.title"/>
  11. </view>
  12. <uv-cell
  13. title="租房地点"
  14. rightIconStyle="fontSize: 30rpx;"
  15. :value="form.address || '请选择租房地点'"
  16. @click="selectAddr"
  17. isLink
  18. ></uv-cell>
  19. <uv-cell
  20. title="朝向"
  21. rightIconStyle="fontSize: 30rpx;"
  22. :value="form.face || '请选择朝向'"
  23. @click="openPicker('face')"
  24. isLink
  25. ></uv-cell>
  26. <uv-cell
  27. title="装修"
  28. rightIconStyle="fontSize: 30rpx;"
  29. :value="form.decoration || '请选择装修'"
  30. @click="openPicker('decoration')"
  31. isLink
  32. ></uv-cell>
  33. <!-- <uv-cell
  34. title="楼层"
  35. rightIconStyle="fontSize: 30rpx;"
  36. value="请选择楼层"
  37. isLink
  38. ></uv-cell> -->
  39. <view class="form-sheet-cell">
  40. <view class="label">
  41. 楼层
  42. </view>
  43. <view class="price">
  44. <input placeholder="请输入楼层(1楼)" v-model="form.floor" />
  45. </view>
  46. </view>
  47. <view class="form-sheet-cell">
  48. <view class="label">
  49. 户型
  50. </view>
  51. <view class="price">
  52. <input placeholder="请输入户型(三室一厅)" v-model="form.home" />
  53. </view>
  54. </view>
  55. <view class="form-sheet-cell">
  56. <view class="label">
  57. 付款方式
  58. </view>
  59. <view class="price">
  60. <input placeholder="请输入付款方式(押一付三)" v-model="form.payment" />
  61. </view>
  62. </view>
  63. <view class="form-sheet-cell">
  64. <view class="label">
  65. 租金/
  66. </view>
  67. <view class="price">
  68. <input placeholder="请输入租金" type="text" v-model="form.money" />
  69. </view>
  70. </view>
  71. <view class="form-sheet-cell">
  72. <view class="label">
  73. 面积
  74. </view>
  75. <view class="price">
  76. <input placeholder="请输入面积(平方米)" type="number" v-model="form.crm" />
  77. </view>
  78. </view>
  79. <view class="form-sheet-cell">
  80. <view class="label">
  81. 看房
  82. </view>
  83. <uv-radio-group v-model="form.showings">
  84. <view class="price">
  85. <uv-radio
  86. :customStyle="{margin: '8px'}"
  87. iconSize="30rpx"
  88. size="40rpx"
  89. labelSize="26rpx"
  90. :label="t.name"
  91. v-for="(t, i) in showingsRadio"
  92. :key="i"
  93. :name="t.name">
  94. </uv-radio>
  95. </view>
  96. </uv-radio-group>
  97. </view>
  98. <view class="form-sheet-cell">
  99. <view class="label">
  100. 电梯
  101. </view>
  102. <uv-radio-group v-model="form.lift">
  103. <view class="price">
  104. <uv-radio
  105. :customStyle="{margin: '8px'}"
  106. iconSize="30rpx"
  107. size="40rpx"
  108. labelSize="26rpx"
  109. :label="t.name"
  110. :name="t.name"
  111. v-for="(t, i) in liftRadio"
  112. :key="i">
  113. </uv-radio>
  114. </view>
  115. </uv-radio-group>
  116. </view>
  117. <view class="form-sheet-cell">
  118. <view class="label">
  119. 交付
  120. </view>
  121. <uv-radio-group v-model="form.deliver">
  122. <view class="price">
  123. <uv-radio
  124. :customStyle="{margin: '8px'}"
  125. iconSize="30rpx"
  126. size="40rpx"
  127. labelSize="26rpx"
  128. :label="t.name"
  129. :name="t.name"
  130. v-for="(t, i) in deliverRadio"
  131. :key="i">
  132. </uv-radio>
  133. </view>
  134. </uv-radio-group>
  135. </view>
  136. <view class="form-sheet-cell">
  137. <view class="label">
  138. 联系电话
  139. </view>
  140. <input placeholder="请输入联系电话" v-model="form.phone" />
  141. </view>
  142. <view class="form-sheet-cell">
  143. <view class="label">
  144. 备注
  145. </view>
  146. <input placeholder="请输入备注" v-model="form.titleSub" />
  147. </view>
  148. <view class="images box">
  149. <view class="">
  150. 精选照片
  151. </view>
  152. <uv-upload
  153. :fileList="fileList"
  154. :maxCount="imageMax"
  155. multiple
  156. width="150rpx"
  157. height="150rpx"
  158. @delete="deleteImage"
  159. @afterRead="afterRead"
  160. :previewFullImage="true"></uv-upload>
  161. </view>
  162. <view class="category">
  163. <view class="title">
  164. 选择地区
  165. </view>
  166. <view class="tagList">
  167. <view
  168. :class="{act : t.id == form.addId}"
  169. @click="form.addId = t.id"
  170. v-for="(t, i) in cityList"
  171. :key="i">
  172. {{ t.name }}
  173. </view>
  174. </view>
  175. </view>
  176. <!-- <view class="">
  177. <uv-textarea
  178. v-model="form.content"
  179. count
  180. :maxlength="300"
  181. autoHeight
  182. placeholder="请输入详细介绍"></uv-textarea>
  183. </view> -->
  184. <uv-picker
  185. ref="picker"
  186. :columns="columns"
  187. @confirm="pickerConfirm"></uv-picker>
  188. <view class="uni-color-btn"
  189. @click="submit">
  190. 发布
  191. </view>
  192. </view>
  193. </view>
  194. </template>
  195. <script>
  196. import Position from '@/utils/position.js'
  197. import { mapState } from 'vuex'
  198. export default {
  199. data() {
  200. return {
  201. form : {
  202. addId : '',//地区id
  203. address : '',//地址
  204. crm : '',//面积
  205. showings : '随时可看',//看房
  206. face : '',
  207. lift : '有',
  208. deliver : '整租',
  209. floor : '',
  210. decoration : '',
  211. },
  212. showingsRadio : [//看房
  213. {
  214. name : '随时可看',
  215. },
  216. {
  217. name : '电话预约',
  218. },
  219. ],
  220. liftRadio : [
  221. {
  222. name : '有',
  223. },
  224. {
  225. name : '无',
  226. },
  227. ],
  228. deliverRadio : [
  229. {
  230. name : '整租',
  231. },
  232. {
  233. name : '合租',
  234. },
  235. ],
  236. fileList : [],
  237. imageMax : 9,
  238. picker : {
  239. face : [
  240. '朝东',
  241. '朝南',
  242. '朝西',
  243. '朝北',
  244. ],
  245. decoration : [
  246. '精装',
  247. '毛胚',
  248. ],
  249. },
  250. pickerKey : '',
  251. }
  252. },
  253. onLoad() {
  254. // for (var i = 0; i < 30; i++) {
  255. // this.picker.workYear.push((i + 1) + '年')
  256. // }
  257. this.form.addId = this.cityList[0].id
  258. },
  259. computed : {
  260. columns(){
  261. return [this.picker[this.pickerKey]]
  262. },
  263. ...mapState(['cityList', 'category']),
  264. },
  265. methods: {
  266. openPicker(key){
  267. this.pickerKey = key
  268. this.$refs.picker.open()
  269. },
  270. pickerConfirm(e){
  271. this.form[this.pickerKey] = e.value[0]
  272. },
  273. deleteImage(e){
  274. this.fileList.splice(e.index, 1)
  275. },
  276. afterRead(e){
  277. let self = this
  278. e.file.forEach(file => {
  279. self.$Oss.ossUpload(file.url).then(url => {
  280. self.fileList.push({
  281. url
  282. })
  283. })
  284. })
  285. },
  286. //地图上选择地址
  287. selectAddr() {
  288. Position.selectAddress(0, 0, res => {
  289. //经纬度信息
  290. this.form.latitude = res.latitude
  291. this.form.longitude = res.longitude
  292. if (res.name) {
  293. return this.form.address = res.name
  294. }
  295. this.form.address = ''
  296. })
  297. },
  298. // 提交
  299. submit(){
  300. if (this.$utils.verificationAll(this.form, {
  301. title: '请输入标题',
  302. address : '请选择租房地点',
  303. face : '请选择朝向',
  304. decoration : '请选择装修',
  305. floor : '请输入楼层',
  306. home : '请输入户型',
  307. payment : '请输入付款方式',
  308. money : '请输入租金',
  309. crm : '请输入面积',
  310. showings : '请选择看房',
  311. lift : '请选择电梯',
  312. deliver : '请选择交付方式',
  313. phone: '请输入联系电话',
  314. // titleSub : '请输入备注',
  315. })) {
  316. return
  317. }
  318. if(this.fileList.length == 0){
  319. return uni.showToast({
  320. title: '请上传精选照片',
  321. icon : 'none'
  322. })
  323. }
  324. this.form.image = this.fileList.map(n => n.url).join(',')
  325. this.$api('publishRent', this.form, res => {
  326. if(res.code == 200){
  327. uni.showToast({
  328. title: '发布成功!',
  329. icon: 'none'
  330. })
  331. setTimeout(uni.navigateBack, 1000, -1)
  332. }
  333. })
  334. },
  335. }
  336. }
  337. </script>
  338. <style scoped lang="scss">
  339. .page{
  340. background-color: #fff;
  341. min-height: 100vh;
  342. box-sizing: border-box;
  343. color: #333333;
  344. font-size: 28rpx;
  345. /deep/ text{
  346. font-size: 28rpx !important;
  347. }
  348. .form{
  349. padding: 30rpx;
  350. .help-issue {
  351. margin: 20rpx;
  352. }
  353. .title-input{
  354. border: 1px solid $uni-color;
  355. width: 100%;
  356. border-radius: 10rpx;
  357. padding: 10rpx 20rpx;
  358. box-sizing: border-box;
  359. height: 65rpx;
  360. }
  361. .form-sheet-cell{
  362. display: flex;
  363. background-color: #fff;
  364. padding: 20rpx 30rpx;
  365. align-items: center;
  366. .label{
  367. width: 160rpx;
  368. }
  369. .price{
  370. display: flex;
  371. // text-align: center;
  372. input{
  373. width: 450rpx;
  374. // border: 1px solid $uni-color;
  375. margin: 0 10rpx;
  376. }
  377. }
  378. .right-icon{
  379. margin-left: auto;
  380. }
  381. }
  382. .images{
  383. padding: 30rpx;
  384. view{
  385. padding-bottom: 20rpx;
  386. }
  387. }
  388. }
  389. .category{
  390. padding: 20rpx;
  391. .title{
  392. // font-weight: 900;
  393. // font-size: 30rpx;
  394. }
  395. .tagList{
  396. display: flex;
  397. flex-wrap: wrap;
  398. padding: 10rpx 0;
  399. view{
  400. background: rgba($uni-color, 0.1);
  401. padding: 10rpx 20rpx;
  402. margin: 10rpx;
  403. border-radius: 10rpx;
  404. font-size: 26rpx;
  405. }
  406. .act{
  407. color: #fff;
  408. background: $uni-color;
  409. }
  410. }
  411. }
  412. }
  413. </style>