10.10综合交易所原始源码-管理后台
admin
2026-01-06 a3cc41349752d6fb067df2a58e4e4b723a915f21
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
<template>
  <el-dialog
    :title="!row ? '新增' : '修改'"
    :close-on-click-modal="false"
    width="1100px"
    @close = 'handClose'
    :visible.sync="visible"
  >
    <el-form
      :model="dataForm"
      :rules="dataRule"
      ref="dataForm"
      @keyup.enter.native="dataFormSubmit()"
      label-width="150px"
    >
      <el-form-item class="titleDivTwo" label="基础信息" prop="">
      </el-form-item>
      <el-form-item  label="注意事项:">
        <div class="green">
          代理商(UID)</br>
全局只设置代理商,表示代理线下所有用户质押配置。</br>
优先级为个人>代理>全局</div>
      </el-form-item>
      <el-row>
        <el-col :span="8">
          <el-form-item label="代理商UID" prop="userCode">
            <el-input
              v-model="dataForm.userCode"
              :disabled = "row?true:false"
              placeholder="代理商UID"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="限制天数" prop="limitDays">
            <el-input
              v-model="dataForm.limitDays"
              placeholder="限制天数"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="标题文本" prop="title">
            <el-input
              v-model="dataForm.title"
              placeholder="标题文本"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      
      <el-row>
        <el-col :span="8">
          <el-form-item label="标题图片" prop="titleImg">
        <el-upload
          class="avatar-uploader"
          :action="$http.adornUrl('/api/uploadFile')"
          :headers="{ Authorization: $cookie.get('Authorization') }"
          :show-file-list="false"
          :on-success="handleAvatarSuccess"
          :before-upload="beforeAvatarUpload"
        >
          <img v-if="imageUrl" :src="imageUrl" class="avatar" />
          <i v-else class="el-icon-plus avatar-uploader-icon"></i>
        </el-upload>
      </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="内容文本" prop="content">
        <el-input
          v-model="dataForm.content"
          type="textarea"
          placeholder="内容文本"
        ></el-input>
      </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="内容图片" prop="contentImg">
        <el-upload
          class="avatar-uploader"
          :action="$http.adornUrl('/api/uploadFile')"
          :headers="{ Authorization: $cookie.get('Authorization') }"
          :show-file-list="false"
          :on-success="handleAvatarSuccess2"
          :before-upload="beforeAvatarUpload"
        >
          <img v-if="imageUrl2" :src="imageUrl2" class="avatar" />
          <i v-else class="el-icon-plus avatar-uploader-icon"></i>
        </el-upload>
      </el-form-item>
        </el-col>
      </el-row>
      <el-form-item class="titleDivTwo" label="交易信息" prop="">
      </el-form-item>
      <el-form-item  label="注意事项:">
        <div class="green">
          收益费率格式示范:100-5000;0.0025-0.003|5000-20000;0.005-0.0055|20000-50000;0.0055-0.0065|50000-9999999;0.0065-0.0075</br>
          ⻔槛说明举例:100-5000;0.0025-0.003 表示:如果客户的钱包USDT余额在100到5000USDT之间,每次结算可以获得0.25%到0.3%之间的利润</br>
          ⼀天有4次结算。 有可能是0.26%或者 0.29%,是随机区间</div>
      </el-form-item>
      <el-form-item label="收益费率" prop="config">
            <el-input
              v-model="dataForm.config"
              placeholder="收益费率"
            ></el-input>
          </el-form-item>
      <el-row>
        <el-col :span="12">
          <el-form-item label="用户USDT达标数量" prop="usdt">
            <el-input
              v-model="dataForm.usdt"
              placeholder="用户USDT达标数量"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="奖励ETH数量" prop="eth">
            <el-input
              v-model="dataForm.eth"
              placeholder="奖励ETH数量"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
 
      <el-row>
        <el-col :span="12">
          <el-form-item  label="登录人资金密码"  prop="loginSafeword">
        <el-input v-model="dataForm.loginSafeword" type="password" placeholder="请输入登录人资金密码"></el-input>
      </el-form-item></el-col>
      </el-row>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">取消</el-button>
      <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
    </span>
  </el-dialog>
</template>
<script>
import { Debounce } from "@/utils/debounce";
import { encrypt } from "@/utils/crypto";
export default {
  data() {
    return {
      visible: false,
      row:'',
      imageUrl: "",
      imageUrl2:'',
      dataForm: {
        id: '',
        config: "",
        content: "",
        contentImg: "",
        eth: "",
        limitDays: "",
        loginSafeword: "",
        title: "",
        titleImg: "",
        usdt: "",
        userCode: "",
      },
      direction: [
        {
          label: "启用",
          value: "1",
        },
        {
          label: "停用",
          value: "0",
        },
      ],
      dataRule: {
        //{ validator: validateindex, trigger: "blur" }, 
        titleImg: [
          { required: true, message: "标题图片不能为空", trigger: "blur" },
        ],
        contentImg: [
          { required: true, message: "内容图片不能为空", trigger: "blur" },
        ],
        userCode: [
          { required: true, message: "代理商UID不能为空", trigger: "blur" },
        ],
        limitDays: [
          { required: true, message: "限制天数不能为空", trigger: "blur" },
        ],
        title: [
          { required: true, message: "标题文本不能为空", trigger: "blur" },
        ],
        config: [
          { required: true, message: "收益费率不能为空", trigger: "blur" },
        ],
        usdt: [
          { required: true, message: "用户USDT达标数量不能为空", trigger: "blur" },
        ],
        eth: [
          { required: true, message: "奖励ETH数量不能为空", trigger: "blur" },
        ],
        loginSafeword: [
            { required: true, message: '登录人资金密码不能为空', trigger: 'blur' },
        ],
      },
      tempKey: -666666, // 临时key, 用于解决tree半选中状态项不能传给后台接口问题. # 待优化
    };
  },
  methods: {
    init(row) {
      console.log(row)
      if(row){
        this.row = row,
        this.dataForm = row; 
        this.imageUrl = this.dataForm.titleImgUrl
        this.imageUrl2 = this.dataForm.contentImgUrl
      }else{
        this.dataForm.config = '100-5000;0.0025-0.003|5000-20000;0.005-0.0055|20000-50000;0.0055-0.0065|50000-9999999;0.0065-0.0075'
      }
      
      this.visible = true;
    },
    handleAvatarSuccess(res, file) {
      if(res.code == 0){
        this.dataForm.titleImg = res.data.path;
        this.imageUrl = URL.createObjectURL(file.raw);
        this.$refs["dataForm"].validateField('titleImg')
      }else{
        this.$message({
          type: 'error',
          message: data.msg
        }); 
      }
 
 
    },
    handleAvatarSuccess2(res, file) {
      if(res.code == 0){
        this.dataForm.contentImg = res.data.path;
        this.imageUrl2 = URL.createObjectURL(file.raw);
        this.$refs["dataForm"].validateField('contentImg')
      }else{
        this.$message({
          type: 'error',
          message: data.msg
        }); 
      }
 
 
    },
    beforeAvatarUpload(file) {
      // const isJPG = file.type === 'image/jpeg';
      const isLt2M = file.size / 1024 / 1024 < 10;
 
      // if (!isJPG) {
      //   this.$message.error('上传头像图片只能是 JPG 格式!');
      // }
      if (!isLt2M) {
        this.$message.error("上传图片大小不能超过 10MB!");
      }
      // return isJPG && isLt2M;
      return isLt2M;
    },
    handClose(){
        this.$data.dataForm=JSON.parse(JSON.stringify(this.$options.data().dataForm))
        this.imageUrl = ''
        this.imageUrl2 = ''
        this.row = ''
     this.$nextTick(() => {
            this.$refs['dataForm'].clearValidate() // 清除表单验证
          })
      },
    changeVal(val) {
      this.$forceUpdate();
    },
    // 表单提交
    dataFormSubmit: Debounce(function () {
      let url = '';
      let data = {}
      if(!this.row){ // 新增
        url = `/pledgeConfig/add`;
        data = {
          config :this.dataForm.config,
          content:this.dataForm.content,
          contentImg:this.dataForm.contentImg,
          eth :this.dataForm.eth,
          limitDays :this.dataForm.limitDays,
          title :this.dataForm.title,
          titleImg :this.dataForm.titleImg,
          usdt :this.dataForm.usdt,
          userCode :this.dataForm.userCode,
          loginSafeword:encrypt(this.dataForm.loginSafeword)
        }
      }else{
        url = `/pledgeConfig/update`;
        data = {
          config :this.dataForm.config,
          content:this.dataForm.content,
          contentImg:this.dataForm.contentImg,
          eth :this.dataForm.eth,
          limitDays :this.dataForm.limitDays,
          title :this.dataForm.title,
          titleImg :this.dataForm.titleImg,
          usdt :this.dataForm.usdt,
          userCode :this.dataForm.userCode,
          id:this.dataForm.id,
          loginSafeword:encrypt(this.dataForm.loginSafeword)
        }
      }
      this.$refs["dataForm"].validate((valid) => {
        if (valid) {
          this.$http({
            url: this.$http.adornUrl(url),
            method: "post",
            data: this.$http.adornData(data),
          }).then(({ data }) => {
            if(data.code == 0){
              this.$message({
              message: "操作成功",
              type: "success",
              duration: 1500,
              onClose: () => {
                this.visible = false;
                this.$emit("refreshDataList");
              },
            });
            }else{
              this.$message({
              message:data.msg,
              type: "error",
              duration: 1500,
              onClose: () => {
              },
            });
            }
 
          });
        }
      });
    }),
  },
};
</script>
<style lang="less"  scoped>
.titleDivTwo {
  height: 40px;
  border-left: 3px solid #1c4efa;
  background: #f4f7ff;
}
/deep/.avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9 !important;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
/deep/.avatar-uploader .el-upload:hover {
  border-color: #409eff;
}
.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 178px;
  height: 178px;
  line-height: 178px;
  text-align: center;
}
.avatar {
  width: 178px;
  height: 178px;
  display: block;
}
</style>