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

完善价格相关的功能

parent a521ab93
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form ref="form" :model="form" :rules="rules" label-width="150px"> <el-form ref="form" :model="form" :rules="rules" label-width="150px">
<products-selector v-model="form.productIdList" show-all @setall="isAllProduct=$event" class="mb-20" /> <products-selector ref="productSelector" v-model="form.productIdList" show-all @setall="isAllProduct=$event" :default-ids="form.productIdList" class="mb-20" />
<routers-selector v-model="selectedRoutes" :type="type" /> <routers-selector v-model="selectedRoutes" :type="type" />
...@@ -191,13 +191,14 @@ ...@@ -191,13 +191,14 @@
</template> </template>
<script> <script>
import RoutersSelector from '@/components/RoutersSelector' import RoutersSelector from '@/components/RoutersSelector'
import { batchUpdateProductPrice} from "@/api/ecw/productPrice"; import {batchUpdateProductPrice, getProductPrice} from "@/api/ecw/productPrice";
import { getCurrencyList } from '@/api/ecw/currency'; import { getCurrencyList } from '@/api/ecw/currency';
import { getUnitList } from '@/api/ecw/unit'; import { getUnitList } from '@/api/ecw/unit';
import ProductsSelector from '@/components/ProductsSelector' import ProductsSelector from '@/components/ProductsSelector'
import Selector from '@/components/Selector' import Selector from '@/components/Selector'
import Inputor from '@/components/Inputor' import Inputor from '@/components/Inputor'
import Decimal from 'decimal.js' import Decimal from 'decimal.js'
import {getProduct} from "@/api/ecw/product";
export default { export default {
components: { RoutersSelector, ProductsSelector, Selector, Inputor }, components: { RoutersSelector, ProductsSelector, Selector, Inputor },
...@@ -294,16 +295,24 @@ export default { ...@@ -294,16 +295,24 @@ export default {
getCurrencyList().then(res => this.currencyList = res.data) getCurrencyList().then(res => this.currencyList = res.data)
getUnitList().then(res => this.unitList = res.data) getUnitList().then(res => this.unitList = res.data)
// 如果是复制,则获取数据并填充,先复制,然后填充特需,避免数据的特需不全导致部分不显示
if(this.$route.query.templateId){
await this.getTemplateDetail(this.$route.query.templateId)
}
this.getDictDatas(this.DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS).forEach(item => { this.getDictDatas(this.DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS).forEach(item => {
this.form.specialList.push({ // 没有的才push,已有的可能是从复制模板携带过来的数据
"clearancePrice": null, if(!this.form.specialList.find(special => special.specialDictType == item.value)) {
"clearancePriceUnit": null, this.form.specialList.push({
"clearanceVolumeUnit": null, "clearancePrice": null,
"specialDictType": item.value, "clearancePriceUnit": null,
"transportPrice": null, "clearanceVolumeUnit": null,
"transportPriceUnit": null, "specialDictType": item.value,
"transportVolumeUnit": null, "transportPrice": null,
}) "transportPriceUnit": null,
"transportVolumeUnit": null,
})
}
}) })
this.$nextTick(() => { this.$nextTick(() => {
...@@ -312,8 +321,62 @@ export default { ...@@ -312,8 +321,62 @@ export default {
this.$set(this.form, 'stepPrice', 1) this.$set(this.form, 'stepPrice', 1)
} }
}) })
}, },
methods: { methods: {
// 获取模板数据(复制的源路线价格信息)
async getTemplateDetail(id){
await getProductPrice(id).then(res => {
// 填充商品、线路、价格信息、出货渠道(空运)
// this.form.productIdList = [res.data.productId]
this.selectedRoutes = [{
"lineId": res.data.warehouseLineId,
"channelId": res.data.shippingChannelId,
"transportId": res.data.warehouseLineDO.transportType,
"shippingChannelId":res.data.channelId
}]
// 要复制过来的字段
const {
allPrice,
allPriceUnit,
allVolumeUnit,
transportPrice,
transportPriceUnit,
transportVolumeUnit,
clearancePrice,
clearancePriceUnit,
clearanceVolumeUnit,
priceType,
stepPrice,
specialList,
priceStepList
} = res.data
this.$set(this, 'form', Object.assign({}, this.form, {
allPrice,
allPriceUnit,
allVolumeUnit,
transportPrice,
transportPriceUnit,
transportVolumeUnit,
clearancePrice,
clearancePriceUnit,
clearanceVolumeUnit,
priceType,
stepPrice,
specialList,
priceStepList,
minWeight,
minWeightUnit
}))
// 产品选择器默认选择的商品
getProduct(res.data.productId).then(res => {
this.$refs.productSelector.choose(res.data)
})
})
},
// 同步全部单位 // 同步全部单位
syncAllUnit(){ syncAllUnit(){
let obj = this.form.stepPrice == 1 ? this.form.priceStepList[0] : this.form let obj = this.form.stepPrice == 1 ? this.form.priceStepList[0] : this.form
......
...@@ -62,143 +62,167 @@ ...@@ -62,143 +62,167 @@
</el-form-item> </el-form-item>
<!--有路线则不显示路线选择器--> <!--有路线则不显示路线选择器-->
<routers-selector v-else v-model="selectedRoutes" :option="routerOption" /> <routers-selector v-else v-model="selectedRoutes" :option="routerOption" :type="type" />
<el-card style="margin-bottom: 10px"> <el-card style="margin-bottom: 10px">
<div slot="header" style="font-size:20px;"> <div slot="header" style="font-size:20px;">
{{$t('价格设置')}} {{$t('价格设置')}}
<span> <span>
<el-checkbox v-if="$route.query.action != 'batchUpdate'" label="" v-model="needPay">{{$t('预付')}}</el-checkbox> <el-checkbox v-if="$route.query.action != 'batchUpdate'" label="" v-model="needPay">{{$t('预付')}}</el-checkbox>
<el-checkbox label="" v-model="stepPrice">{{$t('阶梯定价')}}</el-checkbox> <!--空运只有阶梯价格,所以不显示勾选-->
<el-checkbox label="" v-model="stepPrice" v-if="type != 'air'">{{$t('阶梯定价')}}</el-checkbox>
</span> </span>
</div> </div>
<el-form-item :label="$t('预付')" prop="needPay" v-if="$route.query.action == 'batchUpdate'" > <el-row :gutter="20">
<el-radio-group v-model="form.needPay"> <el-col :span="12">
<el-radio :label="1">{{$t('预付')}}</el-radio> <el-form-item :label="$t('预付')" prop="needPay" v-if="$route.query.action == 'batchUpdate'" >
<el-radio :label="0">{{$t('均可')}}</el-radio> <el-radio-group v-model="form.needPay">
</el-radio-group> <el-radio :label="1">{{$t('预付')}}</el-radio>
</el-form-item> <el-radio :label="0">{{$t('均可')}}</el-radio>
<el-form-item :label="$t('单价模式')" prop="priceType"> </el-radio-group>
<dict-selector :type="DICT_TYPE.ECW_PRICE_TYPE" v-model="form.priceType" form-type="radio" formatter="number" defaultable2 />
</el-form-item>
<!--阶梯定价-->
<template v-if="form.stepPrice==1" >
<div v-for="(item, index) in form.priceStepList" :key="index">
<div style="font-size:14px; margin:10px 0">
{{$t('第{index}阶梯定价方案', {index: index+1})}}
<template v-if="index == form.priceStepList.length - 1">
<el-link type="primary" @click.native="form.priceStepList.push({})">{{$t('添加区间')}}</el-link>
<el-divider direction="vertical"></el-divider>
<el-link type="danger" @click.native="form.priceStepList.splice(index, 1)">{{$t('删除')}}</el-link>
</template>
</div>
<el-form-item :label="$t('第{index}阶梯', {index: index + 1})">
<el-input v-model="item.startNum" type="number" placeholder="" class="w-100"></el-input>
-
<el-input v-model="item.endNum" type="number" placeholder="" class="w-100"></el-input>
/
<selector :disabled="index > 0" @input="syncAllUnit" v-model="item.weightUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable class="w-100" />
</el-form-item> </el-form-item>
<el-form-item :label="$t('默认运费')" v-if="form.priceType != 1" :prop="`priceStepList.${index}.transportPrice`" :rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}"> <el-form-item :label="$t('单价模式')" prop="priceType">
<inputor default2="0" v-model.number="item.transportPrice" type="number" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10"/> <dict-selector :type="DICT_TYPE.ECW_PRICE_TYPE" v-model="form.priceType" form-type="radio" formatter="number" defaultable2 />
<selector :disabled="index > 0" @input="syncAllUnit" v-model="item.transportPriceUnit" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable class="w-100" />
/ <selector :disabled="index > 0" @input="syncAllUnit" v-model="item.transportVolumeUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable class="w-100" />
</el-form-item> </el-form-item>
<el-form-item :label="$t('默认清关费')" v-if="form.priceType != 1" :prop="`priceStepList.${index}.transportPrice`" :rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}"> <!--阶梯定价-->
<inputor default2="0" v-model.number="item.clearancePrice" type="number" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10" :rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}"/> <template v-if="form.stepPrice==1" >
<selector :disabled="index > 0" @input="syncAllUnit" v-model="item.clearancePriceUnit" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable class="w-100" /> <div v-for="(item, index) in form.priceStepList" :key="index">
/ <selector disabled @input="syncAllUnit" v-model="item.clearanceVolumeUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable class="w-100" /> <div style="font-size:14px; margin:10px 0">
</el-form-item> {{$t('第{index}阶梯定价方案', {index: index+1})}}
<template v-if="index == form.priceStepList.length - 1">
<el-form-item <el-link type="primary" @click.native="form.priceStepList.push({})">{{$t('添加区间')}}</el-link>
:label="$t('默认全包价')" <el-divider direction="vertical"></el-divider>
v-if="form.priceType == 1" <el-link type="danger" @click.native="form.priceStepList.splice(index, 1)">{{$t('删除')}}</el-link>
:prop="`priceStepList.${index}.allPrice`" </template>
:rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}" </div>
<el-form-item :label="$t('第{index}阶梯', {index: index + 1})">
<el-input v-model="item.startNum" type="number" placeholder="" class="w-100"></el-input>
-
<el-input v-model="item.endNum" type="number" placeholder="" class="w-100"></el-input>
/
<selector :disabled="index > 0" @input="syncAllUnit" v-model="item.weightUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable class="w-100" />
</el-form-item>
<el-form-item :label="$t('默认运费')" v-if="form.priceType != 1" :prop="`priceStepList.${index}.transportPrice`" :rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}">
<inputor default2="0" v-model.number="item.transportPrice" type="number" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10"/>
<selector :disabled="index > 0" @input="syncAllUnit" v-model="item.transportPriceUnit" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable class="w-100" />
/ <selector :disabled="index > 0" @input="syncAllUnit" v-model="item.transportVolumeUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable class="w-100" />
</el-form-item>
<el-form-item :label="$t('默认清关费')" v-if="form.priceType != 1 && type != 'air'" :prop="`priceStepList.${index}.transportPrice`" :rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}">
<inputor default2="0" v-model.number="item.clearancePrice" type="number" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10" :rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}"/>
<selector :disabled="index > 0" @input="syncAllUnit" v-model="item.clearancePriceUnit" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable class="w-100" />
/ <selector disabled @input="syncAllUnit" v-model="item.clearanceVolumeUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable class="w-100" />
</el-form-item>
<el-form-item
:label="$t('默认全包价')"
v-if="form.priceType == 1"
:prop="`priceStepList.${index}.allPrice`"
:rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}"
>
<selector :disabled="index > 0" @input="syncAllUnit" v-model="item.allPriceUnit" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable class="w-100" />
<inputor default2="0" v-model.number="item.allPrice" type="number" :placeholder="$t('整数或者两位小数')" class="w-100 ml-10" :rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}"/>
/ <selector :disabled="index > 0" @input="syncAllUnit" v-model="item.allVolumeUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable class="w-100" />
</el-form-item>
</div>
</template>
<template v-else>
<el-form-item
:label="$t('最小起计量')"
:prop="`minWeight`"
> >
<selector :disabled="index > 0" @input="syncAllUnit" v-model="item.allPriceUnit" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable class="w-100" /> <inputor default2="0" v-model.number="form.minWeight" type="number" class="w-100" :rules="{validator: priceValidator, trigger: 'blur', message: '数量错误'}"/>
<inputor default2="0" v-model.number="item.allPrice" type="number" :placeholder="$t('整数或者两位小数')" class="w-100 ml-10" :rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}"/> / <selector v-model="form.minWeightUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" disabled />
/ <selector :disabled="index > 0" @input="syncAllUnit" v-model="item.allVolumeUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable class="w-100" /> </el-form-item>
</el-form-item>
</div>
</template>
<template v-else>
<el-form-item
:label="$t('最小起计量')"
:prop="`minWeight`"
>
<inputor default2="0" v-model.number="form.minWeight" type="number" class="w-100" :rules="{validator: priceValidator, trigger: 'blur', message: '数量错误'}"/>
/ <selector v-model="form.minWeightUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" disabled />
</el-form-item>
<el-form-item :label="$t('默认全包价')" v-if="form.priceType == 1" prop="allPrice" :rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}"> <el-form-item :label="$t('默认全包价')" v-if="form.priceType == 1" prop="allPrice" :rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}">
<selector test="allPriceUnit" v-model="form.allPriceUnit" :options="currencyList" :label-field="$l('title')" value-field="id" defaultable2 class="w-100 mr-10 aaa" /> <selector test="allPriceUnit" v-model="form.allPriceUnit" :options="currencyList" :label-field="$l('title')" value-field="id" defaultable2 class="w-100 mr-10 aaa" />
<inputor default2="0" v-model.number="form.allPrice" type="number" :placeholder="$t('整数或者两位小数')" class="w-100 mr10" /> <inputor default2="0" v-model.number="form.allPrice" type="number" :placeholder="$t('整数或者两位小数')" class="w-100 mr10" />
<span class="mr-10">/</span>
<selector v-model="form.allVolumeUnit" :options="unitList" :label-field="$l('title')" value-field="id" defaultable2 class="w-100" />
</el-form-item>
<template v-else>
<el-form-item :label="$t('默认运费')" prop="transportPrice" :rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}">
<selector v-model="form.transportPriceUnit" :options="currencyList" :label-field="$l('title')" value-field="id" defaultable2 class="w-100 mr-10" />
<inputor default2="0" v-model.number="form.transportPrice" type="number" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10" />
<span class="mr-10">/</span>
<selector v-model="form.transportVolumeUnit" :options="unitList" :label-field="$l('title')" value-field="id" defaultable2 class="w-100" />
</el-form-item>
<el-form-item :label="$t('默认清关费')" prop="clearancePrice" :rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}">
<selector v-model="form.clearancePriceUnit" :options="currencyList" :label-field="$l('title')" value-field="id" defaultable2 class="w-100 mr-10" />
<inputor default2="0" v-model.number="form.clearancePrice" type="number" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10" />
<span class="mr-10">/</span> <span class="mr-10">/</span>
<selector disabled v-model="form.clearanceVolumeUnit" :options="unitList" :label-field="$l('title')" value-field="id" defaultable2 class="w-100" /> <selector v-model="form.allVolumeUnit" :options="unitList" :label-field="$l('title')" value-field="id" defaultable2 class="w-100" />
</el-form-item> </el-form-item>
</template> <template v-else>
<el-form-item :label="$t('默认运费')" prop="transportPrice" :rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}">
<selector v-model="form.transportPriceUnit" :options="currencyList" :label-field="$l('title')" value-field="id" defaultable2 class="w-100 mr-10" />
<inputor default2="0" v-model.number="form.transportPrice" type="number" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10" />
<span class="mr-10">/</span>
<selector v-model="form.transportVolumeUnit" :options="unitList" :label-field="$l('title')" value-field="id" defaultable2 class="w-100" />
</el-form-item>
<el-form-item v-if="type != 'air'" :label="$t('默认清关费')" prop="clearancePrice" :rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}">
<selector v-model="form.clearancePriceUnit" :options="currencyList" :label-field="$l('title')" value-field="id" defaultable2 class="w-100 mr-10" />
<inputor default2="0" v-model.number="form.clearancePrice" type="number" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10" />
<span class="mr-10">/</span>
<selector disabled v-model="form.clearanceVolumeUnit" :options="unitList" :label-field="$l('title')" value-field="id" defaultable2 class="w-100" />
</el-form-item>
</template>
</template> </template>
<!--特需--> <!--特需-->
<template v-if="form.priceType==1"> <template v-if="form.priceType==1">
<el-form-item <el-form-item
v-for="(special, specialIndex) in this.form.specialList" v-for="(special, specialIndex) in this.form.specialList"
:label="getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + $t('全包价')" :label="getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + $t('全包价')"
:key="specialIndex + 'transport'" :key="specialIndex + 'transport'"
:prop="`specialList.${specialIndex}`.allPrice" :prop="`specialList.${specialIndex}`.allPrice"
:rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}" :rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}"
> >
<selector disabled v-model="special.allPriceUnit" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable2 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" />
<inputor default2="0" v-model.number="special.allPrice" type="number" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10" /> <inputor default2="0" v-model.number="special.allPrice" type="number" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10" />
<span class="mr-10">/</span> <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" /> <selector disabled v-model="special.allVolumeUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
</el-form-item> </el-form-item>
</template> </template>
<template v-else v-for="(special, specialIndex) in this.form.specialList"> <template v-else v-for="(special, specialIndex) in this.form.specialList">
<el-form-item <el-form-item
:label="getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + $t('运费')" :label="getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + $t('运费')"
:key="specialIndex + 'transport'" :key="specialIndex + 'transport'"
:prop="`specialList.${specialIndex}.transportPrice`" :prop="`specialList.${specialIndex}.transportPrice`"
:rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}" :rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}"
> >
<selector disabled v-model="special.transportPriceUnit" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable2 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" />
<inputor default2="0" v-model.number="special.transportPrice" type="number" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10" /> <inputor default2="0" v-model.number="special.transportPrice" type="number" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10" />
<span class="mr-10">/</span> <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" /> <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>
<el-form-item <el-form-item
:label="getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + $t('清关费')" v-if="type != 'air'"
:key="specialIndex + 'clearance'" :label="getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + $t('清关费')"
:prop="`specialList.${specialIndex}.clearancePrice`" :key="specialIndex + 'clearance'"
:rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}" :prop="`specialList.${specialIndex}.clearancePrice`"
> :rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}"
<selector disabled v-model="special.clearancePriceUnit" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100 mr-10" /> >
<inputor default2="0" v-model.number="special.clearancePrice" type="number" :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> <inputor default2="0" v-model.number="special.clearancePrice" type="number" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10" />
<selector disabled v-model="special.clearanceVolumeUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" /> <span class="mr-10">/</span>
</el-form-item> <selector disabled v-model="special.clearanceVolumeUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
</template> </el-form-item>
</template>
<el-form-item :label="$t('价格有效期')">
<el-form-item :label="$t('价格有效期')"> <el-date-picker v-model="form.validateStartDate" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
<el-date-picker v-model="form.validateStartDate" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker> -
- <el-date-picker v-model="form.validateEndDate" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
<el-date-picker v-model="form.validateEndDate" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker> </el-form-item>
</el-form-item> </el-col>
<el-col :span="12">
<h2>{{$t('快捷设置')}}</h2>
<div class="flex items-center">
{{$t('批量加价')}}+
<el-input v-model="quickForm.plus" class="w-100 ml-10 mr-10" :disabled="!!quickForm.minus"></el-input>
<selector disabled v-model="currencyAndUnit.currency" :options="currencyList" :label-field="$l('title')" value-field="id" class="w-100" />
/ <selector disabled v-model="currencyAndUnit.unit" :options="unitList" :label-field="$l('title')" value-field="id" class="w-100" />
<div class="ml-10">{{$t('*针对所有价格加价')}}</div>
</div>
<div class="flex items-center mt-10">
{{$t('批量减价')}} -
<el-input v-model="quickForm.minus" class="w-100 ml-10 mr-10" :disabled="!!quickForm.plus"></el-input>
<selector disabled v-model="currencyAndUnit.currency" :options="currencyList" :label-field="$l('title')" value-field="id" class="w-100" />
/ <selector disabled v-model="currencyAndUnit.unit" :options="unitList" :label-field="$l('title')" value-field="id" class="w-100" />
<div class="ml-10">{{$t('*针对所有价格加价')}}</div>
</div>
<div class="mt-10">
<el-button @click="quickSet" type="primary" :disabled="!quickForm.plus && !quickForm.minus">{{$t('确定')}}</el-button>
</div>
</el-col>
</el-row>
</el-card> </el-card>
...@@ -212,16 +236,23 @@ ...@@ -212,16 +236,23 @@
<el-radio v-model.number="form.needBook" :label="0">{{$t('')}}</el-radio> <el-radio v-model.number="form.needBook" :label="0">{{$t('')}}</el-radio>
</el-form-item> </el-form-item>
<el-form-item :label="$t('每日入仓上限')" prop="dayLimit" v-if="form.needBook == 1"> <!--空运不显示这几个字段-->
<el-input v-model.number="form.dayLimit" type="number" class="w-100" />{{$t('立方米')}} <template v-if="type != 'air'">
</el-form-item> <el-form-item :label="$t('每日入仓上限')" prop="dayLimit" v-if="form.needBook == 1">
<el-input v-model.number="form.dayLimit" type="number" class="w-100" />{{$t('立方米')}}
</el-form-item>
<el-form-item :label="$t('货柜位置')" prop="containerLocation"> <el-form-item :label="$t('货柜位置')" prop="containerLocation">
<dict-selector :type="DICT_TYPE.ECW_CONTAINER_LOCATION" v-model="form.containerLocation" /> <dict-selector :type="DICT_TYPE.ECW_CONTAINER_LOCATION" v-model="form.containerLocation" />
</el-form-item> </el-form-item>
<el-form-item :label="$t('订单方数上限')" prop="square">
<el-input v-model.number="form.square" type="number" style="width:200px" />
</el-form-item>
</template>
<el-form-item :label="$t('订单方数上限')" prop="square"> <el-form-item :label="$t('是否単询')" prop="inquiry">
<el-input v-model.number="form.square" type="number" style="width:200px" /> <dict-selector :type="DICT_TYPE.NEED_ORDER_INQUIRY" v-model="form.needOrderInquiry" form-type="radio"></dict-selector>
</el-form-item> </el-form-item>
</el-card> </el-card>
</el-form> </el-form>
...@@ -331,6 +362,7 @@ import Selector from '@/components/Selector' ...@@ -331,6 +362,7 @@ import Selector from '@/components/Selector'
import Inputor from '@/components/Inputor' import Inputor from '@/components/Inputor'
import {parseTime} from '@/utils/ruoyi' import {parseTime} from '@/utils/ruoyi'
import {openedRouterList} from '@/api/ecw/warehouse' import {openedRouterList} from '@/api/ecw/warehouse'
import Decimal from "decimal.js";
export default { export default {
components: { RoutersSelector, ProductSelector, Selector, Inputor }, components: { RoutersSelector, ProductSelector, Selector, Inputor },
filters: {parseTime}, filters: {parseTime},
...@@ -363,7 +395,9 @@ export default { ...@@ -363,7 +395,9 @@ export default {
lineList: [], //路线数组 lineList: [], //路线数组
loading: false, loading: false,
showLogsDialog: false, // 显示价格日志弹层 showLogsDialog: false, // 显示价格日志弹层
logs: [] logs: [],
// 批量加价/减价
quickForm:{} // 快速加价/减价表单
} }
}, },
computed: { computed: {
...@@ -383,7 +417,27 @@ export default { ...@@ -383,7 +417,27 @@ export default {
map[item.id] = this.$l(item, 'title') map[item.id] = this.$l(item, 'title')
}) })
return map return map
} },
// 默认运费的货币和体积单位
currencyAndUnit(){
let currency = null, unit = null, fields = null
// 如果是阶梯价格则取第一阶梯,否则就取form中的字段
let obj = this.form.stepPrice == 1 ? this.form.priceStepList[0] : this.form
// 全包价
if(this.form.priceType == 1){
currency = obj.allPriceUnit
unit = obj.allVolumeUnit
}else{
currency = obj.transportPriceUnit
unit = obj.transportVolumeUnit
}
return {currency, unit}
},
// 类型,默认海运sea,air表示空运
type(){
return this.$route.path.split(/[-_]/).pop()
},
}, },
watch: { watch: {
...@@ -464,14 +518,6 @@ export default { ...@@ -464,14 +518,6 @@ export default {
}, },
'form.stepPrice'(stepPrice){ 'form.stepPrice'(stepPrice){
if(stepPrice == 1 && (!this.form.priceStepList || !this.form.priceStepList.length)){ if(stepPrice == 1 && (!this.form.priceStepList || !this.form.priceStepList.length)){
/* let def = {
weightUnit: this.unitList[0].id,
allPriceUnit: this.currencyList[0].id,
transportPriceUnit: this.currencyList[0].id,
transportVolumeUnit: this.unitList[0].id,
clearancePriceUnit: this.currencyList[0].id,
clearanceVolumeUnit: this.unitList[0].id,
} */
this.$set(this.form, 'priceStepList', [{},{}]) this.$set(this.form, 'priceStepList', [{},{}])
} }
this.syncAllUnit() this.syncAllUnit()
...@@ -551,7 +597,8 @@ export default { ...@@ -551,7 +597,8 @@ export default {
if(!this.$route.query.action){ if(!this.$route.query.action){
this.form = { this.form = {
priceType: 0, priceType: 0,
stepPrice: 0, // 空运则默认是阶梯价格
stepPrice: this.type == 'air' ? 1 : 0,
advanceStatus: 0, advanceStatus: 0,
needBook: 0, needBook: 0,
specialList: [], specialList: [],
...@@ -617,7 +664,6 @@ export default { ...@@ -617,7 +664,6 @@ export default {
}) })
}) })
} */ } */
console.log(this.getDictDatas(this.DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS))
this.getDictDatas(this.DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS).forEach(item => { this.getDictDatas(this.DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS).forEach(item => {
if(!this.form.specialList.find(special => special.specialDictType == item.value)){ if(!this.form.specialList.find(special => special.specialDictType == item.value)){
this.form.specialList.push({ this.form.specialList.push({
...@@ -812,6 +858,14 @@ export default { ...@@ -812,6 +858,14 @@ export default {
data.productId = this.product.id; data.productId = this.product.id;
data.lineChannelList = this.lineList.length ? this.lineList : this.selectedRoutes data.lineChannelList = this.lineList.length ? this.lineList : this.selectedRoutes
// 空运且不是全包价的清关费用0填充
if(this.type == 'air' && this.form.priceType == 0){
// 根据是否全包价确定字段
data.priceStepList.forEach(item => {
item.clearancePrice = item.clearancePrice || 0
})
}
this.loading = true this.loading = true
createProductPrice(data).then(response => { createProductPrice(data).then(response => {
this.$modal.msgSuccess(this.$t("请求成功")); this.$modal.msgSuccess(this.$t("请求成功"));
...@@ -829,6 +883,17 @@ export default { ...@@ -829,6 +883,17 @@ export default {
item.detail = JSON.parse(item.content) item.detail = JSON.parse(item.content)
}) })
}) })
},
// 快捷设置,只更新默认运费
quickSet(){
// 字段,根据是否全包价来取
let field = this.form.priceType == 1 ? 'allPrice' : 'transportPrice'
// 取得要加的数额(减少则是负数)
let amount = Decimal(this.quickForm.plus || -this.quickForm.minus)
this.form.priceStepList.forEach(item => {
// 加上对应的价格,但是不能小于0
this.$set(item, field, Math.max(0, Decimal(item[field] || 0).plus(amount).toNumber()))
})
} }
} }
} }
......
...@@ -54,7 +54,8 @@ ...@@ -54,7 +54,8 @@
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<!--全部路线吗没有新增入口,指定商品的路线价格才有添加路线--> <!--全部路线吗没有新增入口,指定商品的路线价格才有添加路线-->
<el-col :span="1.5" v-if="$route.query.product_id"> <el-col :span="1.5" v-if="$route.query.product_id">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['ecw:product-price:create']">{{$t('新建价格')}}</el-button> <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd('air')" v-hasPermi="['ecw:product-price:create']">{{$t('新建空运价格')}}</el-button>
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd('sea')" v-hasPermi="['ecw:product-price:create']">{{$t('新建海运价格')}}</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<!--未指定商品--> <!--未指定商品-->
...@@ -150,8 +151,19 @@ ...@@ -150,8 +151,19 @@
{{$t('运费')}}:{{ getCurrencySymbol(scope.row.priceStepList[0].transportPriceUnit) + scope.row.priceStepList[0].transportPrice}}&nbsp; {{$t('运费')}}:{{ getCurrencySymbol(scope.row.priceStepList[0].transportPriceUnit) + scope.row.priceStepList[0].transportPrice}}&nbsp;
{{ getCurrencyTitle(scope.row.priceStepList[0].transportPriceUnit) + '/' + getUnitTitle(scope.row.priceStepList[0].transportVolumeUnit)}} {{ getCurrencyTitle(scope.row.priceStepList[0].transportPriceUnit) + '/' + getUnitTitle(scope.row.priceStepList[0].transportVolumeUnit)}}
<br /> <br />
{{$t('清关费')}}:{{ getCurrencySymbol(scope.row.priceStepList[0].clearancePriceUnit) + scope.row.priceStepList[0].clearancePrice}}&nbsp; <template v-if="[3,4].indexOf(+scope.row.warehouseLineDO.transportType) > -1">
{{ getCurrencyTitle(scope.row.priceStepList[0].clearancePriceUnit) + '/' + getUnitTitle(scope.row.priceStepList[0].clearanceVolumeUnit)}} <!--空运的清关费-->
<template v-if="scope.row.clearPriceStepList.length">
{{$t('清关费')}}:{{ getCurrencySymbol(scope.row.clearPriceStepList[0].clearancePriceUnit) + scope.row.clearPriceStepList[0].clearancePrice}}&nbsp;
{{ getCurrencyTitle(scope.row.clearPriceStepList[0].clearancePriceUnit) + '/' + getUnitTitle(scope.row.clearPriceStepList[0].clearanceVolumeUnit)}}
</template>
<template v-else>{{$t('暂无清关费设置')}}</template>
</template>
<template v-else>
<!--海运的清关费-->
{{$t('清关费')}}:{{ getCurrencySymbol(scope.row.priceStepList[0].clearancePriceUnit) + scope.row.priceStepList[0].clearancePrice}}&nbsp;
{{ getCurrencyTitle(scope.row.priceStepList[0].clearancePriceUnit) + '/' + getUnitTitle(scope.row.priceStepList[0].clearanceVolumeUnit)}}
</template>
</div> </div>
<div v-if="scope.row.priceType == 1"> <div v-if="scope.row.priceType == 1">
{{$t('全包价')}}:{{ getCurrencySymbol(scope.row.priceStepList[0].allPriceUnit) + scope.row.priceStepList[0].allPrice}}&nbsp; {{$t('全包价')}}:{{ getCurrencySymbol(scope.row.priceStepList[0].allPriceUnit) + scope.row.priceStepList[0].allPrice}}&nbsp;
...@@ -348,7 +360,8 @@ export default { ...@@ -348,7 +360,8 @@ export default {
computed: { computed: {
// 路径中的运输方式参数 // 路径中的运输方式参数
transportType() { transportType() {
return this.$route.path.split('-').pop(); // product-price-1_2的格式,如果没有三段则最后一段不是运输方式
return this.$route.path.split('-')[2] || '';
}, },
// 路由中的标题 // 路由中的标题
routeName(){ routeName(){
...@@ -505,9 +518,11 @@ export default { ...@@ -505,9 +518,11 @@ export default {
this.product = res.data this.product = res.data
}) })
}else{ }else{
// 如果指定了单个的运输方式则赋值 if(this.transportType) {
if(this.transportType.split('_').length == 1){ // 如果指定了单个的运输方式则赋值
this.$set(this.queryParams, 'transportType', +this.transportType) if (this.transportType.split('_').length == 1) {
this.$set(this.queryParams, 'transportType', +this.transportType)
}
} }
this.getAttrList(); this.getAttrList();
} }
...@@ -576,9 +591,9 @@ export default { ...@@ -576,9 +591,9 @@ export default {
}) })
}, },
handleSelectionChange(val) { /*handleSelectionChange(val) {
this.lineList = val; this.lineList = val;
}, },*/
/**运输线路改变 */ /**运输线路改变 */
transportTypeChange(newVal) { transportTypeChange(newVal) {
...@@ -658,8 +673,8 @@ export default { ...@@ -658,8 +673,8 @@ export default {
this.handleQuery(); this.handleQuery();
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd(type) {
return this.$router.push('../../lineProject/product-price/edit?' + (new URLSearchParams(this.$route.query)).toString()) return this.$router.push(`../../lineProject/product-price/edit-${type}?` + (new URLSearchParams(this.$route.query)).toString())
}, },
// 批量修改单个商品的价格(一条或者多条,后者全部路线) // 批量修改单个商品的价格(一条或者多条,后者全部路线)
...@@ -672,7 +687,9 @@ export default { ...@@ -672,7 +687,9 @@ export default {
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row, readonly) { handleUpdate(row, readonly) {
let url = '../../lineProject/product-price/edit?action=update&id=' + row.id let transportType = row.warehouseLineDO.transportType
let type = transportType == 3 || transportType == 4 ? 'air' : 'sea'
let url = `../../lineProject/product-price/edit-${type}?action=update&id=${row.id}`
if(readonly)url += '&readonly=1' if(readonly)url += '&readonly=1'
return this.$router.push(url) return this.$router.push(url)
}, },
...@@ -712,7 +729,7 @@ export default { ...@@ -712,7 +729,7 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { /*submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (!valid) { if (!valid) {
return; return;
...@@ -747,7 +764,7 @@ export default { ...@@ -747,7 +764,7 @@ export default {
this.getList(); this.getList();
}); });
}); });
}, },*/
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const id = row.id; const id = row.id;
...@@ -805,7 +822,8 @@ export default { ...@@ -805,7 +822,8 @@ export default {
}, },
// 复制模板 // 复制模板
copyTemplate(row){ copyTemplate(row){
this.$alert('// TODO') // 跳转到批量设置页面,并填充数据
this.$router.push(`../../lineProject/batch-edit-${row.transportType == 3 || row.transportType == 4 ? 'air' : 'sea'}?templateId=${row.id}`)
} }
} }
......
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