MrShi
2 天以前 4eac422e52a4d28fb651b75d0f054697c7a2c0fa
admin/src/views/business/integralRuleSet.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,150 @@
<template>
  <div class="box" style="max-height:calc(100% - 60px);margin-bottom:50px;overflow-y: auto" >
    <el-form :model="form" ref="form">
      <div class="header">
        <span style="font-size: 15px; font-weight: bold">【1】积分抵扣现金规则</span>
      </div>
      <div class="item-content">
        <el-form-item label="" label-width="1px" prop="deductIntegralLimit">
          <el-input  style="width: 200px;margin: 0px 20px" type="number"   v-model="form.deductIntegralLimit"   placeholder="请输入"  v-trim>
          </el-input>积分抵扣1元
        </el-form-item>
      </div>
      <div class="header">
        <span style="font-size: 15px; font-weight: bold">【2】积分使用门槛</span>
      </div>
      <div class="item-content">
        <el-form-item label="积分满" label-width="150px" prop="minIntegralPriceLimit">
          <el-input  style="width: 150px;margin: 0px 20px" type="number"   v-model="form.minIntegralPriceLimit"   placeholder="请输入"   v-trim>
            <template slot="append">元</template>
          </el-input>可用
        </el-form-item>
      </div>
      <div class="item-content">
        <el-form-item label="积分失效规则" label-width="150px"  prop="integralInvalidType">
          <el-radio-group v-model="form.integralInvalidType">
            <el-radio :label="0">长期有效</el-radio>
            <el-radio :label="1">按积分产生时间失效</el-radio>
          </el-radio-group>
          <p class="tip-warn" style="margin-bottom: 1px;"><i class="el-icon-warning"></i>说明:积分按月销毁,根据积分生成时间,设置销毁周期(单位:年),如销毁周期设置1年,去年9月份产生的积分,到今年10月1号00:00时全部统一销毁;</p>
        </el-form-item>
      </div>
      <div class="item-content">
        <el-form-item label="积分失效规则" label-width="150px"  prop="integralInvalidCircle">
          <el-input  style="width: 200px;margin: 0px 20px" type="number"  v-model="form.integralInvalidCircle"   placeholder="请输入"   v-trim>
            <template slot="append">å¹´</template> </el-input>
          <p class="tip-warn" style="margin-bottom: 1px;"><i class="el-icon-warning"></i>说明:配置后根据会员积分生成时间的周期清空,单位:年</p>
        </el-form-item>
      </div>
      <div class="header">
        <span style="font-size: 15px; font-weight: bold">【3】积分规则说明</span>
      </div>
      <div class="item-content">
        <el-form-item label="" label-width="1px"  prop="integralRuleInfo">
          <RichEditor  :richData="form.integralRuleInfo" :styleEditor="styleEditor" @getWangedditor="getWangedditor" :readonly="false"/>
        </el-form-item>
      </div>
      <el-form-item style="margin-top: 100px;width: 100%;text-align: center">
        <el-button type="primary" style="width: 300px"  :loading="working" @click="submit">保存配置项</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import { getPlatformConfig, updPlatformConfig } from '@/api/system/dictData'
import RichEditor from '@/components/common/RichEditor'
export default {
  name: '',
  components: { RichEditor },
  data () {
    return {
      uploadData: {
        folder: ''
      },
      styleEditor: 'border: 1px solid #ccc;display: inline-block;height:400px;',
      isUploading: false,
      working: false,
      couponList: [],
      form: {
        dictCode:'INTEGRAL_SET',
        integralRuleInfo: null,
        integralInvalidCircle: 0,
        integralInvalidType: 0,
        minIntegralPriceLimit: 0,
        deductIntegralLimit: 0
      }
    }
  },
  created () {
    this.getData()
  },
  methods: {
    getData () {
      getPlatformConfig({})
        .then(res => {
          if (res) {
            this.form = {
              dictCode: 'INTEGRAL_SET',
              integralRuleInfo: res.integralRuleInfo || null,
              integralInvalidCircle: res.integralInvalidCircle || 0,
              integralInvalidType: res.integralInvalidType || 0,
              minIntegralPriceLimit: res.minIntegralPriceLimit || 0,
              deductIntegralLimit: res.deductIntegralLimit || 0
            }
          }
        })
    },
    getWangedditor (val) {
      this.form.integralRuleInfo = val
    },
    submit () {
      console.log(this.form)
      this.$refs.form.validate((valid) => {
        if (!valid) {
          return
        }
        // è°ƒç”¨æ–°å»ºæŽ¥å£
        this.isWorking = true
        updPlatformConfig(this.form).then(res => {
          this.$message.success('保存成功')
          this.getData()
        })
          .catch(e => {
            this.$tip.apiFailed(e)
          })
          .finally(() => {
            this.isWorking = false
          })
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.el-container /deep/  .el-main{
  width: 100%;
  overflow-y: auto  !important ;
  height: calc(100% - 94px);
}
.item-content{
  display: flex;
  width: 100%;
}
.header{
  margin: 20px 0 20px 0;padding:10px;background-color: #E0DEDE;
}
/deep/ .el-main{
  width: 100%;
  //height: 100%;
  overflow-y: auto  !important ;
  height: calc(100% - 94px);
}
.box {
  width: 100%;
  padding: 0 30px;
  box-sizing: border-box;
  background: #ffffff;
}
</style>