|
|
@@ -3,8 +3,8 @@
|
|
|
<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>
|
|
|
- <el-radio label="itemList">全部花材</el-radio>
|
|
|
+ <el-radio label="itemList">全部花材</el-radio>
|
|
|
+ <el-radio label="hasStockList">有库存花材</el-radio>
|
|
|
</el-radio-group>
|
|
|
|
|
|
<el-select size="small" v-model="currentItemClassName" placeholder="花材分类" style="width:150px;margin-right:10px;" @change="getItemClass" clearable>
|
|
|
@@ -17,7 +17,7 @@
|
|
|
<el-button type="primary" size="small" @click="confirmChange()">确认修改</el-button>
|
|
|
<el-checkbox v-model="couldLessCost" style="margin-left:8px;">售价允许低于成本</el-checkbox>
|
|
|
</div>
|
|
|
- <div style="padding-left:9px;margin-bottom:5px;">
|
|
|
+ <div style="padding-left:9px;margin-bottom:9px;">
|
|
|
修改记录:<span v-for="(it,idx) in modifyList" style="margin-right:15px;cursor: pointer;" @click="getChagnePrice(it)"> {{ it.name }} </span>
|
|
|
</div>
|
|
|
<div style="width:100%;height:auto;text-align: left;" v-for="(sonProduct, index) in allProdct">
|
|
|
@@ -37,38 +37,50 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
- <el-table-column prop="name" label="花材" width="150">
|
|
|
+ <el-table-column prop="name" label="花材" width="120">
|
|
|
<template slot-scope="scope">
|
|
|
- <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="color:red;font-size:14px;" 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>
|
|
|
|
|
|
- <el-table-column prop="showHjPrice" label="大客价" align="center" width="70">
|
|
|
+ <el-table-column prop="showHjPrice" label="大客价" align="center" width="60">
|
|
|
<template slot-scope="scope">
|
|
|
<el-input v-model="scope.row.showHjPrice" @focus="scope.row.showHjPrice=''" placeholder="大客" size="small"></el-input>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
- <el-table-column prop="showPrice" label="批发价" align="center" width="70">
|
|
|
+ <el-table-column prop="showPrice" label="批发价" align="center" width="60">
|
|
|
<template slot-scope="scope">
|
|
|
<el-input v-model="scope.row.showPrice" @focus="scope.row.showPrice=''" @input="changePrice(scope.row)" placeholder="批发" style="border:1upx solid red;" size="small">
|
|
|
</el-input>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
- <el-table-column prop="showSkPrice" label="散客价" align="center" width="70">
|
|
|
+ <el-table-column prop="showSkPrice" label="散客价" align="center" width="60">
|
|
|
<template slot-scope="scope">
|
|
|
<el-input v-model="scope.row.showSkPrice" @focus="scope.row.showSkPrice=''" placeholder="散客" size="small"></el-input>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
- <el-table-column prop="cost" label="成本" align="center" width="70">
|
|
|
+ <el-table-column prop="cost" label="成本" align="center" width="60">
|
|
|
<template slot-scope="scope">
|
|
|
<span>{{ scope.row.cost?parseFloat(scope.row.cost):0 }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
+ <el-table-column prop="showStock" label="库存" align="center" width="60">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input v-model="scope.row.showStock" @focus="scope.row.showStock=''" placeholder="库存" size="small"></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column prop="cost" label="剩余" align="center" width="60">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span style="font-size:12px;">剩 {{ scope.row.stock?parseFloat(scope.row.stock):0 }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
@@ -89,7 +101,7 @@
|
|
|
data () {
|
|
|
return {
|
|
|
allProdct:[],
|
|
|
- requestType:"hasStockList",
|
|
|
+ requestType:"itemList",
|
|
|
itemClassList:[],
|
|
|
currentItemClassName:'',
|
|
|
classId:0,
|
|
|
@@ -97,7 +109,8 @@
|
|
|
modifyName:'',
|
|
|
couldLessCost: false,
|
|
|
modifyList:[],
|
|
|
- historyPriceList:[]
|
|
|
+ historyPriceList:[],
|
|
|
+ stockArr:[]
|
|
|
};
|
|
|
},
|
|
|
mounted () {
|
|
|
@@ -120,9 +133,9 @@
|
|
|
skDiff = parseFloat(skMore) - parseFloat(addPrice)
|
|
|
skDiff = parseFloat(skDiff).toFixed(2)
|
|
|
}
|
|
|
- let skAmount = currentPrice + skDiff
|
|
|
+ let skAmount = parseFloat(currentPrice) + parseFloat(skDiff)
|
|
|
skAmount = parseFloat(skAmount).toFixed(2)
|
|
|
- info.showSkPrice = skAmount
|
|
|
+ info.showSkPrice = parseFloat(skAmount)
|
|
|
|
|
|
let hjDiff = 0
|
|
|
if(parseFloat(addPrice)>parseFloat(hjAddPrice)){
|
|
|
@@ -134,7 +147,7 @@
|
|
|
hjAmount = parseFloat(currentPrice) - parseFloat(hjDiff)
|
|
|
hjAmount = parseFloat(hjAmount).toFixed(2)
|
|
|
}
|
|
|
- info.showHjPrice = hjAmount
|
|
|
+ info.showHjPrice = parseFloat(hjAmount)
|
|
|
},
|
|
|
getChagnePrice(info){
|
|
|
this.$service.modify.getModifyItem({id:info.id}).then(res=>{
|
|
|
@@ -155,37 +168,77 @@
|
|
|
return false
|
|
|
}
|
|
|
let hasLessCostPrice = false
|
|
|
+ let hasError = false
|
|
|
let data = []
|
|
|
+ this.stockArr = []
|
|
|
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,name:it.name,cover:it.shortCover})
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if((it.showPrice && Number(it.showPrice)>0) || parseFloat(it.showStock)>=0){
|
|
|
+
|
|
|
+ if (this.$util.isEmpty(it.showSkPrice) || parseFloat(it.showSkPrice)<0) {
|
|
|
+ this.$message.error('请填写【'+it.name+'】零售价')
|
|
|
+ hasError = true
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.$util.isEmpty(it.showHjPrice) || parseFloat(it.showHjPrice)<0) {
|
|
|
+ this.$message.error('请填写【'+it.name+'】大客价')
|
|
|
+ hasError = true
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.$util.isEmpty(it.showPrice) || parseFloat(it.showPrice)<0) {
|
|
|
+ this.$message.error('请填写【'+it.name+'】批发价')
|
|
|
+ hasError = true
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ if(parseFloat(it.showStock)>=0){
|
|
|
+ this.stockArr.push({productId:it.id,bigNum:it.showStock,smallNum:null})
|
|
|
+ }
|
|
|
+
|
|
|
+ data.push({id:it.id,price:it.showPrice,skPrice:it.showSkPrice,hjPrice:it.showHjPrice,stock:it.showStock,name:it.name,cover:it.shortCover})
|
|
|
if(Number(it.cost)>Number(it.showPrice)){
|
|
|
hasLessCostPrice = true
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
})
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
+ if(hasError == true){
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
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.$service.modify.addModify({modifyName:this.modifyName,data:JSON.stringify(data)}).then(res => {
|
|
|
- })
|
|
|
-
|
|
|
- this.modifyName = ''
|
|
|
- this.$message.success('修改成功')
|
|
|
- this.show()
|
|
|
- this.getModifyList()
|
|
|
- this.historyPriceList=[]
|
|
|
-
|
|
|
+ this.$service.modify.addModify({modifyName:this.modifyName,data:JSON.stringify(data)}).then(res => { })
|
|
|
+ if (!this.$util.isEmpty(this.stockArr)) {
|
|
|
+ let data = JSON.stringify(this.stockArr);
|
|
|
+ this.$service.checkOrder.createOrder({pdType:'',itemInfo:data,remark:'修改库存'}).then(res=>{
|
|
|
+ this.modifyName = ''
|
|
|
+ this.$message.success('修改成功')
|
|
|
+ this.show()
|
|
|
+ this.getModifyList()
|
|
|
+ this.historyPriceList=[]
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ this.modifyName = ''
|
|
|
+ this.$message.success('修改成功')
|
|
|
+ this.show()
|
|
|
+ this.getModifyList()
|
|
|
+ this.historyPriceList=[]
|
|
|
+ }
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
@@ -226,6 +279,7 @@
|
|
|
array[ix].showPrice=''
|
|
|
array[ix].showSkPrice=''
|
|
|
array[ix].showHjPrice=''
|
|
|
+ array[ix].showStock=''
|
|
|
}
|
|
|
})
|
|
|
|