|
@@ -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>
|