230320a303 1 year ago
parent
commit
4cf3918cbb

+ 9 - 0
src/api/house.js

@@ -308,4 +308,13 @@ export default {
   admeshouseshow: params => { // 新版 小程序上房源  显示隐藏
     return getRequest('/adm/eshouse/show', params, 'loading')
   },
+  admeshouseadd: params => { // 上房源  添加
+    return getRequestNoSort('/adm/eshouse/add', params, 'loading')
+  },
+  admeshouseedit: params => { // 上房源  编辑
+    return getRequestNoSort('/adm/eshouse/edit', params, 'loading')
+  },
+  admeshousedetail: params => { // 上房源  详情
+    return getRequestNoSort('/adm/eshouse/detail', params, 'loading')
+  },
 }

+ 148 - 45
src/views/room/components/popup/IndexEdit.vue

@@ -11,8 +11,50 @@
       custom-class="xl-dialog"
       center
     >
-      <base-form ref="ruleForm" :class="estate_id ? 'lib-edit' : 'lib-edit scoped-le2' " :data="formData" :is-inline="false" label-width="110px" :insertSlotArr="[8]">
-        <div slot="OI8">
+      <base-form ref="ruleForm" :class="estate_id ? 'lib-edit' : 'lib-edit scoped-le2' " :data="formData" :is-inline="false" label-width="110px" :insertSlotArr="[2,4]">
+        <div class="scoped-form-diy" slot="OI2">
+          <div class="sfd-item">
+            <div class="l">地址</div>
+            <div class="r">
+              <input type="text" v-model="diyFormObj.addr1" class="i"/>
+              <div class="dot">栋座</div>
+              <input type="text" v-model="diyFormObj.addr2" class="i" />
+              <div class="dot">单元</div>
+              <input type="text" v-model="diyFormObj.addr3" class="i" />
+              <div class="dot">室号</div>
+            </div>
+          </div>
+          <div class="sfd-item">
+            <div class="l">户型</div>
+            <div class="r">
+              <input type="text" v-model="diyFormObj.hType1" class="i"/>
+              <div class="dot">室</div>
+              <input type="text" v-model="diyFormObj.hType2" class="i" />
+              <div class="dot">厅</div>
+              <input type="text" v-model="diyFormObj.hType3" class="i" />
+              <div class="dot">卫</div>
+            </div>
+          </div>
+          <div class="sfd-item">
+            <div class="l">楼层</div>
+            <div class="r">
+              <input type="text" v-model="cObj.floor" class="i"/>
+              <div class="dot t2">/</div>
+              <input type="text" v-model="cObj.storeys" class="i" />
+              <div class="dot">层</div>
+            </div>
+          </div>
+          <div class="sfd-item">
+            <div class="l">梯户比</div>
+            <div class="r">
+              <input type="text" v-model="diyFormObj.sRate1" class="i"/>
+              <div class="dot">梯</div>
+              <input type="text" v-model="diyFormObj.sRate2" class="i" />
+              <div class="dot">户</div>
+            </div>
+          </div>
+        </div>
+        <div slot="OI4">
           <div class="scoped-img-area">
             <div class="sia-op" v-for="(imgsrc,index) in imagesArr" :key="index">
               <img class="img" :src="imgsrc + '_adm0'" alt="img">
@@ -31,13 +73,6 @@
             </el-upload>
           </div>
         </div>
-        <div slot="OI8" class="scoped-other-form">
-          <el-form-item label="点位坐标" class="scoped-item-two item">
-            纬度N<el-input v-model="cObj.latitude" disabled />
-            经度E<el-input v-model="cObj.longitude" disabled />
-            <el-button type="primary" class="map-btn" size="small" @click="openMap">点击从地图获取</el-button>
-          </el-form-item>
-        </div>
         <div slot="footer">
           <el-button class="xl-form-btn t2" @click="close">关 闭</el-button>
           <el-button class="xl-form-btn t1" @click="close('confirm')">确定</el-button>
@@ -71,6 +106,7 @@ export default {
       imagesArr: [],
       roomAreaList: [],
       estate_id: '',
+      diyFormObj: {},
     }
   },
   watch: {
@@ -78,11 +114,27 @@ export default {
       if (val) {
         if (this.curObj.id) {
           this.loading = true
-          this.$api.house.admoldhousedetail({id: this.curObj.id}).then(res => {
-            let curData = res || {}
-            this.imagesArr = curData.images ? curData.images.split(',') : []
-            this.cObj = curData || {}
+          this.$api.house.admeshousedetail({id: this.curObj.id}).then(res => {
+            let cObj = res || {}
+            this.imagesArr = cObj.images ? cObj.images.split(',') : []
+            this.cObj = {...cObj}
             this.getDef()
+            let diyFormObj = {...this.diyFormObj}
+            const addr = cObj.house_no ? cObj.house_no.split('-') : []
+            const hType = cObj.house_type ? cObj.house_type.split('-') : []
+            const sRate = cObj.stairs_rate ? cObj.stairs_rate.split('-') : []
+            diyFormObj = {
+              addr1: addr[0],
+              addr2: addr[1],
+              addr3: addr[2],
+              hType1: hType[0],
+              hType2: hType[1],
+              hType3: hType[2],
+              sRate1: sRate[0],
+              sRate2: sRate[1],
+            }
+            console.log(diyFormObj)
+            this.diyFormObj = {...diyFormObj}
             this.loading = false
           })
         } else {
@@ -128,30 +180,17 @@ export default {
               { keyRO: params.estate_name, valRO: params.estate_id }
             ]
           },
-          { label: `面积产品户型`, label2: `快捷选择工具`, key: `HT`, type: 'select', options: this.roomAreaList, changeHandle: this.htChange,},
-          { label: '面积', key: 'area', class: 'c-3', type: 'inputFont', appendFont: '㎡', rules: [
-            { validator: (rule, value, callback) => {
-              if (Number(value) < 0 || isNaN(Number(value))) {
-                callback(new Error('请输入数字'))
-              } else {
-                callback()
-              }
-            }, trigger: 'blur' },
-          ]},
-          { label: '产品类型', key: 'product_type', class: 'c-3', type: 'select', options: this.$dictData.product_type},
-          { label: '房源户型', key: 'house_type', class: 'c-3', type: 'select', options: this.$dictData.house_type},
+          // { label: `面积产品户型`, label2: `快捷选择工具`, class: 'c-3', key: `HT`, type: 'select', options: this.roomAreaList, changeHandle: this.htChange,},
+          
           { label: '房源标题', key: 'title', rules: 1},
-          { label: '户型图', key: 'house_img', class: 'c-3', type: 'upload' },
+          { label: '户型图', key: 'house_img', class: 'c-3', type: 'uploads' },
           { label: '房源封面', key: 'pri_image', rules: 1, class: 'c-3', type: 'cuImg',
             options: {
               w: 375,
               h: 250,
-              SY: 1,
             }
           }, 
-          { label: '房源地址', key: 'address', class: 'c-3s' },
-          { label: '区域', key: 'area_type', class: 'c-3', type: 'select', options: this.$dictData.area_type},
-          { label: '总价', key: 'price', class: 'c-3', type: 'inputFont', appendFont: '万元', rules: [
+          { label: '面积', key: 'area', class: 'c-3', type: 'inputFont', appendFont: '㎡', rules: [
             { validator: (rule, value, callback) => {
               if (Number(value) < 0 || isNaN(Number(value))) {
                 callback(new Error('请输入数字'))
@@ -160,7 +199,7 @@ export default {
               }
             }, trigger: 'blur' },
           ]},
-          { label: '层高', class: 'c-3', key: 'floor_height', rules: [
+          { label: '总价', key: 'price', class: 'c-3', type: 'inputFont', appendFont: '万元', rules: [
             { validator: (rule, value, callback) => {
               if (Number(value) < 0 || isNaN(Number(value))) {
                 callback(new Error('请输入数字'))
@@ -168,8 +207,8 @@ export default {
                 callback()
               }
             }, trigger: 'blur' },
-          ] },
-          { label: '总层数', class: 'c-3', key: 'height', rules: [
+          ]},
+          { label: '实际总价', key: 'floor_price', class: 'c-3', type: 'inputFont', appendFont: '万元', rules: [
             { validator: (rule, value, callback) => {
               if (Number(value) < 0 || isNaN(Number(value))) {
                 callback(new Error('请输入数字'))
@@ -177,12 +216,15 @@ export default {
                 callback()
               }
             }, trigger: 'blur' },
-          ] },
-          { label: '详细地址', label2: '如:1栋2单元305室', class: 'c-3', key: 'detail_address' },
-          { label: '满几年', key: 'how_many_year', class: 'c-3', type: 'select', options: this.$dictData.house_room_year },
-          { label: '装修状态', key: 'is_dec', class: 'c-3', type: 'select', options: this.$dictData.room_dec },
+          ]},
           { label: '业主称呼', class: 'c-3', key: 'owner' },
-          { label: '业主电话', class: 'c-3', key: 'phone' },
+          { label: '业主电话', class: 'c-3', key: 'owner_phone' },
+          { label: '装修状态', key: 'is_dec', class: 'c-3', type: 'select', options: this.$dictData.room_dec },
+          { label: '满几年', key: 'full_year', class: 'c-3', type: 'select', options: this.$dictData.house_room_year },
+          { label: '有电梯', key: 'is_elevator', class: 'c-3', type: 'select', options: this.$dictData.sys_yesno },
+          { label: '交房时间', key: 'delivery_at', type: 'datePicker', class: 'c-3', type2: 'month', valueFormat: 'yyyy-MM'},
+          { label: '显示隐藏', key: 'hide_status', class: 'c-3', type: 'select', options: this.$dictData.hide_status },
+          { label: '户型方位', key: 'position', class: 'c-3', type: 'select', options: this.$dictData.room_position },
           { label: '自定义标签', class: 'c-3', key: 'custom_tag', rules: 1 },
           { label: '置业经理', key: 'sale_id', rules: 1, class: 'c-3', type: 'selectRemote',
             remoteParams: { skey: 'sale_name', api: `user.admsaleuserlist?page_size=999`, opKey: 'sale_name', opVal: 'id' },
@@ -255,18 +297,43 @@ export default {
             const oldform = this.$refs.ruleForm.baseForm
             const newForm = { ...oldform }
             if (this.curObj.id) newForm.id = this.curObj.id
-            newForm.longitude = this.cObj.longitude
-            newForm.latitude = this.cObj.latitude
-            if (!newForm.longitude) return this.$msgw('请选择经度!')
-            else if (!newForm.latitude) return this.$msgw('请选择纬度!')
+            if (this.diyFormObj.addr1 && this.diyFormObj.addr2 && this.diyFormObj.addr3) {
+              newForm.house_no = `${this.diyFormObj.addr1}-${this.diyFormObj.addr2}-${this.diyFormObj.addr3}`
+            } else {
+              this.$msg('请输入楼栋单号房间号')
+              return
+            }
+            if (this.diyFormObj.hType1 && this.diyFormObj.hType2 && this.diyFormObj.hType3) {
+              newForm.house_type = `${this.diyFormObj.hType1}-${this.diyFormObj.hType2}-${this.diyFormObj.hType3}`
+            } else {
+              this.$msg('请输入户型')
+              return
+            }
+            if (this.diyFormObj.sRate1 && this.diyFormObj.sRate2) {
+              newForm.stairs_rate = `${this.diyFormObj.sRate1}-${this.diyFormObj.sRate2}`
+            } else {
+              this.$msg('请输入梯户比')
+              return
+            }
+            if (this.cObj.floor && this.cObj.storeys) {
+              newForm.floor = this.cObj.floor
+              newForm.storeys = this.cObj.storeys
+            } else {
+              this.$msg('请输入楼层')
+              return
+            }
+            // newForm.longitude = this.cObj.longitude
+            // newForm.latitude = this.cObj.latitude
+            // if (!newForm.longitude) return this.$msgw('请选择经度!')
+            // else if (!newForm.latitude) return this.$msgw('请选择纬度!')
             const imgUrlArr = this.imagesArr.map(urlStr => {
               return urlStr
             })
             newForm.images = imgUrlArr.join(',')
             newForm.pri_image = this.IMdel(newForm.pri_image)
             newForm.custom_tag = newForm.custom_tag.replace(/,|、|\/|\\/g, ',')
-            let apiStr = 'admoldhouseadd'
-            if (this.curObj.id) apiStr = 'admoldhouseedit'
+            let apiStr = 'admeshouseadd'
+            if (this.curObj.id) apiStr = 'admeshouseedit'
             this.$api.house[apiStr](newForm).then(data => {
               this.$msgs(newForm.id ? '编辑成功' : '新增成功')
               this.productData = []
@@ -335,7 +402,7 @@ export default {
 }
 .scoped-img-area {
   text-align: left;
-  width: 280px;
+  padding: 0 40px;
   .sia-op {
     display: inline-block;
     vertical-align: middle;
@@ -389,4 +456,40 @@ export default {
     }
   }
 }
+
+
+.scoped-form-diy {
+  width: 100%;
+  .sfd-item {
+    padding-bottom: 16px;
+    display: flex;
+    .l {
+      width: 110px;
+      text-align: right;
+      padding-right: 12px;
+      font-size: 14px;
+      color: #606266;
+      font-weight: bold;
+    }
+    .r {
+      flex: 1;
+    }
+    .i {
+      border: 0;
+      border-bottom: 1px solid #dcdcdc;
+      width: 50px;
+      text-align: center;
+      outline: none;
+    }
+    .dot {
+      display: inline-block;
+      width: 50px;
+      &.t2 {
+        text-align: center;
+      }
+    }
+  }
+}
+
+
 </style>

+ 4 - 2
src/views/room/components/searchForm/Index.vue

@@ -2,6 +2,7 @@
   <base-form slot="content" ref="ruleForm" :data="searchData">
     <div slot="footer">
       <el-button :loading="listLoading" icon="el-icon-search" class="xl-form-btn bgc1" @click="searchHandle">查询</el-button>
+      <el-button :loading="listLoading" icon="el-icon-plus" class="xl-form-btn bgc2" @click="addHandle">添加房源</el-button>
       <!-- <el-button :loading="listLoading" icon="el-icon-document" class="xl-form-btn bgc2" @click="toExportExcel">导出{{ this.$route.meta.title }}信息</el-button> -->
     </div>
   </base-form>
@@ -22,8 +23,9 @@ export default {
     this.getDef()
   },
   methods: {
-    subwayLineChange (val) {
-      this.getDef('change')
+    addHandle () {
+      this.parentData.isDtlShow = true
+      this.parentData.curObj = {}
     },
     getDef (str) {
       let params = { ...this.$refs.ruleForm.baseForm }

+ 2 - 1
src/views/room/index.vue

@@ -75,8 +75,9 @@ export default {
         { label: '更新时间', prop: 'update_at' },
         { label: '创建人', prop: 'sale_name' },
         { label: '创建时间', prop: 'create_at' },
-        { label: '操作', width: 80, type: 'handle2', operations:
+        { label: '操作', width: 160, type: 'handle2', operations:
           [
+            { label: '编辑', func: this.openPopup, btnType: 'primary' },
             { labelFor: 'hide_status', disabled: true, func: this.statusHandle, hide: 'nosys',
               labelConfig: {
                 texts: {