liujq 4 anos atrás
pai
commit
f870b2ba71

+ 17 - 45
src/views/house/components/popup/LotteryEdit.vue

@@ -1,17 +1,16 @@
 <template>
   <div>
-    <el-dialog
-      v-loading="loading"
+    <el-drawer
       :show-close="false"
-      :close-on-click-modal="false"
-      :visible.sync="isShow"
       :title="curObj.estate_id ? '编辑摇号信息' : '新增摇号信息'"
-      :fullscreen="false"
-      width="700px"
-      custom-class="xl-dialog"
-      center
+      :wrapper-closable="false"
+      :close-on-press-escape="false"
+      :visible.sync="isShow"
+      size="960px"
+      custom-class="xl-drawer"
+      direction="rtl"
     >
-      <base-form ref="ruleForm" class="lib-edit" :data="formData" :is-inline="false" label-width="110px" :insertSlotArr="[0, 1]">
+      <base-form ref="ruleForm" class="lib-edit" :data="formData" :is-inline="false" label-width="110px" :insertSlotArr="[0]">
         <div slot="OI0" class="scoped-other-form">
           <div class="scoped-img-area">
             <div class="sia-title">项目图</div>
@@ -32,26 +31,6 @@
             </el-upload>
           </div>
         </div>
-        <div slot="OI1" class="scoped-other-form">
-          <div class="scoped-img-area">
-            <div class="sia-title">一房一价图</div>
-            <div class="sia-op" v-for="(imgsrc,index) in houseImg" :key="index">
-              <img class="img" :src="imgsrc" alt="img">
-              <span class="close" @click="houseImgDel(index)"></span>
-            </div>
-            <el-upload
-              class="sia-img"
-              :action="`${domainUrl}/adm/upload/cloudpub`"
-              :data="{logic_type: 'estate', token}"
-              name="upload"
-              :show-file-list="false"
-              :on-success="houseImgSuccess"
-              :before-upload="imgUploadBefore"
-              >
-              <i class="el-icon-plus icon" />
-            </el-upload>
-          </div>
-        </div>
         <div slot="otherItem" class="scoped-other-form">
           <div class="scoped-img-area">
             <div class="sia-title">摇号结果图</div>
@@ -72,12 +51,14 @@
             </el-upload>
           </div>
         </div>
-        <div slot="footer" style="padding-top: 20px;">
+      </base-form>
+      <div class="xl-form">
+        <div class="xl-form-footer fixed" style="width:960px;padding-top: 20px;border-top: 1px solid #dcdcdc;right:0;">
           <el-button class="xl-form-btn t2" @click="close">关 闭</el-button>
           <el-button class="xl-form-btn t1" @click="close('confirm')">确定</el-button>
         </div>
-      </base-form>
-    </el-dialog>
+      </div>
+    </el-drawer>
   </div>
 </template>
 <script>
@@ -99,7 +80,6 @@ export default {
       loading: true,
       cObj: {},
       infoImg: [],
-      houseImg: [],
       lotteryImg: [],
     }
   },
@@ -107,12 +87,10 @@ export default {
     isShow: function(val) {
       if (val) {
         this.infoImg = []
-        this.houseImg = []
         this.lotteryImg = []
         this.$api.house.admestatelotterydetail({estate_id: this.curObj.estate_id}).then(res => {
           this.cObj = res || {}
           if (res.info_img) this.infoImg = res.info_img.split(',')
-          if (res.house_img) this.houseImg = res.house_img.split(',')
           if (res.lottery_img) this.lotteryImg = res.lottery_img.split(',')
           this.getDef()
         })
@@ -137,13 +115,6 @@ export default {
     lotteryImgSuccess(res, file) {
       this.comImgSuccess('lotteryImg', res)
     },
-    houseImgDel (index) {
-      this.houseImg.splice(index, 1)
-      this.houseImg = [...this.houseImg]
-    },
-    houseImgSuccess(res, file) {
-      this.comImgSuccess('houseImg', res)
-    },
     infoImgDel (index) {
       this.infoImg.splice(index, 1)
       this.infoImg = [...this.infoImg]
@@ -165,7 +136,9 @@ export default {
     getDef() {
       const params = { ...this.cObj }
       this.formData = [
+        { label: '摇号期数', key: 'a' },
         { label: '摇号中标题', key: 'under_way' },
+        { label: '摇号中时间', key: 'test', type: 'datePicker' },
         { label: '摇号结果标题', key: 'result' },
       ]
       this.setDefaultValue(params)
@@ -175,6 +148,8 @@ export default {
         this.$refs['ruleForm'].$refs['baseForm'].validate((valid) => {
           if (valid) {
             const oldform = this.$refs.ruleForm.baseForm
+            console.log(oldform)
+            return
             const newForm = { ...oldform }
             if (this.curObj.estate_id) {
               newForm.estate_id = this.curObj.estate_id
@@ -182,9 +157,6 @@ export default {
             if (this.infoImg && this.infoImg.length > 0) {
               newForm.info_img = this.infoImg.join(',')
             }
-            if (this.houseImg && this.houseImg.length > 0) {
-              newForm.house_img = this.houseImg.join(',')
-            }
             if (this.lotteryImg && this.lotteryImg.length > 0) {
               newForm.lottery_img = this.lotteryImg.join(',')
             }

+ 280 - 0
src/views/house/components/popup/LotteryEdit2.vue

@@ -0,0 +1,280 @@
+<template>
+  <div>
+    <el-dialog
+      v-loading="loading"
+      :show-close="false"
+      :close-on-click-modal="false"
+      :visible.sync="isShow"
+      :title="curObj.estate_id ? '编辑摇号信息' : '新增摇号信息'"
+      :fullscreen="false"
+      width="700px"
+      custom-class="xl-dialog"
+      center
+    >
+      <base-form ref="ruleForm" class="lib-edit" :data="formData" :is-inline="false" label-width="110px" :insertSlotArr="[0, 1]">
+        <div slot="OI0" class="scoped-other-form">
+          <div class="scoped-img-area">
+            <div class="sia-title">项目图</div>
+            <div class="sia-op" v-for="(imgsrc,index) in infoImg" :key="index">
+              <img class="img" :src="imgsrc" alt="img">
+              <span class="close" @click="infoImgDel(index)"></span>
+            </div>
+            <el-upload
+              class="sia-img"
+              :action="`${domainUrl}/adm/upload/cloudpub`"
+              :data="{logic_type: 'estate', token}"
+              name="upload"
+              :show-file-list="false"
+              :on-success="infoImgSuccess"
+              :before-upload="imgUploadBefore"
+              >
+              <i class="el-icon-plus icon" />
+            </el-upload>
+          </div>
+        </div>
+        <div slot="OI1" class="scoped-other-form">
+          <div class="scoped-img-area">
+            <div class="sia-title">一房一价图</div>
+            <div class="sia-op" v-for="(imgsrc,index) in houseImg" :key="index">
+              <img class="img" :src="imgsrc" alt="img">
+              <span class="close" @click="houseImgDel(index)"></span>
+            </div>
+            <el-upload
+              class="sia-img"
+              :action="`${domainUrl}/adm/upload/cloudpub`"
+              :data="{logic_type: 'estate', token}"
+              name="upload"
+              :show-file-list="false"
+              :on-success="houseImgSuccess"
+              :before-upload="imgUploadBefore"
+              >
+              <i class="el-icon-plus icon" />
+            </el-upload>
+          </div>
+        </div>
+        <div slot="otherItem" class="scoped-other-form">
+          <div class="scoped-img-area">
+            <div class="sia-title">摇号结果图</div>
+            <div class="sia-op" v-for="(imgsrc,index) in lotteryImg" :key="index">
+              <img class="img" :src="imgsrc" alt="img">
+              <span class="close" @click="lotteryImgDel(index)"></span>
+            </div>
+            <el-upload
+              class="sia-img"
+              :action="`${domainUrl}/adm/upload/cloudpub`"
+              :data="{logic_type: 'estate', token}"
+              name="upload"
+              :show-file-list="false"
+              :on-success="lotteryImgSuccess"
+              :before-upload="imgUploadBefore"
+              >
+              <i class="el-icon-plus icon" />
+            </el-upload>
+          </div>
+        </div>
+        <div slot="footer" style="padding-top: 20px;">
+          <el-button class="xl-form-btn t2" @click="close">关 闭</el-button>
+          <el-button class="xl-form-btn t1" @click="close('confirm')">确定</el-button>
+        </div>
+      </base-form>
+    </el-dialog>
+  </div>
+</template>
+<script>
+export default {
+  components: { },
+  mixins,
+  props: {
+    isShow: Boolean,
+    curObj: Object
+  },
+  inject: ['parentData'],
+  data() {
+    let domainUrl = process.env.VUE_APP_BASE_API
+    const token = window.sessionStorage.getItem('fp_token')
+    return {
+      domainUrl,
+      token,
+      formData: [],
+      loading: true,
+      cObj: {},
+      infoImg: [],
+      houseImg: [],
+      lotteryImg: [],
+    }
+  },
+  watch: {
+    isShow: function(val) {
+      if (val) {
+        this.infoImg = []
+        this.houseImg = []
+        this.lotteryImg = []
+        this.$api.house.admestatelotterydetail({estate_id: this.curObj.estate_id}).then(res => {
+          this.cObj = res || {}
+          if (res.info_img) this.infoImg = res.info_img.split(',')
+          if (res.house_img) this.houseImg = res.house_img.split(',')
+          if (res.lottery_img) this.lotteryImg = res.lottery_img.split(',')
+          this.getDef()
+        })
+      }
+    },
+  },
+  methods: {
+    comImgDel (str, index) {
+      let cImg = this[str]
+      cImg.splice(index, 1)
+      this[str] = [...cImg]
+    },
+    comImgSuccess(str, res) {
+      const data = res.data || {}
+      let cImg = [...this[str]]
+      cImg.push(`${data.url}`)
+      this[str] = [...cImg]
+    },
+    lotteryImgDel (index) {
+      this.comImgDel('lotteryImg', index)
+    },
+    lotteryImgSuccess(res, file) {
+      this.comImgSuccess('lotteryImg', res)
+    },
+    houseImgDel (index) {
+      this.houseImg.splice(index, 1)
+      this.houseImg = [...this.houseImg]
+    },
+    houseImgSuccess(res, file) {
+      this.comImgSuccess('houseImg', res)
+    },
+    infoImgDel (index) {
+      this.infoImg.splice(index, 1)
+      this.infoImg = [...this.infoImg]
+    },
+    infoImgSuccess(res, file) {
+      this.comImgSuccess('infoImg', res)
+    },
+    imgUploadBefore(file) {
+      const isJPGPNG = file.type === 'image/jpeg' || file.type === 'image/png'
+      const isLt2M = file.size / 1024 / 1024 < 5
+      if (!isJPGPNG) {
+        this.$message.error('上传图片只能是 JPG PNG 格式!')
+      }
+      if (!isLt2M) {
+        this.$message.error('上传图片大小不能超过 5M!')
+      }
+      return isJPGPNG && isLt2M
+    },
+    getDef() {
+      const params = { ...this.cObj }
+      this.formData = [
+        { label: '摇号中标题', key: 'under_way' },
+        { label: '摇号结果标题', key: 'result' },
+      ]
+      this.setDefaultValue(params)
+    },
+    close(str) {
+      if (str === 'confirm') {
+        this.$refs['ruleForm'].$refs['baseForm'].validate((valid) => {
+          if (valid) {
+            const oldform = this.$refs.ruleForm.baseForm
+            const newForm = { ...oldform }
+            if (this.curObj.estate_id) {
+              newForm.estate_id = this.curObj.estate_id
+            }
+            if (this.infoImg && this.infoImg.length > 0) {
+              newForm.info_img = this.infoImg.join(',')
+            }
+            if (this.houseImg && this.houseImg.length > 0) {
+              newForm.house_img = this.houseImg.join(',')
+            }
+            if (this.lotteryImg && this.lotteryImg.length > 0) {
+              newForm.lottery_img = this.lotteryImg.join(',')
+            }
+            let apiStr = 'admestatelotterychange'
+            this.$api.house[apiStr](newForm).then(data => {
+              this.$msgs(newForm.id ? '编辑成功' : '新增成功')
+              this.$emit('close', newForm)
+            })
+          }
+        })
+      } else {
+        this.$emit('close')
+        this.setDefaultValue()
+      }
+    }
+  }
+}
+</script>
+<style lang="scss" scoped>
+@import '../../../../styles/libEdit.scss';
+.lib-edit {
+  padding-top: 0;
+  ::v-deep .el-form-item {
+    margin-bottom: 10px;
+  }
+  ::v-deep .el-date-editor.el-input {
+    width: 100%;
+  }
+}
+
+.scoped-img-area {
+  padding-left: 20px;
+  margin-bottom: 20px;
+  .sia-title {
+    font-size: 12px;
+    padding-bottom: 10px;
+    color: #666;
+    font-weight: bold;
+  }
+  .sia-op {
+    display: inline-block;
+    vertical-align: middle;
+    margin-right: 10px;
+    margin-bottom: 10px;
+    border: 1px solid #f2f2f2;
+    width: 80px;
+    height: 80px;
+    position: relative;
+    &:hover {
+      .img-big {
+        display: block;
+      }
+    }
+    .img {
+      width: 80px;
+      height: 80px;
+    }
+    .close {
+      position: absolute;
+      width: 20px;
+      height: 20px;
+      top: -10px;
+      right: -10px;
+      background: url(../../../../assets/icon_g_close.png) no-repeat;
+      background-size: 20px;
+      cursor: pointer;
+    }
+    .img-big {
+      position: absolute;
+      bottom: 0;
+      left: 0;
+      width: 400px;
+      height: auto;
+      display: none;
+      box-shadow: 10px 10px 10px #ccc;
+      z-index: 99;
+    }
+  }
+  .sia-img {
+    display: inline-block;
+    vertical-align: middle;
+    width: 80px;
+    height: 80px;
+    overflow: hidden;
+    border: 1px dashed #999;
+    margin-bottom: 10px;
+    .el-icon-plus {
+      color: #999;
+      padding: 30px;
+    }
+  }
+}
+</style>

+ 126 - 0
src/views/house/components/popup/LotteryList.vue

@@ -0,0 +1,126 @@
+<template>
+  <div>
+    <el-drawer
+      :show-close="false"
+      :title="curObj.id ? '编辑楼盘摇号信息' : '新增楼盘摇号信息'"
+      :wrapper-closable="false"
+      :close-on-press-escape="false"
+      :visible.sync="isShow"
+      size="960px"
+      custom-class="xl-drawer"
+      direction="rtl"
+    >
+      <table-list
+        :list-loading="listLoading"
+        :data="tableData2"
+        :columns="listConfig"
+        :current-page="currentPage"
+        :page-size="pageSize"
+        :total-records="totalRecords"
+        @currentChange="pageHandle"
+        :isAdd="true"
+        @add="openLEPopup"
+      />
+      <div class="xl-form">
+        <div class="xl-form-footer fixed" style="width:960px;padding-top: 20px;border-top: 1px solid #dcdcdc;right:0;">
+          <el-button class="xl-form-btn t2" @click="close">关 闭</el-button>
+        </div>
+      </div>
+    </el-drawer>
+    <lottery-edit
+      :isShow="isLEShow"
+      :curObj="cObj"
+      @close="closeLEPopup"
+    />
+  </div>
+</template>
+<script>
+import baseTable from '_m/baseTable.js'
+import LotteryEdit from './LotteryEdit'
+export default {
+  components: {
+    LotteryEdit
+  },
+  mixins: [baseTable],
+  props: {
+    isShow: Boolean,
+    curObj: Object
+  },
+  inject: ['parentData'],
+  data() {
+    return {
+      apiStr: 'house.admpricelist',
+      searchForm: {},
+      noCreated: true,
+      isLEShow: false,
+      cObj: {},
+    }
+  },
+  computed: {
+    tableData2() {
+      const arr = [...this.tableData, {a: '第一期', b1: '2021-05-20', b2: '2021-06-10', c: '#12栋共计192套'}]
+      arr.map(item => {
+      })
+      return arr
+    }
+  },
+  mounted() {
+    this.listConfig = {
+      rows: [
+        { label: '期数', prop: 'a'},
+        { label: '摇号中标题', prop: 'c'},
+        { label: '开始时间', prop: 'b1'},
+        { label: '结束时间', prop: 'b2'},
+        { label: '摇号结果标题', prop: 'd'},
+        { label: '操作', width: 120, type: 'handle2', operations:
+          [
+            { label: '编辑', func: this.openLEPopup, btnType: 'primary' },
+            { label: '删除', func: this.delHandle, btnType: 'danger' },
+          ]
+        }
+      ]
+    }
+  },
+  watch: {
+    isShow: function(val) {
+      if (val) {
+        // this.$api.house.admestatelotterydetail({estate_id: this.curObj.estate_id}).then(res => {
+        //   console.log(res)
+        // })
+      }
+    },
+  },
+  methods: {
+    delHandle(row) {
+      this.$msg(`您确定要删除该楼盘吗?`, 'confirm', () => {
+        this.$api.house.admpricedel({
+          id: row.id,
+        }).then(data => {
+          this.$msgs(`已删除!`)
+          this.fetchData()
+        })
+      }, null, true)
+    },
+    openLEPopup(row) {
+      this.cObj = {...this.curObj}
+      // if (row && row.id) {
+      //   this.cObj = row
+      // } else {
+      //   this.cObj = {}
+      // }
+      this.isLEShow = true
+    },
+    closeLEPopup(obj) {
+      this.isLEShow = false
+      if (obj) {
+        this.fetchData()
+      }
+    },
+    close(str) {
+      this.$emit('close')
+    }
+  }
+}
+</script>
+<style lang="scss" scoped>
+</style>

+ 2 - 1
src/views/house/theme.vue

@@ -35,7 +35,8 @@
 import { arrToObj } from '@/utils'
 import SearchForm from './components/searchForm/Theme'
 import PopupEdit from './components/popup/ThemeEdit'
-import LotteryEdit from './components/popup/LotteryEdit'
+import LotteryEdit from './components/popup/LotteryEdit2'
+// import LotteryEdit from './components/popup/LotteryList'
 import baseTable from '_m/baseTable.js'
 export default {
   name: 'old',