quanwei
18 hours ago c441dea81bd86bdfb12dff35821fed51f4cc91c2
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
<template>
  <!--
      作者 luoyiming
      时间:2019-10-26
      描述:设置-外卖设置
  -->
  <div class="product-add">
    <!--form表单-->
    <el-form size="small" ref="form" :model="form" label-width="200px">
      <!--外卖设置-->
      <div class="common-form">外卖设置</div>
      <el-form-item label="配送员默认佣金类型">
        <div>
          <el-radio v-model="form.commission_type" :label="0">固定金额</el-radio>
          <el-radio v-model="form.commission_type" :label="1">百分比</el-radio>
        </div>
      </el-form-item>
      <el-form-item label="配送员默认佣金">
          <el-input v-model="form.order_commission" class="max-w460"></el-input>
      </el-form-item>
 
      <!--提交-->
      <div class="common-button-wrapper">
        <el-button type="primary" @click="onSubmit" :loading="loading">提交</el-button>
      </div>
    </el-form>
  </div>
</template>
 
<script>
  import SettingApi from '@/api/setting.js';
 
  export default {
    data() {
      return {
        /*form表单数据*/
        form: {
          commission_type: 0,
          order_commission:0,
        },
        loading: false
      };
    },
    created() {
      this.getData();
    },
 
    methods: {
      getData() {
        let self = this;
        SettingApi.deliverDetail({}, true)
          .then(data => {
            let vars = data.data.vars.values;
            self.form.commission_type = parseInt(vars.commission_type);
            self.form.order_commission = vars.order_commission;
          }).catch(error => {});
      },
      //提交表单
      onSubmit() {
        let self = this;
        self.loading = true;
        let params = this.form;
        SettingApi.editDeliver(params, true)
          .then(data => {
            self.loading = false;
            self.$message({
              message: '修改成功',
              type: 'success'
            });
          })
          .catch(error => {
            self.loading = false;
          });
      },
    }
  };
</script>
 
<style>
  .tips {
    color: #ccc;
  }
</style>