|
@@ -2,7 +2,7 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
<div style="margin-bottom: 15px">
|
|
|
- <add v-if="tool.checkAuth($route.name,'productSetManage') && data.disabled" class="inline-16" @addSuccess="onSuccess"></add>
|
|
|
+ <add v-if="tool.checkAuth($route.name,'productSetManage') && data.disabled" class="inline-16" @addSuccess="onSuccess" :discountrate="data.discountrate"></add>
|
|
|
<el-button v-if="tool.checkAuth($route.name,'productSetManage') && data.disabled" class="inline-16" size="small" :type="delProductData.length === 0?'':'primary'" @click="onDelProduct" :disabled="delProductData.length === 0">删 除</el-button>
|
|
|
<el-input
|
|
|
size="small"
|
|
@@ -13,6 +13,10 @@
|
|
|
@keyup.enter.native="listData(params.content.pageNumber= 1)"
|
|
|
@clear="listData(params.content.pageNumber= 1)"
|
|
|
clearable></el-input>
|
|
|
+ <div style="float: right">
|
|
|
+ <label class="search__label">预计折扣(%):</label>
|
|
|
+ <el-input style="width: 100px;" v-model="data.discountrate" size="small" label="默认折扣" :disabled="!tool.checkAuth($route.name,'productSetManage') || !data.disabled" @change="discountrateChange(data.discountrate)"></el-input>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div class="produtMag-panel">
|
|
|
<el-table
|
|
@@ -119,6 +123,7 @@
|
|
|
<el-table-column
|
|
|
prop="marketprice"
|
|
|
label="牌价(元)"
|
|
|
+ fixed="right"
|
|
|
width="100">
|
|
|
<template slot-scope="scope">
|
|
|
<p><span>{{scope.row.marketprice?scope.row.marketprice:'--'}}</span></p>
|
|
@@ -133,6 +138,15 @@
|
|
|
<el-input-number v-model="scope.row.qty" size="mini" :min="1" label="描述文字" @change="numChange(scope.row.qty,scope.$index,scope.row)" :disabled="!data.disabled"></el-input-number>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="price"
|
|
|
+ label="单价(元)"
|
|
|
+ fixed="right"
|
|
|
+ width="100">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input v-model="scope.row.price" size="mini" @change="priceChange(scope.row.price,scope.$index,scope.row)" :disabled="!data.disabled"></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column
|
|
|
prop="amount"
|
|
|
label="总金额(元)"
|
|
@@ -212,6 +226,9 @@ export default {
|
|
|
},*/
|
|
|
|
|
|
async listData(){
|
|
|
+ console.log(this.data,"data的数据")
|
|
|
+ console.log(this.data.discountrate)
|
|
|
+ /*this.data.discountrate = Math.round(this.data.discountrate * 100) / 100*/
|
|
|
this.totalPrice = 0
|
|
|
this.params.content.sa_projectid = this.data.sa_projectid
|
|
|
const res = await this.$api.requested(this.params)
|
|
@@ -219,6 +236,7 @@ export default {
|
|
|
res.data.forEach((e,index)=>{
|
|
|
this.totalPrice = this.totalPrice + e.amount
|
|
|
})
|
|
|
+ console.log(this.data.discountrate)
|
|
|
this.total = res.total
|
|
|
},
|
|
|
handleSizeChange(val) {
|
|
@@ -282,10 +300,23 @@ export default {
|
|
|
/*修改商品数量*/
|
|
|
numChange(val,index,data){
|
|
|
data.qty = val.toFixed(2)
|
|
|
- data.amount = (data.marketprice * data.qty).toFixed(2)
|
|
|
+ data.amount = (data.price * data.qty).toFixed(2)
|
|
|
this.$set(this.list,index,data)
|
|
|
this.onChangQty(data,data.qty)
|
|
|
},
|
|
|
+ /*修改单价*/
|
|
|
+ priceChange(val,index,data){
|
|
|
+ if (val > data.marketprice){
|
|
|
+ data.price = data.marketprice
|
|
|
+ }else if(val < 0) {
|
|
|
+ data.price = 0
|
|
|
+ }else {
|
|
|
+ data.price = Math.round(val * 100)/100
|
|
|
+ }
|
|
|
+ data.amount = Math.round((data.price * data.qty)*100)/100
|
|
|
+ this.$set(this.list,index,data)
|
|
|
+ this.onChangePrice(data,data.price)
|
|
|
+ },
|
|
|
async onChangQty(data,val){
|
|
|
const res = await this.$api.requested({
|
|
|
"id": 20221021145502,
|
|
@@ -296,17 +327,62 @@ export default {
|
|
|
"sa_project_itemsid":data.sa_project_itemsid,
|
|
|
"itemid": data.itemid,
|
|
|
"qty": val,
|
|
|
- "remarks": ""
|
|
|
+ "remarks": "",
|
|
|
+ "marketprice": data.marketprice, //市场价
|
|
|
+ "price": data.price //单价
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.listData()
|
|
|
+ this.$emit("productSetSuccess")
|
|
|
+ },
|
|
|
+ async onChangePrice(data,val){
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id": 20221021145502,
|
|
|
+ "content": {
|
|
|
+ "sa_projectid": this.data.sa_projectid,
|
|
|
+ "items": [
|
|
|
+ {
|
|
|
+ "sa_project_itemsid":data.sa_project_itemsid,
|
|
|
+ "itemid": data.itemid,
|
|
|
+ "qty": data.qty,
|
|
|
+ "remarks": "",
|
|
|
+ "marketprice": data.marketprice, //市场价
|
|
|
+ "price": val //单价
|
|
|
}
|
|
|
]
|
|
|
}
|
|
|
})
|
|
|
this.listData()
|
|
|
+ this.$emit("productSetSuccess")
|
|
|
+ },
|
|
|
+ /*修改预计折扣*/
|
|
|
+ async discountrateChange(val){
|
|
|
+ if (val > 100){
|
|
|
+ this.data.discountrate = 100
|
|
|
+ }else if(val < 1){
|
|
|
+ this.data.discountrate = 1
|
|
|
+ }else {
|
|
|
+ this.data.discountrate = Math.round(val * 100)/100
|
|
|
+ }
|
|
|
+ console.log(this.data,"修改预计折扣")
|
|
|
+ this.data.discountrate = this.data.discountrate / 100
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id": 20221020144202,
|
|
|
+ "content": this.data
|
|
|
+ })
|
|
|
+ this.tool.showMessage(res,()=>{
|
|
|
+ this.listData()
|
|
|
+ this.data.discountrate = Math.round((this.data.discountrate * 100) * 100) / 100
|
|
|
+ this.$emit("productSetSuccess")
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
/*this.getProductList()*/
|
|
|
this.tablecols = this.tool.tabelCol(this.$route.name).projectSetTable.tablecols
|
|
|
+ /* this.data.discountrate = Math.round((this.data.discountrate * 100) * 100) / 100*/
|
|
|
},
|
|
|
mounted () {
|
|
|
this.listData()
|