| | |
| | | 描述:插件中心-分销-代理审核 |
| | | --> |
| | | <div v-if="status != 30"> |
| | | <el-dialog title="代理审核" :visible.sync="dialogVisible" @close="dialogFormVisible" :close-on-click-modal="false" :close-on-press-escape="false"> |
| | | <el-form :model="form"> |
| | | <el-form-item label="审核状态" :label-width="formLabelWidth"> |
| | | <div> |
| | | <el-radio v-model="form.apply_status" label="20">审核通过</el-radio> |
| | | <el-radio v-model="form.apply_status" label="30">驳回</el-radio> |
| | | </div> |
| | | <el-dialog title="代理审核" :visible.sync="dialogVisible" @close="dialogFormVisible" :close-on-click-modal="false" :close-on-press-escape="false" width="600px"> |
| | | <el-form :model="form" ref="formRef" label-width="120px"> |
| | | <el-form-item label="审核状态"> |
| | | <el-radio-group v-model="form.apply_status" @change="handleStatusChange"> |
| | | <el-radio label="20">审核通过</el-radio> |
| | | <el-radio label="30">驳回</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | |
| | | <!-- 审核通过时显示区域和级别选择 --> |
| | | <div v-if="form.apply_status == 20"> |
| | | <el-form-item label="运营中心级别"> |
| | | <el-select v-model="form.region_level" placeholder="请选择级别" @change="handleLevelChange"> |
| | | <el-option label="省级" :value="1"></el-option> |
| | | <el-option label="市级" :value="2"></el-option> |
| | | <el-option label="区县级" :value="3"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="省/直辖市"> |
| | | <el-select v-model="form.province_id" placeholder="请选择省份" @change="handleProvinceChange"> |
| | | <el-option |
| | | v-for="item in provinceList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="城市" v-if="form.region_level >= 2"> |
| | | <el-select v-model="form.city_id" placeholder="请选择城市" @change="handleCityChange" :disabled="!form.province_id"> |
| | | <el-option |
| | | v-for="item in cityList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="区县" v-if="form.region_level == 3"> |
| | | <el-select v-model="form.area_id" placeholder="请选择区县" :disabled="!form.city_id"> |
| | | <el-option |
| | | v-for="item in areaList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="登录账号" prop="user_name"> |
| | | <el-input type="text" v-model="form.user_name" autocomplete="off" placeholder="请输入登录账号"></el-input> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="登录密码" prop="password"> |
| | | <el-input type="password" v-model="form.password" autocomplete="off" placeholder="请输入登录密码"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | |
| | | <!-- 驳回时显示驳回原因 --> |
| | | <div v-if="form.apply_status == 30"> |
| | | <el-form-item label="驳回原因" :label-width="formLabelWidth"><el-input v-model="form.reject_reason" autocomplete="off"></el-input></el-form-item> |
| | | <el-form-item label="驳回原因"> |
| | | <el-input v-model="form.reject_reason" type="textarea" :rows="3" placeholder="请输入驳回原因"></el-input> |
| | | </el-form-item> |
| | | </div> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button @click="dialogFormVisible">取 消</el-button> |
| | | <el-button type="primary" @click="editApplyStatus">确 定</el-button> |
| | | <el-button type="primary" @click="editApplyStatus" :loading="loading">确 定</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | |
| | | <div v-else> |
| | | <el-dialog title="驳回原因" :visible.sync="dialogVisible" @close="dialogFormVisible" :close-on-click-modal="false" :close-on-press-escape="false"> |
| | | <p>{{ reject_reason }}</p> |
| | | <!-- <div slot="footer" class="dialog-footer"> |
| | | <el-button @click="dialogFormVisible">取 消</el-button> |
| | | <el-button type="primary" @click="dialogFormVisible">确 定</el-button> |
| | | </div> --> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import OperationsApi from '@/api/plus/operations.js'; |
| | | import DataApi from '@/api/data.js'; |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | status: '', |
| | | reject_reason: '', |
| | | /*左边长度*/ |
| | | formLabelWidth: '120px', |
| | | /*是否显示*/ |
| | | dialogVisible: false |
| | | loading: false, |
| | | /*地区数据*/ |
| | | regionData: [] |
| | | }; |
| | | }, |
| | | props: ['open_edit', 'form'], |
| | |
| | | this.status = this.form.apply_status.value; |
| | | if (this.status == 30) { |
| | | this.reject_reason = this.form.reject_reason; |
| | | } else { |
| | | // 如果是待审核状态,默认设置为省级 |
| | | if (!this.form.region_level) { |
| | | this.form.region_level = 1; |
| | | } |
| | | // 加载地区数据 |
| | | this.getRegionData(); |
| | | } |
| | | }, |
| | | computed: { |
| | | /*获取省份列表*/ |
| | | provinceList() { |
| | | return Object.values(this.regionData).filter(item => item.level === 1); |
| | | }, |
| | | /*获取城市列表*/ |
| | | cityList() { |
| | | if (this.form.province_id && this.regionData[this.form.province_id]) { |
| | | const provinceData = this.regionData[this.form.province_id]; |
| | | if (provinceData.city) { |
| | | return Object.values(provinceData.city); |
| | | } |
| | | } |
| | | return []; |
| | | }, |
| | | /*获取区/县列表*/ |
| | | areaList() { |
| | | if (this.form.city_id && this.form.province_id && this.regionData[this.form.province_id]) { |
| | | const provinceData = this.regionData[this.form.province_id]; |
| | | if (provinceData.city && provinceData.city[this.form.city_id]) { |
| | | const cityData = provinceData.city[this.form.city_id]; |
| | | if (cityData.region) { |
| | | return Object.values(cityData.region); |
| | | } |
| | | } |
| | | } |
| | | return []; |
| | | } |
| | | }, |
| | | methods: { |
| | | /*获取地区数据*/ |
| | | getRegionData() { |
| | | let self = this; |
| | | DataApi.getRegion({}, true) |
| | | .then(res => { |
| | | self.regionData = res.data.regionData; |
| | | }) |
| | | .catch(() => {}); |
| | | }, |
| | | |
| | | /*省份改变*/ |
| | | handleProvinceChange(val) { |
| | | this.form.city_id = 0; |
| | | this.form.area_id = 0; |
| | | }, |
| | | |
| | | /*城市改变*/ |
| | | handleCityChange(val) { |
| | | this.form.area_id = 0; |
| | | }, |
| | | |
| | | /*级别改变*/ |
| | | handleLevelChange(val) { |
| | | // 切换级别时清空下级区域 |
| | | if (val < 2) { |
| | | this.form.city_id = 0; |
| | | this.form.area_id = 0; |
| | | } |
| | | if (val < 3) { |
| | | this.form.area_id = 0; |
| | | } |
| | | }, |
| | | |
| | | /*审核状态改变*/ |
| | | handleStatusChange(val) { |
| | | // 切换到审核通过时,加载数据 |
| | | if (val == 20) { |
| | | if (this.regionData.length === 0) { |
| | | this.getRegionData(); |
| | | } |
| | | } |
| | | }, |
| | | |
| | | /*修改用户*/ |
| | | editApplyStatus() { |
| | | // 验证审核通过时的必填项 |
| | | if (this.form.apply_status == 20) { |
| | | if (!this.form.region_level) { |
| | | this.$message.error('请选择运营中心级别'); |
| | | return; |
| | | } |
| | | if (!this.form.province_id) { |
| | | this.$message.error('请选择省份'); |
| | | return; |
| | | } |
| | | if (this.form.region_level >= 2 && !this.form.city_id) { |
| | | this.$message.error('请选择城市'); |
| | | return; |
| | | } |
| | | if (this.form.region_level == 3 && !this.form.area_id) { |
| | | this.$message.error('请选择区县'); |
| | | return; |
| | | } |
| | | if (!this.form.user_name) { |
| | | this.$message.error('请输入登录账号'); |
| | | return; |
| | | } |
| | | if (!this.form.password) { |
| | | this.$message.error('请输入登录密码'); |
| | | return; |
| | | } |
| | | if (this.form.password.length < 6) { |
| | | this.$message.error('密码长度不能少于6位'); |
| | | return; |
| | | } |
| | | } else { |
| | | // 驳回时必须填写原因 |
| | | if (!this.form.reject_reason) { |
| | | this.$message.error('请输入驳回原因'); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | this.loading = true; |
| | | let self = this; |
| | | let params = this.form; |
| | | let params = { |
| | | apply_id: this.form.apply_id, |
| | | apply_status: this.form.apply_status, |
| | | real_name: this.form.real_name, |
| | | mobile: this.form.mobile, |
| | | user_id: this.form.user_id, |
| | | referee_id: this.form.referee_id, |
| | | region_level: { |
| | | value: this.form.region_level, |
| | | text: this.form.region_level == 1 ? '省级' : (this.form.region_level == 2 ? '市级' : '区县级') |
| | | }, |
| | | province_id: this.form.province_id, |
| | | city_id: this.form.city_id || 0, |
| | | area_id: this.form.area_id || 0, |
| | | user_name: this.form.user_name || '', |
| | | password: this.form.password || '', |
| | | reject_reason: this.form.reject_reason || '' |
| | | }; |
| | | |
| | | OperationsApi.editApplyStatus(params, true) |
| | | .then(data => { |
| | | self.$message({ |
| | |
| | | }); |
| | | self.dialogFormVisible(true); |
| | | }) |
| | | .catch(error => {}); |
| | | .catch(error => { |
| | | this.loading = false; |
| | | }); |
| | | }, |
| | | |
| | | /*关闭弹窗*/ |