zxl
2025-05-23 5d5b0f7ab0f34019e11901ddcd59cd8b51ea9ff9
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
<template>
  <div class="layout">
 
    <Form ref="formValidate" :label-width="150" label-position="right" :model="formValidate">
      <FormItem label="提现审核是否开启">
        <i-switch v-model="formValidate.apply" style="margin-top:7px;"><span slot="open">开</span>
          <span slot="close">关</span>
        </i-switch>
      </FormItem>
 
      <FormItem  label="最低提现金额" prop="minPrice">
        ¥<Input class="label-appkey" v-model="formValidate.minPrice" />
      </FormItem>
 
      <FormItem label="提现方式" prop="type">
        <RadioGroup v-model="formValidate.type">
          <Radio label="WECHAT">微信</Radio>
          <Radio label="ALI">支付宝</Radio>
        </RadioGroup>
      </FormItem>
 
      <FormItem label="微信提现应用ID" prop="wechatAppId">
        <Input class="label-appkey" v-model="formValidate.wechatAppId" />
      </FormItem>
 
      <div class="label-btns">
        <Button type="primary" @click="submit('formValidate')">保存</Button>
      </div>
    </Form>
  </div>
</template>
<script>
import { setSetting } from "@/api/index";
import { handleSubmit } from "./validate";
export default {
  data() {
    return {
      result:"",
      formValidate: { // 表单数据
        apply: true,
        minPrice: "",
        type: "",
        wechatAppId: "",
      },
 
      switchTitle: "提现审核是否开启", // 切换title
    };
  },
  created() {
    this.init();
  },
  props: ["res", "type"],
  methods: {
    // 保存
    submit(name) {
      let that = this;
       if( handleSubmit(that, name )){
        this.setupSetting()
      }
    },
    // 保存设置
    setupSetting() {
 
      setSetting(this.type, this.formValidate).then((res) => {
        if (res.success) {
          this.$Message.success("保存成功!");
        } else {
          this.$Message.error("保存失败!");
        }
      });
    },
    // 实例化数据
    init() {
      this.result = JSON.parse(this.res);
      this.$set(this, "formValidate", { ...this.result });
    },
  },
};
</script>
 
<style lang="scss" scoped>
@import "./style.scss";
/deep/ .ivu-form-item-content{
  align-items: center;
  padding-bottom: 5px;
}
</style>