Browse Source

大转盘设置bug修改

1004749546@qq.com 4 years ago
parent
commit
f403627b87
1 changed files with 16 additions and 6 deletions
  1. 16 6
      src/views/market/addlotterySetModal.vue

+ 16 - 6
src/views/market/addlotterySetModal.vue

@@ -543,15 +543,24 @@ export default {
     // 抽奖规则
     // 抽奖规则
     cjGzChange (val) {
     cjGzChange (val) {
       console.log(val)
       console.log(val)
-      this.form.luckyDrawTaskList = []
+      // this.form.luckyDrawTaskList = []
       this.form.cjGz && this.form.cjGz.map(item => {
       this.form.cjGz && this.form.cjGz.map(item => {
         const row = this.cjGz.find(k => k.code == item)
         const row = this.cjGz.find(k => k.code == item)
-        this.form.luckyDrawTaskList.push({
-          taskCode: item,
-          taskCodeDictValue: row.dispName,
-          giveTimes: ''
-        })
+		const hasRow = this.form.luckyDrawTaskList.find(m => m.taskCode == item)
+		if(!hasRow) {
+			this.form.luckyDrawTaskList.push({
+			  taskCode: item,
+			  taskCodeDictValue: row.dispName,
+			  giveTimes: ''
+			})
+		}
       })
       })
+	  this.form.luckyDrawTaskList.map((key,index) => {
+	  	const has = this.form.cjGz && this.form.cjGz.indexOf(key.taskCode)
+		if(has == -1) {
+			this.form.luckyDrawTaskList.splice(index,1)
+		}
+	  })
     },
     },
     // 保存
     // 保存
     onSubmit () {
     onSubmit () {
@@ -625,6 +634,7 @@ export default {
             }
             }
           })
           })
           this.form = Object.assign({}, this.form, res.data)
           this.form = Object.assign({}, this.form, res.data)
+		  console.log(this.form,'this.form')
           this.form.isPeopleLimit = this.form.isPeopleLimit == 1
           this.form.isPeopleLimit = this.form.isPeopleLimit == 1
           this.form.time = [moment(this.form.activeStartTime), moment(this.form.activeEndTime)]
           this.form.time = [moment(this.form.activeStartTime), moment(this.form.activeEndTime)]
           this.form.zjXz = this.getGzVal(this.form.luckyDrawWinPrizeLimitList, 0)
           this.form.zjXz = this.getGzVal(this.form.luckyDrawWinPrizeLimitList, 0)