|
@@ -67,9 +67,9 @@
|
|
|
<div style="display:flex;align-items:center">
|
|
|
<el-input size="small" style="width:200px" v-model="params.content.where.condition" placeholder="输入搜索内容" @clear="getProductList(params.content.pageNumber = 1)" @keyup.native.enter="getProductList(params.content.pageNumber = 1)" clearable></el-input>
|
|
|
</div>
|
|
|
- <el-button type="primary" size="small" :disabled="selectProductLength == 0" @click="batchSelects">批 量 添 加</el-button>
|
|
|
+ <el-button type="primary" size="small" :disabled="selectProductLength == 0" @click="queryProuctAdds">批 量 添 加</el-button>
|
|
|
</div>
|
|
|
- <Table ref="table" fixedName="operation" v-model="itemno" :data="productList" :custom="true" height="500px" @selection="selectArr" @onSelect="batchSelect">
|
|
|
+ <Table ref="table" fixedName="operation" v-model="itemno" :data="productList" :custom="true" height="500px" @selection="selectArr" @onSelect="queryProuctAdd">
|
|
|
</Table>
|
|
|
<div style="display:flex;justify-content:space-between;align-items:center;margin-top:10px">
|
|
|
<span>已添加产品数:{{addProductLength}}</span>
|
|
@@ -204,6 +204,7 @@ export default {
|
|
|
},300)()
|
|
|
},
|
|
|
async addProduct (data) {
|
|
|
+ console.log(data,'data1111')
|
|
|
let res = await this.$api.requested({
|
|
|
"id": 20221123164402,
|
|
|
"content": {
|
|
@@ -213,7 +214,8 @@ export default {
|
|
|
"itemid": data.itemid,
|
|
|
"price": data.price,
|
|
|
"qty": data.qty,
|
|
|
- "marketprice":data.marketprice
|
|
|
+ "marketprice":data.marketprice,
|
|
|
+ "discountrate":data.discountrate
|
|
|
}
|
|
|
]
|
|
|
},
|
|
@@ -230,14 +232,6 @@ export default {
|
|
|
},
|
|
|
async onSumit () {
|
|
|
console.log(this.$refs.table.tableSelectData);
|
|
|
- let item = this.$refs.table.tableSelectData.map(item => {
|
|
|
- return {
|
|
|
- "itemid": item.itemid,
|
|
|
- "price": item.price,
|
|
|
- "qty": item.qty,
|
|
|
- "marketprice":item.marketprice
|
|
|
- }
|
|
|
- })
|
|
|
let res = await this.$api.requested({
|
|
|
"id": 20221123164402,
|
|
|
"content": {
|
|
@@ -251,6 +245,84 @@ export default {
|
|
|
this.getProductList()
|
|
|
})
|
|
|
},
|
|
|
+ /*查询商品是否已添加*/
|
|
|
+ async queryProuctAdds(){
|
|
|
+ let item = this.$refs.table.tableSelectData.map(item => {
|
|
|
+ return {
|
|
|
+ "itemid": item.itemid,
|
|
|
+ "price": item.price,
|
|
|
+ "qty": item.qty,
|
|
|
+ "marketprice":item.marketprice,
|
|
|
+ "discountrate":item.discountrate
|
|
|
+ }
|
|
|
+ })
|
|
|
+ console.log(item,'批量添加')
|
|
|
+ let checkItem = []
|
|
|
+ item.forEach((item,index)=>{
|
|
|
+ checkItem[index] = item.itemid
|
|
|
+ })
|
|
|
+ console.log(checkItem,'校验id')
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id": 20230221151903,
|
|
|
+ "content": {
|
|
|
+ "sa_contractid": this.$route.query.id,
|
|
|
+ "itemids":checkItem
|
|
|
+ },
|
|
|
+ })
|
|
|
+ console.log(res,'是否重复')
|
|
|
+ if (!res.data){
|
|
|
+ this.batchSelects(item)
|
|
|
+ }else {
|
|
|
+ this.checkItems(item)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async queryProuctAdd(data){
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id": 20230221151903,
|
|
|
+ "content": {
|
|
|
+ "sa_contractid": this.$route.query.id,
|
|
|
+ "itemids":[data.itemid]
|
|
|
+ },
|
|
|
+ })
|
|
|
+ console.log(res,'是否重复')
|
|
|
+ if (!res.data){
|
|
|
+ console.log(data,'不重复的数据')
|
|
|
+ this.batchSelect(data)
|
|
|
+ }else {
|
|
|
+ this.checkItem(data)
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ checkItem(data) {
|
|
|
+ this.$confirm('商品已存在, 是否更新最新价格?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ closeOnClickModal:false,
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ this.batchSelect(data)
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消添加'
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ checkItems(data) {
|
|
|
+ this.$confirm('商品已存在, 是否更新最新价格?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ closeOnClickModal:false,
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ this.batchSelects(data)
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消添加'
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
upDateData (data) {
|
|
|
this.selectProductLength = data.length
|
|
|
},
|