|
|
@@ -41,8 +41,8 @@
|
|
|
|
|
|
<!-- 操作按钮区域 -->
|
|
|
<div class="table-operator">
|
|
|
- <a-button v-if="sellClear == 1" @click="handleAdd">立即沽清</a-button>
|
|
|
- <a-button v-if="sellClear == 2" @click="handleDelete">取消沽清</a-button>
|
|
|
+ <a-button @click="handleAdd">立即沽清</a-button>
|
|
|
+ <a-button @click="handleDelete">取消沽清</a-button>
|
|
|
</div>
|
|
|
|
|
|
<div>
|
|
|
@@ -151,8 +151,20 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
handleDelete() {
|
|
|
+
|
|
|
+ let selectArr = this.dataSource.filter((t) => t.sort == 888888)
|
|
|
+ if (!selectArr.length) {
|
|
|
+ this.$message.warning("请选择取消沽清商品");
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (selectArr.some(ele=>!ele.isSellClear)) {
|
|
|
+ this.$message.warning("未沽清商品不能取消沽清");
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let modelArr = selectArr.map(ele=>ele.id)
|
|
|
+ console.log(modelArr);
|
|
|
deleteAction("/pos/posSellClearGoods/delete", {
|
|
|
- goodsId: this.selectGoods.id,
|
|
|
+ goodsId: modelArr.join(",")
|
|
|
})
|
|
|
.then((res) => {
|
|
|
if (res.success) {
|
|
|
@@ -171,7 +183,19 @@ export default {
|
|
|
if (_info) {
|
|
|
model.hotelId = _info.id;
|
|
|
}
|
|
|
- postAction("/pos/posSellClearGoods/add", model)
|
|
|
+ console.log(model,this.dataSource);
|
|
|
+ let selectArr = this.dataSource.filter((t) => t.sort == 888888)
|
|
|
+ if (!selectArr.length) {
|
|
|
+ this.$message.warning("请选择沽清商品");
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (selectArr.some(ele=>ele.isSellClear)) {
|
|
|
+ this.$message.warning("已沽清商品不能重复沽清");
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let modelArr = selectArr.map(ele=>({ goodsId: ele.id,hotelId:_info.id }))
|
|
|
+ console.log(modelArr);
|
|
|
+ postAction("/pos/posSellClearGoods/add", modelArr)
|
|
|
.then((res) => {
|
|
|
if (res.success) {
|
|
|
this.$message.success(res.message);
|
|
|
@@ -187,10 +211,10 @@ export default {
|
|
|
console.log(row);
|
|
|
if (row.sort != 888888) {
|
|
|
this.selectGoods = row;
|
|
|
- var list = this.dataSource.filter((t) => (t) => t.sort == 888888);
|
|
|
- list.forEach((t) => {
|
|
|
- t.sort = 0;
|
|
|
- });
|
|
|
+ // var list = this.dataSource.filter((t) => (t) => t.sort == 888888);
|
|
|
+ // list.forEach((t) => {
|
|
|
+ // t.sort = 0;
|
|
|
+ // });
|
|
|
row.sort = 888888;
|
|
|
if (row.isSellClear) {
|
|
|
this.sellClear = 2;
|