|
@@ -246,6 +246,7 @@
|
|
|
v-model="scope.row.walletRebateId"
|
|
|
placeholder="请选择返利类型"
|
|
|
@change="handelRebateList($event, scope.$index, scope.row)"
|
|
|
+ @remove-tag="handleRemove2($event, scope.$index, scope.row)"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="(item, index) in scope.row.rebateList"
|
|
@@ -343,6 +344,7 @@
|
|
|
clearable
|
|
|
v-model="scope.row.walletsId"
|
|
|
@change="handelWallets($event, scope.$index, scope.row)"
|
|
|
+ @remove-tag="handleRemove($event, scope.$index, scope.row)"
|
|
|
placeholder="请选择现金钱包"
|
|
|
>
|
|
|
<el-option
|
|
@@ -359,6 +361,7 @@
|
|
|
clearable
|
|
|
v-model="scope.row.walletsId"
|
|
|
@change="handelWallets($event, scope.$index, scope.row)"
|
|
|
+ @remove-tag="handleRemove($event, scope.$index, scope.row)"
|
|
|
placeholder="请选择现金钱包"
|
|
|
>
|
|
|
<el-option
|
|
@@ -964,59 +967,75 @@ export default {
|
|
|
this.$set(this.items[index], "rebateList", rebateList);
|
|
|
// this.fang = false;
|
|
|
},
|
|
|
+ resArr(arr1, arr2) {
|
|
|
+ return arr1.filter((v) => arr2.every((val) => val.id != v.id));
|
|
|
+ },
|
|
|
// xua
|
|
|
handelWallets(e, index, row) {
|
|
|
- let id = row.cid;
|
|
|
-
|
|
|
+ let id = row.cid || row.id;
|
|
|
+ if (e && e.length) {
|
|
|
+ for (let i = 0; i < e.length; i++) {
|
|
|
if (!this.wall1.includes(e[e.length - 1])) {
|
|
|
- this.items[index].wallets.push({
|
|
|
- type: "COMMONLY",
|
|
|
- id: "",
|
|
|
- updPriceBillId: id,
|
|
|
- updPriceBillItemId: id,
|
|
|
- walletId: e[e.length - 1],
|
|
|
- });
|
|
|
+ this.$set(row, 'wallets',[
|
|
|
+ ...row.wallets,
|
|
|
+ {
|
|
|
+ type: "COMMONLY",
|
|
|
+ id: "",
|
|
|
+ updPriceBillId: id,
|
|
|
+ updPriceBillItemId: id,
|
|
|
+ walletId: e[e.length - 1],
|
|
|
+ },
|
|
|
+ ]);
|
|
|
+ this.wall1.push(e[e.length - 1])
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
- handelRebateList(e, index, row) {
|
|
|
- let id = row.cid;
|
|
|
- if (!this.wall2.includes(e[e.length - 1])) {
|
|
|
- this.items[index].rebateWallets.push({
|
|
|
- type: "REBATE",
|
|
|
- id: "",
|
|
|
- updPriceBillId: id,
|
|
|
- updPriceBillItemId: id,
|
|
|
- walletId: e[e.length - 1],
|
|
|
- });
|
|
|
+ handleRemove(e, index, row) {
|
|
|
+ console.log(e);
|
|
|
+ const copxyWall = JSON.parse(JSON.stringify(row.wallets))
|
|
|
+ for (let i = 0; i < row.wallets.length; i++) {
|
|
|
+ if (this.wall1.includes(e) && row.wallets[i].walletId==e) {
|
|
|
+ console.log(454);
|
|
|
+
|
|
|
+ this.wall1.splice(i,1)
|
|
|
+ copxyWall.splice(i,1)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.$set(row,'wallets',copxyWall)
|
|
|
+
|
|
|
+ },
|
|
|
+ handleRemove2(e, index, row) {
|
|
|
+ const copxyWall = JSON.parse(JSON.stringify(row.rebateWallets))
|
|
|
+ for (let i = 0; i < row.rebateWallets.length; i++) {
|
|
|
+ if (this.wall2.includes(e) && row.rebateWallets[i].walletId==e) {
|
|
|
+ copxyWall.splice(i,1)
|
|
|
+ this.wall2.splice(i,1)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.$set(row,'rebateWallets',copxyWall)
|
|
|
+
|
|
|
+ }
|
|
|
+,
|
|
|
+ handelRebateList(e, index, row) {
|
|
|
+ let id = row.cid || row.id;
|
|
|
+ if (e && e.length) {
|
|
|
+ for (let i = 0; i < e.length; i++) {
|
|
|
+ if (!this.wall2.includes(e[e.length - 1])) {
|
|
|
+ this.$set(row, "rebateWallets", [
|
|
|
+ ...row.rebateWallets,
|
|
|
+ {
|
|
|
+ type: "REBATE",
|
|
|
+ id: "",
|
|
|
+ updPriceBillId: id,
|
|
|
+ updPriceBillItemId: id,
|
|
|
+ walletId: e[e.length - 1],
|
|
|
+ },
|
|
|
+ ]);
|
|
|
+ this.wall2.push(e[e.length - 1])
|
|
|
}
|
|
|
- // for (let i = 0; i < e.length; i++) {
|
|
|
- // if (this.items[index].wallets.length) {
|
|
|
- // for (let j = 0; j < this.items[index].wallets.length; j++) {
|
|
|
- // if (e[i] !== this.items[index].wallets[j].walletId) {
|
|
|
- // this.$set(this.items[index], "wallets", [
|
|
|
- // ...this.items[index].wallets,
|
|
|
- // {
|
|
|
- // type: "REBATE",
|
|
|
- // id: "",
|
|
|
- // updPriceBillId: row.cid,
|
|
|
- // updPriceBillItemId: row.cid,
|
|
|
- // walletId: e[i],
|
|
|
- // },
|
|
|
- // ]);
|
|
|
- // }
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // this.$set(this.items[index], "rebateWallets", [
|
|
|
- // {
|
|
|
- // type: "REBATE",
|
|
|
- // id: "",
|
|
|
- // updPriceBillId: row.id,
|
|
|
- // updPriceBillItemId: row.id,
|
|
|
- // walletId: e[0],
|
|
|
- // },
|
|
|
- // ]);
|
|
|
- // }
|
|
|
- // }
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
handleUser(e) {
|
|
|
const adminCompany = this.userList.filter((k) => {
|
|
@@ -1161,13 +1180,13 @@ export default {
|
|
|
}
|
|
|
this.walleList = wall.data;
|
|
|
|
|
|
- let linshi = [];
|
|
|
if (this.$parent.show == 5) {
|
|
|
- let rebateList = [];
|
|
|
getProductRriceDetail({ id: this.cid }).then((res) => {
|
|
|
- // this.editData = res.data;
|
|
|
-
|
|
|
for (let i = 0; i < res.data.items.length; i++) {
|
|
|
+ let linshi = [];
|
|
|
+ let rebateList = [];
|
|
|
+ let walletIds = [];
|
|
|
+ let walletRebateIds = [];
|
|
|
res.data.items[i].isPublishArr = [
|
|
|
{
|
|
|
value: "是",
|
|
@@ -1189,62 +1208,48 @@ export default {
|
|
|
},
|
|
|
];
|
|
|
|
|
|
- let walletIds = [];
|
|
|
- let walletRebateIds = [];
|
|
|
- res.data.items[i].wallets = [];
|
|
|
res.data.items[i].walletsId = [];
|
|
|
res.data.items[i].walletRebateId = [];
|
|
|
+ res.data.items[i].rebateWallets = [];
|
|
|
+ res.data.items[i].wallets = [];
|
|
|
for (let p = 0; p < res.data.items[i].wallets2.length; p++) {
|
|
|
if (res.data.items[i].wallets2[p].type == "COMMONLY") {
|
|
|
walletIds.push(res.data.items[i].wallets2[p].walletId);
|
|
|
- this.$set(res.data.items[i], "walletsId", walletIds);
|
|
|
- res.data.items[i].wallets.push({
|
|
|
- type: "REBATE",
|
|
|
- id: "",
|
|
|
- updPriceBillId: res.data.items[i].updPriceBillId,
|
|
|
- updPriceBillItemId: res.data.items[i].updPriceBillId,
|
|
|
- walletId: res.data.items[i].wallets2[p].walletId,
|
|
|
- });
|
|
|
- } else {
|
|
|
- res.data.items[i].wallets.push({
|
|
|
- type: "COMMONLY",
|
|
|
- id: "",
|
|
|
- updPriceBillId: res.data.items[i].updPriceBillId,
|
|
|
- updPriceBillItemId: res.data.items[i].updPriceBillId,
|
|
|
- walletId: res.data.items[i].wallets2[p].walletId,
|
|
|
- });
|
|
|
+ this.$set(res.data.items[i],'wallets',[
|
|
|
+ ...res.data.items[i].wallets,
|
|
|
+ res.data.items[i].wallets2[p]
|
|
|
+ ])
|
|
|
+ } else if (res.data.items[i].wallets2[p].type == "REBATE") {
|
|
|
walletRebateIds.push(res.data.items[i].wallets2[p].walletId);
|
|
|
- this.$set(res.data.items[i], "walletRebateId", walletRebateIds);
|
|
|
+ this.$set(res.data.items[i],'rebateWallets',[
|
|
|
+ ...res.data.items[i].rebateWallets,
|
|
|
+ res.data.items[i].wallets2[p]
|
|
|
+ ])
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ this.$set(res.data.items[i], "walletsId", walletIds);
|
|
|
+ this.$set(res.data.items[i], "walletRebateId", walletRebateIds);
|
|
|
+ console.log(res.data.items[i].walletRebateId);
|
|
|
this.rebateList.forEach((k) => {
|
|
|
k.saleTypes.forEach((j) => {
|
|
|
- console.log(
|
|
|
- j.saleTypeId == res.data.items[i].saleTypeId,
|
|
|
- "545454"
|
|
|
- );
|
|
|
if (
|
|
|
!linshi.includes(j.saleTypeId) &&
|
|
|
j.saleTypeId == res.data.items[i].saleTypeId
|
|
|
) {
|
|
|
+ console.log(res.data.items[i].saleTypeId, "saleTypeId");
|
|
|
rebateList.push(k);
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
- console.log(rebateList, "444878787");
|
|
|
- res.data.items[i].rebateWallets = [];
|
|
|
|
|
|
- res.data.items[i].wallets = [];
|
|
|
res.data.items[i].walleList = this.walleList;
|
|
|
res.data.items[i].rebateList = rebateList;
|
|
|
-
|
|
|
- this.items = res.data.items;
|
|
|
- this.base = res.data;
|
|
|
-
|
|
|
res.data.items[i].fang = false;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ this.items = res.data.items;
|
|
|
+ this.base = res.data;
|
|
|
this.listLoading = false;
|
|
|
});
|
|
|
} else {
|
|
@@ -1281,21 +1286,18 @@ export default {
|
|
|
// 如果没有返回值则默认返回false(全部无法选中)
|
|
|
},
|
|
|
hanleSbumit() {
|
|
|
- for (let i = 0; i < this.items.length; i++) {
|
|
|
- if (!this.cid) {
|
|
|
- this.items[i].wallets = [
|
|
|
- ...this.items[i].rebateWallets,
|
|
|
- ...this.items[i].wallets,
|
|
|
- ];
|
|
|
- } else {
|
|
|
- }
|
|
|
+ console.log(this.items, 45454);
|
|
|
+ // for (let i = 0; i < this.items.length; i++) {
|
|
|
+ // this.items[i].wallets = [
|
|
|
+ // ...this.items[i].rebateWallets,
|
|
|
+ // ...this.items[i].wallets,
|
|
|
+ // ];
|
|
|
|
|
|
- console.log(this.items, 45454);
|
|
|
- if (!this.items[i].mainId) {
|
|
|
- this.$errorMsg("请选择销售类型");
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
+ // if (!this.items[i].mainId) {
|
|
|
+ // this.$errorMsg("请选择销售类型");
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
const params = {
|
|
|
...this.base,
|
|
|
items: this.items,
|
|
@@ -1312,8 +1314,15 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
hanleSave() {
|
|
|
+ console.log(this.items);
|
|
|
handleEdit({
|
|
|
- ...this.base,
|
|
|
+ ...this.base,
|
|
|
+ items: this.items,
|
|
|
+ saleTypeId: this.saleTypeId,
|
|
|
+ adminWebsitId: this.adminWebsitId,
|
|
|
+ serviceId: this.serviceId,
|
|
|
+ adminCompanyName: this.adminCompanyName,
|
|
|
+ serviceName: this.nickName,
|
|
|
}).then((res) => {
|
|
|
this.$successMsg("成功");
|
|
|
this.$parent.cid = "";
|