|
@@ -763,9 +763,36 @@ export default {
|
763
|
763
|
this.$message.error("不能选择相同的次卡");
|
764
|
764
|
return
|
765
|
765
|
}
|
|
766
|
+ let isProjectList = []
|
|
767
|
+ //判断是否重复选择次卡
|
|
768
|
+ let isTrueCode = false
|
|
769
|
+ this.cardList.forEach(res => {
|
|
770
|
+ if (res.isSelectCard) {
|
|
771
|
+ isProjectList = isProjectList.concat(res.project_ids)
|
|
772
|
+ }
|
|
773
|
+ })
|
|
774
|
+ if (item.isSelectCard) {
|
|
775
|
+ item.project_ids.forEach((_item,index) => {
|
|
776
|
+ isProjectList.forEach((item, i) => {
|
|
777
|
+ if (_item == item) {
|
|
778
|
+ isProjectList.splice(i, 1)
|
|
779
|
+ }
|
|
780
|
+ })
|
|
781
|
+ })
|
|
782
|
+ }
|
|
783
|
+ if (this.includes(isProjectList, item.project_ids)) {
|
|
784
|
+ isTrueCode = true
|
|
785
|
+ }
|
|
786
|
+ if (isTrueCode) {
|
|
787
|
+ this.$message.error('请勿重复选择次卡')
|
|
788
|
+ return
|
|
789
|
+ }
|
766
|
790
|
this.cardList[index].isSelect = !this.cardList[index].isSelect
|
767
|
791
|
|
768
|
792
|
},
|
|
793
|
+ includes(arr1, arr2) {
|
|
794
|
+ return arr2.every(val => arr1.includes(val));
|
|
795
|
+ },
|
769
|
796
|
//确定选择的次卡
|
770
|
797
|
isCardAdd () {
|
771
|
798
|
let isSelectCardList = []
|
|
@@ -774,6 +801,7 @@ export default {
|
774
|
801
|
let card_data = []
|
775
|
802
|
let card_data_info = {}
|
776
|
803
|
console.log(price, 'price');
|
|
804
|
+ let projectId = []
|
777
|
805
|
if (this.isSelectCoup.length > 0) {
|
778
|
806
|
this.isSelectCoup.forEach(res => {
|
779
|
807
|
this.order_data.project_list.forEach(item => {
|
|
@@ -787,11 +815,13 @@ export default {
|
787
|
815
|
|
788
|
816
|
project_list.forEach((res,index) => {
|
789
|
817
|
this.cardList.forEach(e => {
|
790
|
|
- if (e.isSelect && e.project_ids.indexOf(res.id) > -1) {
|
|
818
|
+ if (e.isSelect && e.project_ids.indexOf(res.id) > -1 && projectId.indexOf(res.id)==-1) {
|
|
819
|
+ projectId.push(res.id)
|
791
|
820
|
price = price - res.price
|
792
|
821
|
console.log(price);
|
793
|
822
|
price = price.toFixed(2)
|
794
|
823
|
isSelectCardList.push(res)
|
|
824
|
+ isSelectCardList=Array.from(new Set(isSelectCardList))
|
795
|
825
|
card_data_info = {
|
796
|
826
|
id: res.id,
|
797
|
827
|
card_id: e.id
|