瀏覽代碼

活动选项答案调整

pengyh 1 年之前
父節點
當前提交
6f3963cc82
共有 1 個文件被更改,包括 31 次插入18 次删除
  1. 31 18
      src/views/mallManagement/activityOrder/detail.vue

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

@@ -98,8 +98,8 @@
 			        v-for="(it, idx) in item.answer"
 			        v-for="(it, idx) in item.answer"
 			        :key="idx"
 			        :key="idx"
 			        @click="clickOption(index, idx)">
 			        @click="clickOption(index, idx)">
-			        <el-image class="image" :src="returnUrl(it)" mode="aspectFill"></el-image>
-			        <div class="text">{{it.option_value}}</div>
+			        <el-image v-if="item.answerType != 2" class="image" :src="returnUrl(it)" mode="aspectFill"></el-image>
+			        <div class="text" v-if="item.answerType != 3">{{it.option_value}}</div>
 			      </div>
 			      </div>
 			    </div>
 			    </div>
 			    <div class="text-list" v-else>
 			    <div class="text-list" v-else>
@@ -117,9 +117,13 @@
 			    <div class="label"><span v-if="item.isRequire">*</span>{{item.question}}</div>
 			    <div class="label"><span v-if="item.isRequire">*</span>{{item.question}}</div>
 				<el-input type="text" v-model="item.inputValue" show-word-limit :maxlength="item.answer[0].option_limit" :disabled="formType!=0" :placeholder="`请输入${item.question}`"></el-input>
 				<el-input type="text" v-model="item.inputValue" show-word-limit :maxlength="item.answer[0].option_limit" :disabled="formType!=0" :placeholder="`请输入${item.question}`"></el-input>
 			  </div>
 			  </div>
+			  <div class="input-container" v-else-if="item.type == 4">
+			    <div class="label"><span v-if="item.isRequire">*</span>{{item.question}}</div><br/>
+				<ImageUpload :fileList="item.inputValue" :limit="Number(item.answer[0].option_limit)" :isEdit="formType==0" :fileType="['image']"/>
+			  </div>
 			  <div class="input-container" v-else>
 			  <div class="input-container" v-else>
 			    <div class="label"><span v-if="item.isRequire">*</span>{{item.question}}</div><br/>
 			    <div class="label"><span v-if="item.isRequire">*</span>{{item.question}}</div><br/>
-				<ImageUpload :fileList="item.inputValue" :limit="1" :isEdit="formType==0" :fileType="['image','video']"/>
+			  	<ImageUpload :fileList="item.inputValue" :limit="Number(item.answer[0].option_limit)" :isEdit="formType==0" :fileType="['video']"/>
 			  </div>
 			  </div>
 			</div>
 			</div>
 		</el-card>
 		</el-card>
@@ -245,7 +249,24 @@
 						active: {id: res.data.promotionQuestionnaireId}
 						active: {id: res.data.promotionQuestionnaireId}
 					})
 					})
 					this.status = res.data.status
 					this.status = res.data.status
-					this.getActiveDetail(res.data.promotionQuestionnaireId,res.data.items)
+					res.data.items.forEach(item=>{
+						item.answer = JSON.parse(item.answer)
+						
+						item.answer.forEach(it => {
+							if(item.type == 3){
+								item.inputValue = it.option_value
+							}else if(item.type == 4 || item.type == 5){
+								let img = []
+								it.option_value.forEach(t=>{
+									img.push({url: t})
+								})
+								console.log(it.option_value,img)
+								item.inputValue = img
+							}
+						})
+					})
+					this.activeItems = res.data.items
+					// this.getActiveDetail(res.data.promotionQuestionnaireId,res.data.items)
 				})
 				})
 			},
 			},
 			getActiveList(){
 			getActiveList(){
@@ -273,18 +294,6 @@
 										}
 										}
 									})
 									})
 								})
 								})
-								// 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{
 						}else{
 							if(item.type == 4 || item.type == 5){
 							if(item.type == 4 || item.type == 5){
@@ -340,7 +349,7 @@
 							for(let index = 0; index < activeItems.length; index++) {
 							for(let index = 0; index < activeItems.length; index++) {
 							  // 单选题多选题
 							  // 单选题多选题
 							  if ((activeItems[index].type == 1 || activeItems[index].type == 2)) {
 							  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);
 							    activeItems[index].answer = JSON.stringify(activeItems[index].answer);
 							    items.push(activeItems[index]);
 							    items.push(activeItems[index]);
 							  }
 							  }
@@ -352,7 +361,11 @@
 							  }
 							  }
 							  // 图片视频
 							  // 图片视频
 							  if (activeItems[index].type == 4 || activeItems[index].type == 5) {
 							  if (activeItems[index].type == 4 || activeItems[index].type == 5) {
-							    activeItems[index].answer[0].option_value = activeItems[index].inputValue.length>0?activeItems[index].inputValue[0].url:'';
+								  let option_value = []
+								  activeItems[index].inputValue.forEach(item=>{
+									  option_value.push(item.url)
+								  })
+							    activeItems[index].answer[0].option_value = option_value
 							    activeItems[index].answer = JSON.stringify(activeItems[index].answer);
 							    activeItems[index].answer = JSON.stringify(activeItems[index].answer);
 							    items.push(activeItems[index]);
 							    items.push(activeItems[index]);
 							  }
 							  }