doum
2 天以前 7c626e30b790489978150e57a2c7359934df32c7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
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>