Commit d4012634 authored by dragondean@qq.com's avatar dragondean@qq.com

bug

parent 213600ae
......@@ -293,20 +293,20 @@ export const constantRoutes = [
name: 'order-special',
meta: {title: '订单特价申请', icon: '', activeMenu: '/order/index'}
},
{
/* {
path: 'discount/:orderItemId(\\d+)',
component: (resolve) => import('@/views/ecw/order/special/discount'),
props: true,
name: 'discount',
meta: {title: '订单优惠申请', icon: '', activeMenu: '/order/index'}
},
{
}, */
/* {
path: 'discount1/:orderItemId(\\d+)',
component: (resolve) => import('@/views/ecw/order/special/discount'),
props: true,
name: 'discount1',
meta: {title: '订单折扣申请', icon: '', activeMenu: '/order/index'}
},
}, */
{
path: 'speciallight/:orderId(\\d+)',
component: (resolve) => import('@/views/ecw/order/special/light'),
......
<template>
<el-dialog visible :close-on-click-modal="false" :before-close="closeDialog" :title="$t('优惠申请')">
<el-form ref="form" :model="form" label-width="80px" :rules="rules">
<el-form-item :label="$t('商品类型')">
<span>{{ $l(productType, 'title') }}</span>
</el-form-item>
<el-form-item :label="$t('商品名称')">
<span>{{ form.prodTitleZh }}</span>
</el-form-item>
<el-form-item :label="$t('英文名称')">
<span>{{ form.prodTitleEn }}</span>
</el-form-item>
<el-form-item :label="$t('线路')">
<dict-tag :type="DICT_TYPE.TRANSPORT_TYPE" :value="form.transportId" />
{{ channel ? $l(channel, 'title') : '' }}
{{$t("从【{departureName}】发往【{objectiveName}", {departureName: form.departureName, objectiveName: form.objectiveName})}}
</el-form-item>
<el-form-item :label="$t('是否预付')">
<dict-tag :type="DICT_TYPE.ECW_YESNO" :value="form.isPayAdvance" />
</el-form-item>
<el-row v-if="!form.charging">
<el-col :span="12">
<el-form-item :label="$t('旧运费')">
{{form.orgSeaFreight}} {{ currentMap[form.seaFreightCurrency] }} / {{ unitMap[form.seaFreightVolume] }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('旧清关费')">
{{form.orgClearanceFreight}} {{ currentMap[form.clearanceFreightCurrency] }} / {{ unitMap[form.clearanceFreightVolume] }}
</el-form-item>
</el-col>
</el-row>
<el-row v-if="!form.charging">
<el-col :span="12">
<el-form-item :label="$t('新运费')" style="width: 400px" prop="seaFreight">
<el-input v-model="form.seaFreight" type="number" class="w-100" />
{{ currentMap[form.seaFreightCurrency] }} / {{ unitMap[form.seaFreightVolume] }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('新清关费')" style="width: 400px" prop="clearanceFreight">
<el-input v-model="form.clearanceFreight" type="number" class="w-100" />
{{ currentMap[form.clearanceFreightCurrency] }} / {{ unitMap[form.clearanceFreightVolume] }}
</el-form-item>
</el-col>
</el-row>
<el-form-item :label="$t('旧全包价')" v-if="form.charging">
{{form.orgSeaFreight}} {{ currentMap[form.seaFreightCurrency] }} / {{ unitMap[form.seaFreightVolume] }}
</el-form-item>
<el-form-item :label="$t('新全包价')" style="width: 400px" prop="clearanceFreight" v-if="form.charging">
<el-input v-model="form.seaFreight" type="number" class="w-100" />
{{ currentMap[form.seaFreightCurrency] }} / {{ unitMap[form.seaFreightVolume] }}
</el-form-item>
</el-form>
<div class="page-title">审批流程</div>
<work-flow xmlkey="sheet_sale" v-model="ccIdArr" />
<div v-if="!form.applyStatus">
<el-button type="primary" @click="handleSubmit">提交</el-button>
</div>
<div v-else>
<el-button type="primary" @click="$router.push('/bpm/process-instance/detail?id=' + form.formId)">
<dict-tag :type="DICT_TYPE.APPLY_STATUS" :value="form.applyStatus" />
</el-button>
</div>
</el-dialog>
</template>
<script>
import {createOrderSpecial, getOrderSpecial} from "@/api/ecw/order"
import {getUnitList} from "@/api/ecw/unit"
import {getChannel, getChannelList} from "@/api/ecw/channel"
import { getCurrencyList } from '@/api/ecw/currency'
import { getProductTypeList, getProductType } from '@/api/ecw/productType'
import WorkFlow from '@/components/WorkFlow'
export default {
name: "specialDiscount",
props: {
order: Object,
orderItemId: Number,
},
components: {
WorkFlow
},
created() {
// 查看详情,列表进来的
if(this.orderItemId){
this.getOrderSpecial()
}
getUnitList().then(res => this.unitList = res.data)
// getChannelList().then(res => this.channelList = res.data)
getCurrencyList().then(res => this.currencyList = res.data)
// getProductTypeList().then(res => this.productTypeList = res.data)
},
data() {
return {
unitList:[],
// channelList:[],
currencyList:[],
// productTypeList:[],
ccIdArr: [],
form: {
type: 1
},
rules:{
seaFreight : {required: true, message: '运费不能为空'},
clearanceFreight: {required: true, message: '清关费不能为空'}
},
productType: null,
channel: null
}
},
watch:{
ccIdArr(){
this.$set(this.form, 'ccIds', this.ccIdArr.join(','))
}
},
methods: {
handleSubmit(){
this.$refs.form.validate().then(res => {
createOrderSpecial(Object.assign({}, this.form, {type: 1})).then(res => {
this.$message.success(this.$t('提交成功'))
this.$emit('success')
})
})
},
getOrderSpecial(){
getOrderSpecial(this.order.orderId, 1, {orderItemId: this.orderItemId}).then(r => {
this.form = r.data
getProductType(this.form.productType).then(res => {
this.productType = res.data
})
if(this.form.channelId){
getChannel(this.form.channelId).then(res => {
this.channel = res.data
})
}
})
},
/* getProductTypeNameById(id){
return this.$l(this.productTypeList.find(e => e.id === id), 'title')
}, */
closeDialog(){
this.$emit('close')
}
},
computed: {
// 根据渠道id显示渠道名
getChannelNameById(){
return channelId => {
const s = this.channelList.find(item => item.channelId == channelId) ?. nameZh
return s ? '' + s + '' : ''
}
},
currentMap(){
let map = {}
this.currencyList.forEach(item => {
map[item.id] = this.$l(item, 'title')
})
return map
},
unitMap(){
let map = {}
this.unitList.forEach(item => {
map[item.id] = this.$l(item, 'title')
})
return map
}
}
}
</script>
<template>
<el-dialog visible :close-on-click-modal="false" :before-close="closeDialog" :title="$t('管理折扣')">
<el-form ref="form" :model="form" label-width="80px" :rules="rules">
<el-form-item :label="$t('旧全包价')" v-if="orderItem.charging">
{{form.freight}} {{ currentMap[form.freightCurrency] }} / {{ unitMap[form.freightVolume] }}
</el-form-item>
<el-form-item :label="$t('新全包价')" style="width: 400px" prop="clearanceFreight" v-if="orderItem.charging">
<el-input v-model="form.freight" type="number" class="w-100" />
{{ currentMap[form.freightCurrency] }} / {{ unitMap[form.freightVolume] }}
</el-form-item>
</el-form>
<div class="page-title">审批流程</div>
<work-flow xmlkey="special_apply" v-model="ccIdArr" />
<div v-if="!form.applyStatus">
<el-button type="primary" @click="handleSubmit">提交</el-button>
</div>
<div v-else>
<el-button type="primary" @click="$router.push('/bpm/process-instance/detail?id=' + form.formId)">
<dict-tag :type="DICT_TYPE.APPLY_STATUS" :value="form.applyStatus" />
</el-button>
</div>
</el-dialog>
</template>
<script>
import {createOrderSpecial, getOrderSpecial} from "@/api/ecw/order"
import {getUnitList} from "@/api/ecw/unit"
import {getChannel, getChannelList} from "@/api/ecw/channel"
import { getCurrencyList } from '@/api/ecw/currency'
import { getProductType } from '@/api/ecw/productType'
import WorkFlow from '@/components/WorkFlow'
export default {
name: "OrderSpecialDiscount",
props: {
order: Object,
orderItem: Object,
applyType: Number // 4是重货优惠5是泡货优惠
},
components: {
WorkFlow
},
created() {
// 查看详情,列表进来的
this.getOrderSpecial()
},
data() {
return {
// applyType: 2, //1是优惠申请2是管理折扣3是佣金设置4是重货优惠5是泡货优惠
ccIdArr: [],
form: {
},
rules:{
},
}
},
watch:{
ccIdArr(){
this.$set(this.form, 'ccIds', this.ccIdArr.join(','))
}
},
methods: {
handleSubmit(){
this.$refs.form.validate().then(res => {
createOrderSpecial(Object.assign({}, this.form, {applyType: this.applyType})).then(res => {
this.$message.success(this.$t('提交成功'))
this.$emit('success')
})
})
},
getOrderSpecial(){
getOrderSpecial(this.order.orderId, this.applyType, {}).then(r => {
this.form = r.data
})
},
closeDialog(){
this.$emit('close')
}
}
}
</script>
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<el-card>
<div slot="header" class="card-title">{{$t('修改佣金规则')}}-{{form.orderNo||''}}</div>
<el-form :model="form" ref="queryForms" label-width="120px" class="card">
<el-form-item :label="$t('商品类型:')">
<span>{{getProductAttrNameById(form.prodType) }}</span>
</el-form-item>
<el-form-item :label="$t('商品名称:')">
<span>{{ form.prodTitleZh }}</span>
</el-form-item>
<el-form-item :label="$t('英文名称:')">
<span>{{ form.prodTitleEn }}</span>
</el-form-item>
<el-form-item :label="$t('线路:')">
{{ `【${getDictDataLabel(DICT_TYPE.TRANSPORT_TYPE, form.transportId)}】${ getChannelNameById(form.channelId) }从【${startTitleZh}】发往【${destTitleZh}】`}}
</el-form-item>
<el-form-item :label="$t('运费:')" >
<span>{{ form.subtotalFreight }} {{ currentMap[form.freightCurrency] }}</span>
<el-dialog visible :close-on-click-modal="false" :before-close="closeDialog" :title="$t('佣金规则')">
<el-form ref="form" :model="form" label-width="80px" :rules="rules">
<el-form-item :label="$t('商品类型')">
<span>{{ $l(productType, 'title') }}</span>
</el-form-item>
<el-form-item :label="$t('商品名称')">
<span>{{ orderItem.prodTitleZh }}</span>
</el-form-item>
<el-form-item :label="$t('英文名称')">
<span>{{ orderItem.prodTitleEn }}</span>
</el-form-item>
<el-form-item :label="$t('线路')">
<dict-tag :type="DICT_TYPE.TRANSPORT_TYPE" :value="order.transportId" />
{{ channel ? $l(channel, 'title') : '' }}
{{$t("从【{departureName}】发往【{objectiveName}", {departureName: $l(order.logisticsInfoDto, 'startTitle'), objectiveName: $l(order.logisticsInfoDto, 'destTitle')})}}
</el-form-item>
<el-form-item :label="$t('是否预付')">
<dict-tag :type="DICT_TYPE.ECW_YESNO" :value="orderItem.isPayAdvance" />
</el-form-item>
<el-row v-if="!orderItem.charging">
<el-col :span="12">
<el-form-item :label="$t('运费')">
{{form.oneSeaFreight}} {{ currencyMap[orderItem.seaFreightCurrency] }} / {{ unitMap[orderItem.seaFreightVolume] }}
</el-form-item>
<el-form-item :label="$t('清关费:')">
<span>{{ form.subtotalClearanceFreight }} {{ currentMap[form.clearanceFreightCurrency] }}</span>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('清关费')">
{{form.oneClearanceFreight}} {{ currencyMap[form.clearanceFreightCurrency] }} / {{ unitMap[form.clearanceFreightVolume] }}
</el-form-item>
<el-form-item :label="$t('佣金类型:')">
<el-radio-group v-model="form.commissionType" >
<el-radio :label="dict.value" v-for="dict in getDictDatas('commission_type')">{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-if="form.commissionType==3" :label="$t('暗佣佣金:')">
<el-input style="width: 100px;" type="number" v-model="shadeCommissionAmount" />
<span style="margin-left: 10px;">{{ currentMap[form.freightCurrency] }}</span>
<span>/{{ volumeMap[form.freightVolume] }}</span>
</el-form-item >
<el-form-item v-if="form.commissionType==1||form.commissionType==3" :label="$t('明佣佣金:')">
<el-input style="width: 100px;" type="number" v-model="lightCommissionAmount" />
<span style="margin-left: 10px;">{{ currentMap[form.freightCurrency] }}</span>
<span>/{{ volumeMap[form.freightVolume] }}</span>
</el-form-item >
<el-form-item v-if="form.commissionType!=0" :label="$t('商品:')">
<span>{{form.prodTitleZh }}</span>
<span style="margin-left: 10px;" v-if="form.commissionType==3">{{$t('成本价')}}{{parseInt(form.freight)-parseInt(shadeCommissionAmount)}}{{ currentMap[form.freightCurrency] }}/{{ volumeMap[form.freightVolume] }}</span>
<span style="margin-left: 10px;"> {{$t('销售价')}}{{form.commissionType!=2?(parseInt(form.freight)+parseInt(lightCommissionAmount)):form.freight}}{{ currentMap[form.freightCurrency] }}/{{ volumeMap[form.freightVolume] }}</span>
<span style="margin-left: 10px;color: #1E98D7;" v-if="form.commissionType==2" @click="$router.push(`/customer/customerCommission`)">{{$t('去设置')}}</span>
<span style="margin-left: 10px;" v-if="form.commissionType==3">{{$t('实际佣金返点')}}{{parseInt(lightCommissionAmount)+parseInt(shadeCommissionAmount)}}{{ currentMap[form.freightCurrency] }}/{{ volumeMap[form.freightVolume] }}</span>
</el-form-item>
<el-form-item :label="$t('审核状态:')">
<dict-tag :type="DICT_TYPE.APPLY_STATUS" :value="form.applyStatus"></dict-tag>
<span>{{form.applyResult?('('+form.applyResult+')'):''}}</span>
</el-form-item>
</el-form>
</el-card>
<div slot="header" class="card-title">{{$t('审批流程')}}</div>
<work-flow xmlkey="commission_config" v-model="selectedUsers" style="margin-top: 20px;"></work-flow>
<div slot="footer" class="card footer_btn">
<el-button type="primary" v-if="form.applyStatus==0" @click="submitForm">{{$t('提交')}}</el-button>
<el-button plain type="primary" v-if="form.applyStatus==0" @click="$store.dispatch('tagsView/delCurrentView')">{{$t('取消')}}</el-button>
<el-button v-if="form.applyStatus==1" type="primary" @click="$router.push(`/bpm/process-instance/detail?id=`+form.formId)">{{$t('审核中')}}</el-button>
<el-button v-if="form.applyStatus==1" plain type="primary" @click="dialogVisible = true">{{$t('取消审核')}}</el-button>
<el-button v-if="form.applyStatus==1" plain type="primary" @click="$store.dispatch('tagsView/delCurrentView')">{{$t('返回')}}</el-button>
</div>
<el-dialog
:title="$t('提示')"
:visible.sync="dialogVisible"
width="30%">
<span class="cancel_notice">{{$t('特价申请正在审核中,你确定取消特价申请吗?')}}</span>
<div class="cancel_content">
<span>{{$t('取消原因')}}</span>
<el-input v-model="reason" :placeholder="$t('请输入取消原因')"></el-input>
</div>
</el-col>
</el-row>
<el-form-item :label="$t('全包价')" v-if="orderItem.charging">
{{orderItem.oneSeaFreight}} {{ currencyMap[form.freightCurrency] }} / {{ unitMap[orderItem.seaFreightVolume] }}
</el-form-item>
<el-form-item :label="$t('佣金类型')" prop="commissionType">
<dict-selector :type="DICT_TYPE.COMMISSION_TYPE" v-model="form.commissionType" form-type="radio" formatter="number" />
</el-form-item>
<!-- 明佣或者明佣+暗佣才显示 -->
<el-form-item label="明佣佣金" v-if="form.commissionType == 1 || form.commissionType == 3">
<el-input v-model.number="form.lightCommissionAmount" placeholder="" class="w-100"></el-input>
{{ currencyMap[orderItem.seaFreightCurrency] }} / {{ unitMap[orderItem.seaFreightVolume] }}
</el-form-item>
<!-- 明佣+暗佣才显示 -->
<el-form-item label="暗佣佣金" v-if="form.commissionType == 3">
<el-input v-model.number="form.shadeCommissionAmount" placeholder="" class="w-100"></el-input>
{{ currencyMap[form.freightCurrency] }} / {{ unitMap[form.freightVolume] }}
</el-form-item>
<!-- 无佣金不显示 -->
<div class="pl-50" v-if="form.commissionType != 0">
<div v-if="form.commissionType != 2">{{$l(orderItem, 'prodTitle')}}</div>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">{{$t('取消')}}</el-button>
<el-button type="primary" @click="cancelSplit">{{$t('确定')}}</el-button>
</span>
</el-dialog>
</div>
<!-- 明佣+暗佣显示 -->
<div v-if="form.commissionType == 3">
{{$t('成本价')}}{{form.freight}} {{ currencyMap[form.freightCurrency] }} / {{ unitMap[form.freightVolume] }}
</div>
<!-- 暗佣显示 -->
<div v-if="form.commissionType == 2">
{{$l(orderItem, 'prodTitle')}}
<template v-if="darkCommission">
{{$t('暗佣')}}{{darkCommission}} {{ currencyMap[form.freightCurrency] }} / {{ unitMap[form.freightVolume] }}
</template>
<el-link type="primary" @click.native="$router.push('/customer/customerCommission?customerId=' + customerId)">{{$t('去设置')}}</el-link>
</div>
<div v-if="form.commissionType == 1 || form.commissionType == 3">{{$t('销售价')}}{{form.freight + form.shadeCommissionAmount + form.lightCommissionAmount }} {{ currencyMap[form.freightCurrency] }} / {{ unitMap[form.freightVolume] }}</div>
<div v-if="form.commissionType == 3">{{$t('实际佣金返点')}}{{form.shadeCommissionAmount + form.lightCommissionAmount }} {{ currencyMap[form.freightCurrency] }} / {{ unitMap[form.freightVolume] }}</div>
</div>
</el-form>
<div class="page-title">审批流程</div>
<work-flow xmlkey="commission_config" v-model="ccIdArr" />
<div v-if="!form.applyStatus">
<el-button type="primary" @click="handleSubmit">提交</el-button>
</div>
<div v-else>
<el-button type="primary" @click="$router.push('/bpm/process-instance/detail?id=' + form.formId)">
<dict-tag :type="DICT_TYPE.APPLY_STATUS" :value="form.applyStatus" />
</el-button>
</div>
</el-dialog>
</template>
<script>
import {getDictData, getDictDatas,DICT_TYPE,getDictDataLabel} from '@/utils/dict'
import WorkFlow from '@/components/WorkFlow'
import {getOrder,getOrderSpecial,cancelOrderSpecial,createOrderSpecial} from '@/api/ecw/order'
import {getChannelList} from "@/api/ecw/channel"
import {createOrderSpecial, getOrderSpecial} from "@/api/ecw/order"
import {getUnitList} from "@/api/ecw/unit"
import {getChannel} from "@/api/ecw/channel"
import { getCurrencyList } from '@/api/ecw/currency'
import { getProductAttrList } from '@/api/ecw/productAttr'
import {getUnitList} from '@/api/ecw/unit'
import {openedRouterList} from "@/api/ecw/warehouse"
import { getProductType } from '@/api/ecw/productType'
import WorkFlow from '@/components/WorkFlow'
import {getDarkReturnCommission} from '@/api/ecw/customerCommission'
export default {
name: "specialCommission",
name: "OrderSpecialCommission",
props: {
order: Object,
orderItem: Object,
},
components: {
WorkFlow
},
props: {
orderItemId: [String, Number]
created() {
// 查看详情,列表进来的
this.getOrderSpecial()
getUnitList().then(res => this.unitList = res.data)
getCurrencyList().then(res => this.currencyList = res.data)
getProductType(this.orderItem.prodType).then(res => {
this.productType = res.data
})
if(this.order.channelId){
getChannel(this.order.channelId).then(res => {
this.channel = res.data
})
}
},
data() {
return {
reason:'',
dialogVisible:false,
loading:false,
form:{},
selectedUsers:[],
orderData:{},
channelList:[],
applyType: 3, // 1是优惠申请2是管理折扣3是佣金设置4是重货优惠5是泡货优惠
unitList:[],
currencyList:[],
productAttrList:[],
unitType:[],
startTitleZh:'',
destTitleZh:'',
shadeCommissionAmount:0,
lightCommissionAmount:0
};
ccIdArr: [],
form: {
type: 3
},
rules:{
seaFreight : {required: true, message: '运费不能为空'},
clearanceFreight: {required: true, message: '清关费不能为空'}
},
productType: null,
channel: null,
darkCommission: null
}
},
created() {
if(this.orderItemId){
this.form.orderItemId = this.orderItemId - 0
this.getOrderSpecialData()
watch:{
ccIdArr(){
this.$set(this.form, 'ccIds', this.ccIdArr.join(','))
},
'form.commissionType'(val, old){
if(typeof old !='undefined' && old != val){
this.$set(this.form, 'lightCommissionAmount', 0)
this.$set(this.form, 'shadeCommissionAmount', 0)
}
// 暗佣需要查询暗佣设置
if(val == 2){
this.getCommission()
}
}
// this.getOrderData()
// this.getList()
this.getUnitTypeData()
getChannelList().then(res => this.channelList = res.data)
getCurrencyList().then(res => this.currencyList = res.data)
getProductAttrList().then(res => this.productAttrList = res.data)
},
computed:{
getDictData(){
return (type, value) => getDictData(type, value) || {}
methods: {
handleSubmit(){
this.$refs.form.validate().then(res => {
createOrderSpecial(Object.assign({}, this.form, {applyType: this.applyType})).then(res => {
this.$message.success(this.$t('提交成功'))
this.$emit('success')
})
})
},
getDictDatas(){
return getDictDatas
getOrderSpecial(){
getOrderSpecial(this.order.orderId, this.applyType, {orderItemId: this.orderItem.orderItemId}).then(r => {
this.form = r.data
})
},
/* getProductTypeNameById(id){
return this.$l(this.productTypeList.find(e => e.id === id), 'title')
}, */
closeDialog(){
this.$emit('close')
},
getCommission(){
getDarkReturnCommission({
customerId: this.order.customerId,
customsType: this.order.customsType,
darkCurrency: this.orderItem.seaFreightCurrency,
darkUnit: this.order.seaFreightVolume,
departureId: this.order.departureVO.departureId,
objectiveId: this.order.objectiveVO.objectiveId,
productAttr: this.orderItem.prodAttrIds.split(',').filter(item => item && item != ''),
productType: this.orderItem.prodType,
transportId: this.order.transportId,
type: 2, // 暗佣
}).then(res => {
this.darkCommission = res.data?.darkCommission
})
}
},
computed: {
// 根据渠道id显示渠道名
getChannelNameById(){
return channelId => {
const s = this.channelList.find(item => item.channelId == channelId) ?. nameZh
return s ? '' + s + '' : ''
}
}
},
currentMap(){
currencyMap(){
let map = {}
this.currencyList.forEach(item => {
map[item.id] = item.titleZh
map[item.id] = this.$l(item, 'title')
})
return map
},
volumeMap(){
unitMap(){
let map = {}
this.unitType.forEach(item => {
map[item.id] = item.titleZh
this.unitList.forEach(item => {
map[item.id] = this.$l(item, 'title')
})
return map
},
},
watch: {
'form.lineId'(val){
if (val){
openedRouterList({lineId: val}).then(r => {
if(r.data && r.data.length > 0){
this.startTitleZh = r.data[0].startTitleZh
this.destTitleZh = r.data[0].destTitleZh
}
})
}
}
},
methods: {
getUnitTypeData () {
getUnitList().then(res => {
if(res.code==0&&res.data&&res.data.length>0){
this.unitType = res.data
}
})
},
getOrderData(){
getOrder(this.form.orderId).then(response => {
this.orderData = response.data
});
},
getProductAttrNameById(id){
return this.productAttrList.find(e => e.id === id)?.attrName || ''
},
/** 查询列表 */
getOrderSpecialData(){
getOrderSpecial(this.form.orderItemId,3).then(r => {
this.form = r.data
this.lightCommissionAmount = this.form.lightCommissionAmount
this.shadeCommissionAmount = this.form.shadeCommissionAmount
this.form.commissionType = this.form.commissionType.toString()
})
},
submitForm(){
this.form.applyType = 3
this.form.commissionType = parseInt(this.form.commissionType)
if(this.form.commissionType==1){
this.form.lightCommissionAmount = this.lightCommissionAmount
}
if(this.form.commissionType==3){
this.form.lightCommissionAmount = this.lightCommissionAmount
this.form.shadeCommissionAmount = this.shadeCommissionAmount
}
this.form.ccIds = this.selectedUsers.join(',')
createOrderSpecial(this.form).then(r => {
this.$message.success(r.msg || this.$t('提交成功'))
this.$store.dispatch('tagsView/delCurrentView')
})
},
cancelSplit(){
let that = this
if(!that.reason){
that.$message.error(this.$t("请输入取消原因"));
return
}
cancelOrderSpecial(that.form.orderApprovalId,{reason:that.reason}).then(res=>{
that.$message.success(this.$t("取消成功"));
that.$store.dispatch('tagsView/delCurrentView')
})
},
}
}
</script>
<style scoped>
.card-title{
font-size: 18px;
font-weight: bold;
margin-top: 10px;
}
.card-info{
font-size: 16px;
}
.card{
margin-top: 20px;
}
.btn-header{
width: 90%;
display: flex;
align-items: center;
justify-content: space-between;
margin: 20px 0;
}
.red{
color:#ff3430;
font-size: 15px;
}
.footer_btn{
padding-bottom: 60px;
}
.cancel_notice{
font-size: 16px;
font-weight: 600;
}
.cancel_content{
display: flex;
align-items: center;
padding-top: 20px;
}
.cancel_content span{
width: 100px;
}
</style>
<template>
<div class="app-container">
<el-row type="flex" justify="center">
<el-col :xs="24" :sm="24" :md="24" :lg="20" :xl="16">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span style="font-size: 18px;font-weight: bold">{{$t('优惠申请')}}</span>
</div>
<el-form ref="form" :model="form" label-width="80px">
<el-form-item label="商品类型">
<span>{{ getProductAttrNameById(form.prodType) }}</span>
</el-form-item>
<el-form-item label="商品名称">
<span>{{ form.prodTitleZh }}</span>
</el-form-item>
<el-form-item label="英文名称">
<span>{{ form.prodTitleEn }}</span>
</el-form-item>
<el-form-item label="线路">
{{ `【${getDictDataLabel(DICT_TYPE.TRANSPORT_TYPE, form.transportId)}】${ getChannelNameById(form.channelId) }从【${startTitleZh}】发往【${destTitleZh}】`}}
</el-form-item>
<el-form-item label="是否预付">
{{ form.isPayAdvance === 0 ? '' : '' }}
</el-form-item>
<el-form-item label="旧运费" style="width: 400px">
<el-input v-model="form.orgFreight" readonly>
<div slot="prepend" style="width: 60px">{{ currentMap[form.orgFreightCurrency] }}</div>
<div slot="append" style="width: 60px">{{ unitMap[form.orgFreightVolume] }}</div>
</el-input>
</el-form-item>
<el-form-item label="旧清关费" style="width: 400px">
<el-input v-model="form.orgClearanceFreight" readonly>
<div slot="prepend" style="width: 60px">{{ currentMap[form.orgClearanceFreightCurrency] }}</div>
<div slot="append" style="width: 60px">{{ unitMap[form.orgClearanceFreightVolume] }}</div>
</el-input>
</el-form-item>
<el-form-item label="新运费" required style="width: 400px">
<el-input v-model="form.freight" type="number" class="input-with-select">
<div slot="prepend" style="width: 60px">{{ currentMap[form.freightCurrency] }}</div>
<div slot="append" style="width: 60px">{{ unitMap[form.freightVolume] }}</div>
</el-input>
</el-form-item>
<el-form-item label="新清关费" required style="width: 400px">
<el-input v-model="form.clearanceFreight" type="number" class="input-with-select">
<div slot="prepend" style="width: 60px">{{ currentMap[form.clearanceFreightCurrency] }}</div>
<div slot="append" style="width: 60px">{{ unitMap[form.clearanceFreightVolume] }}</div>
</el-input>
</el-form-item>
</el-form>
<div>
<h2>审批流程</h2>
<work-flow xmlkey="free_apply" v-model="form.channelId" />
</div>
<div>
<el-button type="primary" @click="handleSubmit">提交</el-button>
</div>
</el-card>
</el-col>
</el-row>
</div>
<el-dialog visible :close-on-click-modal="false" :before-close="closeDialog" :title="applyType == 2 ? $t('管理折扣') : $t('优惠申请')">
<el-form ref="form" :model="form" label-width="80px" :rules="rules">
<el-form-item :label="$t('商品类型')">
<span>{{ $l(productType, 'title') }}</span>
</el-form-item>
<el-form-item :label="$t('商品名称')">
<span>{{ orderItem.prodTitleZh }}</span>
</el-form-item>
<el-form-item :label="$t('英文名称')">
<span>{{ orderItem.prodTitleEn }}</span>
</el-form-item>
<el-form-item :label="$t('线路')">
<dict-tag :type="DICT_TYPE.TRANSPORT_TYPE" :value="order.transportId" />
{{ channel ? $l(channel, 'title') : '' }}
{{$t("从【{departureName}】发往【{objectiveName}", {departureName: $l(order.logisticsInfoDto, 'startTitle'), objectiveName: $l(order.logisticsInfoDto, 'destTitle')})}}
</el-form-item>
<el-form-item :label="$t('是否预付')">
<dict-tag :type="DICT_TYPE.ECW_YESNO" :value="orderItem.isPayAdvance" />
</el-form-item>
<el-row v-if="!orderItem.charging">
<el-col :span="12">
<el-form-item :label="$t('旧运费')">
{{form.orgFreight}} {{ currentMap[form.freightCurrency] }} / {{ unitMap[form.freightVolume] }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('旧清关费')">
{{form.orgClearanceFreight}} {{ currentMap[form.clearanceFreightCurrency] }} / {{ unitMap[form.clearanceFreightVolume] }}
</el-form-item>
</el-col>
</el-row>
<el-row v-if="!orderItem.charging">
<el-col :span="12">
<el-form-item :label="$t('新运费')" style="width: 400px" prop="seaFreight">
<el-input v-model="form.seaFreight" type="number" class="w-100" />
{{ currentMap[form.freightCurrency] }} / {{ unitMap[form.freightVolume] }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('新清关费')" style="width: 400px" prop="clearanceFreight">
<el-input v-model="form.clearanceFreight" type="number" class="w-100" />
{{ currentMap[form.clearanceFreightCurrency] }} / {{ unitMap[form.clearanceFreightVolume] }}
</el-form-item>
</el-col>
</el-row>
<el-form-item :label="$t('旧全包价')" v-if="orderItem.charging">
{{form.freight}} {{ currentMap[form.freightCurrency] }} / {{ unitMap[form.freightVolume] }}
</el-form-item>
<el-form-item :label="$t('新全包价')" style="width: 400px" prop="clearanceFreight" v-if="orderItem.charging">
<el-input v-model="form.freight" type="number" class="w-100" />
{{ currentMap[form.freightCurrency] }} / {{ unitMap[form.freightVolume] }}
</el-form-item>
</el-form>
<div class="page-title">审批流程</div>
<work-flow xmlkey="special_apply" v-model="ccIdArr" />
<div v-if="!form.applyStatus">
<el-button type="primary" @click="handleSubmit">提交</el-button>
</div>
<div v-else>
<el-button type="primary" @click="$router.push('/bpm/process-instance/detail?id=' + form.formId)">
<dict-tag :type="DICT_TYPE.APPLY_STATUS" :value="form.applyStatus" />
</el-button>
</div>
</el-dialog>
</template>
<script>
import {createOrderSpecial, getOrderSpecial, getOrderSpecialByApproveId} from "@/api/ecw/order"
import {DICT_TYPE, getDictDataLabel} from "@/utils/dict"
import DictSelector from "@/components/DictSelector"
import {createOrderSpecial, getOrderSpecial} from "@/api/ecw/order"
import {getUnitList} from "@/api/ecw/unit"
import {getChannelList} from "@/api/ecw/channel"
import {getChannel, getChannelList} from "@/api/ecw/channel"
import { getCurrencyList } from '@/api/ecw/currency'
import { getProductAttrList } from '@/api/ecw/productAttr'
import {openedRouterList} from "@/api/ecw/warehouse"
import WorkFlow from "@/components/WorkFlow"
import { getProductType } from '@/api/ecw/productType'
import WorkFlow from '@/components/WorkFlow'
export default {
name: "specialDiscount",
name: "OrderSpecialDiscount",
props: {
orderItemId: String,
id: Number,
readonly: {
type: Boolean,
default: false
order: Object,
orderItem: Object,
applyType:{ // // 1是优惠申请2是管理折扣3是佣金设置4是重货优惠5是泡货优惠, 默认是优惠申请,可以设置为2表示管理折扣,公用一个组件
type: Number,
default: 1
}
},
components: {
DictSelector,
WorkFlow
},
created() {
// 临时
if(this.$route.query.orderId){
this.form.orderId = this.$route.query.orderId - 0
// this.getOrder()
}
// 查看详情,列表进来的
if(this.orderItemId){
this.form.orderItemId = this.orderItemId - 0
this.getOrderSpecial()
}
// 从流程查看详情
if(this.id)
this.getOrderSpecialByApproveId()
this.getOrderSpecial()
getUnitList().then(res => this.unitList = res.data)
getChannelList().then(res => this.channelList = res.data)
getCurrencyList().then(res => this.currencyList = res.data)
getProductAttrList().then(res => this.productAttrList = res.data)
getProductType(this.orderItem.prodType).then(res => {
this.productType = res.data
})
if(this.order.channelId){
getChannel(this.order.channelId).then(res => {
this.channel = res.data
})
}
},
data() {
return {
getDictDataLabel,
DICT_TYPE,
// applyType: 1, // 1是优惠申请2是管理折扣3是佣金设置4是重货优惠5是泡货优惠
unitList:[],
channelList:[],
// channelList:[],
currencyList:[],
productAttrList:[],
form: {
"abnormalState": 0,
"applyResult": "",
"applyStatus": 0,
"applyType": '1',
"ccIds": "",
"channelId": 0,
"charging": 0,
"clearanceFreight": 0,
"clearanceFreightCurrency": 0,
"clearanceFreightVolume": 0,
"commissionCurrencyId": 0,
"commissionType": 0,
"commission_id": 0,
"destAddressEn": "",
"destAddressZh": "",
"destTitleEn": "",
"destTitleZh": "",
"destVolume": "",
"destWarehouseId": 0,
"freight": 0,
"freightCurrency": 0,
"freightVolume": 0,
"inWarehouseState": 0,
"isPayAdvance": 0,
"lightCommissionAmount": 0,
"lineId": 0,
"orderId": 0,
"orderItemId": 0,
"orderNo": "",
"orgClearanceFreight": 0,
"orgClearanceFreightCurrency": 0,
"orgClearanceFreightVolume": 0,
"orgFreight": 0,
"orgFreightCurrency": 0,
"orgFreightVolume": 0,
"orgVWeight": "",
"orgWVolume": "",
"prodId": 0,
"prodTitleEn": "",
"prodTitleZh": "",
"prodType": 0,
"shadeCommissionAmount": 0,
"shipmentState": 0,
"startAddressEn": "",
"startAddressZh": "",
"startTitleEn": "",
"startTitleZh": "",
"startVolume": "",
"startWarehouseId": 0,
"status": 0,
"toWarehouseState": 0,
"transportId": 0,
"vweight": "",
"wvolume": ""
// productTypeList:[],
ccIdArr: [],
form: { },
rules:{
seaFreight : {required: true, message: '运费不能为空'},
clearanceFreight: {required: true, message: '清关费不能为空'}
},
startTitleZh: '',
destTitleZh: ''
productType: null,
channel: null
}
},
watch:{
ccIdArr(){
this.$set(this.form, 'ccIds', this.ccIdArr.join(','))
}
},
methods: {
handleSubmit(){
createOrderSpecial({
"applyType": this.isDiscount ? '2' : '1',
clearanceFreight: this.form.clearanceFreight,
clearanceFreightCurrency: this.form.clearanceFreightCurrency,
clearanceFreightVolume: this.form.clearanceFreightVolume,
orderId: this.form.orderId,
orderItemId: this.form.orderItemId,
freight: this.form.freight,
freightCurrency: this.form.freightCurrency,
freightVolume: this.form.freightVolume,
}).then(r => {
this.$message.success(r.msg || '提交成功')
this.$tab.closePage()
this.$refs.form.validate().then(res => {
createOrderSpecial(Object.assign({}, this.form, {applyType: this.applyType})).then(res => {
this.$message.success(this.$t('提交成功'))
this.$emit('success')
})
})
},
getOrderSpecial(){
getOrderSpecial(this.form.orderItemId).then(r => {
this.form = r.data
this.form.freight = ''
this.form.clearanceFreight = ''
})
},
getOrderSpecialByApproveId(){
getOrderSpecialByApproveId(this.id).then(r => {
getOrderSpecial(this.order.orderId, this.applyType, {orderItemId: this.orderItem.orderItemId}).then(r => {
this.form = r.data
})
},
getProductAttrNameById(id){
return this.productAttrList.find(e => e.id === id)?.attrName || ''
/* getProductTypeNameById(id){
return this.$l(this.productTypeList.find(e => e.id === id), 'title')
}, */
closeDialog(){
this.$emit('close')
}
},
computed: {
// 折扣管理页面
isDiscount(){
return this.$route.query.discount
},
// 根据渠道id显示渠道名
getChannelNameById(){
return channelId => {
......@@ -228,33 +158,17 @@ export default {
currentMap(){
let map = {}
this.currencyList.forEach(item => {
map[item.id] = item.titleZh
map[item.id] = this.$l(item, 'title')
})
return map
},
unitMap(){
let map = {}
this.unitList.forEach(item => {
map[item.id] = item.titleZh
map[item.id] = this.$l(item, 'title')
})
return map
}
},
watch: {
'form.lineId'(val){
if (val){
openedRouterList({lineId: val}).then(r => {
if(r.data && r.data.length > 0){
this.startTitleZh = r.data[0].startTitleZh
this.destTitleZh = r.data[0].destTitleZh
}
})
}
}
}
}
</script>
<style scoped lang="scss">
</style>
......@@ -30,7 +30,7 @@
prop="address"
:label="$t('入库货物属性')">
<template v-slot="{row}">
<!-- // TODO 待测试完善 -->
<!-- // TODO 缺少入库品牌信息 -->
<template v-if="row.warehouseInInfoVO">
{{$t('品牌')}}<dict-tag :type="DICT_TYPE.ECW_IS_BRAND" :value="row.brandType" /><br>
{{$t('箱数')}}{{ row.warehouseInInfoVO.cartonsNum }}<br>
......@@ -49,7 +49,7 @@
<el-table-column
:label="$t('原价')">
<template v-slot="{row}">
<template v-if="!row.originalSeaFreight">未报价</template>
<template v-if="!row.originalSeaFreight">{{$t('未报价')}}</template>
<template v-else-if="row.charging ==1">
{{$t('全包价')}}{{ row.originalSeaFreight }} {{ currencyMap[row.seaFreightCurrency] }}/{{ unitMap[row.seaFreightVolume] }}
</template>
......@@ -63,7 +63,7 @@
<el-table-column
label="成本价">
<template v-slot="{row}">
<template v-if="!row.costSeaFreight">未报价</template>
<template v-if="!row.costSeaFreight">{{$t('未报价')}}</template>
<template v-else-if="row.charging">
{{$t('全包价')}}{{ row.costSeaFreight }} {{ currencyMap[row.seaFreightCurrency] }}/{{ unitMap[row.seaFreightVolume] }}
</template>
......@@ -77,7 +77,7 @@
<el-table-column
:label="$t('销售价')">
<template v-slot="{row}">
<template v-if="!row.oneSeaFreight">未报价</template>
<template v-if="!row.oneSeaFreight">{{$t('未报价')}}</template>
<template v-else-if="row.charging">
{{$t('全包价')}}{{ row.oneSeaFreight }} {{ currencyMap[row.seaFreightCurrency] }}/{{ unitMap[row.seaFreightVolume] }}
</template>
......@@ -93,23 +93,33 @@
prop="address"
:label="$t('操作')">
<template v-slot="{row}">
<el-button size="mini" type="text" v-hasPermi="['ecw:order:update']" @click="showDiscountItemId=row.orderItemId">优惠申请</el-button>
<el-button size="mini" type="text" v-hasPermi="['ecw:order:update']" @click="$router.push(`/order/specialCommission/${row.orderItemId}`)">佣金规则</el-button>
<el-button size="mini" type="text" v-hasPermi="['ecw:order:update']" @click="$router.push(`/order/discount1/${row.orderItemId}?orderId=${row.orderId}&discount=1`)">管理折扣</el-button>
<el-button size="mini" type="text" v-hasPermi="['ecw:order:update']" @click="showDiscountItem=row">{{$t('优惠申请')}}</el-button>
<el-button size="mini" type="text" v-hasPermi="['ecw:order:update']" @click="showCommissionItem=row">{{$t('佣金规则')}}</el-button>
<el-button size="mini" type="text" v-hasPermi="['ecw:order:update']" @click="showAllowanceItem=row">{{$t('管理折扣')}}</el-button>
</template>
</el-table-column>
</el-table>
<div style="text-align: center;margin-top: 80px">
<el-button type="primary" @click="toweight" v-if="hasWarehouseInInfo && (order.transportId === 1 || order.transportId === 2)">申请重货优惠</el-button>
<el-button type="primary" @click="tolight" v-if="hasWarehouseInInfo && (order.transportId === 3 || order.transportId === 4)">申请泡货优惠</el-button>
<el-button type="primary" @click="$tab.closePage()">关闭窗口</el-button>
<div class="mt-50 flex-center">
<!--
1.海运整柜、海运拼柜显示重货优惠 1,2
2.空运专线、海空联运显示泡货优惠 3,4
-->
<el-button type="primary" @click="showPreferentialType=4" v-if="order.transportId === 1 || order.transportId === 2">{{$t('申请重货优惠')}}</el-button>
<el-button type="primary" @click="showPreferentialType=5" v-else>{{$t('申请泡货优惠')}}</el-button>
<el-button type="primary" @click="$tab.closePage()">{{$t('关闭窗口')}}</el-button>
</div>
</el-card>
<special-discount v-if="!!showDiscountItemId" :order="order" :orderItemId="showDiscountItemId" />
<!-- 优惠申请 -->
<discount v-if="!!showDiscountItem" :order="order" :orderItem="showDiscountItem" @close="showDiscountItem=null" @success="onDiscountSuccess" />
<!-- 管理折扣 -->
<discount v-if="!!showAllowanceItem" :order="order" :orderItem="showAllowanceItem" @close="showAllowanceItem=null" :applyType="2" @success="onDiscountSuccess" />
<!-- 佣金规则 -->
<commission v-if="!!showCommissionItem" :order="order" :orderItem="showCommissionItem" @close="showCommissionItem=null" @success="onCommissionSuccess" />
<!-- 重泡货优惠 -->
<preferential v-if="!!showPreferentialType" :applyType="showPreferentialType" :order="order" @close="showPreferentialType=null" @success="onPreferentialSuccess" />
</div>
</template>
......@@ -121,11 +131,13 @@ import {getProductAttrList} from "@/api/ecw/productAttr"
import { parseTime } from '@/utils/ruoyi'
import {getOrder} from "@/api/ecw/order"
import SpecialDiscount from '@/views/ecw/order/components/SpecialDiscount.vue'
import Discount from './Discount'
import Commission from './Commission'
import Preferential from './Preferential'
export default {
name: "OrderSpecial",
components: {
SpecialDiscount
Discount, Commission, Preferential
},
props: {
orderId: [String, Number]
......@@ -138,15 +150,14 @@ export default {
// 遮罩层
loading: true,
list: [],
total:0,
/* total:0,
params:{
page:1,
rows:20,
orderId:0,
type:2
},
}, */
relationId:0,
creatorName:'test',
order: {
number: '',
orderItemVOList: []
......@@ -156,14 +167,14 @@ export default {
productAttrList:[],
hasWarehouseInInfo: false,
showDiscountItemId: null
showDiscountItem: null, // 优惠申请
showCommissionItem: null, // 佣金规则
showAllowanceItem: null, // 管理折扣
showPreferentialType: null, // 重泡货类型
};
},
created() {
if(this.orderId){
this.params.orderId = this.orderId
this.getOrder()
}
this.getOrder()
getUnitList().then(res => this.unitList = res.data)
getCurrencyList().then(res => this.currencyList = res.data)
getProductAttrList().then(res => this.productAttrList = res.data)
......@@ -191,17 +202,18 @@ export default {
path:"/order/specialLight/"+this.params.orderId,
})
},
/* getProductNamesByIds(ids){
const result = []
ids.split(',').forEach(e => {
this.productAttrList.forEach(f => {
if (parseInt(e) === f.id) {
result.push(f.attrName)
}
})
})
return result.join(',')
} */
onDiscountSuccess(){
this.showDiscountItem = null
this.getOrder()
},
onCommissionSuccess(){
this.showCommissionItem = null
this.getOrder()
},
onPreferentialSuccess(){
this.showPreferentialType = null
this.getOrder()
}
},
computed: {
currencyMap(){
......
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