Browse Source

temp save

liujq temp20230202 2 years ago
parent
commit
09d2c8ed6f

+ 1 - 0
src/app.jsx

@@ -79,6 +79,7 @@ class App extends Component {
           'center/saleEdit',
           'center/userEdit',
           'center/uploadRoom',
+          'center/uploadRoom2',
           'comment/add',
           'comment/list',
           'comment/dtl',

+ 2 - 1
src/components/lform/formGroup.jsx

@@ -222,6 +222,7 @@ export default class FormGroup extends Component {
       cantonLevel = 3,
       cantonLabelObj,
       cantonVerify,
+      dateFields
     } = this.props
     const { hasFooterNav = false } = this.props
     const curArr = moreOptions && moreOptions.arr ? moreOptions.arr : []
@@ -340,7 +341,7 @@ export default class FormGroup extends Component {
           curTypeStr === 'date'
           &&
           <View className={formContentStr + ' t2'}>
-            <Picker mode='date' value={curVal} className="l-form-picker" disabled={disabled} onChange={this.dateChange.bind(this)} start={startDate} >
+            <Picker mode='date' value={curVal} className="l-form-picker" disabled={disabled} onChange={this.dateChange.bind(this)} start={startDate} fields={dateFields ? dateFields : 'day'} >
               <Input type={inputType} value={curVal} disabled  className={disabled ? 'l-form-input disabled' : 'l-form-input'}  placeholder={`${placeholderSingle ? '' : keyStr2 ? keyStr2 : '请选择' + keyStr}`}/>
             </Picker>
             <Image src={signRight} className="down" />

+ 16 - 7
src/pagesMore/center/index.jsx

@@ -198,13 +198,22 @@ class Index extends Component {
         {
           userInfo.is_sale && userInfo.is_sale === '1'
           ?
-          <Navigator url="/pagesRoom/follow/lineup" className="entry-op">
-            <Image src={icon6} className="entry-icon"></Image>
-            <View className="entry-text">门店排班轮值</View>
-            <View className="entry-right">
-              <Image src={iconSign} className="sign"></Image>
-            </View>
-          </Navigator>
+          <View>
+            <Navigator url="/pagesRoom/follow/lineup" className="entry-op">
+              <Image src={icon6} className="entry-icon"></Image>
+              <View className="entry-text">门店排班轮值</View>
+              <View className="entry-right">
+                <Image src={iconSign} className="sign"></Image>
+              </View>
+            </Navigator>
+            <Navigator url="/pagesMore/center/uploadRoom2" className="entry-op">
+              <Image src={icon4} className="entry-icon"></Image>
+              <View className="entry-text">上传房源2</View>
+              <View className="entry-right">
+                <Image src={iconSign} className="sign"></Image>
+              </View>
+            </Navigator>
+          </View>
           : 
           <Navigator url="/pagesMore/center/uploadRoom" className="entry-op">
             <Image src={icon4} className="entry-icon"></Image>

+ 367 - 0
src/pagesMore/center/uploadRoom2.jsx

@@ -0,0 +1,367 @@
+import Taro, { Component } from '@tarojs/taro'
+import { View } from '@tarojs/components'
+import { AtTextarea }  from 'taro-ui'
+import LFormGroup from '@/c/lform/formGroup'
+const HLKEY = '654mca0l38b489d9'
+const CJ = require('crypto-js')
+import './uploadRoom2.scss'
+
+class Index extends Component {
+
+  onShareAppMessage() {
+    return {
+      title: `自助上传房源`,
+    }
+  }
+  onShareTimeline () {
+    return {
+      title: `自助上传房源`,
+    }
+  }
+
+
+  constructor (props) {
+    super(props)
+    this.state = {
+      addr1: '',
+      addr2: '',
+      addr3: '',
+      remark: '',
+      house_cert: '',
+      formObj: {},
+      imgArr: [],
+    }
+  }
+  config = {
+    navigationBarTitleText: '上传房源',
+  }
+
+  componentWillMount () {
+    Taro.$AHU(this)
+  }
+
+  commentChange (remark) {
+    this.setState({
+      remark
+    })
+  }
+
+  saveHandle () {
+    const { remark, formObj, imgArr, house_cert } = this.state
+    if (formObj.price && formObj.phone && house_cert) {
+      Taro.api.base.apiuserhouseadd({
+        phone: formObj.phone,
+        price: formObj.price,
+        house_cert: house_cert,
+        remark: remark,
+        images: imgArr.join(','),
+      }).then(res => {
+        this.setState({
+          remark: '',
+          house_cert: '',
+          formObj: {},
+          imgArr: [],
+        })
+        Taro.$msgConfirm('上传成功~我们审核通过后将展现在洪楼房源系统', () => {
+          Taro.navigateBack({
+            delta: 1
+          })
+        }, () => {
+          Taro.navigateBack({
+            delta: 1
+          })
+        })
+      })
+    } else {
+      Taro.$msg('联系人手机号,价格,和房产证图片必填')
+    }
+  }
+
+  baseFormChange (key, val) {
+    let { formObj } = this.state
+    formObj[key] = val
+    this.setState({
+      formObj
+    })
+  }
+
+  addHouseCertImg () {
+    this.uploadComImg((curImg) => {
+      this.setState({
+        house_cert: curImg,
+      })
+    })
+  }
+
+  addImg () {
+    this.uploadComImg((curImg) => {
+      let { imgArr } = this.state
+      imgArr.push(curImg)
+      this.setState({
+        imgArr
+      })
+    })
+  }
+  uploadComImg (bc) {
+    let token = Taro.getStorageSync('APP_token')
+    const that = this
+    Taro.chooseImage({
+      count: 1, // 默认9
+      sizeType: ['original', 'compressed'],
+      sourceType: ['album', 'camera'],
+      success: function (res) {
+        const tempFilePaths = res.tempFilePaths
+        Taro.uploadFile({
+          url: `https://api.honglouplus.com/api/upload/cloud`,
+          filePath: tempFilePaths[0],
+          name: 'upload',
+          formData: {
+            'token': token
+          },
+          success (res){
+            const msg = res.data || ''
+            const key = CJ.enc.Utf8.parse(HLKEY)
+            const bytes = CJ.AES.decrypt(msg, key, {
+              mode: CJ.mode.ECB,
+              padding: CJ.pad.Pkcs7
+            })
+            const originalText = bytes.toString(CJ.enc.Utf8)
+            const cData = JSON.parse(originalText)
+            const curImg = cData.data.url || ''
+            if (bc) bc(curImg)
+          }
+        })
+      }
+    })
+  }
+  delImg (index) {
+    let { imgArr } = this.state
+    imgArr.splice(index, 1)
+    this.setState({
+      imgArr
+    })
+  }
+  previewImageHandle (current, arr) {
+    const { imgArr } = this.state
+    Taro.previewImage({
+      current,
+      urls: imgArr
+    })
+  }
+
+  renderAddr () {
+    const { addr1, addr2, addr3 } = this.state
+    return (
+      <View className="scoped-addr-box">
+        <Input type="number" value={addr1} onInput={this.changeAddrInput.bind(this, 'addr1')}  className="i" />
+        <View className='t'>栋座</View>
+        <Input type="number" value={addr2} onInput={this.changeAddrInput.bind(this, 'addr2')}  className="i" />
+        <View className='t'>单元</View>
+        <Input type="number" value={addr3} onInput={this.changeAddrInput.bind(this, 'addr3')}  className="i" />
+        <View className='t'>室号</View>
+      </View>
+    )
+  }
+  changeAddrInput (str, e) {
+    this.setState({
+      [str]: e.detail.value
+    })
+  }
+
+
+
+
+  render () {
+    const { remark, formObj, imgArr, house_cert } = this.state
+    const dictData = Taro.getStorageSync('dictData')
+    const roomDecMoreOptions = {arr: dictData.room_dec}
+    const houseRoomYearMoreOptions = {arr: dictData.house_room_year}
+    const yesnoMoreOptions = {arr: [...dictData.sys_yesno]}
+    const addIcon = require('@img/icon_upload_img.png')
+    const closeIcon = require('@img/icon_g_close.png')
+    const imgItems = imgArr.map((src, index) => {
+      return (
+        <View className="si-op" key={index}>
+          <Image src={src} className="img" onClick={this.previewImageHandle.bind(this, src)} />
+          <Image src={closeIcon} className="i" onClick={this.delImg.bind(this, index)}/>
+        </View>
+      )
+    })
+    const moreEstateOptions = {
+      api: 'house.admestatelist',
+      opKey: 'estate_name',
+      opVal: 'id',
+      skey: 'estate_name',
+    }
+    return (
+      <View className="l-box">
+        <View className="l-floor-pos2">
+          <LFormGroup
+            val={formObj.estate_id}
+            valStr="estate_id"
+            keyStr="关联楼盘(必填)"
+            keyStr2="请选择"
+            typeStr="radio"
+            moreOptions={moreEstateOptions}
+            bc={this.baseFormChange.bind(this)}
+          />
+        </View>
+        <View className="l-floor-pos2">
+          {this.renderAddr()}
+        </View>
+        <View className="l-floor-pos2">
+          <LFormGroup
+            val={formObj.xxxxxxxxxx}
+            valStr="xxxxxxxxxx"
+            keyStr="楼层层高"
+            keyStr2="请输入"
+            bc={this.baseFormChange.bind(this)}
+          />
+        </View>
+        <View className="l-floor-pos2">
+          <LFormGroup
+            val={formObj.house_type}
+            valStr="house_type"
+            keyStr="户型"
+            keyStr2="请输入"
+            bc={this.baseFormChange.bind(this)}
+          />
+        </View>
+        <View className="l-floor-pos2">
+          <LFormGroup
+            val={formObj.area}
+            valStr="area"
+            keyStr="建筑面积(必填)"
+            keyStr2="请输入"
+            typeStr="inputFont"
+            inputFont="㎡"
+            bc={this.baseFormChange.bind(this)}
+          />
+        </View>
+        <View className="l-floor-pos2">
+          <LFormGroup
+            val={formObj.price}
+            valStr="price"
+            keyStr="总价(必填)"
+            keyStr2="请输入"
+            typeStr="inputFont"
+            inputFont="万"
+            bc={this.baseFormChange.bind(this)}
+          />
+        </View>
+        <View className="l-floor-pos2">
+          <LFormGroup
+            val={formObj.owner}
+            valStr="owner"
+            keyStr="业主姓名"
+            keyStr2="请输入"
+            bc={this.baseFormChange.bind(this)}
+          />
+        </View>
+        <View className="l-floor-pos2">
+          <LFormGroup
+            val={formObj.phone}
+            valStr="phone"
+            keyStr="业主电话"
+            keyStr2="请输入"
+            bc={this.baseFormChange.bind(this)}
+          />
+        </View>
+        <View className="l-floor-pos2">
+          <LFormGroup
+            val={formObj.is_dec}
+            valStr="is_dec"
+            keyStr="装修情况"
+            keyStr2="请选择"
+            typeStr="select"
+            moreOptions={roomDecMoreOptions}
+            bc={this.baseFormChange.bind(this)}
+          />
+        </View>
+        <View className="l-floor-pos2">
+          <LFormGroup
+            val={formObj.how_many_year}
+            valStr="how_many_year"
+            keyStr="满几年"
+            keyStr2="请选择"
+            typeStr="select"
+            moreOptions={houseRoomYearMoreOptions}
+            bc={this.baseFormChange.bind(this)}
+          />
+        </View>
+        <View className="l-floor-pos2">
+          <LFormGroup
+            val={formObj.xxxxxxxxxxxxxxxx}
+            valStr="xxxxxxxxxxxxxxxx"
+            keyStr="有电梯"
+            keyStr2="请选择"
+            typeStr="select"
+            moreOptions={yesnoMoreOptions}
+            bc={this.baseFormChange.bind(this)}
+          />
+        </View>
+        <View className="l-floor-pos2">
+          <LFormGroup
+            val={formObj.xxxxxxxxxxxxxxxxx}
+            valStr="xxxxxxxxxxxxxxxxx"
+            keyStr="交房时间"
+            keyStr2="请选择"
+            dateFields="month"
+            typeStr="date"
+            bc={this.baseFormChange.bind(this)}
+          />
+        </View>
+
+
+        <View className="scoped-box">
+          <View className="sb-title">房产证图片(必填)</View>
+          <View className="scoped-img">
+            {
+              house_cert
+              ?
+              <View className="si-op" onClick={this.addHouseCertImg.bind(this)}>
+                <Image src={house_cert} className="img"/>
+              </View>
+              :
+              <View className="si-op" onClick={this.addHouseCertImg.bind(this)}>
+                <Image src={addIcon} className="img"/>
+              </View>
+            }
+          </View>
+        </View>
+        <View className="scoped-box">
+          <View className="sb-title">房源图片
+            <View className="s">(最多9张)</View>
+          </View>
+          <View className="scoped-img">
+            {imgItems}
+            {
+              imgArr.length < 9
+              &&
+              <View className="si-op" onClick={this.addImg.bind(this)}>
+                <Image src={addIcon} className="img"/>
+              </View>
+            }
+          </View>
+        </View>
+        <View className="scoped-box">
+          <View className="sb-title">更多对外描述</View>
+          <AtTextarea
+            value={remark}
+            onChange={this.commentChange.bind(this)}
+            maxLength={300}
+            height={200}
+            placeholder='更多需要补充的描述,对外公开(300字以内)'
+          />
+        </View>
+        <View className="l-floor-footer t2">
+          <View className="lff-flex">
+            <View className="lff-btn full" onClick={this.saveHandle.bind(this)}>提交</View>
+          </View>
+        </View>
+      </View>
+    )
+  }
+}
+
+export default Index

+ 74 - 0
src/pagesMore/center/uploadRoom2.scss

@@ -0,0 +1,74 @@
+@import '@css/mixin.scss';
+.scoped-box {
+  padding: 20px 20px 0;
+  .sb-title {
+    font-size: 30px;
+    color: #333;
+    padding-bottom: 20px;
+    font-weight: bold;
+    padding-left: 10px;
+    .s {
+      display: inline-block;
+      font-size: 24px;
+      color: #999;
+      font-weight: normal;
+    }
+  }
+}
+.at-textarea {
+  border: 1PX solid #f2f2f2;
+}
+.at-textarea__textarea {
+  font-size: 28px;
+  color: #333;
+}
+
+.scoped-img {
+  .si-op {
+    display: inline-block;
+    vertical-align: middle;
+    width: 200px;
+    height: 200px;
+    margin-right: 30px;
+    margin-bottom: 30px;
+    position: relative;
+    border: 1PX solid #f2f2f2;
+    .img {
+      width: 200px;
+      height: 200px;
+    }
+    .i {
+      position: absolute;
+      top: -20px;
+      right: -20px;
+      width: 40px;
+      height: 40px;
+    }
+  }
+}
+
+
+
+
+
+
+
+.scoped-addr-box {
+  display: flex;
+  height: 60px;
+  padding: 20px;
+  border-bottom: 1PX solid #f2f2f2;
+  .i {
+    flex: 3;
+    font-size: 30px;
+    line-height: 60px;
+    text-align: right;
+    padding-right: 10px;
+  }
+  .t {
+    flex: 2;
+    font-size: 30px;
+    color: #999;
+    line-height: 60px;
+  }
+}