YZM před 1 rokem
rodič
revize
edc0eaf6d0

+ 78 - 47
pages/luru/index.vue

@@ -32,10 +32,10 @@
 							<tm-input title="分类" placeholder="请选择分类" disabled :value="obTstrnew(category_danarr,'')" right-icon="icon-angle-right"></tm-input>
 						</tm-pickers> -->
 						<view v-for="(item,index) in arrbig">
-							<tm-pickers v-if="item.type=='select'"  @confirm="xuanze" :indexfu="index" :list="item.value">
+							<tm-pickers v-if="item.type=='select'"  @confirm="xuanze" :indexfu="item.name" :list="item.value">
 								<tm-input :title="item.name" align="right" :placeholder="'请选择'+item.name" v-model="item.choosevalue" disabled right-icon="icon-angle-right"></tm-input>
 							</tm-pickers>
-							<tm-input v-if="item.type=='text' && item.name !='颜色'" :title="item.name" v-model="item.value" disabled align="right"></tm-input>
+							<tm-input v-if="item.type=='text' && item.name !='颜色'" :title="item.name" v-model="item.choosevalue" align="right"></tm-input>
 							<view class="border-b-0 border-grey-darken-4-b-1 py-24 flex-between" v-if="item.name=='颜色'">
 								<text class="text-size-n ">{{item.name}}</text>
 								<view>
@@ -108,7 +108,7 @@ export default {
 			bottomPickerColor:0,
 			arrbig:[],
 			koutu:'/static/img/53.png',
-			active:0,
+			active:1,
 			category_arr:[],
 			category_danarr:[],
 			size_arr:[
@@ -133,7 +133,8 @@ export default {
 				size:'',
 				brand:'',
 				science:'',
-				role_id:''
+				role_id:'',
+				fenlei:[]
 			},
 		};
 	},
@@ -166,8 +167,14 @@ export default {
 		},
 		xuanze(data){
 			// var index=data[0].index;
-			// this.arrbig[index].choosename=data[0].data;
+			// this.arrbig[index].choosevalue=data[0].data;
+			for(let i=0;i<this.arrbig.length;i++){
+				if(this.arrbig[i].name==data[0].name){
+					this.arrbig[i].choosevalue=data[0].data
+				}
+			}
 			console.log(data)
+			// console.log(this.arrbig)
 		},
 		getFl(){
 			var that=this;
@@ -256,17 +263,33 @@ export default {
 				method:'post',
 				data:that.reqData
 			}).then(res => {
-				console.log(res.data)
 				if (res.data.code == 200) {
-					var arrbig=[
-						{name:"名称",value:"羽绒服",choosevalue:'',type:'text'},
-						{name:"颜色",value:"#b1b1b1",choosevalue:'',type:'text'},
-						{name:"尺码",value:["S","L","M"],choosevalue:'L',type:'select'},
-						{name:"材质",value:["牛仔","纯棉","羊毛"],choosevalue:'纯棉',type:'select'}
-					]
-					that.arrbig=arrbig;
-					that.active=2;
-					console.log(that.arrbig)
+					// var arrbig=[
+					// 	{name:"名称",value:"羽绒服",choosevalue:'',type:'text'},
+					// 	{name:"颜色",value:"#b1b1b1",choosevalue:'',type:'text'},
+					// 	{name:"尺码",value:["S","L","M"],choosevalue:'L',type:'select'},
+					// 	{name:"材质",value:["牛仔","纯棉","羊毛"],choosevalue:'纯棉',type:'select'}
+					// ]
+					that.arrbig=res.data.data.parm;
+					myRequest({
+						url: "/api/Category/list",
+						method:'post',
+						data:that.reqData
+					}).then(res => {
+						if (res.data.code == 200) {
+							var valuearr=[];
+							for(let i=0;i<res.data.data.length;i++){
+								valuearr.push(res.data.data[i].category_name)
+							}
+							var arrsmall=[{name:"分类",value:valuearr,choosevalue:'',type:'select',classid:''}];
+							that.arrbig=arrsmall.concat(that.arrbig)
+							that.fenlei=res.data.data;
+							that.active=2;
+						}else{
+							
+						}
+					})
+					
 				}else{
 					
 				}
@@ -307,39 +330,47 @@ export default {
 		},
 		chuangjianFun(){
 			var that=this;
-			if(that.reqData.goods_name==""){
-				that.$refs.toast.show({model:'warn',label:'请输入商品名称'})
-				return
-			}
-			if(that.category_danarr.length==0){
-				that.$refs.toast.show({model:'warn',label:'请选择分类'})
-				return
-			}else{
-				that.reqData.category_id=that.category_danarr[0].id
-			}
-			if(that.role_danarr.length==0){
-				that.$refs.toast.show({model:'warn',label:'请选择成员'})
-				return
-			}else{
-				that.reqData.role_id=that.role_danarr[0].id
-			}
-			if(that.size_danarr.length!=0){
-				that.reqData.size=that.size_danarr[0].id
-			}
-			that.reqData.image=that.koutu;
-			that.reqData.thumb=that.koutu;
-			myRequest({
-				url: "/api/Goods/addGodds",
-				method:'post',
-				data:that.reqData
-			}).then(res => {
-				console.log(res.data)
-				if (res.data.code == 200) {
-					that.active=3;
-				}else{
-					that.$refs.toast.show({model:'error',label:res.data.msg})
+			for(let i=0;i<that.arrbig.length;i++){
+				if(that.arrbig[i].choosevalue==""){
+					that.$refs.toast.show({model:'warn',label:'请将数据填写完整'})
+					return
 				}
-			})
+				// 这里写循环放id
+			}
+			console.log(that.arrbig)
+			// if(that.reqData.goods_name==""){
+			// 	that.$refs.toast.show({model:'warn',label:'请输入商品名称'})
+			// 	return
+			// }
+			// if(that.category_danarr.length==0){
+			// 	that.$refs.toast.show({model:'warn',label:'请选择分类'})
+			// 	return
+			// }else{
+			// 	that.reqData.category_id=that.category_danarr[0].id
+			// }
+			// if(that.role_danarr.length==0){
+			// 	that.$refs.toast.show({model:'warn',label:'请选择成员'})
+			// 	return
+			// }else{
+			// 	that.reqData.role_id=that.role_danarr[0].id
+			// }
+			// if(that.size_danarr.length!=0){
+			// 	that.reqData.size=that.size_danarr[0].id
+			// }
+			// that.reqData.image=that.koutu;
+			// that.reqData.thumb=that.koutu;
+			// myRequest({
+			// 	url: "/api/Goods/addGodds",
+			// 	method:'post',
+			// 	data:that.reqData
+			// }).then(res => {
+			// 	console.log(res.data)
+			// 	if (res.data.code == 200) {
+			// 		that.active=3;
+			// 	}else{
+			// 		that.$refs.toast.show({model:'error',label:res.data.msg})
+			// 	}
+			// })
 		}
 	},
 }

+ 9 - 4
tm-vuetify/components/tm-pickers/tm-pickers.vue

@@ -96,7 +96,7 @@
 			},
 			indexfu:{
 				type: String | Number,
-				default: "text"
+				default: false
 			},
 			// 背景颜色,主题色名称。
 			bgColor:{
@@ -162,7 +162,7 @@
 		},
 		methods: {
 			confirm() {
-				// console.log(this.indexfu)
+				console.log(this.indexfu)
 				if(!this.aniisTrue){
 					console.log('no');
 					return ;
@@ -171,10 +171,15 @@
 				
 				let saray = [];
 				sdata.forEach(item=>{
-					var obj={data:item.data,index:this.indexfu}
+					var obj={data:item.data,name:this.indexfu}
 					saray.push(obj)
 				})
-				this.$emit('confirm',sdata)
+				console.log(sdata)
+				if(this.indexfu){
+					this.$emit('confirm',saray)
+				}else{
+					this.$emit('confirm',sdata)
+				}
 				this.$emit('update:defaultValue',saray)
 				this.showpop=false;
 			},