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

修复优惠,路线价格等bug

parent 91cd788b
...@@ -457,4 +457,10 @@ export function dataURLtoBlob(base64Data) { ...@@ -457,4 +457,10 @@ export function dataURLtoBlob(base64Data) {
type: mimeString type: mimeString
}); });
return blob; return blob;
}
// 将字符串转成数组
export function str2arr(str, separator = ','){
if(!str) return []
return str.split(separator).filter(item => item)
} }
\ No newline at end of file
<script>
import Edit from './edit'
Edit.name = 'CouponDetail'
export default Edit
</script>
\ No newline at end of file
...@@ -261,6 +261,7 @@ import ProductsSelector from '@/components/ProductsSelector' ...@@ -261,6 +261,7 @@ import ProductsSelector from '@/components/ProductsSelector'
import Editor from '@/components/Editor' import Editor from '@/components/Editor'
import Selector from '@/components/Selector/index' import Selector from '@/components/Selector/index'
import {parseTime} from '@/utils/ruoyi' import {parseTime} from '@/utils/ruoyi'
import {str2arr} from '@/utils/index'
export default { export default {
...@@ -304,6 +305,7 @@ export default { ...@@ -304,6 +305,7 @@ export default {
}, },
errTips: {}, // 跟fee对应的错误提示 errTips: {}, // 跟fee对应的错误提示
isAllProduct: false, // 是否全部商品 isAllProduct: false, // 是否全部商品
initing: false, // 初始化中,编辑或者查看的时候,初始化中修改type不改默认值
}; };
}, },
computed:{ computed:{
...@@ -370,13 +372,15 @@ export default { ...@@ -370,13 +372,15 @@ export default {
// 非优惠券则查询优惠券列表 // 非优惠券则查询优惠券列表
if(val && val != 1){ if(val && val != 1){
this.getCouponSelect() this.getCouponSelect()
// 非优惠券给默认数据 if(!this.initing){
this.$set(this.form, 'documentDeclarationArr', ["1", "2", "3"]) // 非优惠券给默认数据
this.$set(this.form, 'isCargoControlArr', ["0", "1"]) this.$set(this.form, 'documentDeclarationArr', ["1", "2", "3"])
this.$set(this.form, 'orderAttrArr', ["2","3","1"]) this.$set(this.form, 'isCargoControlArr', ["0", "1"])
this.$set(this.form, 'brandArr', ["0","1", "2"]) this.$set(this.form, 'orderAttrArr', ["2","3","1"])
this.$set(this.form, 'suitableLineType', 0) this.$set(this.form, 'brandArr', ["0","1", "2"])
this.$set(this.form, 'suitableLineType', 0)
}
} }
// 过一遍费用,禁用/启用、同步 部分货币单位 // 过一遍费用,禁用/启用、同步 部分货币单位
...@@ -416,9 +420,13 @@ export default { ...@@ -416,9 +420,13 @@ export default {
} }
getCurrencyList().then(res => this.currencyList = res.data) getCurrencyList().then(res => this.currencyList = res.data)
if (this.$route.query.id) { if (this.$route.query.id) {
this.initing = true
getCoupon(this.$route.query.id).then((res) => { getCoupon(this.$route.query.id).then((res) => {
this.form = res.data this.form = res.data;
['orderAttr', 'isCargoControl', 'brand', 'documentDeclaration'].forEach(field => {
this.$set(this.form, field + 'Arr', str2arr(res.data[field]))
})
// 没有商品则表示全部 // 没有商品则表示全部
if(!this.form.prodIds){ if(!this.form.prodIds){
this.isAllProduct = true this.isAllProduct = true
...@@ -464,6 +472,10 @@ export default { ...@@ -464,6 +472,10 @@ export default {
this.fee[type] = [{type}] this.fee[type] = [{type}]
} }
}) })
}).finally(() => {
this.$nextTick(() => {
this.initing = false
})
}) })
} }
// 不是编辑查看则给默认的费用表格 // 不是编辑查看则给默认的费用表格
...@@ -489,7 +501,14 @@ export default { ...@@ -489,7 +501,14 @@ export default {
// 只要不是按产品单位满减 // 只要不是按产品单位满减
if(!item.combUnit || item.combUnit.split('_')[0] != 'prodUnit'){ if(!item.combUnit || item.combUnit.split('_')[0] != 'prodUnit'){
this.$set(item, 'reduceCurrencyDisabled', true) this.$set(item, 'reduceCurrencyDisabled', true)
this.$set(item, 'reduceCurrencyId', +item.fullCurrencyId || +item.combUnit.split('_')[1]) let currencyId = +item.fullCurrencyId
if(!currencyId && item.combUnit){
currencyId = +item.combUnit.split('_')[1]
}
if(!currencyId){
currencyId = this.currencyList[0].id
}
this.$set(item, 'reduceCurrencyId', currencyId)
} }
return return
...@@ -639,7 +658,7 @@ export default { ...@@ -639,7 +658,7 @@ export default {
} }
// 没勾选全部就需要选择商品 // 没勾选全部就需要选择商品
if(!this.isAllProduct && !this.form.prodIds){ if(this.form.type != 1 && !this.isAllProduct && !this.form.prodIds){
return this.$message.error('请选择商品') return this.$message.error('请选择商品')
} }
......
...@@ -161,7 +161,7 @@ ...@@ -161,7 +161,7 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row, true)" <el-button size="mini" type="text" icon="el-icon-edit" @click="handleDetail(scope.row, true)"
v-hasPermi="['ecw:coupon:update']">查看</el-button> v-hasPermi="['ecw:coupon:update']">查看</el-button>
<el-button v-if="scope.row.status != 1" size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" <el-button v-if="scope.row.status != 1" size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['ecw:coupon:update']">编辑</el-button> v-hasPermi="['ecw:coupon:update']">编辑</el-button>
...@@ -287,6 +287,9 @@ export default { ...@@ -287,6 +287,9 @@ export default {
} }
return this.$router.push(url) return this.$router.push(url)
}, },
handleDetail(row){
this.$router.push('detail?id=' + row.couponId + '&readonly=1')
},
handleCopy(row){ handleCopy(row){
this.$router.push('edit?action=copy&id=' + row.couponId) this.$router.push('edit?action=copy&id=' + row.couponId)
}, },
......
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
- -
<el-input v-model="item.endNum" type="number" placeholder="" class="w-100"></el-input> <el-input v-model="item.endNum" type="number" placeholder="" class="w-100"></el-input>
/ /
<selector v-model="form.weightUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" /> <selector v-model="item.weightUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 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('默认运费')" 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"/> <inputor default2="0" v-model.number="item.transportPrice" type="number" :placeholder="$t('整数或者两位小数')" class="w-100 mr-10"/>
...@@ -117,7 +117,7 @@ ...@@ -117,7 +117,7 @@
:rules="{validator: priceValidator, trigger: 'blur', message: '价格错误'}" :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" /> <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" :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="item.allVolumeUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" /> / <selector v-model="item.allVolumeUnit" :options="unitList" :label-field="$l(null, 'title')" value-field="id" defaultable2 class="w-100" />
</el-form-item> </el-form-item>
</div> </div>
...@@ -426,6 +426,7 @@ export default { ...@@ -426,6 +426,7 @@ export default {
stepPrice: 0, stepPrice: 0,
advanceStatus: 0, advanceStatus: 0,
needBook: 0, needBook: 0,
specialList: [],
// dayLimit: 10000, // dayLimit: 10000,
validateEndDate: undefined, validateEndDate: undefined,
validateStartDate: undefined, validateStartDate: undefined,
...@@ -471,7 +472,7 @@ export default { ...@@ -471,7 +472,7 @@ 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.form.specialList || !this.form.specialList.length){ /* if(!this.form.specialList || !this.form.specialList.length){
console.log('specialList默认给[]') console.log('specialList默认给[]')
this.$set(this.form, 'specialList', []) this.$set(this.form, 'specialList', [])
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 => {
...@@ -485,7 +486,22 @@ export default { ...@@ -485,7 +486,22 @@ export default {
"transportVolumeUnit": null, "transportVolumeUnit": null,
}) })
}) })
} } */
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 => {
if(!this.form.specialList.find(special => special.specialDictType == item.value)){
this.form.specialList.push({
"clearancePrice": !this.$route.query.action ? 0 : null, // 新建默认给0,否则默认是null
"clearancePriceUnit": null,
"clearanceVolumeUnit": null,
"specialDictType": item.value,
"transportPrice": !this.$route.query.action ? 0 : null, // 新建默认给0,否则默认是null
"transportPriceUnit": null,
"transportVolumeUnit": null,
})
}
})
}, },
methods: { methods: {
......
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