Commit 1b2976e7 authored by 邓春圆's avatar 邓春圆

Merge remote-tracking branch 'origin/dev' into dev

parents 7fcb34c6 953c20b7
......@@ -9,6 +9,14 @@ export function createProductPrice(data) {
})
}
export function createProductPriceAir(data) {
return request({
url: '/ecw/product-price/createAir',
method: 'post',
data: data
})
}
// 更新产品价格
export function updateProductPrice(data) {
return request({
......@@ -18,6 +26,15 @@ export function updateProductPrice(data) {
})
}
// 更新空运价格
export function updateProductPriceAir(data) {
return request({
url: '/ecw/product-price/updateAir',
method: 'put',
data: data
})
}
// 删除产品价格
export function deleteProductPrice(id) {
return request({
......@@ -71,6 +88,15 @@ export function batchUpdateProductPrice(query) {
})
}
// 批量修改空运产品价格
export function batchUpdateProductPriceAir(data) {
return request({
url: '/ecw/product-price/batchUpdate',
method: 'put',
data
})
}
// 批量拉黑
export function batchBlock(query) {
return request({
......@@ -124,3 +150,12 @@ export function batchAddPrice(data) {
data
})
}
// 批量加价空运
export function batchAddPriceAir(data) {
return request({
url: '/ecw/product-price/batchAddPriceAir',
method: 'put',
data
})
}
......@@ -12,7 +12,7 @@
<el-input v-model="queryParams.titleZh" :placeholder="$t('产品关键字')" style="width:120px" clearable :disabled="loading"/>
<el-button type="primary" @click="reLoad" :loading="loading">{{$t('搜索')}}</el-button>
<div>
<div style="height: 36px; display: flex; align-items: center">
<el-checkbox :label="$t('全选') + `(${$t('{total}个', {total})})`" @change="toggleAll" :disabled="isAllProduct || loading"></el-checkbox>
</div>
</div>
......@@ -27,18 +27,28 @@
</div>
<div class="flex-1 ml-10">
<el-card style="height:100%">
<div slot="header" class="header flex">
<div class="flex-1 flex items-center">{{$t('已选{cnt}个产品', {cnt: choosedList.length})}}</div>
<div slot="header" class="header">
<el-select v-model="selectedFilterParams.typeId" :placeholder="$t('选择类型')" style="width:120px" clearable :disabled="loading">
<el-option v-for="item in typeList" :key="item.id" :label="item.titleZh" :value="item.id" />
</el-select>
<el-select v-model="selectedFilterParams.attrId" :placeholder="$t('选择属性')" style="width:120px" clearable :disabled="loading">
<el-option v-for="item in attrList" :key="item.id" :label="item.attrName" :value="item.id" />
</el-select>
<el-input v-model="selectedFilterParams.titleZh" :placeholder="$t('产品关键字')" style="width:120px" clearable :disabled="loading"/>
<!--<el-button type="primary" @click="reLoad" :loading="loading">{{$t('搜索')}}</el-button>-->
<div class="flex">
<div class="flex-1 flex items-center">{{$t('已选{cnt}个产品', {cnt: choosedList.length})}}</div>
<el-button :disabled="!choosedList.length" type="text" @click="clearAll">{{$t('全部清除')}}</el-button>
</div>
</div>
<div class="list">
<div class="item" v-for="(choosed) in selectedList" :key="choosed.id" :data-data="JSON.stringify(choosed)">
<div class="item" v-for="(choosed) in selectedList" :key="choosed.id">
<el-link class="el-icon-delete" @click="remove(choosed)" :disabled="isAllProduct"/> {{choosed.titleZh}}
<div>{{choosed.titleEn}}</div>
</div>
</div>
<el-pagination :total="choosedList.length" :page-sizes="[100, 200, 300, 500]" :page-size="pageSize" @current-change="rightPage = $event" layout="prev, pager, next, total, sizes" :current-page="rightPage" />
<el-pagination :total="filteredList.length" :page-sizes="[100, 200, 300, 500]" :page-size="pageSize" @current-change="rightPage = $event" layout="prev, pager, next, total, sizes" :current-page="rightPage" />
</el-card>
</div>
</div>
......@@ -75,6 +85,11 @@ export default {
titleZh: null,
typeId: null
},
selectedFilterParams:{
attrId: null,
titleZh: null,
typeId: null
},
choosedList: [],
typeList: [],
attrList: [],
......@@ -110,9 +125,24 @@ export default {
currentList(){
return this.list.slice((this.leftPage - 1) * this.pageSize, this.leftPage * this.pageSize)
},
// 已勾选的显示列表
// 已选中 且符合筛选的
filteredList(){
return this.choosedList.filter(item => {
if(this.selectedFilterParams.typeId && item.typeId != this.selectedFilterParams.typeId){
return false
}
if(this.selectedFilterParams.attrId && item.attrId != this.selectedFilterParams.attrId){
return false
}
if(this.selectedFilterParams.titleZh && item.titleZh.indexOf(this.selectedFilterParams.titleZh) == -1){
return false
}
return true
})
},
// 已勾选的显示列表,当前分页显示的
selectedList(){
return this.choosedList.slice((this.rightPage - 1) * this.pageSize, this.rightPage * this.pageSize)
return this.filteredList.slice((this.rightPage - 1) * this.pageSize, this.rightPage * this.pageSize)
}
},
watch: {
......@@ -131,7 +161,7 @@ export default {
},*/
defaultIds(newValue, oldValue){
if(!oldValue || !oldValue.length){
this.loadDefaultProds()
// this.loadDefaultProds()
}
},
isall(isall){
......
......@@ -939,6 +939,14 @@ export default {
'form.channelId'(){
this.calculationPrice()
if(this.form.lineId) this.getOfferData()
// 选择渠道后需要筛选目的城市和线路
// 有点卡,改异步
this.$nextTick(() => {
// 更新目的城市备选
this.getTradeCity()
// 更新线路备选
this.getOpenedRouterList()
})
},
'form.consigneeCountryCode'(){
if(this.form.lineId) this.getOfferData()
......@@ -1086,7 +1094,7 @@ export default {
this.productAttrList = (await getProductAttrList()).data
this.channelList = (await getChannelList()).data
this.tradeCityList = (await getTradeCityList()).data
await this.getTradeCity()
this.currencyList = (await getCurrencyList()).data
this.unitList = (await getUnitList()).data
this.transportList = this.getDictDatas(this.DICT_TYPE.ECW_TRANSPORT_TYPE)
......@@ -1110,6 +1118,13 @@ export default {
},
methods: {
async getTradeCity(){
let query = {}
if(this.form.channelId){
query.channelId = this.form.channelId
}
this.tradeCityList = (await getTradeCityList(query)).data
},
onTableMounted(e){
// console.warn('onTableMounted', e)
},
......@@ -1333,6 +1348,9 @@ export default {
if(this.form.transportId){
params.transportType = this.form.transportId
}
if(this.form.channelId){
params.channelId = this.form.channelId
}
// 始发,目的和运输方式都没有的时候不获取
if(!params.startCityId && !params.destCityId && !params.transportType) return false
getOpenedRouterList(params).then(res => this.routerList = res.data.filter(item => {
......
......@@ -274,6 +274,8 @@
<el-button v-else-if="scope.row.orderExceptionType=='stock_up_exception'" v-hasPermi="['ecw:exception:stockUpException']" size="mini" type="text" icon="el-icon-edit" @click="handEdit(scope.row.orderId)">{{$t('处理')}}</el-button>
<el-button v-else-if="scope.row.orderExceptionType=='channel_exception'" v-hasPermi="['ecw:exception:channelException']" size="mini" type="text" icon="el-icon-edit" @click="handEdit(scope.row.orderId)">{{$t('处理')}}</el-button>
<el-button v-else-if="scope.row.orderExceptionType=='channel_packaging_overweight_exception'" v-hasPermi="['ecw:exception:channelPackagingException']" size="mini" type="text" icon="el-icon-edit" @click="handEdit(scope.row.orderId)">{{$t('处理')}}</el-button>
<!-- 2.0.2 -->
<el-button v-else-if="scope.row.orderExceptionType=='line_weight_exception'" v-hasPermi="['ecw:exception:lineWeightException']" size="mini" type="text" icon="el-icon-edit" @click="handEdit(scope.row.orderId)">{{$t('处理')}}</el-button>
</template>
</el-table-column>
</el-table>
......
......@@ -146,6 +146,8 @@
<el-button v-else-if="scope.row.orderExceptionStatus==2&&scope.row.orderExceptionType=='stock_up_exception'" v-hasPermi="['ecw:exception:stockUpException']" size="mini" type="text" icon="el-icon-edit" @click="handEdit(scope.row)">{{$t('查看')}}</el-button>
<el-button v-else-if="scope.row.orderExceptionStatus==2&&scope.row.orderExceptionType=='channel_exception'" v-hasPermi="['ecw:exception:channelException']" size="mini" type="text" icon="el-icon-edit" @click="handEdit(scope.row)">{{$t('查看')}}</el-button>
<el-button v-else-if="scope.row.orderExceptionStatus==2&&scope.row.orderExceptionType=='channel_packaging_overweight_exception'" v-hasPermi="['ecw:exception:channelPackagingException']" size="mini" type="text" icon="el-icon-edit" @click="handEdit(scope.row)">{{$t('查看')}}</el-button>
<!-- v2.0.2 -->
<el-button v-else-if="scope.row.orderExceptionStatus==2&&scope.row.orderExceptionType=='line_Weight_exception'" v-hasPermi="['ecw:exception:lineWeightException']" size="mini" type="text" icon="el-icon-edit" @click="handEdit(scope.row)">{{$t('查看')}}</el-button>
<el-tag style="margin-left:10px" v-if="scope.row.orderExceptionStatus==2">{{$t('已完成')}}</el-tag>
<el-button v-else-if="scope.row.orderExceptionType=='order_superfluous_box_exception'" v-hasPermi="['ecw:exception:superfluousBox']" size="mini" type="text" icon="el-icon-edit" @click="handEdit(scope.row)">{{$t('处理')}}</el-button>
......@@ -176,6 +178,8 @@
<el-button v-else-if="scope.row.orderExceptionType=='stock_up_exception'" v-hasPermi="['ecw:exception:stockUpException']" size="mini" type="text" icon="el-icon-edit" @click="handEdit(scope.row)">{{$t('处理')}}</el-button>
<el-button v-else-if="scope.row.orderExceptionType=='channel_exception'" v-hasPermi="['ecw:exception:channelException']" size="mini" type="text" icon="el-icon-edit" @click="handEdit(scope.row)">{{$t('处理')}}</el-button>
<el-button v-else-if="scope.row.orderExceptionType=='channel_packaging_overweight_exception'" v-hasPermi="['ecw:exception:channelPackagingException']" size="mini" type="text" icon="el-icon-edit" @click="handEdit(scope.row)">{{$t('处理')}}</el-button>
<!-- v2.0.2 -->
<el-button v-else-if="scope.row.orderExceptionType=='line_weight_exception'" v-hasPermi="['ecw:exception:lineWeightException']" size="mini" type="text" icon="el-icon-edit" @click="handEdit(scope.row)">{{$t('处理')}}</el-button>
</template>
</el-table-column>
</el-table>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<script>
import {getPriceSnapshotList} from "@/api/ecw/productPrice";
export default {
name: "Logs",
props:{
currencyMap:{
type:Object,
default:() =>{
return {}
}
},
unitMap:{
type:Object,
default:() =>{
return {}
}
},
},
data(){
return {
showLogsDialog: false,
loading: false,
logs:[]
}
},
methods:{
open(id){
this.showLogsDialog = true
this.loading = true
getPriceSnapshotList(id).then(res => {
this.logs = res.data
this.logs.forEach(item => {
item.detail = JSON.parse(item.content)
})
}).finally(() => {
this.loading = false
})
},
closeLogsDialog(){
this.logs = []
this.showLogsDialog = false
}
}
}
</script>
<template>
<el-dialog :title="$t('查看价格日志')" :visible.sync="showLogsDialog" :before-close="closeLogsDialog" width="1000px">
<el-table :data="logs" v-loading="loading">
<el-table-column :label="$t('序号')" type="index"></el-table-column>
<el-table-column :label="$t('修改人')" prop="creatorName" width="200px"></el-table-column>
<el-table-column :label="$t('修改时间')">
<template slot-scope="{row}">{{row.createTime|parseTime}}</template>
</el-table-column>
<el-table-column :label="$t('修改前')">
<template slot-scope="{row}">
<div>{{ $t('预付') }}<dict-tag :type="DICT_TYPE.ECW_PAY_ADVANCE" :value="row.detail.needPay" /></div>
<div>{{ $t('单价模式') }}<dict-tag :type="DICT_TYPE.ECW_PRICE_TYPE" :value="row.detail.priceType" /></div>
<div v-if="row.detail.minWeight">{{ $t('最小起计量') }}{{ row.detail.minWeight }}{{unitMap[row.detail.minWeightUnit]}}</div>
<!----阶梯定价-->
<template v-if="row.detail.stepPrice == 1">
<template v-for="(item, index) in row.detail.priceStepList">
<div class="mt-10">
{{index+1}}阶段
{{item.startNum}} - {{item.endNum}} {{unitMap[item.weightUnit]}}
</div>
<template v-if="row.detail.priceType != 1">
<div :key="index + '_freight'" class="pl-10" >
运费:
{{item.transportPrice}} {{currencyMap[item.transportPriceUnit]}} / {{unitMap[item.transportVolumeUnit]}}
</div>
<!--空运没有清关费, 不需要显示-->
<div v-if="type != 'air'" :key="item.specialDictType + '_clearance'" class="pl-10">
清关费:
{{item.clearancePrice}} {{currencyMap[item.clearancePriceUnit]}} / {{unitMap[item.clearanceVolumeUnit]}}
</div>
</template>
<div v-else class="pl-10">
全包价:
{{item.allPrice}} {{currencyMap[item.allPriceUnit]}} / {{unitMap[item.allVolumeUnit]}}
</div>
</template>
</template>
<template v-else>
<template v-if="row.detail.priceType != 1">
<div>
默认运费:
{{row.detail.transportPrice}} {{currencyMap[row.detail.transportPriceUnit]}} / {{unitMap[row.detail.transportVolumeUnit]}}
</div>
<div>
默认清关费:
{{row.detail.clearancePrice}} {{currencyMap[row.detail.clearancePriceUnit]}} / {{unitMap[row.detail.clearanceVolumeUnit]}}
</div>
</template>
<div v-else>
全包价:
{{row.detail.allPrice}} {{currencyMap[row.detail.allPriceUnit]}} / {{unitMap[row.detail.allVolumeUnit]}}
</div>
<template v-for="(item, index) in row.detail.specialList">
<template v-if="row.detail.priceType != 1">
<div :key="item.specialDictType + '_freight'" >
{{getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, item.specialDictType)}} 运费:
{{item.transportPrice}} {{currencyMap[item.transportPriceUnit]}} / {{unitMap[item.transportVolumeUnit]}}
</div>
<div :key="item.specialDictType + '_clearance'" >
{{getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, item.specialDictType)}} 清关费:
{{item.clearancePrice}} {{currencyMap[item.clearancePriceUnit]}} / {{unitMap[item.clearanceVolumeUnit]}}
</div>
</template>
<div v-else>
{{getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, item.specialDictType)}} 全包价:
{{item.allPrice}} {{currencyMap[item.allPriceUnit]}} / {{unitMap[item.allVolumeUnit]}}
</div>
</template>
</template>
<div v-if="row.detail.validateStartDate || row.detail.validateStartDate">有效期:{{ row.detail.validateStartDate|parseTime }}-{{ row.detail.validateEndDate|parseTime }}</div>
</template>
</el-table-column>
</el-table>
</el-dialog>
</template>
<style scoped lang="scss">
</style>
<script>
import Selector from "@/components/Selector/index.vue";
import Inputor from "@/components/Inputor/index.vue";
import Template from "@/views/cms/template/index.vue";
import {DICT_TYPE, getDictDatas} from "@/utils/dict";
export default {
name: "PriceStep",
components: {Template, Inputor, Selector},
props:{
index: Number,
priceName: String,
fieldPrefix: String,
unitList:{
type: Array,
default: []
},
currencyList:{
type: Array,
default: []
},
showAdd: Boolean,
readonly: Boolean,
stepTips: String,
value:{
type: Object,
default: () => {
return {
}
}
}
},
created() {
if(!this.value.packagingList){
this.addPackage()
}
// 格式化包装
if(this.value.packagingList?.length){
this.value.packagingList.forEach(item => {
if(item.packagingTypes && typeof item.packagingTypes == 'string'){
item.packagingTypes = item.packagingTypes.split(',')
}
})
}
this.initSpecialPrice()
},
data(){
return {
}
},
computed:{
packagingList(){
return getDictDatas(DICT_TYPE.ECW_PACKAGING_TYPE).map(dict => {
dict.enable = true
this.value.packagingList.forEach(item => {
if(item.packagingTypes?.length && item.packagingTypes.indexOf(dict.value) > -1){
dict.enable = false
}
})
return dict
})
}
},
methods:{
getDictDatas,
// 初始化特需加价
initSpecialPrice(){
if(!this.value.specialList){
this.$set(this.value, 'specialList', [])
}
this.getDictDatas(this.DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS).forEach(item => {
if(!this.value.specialList.find(special => special.specialDictType == item.value)){
this.value.specialList.push({
[`${this.fieldPrefix}Price`]: undefined, // 新建默认给0,否则默认是null
[`${this.fieldPrefix}PriceUnit`]: this.value[`${this.fieldPrefix}PriceUnit`],
[`${this.fieldPrefix}VolumeUnit`]: this.value[`${this.fieldPrefix}VolumeUnit`],
"specialDictType": item.value
})
}
})
},
// 添加包装类型运费
addPackage(){
if(!this.value.packagingList){
this.$set(this.value, 'packagingList', [])
}
this.value.packagingList.push({
packagingPrice: undefined,
packagingPriceUnit : this.value[`${this.fieldPrefix}PriceUnit`],
packagingVolumeUnit : this.value[`${this.fieldPrefix}VolumeUnit`],
})
},
// 删除包装类型运费
deletePackage(index){
this.value.packagingList.splice(index, 1)
},
// 校验
validate(){
const index = this.index
const errors = []
// 区间设置检查
if(index > 0 && !this.value.startNum){
errors.push(`请设置${this.priceName}${index+1}阶段的起始值`)
}
if(!this.value.endNum){
errors.push(`请设置${this.priceName}${index+1}阶段的结束值`)
}
// 价格检查
if(!this.validatePrice(this.value[`${this.fieldPrefix}Price`])){
errors.push(`请设置第${index+1}阶段的${this.priceName}`)
}
// 包装价格检查
if(this.value.packagingList?.length){
this.value.packagingList.forEach((item, i) => {
if(item.packagingTypes?.length && !this.validatePrice(item.packagingPrice)){
errors.push(`请设置第${index+1}阶段的包装类型${i+1}${this.priceName}`)
}
})
}
if(errors.length){
this.$notify.error({
title: this.$t("表单错误"),
message: errors.join(';\n')
});
}
return !errors.length
},
// 校验价格是否为空,可以是0
validatePrice(value){
if(value === undefined || value === null || value === ''){
return false
}
return true
},
}
}
</script>
<template>
<div>
<div class="bold text-lg">{{$t('空运{type}设置', {type: priceName})}}</div>
<div style="font-size:14px; margin:10px 0">
{{$t('第{index}阶梯定价方案', {index: index+1})}}
<template v-if="showAdd">
<el-link type="primary" @click.native="$emit('add', fieldPrefix)">{{$t('添加区间')}}</el-link>
<el-divider direction="vertical"></el-divider>
<el-link type="danger" @click.native="$emit( 'delete', index)">{{$t('删除')}}</el-link>
</template>
</div>
<el-form-item :label="$t('第{index}阶梯', {index: index+1})">
<el-input-number v-model="value.startNum" :controls="false" class="w-100"></el-input-number>
-
<el-input-number v-model="value.endNum" :controls="false" class="w-100"></el-input-number>
/
<selector
:disabled="index>0"
v-model="value.weightUnit"
:options="unitList"
:label-field="$l(null, 'title')"
@input="$emit('changeUnit', {
value: $event,
field: 'weightUnit',
type: fieldPrefix
})"
value-field="id"
class="w-100" />
<div class="tips" v-if="stepTips">{{stepTips}}</div>
</el-form-item>
<el-form-item :label="$t('默认') + priceName">
<el-input-number v-model="value[`${fieldPrefix}Price`]" :placeholder="$t('整数或者两位小数')" :precision="2" :controls="false" class="w-100 mr-10"/>
<selector
:disabled="index>0"
v-model="value[`${fieldPrefix}PriceUnit`]"
:options="currencyList"
:label-field="$l(null, 'title')"
@input="$emit('changeUnit', {
value: $event,
field: `${fieldPrefix}PriceUnit`
})"
value-field="id"
class="w-100" />
/
<selector
:disabled="index>0"
v-model="value[`${fieldPrefix}VolumeUnit`]"
:options="unitList"
:label-field="$l(null, 'title')"
@input="$emit('changeUnit', {
value: $event,
field: `${fieldPrefix}VolumeUnit`
})"
value-field="id"
class="w-100" />
</el-form-item>
<!--特性加价-->
<template v-for="(special, specialIndex) in value.specialList">
<el-form-item
:label="getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + priceName"
:key="specialIndex + 'transport'"
>
<el-input-number v-model.number="special[`${fieldPrefix}Price`]" :controls="false" :min="0" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10" />
<selector disabled v-model="special[`${fieldPrefix}PriceUnit`]" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100 mr-10" />
<span class="mr-10">/</span>
<selector disabled v-model="special[`${fieldPrefix}VolumeUnit`]" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
</el-form-item>
</template>
<!--包装类型价格-->
<template v-for="(item, i) in value.packagingList">
<el-form-item :label="$t('包装类型') + priceName + (i+1)">
<template #label>
<div class="el-form-item__label" style="width: 150px;">{{$t('包装类型') + priceName + (i+1)}}</div>
<div v-if="!item.packagingTypes || !item.packagingTypes.length" class="tips">{{$t('未选择包装类型将被忽略')}}</div>
</template>
<el-select v-model="item.packagingTypes" multiple placeholder="请选择" style="width: 100%; max-width: 450px; margin-bottom: 5px; display: block">
<el-option
v-for="item in packagingList"
:key="item.value"
:label="$l(item, 'label')"
:value="item.value"
:disabled="!item.enable"
>
</el-option>
</el-select>
<el-input-number v-model="item.packagingPrice" :controls="false" :min="0" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10" />
<selector disabled v-model="item.packagingPriceUnit" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100 mr-10" />
<span class="mr-10">/</span>
<selector disabled v-model="item.packagingVolumeUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
<template v-if="i == value.packagingList.length -1 && !readonly">
<el-link type="primary" @click.native="addPackage" class="ml-5">{{$t('添加')}}</el-link>
<el-divider direction="vertical"></el-divider>
<el-link type="danger" @click.native="deletePackage(i)">{{$t('删除')}}</el-link>
</template>
</el-form-item>
</template>
</div>
</template>
<style scoped lang="scss">
.bold {
font-weight: bold;
}
.text-lg{
font-size: 1.3rem;
}
.tips{
font-size: 1rem; color: red;
}
</style>
<script>
import Selector from "@/components/Selector/index.vue";
export default {
name: "QuickSet.vue",
props:{
type:String,
unitList:{
type: Array,
default(){
return []
}
},
currencyList:{
type: Array,
default(){
return []
}
},
value:{
type: Object,
default(){
return {}
}
}
},
components: {Selector},
data(){
return {
quickForm:{}, // 快速加价/减价表单
}
},
computed:{
getUnit(){
return (field, unitField) => {
if(this.type == 'sea'){
if(this.value.stepPrice && !this.value.priceStepList?.length){
return null
}
if(this.value.stepPrice){
return this.value.priceStepList[0][unitField]
}
return this.value[unitField]
}
// 后面是空运的
if(!this.value[field]?.length) return null
return this.value[field][0][unitField]
}
}
},
methods:{
handleConfirm(type){
let amount = this.quickForm[type]
if(!amount){
return this.$message.error(this.$t('请输入加价金额'))
}
if(this.type == 'sea'){
return this.batchSetSeaPrice(type, amount)
}
if(this.value?.priceType == 1){
this.batchSetPrice("fullPriceStepList", 'all', amount)
}else if(type == 'transport'){
this.batchSetPrice("freightPriceStepList","transport", amount)
}else if(type == 'clearance'){
this.batchSetPrice("clearancePriceStepList", "clearance", amount)
}
},
batchSetPrice(field, fieldPrefix, amount){
if(!this.value[field]?.length) return
this.value[field].forEach(item => {
if(item[fieldPrefix + 'Price']){
item[fieldPrefix + 'Price'] = (item[fieldPrefix + 'Price'] * 100 + amount * 100) / 100
}
// 特性价格
if(item.specialList?.length){
item.specialList.forEach(special => {
console.log(special.specialDictType, special[fieldPrefix + 'Price'])
if(special[fieldPrefix + 'Price']){
special[fieldPrefix + 'Price'] = (special[fieldPrefix + 'Price'] * 100 + amount * 100) / 100
}
})
}
// 包装价格
if(item.packagingList?.length){
item.packagingList.forEach(packaging => {
if(packaging['packagingPrice']){
packaging['packagingPrice'] = (packaging['packagingPrice'] * 100 + amount * 100) / 100
}
})
}
})
},
batchSetSeaPrice(type, amount){
console.log('快捷设置海运价格', type, amount)
if(!this.value.stepPrice){
if(!this.value.priceType){
this.setSeaPrice(this.value,"transport", amount)
this.setSeaPrice(this.value,"clearance",amount)
}else{
this.setSeaPrice(this.value,"all", amount)
}
return
}
this.value.priceStepList.forEach(item => {
if(!this.value.priceType){
this.setSeaPrice(item,"transport", amount)
this.setSeaPrice(item,"clearance",amount)
}else{
this.setSeaPrice(item,"all", amount)
}
})
},
setSeaPrice(parent, fieldPrefix, amount){
console.log(parent[`${fieldPrefix}Price`], ...arguments)
parent[`${fieldPrefix}Price`] = (parent[fieldPrefix + 'Price'] * 100 + amount * 100) / 100
if(!parent.specialList?.length) return
parent.specialList.forEach(special => {
console.log(special.specialDictType, special[fieldPrefix + 'Price'])
if(special[fieldPrefix + 'Price']){
special[fieldPrefix + 'Price'] = (special[fieldPrefix + 'Price'] * 100 + amount * 100) / 100
}
})
}
}
}
</script>
<template>
<div>
<h2 class="mt-5">{{$t('快捷设置')}}</h2>
<div class="flex items-center" v-if="value.priceType != 1">
<div class="w-100">{{$t('运费快捷加价')}}</div>
<el-input-number :controls="false" v-model="quickForm.transport" class="w-100 ml-10 mr-10"></el-input-number>
<selector disabled :value="getUnit('freightPriceStepList', 'transportPriceUnit')" :options="currencyList" :label-field="$l('title')" value-field="id" class="w-100" />
/ <selector disabled :value="getUnit('freightPriceStepList', 'transportVolumeUnit')" :options="unitList" :label-field="$l('title')" value-field="id" class="w-100" />
<div class="ml-10">
<el-button @click="handleConfirm('transport')" type="primary">{{$t('提交运费')}}</el-button>
</div>
</div>
<div class="flex items-center mt-10" v-if="value.priceType != 1">
<div class="w-100">{{$t('清关费快捷加价')}}</div>
<el-input-number :controls="false" v-model="quickForm.clearance" class="w-100 ml-10 mr-10"></el-input-number>
<selector disabled :value="getUnit('clearancePriceStepList', 'clearancePriceUnit')" :options="currencyList" :label-field="$l('title')" value-field="id" class="w-100" />
/ <selector disabled :value="getUnit('clearancePriceStepList', 'clearanceVolumeUnit')" :options="unitList" :label-field="$l('title')" value-field="id" class="w-100" />
<div class="ml-10">
<el-button @click="handleConfirm('clearance')" type="primary">{{$t('提交清关费')}}</el-button>
</div>
</div>
<div class="flex items-center" v-if="value.priceType == 1">
<div class="w-100">{{$t('全包价快捷加价')}}</div>
<el-input-number v-model="quickForm.all" :controls="false" class="w-100 ml-10 mr-10"></el-input-number>
<selector disabled :value="getUnit('fullPriceStepList', 'allPriceUnit')" :options="currencyList" :label-field="$l('title')" value-field="id" class="w-100" />
/ <selector disabled :value="getUnit('fullPriceStepList', 'allVolumeUnit')" :options="unitList" :label-field="$l('title')" value-field="id" class="w-100" />
<div class="ml-10">
<el-button @click="handleConfirm('all')" type="primary">{{$t('提交全包价')}}</el-button>
</div>
</div>
</div>
</template>
<style scoped lang="scss">
</style>
<script>
import Selector from "@/components/Selector/index.vue";
import Inputor from "@/components/Inputor/index.vue";
import Template from "@/views/cms/template/index.vue";
import {DICT_TYPE, getDictDatas} from "@/utils/dict";
export default {
name: "SeaPrice",
components: {Template, Inputor, Selector},
props:{
priceType: Number, // 1全包价,0清关费+运费
unitList:{
type: Array,
default: []
},
currencyList:{
type: Array,
default: []
},
readonly: Boolean,
value:{
type: Object,
default: () => {
return {
}
}
}
},
created() {
this.initSpecialPrice()
},
data(){
return {
}
},
methods:{
getDictDatas,
// 初始化特需加价
initSpecialPrice(){
if(!this.value.specialList){
this.$set(this.value, 'specialList', [])
}
this.getDictDatas(this.DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS).forEach(item => {
if(!this.value.specialList.find(special => special.specialDictType == item.value)){
this.value.specialList.push({
allPrice: undefined, // 新建默认给0,否则默认是null
allPriceUnit: this.value[`allPriceUnit`],
allVolumeUnit: this.value[`allVolumeUnit`],
transportPrice: undefined, // 新建默认给0,否则默认是null
transportPriceUnit: this.value[`transportPriceUnit`],
transportVolumeUnit: this.value[`transportVolumeUnit`],
clearancePrice: undefined,
clearancePriceUnit: this.value[`clearancePriceUnit`],
clearanceVolumeUnit: this.value[`clearanceVolumeUnit`],
specialDictType: item.value
})
}
})
},
// 校验
validate(){
let valid = true
// 价格检查
if(this.priceType){
if(!this.validatePrice(this.value[`allPrice`])){
valid = false
this.$message.error(`请设置全包价`)
}
}else{
if(!this.validatePrice(this.value[`transportPrice`])){
valid = false
this.$message.error(`请设置运费`)
}
if(!this.validatePrice(this.value[`clearancePrice`])){
valid = false
this.$message.error(`请设置清关费`)
}
}
return valid
},
// 校验价格是否为空,可以是0
validatePrice(value){
if(value === undefined || value === null || value === ''){
return false
}
return true
},
}
}
</script>
<template>
<div>
<el-form-item :label="$t('默认运费')" v-if="!priceType">
<el-input-number v-model="value[`transportPrice`]" :placeholder="$t('整数或者两位小数')" :controls="false":disabled="readonly" class="w-100 mr-10"/>
<selector
:disabled="readonly"
v-model="value[`transportPriceUnit`]"
:options="currencyList"
:label-field="$l(null, 'title')"
@input="$emit('changeUnit', {
value: $event,
field: `transportPriceUnit`
})"
value-field="id"
class="w-100" />
/
<selector
:disabled="readonly"
v-model="value[`transportVolumeUnit`]"
:options="unitList"
:label-field="$l(null, 'title')"
@input="$emit('changeUnit', {
value: $event,
field: `transportVolumeUnit`
})"
value-field="id"
class="w-100" />
</el-form-item>
<el-form-item :label="$t('默认清关费')" v-if="!priceType">
<el-input-number v-model="value[`clearancePrice`]" :placeholder="$t('整数或者两位小数')" :disabled="readonly" :controls="false" class="w-100 mr-10"/>
<selector
:disabled="readonly"
v-model="value[`clearancePriceUnit`]"
:options="currencyList"
:label-field="$l(null, 'title')"
@input="$emit('changeUnit', {
value: $event,
field: `clearancePriceUnit`
})"
value-field="id"
class="w-100" />
/
<selector
:disabled="readonly"
v-model="value[`clearanceVolumeUnit`]"
:options="unitList"
:label-field="$l(null, 'title')"
@input="$emit('changeUnit', {
value: $event,
field: `clearanceVolumeUnit`
})"
value-field="id"
class="w-100" />
</el-form-item>
<el-form-item :label="$t('默认全包价')" v-if="priceType">
<el-input-number v-model="value[`allPrice`]" :placeholder="$t('整数或者两位小数')" :disabled="readonly" :controls="false" class="w-100 mr-10"/>
<selector
:disabled="readonly"
v-model="value[`allPriceUnit`]"
:options="currencyList"
:label-field="$l(null, 'title')"
@input="$emit('changeUnit', {
value: $event,
field: `allPriceUnit`
})"
value-field="id"
class="w-100" />
/
<selector
:disabled="readonly"
v-model="value[`allVolumeUnit`]"
:options="unitList"
:label-field="$l(null, 'title')"
@input="$emit('changeUnit', {
value: $event,
field: `allVolumeUnit`
})"
value-field="id"
class="w-100" />
</el-form-item>
<!--特性加价-->
<template v-for="(special, specialIndex) in value.specialList">
<div :key="specialIndex + 'transport'">
<el-form-item
v-if="!priceType"
:label="getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + $t('运费')"
>
<el-input-number v-model.number="special[`transportPrice`]" :controls="false" :min="0" :disabled="readonly" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10" />
<selector disabled v-model="special[`transportPriceUnit`]" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100 mr-10" />
<span class="mr-10">/</span>
<selector disabled v-model="special[`transportVolumeUnit`]" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
</el-form-item>
<el-form-item
v-if="!priceType"
:label="getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + $t('清关费')"
>
<el-input-number v-model.number="special[`clearancePrice`]" :controls="false" :min="0" :disabled="readonly" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10" />
<selector disabled v-model="special[`clearancePriceUnit`]" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100 mr-10" />
<span class="mr-10">/</span>
<selector disabled v-model="special[`clearanceVolumeUnit`]" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
</el-form-item>
<el-form-item
v-if="priceType"
:label="getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + $t('全包价')"
>
<el-input-number v-model.number="special[`allPrice`]" :controls="false" :min="0" :disabled="readonly" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10" />
<selector disabled v-model="special[`allPriceUnit`]" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100 mr-10" />
<span class="mr-10">/</span>
<selector disabled v-model="special[`allVolumeUnit`]" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
</el-form-item>
</div>
</template>
</div>
</template>
<style scoped lang="scss">
.bold {
font-weight: bold;
}
.text-lg{
font-size: 1.3rem;
}
.tips{
font-size: 1rem; color: red;
}
</style>
<script>
import Selector from "@/components/Selector/index.vue";
import Inputor from "@/components/Inputor/index.vue";
import Template from "@/views/cms/template/index.vue";
import {DICT_TYPE, getDictDatas} from "@/utils/dict";
export default {
name: "SeaStep",
components: {Template, Inputor, Selector},
props:{
index: Number,
priceType: Number, // 1全包价,0清关费+运费
unitList:{
type: Array,
default: []
},
currencyList:{
type: Array,
default: []
},
showAdd: Boolean,
readonly: Boolean,
value:{
type: Object,
default: () => {
return {
}
}
}
},
created() {
this.initSpecialPrice()
},
data(){
return {
}
},
methods:{
getDictDatas,
// 初始化特需加价
initSpecialPrice(){
if(!this.value.specialList){
this.$set(this.value, 'specialList', [])
}
this.getDictDatas(this.DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS).forEach(item => {
if(!this.value.specialList.find(special => special.specialDictType == item.value)){
this.value.specialList.push({
allPrice: undefined, // 新建默认给0,否则默认是null
allPriceUnit: this.value[`allPriceUnit`],
allVolumeUnit: this.value[`allVolumeUnit`],
transportPrice: undefined, // 新建默认给0,否则默认是null
transportPriceUnit: this.value[`transportPriceUnit`],
transportVolumeUnit: this.value[`transportVolumeUnit`],
clearancePrice: undefined,
clearancePriceUnit: this.value[`clearancePriceUnit`],
clearanceVolumeUnit: this.value[`clearanceVolumeUnit`],
specialDictType: item.value
})
}
})
},
// 校验
validate(){
let valid = true
const index = this.index
// 区间设置检查
if(index > 0 && !this.value.startNum){
valid = false
this.$message.error(`请设置第${index+1}阶段的起始值`)
}
if(!this.value.endNum){
valid = false
this.$message.error(`请设置第${index+1}阶段的结束值`)
}
// 价格检查
if(this.priceType){
if(!this.validatePrice(this.value[`allPrice`])){
valid = false
this.$message.error(`请设置第${index+1}阶段的全包价`)
}
}else{
if(!this.validatePrice(this.value[`transportPrice`])){
valid = false
this.$message.error(`请设置第${index+1}阶段的运费`)
}
if(!this.validatePrice(this.value[`clearancePrice`])){
valid = false
this.$message.error(`请设置第${index+1}阶段的清关费`)
}
}
return valid
},
// 校验价格是否为空,可以是0
validatePrice(value){
if(value === undefined || value === null || value === ''){
return false
}
return true
},
}
}
</script>
<template>
<div>
<div style="font-size:14px; margin:10px 0">
{{$t('第{index}阶梯定价方案', {index: index+1})}}
<template v-if="showAdd">
<el-link type="primary" @click.native="$emit('add', fieldPrefix)">{{$t('添加区间')}}</el-link>
<el-divider direction="vertical"></el-divider>
<el-link type="danger" @click.native="$emit( 'delete', index)">{{$t('删除')}}</el-link>
</template>
</div>
<el-form-item :label="$t('第{index}阶梯', {index: index+1})">
<el-input-number v-model="value.startNum" :controls="false" class="w-100"></el-input-number>
-
<el-input-number v-model="value.endNum" :controls="false" class="w-100"></el-input-number>
/
<selector
:disabled="index>0"
v-model="value.weightUnit"
:options="unitList"
:label-field="$l(null, 'title')"
@input="$emit('changeUnit', {
value: $event,
field: 'weightUnit',
type: fieldPrefix
})"
value-field="id"
class="w-100" />
</el-form-item>
<el-form-item :label="$t('默认运费')" v-if="!priceType">
<el-input-number v-model="value[`transportPrice`]" :placeholder="$t('整数或者两位小数')" :precision="2" :controls="false" class="w-100 mr-10"/>
<selector
:disabled="index>0"
v-model="value[`transportPriceUnit`]"
:options="currencyList"
:label-field="$l(null, 'title')"
@input="$emit('changeUnit', {
value: $event,
field: `transportPriceUnit`
})"
value-field="id"
class="w-100" />
/
<selector
:disabled="index>0"
v-model="value[`transportVolumeUnit`]"
:options="unitList"
:label-field="$l(null, 'title')"
@input="$emit('changeUnit', {
value: $event,
field: `transportVolumeUnit`
})"
value-field="id"
class="w-100" />
</el-form-item>
<el-form-item :label="$t('默认清关费')" v-if="!priceType">
<el-input-number v-model="value[`clearancePrice`]" :placeholder="$t('整数或者两位小数')" :precision="2" :controls="false" class="w-100 mr-10"/>
<selector
:disabled="index>0"
v-model="value[`clearancePriceUnit`]"
:options="currencyList"
:label-field="$l(null, 'title')"
@input="$emit('changeUnit', {
value: $event,
field: `clearancePriceUnit`
})"
value-field="id"
class="w-100" />
/
<selector
:disabled="index>0"
v-model="value[`clearanceVolumeUnit`]"
:options="unitList"
:label-field="$l(null, 'title')"
@input="$emit('changeUnit', {
value: $event,
field: `clearanceVolumeUnit`
})"
value-field="id"
class="w-100" />
</el-form-item>
<el-form-item :label="$t('默认全包价')" v-if="priceType">
<el-input-number v-model="value[`allPrice`]" :placeholder="$t('整数或者两位小数')" :precision="2" :controls="false" class="w-100 mr-10"/>
<selector
:disabled="index>0"
v-model="value[`allPriceUnit`]"
:options="currencyList"
:label-field="$l(null, 'title')"
@input="$emit('changeUnit', {
value: $event,
field: `allPriceUnit`
})"
value-field="id"
class="w-100" />
/
<selector
:disabled="index>0"
v-model="value[`allVolumeUnit`]"
:options="unitList"
:label-field="$l(null, 'title')"
@input="$emit('changeUnit', {
value: $event,
field: `allVolumeUnit`
})"
value-field="id"
class="w-100" />
</el-form-item>
<!--特性加价-->
<template v-for="(special, specialIndex) in value.specialList">
<div :key="specialIndex + 'transport'">
<el-form-item
v-if="!priceType"
:label="getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + $t('运费')"
>
<el-input-number v-model.number="special[`transportPrice`]" :controls="false" :min="0" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10" />
<selector disabled v-model="special[`transportPriceUnit`]" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100 mr-10" />
<span class="mr-10">/</span>
<selector disabled v-model="special[`transportVolumeUnit`]" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
</el-form-item>
<el-form-item
v-if="!priceType"
:label="getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + $t('清关费')"
>
<el-input-number v-model.number="special[`clearancePrice`]" :controls="false" :min="0" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10" />
<selector disabled v-model="special[`clearancePriceUnit`]" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100 mr-10" />
<span class="mr-10">/</span>
<selector disabled v-model="special[`clearanceVolumeUnit`]" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
</el-form-item>
<el-form-item
v-if="priceType"
:label="getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + $t('全包价')"
>
<el-input-number v-model.number="special[`allPrice`]" :controls="false" :min="0" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10" />
<selector disabled v-model="special[`allPriceUnit`]" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100 mr-10" />
<span class="mr-10">/</span>
<selector disabled v-model="special[`allVolumeUnit`]" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
</el-form-item>
</div>
</template>
</div>
</template>
<style scoped lang="scss">
.bold {
font-weight: bold;
}
.text-lg{
font-size: 1.3rem;
}
.tips{
font-size: 1rem; color: red;
}
</style>
This diff is collapsed.
This diff is collapsed.
......@@ -4,7 +4,15 @@
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item :label="$t('商品名称')" prop="titleZh" v-if="!$route.query.product_id">
<el-input v-model="queryParams.titleZh" :placeholder="$t('请输入中英文名称、商品编码、海关编码')" clearable @keyup.enter.native="handleQuery"/>
<el-input v-model="queryParams.titleZh" :placeholder="$t('请输入中英文名称、商品编码、海关编码')" clearable @keyup.enter.native="handleQuery">
<template #prepend>
<el-select v-model="queryParams.searchType" style="width: 100px">
<el-option :value="1" :label="$t('包含')"></el-option>
<el-option :value="2" :label="$t('不包含')"></el-option>
<el-option :value="3" :label="$t('等于')"></el-option>
</el-select>
</template>
</el-input>
</el-form-item>
<el-form-item :label="$t('商品类型')" prop="typeId" v-if="!$route.query.product_id">
......@@ -58,7 +66,12 @@
<el-option :label="$t('否')" value="0"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('单价模式')" prop="priceType">
<el-select v-model="queryParams.priceType" :placeholder="$t('请选择')" clearable>
<el-option :label="$t('运费+清关费')" value="0"></el-option>
<el-option :label="$t('全包价')" value="1"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">{{$t('搜索')}}</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">{{$t('重置')}}</el-button>
......@@ -393,6 +406,7 @@ export default {
dateRangeCreateTime: [],
// 查询参数
queryParams: {
searchType: 1,
pageNo: 1,
pageSize: 10,
productId: null,
......
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