Browse Source

修复商家添加商品时添加元素不能添加价格bug,修复买家购买后未评价订单中却显示已评价bug

Zhengy 7 years ago
parent
commit
1cb52c1265
3 changed files with 96 additions and 53 deletions
  1. 2 1
      src/mock/index.js
  2. 3 1
      src/view/buyer/Order.vue
  3. 91 51
      src/view/shop/AddGood.vue

+ 2 - 1
src/mock/index.js

@@ -1047,7 +1047,8 @@ Mock.mock('http://www.Zhengy.com/api/paySuccess',function(options){
 		"id":id,
 		"shopId":req.shopId,
 		"goodId":req.goodId,
-		"madeTags":req.madeTags
+		"madeTags":req.madeTags,
+		"evaluate":""
 	}
 	accountInfo[2][index1].boughtList.push(bought);
 	code=200;

+ 3 - 1
src/view/buyer/Order.vue

@@ -72,6 +72,7 @@ import QRcode from '@xkeshi/vue-qrcode'
 	      		this.price=res.data.res.price;
 	      		this.evaluate=res.data.res.evaluate;
 	      		this.madeTags=res.data.res.madeTags;
+	      		console.log(this.evaluate)
 	      		if(this.evaluate==""){
 							this.active=2;
 						}else{
@@ -186,7 +187,8 @@ import QRcode from '@xkeshi/vue-qrcode'
 		padding: 10px 40px;
 	}
 	.price{
-		margin-top: 20px;
+		display: block;
+		margin: 20px auto;
 	}
 
 	.orderCompletion{

+ 91 - 51
src/view/shop/AddGood.vue

@@ -47,23 +47,30 @@
 				<h6>{{item.type}}</h6>
 				<div>
 					<el-tag
-					  v-for="tag in item.list"
-					  :key="tag"
-					  closable
-					  :disable-transitions="false"
-					  @close="handleClose(tag,item.id)">
-					  {{tag}}
-					</el-tag>
+            v-for="(tag,index) in item.list"
+            :key="index"
+            closable
+            :disable-transitions="false"
+            @close="handleClose(tag,item.id)">
+            {{tag.name}}
+          </el-tag>
 					<el-input
-					  class="input-new-tag"
-					  v-if="item.inputVisible"
-					  v-model="inputValue"
-					  :ref="item.type"
-					  size="small"
-					  @keyup.enter.native="handleInputConfirm(item.id)"
-					  @blur="handleInputConfirm(item.id)"
-					>
-					</el-input>
+            class="input-new-tag"
+            v-if="item.inputVisible"
+            v-model="inputValue1"
+            :ref="item.type"
+            size="small"
+            placeholder="标签名称"
+          ></el-input>
+          <el-input
+            class="input-new-tag"
+            v-if="item.inputVisible"
+            v-model="inputValue2"
+            :ref="item.type"
+            size="small"
+            placeholder="标签价格"
+          ></el-input>
+          <el-button v-if="item.inputVisible" class="button-new-tag" @click="handleInputConfirm(item.id)">确定</el-button>
 					<el-button v-else class="button-new-tag" @click="showInput(item.id,item.type)">+ 添加新元素</el-button>
 				</div>
 			</div>
@@ -77,23 +84,32 @@
           </el-form-item>
           <el-form-item label="元素标签">
             <el-tag
-						  v-for="tag in showItem.list"
-						  :key="tag"
-						  closable
-						  :disable-transitions="false"
-						  @close="handleClose(tag,-1)">
-						  {{tag}}
-						</el-tag>
-						<el-input
-						  class="input-new-tag"
-						  v-if="showItem.inputVisible"
-						  v-model="inputValue"
-						  ref="saveTagInput"
-						  size="small"
-						  @keyup.enter.native="handleInputConfirm(-1)"
-						  @blur="handleInputConfirm(-1)"
-						>
-						</el-input>
+              v-for="(tag,index) in showItem.list"
+              :key="index"
+              closable
+              :disable-transitions="false"
+              @close="handleClose(tag,-1)">
+              {{tag.name}}
+            </el-tag>
+            <el-input
+              class="input-new-tag"
+              v-if="showItem.inputVisible"
+              v-model="inputValue1"
+              ref="saveTagInput"
+              size="small"
+              placeholder="标签名称"
+            >
+            </el-input>
+            <el-input
+              class="input-new-tag"
+              v-if="showItem.inputVisible"
+              v-model="inputValue2"
+              ref="saveTagInput"
+              size="small"
+              placeholder="标签价格"
+            >
+            </el-input>
+            <el-button v-if="showItem.inputVisible" class="button-new-tag" @click="handleInputConfirm(-1)">确定</el-button>
 						<el-button v-else class="button-new-tag" size="small" @click="showInput(-1,showItem.type)">+ 添加新元素</el-button>
           </el-form-item>
           <el-form-item>
@@ -118,7 +134,8 @@
 				tags:[],
 				commentsList:[],
 				inputVisible: false,
-        inputValue: '',
+        inputValue1: '',
+        inputValue2: '',
         dialogTableVisible:false,
         showItem:{
         	type:"",
@@ -163,33 +180,56 @@
       	}
       },
       showInput(id,type) {
+        console.log(id)
       	if(id!=-1){
       		this.tags[id].inputVisible = true;
-      		this.$nextTick(_ => {
-      			this.$refs[type][0].$refs.input.focus();
-	        });
+      		// this.$nextTick(_ => {
+      		// 	this.$refs[type][0].$refs.input.focus();
+	       //  });
       	}else{
       		this.showItem.inputVisible = true;
-      		this.$nextTick(_ => {
-	        	this.$refs.saveTagInput.$refs.input.focus();
-	        });
+      		// this.$nextTick(_ => {
+	       //  	this.$refs.saveTagInput.$refs.input.focus();
+	       //  });
       	}
         
       },
       handleInputConfirm(id) {
-        let inputValue = this.inputValue;
-        if (inputValue&&id!=-1) {
-          this.tags[id].list.push(inputValue);
+        let inputValue1 = this.inputValue1;
+        let inputValue2 = this.inputValue2;
+        if (inputValue1&&inputValue2&&id!=-1) {
+          var tag={
+            name:inputValue1,
+            price:inputValue2
+          }
+          this.tags[id].list.push(tag);
+          // let param = {
+          //   shopId:this.$store.state.userMess.id,
+          //   goodId:this.$route.params.id.slice(1),
+          //   id:id,
+          //   list:this.tagList[id].list,
+          // }
+          // this.axios.post(this.Api.changeTags,param).then((res)=>{
+          //   console.log(res)
+          // }).catch((err)=>{
+          //   console.log("handleInputConfirm:"+err);
+          // });
           this.tags[id].inputVisible = false;
-        }else if(inputValue&&id==-1){
-        	this.showItem.list.push(inputValue);
-        	this.showItem.inputVisible = false;
-        }else if(inputValue==""&&id!=-1){
-        	this.tags[id].inputVisible = false;
-        }else if(inputValue==""&&id==-1){
-        	this.showItem.inputVisible = false;
+        }else if(inputValue1&&inputValue2&&id==-1){
+          var tag={
+            name:inputValue1,
+            price:inputValue2
+          }
+          this.showItem.list.push(tag);
+          this.showItem.inputVisible = false
+        }else if(id!=-1&&(inputValue1==""||inputValue2=="")){
+          this.tagList[id].inputVisible = false;
+        }else if(id==-1&&(inputValue1==""||inputValue2=="")){
+
+          this.showItem.inputVisible = false;
         }
-        this.inputValue = '';
+        this.inputValue1 = '';
+        this.inputValue2 = '';
       },
       toCancel(){
       	this.dialogTableVisible=false;