123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753 |
- <template>
- <div class="app-container">
- <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch">
- <el-form-item label="代理商名称" prop="name">
- <el-input
- v-model="queryParams.name"
- placeholder="请输入代理商名称"
- clearable
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item label="代理商等级" prop="agentLevel">
- <el-select v-model="queryParams.agentLevel" placeholder="请选择代理商等级" clearable >
- <el-option
- v-for="item in agentLevelList"
- :key="item.level"
- :label="item.name"
- :value="item.level"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="联系人" prop="contactName">
- <el-input
- v-model="queryParams.contactName"
- placeholder="请输入联系人"
- clearable
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item label="联系手机" prop="mobile">
- <el-input
- v-model="queryParams.mobile"
- placeholder="请输入联系手机"
- clearable
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item label="代理商地区">
- <OldSend :sendAreaProp="sendAreaProp" @changeArea="changeSendArea" ref="sendArea"/>
- </el-form-item>、
- <el-form-item label="创建时间" prop="createTime">
- <el-date-picker
- v-model="date"
- type="datetimerange"
- start-placeholder="开始时间"
- range-separator="至"
- end-placeholder="结束时间"
- :default-time="['00:00:00', '23:59:59']"
- value-format="yyyy-MM-dd HH:mm:ss"
- format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
- <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
- </el-form-item>
- </el-form>
- <el-row :gutter="10" class="mb8">
- <el-col :span="1.5">
- <el-button
- type="primary"
- plain
- icon="el-icon-plus"
- @click="handleAdd"
- v-hasPermi="['module:agent:add']"
- >新增</el-button>
- </el-col>
- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
- </el-row>
- <el-table v-loading="loading" :data="agentList" stripe border highlight-current-row style="width: 100%">
- <el-table-column prop="avatar" header-align="center" align="center" label="代理商头像">
- <template slot-scope="scope">
- <img :src="scope.row.avatar" style="width:50px;height:50px;" />
- </template>
- </el-table-column>
- <el-table-column label="代理商名称" align="center" prop="name" />
- <el-table-column label="联系人" align="center" prop="contactName" />
- <el-table-column label="联系手机" align="center" prop="mobile" />
- <el-table-column label="上级代理" align="center" class-name="small-padding fixed-width" show-overflow-tooltip>
- <template slot-scope="scope">
- <el-button v-if="scope.row.pid"
- type="text"
- @click="gotoInfo(scope.row.pid)"
- >{{scope.row.pagentName}}</el-button>
- </template>
- </el-table-column>
- <el-table-column label="所在省" align="center" prop="provinceName" />
- <el-table-column label="所在城市" align="center" prop="cityName" />
- <el-table-column label="所在区" align="center" prop="districtName" show-overflow-tooltip />
- <el-table-column label="二维码" align="center" prop="qrCode" >
- <template slot-scope="scope">
- <img style="width: 50px;height: 50px" :src="scope.row.qrCode">
- </template>
- </el-table-column>
- <el-table-column label="代理商等级" align="center" prop="levelName" />
- <el-table-column label="佣金类型" align="center" prop="type">
- <template slot-scope="scope">
- <span v-if="scope.row.type == 0">比例</span>
- <span v-if="scope.row.type == 1">金额</span>
- </template>
- </el-table-column>
- <el-table-column label="佣金" align="center" prop="commissionRate">
- <template slot-scope="scope">
- {{ scope.row.commissionRate }}
- <span v-if="scope.row.type == 0">%</span>
- <span v-if="scope.row.type == 1">元</span>
- </template>
- </el-table-column>
- <!-- <el-table-column label="佣金比率(%)" align="center" prop="commissionRate" /> -->
- <el-table-column label="货拉拉佣金金额(单位:元)" align="center" prop="huolalaCommission">
- <template slot-scope="scope">
- {{ scope.row.huolalaCommission }}
- </template>
- </el-table-column>
- <el-table-column label="绑定三方运力佣金比例" align="center" prop="bindingThirdCommission">
- <template slot-scope="scope">
- {{ scope.row.bindingThirdCommission }}%
- </template>
- </el-table-column>
- <el-table-column label="备注" align="center" prop="remark" />
- <el-table-column label="优惠包名称" align="center" v-if="user.type != 2">
- <template slot-scope="scope">
- <span>{{ scope.row.packageDiscountName || '- -' }}</span>
- </template>
- </el-table-column>
- <el-table-column label="佣金包名称" align="center" v-if="user.type != 2">
- <template slot-scope="scope">
- <span>{{ scope.row.packageCommissionName || '- -' }}</span>
- </template>
- </el-table-column>
- <el-table-column label="创建时间" align="center" prop="createTime" />
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
- <template slot-scope="scope">
- <el-button
- size="mini"
- type="text"
- @click="gotoInfo(scope.row.id)"
- >详情</el-button>
- <el-button
- size="mini"
- type="text"
- icon="el-icon-edit"
- @click="handleUpdate(scope.row)"
- v-if="scope.row.isEdit == 1"
- v-hasPermi="['module:agent:edit']"
- >修改</el-button>
- <el-button
- v-if="user.type != 2"
- size="mini"
- type="text"
- @click="handleDiscount(scope.row.id, 1)"
- >绑定优惠包</el-button>
- <el-button
- v-if="user.type != 2"
- size="mini"
- type="text"
- @click="handleCommission(scope.row.id, 2)"
- >绑定佣金包</el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- v-show="total>0"
- :total="total"
- :page.sync="queryParams.pageNum"
- :limit.sync="queryParams.pageSize"
- @pagination="getList"
- />
- <!-- 添加或修改代理商对话框 -->
- <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
- <el-form ref="form" :model="form" :rules="rules" label-width="230px">
- <el-form-item label="代理商名称" prop="name">
- <el-input v-model="form.name" placeholder="请输入代理商名称" style="width:450px" />
- </el-form-item>
- <el-form-item label="代理商头像" prop="avatar" v-if="form.isPid == 0 || this.title == '添加代理商'">
- <materialLibrary v-model="form.avatar" :pickNum="1" ></materialLibrary>
- </el-form-item>
- <el-form-item label="联系人" prop="contactName">
- <el-input v-model="form.contactName" placeholder="请输入联系人" style="width:250px" />
- </el-form-item>
- <el-form-item label="联系手机" prop="mobile">
- <el-input v-model="form.mobile" placeholder="请输入联系手机" style="width:250px" />
- </el-form-item>
- <el-form-item label="所在地区" v-if="form.isPid == 0 || this.title == '添加代理商'">
- <span style="color: #f56c6c;float: left;position: absolute;left: -77px;">*</span>
- <Area :provinceAndCity="areaProp" @changeArea="changeArea" ref="area"/>
- </el-form-item>
- <el-form-item label="代理商等级" prop="agentLevel" v-if="form.isPid == 0 || this.title == '添加代理商'">
- <el-select v-model="form.agentLevel" placeholder="请选择代理商等级" clearable >
- <el-option
- v-for="item in agentLevelList"
- :key="item.level"
- :label="item.name"
- :value="item.level"
- :disabled="item.isNone == 1"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="佣金类型" prop="type" v-if="form.isPid == 0 || this.title == '添加代理商'">
- <el-radio-group v-model="form.type">
- <el-radio :label="0" :disabled="this.title == '修改代理商'">比例</el-radio>
- <el-radio :label="1" :disabled="this.title == '修改代理商'">金额</el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item :label="form.type == 0 ? '佣金比例' : '佣金金额'" prop="commissionRate">
- <div v-if="form.type == 0">
- <el-input-number :disabled="this.title == '修改代理商'" style="width:330px" :min="0" controls-position="right" :max="maxRate" v-model="form.commissionRate" :placeholder="'可输入佣金比率范围0~' + maxRate">
- </el-input-number> %
- </div>
- <div v-if="form.type == 1">
- <el-input-number :disabled="this.title == '修改代理商'" style="width:330px" :min="0" controls-position="right" :max="qishouMax" :precision="2" v-model="form.commissionRate" :placeholder="'可输入佣金金额范围0~' + qishouMax">
- </el-input-number> 元
- </div>
- </el-form-item>
- <el-form-item label="货拉拉佣金金额(单位:元)" prop="huolalaCommission">
- <el-input-number :disabled="this.title == '修改代理商'" style="width:330px" :min="0" controls-position="right" :max="huolalaMax" :precision="2" v-model="form.huolalaCommission" :placeholder="'可输入货拉拉佣金金额范围0~' + huolalaMax">
- </el-input-number>
- </el-form-item>
- <!-- <el-form-item label="绑定三方运力佣金比例" prop="bindingThirdCommission" v-if="form.isPid == 0 || this.title == '添加代理商'">
- <el-input-number style="width:330px" :min="0" controls-position="right" :max="100" v-model="form.bindingThirdCommission" placeholder="请输入绑定三方运力佣金比例">
- </el-input-number> %
- </el-form-item>
- <el-form-item label="绑定三方运力佣金比例" prop="bindingThirdCommission" v-if="form.isPid != 0 && this.title == '修改代理商'">
- <el-input-number style="width:330px" :min="0" controls-position="right" :max="bindingThirdMax" v-model="form.bindingThirdCommission" :placeholder="'可输入绑定三方运力佣金比例范围0~' + bindingThirdMax">
- </el-input-number> %
- </el-form-item> -->
- <el-form-item label="绑定三方运力佣金比例" prop="bindingThirdCommission">
- <el-input-number :disabled="this.title == '修改代理商'" style="width:330px" :min="0" controls-position="right" :max="100" v-model="form.bindingThirdCommission" placeholder="请输入绑定三方运力佣金比例">
- </el-input-number> %
- </el-form-item>
- <!-- <el-form-item label="佣金比率" prop="commissionRate" v-if="form.isPid == 0 || this.title == '添加代理商'">
- <el-input-number style="width:250px" :min="0" controls-position="right" :max="maxRate" :precision="2" v-model="form.commissionRate" :placeholder="'可输入佣金比率范围0~' + maxRate">
- </el-input-number> %
- </el-form-item> -->
- <el-form-item label="地址" prop="address" v-if="form.isPid == 0 || this.title == '添加代理商'">
- <el-input v-model="form.address" placeholder="请输入地址" style="width:450px" />
- </el-form-item>
- <el-form-item label="备注" prop="remark">
- <el-input v-model="form.remark" placeholder="请输入备注" maxlength="50" style="width:450px" />
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitForm">确 定</el-button>
- <el-button @click="cancel">取 消</el-button>
- </div>
- </el-dialog>
- <el-dialog title="绑定包配置" :visible.sync="packageRequestOpen" width="700px" append-to-body>
- <el-form ref="packageRequest" :model="packageRequest" :rules="packageRequestRules" label-width="130px">
- <el-form-item label="选择包" prop="packageId">
- <el-select v-model="packageRequest.packageId" placeholder="请选择优惠包" v-if="packageRequest.packageType == 1" clearable>
- <el-option v-for="item in this.packageDiscountList" :key="item.id" :label="item.name" :value="item.id"></el-option>
- </el-select>
- <el-select v-model="packageRequest.packageId" placeholder="请选择佣金包" v-if="packageRequest.packageType == 2" clearable>
- <el-option v-for="item in this.packageCommissionList" :key="item.id" :label="item.name" :value="item.id"></el-option>
- </el-select>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitFormPackage">确 定</el-button>
- <el-button @click="cancelPackage">取 消</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import { listAgent, getAgent, delAgent, addAgent, updateAgent, exportAgent } from "@/api/module/agent";
- import { getAgentLevelList } from "@/api/module/agentLevel";
- import Area from '@/components/area'
- import area from "@/api/city";
- import OldSend from '@/components/area/oldSend'
- export default {
- name: "Agent",
- components: {
- Area,
- OldSend
- },
- data() {
- return {
- // 登录用户
- user: {},
- // 允许的最大佣金比例
- maxRate: '',
- // 骑手最大佣金金额
- qishouMax: '',
- // 货拉拉最大佣金金额
- huolalaMax: '',
- // 绑定三方最大佣金金额
- bindingThirdMax: '',
- agentLevelList: [],
- areaProp: {},
- startArea: {
- province: '',
- city: '',
- district: '',
- provinceName: '',
- cityName: '',
- districtName: '',
- cityValues: [],
- districtValues: [],
- districtNames: [],
- //
- // province: '',
- // city: '',
- // district: '',
- // provinceName: '',
- // cityName: '',
- // districtName: ''
- },
- sendAreaProp: {},
- sendStartArea: {
- province: '',
- city: '',
- district: '',
- provinceName: '',
- cityName: '',
- districtName: '',
- cityValues: [],
- districtValues: [],
- districtNames: [],
- },
- // 遮罩层
- loading: true,
- // 选中数组
- ids: [],
- // 非单个禁用
- single: true,
- // 非多个禁用
- multiple: true,
- // 显示搜索条件
- showSearch: true,
- // 总条数
- total: 0,
- // 代理商表格数据
- agentList: [],
- // 弹出层标题
- title: "",
- // 是否显示弹出层
- open: false,
- date: [],
- // 查询参数
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- name: undefined,
- pid: undefined,
- provinceId: undefined,
- cityId: undefined,
- districtId: undefined,
- agentLevel: undefined,
- commissionRate: undefined,
- contactName: undefined,
- avatar: undefined,
- mobile: undefined,
- address: undefined,
- remark: undefined,
- startTime: undefined,
- endTime: undefined
- },
- packageRequest: {
- packageType: undefined,
- packageId: undefined,
- agentId: undefined
- },
- packageRequestRules: {},
- packageRequestOpen: false,
- packageDeliveryList: [],
- packageCommissionList: [],
- packageDiscountList: [],
- // 表单参数
- form: {},
- // 表单校验
- rules: {
- commissionRate: [
- { required: true, message: "佣金比率不能为空", trigger: "blur" }
- ],
- name: [
- { required: true, message: "代理商名称不能为空", trigger: "blur" }
- ],
- agentLevel: [
- { required: true, message: "代理商等级不能为空", trigger: "blur" }
- ],
- provinceId: [
- { required: true, message: "所在省不能为空", trigger: "blur" }
- ],
- cityId: [
- { required: true, message: "所在城市不能为空", trigger: "blur" }
- ],
- districtId: [
- { required: true, message: "所在区不能为空", trigger: "blur" }
- ],
- contactName: [
- { required: true, message: "联系人不能为空", trigger: "blur" }
- ],
- mobile: [
- { required: true, message: "联系手机不能为空", trigger: "blur" }
- ],
- type: [
- { required: true, message: "佣金类型不能为空", trigger: "blur" }
- ],
- huolalaCommission: [
- { required: true, message: "货拉拉佣金金额不能为空", trigger: "blur" }
- ],
- bindingThirdCommission: [
- { required: true, message: "绑定三方运力佣金比例不能为空", trigger: "blur" }
- ],
- }
- };
- },
- created() {
- // 代理商登录跳转到代理商详情
- this.user = {type: '',name: ''}
- var type = localStorage.getItem("SYS_USER_TYPE")
- if(type == '0'){
- this.user.type = 0
- this.user.name = "系统"
- }
- if(type == '1'){
- this.user.type = 1
- this.user.name = "渠道商"
- }
- if(type == '2'){
- this.user.type = 2
- this.user.name = "代理商"
- }
- if (this.user.type == 2){
- this.$router.push({ path: '/agent/agent/info' })
- } else {
- // this.getUser()
- // alert(this.user.type)
- }
- this.getList();
- this.getMaxRate()
- this.getLevelList()
- this.$http.get("/module/packageDelivery/getDeliveryList").then(({ data }) => {
- this.packageDeliveryList = data
- })
- this.$http.get("/module/packageDiscount/getDiscountList").then(({ data }) => {
- this.packageDiscountList = data
- })
- this.$http.get("/module/packageCommission/getCommissionList").then(({ data }) => {
- this.packageCommissionList = data
- })
- },
- methods: {
- handleCommission(agentId, packageType) {
- this.packageRequest.agentId = agentId;
- this.packageRequest.packageType = packageType;
- getAgent(agentId).then(response => {
- this.packageRequest.packageId = response.data.packageCommissionId
- });
- this.packageRequestOpen = true;
- },
- handleDiscount(agentId, packageType) {
- this.packageRequest.agentId = agentId;
- this.packageRequest.packageType = packageType;
- getAgent(agentId).then(response => {
- this.packageRequest.packageId = response.data.packageDiscountId
- });
- this.packageRequestOpen = true;
- },
- changeSendArea(e) {
- this.sendStartArea = e
- },
- getLevelList(){
- getAgentLevelList().then(response => {
- this.agentLevelList = response.data
- })
- },
- getMaxRate(){
- this.$http
- .get(`/module/agent/getMaxRete`)
- .then(({
- data
- }) => {
- if (data) {
- console.log('maxrate', data)
- this.maxRate = data.maxRate
- this.qishouMax = data.qishouMax
- this.huolalaMax = data.huolalaMax
- // this.bindingThirdMax = data.bindingThirdMax
- // this.maxRate = data
- }
- })
- },
- gotoInfo(id){
- this.$router.push({ path: '/agent/agent/info', query: { id: id } })
- },
- // 选择区域
- changeArea (e) {
- this.startArea = e
- // this.$http.get('/module/bindDeliveryConfig/getBindingThirdMax?cityId=' + this.startArea.city).then(( { data } ) => {
- // console.log('data', data)
- // this.bindingThirdMax = data
- // console.log('bindMinFee', this.bindingThirdMax)
- // })
- },
- /** 查询代理商列表 */
- getList() {
- if (this.user.type == 2){
- this.$router.push({ path: '/agent/agent/info' })
- }
- this.loading = true;
- if(null != this.date && "" != this.date) {
- this.queryParams.startTime = this.date[0];
- this.queryParams.endTime = this.date[1];
- }else {
- this.queryParams.startTime = "";
- this.queryParams.endTime = "";
- }
- listAgent(this.queryParams).then(response => {
- this.agentList = response.rows;
- this.total = response.total;
- this.loading = false;
- });
- },
- // 取消按钮
- cancel() {
- this.open = false;
- this.reset();
- },
- cancelPackage() {
- this.packageRequestOpen = false;
- this.packageRequest = {
- packageType: undefined,
- packageId: undefined,
- agentId: undefined
- };
- },
- // 表单重置
- reset() {
- this.form = {
- id: undefined,
- name: undefined,
- pid: undefined,
- provinceId: undefined,
- cityId: undefined,
- districtId: undefined,
- agentLevel: undefined,
- commissionRate: undefined,
- contactName: undefined,
- avatar: undefined,
- mobile: undefined,
- address: undefined,
- provinceName: undefined,
- cityName: undefined,
- districtName: undefined,
- mobilePhone: undefined,
- isPid: undefined,
- remark: undefined,
- type: 0,
- huolalaCommission: undefined,
- bindingThirdCommission: undefined,
- packageDiscountId: undefined,
- packageCommissionid: undefined
- };
- this.resetForm("form");
- this.startArea = {
- province: '',
- city: '',
- district: '',
- provinceName: '',
- cityName: '',
- districtName: '',
- cityValues: [],
- districtValues: [],
- districtNames: [],
- };
- this.areaProp = {}
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryParams.pageNum = 1;
- this.queryParams.provinceName = this.sendStartArea.provinceName
- this.queryParams.cityName = this.sendStartArea.cityName
- this.queryParams.districtName = this.sendStartArea.districtName
- this.getList();
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.resetForm("queryForm");
- this.date = []
- this.queryParams.startTime = ""
- this.queryParams.endTime = ""
- this.sendStartArea = {
- province: '',
- city: '',
- district: '',
- provinceName: '',
- cityName: '',
- districtName: '',
- cityValues: [],
- districtValues: [],
- districtNames: [],
- };
- this.sendAreaProp = {}
- this.handleQuery();
- },
- // 多选框选中数据
- handleSelectionChange(selection) {
- this.ids = selection.map(item => item.id)
- this.single = selection.length!==1
- this.multiple = !selection.length
- },
- /** 新增按钮操作 */
- handleAdd() {
- this.reset();
- this.open = true;
- this.title = "添加代理商";
- },
- /** 修改按钮操作 */
- handleUpdate(row) {
- this.reset();
- const id = row.id || this.ids
- getAgent(id).then(response => {
- this.form = response.data;
- this.form.mobilePhone = response.data.mobile
- this.startArea.province = response.data.provinceId
- this.startArea.district = response.data.districtId
- this.startArea.city = response.data.cityId
- this.startArea.provinceName = response.data.provinceName
- this.startArea.cityName = response.data.cityName
- this.startArea.districtName = response.data.districtName
- this.startArea.district = this.startArea.district.split(",");
- this.bindingThirdMax = response.data.bindingThirdMax
- area.area.forEach(v => {
- if (v.id === this.startArea.province) {
- this.startArea.cityValues = v.childs
- }
- })
- this.startArea.cityValues.forEach(v =>{
- if (v.id === this.startArea.city) {
- this.startArea.districtValues = v.childs
- }
- })
- this.areaProp = JSON.parse(JSON.stringify(this.startArea))
- this.open = true;
- this.title = "修改代理商";
- });
- },
- /** 提交按钮 */
- submitForm() {
- this.$refs["form"].validate(valid => {
- if (valid) {
- if (this.startArea.province === undefined || this.startArea.city === undefined || this.startArea.district === undefined) {
- this.$message({
- message: '请选择地区',
- type: 'error',
- duration: 1500
- })
- return
- }
- this.form.provinceId = this.startArea.province
- this.form.cityId = this.startArea.city
- this.form.districtId = this.startArea.district.join(",")
- this.form.provinceName = this.startArea.provinceName
- this.form.cityName = this.startArea.cityName
- this.form.districtName = this.startArea.districtName
- if (this.form.id != null) {
- updateAgent(this.form).then(response => {
- this.msgSuccess("修改成功");
- this.open = false;
- this.getList();
- });
- } else {
- console.log(this.form)
- addAgent(this.form).then(response => {
- this.msgSuccess("新增成功");
- this.open = false;
- this.getList();
- });
- }
- }
- });
- },
- submitFormPackage() {
- this.$refs["packageRequest"].validate(valid => {
- if (valid) {
- if(this.packageRequest.packageType == 1) {
- this.$http.post('/module/agent/bindDiscountPackage', this.packageRequest).then(( { data }) => {
- if(data) {
- this.$message.success('绑定成功!');
- this.packageRequestOpen = false;
- this.getList();
- }
- })
- }
- if(this.packageRequest.packageType == 2) {
- this.$http.post('/module/agent/bindCommissionPackage', this.packageRequest).then(( { data }) => {
- if(data) {
- this.$message.success('绑定成功!');
- this.packageRequestOpen = false;
- this.getList();
- }
- })
- }
- }
- })
- },
- /** 删除按钮操作 */
- handleDelete(row) {
- const ids = row.id || this.ids;
- this.$confirm('是否确认删除代理商编号为"' + ids + '"的数据项?', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(function() {
- return delAgent(ids);
- }).then(() => {
- this.getList();
- this.msgSuccess("删除成功");
- })
- },
- /** 导出按钮操作 */
- handleExport() {
- const queryParams = this.queryParams;
- this.$confirm('是否确认导出所有代理商数据项?', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(function() {
- return exportAgent(queryParams);
- }).then(response => {
- this.download(response.msg);
- })
- }
- }
- };
- </script>
|