liujq 4 år sedan
förälder
incheckning
ea211a612e
3 ändrade filer med 192 tillägg och 3 borttagningar
  1. 12 0
      src/api/other.js
  2. 153 0
      src/views/house/components/popup/HelpRule.vue
  3. 27 3
      src/views/house/index.vue

+ 12 - 0
src/api/other.js

@@ -40,4 +40,16 @@ export default {
   plandel: params => { // 获客意向收集 删除
     return getRequest('/adm/plan/del', params)
   },
+  admactivityruleedit: params => { // 团购助力活动规则 编辑
+    return getRequestNoSort('/adm/activity/rule/edit', params, 'loading')
+  },
+  admactivityruleadd: params => { // 团购助力活动规则 添加
+    return getRequestNoSort('/adm/activity/rule/add', params, 'loading')
+  },
+  admactivityruledel: params => { // 团购助力活动规则 删除
+    return getRequestNoSort('/adm/activity/rule/del', params, 'loading')
+  },
+  admactivityruledetail: params => { // 团购助力活动规则 详情
+    return getRequestNoSort('/adm/activity/rule/detail', params, 'loading')
+  },
 }

+ 153 - 0
src/views/house/components/popup/HelpRule.vue

@@ -0,0 +1,153 @@
+<template>
+  <div>
+    <el-dialog
+      v-loading="loading"
+      :show-close="false"
+      :close-on-click-modal="false"
+      :visible.sync="isShow"
+      :title="curObj.id ? `编辑(${curObj.estate_name})团购助力规则` : '新增(${curObj.estate_name})团购助力规则'"
+      :fullscreen="false"
+      width="700px"
+      custom-class="xl-dialog"
+      center
+    >
+      <base-form ref="ruleForm" class="lib-edit" :data="formData" :is-inline="false" label-width="110px">
+        <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>
+          <el-button class="xl-form-btn t4" @click="delHandle">清空规则</el-button>
+        </div>
+      </base-form>
+    </el-dialog>
+  </div>
+</template>
+<script>
+import { arrToObj } from '@/utils'
+import baseTable from '_m/baseTable.js'
+export default {
+  components: { },
+  props: {
+    isShow: Boolean,
+    curObj: Object
+  },
+  mixins: [...mixins, baseTable],
+  inject: ['parentData'],
+  data() {
+    return {
+      formData: [],
+      loading: true,
+      tagObj: {},
+    }
+  },
+  watch: {
+    isShow: function(val) {
+      if (val) {
+        this.getDtl()
+        this.getDef()
+      }
+    },
+  },
+  mounted() {},
+  methods: {
+    getDtl () {
+      this.listLoading = true
+      this.$api.other.admactivityruledetail({estate_id: this.curObj.id}).then(res => {
+        console.log(res)
+        // this.getDef()
+        this.listLoading = false
+      })
+    },
+    delHandle() {
+      this.$msg(`您确定要清空改规则吗?`, 'confirm', () => {
+        this.$api.other.admactivityruledel({
+          estate_id: this.curObj.id,
+        }).then(data => {
+          this.$msgs(`已清空!`)
+          this.close()
+        })
+      }, null, true)
+    },
+    getDef() {
+      const params = {}
+      this.formData = [
+        { label: '是否开启', key: 'is_open', rules: 1, type: 'select', options: this.$dictData.sys_yesno },
+        { label: '规则', key: 'rule', type: 'textarea' },
+        { label: '截止时间', key: 'end_at', class: 'c-2', type: 'datePicker', type2: 'date' },
+        { label: '助力人数', key: 'option_req', class: 'c-2', type: 'inputFont', appendFont: '人', rules: 
+          [
+            {
+              validator: (rule, value, callback) => {
+                if (Number(value) < 0 || isNaN(Number(value))) {
+                  callback(new Error('请输入数字'))
+                } else {
+                  callback()
+                }
+              }, trigger: 'blur'
+            }
+          ]
+        },
+      ]
+      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 }
+            newForm.estate_id = this.curObj.id
+            let apiStr = 'admactivityruleadd'
+            this.$api.other[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-ed {
+  .se-op {
+    display: inline-block;
+    vertical-align: middle;
+    border: 1px solid #dcdcdc;
+    margin-bottom: 10px;
+    margin-right: 10px;
+    .t {
+      display: inline-block;
+      vertical-align: middle;
+      height: 30px;
+      line-height: 30px;
+      width: 150px;
+      padding: 0 20px;
+      font-weight: bold;
+    }
+    .s {
+      display: inline-block;
+      vertical-align: middle;
+      color: #fff;
+      background: #ff875c;
+      height: 30px;
+      line-height: 30px;
+      padding: 0 10px;
+      cursor: pointer;
+    }
+  }
+}
+</style>

+ 27 - 3
src/views/house/index.vue

@@ -14,7 +14,7 @@
       @currentChange="pageHandle"
       :isAdd="true"
       @add="openPopup"
-      :operationsDefaultLength="7"
+      :operationsDefaultLength="9"
     />
     <popup-edit
       :isShow="isDtlShow"
@@ -31,6 +31,11 @@
       :curObj="curObj"
       @close="closeTHEPopup"
     />
+    <help-rule
+      :isShow="isHRShow"
+      :curObj="curObj"
+      @close="closeHRPopup"
+    />
   </div>
 </template>
 <script>
@@ -39,6 +44,7 @@ import SearchForm from './components/searchForm/Index'
 import PopupEdit from './components/popup/IndexEdit'
 import PhotoEdit from './components/popup/PhotoEdit'
 import ThemeHouseEdit from './components/popup/ThemeHouseEdit'
+import HelpRule from './components/popup/HelpRule'
 import baseTable from '_m/baseTable.js'
 export default {
   name: 'index',
@@ -47,6 +53,7 @@ export default {
     PopupEdit,
     PhotoEdit,
     ThemeHouseEdit,
+    HelpRule,
   },
   provide() {
     return {
@@ -63,6 +70,7 @@ export default {
       // noCreated: true,
       curObj: {},
       isTHEShow: false,
+      isHRShow: false,
     }
   },
   computed: {
@@ -108,7 +116,7 @@ export default {
         { label: '创建时间', prop: 'create_at' },
         { label: '更新人', prop: 'update_by' },
         { label: '更新时间', prop: 'update_at' },
-        { label: '操作', width: 550, type: 'handle2', operations:
+        { label: '操作', width: 610, type: 'handle2', operations:
           [
             { label: '保存排序', func: this.saveHandle, btnType: 'success' },
             { label: '编辑信息', func: this.openPopup, btnType: 'primary' },
@@ -116,6 +124,7 @@ export default {
             { label: '楼盘动态', func: this.openNews, btnType: 'info' },
             { label: '历史成交价', func: this.openPrice, btnType: 'info' },
             { label: '模块主题', func: this.openTHEPopup, btnType: 'info' },
+            { label: '助力团购', func: this.openHRPopup, btnType: 'warning' },
             { label: '删除', func: this.delHandle, btnType: 'danger' },
           ]
         }
@@ -190,7 +199,22 @@ export default {
       if (obj) {
         this.fetchData()
       }
-    }
+    },
+    openHRPopup(row) {
+      if (row && row.id) {
+        this.curObj = row
+      } else {
+        this.curObj = {}
+      }
+      this.isHRShow = true
+    },
+    closeHRPopup(obj) {
+      this.isHRShow = false
+      if (obj) {
+        this.fetchData()
+      }
+    },
+    
   }
 }
 </script>