You need to sign in or sign up before continuing.
Commit ef2418f8 by zhangquan

添加原价

1 parent 47b0488a
......@@ -29,6 +29,9 @@
<div slot="activityPriceSlot" slot-scope="scope">
<format-input :disabled="disabled" :intDigit="6" :precise="2" placeholder="请输入" v-model="scope.scope.activityPrice"></format-input>
</div>
<div slot="originalPriceSlot" slot-scope="scope">
<format-input :disabled="disabled" :intDigit="6" :precise="2" placeholder="请输入" v-model="scope.scope.originalPrice"></format-input>
</div>
<div slot="retainagePriceSlot" slot-scope="scope">
{{ retainagePriceFn(scope.scope.activityPrice) }}
</div>
......@@ -68,7 +71,12 @@
const MerchantColumns = [
{
label: '门店名称',
prop: 'merchantName'
prop: 'merchantName',
},
{
label: '门店原价(元)',
width: 220,
addHtml: 'originalPriceSlot'
},
{
label: '门店活动价(元)',
......@@ -77,7 +85,7 @@ const MerchantColumns = [
},
{
label: '尾款金额(元)',
width: 220,
width: 150,
addHtml: 'retainagePriceSlot'
}
]
......@@ -85,7 +93,11 @@ const MerchantColumns = [
const notPriceColumns = [
{
label: '门店名称',
prop: 'merchantName'
prop: 'merchantName',
},
{
label: '门店原价(元)',
addHtml: 'originalPriceSlot'
},
{
label: '门店活动价(元)',
......@@ -220,20 +232,27 @@ export default {
saleStore: [{
required: true,
validator: (rule, value, callback) => {
const target = this.saleMerchantList.find(item => !item.activityPrice)
const target = this.saleMerchantList.find(item => !item.activityPrice || !item.originalPrice)
const hasNegTarget = this.saleMerchantList.find(item => {
let activityPrice = item.activityPrice || 0
let depositPrice = this.formObj.depositPrice || 0
return +activityPrice < +depositPrice
})
const hasTarget = this.saleMerchantList.find(item => {
let originalPrice = item.originalPrice || 0
let activityPrice = item.activityPrice || 0
let minSellPrice = this.formObj.minSellPrice || 0
return (+activityPrice > +originalPrice || +originalPrice < minSellPrice)
})
if(!this.saleMerchantList.length){
callback(new Error('请选择门店'))
}else if(target){
callback(new Error('请输入门店活动价'))
callback(new Error('门店活动价和原价不能为空'))
}else if(this.formObj.paymentType == 2 && hasNegTarget){
callback(new Error('活动价不能小于定金'))
}else if(hasTarget){
callback(new Error('原价不能小于最低售价和活动价'))
}else{
console.log(this.formObj.paymentType , hasNegTarget)
callback()
}
},
......@@ -412,16 +431,16 @@ export default {
delete obj.coverList
let saleMerchantList = this.saleMerchantList.map(item => {
let { merchantId, merchantName, activityPrice } = item
let { merchantId, merchantName, activityPrice, originalPrice } = item
let price = this.formObj.paymentType==1 ? 0 : this.formObj.depositPrice
let retainagePrice = activityPrice - price
activityPrice = activityPrice ? Number(Number(activityPrice*10*10).toFixed(0)) : 0
retainagePrice = retainagePrice ? Number(Number(retainagePrice*10*10).toFixed(0)) : 0
originalPrice = originalPrice ? Number(Number(originalPrice*10*10).toFixed(0)) : 0
if(obj.paymentType == 1) {
return {merchantId , merchantName,activityPrice }
return {merchantId , merchantName,activityPrice, originalPrice }
}else{
return {merchantId , merchantName,activityPrice, retainagePrice }
return {merchantId , merchantName,activityPrice, retainagePrice, originalPrice }
}
})
const params = {
......@@ -438,7 +457,7 @@ export default {
const params = this.getParams()
this.$apis.goods.addGoodsApi(params).then(res =>{
if(res) {
this.$message.success('新增成功')
this.$message.success('操作成功')
this.handleCancel()
}
})
......@@ -471,7 +490,8 @@ export default {
this.formObj.coverList = [res.goodsImage]
this.saleMerchantList = res.saleMerchantList?.map(item => {
let activityPrice = item.activityPrice ? Number(Number(item.activityPrice/100).toFixed(2)) : 0
return {...item, activityPrice}
let originalPrice = item.originalPrice ? Number(Number(item.originalPrice/100).toFixed(2)) : 0
return {...item, activityPrice, originalPrice}
}) || []
this.vehicleSeriesRequestList = res?.vehicleSeriesList?.map(item => {
const {brandId, brandName, childBrandId,childBrandName , vehicleSeriesId, vehicleSeriesName } = item
......@@ -516,7 +536,7 @@ export default {
.selected-table {
margin-top: 10px;
width: 100%;
max-width: 750px;
max-width: 1000px;
.el-button--text{
padding: 0;
}
......
......@@ -3,7 +3,7 @@
<div class="container">
<glsx-combi-form :isInline="false" class="glsx-combi-form" ref="baseInfoRef" labelWidth="154px" defaultWidth="432px" :formObj.sync="formObj" :formData="formData" :formRules="myRule">
<div slot="selectBtnSlot">
<el-button class="el-icon-plus" size="small" @click="openGoodsDialog">选择商品</el-button>
<el-button :class="['el-icon-plus', {'disabled-class':disabled}]" size="small" @click="openGoodsDialog">选择商品</el-button>
</div>
<div slot="goodsInfoSlot" class="goods-wrap">
<glsx-combi-form :isInline="false" ref="goodsInfoRef" labelWidth="154px" defaultWidth="432px" :formObj.sync="formObj" :formData="goodsFormData" :formRules="goodsRule">
......@@ -19,6 +19,9 @@
<div slot="activityPriceSlot" slot-scope="scope">
<format-input :disabled="disabled" :intDigit="6" :precise="2" placeholder="请输入" v-model="scope.scope.activityPrice"></format-input>
</div>
<div slot="originalPriceSlot" slot-scope="scope">
<format-input :disabled="disabled" :intDigit="6" :precise="2" placeholder="请输入" v-model="scope.scope.originalPrice"></format-input>
</div>
<div slot="giveIntegralSlot" slot-scope="scope">
<format-input :disabled="disabled" :intDigit="6" :precise="2" placeholder="请输入" v-model="scope.scope.giveIntegral"></format-input>
</div>
......@@ -29,7 +32,7 @@
</template>
</div>
<div slot="expressFeeSlot">
<format-input :disabled="disabled" :intDigit="4" :precise="2" v-model="formObj.expressFee"></format-input>
<format-input class="expressFee-class" :disabled="disabled" :intDigit="4" :precise="2" v-model="formObj.expressFee"></format-input>
</div>
</glsx-combi-form>
</div>
......@@ -48,6 +51,10 @@ const MerchantColumns = [
prop: 'merchantName'
},
{
label: '门店原价(元)',
addHtml: 'originalPriceSlot'
},
{
label: '门店价格(元)',
width: 220,
addHtml: 'activityPriceSlot'
......@@ -151,12 +158,20 @@ export default {
saleStoreSlot: [{
required: true,
validator: (rule, value, callback) => {
const _target = this.saleMerchantList.find(item => !item.activityPrice)
const _target = this.saleMerchantList.find(item => !item.activityPrice || !item.originalPrice)
const _integralTarget = this.saleMerchantList.find(item => !item.giveIntegral)
const hasTarget = this.saleMerchantList.find(item => {
let originalPrice = item.originalPrice || 0
let activityPrice = item.activityPrice || 0
let minSellPrice = this.formObj.minSellPrice || 0
return (+activityPrice > +originalPrice || +originalPrice < minSellPrice)
})
if(!this.saleMerchantList.length){
callback(new Error('请选择门店'))
}else if(_target){
callback(new Error('请输入门店活动价'))
callback(new Error('门店活动价和原价不能为空'))
}else if(hasTarget){
callback(new Error('原价不能小于最低售价和活动价'))
}else if(_integralTarget){
callback(new Error('请输入赠送积分'))
}else{
......@@ -255,6 +270,11 @@ export default {
this.posterOptions.isClose = false
const _target = this.goodsFormData.find(item => item.name == 'goodsName')
_target.isDisabled = true
const disabledList = ['associationClassifyFirstId', 'source', 'method', 'introduction']
disabledList.forEach(ele => {
const _disabledTarget = this.formData.find(item => item.name == ele)
_disabledTarget.isDisabled = true
})
this.selectedtableParams.tableOption = null
}
if(id){
......@@ -327,9 +347,10 @@ export default {
delete obj.method
let saleMerchantList = this.saleMerchantList.map(item => {
let { merchantId, merchantName, activityPrice, giveIntegral } = item
let { merchantId, merchantName, activityPrice, giveIntegral, originalPrice } = item
activityPrice = activityPrice ? Number(Number(activityPrice*10*10).toFixed(0)) : 0
return {merchantId , merchantName, activityPrice, giveIntegral}
originalPrice = originalPrice ? Number(Number(originalPrice*10*10).toFixed(0)) : 0
return {merchantId , merchantName, activityPrice, giveIntegral, originalPrice}
})
const params = {
saleMerchantList: saleMerchantList,
......@@ -344,7 +365,7 @@ export default {
const params = this.getParams()
this.$apis.goods.addGoodsApi(params).then(res =>{
if(res) {
this.$message.success('新增成功')
this.$message.success('操作成功')
this.handleCancel()
}
})
......@@ -379,7 +400,8 @@ export default {
this.formObj.coverList = [res.goodsImage]
this.saleMerchantList = res.saleMerchantList?.map(item => {
let activityPrice = item.activityPrice ? Number(Number(item.activityPrice/100).toFixed(2)) : 0
return {...item, activityPrice}
let originalPrice = item.originalPrice ? Number(Number(item.originalPrice/100).toFixed(2)) : 0
return {...item, activityPrice, originalPrice}
}) || []
}
})
......@@ -403,10 +425,19 @@ export default {
.selected-table {
margin-top: 10px;
width: 100%;
max-width: 750px;
max-width: 1100px;
.el-button--text{
padding: 0;
}
}
.expressFee-class{
width: 432px;
}
/deep/ #introduction{
.el-textarea__inner{
width: 580px;
height: 80px;
}
}
}
</style>
\ No newline at end of file
......@@ -107,6 +107,7 @@ export default {
// }
// }
list.map(item => this.$set(item, 'activityPrice', ''))
list.map(item => this.$set(item, 'originalPrice', ''))
this.$emit('confirmDialog', [...list, ...this.copyList])
},
handleClose() {
......
......@@ -59,6 +59,11 @@
brandCascader,
preferList
},
beforeRouteEnter(to, from, next) {
next(vm =>{
if(from.path.indexOf('/goods/addPrefer')==0) {vm.activeName='2'}
})
},
data() {
return {
tableSearchForm: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!