|
|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <div style="width:100%;height:70px;line-height: 70px;">
|
|
|
+ <div style="width:100%;height:60px;line-height: 60px;">
|
|
|
|
|
|
<el-radio-group v-model="requestType" @change="changeRequest" style="margin-right:20px;padding-top:6px;margin-left:20px;" size="small">
|
|
|
<el-radio label="hasStockList">有库存花材</el-radio>
|
|
|
@@ -13,10 +13,9 @@
|
|
|
|
|
|
<el-input v-model="searchName" placeholder="搜索花材" style="width:200px;margin-right:9px;" size="small" @focus="searchFocus" @input="toSearch"></el-input>
|
|
|
|
|
|
- <el-input v-model="modifyName" placeholder="保存本次名称(选填)" style="width:200px;margin-right:9px;margin-left:90px;" size="small"></el-input>
|
|
|
- <el-button type="primary" size="small" @click="replaceBtnFn(0)">确认修改</el-button>
|
|
|
-
|
|
|
- <el-button type="success" size="small" @click="replaceBtnFn(0)" style="margin-left:90px;">修改记录</el-button>
|
|
|
+ <el-input v-model="modifyName" placeholder="保存本次名称(选填)" style="width:200px;margin-right:9px;margin-left:80px;" size="small"></el-input>
|
|
|
+ <el-button type="primary" size="small" @click="confirmChange()">确认修改</el-button>
|
|
|
+ <el-checkbox v-model="couldLessCost" style="margin-left:8px;">售价允许低于成本</el-checkbox>
|
|
|
</div>
|
|
|
<div style="width:100%;height:auto;text-align: left;" v-for="(sonProduct, index) in allProdct">
|
|
|
|
|
|
@@ -37,7 +36,8 @@
|
|
|
|
|
|
<el-table-column prop="name" label="花材" width="150">
|
|
|
<template slot-scope="scope">
|
|
|
- <span style="font-size:14px;">{{ scope.row.name }}</span>
|
|
|
+ <span style="font-size:16px;font-weight:bold;color:red;" v-if="Number(scope.row.showPrice)>0 && Number(scope.row.cost)>Number(scope.row.showPrice)">{{ scope.row.name }}</span>
|
|
|
+ <span style="font-size:14px;" v-else>{{ scope.row.name }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
@@ -91,7 +91,8 @@
|
|
|
currentItemClassName:'',
|
|
|
classId:0,
|
|
|
searchName:'',
|
|
|
- modifyName:''
|
|
|
+ modifyName:'',
|
|
|
+ couldLessCost: false
|
|
|
};
|
|
|
},
|
|
|
mounted () {
|
|
|
@@ -102,6 +103,39 @@
|
|
|
})
|
|
|
},
|
|
|
methods: {
|
|
|
+ confirmChange(){
|
|
|
+ let that = this
|
|
|
+ if (this.$util.isEmpty(this.allProdct)) {
|
|
|
+ this.$msg('没有修改')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ let hasLessCostPrice = false
|
|
|
+ let data = []
|
|
|
+ this.allProdct.forEach((item,idx,arr) => {
|
|
|
+ if (item.child && !this.$util.isEmpty(item.child)) {
|
|
|
+ item.child.forEach((onIt,index,info)=>{
|
|
|
+ onIt.forEach((it,ii,inData)=>{
|
|
|
+ if(it.showPrice && Number(it.showPrice)>0){
|
|
|
+ data.push({id:it.id,price:it.showPrice,skPrice:it.showPrice,hjPrice:it.showPrice})
|
|
|
+ if(Number(it.cost)>Number(it.showPrice)){
|
|
|
+ hasLessCostPrice = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if(hasLessCostPrice == true && this.couldLessCost == false){
|
|
|
+ this.$message.error('有售价低于成本的花材')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ this.$confirm('确认修改?', '提示', { confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning' }).then(() => {
|
|
|
+ this.$service.product.batchChangePrice({appVersion:1,data:JSON.stringify(data)}).then(res => {
|
|
|
+ this.$message.success('修改成功')
|
|
|
+ this.show()
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
searchFocus(){
|
|
|
this.searchName = ''
|
|
|
this.show()
|
|
|
@@ -122,13 +156,12 @@
|
|
|
this.$service.product.showProduct({requestType:this.requestType,classId:this.classId,name:this.searchName}).then(res => {
|
|
|
if (!this.$util.isEmpty(res.classItem)) {
|
|
|
res.classItem.forEach((item,idx,arr) => {
|
|
|
- //console.log(item.child)
|
|
|
if (item.child && !this.$util.isEmpty(item.child)) {
|
|
|
|
|
|
item.child.forEach((single,ix,array)=>{
|
|
|
- array[ix].showPrce=''
|
|
|
- array[ix].showSkPrce=''
|
|
|
- array[ix].showHjPrce=''
|
|
|
+ array[ix].showPrice=''
|
|
|
+ array[ix].showSkPrice=''
|
|
|
+ array[ix].showHjPrice=''
|
|
|
})
|
|
|
|
|
|
|
|
|
@@ -151,7 +184,6 @@
|
|
|
}
|
|
|
})
|
|
|
this.$forceUpdate()
|
|
|
- console.log(that.allProdct)
|
|
|
}
|
|
|
})
|
|
|
}
|