Browse Source

Merge branch 'develop' of https://gogs.zfire.top/zfire-front/zfire-newmall-admin into develop

linwenxin 1 year ago
parent
commit
be23a62889
1 changed files with 30 additions and 18 deletions
  1. 30 18
      src/views/mallManagement/activityOrder/detail.vue

+ 30 - 18
src/views/mallManagement/activityOrder/detail.vue

@@ -54,7 +54,7 @@
 						</el-col>
 						<el-col :span="6">
 							<el-form-item label="客户电话" prop="userMobile">
-								<el-input type="number" :disabled="formType!=0" v-model="formData.userMobile" placeholder="请输入"></el-input>
+								<el-input type="text" :disabled="formType!=0" :maxlength="11" v-model="formData.userMobile" placeholder="请输入"></el-input>
 							</el-form-item>
 						</el-col>
 						<el-col :span="6">
@@ -200,9 +200,6 @@
 						{ required: true, message: `请输入客户电话`, trigger: 'change' },
 						{ pattern:/^((0\d{2,3}-\d{7,8})|(1[3456789]\d{9}))$/, message: '电话号码格式不正确', trigger: 'blur' }
 					],
-					userMobile2: [
-						{ required: true, message: '请输入客户电话或座机', trigger: 'blur' }
-					],
 					userName: [
 						{ required: true, message: '请输入客户名称', trigger: 'blur' }
 					],
@@ -231,6 +228,7 @@
 			}
 			if(this.activeId){
 				this.formData.active = {id: this.activeId}
+				this.formData.promotionActivityId = this.activeId
 				this.getActiveDetail(this.activeId)
 			}
 			this.getActiveList()
@@ -261,19 +259,32 @@
 					res.data.promotionQuestionnaireItems.forEach((item,index)=>{
 						item.answer = JSON.parse(item.answer)
 						if(items){
-							item.answer.forEach((it,ind) => {
-								let data = JSON.parse(items[index].answer)
-								console.log(data[ind]?.option_value,it.option_value)
-								if(data[ind]?.active && data[ind]?.option_value == it.option_value){
-									it.active = true;
-								}else{
-									it.active = false;
-								}
-								if(items[index].type == 3){
-									item.inputValue = data[ind]?.option_value
-								}else if(item.type == 4 || item.type == 5){
-									item.inputValue = [{url: data[ind]?.option_value}]
-								}
+							item.answer.forEach(it1 => {
+								items.forEach(it2=>{
+									JSON.parse(it2.answer).forEach(t=>{
+										if(item.id == it2.id && t.active && it1.option_value == t.option_value){
+											console.log(t.option_value)
+											it1.active = true;
+										}
+										if(it2.type == 3){
+											item.inputValue = t.option_value
+										}else if(it2 == 4 || it2 == 5){
+											item.inputValue = [{url: t.option_value}]
+										}
+									})
+								})
+								// let data = JSON.parse(items[index].answer)
+								// console.log(data[ind]?.option_value,it.option_value)
+								// if(data[ind]?.active && data[ind]?.option_value == it.option_value){
+								// 	it.active = true;
+								// }else{
+								// 	it.active = false;
+								// }
+								// if(items[index].type == 3){
+								// 	item.inputValue = data[ind]?.option_value
+								// }else if(item.type == 4 || item.type == 5){
+								// 	item.inputValue = [{url: data[ind]?.option_value}]
+								// }
 							})
 						}else{
 							if(item.type == 4 || item.type == 5){
@@ -287,6 +298,7 @@
 						}
 					})
 					this.activeItems = res.data.promotionQuestionnaireItems
+					console.log(this.activeItems,111)
 				})
 			},
 			clickOption(index, idx) {
@@ -328,7 +340,7 @@
 							for(let index = 0; index < activeItems.length; index++) {
 							  // 单选题多选题
 							  if ((activeItems[index].type == 1 || activeItems[index].type == 2)) {
-							    // activeItems[index].answer = activeItems[index].answer.filter(o => o.active);
+							    activeItems[index].answer = activeItems[index].answer.filter(o => o.active);
 							    activeItems[index].answer = JSON.stringify(activeItems[index].answer);
 							    items.push(activeItems[index]);
 							  }