|
@@ -70,19 +70,7 @@
|
|
size="small"
|
|
size="small"
|
|
> 批量操作 <a-icon type="down" /> </a-button>
|
|
> 批量操作 <a-icon type="down" /> </a-button>
|
|
</a-dropdown>
|
|
</a-dropdown>
|
|
- <span v-if="selectTotal" style="margin-left:10px;">已选 {{ selectTotal }} 项</span>
|
|
|
|
- </a-col>
|
|
|
|
- <a-col :md="16" :sm="24" style="text-align:right;">
|
|
|
|
- <a-button
|
|
|
|
- type="link"
|
|
|
|
- class="button-info"
|
|
|
|
- id="salesEdit-import-product"
|
|
|
|
- @click="openGuideModal=true"><a-icon type="login" /> 导入产品</a-button>
|
|
|
|
- <a-button
|
|
|
|
- id="salesEdit-new-product"
|
|
|
|
- type="link"
|
|
|
|
- class="button-info"
|
|
|
|
- @click="openCpModal"><a-icon type="plus" /> 添加产品</a-button>
|
|
|
|
|
|
+ <span v-if="selectTotal" style="margin:0 10px;">已选 {{ selectTotal }} 项</span>
|
|
<a-button
|
|
<a-button
|
|
:id="'salesEdit-allSetWare'"
|
|
:id="'salesEdit-allSetWare'"
|
|
type="link"
|
|
type="link"
|
|
@@ -98,6 +86,18 @@
|
|
@click="handleMenuClick({key:2})"
|
|
@click="handleMenuClick({key:2})"
|
|
><a-icon type="delete"/> 全部删除</a-button>
|
|
><a-icon type="delete"/> 全部删除</a-button>
|
|
</a-col>
|
|
</a-col>
|
|
|
|
+ <a-col :md="16" :sm="24" style="text-align:right;">
|
|
|
|
+ <a-button
|
|
|
|
+ type="link"
|
|
|
|
+ class="button-info"
|
|
|
|
+ id="salesEdit-import-product"
|
|
|
|
+ @click="openGuideModal=true"><a-icon type="login" /> 导入产品</a-button>
|
|
|
|
+ <a-button
|
|
|
|
+ id="salesEdit-new-product"
|
|
|
|
+ type="link"
|
|
|
|
+ class="button-info"
|
|
|
|
+ @click="openCpModal"><a-icon type="plus" /> 添加产品</a-button>
|
|
|
|
+ </a-col>
|
|
</a-row>
|
|
</a-row>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
@@ -365,6 +365,12 @@ export default {
|
|
warehouseLoad (sn, list) {
|
|
warehouseLoad (sn, list) {
|
|
this.warehouseDataList = list
|
|
this.warehouseDataList = list
|
|
},
|
|
},
|
|
|
|
+ // 产品分类 change
|
|
|
|
+ changeProductType (val, opt) {
|
|
|
|
+ this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
|
|
|
|
+ this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
|
|
|
|
+ this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
|
|
|
|
+ },
|
|
// 表格选中项
|
|
// 表格选中项
|
|
rowSelectionFun (obj) {
|
|
rowSelectionFun (obj) {
|
|
this.rowSelectionInfo = obj || null
|
|
this.rowSelectionInfo = obj || null
|
|
@@ -390,11 +396,34 @@ export default {
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ // 删除产品
|
|
|
|
+ handleDel (row) {
|
|
|
|
+ const _this = this
|
|
|
|
+ this.$confirm({
|
|
|
|
+ title: '提示',
|
|
|
|
+ content: '确认要删除吗?',
|
|
|
|
+ centered: true,
|
|
|
|
+ closable: true,
|
|
|
|
+ onOk () {
|
|
|
|
+ _this.delLoading = true
|
|
|
|
+ _this.spinning = true
|
|
|
|
+ salesDetailDel({ salesBillDetailSn: row.salesBillDetailSn, salesBillSn: _this.salesBillSn }).then(res => {
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ _this.$message.success(res.message)
|
|
|
|
+ _this.$refs.table.refresh(false)
|
|
|
|
+ _this.$emit('refash', 'normal', 'del')
|
|
|
|
+ }
|
|
|
|
+ _this.delLoading = false
|
|
|
|
+ _this.spinning = false
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
// 删除全部已选产品
|
|
// 删除全部已选产品
|
|
handleBatchDelAll () {
|
|
handleBatchDelAll () {
|
|
const _this = this
|
|
const _this = this
|
|
if (_this.dataSource.length == 0) {
|
|
if (_this.dataSource.length == 0) {
|
|
- _this.$message.warning('暂无可删除的已选产品!')
|
|
|
|
|
|
+ _this.$message.warning('暂无可删除的产品!')
|
|
return
|
|
return
|
|
}
|
|
}
|
|
this.$confirm({
|
|
this.$confirm({
|
|
@@ -405,7 +434,7 @@ export default {
|
|
_this.spinning = true
|
|
_this.spinning = true
|
|
deleteAll({ salesBillSn: _this.salesBillSn }).then(res => {
|
|
deleteAll({ salesBillSn: _this.salesBillSn }).then(res => {
|
|
if (res.status == 200) {
|
|
if (res.status == 200) {
|
|
- _this.$refs.table.refresh(false)
|
|
|
|
|
|
+ _this.resetSearchForm()
|
|
// 触发事件给父级组件
|
|
// 触发事件给父级组件
|
|
_this.$emit('refash', 'normal', 'batchDel')
|
|
_this.$emit('refash', 'normal', 'batchDel')
|
|
_this.$message.success(res.message)
|
|
_this.$message.success(res.message)
|
|
@@ -418,14 +447,11 @@ export default {
|
|
// 批量删除已选产品
|
|
// 批量删除已选产品
|
|
handleBatchDel () {
|
|
handleBatchDel () {
|
|
const _this = this
|
|
const _this = this
|
|
- if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
|
|
|
|
|
|
+ if (!_this.selectTotal) {
|
|
_this.$message.warning('请先选择要批量删除的产品!')
|
|
_this.$message.warning('请先选择要批量删除的产品!')
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- const obj = []
|
|
|
|
- _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows.map(item => {
|
|
|
|
- obj.push(item.salesBillDetailSn)
|
|
|
|
- })
|
|
|
|
|
|
+ const obj = _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows.map(item => item.salesBillDetailSn) || []
|
|
this.$confirm({
|
|
this.$confirm({
|
|
title: '提示',
|
|
title: '提示',
|
|
content: '已选产品' + obj.length + '项,确认要批量删除吗?',
|
|
content: '已选产品' + obj.length + '项,确认要批量删除吗?',
|
|
@@ -437,7 +463,7 @@ export default {
|
|
salesBillDetailSnList: obj
|
|
salesBillDetailSnList: obj
|
|
}).then(res => {
|
|
}).then(res => {
|
|
if (res.status == 200) {
|
|
if (res.status == 200) {
|
|
- _this.$refs.table.refresh(false)
|
|
|
|
|
|
+ _this.clearTable()
|
|
// 触发事件给父级组件
|
|
// 触发事件给父级组件
|
|
_this.$emit('refash', 'normal', 'batchDel')
|
|
_this.$emit('refash', 'normal', 'batchDel')
|
|
_this.$message.success(res.message)
|
|
_this.$message.success(res.message)
|
|
@@ -457,7 +483,7 @@ export default {
|
|
}
|
|
}
|
|
this.setWarehouseInfo(ajax_data)
|
|
this.setWarehouseInfo(ajax_data)
|
|
},
|
|
},
|
|
- // 选择仓库确认
|
|
|
|
|
|
+ // 全部或批量仓库设置确认
|
|
chooseWarehouseOk (sn) {
|
|
chooseWarehouseOk (sn) {
|
|
const _this = this
|
|
const _this = this
|
|
const snArr = []
|
|
const snArr = []
|
|
@@ -468,7 +494,7 @@ export default {
|
|
warehouseSn: sn,
|
|
warehouseSn: sn,
|
|
salesBillDetailSnList: snArr,
|
|
salesBillDetailSnList: snArr,
|
|
salesBillSn: _this.salesBillSn,
|
|
salesBillSn: _this.salesBillSn,
|
|
- allFlag: _this.warehouseTit ? true : undefined
|
|
|
|
|
|
+ allFlag: snArr.length == 0 ? true : undefined
|
|
}
|
|
}
|
|
_this.setWarehouseInfo(ajax_data)
|
|
_this.setWarehouseInfo(ajax_data)
|
|
},
|
|
},
|
|
@@ -480,23 +506,21 @@ export default {
|
|
if (res.status == 200) {
|
|
if (res.status == 200) {
|
|
_this.$message.success(res.message)
|
|
_this.$message.success(res.message)
|
|
_this.$emit('refash', 'promo', 'update')
|
|
_this.$emit('refash', 'promo', 'update')
|
|
|
|
+ if (data.allFlag) {
|
|
|
|
+ _this.resetSearchForm()
|
|
|
|
+ } else {
|
|
|
|
+ _this.clearTable()
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- _this.$refs.table.refresh(false)
|
|
|
|
_this.openWarehouseModal = false
|
|
_this.openWarehouseModal = false
|
|
_this.spinning = false
|
|
_this.spinning = false
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- // 产品分类 change
|
|
|
|
- changeProductType (val, opt) {
|
|
|
|
- this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
|
|
|
|
- this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
|
|
|
|
- this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
|
|
|
|
- },
|
|
|
|
// 操作下拉菜单
|
|
// 操作下拉菜单
|
|
handleMenuClick (e) {
|
|
handleMenuClick (e) {
|
|
const _this = this
|
|
const _this = this
|
|
if (e.key == 0) { // 仓库设置
|
|
if (e.key == 0) { // 仓库设置
|
|
- if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
|
|
|
|
|
|
+ if (!this.selectTotal) {
|
|
_this.$message.warning('请先选择要设置的产品!')
|
|
_this.$message.warning('请先选择要设置的产品!')
|
|
} else {
|
|
} else {
|
|
_this.openWarehouseModal = true
|
|
_this.openWarehouseModal = true
|
|
@@ -505,7 +529,6 @@ export default {
|
|
} else if (e.key == 1) { // 删除已选项
|
|
} else if (e.key == 1) { // 删除已选项
|
|
this.handleBatchDel()
|
|
this.handleBatchDel()
|
|
} else if (e.key == 3) {
|
|
} else if (e.key == 3) {
|
|
- _this.$refs.table.clearSelected()
|
|
|
|
_this.warehouseTit = '全部仓库设置'
|
|
_this.warehouseTit = '全部仓库设置'
|
|
_this.openWarehouseModal = true
|
|
_this.openWarehouseModal = true
|
|
} else {
|
|
} else {
|
|
@@ -535,7 +558,7 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 重置查询
|
|
// 重置查询
|
|
- resetSearchForm (flag) {
|
|
|
|
|
|
+ resetSearchForm () {
|
|
this.queryParam.productCode = ''
|
|
this.queryParam.productCode = ''
|
|
this.queryParam.productName = ''
|
|
this.queryParam.productName = ''
|
|
this.queryParam.warehouseSn = undefined
|
|
this.queryParam.warehouseSn = undefined
|
|
@@ -545,9 +568,16 @@ export default {
|
|
this.queryParam.productTypeSn3 = ''
|
|
this.queryParam.productTypeSn3 = ''
|
|
this.productType = []
|
|
this.productType = []
|
|
this.$refs.table.clearSelected()
|
|
this.$refs.table.clearSelected()
|
|
- this.$refs.table.refresh(!!flag)
|
|
|
|
|
|
+ this.rowSelectionInfo = null
|
|
|
|
+ this.$refs.table.refresh(true)
|
|
},
|
|
},
|
|
- // 参与促销
|
|
|
|
|
|
+ // 清空选项并查询当前页
|
|
|
|
+ clearTable () {
|
|
|
|
+ this.$refs.table.clearSelected()
|
|
|
|
+ this.rowSelectionInfo = null
|
|
|
|
+ this.$refs.table.refresh(false)
|
|
|
|
+ },
|
|
|
|
+ // 参与促销选择弹框
|
|
handleAddPromo (record) {
|
|
handleAddPromo (record) {
|
|
this.$refs.updateActive.getActiveList({
|
|
this.$refs.updateActive.getActiveList({
|
|
productSn: record.productSn,
|
|
productSn: record.productSn,
|
|
@@ -575,29 +605,6 @@ export default {
|
|
this.openUpActiveModal = false
|
|
this.openUpActiveModal = false
|
|
this.$refs.table.refresh(false)
|
|
this.$refs.table.refresh(false)
|
|
},
|
|
},
|
|
- // 删除产品
|
|
|
|
- handleDel (row) {
|
|
|
|
- const _this = this
|
|
|
|
- this.$confirm({
|
|
|
|
- title: '提示',
|
|
|
|
- content: '确认要删除吗?',
|
|
|
|
- centered: true,
|
|
|
|
- closable: true,
|
|
|
|
- onOk () {
|
|
|
|
- _this.delLoading = true
|
|
|
|
- _this.spinning = true
|
|
|
|
- salesDetailDel({ salesBillDetailSn: row.salesBillDetailSn, salesBillSn: _this.salesBillSn }).then(res => {
|
|
|
|
- if (res.status == 200) {
|
|
|
|
- _this.$message.success(res.message)
|
|
|
|
- _this.$refs.table.refresh(false)
|
|
|
|
- _this.$emit('refash', 'normal', 'del')
|
|
|
|
- }
|
|
|
|
- _this.delLoading = false
|
|
|
|
- _this.spinning = false
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
// 保存添加的产品到销售列表
|
|
// 保存添加的产品到销售列表
|
|
saveNewProduct (row, promotionFlag) {
|
|
saveNewProduct (row, promotionFlag) {
|
|
// 防止多次添加产品
|
|
// 防止多次添加产品
|
|
@@ -626,7 +633,7 @@ export default {
|
|
}).then(res => {
|
|
}).then(res => {
|
|
if (res.status == 200) {
|
|
if (res.status == 200) {
|
|
this.$message.success('产品添加成功', 2.5)
|
|
this.$message.success('产品添加成功', 2.5)
|
|
- this.resetSearchForm(true)
|
|
|
|
|
|
+ this.resetSearchForm()
|
|
// 触发事件给父级组件
|
|
// 触发事件给父级组件
|
|
this.$emit('refash', 'normal', 'add')
|
|
this.$emit('refash', 'normal', 'add')
|
|
}
|
|
}
|
|
@@ -650,7 +657,7 @@ export default {
|
|
salesBatchInsert(params).then(res => {
|
|
salesBatchInsert(params).then(res => {
|
|
if (res.status == 200) {
|
|
if (res.status == 200) {
|
|
this.$message.success('产品导入成功', 2.5)
|
|
this.$message.success('产品导入成功', 2.5)
|
|
- this.resetSearchForm(true)
|
|
|
|
|
|
+ this.resetSearchForm()
|
|
// 触发事件给父级组件
|
|
// 触发事件给父级组件
|
|
this.$emit('refash', 'normal', 'import')
|
|
this.$emit('refash', 'normal', 'import')
|
|
}
|
|
}
|