Commit de70c170 authored by dcy's avatar dcy

佣金设置

parent 30ae2f0a
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) {
......@@ -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) {
......
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) {
return request({
url: '/ecw/customer-commission-info/update',
url: '/ecw/customer-commission/update',
method: 'put',
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){
return request({
......@@ -76,6 +36,7 @@ export function commodityList(){
})
}
//创建佣金
export function createCommission(query){
return request({
url:'/ecw/customer-commission/create',
......@@ -83,3 +44,18 @@ export function createCommission(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 @@
<!-- 搜索工作栏 -->
<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>
</el-form-item>
......@@ -13,35 +13,37 @@
</el-form-item>
<el-form-item label="佣金类型" prop="transportId">
<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"/>
</el-select>
</el-form-item>
<el-form-item label="运输方式" prop="departureId">
<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-form-item>
<el-form-item label="始发地" prop="objectiveId">
<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-form-item>
<el-form-item label="目的地" prop="customsType">
<el-select v-model="queryParams.customsType" clearable size="small">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.CUSTOMS_TYPE)"
:key="dict.value" :label="dict.label" :value="dict.value"/>
<el-option v-for="dict in importCityList"
:key="dict.id" :label="dict.titleZh" :value="dict.id"/>
</el-select>
</el-form-item>
<el-form-item label="报关方式" prop="approval">
<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"/>
</el-select>
</el-form-item>
<el-form-item label="备案" prop="darkReturnType">
<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"/>
</el-select>
</el-form-item>
......@@ -60,12 +62,6 @@
<!-- 操作工具栏 -->
<el-row :gutter="10" class="mb8">
<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>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
......@@ -77,51 +73,54 @@
width="55">
</el-table-column>
<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 label="联系电话" align="center" prop="transportId">
<el-table-column label="联系电话" align="center" prop="transportId" show-overflow-tooltip >
<template slot-scope="scope">
<dict-tag :type="DICT_TYPE.TRANSPORT_TYPE" :value="scope.row.transportId" />
<div>{{scope.row.defaultContactPhone}}</div>
</template>
</el-table-column>
<el-table-column label="佣金类型" align="center" prop="departureId" />
<el-table-column label="暗佣返佣类型" align="center" prop="objectiveId" />
<el-table-column label="运输方式" align="center" prop="customsType">
<el-table-column label="佣金类型" type="" align="center" prop="type">
<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>
</el-table-column>
<el-table-column label="始发地/目的地 " align="center" prop="approval">
<el-table-column label="暗佣返佣类型" align="center" prop="darkReturnType">
<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>
</el-table-column>
<el-table-column label="报关方式" align="center" prop="darkReturnType">
<el-table-column label="运输方式" align="center" prop="transportId">
<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>
</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">
<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>
</el-table-column>
<el-table-column label="未付佣金" align="center" prop="darkReturnType">
<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>
</el-table-column>
<el-table-column label="已付佣金" align="center" prop="darkReturnType">
<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>
</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">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['ecw:customer-commission:update']">编辑</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['ecw:customer-commission:delete']">删除</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">编辑</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
......@@ -129,65 +128,13 @@
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@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>
</template>
<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 {
name: "CustomerCommission",
......@@ -195,6 +142,9 @@ export default {
},
data() {
return {
DICT_TYPE,
getDictDatas,
tradeCityList:[],
// 遮罩层
loading: true,
// 导出遮罩层
......@@ -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() {
this.getList();
getTradeCityList().then(res => {
this.tradeCityList = res.data
})
},
methods: {
/** 查询列表 */
......@@ -249,26 +212,6 @@ export default {
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() {
this.queryParams.pageNo = 1;
......@@ -279,44 +222,10 @@ export default {
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加客户佣金类型";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.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();
});
});
const id = row.customerId;
this.$router.push(`/customerCommissionInfo/${id}`)
},
/** 删除按钮操作 */
handleDelete(row) {
......@@ -328,21 +237,12 @@ export default {
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
// 处理查询参数
let params = {...this.queryParams};
params.pageNo = undefined;
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(() => {});
}
originDestination(row){
let index1 = this.exportCityList.findIndex(item =>item.id == row.departureId);
let index2 = this.importCityList.findIndex(item => item.id == row.objectiveId);
let flag = `${index1 === -1 ? '' : this.exportCityList[index1].titleZh}/${index2 === -1 ? '' : this.importCityList[index2].titleZh}`;
return flag
},
}
};
</script>
......@@ -4,7 +4,7 @@
v-for="item in options"
:key="item[valueKey]"
:label="item[labelKey]"
:value="item[valueKey]">
:value="parseInt(item[valueKey])">
</el-option>
</el-select>
</template>
......
......@@ -10,6 +10,7 @@
remote
reserve-keyword
placeholder="请输入关键词"
@change="changefn"
:remote-method="remoteMethod">
<el-option
v-for="item in customeList"
......@@ -69,7 +70,7 @@
<el-col :span="24">
<el-form-item label="佣金类型(明佣、暗佣)">
<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 }}
</el-radio>
</el-radio-group>
......@@ -80,7 +81,7 @@
<el-col :span="24">
<el-form-item label="返佣类型" v-if="form.type == 2">
<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 }}
</el-radio>
</el-radio-group>
......@@ -176,7 +177,7 @@
:options="getDictDatas(DICT_TYPE.COMMISSION_UNIT)"></custom-selectors-dictionary>
</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 class="mingServantAndDarkServant" v-if="form.type == 3">
......@@ -224,7 +225,7 @@
<el-row>
<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">取消</el-button>
<el-button style="width:200px" @click="cancel">取消</el-button>
</el-col>
</el-row>
</el-form>
......@@ -234,23 +235,26 @@
<script>
import {
itemTypeListApi,
customerDropDownList, commodityList,createCommission
customerDropDownList, commodityList,createCommission,getCustomerCommission,commissionGetByCustomerId,updateCustomerCommissionInfo
} from "@/api/ecw/customerCommissionInfo";
import {DICT_TYPE, getDictDatas} from "@/utils/dict";
import customSelectorsDictionary from "./customSelectorsDictionary"
import {getTradeCityList} from "@/api/ecw/region";
import RoutersSelector from "@/components/RoutersSelector"
import CustomersSelector from "@/components/CustomersSelector";
export default {
name: "CustomerCommissionInfo",
components: {
customSelectorsDictionary,
RoutersSelector
RoutersSelector,
CustomersSelector
},
data() {
return {
value: '',
isSubmit:false,
getDictDatas,
DICT_TYPE,
commodityType: [],
......@@ -261,18 +265,18 @@ export default {
customerCommissionInfoBaseVOList: [],// 佣金详情
customerId: undefined,//客户id
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
objectiveId: undefined,//目的地id
transportId:undefined,//运输方式
type: this.getDictDatas(this.DICT_TYPE.COMMISSION_TYPE)[1].value,// 佣金类型
type: parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_TYPE)[1].value),// 佣金类型
},
//明佣
mingServantFrom: [
{
refund: 0,
refundCurrency:this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value,
refundUnit: this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[0].value,
refundCurrency:parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value),
refundUnit: parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[0].value),
}
],
//暗佣金+产品
......@@ -281,30 +285,30 @@ export default {
productType:undefined,//商品类型
productAttr: undefined,//暗佣 产品属性
darkCommission: 0,//暗佣 佣金
darkCurrency: this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value,// 暗佣 货币
darkUnit: this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[0].value,// 暗佣 单位
darkCurrency: parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value),// 暗佣 货币
darkUnit:parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[0].value),// 暗佣 单位
}
],
//暗佣+达标返佣
darkServantAndRebateForm: [
{
amount: 0,// 暗佣-满减金额
amountCurrency: this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value,// 暗佣-满减金额对应货币
amountUnit: this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[0].value,// 暗佣-满减金额对应单位,
amountCurrency:parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value),// 暗佣-满减金额对应货币
amountUnit:parseInt (this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[0].value),// 暗佣-满减金额对应单位,
refund: 0,//暗佣-满之后返还金额
refundCurrency: this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value,//暗佣-满之后返还金额的货币
refundUnit: this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[0].value,//暗佣-满之后返还金额的单位
refundCurrency:parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value),//暗佣-满之后返还金额的货币
refundUnit:parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[0].value),//暗佣-满之后返还金额的单位
}
],
//暗佣+明金
mingServantAnddarkServant: [
{
refund: 0,// 暗佣+明佣 上调金额
refundCurrency: this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value,// 暗佣+明佣 上调对应的货币
refundUnit: this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[0].value,//暗佣+明佣 上调对应的单位
refundCurrency: parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value),// 暗佣+明佣 上调对应的货币
refundUnit: parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[0].value),//暗佣+明佣 上调对应的单位
darkAdjustCommission: 0,//暗佣+明佣 上调金额
darkAdjustCurrency: this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value,//暗佣+明佣 上调对应的货币
darkAdjustUnit: this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[0].value,//暗佣+明佣 上调对应的单位
darkAdjustCurrency: parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value),//暗佣+明佣 上调对应的货币
darkAdjustUnit:parseInt( this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[0].value),//暗佣+明佣 上调对应的单位
}
],
customerForm: {
......@@ -318,13 +322,14 @@ export default {
// 表单校验
rules: {
customerId: [{required: true, message: "客户名称不能为空", trigger: "blur"}],
departureId: [{required: true, message: "客户名称不能为空", trigger: "blur"}],
departureId: [{required: true, message: "始发地不能为空", trigger: "blur"}],
transportId: [{required: true, message: "运输方式不能为空", trigger: "blur"}],
objectiveId: [{required: true, message: "客户名称不能为空", trigger: "blur"}],
customsType: [{required: true, message: "客户名称不能为空", trigger: "blur"}],
approval: [{required: true, message: "客户名称不能为空", trigger: "blur"}],
objectiveId: [{required: true, message: "目的地不能为空", trigger: "blur"}],
customsType: [{required: true, message: "报关类别不能为空", trigger: "blur"}],
approval: [{required: true, message: "产品备案不能为空", trigger: "blur"}],
},
customerShow: true
customerShow: true,
id:undefined,//佣金id
};
},
computed:{
......@@ -336,12 +341,51 @@ export default {
},
},
created() {
this.getItemType();
commodityList().then(res => {
console.log(res, 'res');
this.commodity = res.data
this.darkServantAndProductForm.forEach(item=>{item.productType =this.commodity[0].id})
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.productAttrFn();
getTradeCityList().then(res => {
this.tradeCityList = res.data
})
......@@ -358,11 +402,16 @@ export default {
},
remoteMethod(val) {
this.customerForm.name = val;
this.form.customerId = val;
console.log(val,'customerId')
this.getCustomeList();
},
changefn(val){
console.log(val,'val')
this.form.customerId = val;
},
/** 取消按钮 */
cancel() {
this.$router.go(-1);
},
/** 表单重置 */
reset() {
......@@ -381,29 +430,29 @@ export default {
//添加多条
addToFn(val){
if(val === 1){
this.darkServantAndProductForm.push( {
this.darkServantAndProductForm.push({
productType:this.commodity[0].id,//商品类型
productAttr: this.commodityType[0].id,//暗佣 产品属性
darkCommission: 0,//暗佣 佣金
darkCurrency: this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value,// 暗佣 货币
darkUnit: this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[0].value,// 暗佣 单位
darkCurrency: parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value),// 暗佣 货币
darkUnit:this.darkServantAndProductForm[0].darkUnit,// 暗佣 单位
})
}else {
this.darkServantAndRebateForm.push( {
amount: 0,// 暗佣-满减金额
amountCurrency: this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value,// 暗佣-满减金额对应货币
amountUnit: this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[0].value,// 暗佣-满减金额对应单位,
amountCurrency:parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value),// 暗佣-满减金额对应货币
amountUnit: parseInt(this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[0].value),// 暗佣-满减金额对应单位,
refund: 0,//暗佣-满之后返还金额
refundCurrency: this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value,//暗佣-满之后返还金额的货币
refundUnit: this.getDictDatas(this.DICT_TYPE.COMMISSION_UNIT)[0].value,//暗佣-满之后返还金额的单位
refundCurrency: parseInt (this.getDictDatas(this.DICT_TYPE.COMMISSION_CURRENCY_TYPE)[0].value),//暗佣-满之后返还金额的货币
refundUnit: this.darkServantAndRebateForm[0].refundUnit,//暗佣-满之后返还金额的单位
})
}
},
/** 提交按钮 */
submitForm() {
this.$refs.form.validate ((valid)=>{
this.isSubmit = true;
if(!valid)return
console.log(valid,'1234')
if (this.form.type == 1) {
this.form.customerCommissionInfoBaseVOList = this.mingServantFrom
} else if (this.form.type == 2) {
......@@ -415,9 +464,29 @@ export default {
} else if (this.form.type == 3) {
this.form.customerCommissionInfoBaseVOList = this.mingServantAnddarkServant
}
if(this.$route.params.dictId == 0){
createCommission(this.form).then(r =>{
console.log(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 {
itemTypeListApi().then(res => {
if (res.code === 0) {
this.commodityType = res.data;
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>
......@@ -443,6 +568,7 @@ export default {
font-size: 14px;
color: #606266;
font-weight: 700;
width: 100px;
}
.content {
......@@ -539,7 +665,7 @@ export default {
.item {
text-align: right;
width: 150px;
width: 130px;
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