Commit de70c170 authored by dcy's avatar dcy

佣金设置

parent 30ae2f0a
import request from '@/utils/request' import request from '@/utils/request'
// 创建客户佣金类型
export function createCustomerCommission(data) {
return request({
url: '/ecw/customer-commission/create',
method: 'post',
data: data
})
}
// 更新客户佣金类型
export function updateCustomerCommission(data) {
return request({
url: '/ecw/customer-commission/update',
method: 'put',
data: data
})
}
// 删除客户佣金类型 // 删除客户佣金类型
export function deleteCustomerCommission(id) { export function deleteCustomerCommission(id) {
...@@ -26,13 +9,6 @@ export function deleteCustomerCommission(id) { ...@@ -26,13 +9,6 @@ export function deleteCustomerCommission(id) {
}) })
} }
// 获得客户佣金类型
export function getCustomerCommission(id) {
return request({
url: '/ecw/customer-commission/get?id=' + id,
method: 'get'
})
}
// 获得客户佣金类型分页 // 获得客户佣金类型分页
export function getCustomerCommissionPage(query) { export function getCustomerCommissionPage(query) {
......
import request from '@/utils/request' import request from '@/utils/request'
// 创建客户佣金详情
export function createCustomerCommissionInfo(data) {
return request({
url: '/ecw/customer-commission-info/create',
method: 'post',
data: data
})
}
// 更新客户佣金详情 // 更新客户佣金详情
export function updateCustomerCommissionInfo(data) { export function updateCustomerCommissionInfo(data) {
return request({ return request({
url: '/ecw/customer-commission-info/update', url: '/ecw/customer-commission/update',
method: 'put', method: 'put',
data: data data: data
}) })
} }
// 删除客户佣金详情
export function deleteCustomerCommissionInfo(id) {
return request({
url: '/ecw/customer-commission-info/delete?id=' + id,
method: 'delete'
})
}
// 获得客户佣金详情
export function getCustomerCommissionInfo(id) {
return request({
url: '/ecw/customer-commission-info/get?id=' + id,
method: 'get'
})
}
// 获得客户佣金详情分页
export function getCustomerCommissionInfoPage(query) {
return request({
url: '/ecw/customer-commission-info/page',
method: 'get',
params: query
})
}
// 导出客户佣金详情 Excel
export function exportCustomerCommissionInfoExcel(query) {
return request({
url: '/ecw/customer-commission-info/export-excel',
method: 'get',
query: query,
responseType: 'blob'
})
}
//商品类型列表 //商品类型列表
export function itemTypeListApi(query){ export function itemTypeListApi(query){
return request({ return request({
...@@ -76,6 +36,7 @@ export function commodityList(){ ...@@ -76,6 +36,7 @@ export function commodityList(){
}) })
} }
//创建佣金
export function createCommission(query){ export function createCommission(query){
return request({ return request({
url:'/ecw/customer-commission/create', url:'/ecw/customer-commission/create',
...@@ -83,3 +44,18 @@ export function createCommission(query){ ...@@ -83,3 +44,18 @@ export function createCommission(query){
data:query data:query
}) })
} }
// 获得客户佣金类型详情
export function getCustomerCommission(id) {
return request({
url: '/ecw/customer-commission-info/get-by-commission-id?commissionId=' + id,
method: 'get'
})
}
//获得客户佣金详情
export function commissionGetByCustomerId (id){
return request({
url:'/ecw/customer-commission/getByCustomerId?customerId='+id,
method:'get'
})
}
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="客户名称" prop="customerId"> <el-form-item label="客户名称" prop="customerId" >
<el-input v-model="queryParams.customerId" placeholder="请选择客户id" clearable size="small"> <el-input v-model="queryParams.customerId" placeholder="请选择客户id" clearable size="small">
</el-input> </el-input>
</el-form-item> </el-form-item>
...@@ -13,35 +13,37 @@ ...@@ -13,35 +13,37 @@
</el-form-item> </el-form-item>
<el-form-item label="佣金类型" prop="transportId"> <el-form-item label="佣金类型" prop="transportId">
<el-select v-model="queryParams.type" clearable size="small"> <el-select v-model="queryParams.type" clearable size="small">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.TRANSPORT_TYPE)" <el-option v-for="dict in this.getDictDatas(DICT_TYPE.COMMISSION_TYPE)"
:key="dict.value" :label="dict.label" :value="dict.value"/> :key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="运输方式" prop="departureId"> <el-form-item label="运输方式" prop="departureId">
<el-select v-model="queryParams.departureId" clearable size="small"> <el-select v-model="queryParams.departureId" clearable size="small">
<el-option label="请选择字典生成" value="" /> <el-option v-for="dict in this.getDictDatas(DICT_TYPE.ECW_TRANSPORT_TYPE)"
:key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="始发地" prop="objectiveId"> <el-form-item label="始发地" prop="objectiveId">
<el-select v-model="queryParams.objectiveId" clearable size="small"> <el-select v-model="queryParams.objectiveId" clearable size="small">
<el-option label="请选择字典生成" value="" /> <el-option v-for="dict in exportCityList"
:key="dict.id" :label="dict.titleZh" :value="dict.id"/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="目的地" prop="customsType"> <el-form-item label="目的地" prop="customsType">
<el-select v-model="queryParams.customsType" clearable size="small"> <el-select v-model="queryParams.customsType" clearable size="small">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.CUSTOMS_TYPE)" <el-option v-for="dict in importCityList"
:key="dict.value" :label="dict.label" :value="dict.value"/> :key="dict.id" :label="dict.titleZh" :value="dict.id"/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="报关方式" prop="approval"> <el-form-item label="报关方式" prop="approval">
<el-select v-model="queryParams.approval" clearable size="small"> <el-select v-model="queryParams.approval" clearable size="small">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.COMMISSION_PRODUCT_APPROVAL)" <el-option v-for="dict in this.getDictDatas(DICT_TYPE.SHIPPING_DECLARATION_TYPE)"
:key="dict.value" :label="dict.label" :value="dict.value"/> :key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="备案" prop="darkReturnType"> <el-form-item label="备案" prop="darkReturnType">
<el-select v-model="queryParams.darkReturnType" clearable size="small"> <el-select v-model="queryParams.darkReturnType" clearable size="small">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.COMMISSION_DARK_TYPE)" <el-option v-for="dict in this.getDictDatas(DICT_TYPE.COMMISSION_PRODUCT_APPROVAL)"
:key="dict.value" :label="dict.label" :value="dict.value"/> :key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -60,12 +62,6 @@ ...@@ -60,12 +62,6 @@
<!-- 操作工具栏 --> <!-- 操作工具栏 -->
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['ecw:customer-commission:create']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
v-hasPermi="['ecw:customer-commission:export']">导出</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
...@@ -77,51 +73,54 @@ ...@@ -77,51 +73,54 @@
width="55"> width="55">
</el-table-column> </el-table-column>
<el-table-column label="佣金编码" align="center" prop="customerId" /> <el-table-column label="佣金编码" align="center" prop="customerId" />
<el-table-column label="客户名称" align="center" prop="customerName"> <el-table-column label="客户名称" align="center" prop="customerName" show-overflow-tooltip >
</el-table-column> </el-table-column>
<el-table-column label="联系电话" align="center" prop="transportId"> <el-table-column label="联系电话" align="center" prop="transportId" show-overflow-tooltip >
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :type="DICT_TYPE.TRANSPORT_TYPE" :value="scope.row.transportId" /> <div>{{scope.row.defaultContactPhone}}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="佣金类型" align="center" prop="departureId" /> <el-table-column label="佣金类型" type="" align="center" prop="type">
<el-table-column label="暗佣返佣类型" align="center" prop="objectiveId" />
<el-table-column label="运输方式" align="center" prop="customsType">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :type="DICT_TYPE.CUSTOMS_TYPE" :value="scope.row.customsType" /> <dict-tag :type="DICT_TYPE.COMMISSION_TYPE" :value="scope.row.type" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="始发地/目的地 " align="center" prop="approval"> <el-table-column label="暗佣返佣类型" align="center" prop="darkReturnType">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :type="DICT_TYPE.COMMISSION_PRODUCT_APPROVAL" :value="scope.row.approval" /> <dict-tag :type="DICT_TYPE.COMMISSION_DARK_TYPE" :value="scope.row.type" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="报关方式" align="center" prop="darkReturnType"> <el-table-column label="运输方式" align="center" prop="transportId">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :type="DICT_TYPE.COMMISSION_DARK_TYPE" :value="scope.row.darkReturnType" /> <dict-tag :type="DICT_TYPE.ECW_TRANSPORT_TYPE" :value="scope.row.transportId" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备案" align="center" prop="darkReturnType"> <el-table-column label="始发地/目的地 " align="center" prop="departureId" show-overflow-tooltip :formatter="originDestination">
</el-table-column>
<el-table-column label="报关方式" align="center" prop="customsType" show-overflow-tooltip>
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :type="DICT_TYPE.COMMISSION_DARK_TYPE" :value="scope.row.darkReturnType" /> <dict-tag :type="DICT_TYPE.SHIPPING_DECLARATION_TYPE" :value="scope.row.customsType" />
</template>
</el-table-column>
<el-table-column label="备案" align="center" prop="approval">
<template slot-scope="scope">
<dict-tag :type="DICT_TYPE.COMMISSION_PRODUCT_APPROVAL" :value="scope.row.approval" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="未付佣金" align="center" prop="darkReturnType"> <el-table-column label="未付佣金" align="center" prop="darkReturnType">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :type="DICT_TYPE.COMMISSION_DARK_TYPE" :value="scope.row.darkReturnType" /> <!-- <dict-tag :type="DICT_TYPE.COMMISSION_DARK_TYPE" :value="scope.row.darkReturnType" />-->
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="已付佣金" align="center" prop="darkReturnType"> <el-table-column label="已付佣金" align="center" prop="darkReturnType">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :type="DICT_TYPE.COMMISSION_DARK_TYPE" :value="scope.row.darkReturnType" /> <!-- <dict-tag :type="DICT_TYPE.COMMISSION_DARK_TYPE" :value="scope.row.darkReturnType" />-->
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">编辑</el-button>
v-hasPermi="['ecw:customer-commission:update']">编辑</el-button> <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['ecw:customer-commission:delete']">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -129,65 +128,13 @@ ...@@ -129,65 +128,13 @@
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/> @pagination="getList"/>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="客户id" prop="customerId">
<el-select v-model="form.customerId" placeholder="请选择客户id">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="佣金类型" prop="type">
<el-select v-model="form.type" placeholder="请选择佣金类型">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.COMMISSION_TYPE)"
:key="dict.value" :label="dict.label" :value="parseInt(dict.value)" />
</el-select>
</el-form-item>
<el-form-item label="运输方式" prop="transportId">
<el-select v-model="form.transportId" placeholder="请选择运输方式">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.TRANSPORT_TYPE)"
:key="dict.value" :label="dict.label" :value="parseInt(dict.value)" />
</el-select>
</el-form-item>
<el-form-item label="始发地id" prop="departureId">
<el-select v-model="form.departureId" placeholder="请选择始发地id">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="目的地id" prop="objectiveId">
<el-select v-model="form.objectiveId" placeholder="请选择目的地id">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="报关类别:我司全代:1,自单代报:2,混合报关:3" prop="customsType">
<el-select v-model="form.customsType" placeholder="请选择报关类别:我司全代:1,自单代报:2,混合报关:3">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.CUSTOMS_TYPE)"
:key="dict.value" :label="dict.label" :value="parseInt(dict.value)" />
</el-select>
</el-form-item>
<el-form-item label="产品备案" prop="approval">
<el-select v-model="form.approval" placeholder="请选择产品备案">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.COMMISSION_PRODUCT_APPROVAL)"
:key="dict.value" :label="dict.label" :value="parseInt(dict.value)" />
</el-select>
</el-form-item>
<el-form-item label="暗佣类型 1产品2达标" prop="darkReturnType">
<el-select v-model="form.darkReturnType" placeholder="请选择暗佣类型 1产品2达标">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.COMMISSION_DARK_TYPE)"
:key="dict.value" :label="dict.label" :value="parseInt(dict.value)" />
</el-select>
</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>
</div> </div>
</template> </template>
<script> <script>
import { createCustomerCommission, updateCustomerCommission, deleteCustomerCommission, getCustomerCommission, getCustomerCommissionPage, exportCustomerCommissionExcel } from "@/api/ecw/customerCommission"; import {deleteCustomerCommission, getCustomerCommissionPage, exportCustomerCommissionExcel } from "@/api/ecw/customerCommission";
import {DICT_TYPE, getDictDatas} from "@/utils/dict";
import {getTradeCityList} from "@/api/ecw/region";
export default { export default {
name: "CustomerCommission", name: "CustomerCommission",
...@@ -195,6 +142,9 @@ export default { ...@@ -195,6 +142,9 @@ export default {
}, },
data() { data() {
return { return {
DICT_TYPE,
getDictDatas,
tradeCityList:[],
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 导出遮罩层 // 导出遮罩层
...@@ -233,8 +183,21 @@ export default { ...@@ -233,8 +183,21 @@ export default {
} }
}; };
}, },
computed:{
//目的地
importCityList(){
return this.tradeCityList.filter(item => item.type == 1)
},
//始发地
exportCityList(){
return this.tradeCityList.filter(item => item.type == 2)
},
},
created() { created() {
this.getList(); this.getList();
getTradeCityList().then(res => {
this.tradeCityList = res.data
})
}, },
methods: { methods: {
/** 查询列表 */ /** 查询列表 */
...@@ -249,26 +212,6 @@ export default { ...@@ -249,26 +212,6 @@ export default {
this.loading = false; this.loading = false;
}); });
}, },
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
customerId: undefined,
type: undefined,
transportId: undefined,
departureId: undefined,
objectiveId: undefined,
customsType: undefined,
approval: undefined,
darkReturnType: undefined,
};
this.resetForm("form");
},
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNo = 1; this.queryParams.pageNo = 1;
...@@ -279,44 +222,10 @@ export default { ...@@ -279,44 +222,10 @@ export default {
this.resetForm("queryForm"); this.resetForm("queryForm");
this.handleQuery(); this.handleQuery();
}, },
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加客户佣金类型";
},
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); const id = row.customerId;
const id = row.id; this.$router.push(`/customerCommissionInfo/${id}`)
getCustomerCommission(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改客户佣金类型";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
// 修改的提交
if (this.form.id != null) {
updateCustomerCommission(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
// 添加的提交
createCustomerCommission(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
});
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
...@@ -328,21 +237,12 @@ export default { ...@@ -328,21 +237,12 @@ export default {
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => {}); }).catch(() => {});
}, },
/** 导出按钮操作 */ originDestination(row){
handleExport() { let index1 = this.exportCityList.findIndex(item =>item.id == row.departureId);
// 处理查询参数 let index2 = this.importCityList.findIndex(item => item.id == row.objectiveId);
let params = {...this.queryParams}; let flag = `${index1 === -1 ? '' : this.exportCityList[index1].titleZh}/${index2 === -1 ? '' : this.importCityList[index2].titleZh}`;
params.pageNo = undefined; return flag
params.pageSize = undefined; },
// 执行导出
this.$modal.confirm('是否确认导出所有客户佣金类型数据项?').then(() => {
this.exportLoading = true;
return exportCustomerCommissionExcel(params);
}).then(response => {
this.$download.excel(response, '${table.classComment}.xls');
this.exportLoading = false;
}).catch(() => {});
}
} }
}; };
</script> </script>
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
v-for="item in options" v-for="item in options"
:key="item[valueKey]" :key="item[valueKey]"
:label="item[labelKey]" :label="item[labelKey]"
:value="item[valueKey]"> :value="parseInt(item[valueKey])">
</el-option> </el-option>
</el-select> </el-select>
</template> </template>
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
remote remote
reserve-keyword reserve-keyword
placeholder="请输入关键词" placeholder="请输入关键词"
@change="changefn"
:remote-method="remoteMethod"> :remote-method="remoteMethod">
<el-option <el-option
v-for="item in customeList" v-for="item in customeList"
...@@ -69,7 +70,7 @@ ...@@ -69,7 +70,7 @@
<el-col :span="24"> <el-col :span="24">
<el-form-item label="佣金类型(明佣、暗佣)"> <el-form-item label="佣金类型(明佣、暗佣)">
<el-radio-group v-model="form.type"> <el-radio-group v-model="form.type">
<el-radio v-for="(item,index) in getDictDatas(DICT_TYPE.COMMISSION_TYPE)" :label="item.value" <el-radio v-for="(item,index) in getDictDatas(DICT_TYPE.COMMISSION_TYPE)" :label="parseInt(item.value)"
:key="index">{{ item.label }} :key="index">{{ item.label }}
</el-radio> </el-radio>
</el-radio-group> </el-radio-group>
...@@ -80,7 +81,7 @@ ...@@ -80,7 +81,7 @@
<el-col :span="24"> <el-col :span="24">
<el-form-item label="返佣类型" v-if="form.type == 2"> <el-form-item label="返佣类型" v-if="form.type == 2">
<el-radio-group v-model="form.darkReturnType"> <el-radio-group v-model="form.darkReturnType">
<el-radio v-for="(item,index) in getDictDatas(DICT_TYPE.COMMISSION_DARK_TYPE)" :label="item.value" <el-radio v-for="(item,index) in getDictDatas(DICT_TYPE.COMMISSION_DARK_TYPE)" :label="parseInt(item.value)"
:key="index">{{ item.label }} :key="index">{{ item.label }}
</el-radio> </el-radio>
</el-radio-group> </el-radio-group>
...@@ -176,7 +177,7 @@ ...@@ -176,7 +177,7 @@
:options="getDictDatas(DICT_TYPE.COMMISSION_UNIT)"></custom-selectors-dictionary> :options="getDictDatas(DICT_TYPE.COMMISSION_UNIT)"></custom-selectors-dictionary>
</div> </div>
</div> </div>
<el-button @click="addToFn(2)" v-show="darkServantAndRebateForm.length -1 === index">添加</el-button> <el-button type="primary" @click="addToFn(2)" v-show="darkServantAndRebateForm.length -1 === index">添加</el-button>
</div> </div>
</div> </div>
<div class="mingServantAndDarkServant" v-if="form.type == 3"> <div class="mingServantAndDarkServant" v-if="form.type == 3">
...@@ -224,7 +225,7 @@ ...@@ -224,7 +225,7 @@
<el-row> <el-row>
<el-col :span="12" style="margin-top: 20px"> <el-col :span="12" style="margin-top: 20px">
<el-button style="width:200px;margin: 0 40px" type="primary" @click="submitForm">确定</el-button> <el-button style="width:200px;margin: 0 40px" type="primary" @click="submitForm">确定</el-button>
<el-button style="width:200px">取消</el-button> <el-button style="width:200px" @click="cancel">取消</el-button>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
...@@ -234,23 +235,26 @@ ...@@ -234,23 +235,26 @@
<script> <script>
import { import {
itemTypeListApi, itemTypeListApi,
customerDropDownList, commodityList,createCommission customerDropDownList, commodityList,createCommission,getCustomerCommission,commissionGetByCustomerId,updateCustomerCommissionInfo
} from "@/api/ecw/customerCommissionInfo"; } from "@/api/ecw/customerCommissionInfo";
import {DICT_TYPE, getDictDatas} from "@/utils/dict"; import {DICT_TYPE, getDictDatas} from "@/utils/dict";
import customSelectorsDictionary from "./customSelectorsDictionary" import customSelectorsDictionary from "./customSelectorsDictionary"
import {getTradeCityList} from "@/api/ecw/region"; import {getTradeCityList} from "@/api/ecw/region";
import RoutersSelector from "@/components/RoutersSelector" import RoutersSelector from "@/components/RoutersSelector"
import CustomersSelector from "@/components/CustomersSelector";
export default { export default {
name: "CustomerCommissionInfo", name: "CustomerCommissionInfo",
components: { components: {
customSelectorsDictionary, customSelectorsDictionary,
RoutersSelector RoutersSelector,
CustomersSelector
}, },
data() { data() {
return { return {
value: '', value: '',
isSubmit:false,
getDictDatas, getDictDatas,
DICT_TYPE, DICT_TYPE,
commodityType: [], commodityType: [],
...@@ -261,18 +265,18 @@ export default { ...@@ -261,18 +265,18 @@ export default {
customerCommissionInfoBaseVOList: [],// 佣金详情 customerCommissionInfoBaseVOList: [],// 佣金详情
customerId: undefined,//客户id customerId: undefined,//客户id
customsType: undefined,//报关类别:我司全代:1,自单代报:2,混合报关:3 customsType: undefined,//报关类别:我司全代:1,自单代报:2,混合报关:3
darkReturnType: this.getDictDatas(this.DICT_TYPE.COMMISSION_DARK_TYPE)[0].value,// 暗佣类型 1产品2达标 darkReturnType: parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_DARK_TYPE)[0].value),// 暗佣类型 1产品2达标
departureId: undefined,// 始发地id departureId: undefined,// 始发地id
objectiveId: undefined,//目的地id objectiveId: undefined,//目的地id
transportId:undefined,//运输方式 transportId:undefined,//运输方式
type: this.getDictDatas(this.DICT_TYPE.COMMISSION_TYPE)[1].value,// 佣金类型 type: parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_TYPE)[1].value),// 佣金类型
}, },
//明佣 //明佣
mingServantFrom: [ mingServantFrom: [
{ {
refund: 0, refund: 0,
refundCurrency:this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value, refundCurrency:parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value),
refundUnit: this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[0].value, refundUnit: parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[0].value),
} }
], ],
//暗佣金+产品 //暗佣金+产品
...@@ -281,30 +285,30 @@ export default { ...@@ -281,30 +285,30 @@ export default {
productType:undefined,//商品类型 productType:undefined,//商品类型
productAttr: undefined,//暗佣 产品属性 productAttr: undefined,//暗佣 产品属性
darkCommission: 0,//暗佣 佣金 darkCommission: 0,//暗佣 佣金
darkCurrency: this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value,// 暗佣 货币 darkCurrency: parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value),// 暗佣 货币
darkUnit: this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[0].value,// 暗佣 单位 darkUnit:parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[0].value),// 暗佣 单位
} }
], ],
//暗佣+达标返佣 //暗佣+达标返佣
darkServantAndRebateForm: [ darkServantAndRebateForm: [
{ {
amount: 0,// 暗佣-满减金额 amount: 0,// 暗佣-满减金额
amountCurrency: this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value,// 暗佣-满减金额对应货币 amountCurrency:parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value),// 暗佣-满减金额对应货币
amountUnit: this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[0].value,// 暗佣-满减金额对应单位, amountUnit:parseInt (this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[0].value),// 暗佣-满减金额对应单位,
refund: 0,//暗佣-满之后返还金额 refund: 0,//暗佣-满之后返还金额
refundCurrency: this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value,//暗佣-满之后返还金额的货币 refundCurrency:parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value),//暗佣-满之后返还金额的货币
refundUnit: this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[0].value,//暗佣-满之后返还金额的单位 refundUnit:parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[0].value),//暗佣-满之后返还金额的单位
} }
], ],
//暗佣+明金 //暗佣+明金
mingServantAnddarkServant: [ mingServantAnddarkServant: [
{ {
refund: 0,// 暗佣+明佣 上调金额 refund: 0,// 暗佣+明佣 上调金额
refundCurrency: this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value,// 暗佣+明佣 上调对应的货币 refundCurrency: parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value),// 暗佣+明佣 上调对应的货币
refundUnit: this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[0].value,//暗佣+明佣 上调对应的单位 refundUnit: parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[0].value),//暗佣+明佣 上调对应的单位
darkAdjustCommission: 0,//暗佣+明佣 上调金额 darkAdjustCommission: 0,//暗佣+明佣 上调金额
darkAdjustCurrency: this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value,//暗佣+明佣 上调对应的货币 darkAdjustCurrency: parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value),//暗佣+明佣 上调对应的货币
darkAdjustUnit: this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[0].value,//暗佣+明佣 上调对应的单位 darkAdjustUnit:parseInt( this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[0].value),//暗佣+明佣 上调对应的单位
} }
], ],
customerForm: { customerForm: {
...@@ -318,13 +322,14 @@ export default { ...@@ -318,13 +322,14 @@ export default {
// 表单校验 // 表单校验
rules: { rules: {
customerId: [{required: true, message: "客户名称不能为空", trigger: "blur"}], customerId: [{required: true, message: "客户名称不能为空", trigger: "blur"}],
departureId: [{required: true, message: "客户名称不能为空", trigger: "blur"}], departureId: [{required: true, message: "始发地不能为空", trigger: "blur"}],
transportId: [{required: true, message: "运输方式不能为空", trigger: "blur"}], transportId: [{required: true, message: "运输方式不能为空", trigger: "blur"}],
objectiveId: [{required: true, message: "客户名称不能为空", trigger: "blur"}], objectiveId: [{required: true, message: "目的地不能为空", trigger: "blur"}],
customsType: [{required: true, message: "客户名称不能为空", trigger: "blur"}], customsType: [{required: true, message: "报关类别不能为空", trigger: "blur"}],
approval: [{required: true, message: "客户名称不能为空", trigger: "blur"}], approval: [{required: true, message: "产品备案不能为空", trigger: "blur"}],
}, },
customerShow: true customerShow: true,
id:undefined,//佣金id
}; };
}, },
computed:{ computed:{
...@@ -336,12 +341,51 @@ export default { ...@@ -336,12 +341,51 @@ export default {
}, },
}, },
created() { created() {
if(this.$route.params.dictId != 0){
commissionGetByCustomerId(this.$route.params.dictId).then(r => {
if(r.code === 0){
let f = this.form;
let p = r.data;
f.type = p.type;
f.approval = p.approval;
f.customerId = p.customerId;
f.customsType = p.customsType;
f.darkReturnType = p.darkReturnType;
f.departureId = p.departureId;
f.objectiveId = p.objectiveId;
f.transportId = p.transportId;
this.form = f;
this.customerForm.name = p.customerName;
this.id = r.data.id;
}
getCustomerCommission(r.data.id).then(r =>{
console.log(r,'客户佣金详情');
if(r.code != 0 || r.data.length == 0) return
if(this.form.type == 1){
//明佣
this.mingServantFrom = r.data
}else if(this.form.type == 2){
console.log('暗—-产')
if(this.form.darkReturnType == 1){
// 暗佣+产品
console.log('1234')
this.darkServantAndProductForm = r.data
}else {
// 暗佣+达标返佣
this.darkServantAndRebateForm = r.data
}
}else {
// 名佣+返佣
this.mingServantAnddarkServant =r.data
}
})
})
}else {
}
this.getItemType(); this.getItemType();
commodityList().then(res => { this.productAttrFn();
console.log(res, 'res');
this.commodity = res.data
this.darkServantAndProductForm.forEach(item=>{item.productType =this.commodity[0].id})
})
getTradeCityList().then(res => { getTradeCityList().then(res => {
this.tradeCityList = res.data this.tradeCityList = res.data
}) })
...@@ -358,11 +402,16 @@ export default { ...@@ -358,11 +402,16 @@ export default {
}, },
remoteMethod(val) { remoteMethod(val) {
this.customerForm.name = val; this.customerForm.name = val;
this.form.customerId = val; console.log(val,'customerId')
this.getCustomeList(); this.getCustomeList();
}, },
changefn(val){
console.log(val,'val')
this.form.customerId = val;
},
/** 取消按钮 */ /** 取消按钮 */
cancel() { cancel() {
this.$router.go(-1);
}, },
/** 表单重置 */ /** 表单重置 */
reset() { reset() {
...@@ -381,29 +430,29 @@ export default { ...@@ -381,29 +430,29 @@ export default {
//添加多条 //添加多条
addToFn(val){ addToFn(val){
if(val === 1){ if(val === 1){
this.darkServantAndProductForm.push( { this.darkServantAndProductForm.push({
productType:this.commodity[0].id,//商品类型 productType:this.commodity[0].id,//商品类型
productAttr: this.commodityType[0].id,//暗佣 产品属性 productAttr: this.commodityType[0].id,//暗佣 产品属性
darkCommission: 0,//暗佣 佣金 darkCommission: 0,//暗佣 佣金
darkCurrency: this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value,// 暗佣 货币 darkCurrency: parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value),// 暗佣 货币
darkUnit: this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[0].value,// 暗佣 单位 darkUnit:this.darkServantAndProductForm[0].darkUnit,// 暗佣 单位
}) })
}else { }else {
this.darkServantAndRebateForm.push( { this.darkServantAndRebateForm.push( {
amount: 0,// 暗佣-满减金额 amount: 0,// 暗佣-满减金额
amountCurrency: this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value,// 暗佣-满减金额对应货币 amountCurrency:parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value),// 暗佣-满减金额对应货币
amountUnit: this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[0].value,// 暗佣-满减金额对应单位, amountUnit: parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[0].value),// 暗佣-满减金额对应单位,
refund: 0,//暗佣-满之后返还金额 refund: 0,//暗佣-满之后返还金额
refundCurrency: this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value,//暗佣-满之后返还金额的货币 refundCurrency: parseInt (this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value),//暗佣-满之后返还金额的货币
refundUnit: this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[0].value,//暗佣-满之后返还金额的单位 refundUnit: this.darkServantAndRebateForm[0].refundUnit,//暗佣-满之后返还金额的单位
}) })
} }
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs.form.validate ((valid)=>{ this.$refs.form.validate ((valid)=>{
this.isSubmit = true;
if(!valid)return if(!valid)return
console.log(valid,'1234')
if (this.form.type == 1) { if (this.form.type == 1) {
this.form.customerCommissionInfoBaseVOList = this.mingServantFrom this.form.customerCommissionInfoBaseVOList = this.mingServantFrom
} else if (this.form.type == 2) { } else if (this.form.type == 2) {
...@@ -415,9 +464,29 @@ export default { ...@@ -415,9 +464,29 @@ export default {
} else if (this.form.type == 3) { } else if (this.form.type == 3) {
this.form.customerCommissionInfoBaseVOList = this.mingServantAnddarkServant this.form.customerCommissionInfoBaseVOList = this.mingServantAnddarkServant
} }
createCommission(this.form).then(r =>{ if(this.$route.params.dictId == 0){
console.log(r) createCommission(this.form).then(r =>{
}) console.log('添加',r)
if(r.code == 0){
this.$message('添加成功!');
this.$router.go(-1)
}
})
}else {
let p = {
id :this.id,
customerCommissionInfoBaseVOList:this.form.customerCommissionInfoBaseVOList
}
p.customerCommissionInfoBaseVOList.forEach(item => {item.commissionId = this.$route.params.dictId})
updateCustomerCommissionInfo(p).then(r=>{
console.log('更新',r)
if(r.code == 0){
this.$router.go(-1)
this.$message('修改成功!');
}
})
}
}) })
}, },
// 商品类型 // 商品类型
...@@ -425,10 +494,66 @@ export default { ...@@ -425,10 +494,66 @@ export default {
itemTypeListApi().then(res => { itemTypeListApi().then(res => {
if (res.code === 0) { if (res.code === 0) {
this.commodityType = res.data; this.commodityType = res.data;
this.darkServantAndProductForm.forEach(item =>{item.productAttr = this.commodityType[0].id}) if(this.$route.params.dictId == 0 || (this.form.type == 2 && this.form.darkReturnType != 1)){
this.darkServantAndProductForm.forEach(item =>{item.productAttr = this.commodityType[0].id})
}
} }
}) })
}, },
//商品属性
productAttrFn(){
commodityList().then(res => {
this.commodity = res.data
if(this.$route.params.dictId == 0 || (this.form.type == 2 && this.form.darkReturnType != 1)){
this.darkServantAndProductForm.forEach(item=>{item.productType =this.commodity[0].id})
}
})
}
},
watch:{
form:{
handler(val){
if(this.isSubmit){
this.$refs.form.validate()
}
},
deep:true,
},
'form.transportId':function (val){
if(!this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)) return
if((val == 1 || val == 2)){
let index = this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT).findIndex(item => item.label == '立方米');
this.mingServantFrom.forEach(item =>{
item.refundUnit = parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[index].value);
})
this.mingServantAnddarkServant.forEach(item =>{
item.refundUnit =parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[index].value);
item.darkAdjustUnit =parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[index].value);
})
this.darkServantAndRebateForm.forEach(item =>{
item.refundUnit = parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[index].value);
})
this.darkServantAndProductForm.forEach(item =>{
item.darkUnit = parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[index].value);
})
}else {
let index = this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT).findIndex(item => item.label == '千克');
this.mingServantFrom.forEach(item =>{
item.refundUnit =parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[index].value);
})
this.mingServantAnddarkServant.forEach(item =>{
item.refundUnit = parseInt( this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[index].value);
item.darkAdjustUnit =parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[index].value);
})
this.darkServantAndRebateForm.forEach(item =>{
item.refundUnit =parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[index].value);
})
this.darkServantAndProductForm.forEach(item =>{
item.darkUnit = parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[index].value);
})
}
}
} }
}; };
</script> </script>
...@@ -443,6 +568,7 @@ export default { ...@@ -443,6 +568,7 @@ export default {
font-size: 14px; font-size: 14px;
color: #606266; color: #606266;
font-weight: 700; font-weight: 700;
width: 100px;
} }
.content { .content {
...@@ -539,7 +665,7 @@ export default { ...@@ -539,7 +665,7 @@ export default {
.item { .item {
text-align: right; text-align: right;
width: 150px; width: 130px;
margin: 0 5px; margin: 0 5px;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment