share.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <div class="app-container ">
  3. <el-form ref="form" size="small" :model="form" :rules="rules" label-width="180px">
  4. <el-tabs v-model="activeName">
  5. <el-tab-pane style="padding-top:10px" label="佣金设置" name="佣金设置">
  6. <el-row>
  7. <el-col :span="24">
  8. <el-form-item label="分销佣金类型">
  9. <el-radio-group v-model="form.price_type">
  10. <el-radio label="0">百分比</el-radio>
  11. <el-radio label="1">固定金额(选固定金额,商品/服务的独立佣金设置会失效)</el-radio>
  12. </el-radio-group>
  13. </el-form-item>
  14. </el-col>
  15. </el-row>
  16. <el-row>
  17. <el-col :span="24">
  18. <el-form-item label="一层佣金">
  19. <el-input
  20. v-model="form.first"
  21. style="width:500px;"
  22. auto-complete="off"
  23. clearable
  24. placeholder="请输入一层佣金"
  25. >
  26. <template v-if="form.price_type==0" slot="append">%</template>
  27. <template v-if="form.price_type==1" slot="append">元</template>
  28. </el-input>
  29. <div class="help-block">注:一层为顾客的直接上级<br>(如果开启分销内购,分销商自己购买商品,享受一层佣金)</div>
  30. </el-form-item>
  31. </el-col>
  32. </el-row>
  33. <el-row>
  34. <el-col :span="24">
  35. <el-form-item label="二层佣金">
  36. <el-input
  37. v-model="form.second"
  38. style="width:500px;"
  39. auto-complete="off"
  40. clearable
  41. placeholder="请输入二层佣金"
  42. >
  43. <template v-if="form.price_type==0" slot="append">%</template>
  44. <template v-if="form.price_type==1" slot="append">元</template>
  45. </el-input>
  46. <div class="help-block">注:二层为顾客的上上级</div>
  47. </el-form-item>
  48. </el-col>
  49. </el-row>
  50. <el-row>
  51. <el-col :span="24">
  52. <el-form-item label="三层佣金">
  53. <el-input
  54. v-model="form.third"
  55. style="width:500px;"
  56. auto-complete="off"
  57. clearable
  58. placeholder="请输入三层佣金"
  59. >
  60. <template v-if="form.price_type==0" slot="append">%</template>
  61. <template v-if="form.price_type==1" slot="append">元</template>
  62. </el-input>
  63. <div class="help-block">注:三层为顾客的上上上级</div>
  64. </el-form-item>
  65. </el-col>
  66. </el-row>
  67. </el-tab-pane>
  68. </el-tabs>
  69. <el-form-item>
  70. <el-button size="small" type="primary" @click="submit">保存设置</el-button>
  71. </el-form-item>
  72. </el-form>
  73. </div>
  74. </template>
  75. <script>
  76. export default {
  77. name: 'Configshare',
  78. components: {},
  79. data() {
  80. return {
  81. form: {
  82. },
  83. loading: false,
  84. activeName: '佣金设置',
  85. rules: {}
  86. }
  87. },
  88. mounted() {
  89. this.$api.post('/config/getInfo', {
  90. mo: 'share'
  91. }).then(res => {
  92. this.form = JSON.stringify(res.data) == '[]' ? {} : res.data
  93. this.setDefaultVal('keyword')
  94. })
  95. },
  96. methods: {
  97. submit() {
  98. this.$refs['form'].validate(valid => {
  99. if (valid) {
  100. this.loading = true
  101. this.$api.post('/config/update', this.form).then(res => {
  102. this.$message({
  103. message: '操作成功',
  104. type: 'success'
  105. })
  106. }).catch(() => {
  107. this.loading = false
  108. })
  109. }
  110. })
  111. },
  112. setDefaultVal(key) {
  113. if (this.form[key] == null || this.form[key] == '') {
  114. this.form[key] = []
  115. }
  116. }
  117. }
  118. }
  119. </script>