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

路线价格特需价格负数校验,订单带出客户地址等

parent 2831f0bd
......@@ -76,7 +76,8 @@
"vuedraggable": "2.24.3",
"vuex": "3.6.0",
"xlsx": "^0.18.5",
"xml-js": "^1.6.11"
"xml-js": "^1.6.11",
"@vue/runtime-dom": "latest"
},
"devDependencies": {
"@vue/cli-plugin-babel": "4.4.6",
......
......@@ -50,7 +50,7 @@ export default {
padding: 50px;
text-align: center;
}
$sizes: 0, 10,20,30,50,100,150,200,500,800,1000;
$sizes: 0, 10,20,30,50,100,150,200,300,500,800,1000;
@for $i from 1 through length($sizes){
$item: nth($sizes, $i);
.ml-#{$item}{
......
......@@ -14,7 +14,7 @@
</div>
<div class="line">
<div class="label">电话:</div>
<div class="value">{{item.areaCode}} {{item.phoneNew}}</div>
<div class="value">+{{item.areaCode}} {{item.phoneNew}}</div>
</div>
<div class="line">
<div class="label">邮箱:</div>
......
......@@ -212,7 +212,7 @@
prop="brand"
v-if="form.type != 1"
>
<dict-selector form-type="checkbox" :type="DICT_TYPE.BRAND_REG_TYPE" v-model="form.brandArr" multiple />
<dict-selector form-type="checkbox" :type="DICT_TYPE.BOX_SHIPPING_BRAND_TYPE" v-model="form.brandArr" multiple />
</el-form-item>
<el-form-item
:label="$t('是否控货')"
......
......@@ -770,7 +770,7 @@ export default {
"position": "",
"social": undefined,
"socialNumber": "",
"userid": [],
"userid": undefined,
// "username": ""
})
},
......
......@@ -363,8 +363,9 @@
:disabled="false"
></area-selector>
</el-form-item>
<br/>
<el-form-item :label="$t('收货详细地址')" prop="consigneeAddress">
<el-input v-model="form.consigneeAddress" :disabled="false"></el-input>
<el-input v-model="form.consigneeAddress" :disabled="false" class="w-300"></el-input>
</el-form-item>
</div>
<div>
......@@ -517,6 +518,7 @@ import {calculationPrice} from '@/api/ecw/product'
import SupplierSelector from '@/components/SupplierSelector'
import Decimal from 'decimal.js'
import WorkFlow from '@/components/WorkFlow'
import { getCustomer } from "@/api/ecw/customer";
// 缓存默认的表单数据
let defaultFormData = null
......@@ -793,6 +795,16 @@ export default {
this.$set(this.form, 'externalWarehouseDtoList', [{}])
}
},
// 选择送货上门需要查询并填充默认地址
'form.harvestMethod'(harvestMethod){
if(harvestMethod == 2 && !this.form.address && this.form.consigneeId){
getCustomer(this.form.consigneeId).then(res => {
if(res.data.address){
this.$set(this.form, 'consigneeAddress', res.data.address)
}
})
}
},
/* 'form.orderItemVOList'(){
console.log('form.orderItemVOList', this.form.orderItemVOList.length, this.form.orderItemVOList)
}, */
......
......@@ -256,10 +256,10 @@
</el-dropdown-menu>
</el-dropdown>
<el-divider direction="vertical"></el-divider>
<el-divider direction="vertical" v-if="scope.row.status != 0"></el-divider>
<!--仓库相关的-->
<el-dropdown>
<el-dropdown v-if="scope.row.status != 0">
<el-button type="text">{{$t('仓库')}}</el-button>
<el-dropdown-menu slot="dropdown">
<!-- 入仓操作 -->
......@@ -325,10 +325,10 @@
</el-dropdown-menu>
</el-dropdown>
<el-divider direction="vertical"></el-divider>
<el-divider direction="vertical" v-if="scope.row.status != 0"></el-divider>
<!--打印相关的-->
<el-dropdown>
<el-dropdown v-if="scope.row.status != 0">
<el-button type="text">{{$t('打印')}}</el-button>
<el-dropdown-menu slot="dropdown">
<!-- 打印标签 -->
......
......@@ -69,8 +69,8 @@
</div>
<el-form-item :label="$t('预付')" prop="needPay" v-if="$route.query.action == 'batchUpdate'" >
<el-radio-group v-model="form.needPay">
<el-radio :label="1">预付</el-radio>
<el-radio :label="0">均可</el-radio>
<el-radio :label="1">{{$t('预付')}}</el-radio>
<el-radio :label="0">{{$t('均可')}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('单价模式')" prop="priceType">
......@@ -78,13 +78,13 @@
</el-form-item>
<!--阶梯定价-->
<template v-if="form.stepPrice==1" >
<div v-for="(item, index) in priceStepList" :key="index">
<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 == priceStepList.length - 1">
<el-link type="primary" @click.native="priceStepList.push({})">{{$t('添加区间')}}</el-link>
<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="priceStepList.splice(index, 1)">{{$t('删除')}}</el-link>
<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})">
......@@ -94,40 +94,45 @@
/
<selector v-model="form.weightUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
</el-form-item>
<el-form-item :label="$t('默认运费')" v-if="form.priceType != 1">
<inputor default2="0" v-model.number="item.transportPrice" type="number" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10" />
<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 v-model="item.transportPriceUnit" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
/ <selector v-model="item.transportVolumeUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
</el-form-item>
<el-form-item :label="$t('默认清关费')" v-if="form.priceType != 1">
<inputor default2="0" v-model.number="item.clearancePrice" type="number" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10" />
<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: '价格错误'}"/>
<selector v-model="item.clearancePriceUnit" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
/ <selector v-model="item.clearanceVolumeUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
</el-form-item>
<el-form-item :label="$t('默认全包价')" v-if="form.priceType == 1">
<el-form-item
:label="$t('默认全包价')"
v-if="form.priceType == 1"
:prop="`priceStepList.${index}.allPrice`"
:rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}"
>
<selector v-model="item.allPriceUnit" :options="currencyList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
<inputor default2="0" v-model.number="item.allPrice" type="number" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10" />
<inputor default2="0" v-model.number="item.allPrice" type="number" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10" :rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}"/>
/ <selector v-model="item.allVolumeUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
</el-form-item>
</div>
</template>
<template v-else>
<el-form-item :label="$t('默认全包价')" v-if="form.priceType == 1">
<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" />
<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">
<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">
<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>
......@@ -135,23 +140,28 @@
</el-form-item>
</template>
<!--特需-->
<template v-if="form.priceType==1">
<el-form-item
v-for="(special, specialIndex) in this.specialProducts"
v-for="(special, specialIndex) in this.form.specialList"
:label="getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + $t('全包价')"
:key="specialIndex + 'transport'">
:key="specialIndex + 'transport'"
:prop="`specialList.${specialIndex}`.allPrice"
:rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}"
>
<selector 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" />
<span class="mr-10">/</span>
<selector v-model="special.allVolumeUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
</el-form-item>
</template>
<template v-else v-for="(special, specialIndex) in this.specialProducts">
<template v-else v-for="(special, specialIndex) in this.form.specialList">
<el-form-item
:label="getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + $t('运费')"
:key="specialIndex + 'transport'">
:key="specialIndex + 'transport'"
:prop="`specialList.${specialIndex}.transportPrice`"
:rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}"
>
<selector 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" />
<span class="mr-10">/</span>
......@@ -159,7 +169,10 @@
</el-form-item>
<el-form-item
:label="getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + $t('清关费')"
:key="specialIndex + 'clearance'">
:key="specialIndex + 'clearance'"
:prop="`specialList.${specialIndex}.clearancePrice`"
:rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}"
>
<selector 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" />
<span class="mr-10">/</span>
......@@ -223,11 +236,14 @@ export default {
return {
checkList: [],
selectedRoutes: [], // 勾选的路线渠道
form: {},
form: {
priceStepList: [{},{}], // 阶梯价格
specialList: []
},
needPay: false, // 是否需要预付
stepPrice: false, // 是否阶梯订单
specialProducts: [],
priceStepList: [{},{}], // 阶梯价格
// specialProducts: [],
// priceStepList: [{},{}], // 阶梯价格
// specialList:[], // 特殊需求,默认四个
rules: {
transportPrice: [{ required: true, message: this.$t("海运费不能为空"), trigger: "blur" }],
......@@ -277,20 +293,9 @@ export default {
// 特殊需求回显
if (val.specialList) {
val.specialList.forEach(item => {
let index = this.specialProducts.findIndex(special => special.specialDictType == item.specialDictType)
if(index > -1)this.specialProducts[index] = item
let index = this.form.specialList.findIndex(special => special.specialDictType == item.specialDictType)
if(index > -1)this.form.specialList[index] = item
})
// this.specialProducts = val.specialList
/* let keyed = arrryToKeyedObjectBy(val.specialList, 'specialDictType')
this.specialProducts.map((item, index) => {
if (keyed[item.specialDictType]) {
for (let field in item) {
if (keyed[item.specialDictType][field]) {
item[field] = keyed[item.specialDictType][field]
}
}
}
}) */
}
},
'form.priceType'(priceType){
......@@ -300,32 +305,32 @@ export default {
}
},
'form.transportVolumeUnit'(val){
this.specialProducts.forEach(item => {
this.form.specialList.forEach(item => {
item.transportVolumeUnit = val
})
},
'form.clearanceVolumeUnit'(val){
this.specialProducts.forEach(item => {
this.form.specialList.forEach(item => {
item.clearanceVolumeUnit = val
})
},
'form.transportPriceUnit'(val){
this.specialProducts.forEach(item => {
this.form.specialList.forEach(item => {
item.transportPriceUnit = val
})
},
'form.clearancePriceUnit'(val){
this.specialProducts.forEach(item => {
this.form.specialList.forEach(item => {
item.clearancePriceUnit = val
})
},
'form.allPriceUnit'(val){
this.specialProducts.forEach(item => {
this.form.specialList.forEach(item => {
item.allPriceUnit = val
})
},
'form.allVolumeUnit'(val){
this.specialProducts.forEach(item => {
this.form.specialList.forEach(item => {
item.allVolumeUnit = val
})
},
......@@ -333,6 +338,11 @@ export default {
if(val) this.$set(this.form, 'dayLimit', 10000)
else delete this.form.dayLimit
},
'form.stepPrice'(stepPrice){
if(stepPrice == 1 && (!this.form.priceStepList || !this.form.priceStepList.length)){
this.$set(this.form, 'priceStepList', [{},{}])
}
},
needPay(val){
this.$set(this.form, 'needPay', val ? 1 : 0)
},
......@@ -362,19 +372,18 @@ export default {
// action=batchUpdate 表示批量修改单个商品的价格(一条或者多条),如果没有ids显示路线选择组件,否则不显示路线组件
// action=update 表示修改单个商品的单条路线价格,需要回显
if(this.$route.query.action == 'update'){
getProductPrice(this.$route.query.id).then(res => {
this.$set(this, 'form', res.data)
if(this.form.needPay){
this.needPay = true
}
if(res.data.validateStartDate){
this.form.validateStartDate = parseTime(res.data.validateStartDate)
}
if(res.data.validateEndDate){
this.form.validateEndDate = parseTime(res.data.validateEndDate)
}
this.lineList = [res.data]
})
let res = await getProductPrice(this.$route.query.id)
this.$set(this, 'form', res.data)
if(this.form.needPay){
this.needPay = true
}
if(res.data.validateStartDate){
this.form.validateStartDate = parseTime(res.data.validateStartDate)
}
if(res.data.validateEndDate){
this.form.validateEndDate = parseTime(res.data.validateEndDate)
}
this.lineList = [res.data]
}
// action=batchUpdate且ids不为空
......@@ -434,8 +443,11 @@ export default {
getCurrencyList().then(res => this.currencyList = res.data)
getUnitList().then(res => this.unitList = res.data)
if(!this.form.specialList){
this.$set(this.form, 'specialList', [])
}
this.getDictDatas(this.DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS).forEach(item => {
this.specialProducts.push({
this.form.specialList.push({
"clearancePrice": !this.$route.query.action ? 0 : null, // 新建默认给0,否则默认是null
"clearancePriceUnit": null,
"clearanceVolumeUnit": null,
......@@ -447,6 +459,14 @@ export default {
})
},
methods: {
priceValidator(rule, value, callback){
if(!value || value == '') return callback()
value = parseFloat(value)
if(!value || value < 0){
return callback(new Error('价格错误'))
}
callback()
},
setDefaultVolumeUnit(unit){
this.$set(this.form, 'transportVolumeUnit', unit)
this.$set(this.form, 'clearanceVolumeUnit', unit)
......@@ -477,8 +497,9 @@ export default {
specialList: this.specialProducts,
isAllProduct: 0
})
if(this.form.stepPrice == 1){
data.priceStepList = this.priceStepList
if(this.form.stepPrice != 1){
// data.priceStepList = this.priceStepList
delete data.priceStepList
}
// 修改单条路线
......
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