sys.vue
4.64 KB
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
<template>
<div class="setting_page">
<el-form ref="form" label-width="200px">
<el-form-item label="申请条件:">
<el-radio-group v-model="applyCondition" @change="applyConditions">
<p class="radiop">
<el-radio :label="1">购买任意商品</el-radio>
</p>
<p class="radiop">
<el-radio :label="2">
至少下单满
<el-input v-model="text" :disabled="disabled" />单
</el-radio>
</p>
<p class="radiop">
<el-radio :label="3">
消费金额满
<el-input v-model="text1" :disabled="disabled1" />元
</el-radio>
</p>
</el-radio-group>
</el-form-item>
<el-form-item label="审核设置:">
<el-radio-group v-model="auditFlag" @change="auditFlags">
<el-radio :label="0">无需审核自动成为分销</el-radio>
<el-radio :label="1">需要审核</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label-width="100" style="padding-left: 120px;">
<el-button class="buttonHover"
style="color: #606266;border: 1px solid #dddfe5;background-color: #fff;" @click="cancel">取消</el-button>
<el-button style="background-color: #3F9B6A;color: #fff" @click="subm">保存</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import { getByShopId, recruitAdd, recruitUpdate } from '@/api/distributor'
export default {
data() {
return {
text: '',
text1: '',
disabled: true,
disabled1: true,
first: true,
relationQuery: {
current: 1,
map: {},
model: {},
order: 'descending',
size: 10,
sort: 'id'
},
applyCondition: 1,
auditFlag: 0,
relationItem: {},
updataQuery: {
applyCondition: '',
applyDetail: '',
auditFlag: '',
expireTime: '',
id: '',
isCanInvite: '',
isForeverValid: '',
protectTime: '',
rebindCustomerFlag: '',
salesBindFalg: '',
selfBuyReturnCommisionFlag: ''
}
}
},
created() {
this.salesRelationConfig()
},
methods: {
// 关系设置
async salesRelationConfig() {
const res = await getByShopId({})
console.log(res)
if (JSON.stringify(res.data) === '{}') {
this.first = true
} else {
this.first = false
this.applyCondition = res.data.condition
this.auditFlag = res.data.ifExamine
this.text = res.data.frequency || ''
this.text1 = res.data.money || ''
this.updataQuery.id = this.relationItem.id
this.updataQuery.auditFlag = this.relationItem.auditFlag
this.updataQuery.applyCondition = this.relationItem.applyCondition
console.log(this.relationItem)
}
},
applyConditions(e) {
console.log(e)
if (e === 1) {
this.disabled = true
this.disabled1 = true
this.text1 = ''
this.text = ''
} else if (e === 2) {
this.disabled = false
this.disabled1 = true
} else if (e === 3) {
this.disabled = true
this.disabled1 = false
}
this.relationQuery.model.applyCondition = e
},
auditFlags(e) {
this.relationQuery.model.auditFlag = e
},
// 复制链接
copy(data) {
const oInput = document.createElement('input')
oInput.value = data
document.body.appendChild(oInput)
oInput.select() // 选择对象;
document.execCommand('Copy') // 执行浏览器复制命令
this.$message({
message: '复制成功',
type: 'success'
})
oInput.remove()
},
preview() {},
// 取消
cancel() {
this.$message({
message: '已取消',
type: 'success'
})
},
// 保存
async subm() {
const obj = {
condition: this.applyCondition,
frequency: this.text, // 下单次数
money: this.text1, // 消费金额
ifExamine: this.auditFlag, // 是否需要审核 1-是 0-否
url: '' // 招募页链接
}
if (this.first) {
const res = await recruitAdd(obj)
if (res.code === '') {
this.$message.success('新增成功')
}
} else {
const res = await recruitUpdate(obj)
if (res.code === '') {
this.$message.success('编辑成功')
}
}
}
}
}
</script>
<style lang='scss' scoped>
.setting_page {
padding: 20px 0;
}
p {
margin: 0;
padding: 0;
}
.radiop {
line-height: 40px;
}
::v-deep .el-input {
width: 80px;
margin: 0 10px;
}
</style>