|
|
@@ -81,7 +81,7 @@
|
|
|
<el-input size="small" suffix-icon="el-icon-search" v-model="params.content.where.condition" placeholder="类别名称" @keyup.enter.native="listData(params.content.pageNumber = 1)" @clear="listData(params.content.pageNumber = 1)" clearable></el-input>
|
|
|
</div>
|
|
|
<div style="margin-top:-10px;margin-bottom: 10px;float: right">
|
|
|
- <el-button style="float: right" type="primary" size="mini" @click="batchSelect" :disabled="tableSelectData.length === 0 ">批量添加</el-button>
|
|
|
+ <el-button style="float: right" type="primary" size="mini" @click="itemClassSelect" :disabled="tableSelectData.length === 0 ">批量添加</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="produtMag-panel">
|
|
|
@@ -124,7 +124,7 @@
|
|
|
label="折扣"
|
|
|
width="0">
|
|
|
<template slot-scope="scope">
|
|
|
- <span>{{Math.round((scope.row.discountrate * 100)*100)/100}}</span>
|
|
|
+ <span>{{Math.round(scope.row.discountrate*100)/100}}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
@@ -132,7 +132,7 @@
|
|
|
label="操作"
|
|
|
width="80">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button type="text" @click="onSelect(scope.row)">添 加</el-button>
|
|
|
+ <el-button type="text" @click="itemClass(scope.row)">添 加</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
@@ -226,6 +226,24 @@ export default {
|
|
|
that.timer = setTimeout(fn, wait)
|
|
|
}
|
|
|
},
|
|
|
+ async itemClassSelect(){
|
|
|
+ let checkItem = []
|
|
|
+ this.selectData.forEach((item,index)=>{
|
|
|
+ checkItem[index] = item.itemclassid
|
|
|
+ })
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id": 20230223201103,
|
|
|
+ "content": {
|
|
|
+ "sa_contractid": this.$route.query.id,
|
|
|
+ "itemclassids":checkItem
|
|
|
+ },
|
|
|
+ })
|
|
|
+ if (!res.data){
|
|
|
+ this.batchSelect()
|
|
|
+ }else {
|
|
|
+ this.checkItems()
|
|
|
+ }
|
|
|
+ },
|
|
|
batchSelect(){
|
|
|
this.debounce(this.onSubmit,300)()
|
|
|
},
|
|
|
@@ -244,6 +262,24 @@ export default {
|
|
|
})
|
|
|
|
|
|
},
|
|
|
+
|
|
|
+ async itemClass(data){
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id": 20230223201103,
|
|
|
+ "content": {
|
|
|
+ "sa_contractid": this.$route.query.id,
|
|
|
+ "itemclassids":[data.itemclassid]
|
|
|
+ },
|
|
|
+ })
|
|
|
+ console.log(res,'是否重复')
|
|
|
+ if (!res.data){
|
|
|
+ console.log(data,'不重复的数据')
|
|
|
+ this.onSelect(data)
|
|
|
+ }else {
|
|
|
+ this.checkItem(data)
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
onSelect(val){
|
|
|
console.log(val,"选择的商品")
|
|
|
this.tableSelectData = []
|
|
|
@@ -252,7 +288,7 @@ export default {
|
|
|
return {
|
|
|
"sa_contract_itemsaleclassid":0,
|
|
|
"itemclassid":e.itemclassid,
|
|
|
- "discountrate":e.discountrate
|
|
|
+ "discountrate":e.discountrate /100
|
|
|
}
|
|
|
})
|
|
|
this.selectData = obj
|
|
|
@@ -279,7 +315,7 @@ export default {
|
|
|
return {
|
|
|
"sa_contract_itemsaleclassid":0,
|
|
|
"itemclassid":e.itemclassid,
|
|
|
- "discountrate":e.discountrate
|
|
|
+ "discountrate":e.discountrate / 100
|
|
|
}
|
|
|
})
|
|
|
this.selectData = obj
|
|
|
@@ -321,7 +357,37 @@ export default {
|
|
|
this.params.content.sa_quotedpriceid = row.sa_quotedpriceid
|
|
|
this.listData()
|
|
|
this.selectListData()
|
|
|
- }
|
|
|
+ },
|
|
|
+ checkItems() {
|
|
|
+ this.$confirm('类别已存在, 是否更新最新折扣?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ closeOnClickModal:false,
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ this.batchSelect()
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消添加'
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ checkItem(data) {
|
|
|
+ this.$confirm('类别已存在, 是否更新最新折扣?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ closeOnClickModal:false,
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ this.onSelect(data)
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消添加'
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
},
|
|
|
mounted() {
|
|
|
}
|