YZM hai 1 ano
pai
achega
aa1f4f9b22

+ 32 - 16
pages/baocun/index.vue

@@ -41,7 +41,7 @@
 			<tm-button @click="shanchu()" :round="24" theme="gray" size="n">删除</tm-button>
 			<tm-button @click="baocun()" :round="24" class="fr" theme="primary" size="n">保存</tm-button>
 		</view>
-		<view class="anniu" v-if="off==1">
+		<view class="anniu" v-if="off==1 || off==3">
 			<tm-button class="anniubaocun " @click="baocun()" :round="24" theme="primary" size="n">保存</tm-button>
 		</view>
 		<view style="clear: both;"></view>
@@ -80,12 +80,16 @@ export default {
 		};
 	},
 	onLoad(e) {
-		this.off=e.type?e.type:1;//1保存2是修改
+		this.off=e.type?e.type:1;//1修改单品返回此页面 2是修改该页面数据 3是新建
 		this.id=e.id?e.id:13;
 		if(this.off==1){
 			this.huancun();
-		}else{
+		}else if(this.off==2){
 			this.getDate();
+		}else if(this.off==3){
+			this.getCj();
+			this.getFl();
+			this.huancun();
 		}
 	},
 	created() {
@@ -119,8 +123,6 @@ export default {
 		},
 		huancun(){
 			var ids=[];
-			console.log(11111111111)
-			console.log(uni.getStorageSync("datalist"))
 			if(uni.getStorageSync("datalist")){
 				var datalist=uni.getStorageSync("datalist");
 				this.test=[];
@@ -156,6 +158,7 @@ export default {
 					that.familyname=res.data.data.data.title;
 					that.alldata=res.data.data.data;
 					var datalist=res.data.data.details,datalist1=[];
+					that.datalistall=res.data.data.details;
 					for(let i=0;i<datalist.length;i++){
 						datalist1.push(datalist[i].goods)
 					}
@@ -175,10 +178,11 @@ export default {
 				method:'post',
 				data:{id:that.id}
 			}).then(res => {
-				console.log(res.data)
+				
 				if (res.data.code == 200) {
 					setTimeout(function(){
 						let pages = getCurrentPages(); // 当前页面
+						console.log(pages)
 						let beforePage = pages[pages.length - 2]; // 前一个页面
 						uni.navigateBack({
 							delta: 1,
@@ -248,23 +252,35 @@ export default {
 			})
 		},
 		baocun(){
-			var that=this;
+			var that=this,newids=[];
 			if(that.familyname==""){
 				that.$refs.toast.show({model:'error',label:'请输入搭配名称'})
 				return
 			}
-			var obj={
-				title:that.familyname,
-				category_id:that.listflall[that.activeIndex].id,
-				memberinfo_id:that.itemuser.id,
-				ids:this.ids,
-				scene_id:that.list1all[that.activeIndex1].id
-			}
-			if(this.off==1){
+			// [{'id':1,'g_id':3},{'id':2,'g_id':4}]
+			console.log(this.datalistall)
+			if(this.off==1 || this.off==3){
+				var obj={
+					title:that.familyname,
+					category_id:that.listflall[that.activeIndex].id,
+					memberinfo_id:that.itemuser.id,
+					ids:that.ids,
+					scene_id:that.list1all[that.activeIndex1].id
+				}
 				// 保存
 				var url="/api/Collocation/customizedCollocation"
 			}else{
-				obj['id']=that.id;
+				for(let i=0;i<that.ids.length;i++){
+					newids.push({'id':that.datalistall[i].id,'g_id':that.ids[i]})
+				}
+				var obj={
+					title:that.familyname,
+					category_id:that.listflall[that.activeIndex].id,
+					memberinfo_id:that.itemuser.id,
+					ids:newids,
+					scene_id:that.list1all[that.activeIndex1].id,
+					id:that.id*1
+				}
 				var url="/api/Collocation/customizedUpdateCollocation"
 			}
 			myRequest({

+ 1 - 1
pages/changan/index.vue

@@ -115,7 +115,7 @@ export default {
 			}
 			uni.setStorageSync("datalist",arr)
 			uni.redirectTo({
-				url: "/pages/baocun/index?type=1",
+				url: "/pages/baocun/index?type=3",
 			})
 		},
 		shanchu(){

+ 0 - 5
pages/chengyuan/index.vue

@@ -80,11 +80,6 @@ export default {
 		qiehuanren(index){
 			this.show=index;
 		},
-		quyifu(){
-			uni.navigateTo({
-				url: "/pages/luru/index",
-			})
-		},
 		tijiao(){
 			var that=this;
 			if(this.reqData.username==""){

+ 9 - 9
pages/dapei/index.vue

@@ -20,7 +20,7 @@
 					<text class="text-size-s ml-15">{{tianqiList.templow}}°c~{{tianqiList.temphigh}}°c</text>
 					<text class="text-size-s ml-15">{{tianqiList.week}}</text>
 				</view>
-				<view v-if="alltouList[0].data !=0" class="bianji" @click="bianji(1,alltouList[0].data)">{{alltouList[0].data !=0?'更换穿搭':'添加穿搭'}}</view>
+				<view v-if="alltouList[0]" class="bianji" @click="bianji(1,alltouList[0].data)">{{alltouList[0].data !=0?'更换穿搭':'添加穿搭'}}</view>
 			</view>
 			<view class="scroll-view-item_H" v-if="alltouList.length !=0">
 				<image v-if="alltouList[1].data !=0" class="chuanda" :src="alltouList[1].data.makeAppointmentCollocation.image"></image>
@@ -35,7 +35,7 @@
 					<text class="text-size-s ml-15">最高温度{{tianqiList.daily[1].day.temphigh}}°C</text>
 					<text class="text-size-s ml-15">{{tianqiList.daily[1].week}}</text>
 				</view>
-				<view v-if="alltouList[1].data !=0" class="bianji" @click="bianji(2,alltouList[1].data)">{{alltouList[1].data !=0?'更换穿搭':'添加穿搭'}}</view>
+				<view v-if="alltouList[1]" class="bianji" @click="bianji(2,alltouList[1].data)">{{alltouList[1].data !=0?'更换穿搭':'添加穿搭'}}</view>
 			</view>
 			<!-- <view class="scroll-view-item_H">
 				
@@ -96,7 +96,7 @@ export default {
 			alltouList:[],
 			tianqiList:[],
 			page:1,
-			pageSize:3,
+			pagesize:2,
 			city:'南京'
 		};
 	},
@@ -149,11 +149,11 @@ export default {
 							console.log(district);
 						},
 						fail: function(res) {
-							uni.showToast({
-								title: '定位失败',
-								duration: 2000,
-								icon: "none"
-							})
+							// uni.showToast({
+							// 	title: '定位失败',
+							// 	duration: 2000,
+							// 	icon: "none"
+							// })
 							console.log(res);
 						},
 						complete: function(res) {
@@ -242,7 +242,7 @@ export default {
 			myRequest({
 				url: "/api/Collocation/getCollocationList",
 				method:'post',
-				data:{category_id:id,page:that.page,pageSize:that.pageSize}
+				data:{category_id:id,page:that.page,pagesize:that.pagesize}
 			}).then(res => {
 				if (res.data.code == 200) {
 					if(res.data.data.length != 0){

+ 10 - 1
pages/genghuan/index.vue

@@ -116,7 +116,16 @@ export default {
 					if(datalist[i].id==this.id){
 						datalist[i]=this.quanbuList[this.itemoff];
 						uni.setStorageSync("datalist",datalist)
-						uni.navigateBack();
+						let pages = getCurrentPages(); // 当前页面
+						let beforePage = pages[pages.length - 2]; // 前一个页面
+						console.log(beforePage)
+						uni.navigateBack({
+							delta: 1,
+							success: function() {
+								beforePage.$vm.huancun()
+							}
+						});
+						return
 					}
 				}
 				return

+ 13 - 10
pages/index/index.vue

@@ -137,10 +137,10 @@
 						</view>
 					</view>
 					<view style="clear: both;"></view>
-					<!-- <view style="clear: both;" class="more ma-40 pt-40" @click="gengmore()">
+					<view v-if="total>listdata.length" style="clear: both;" class="more ma-40 pt-40" @click="gengmore()">
 						<image src="/static/img/30.png" mode="widthFix"></image>
 						<text class="text-size-s">下拉加载更多~</text>
-					</view> -->
+					</view>
 				</view>
 			</tm-sheet>
 		</view>
@@ -187,8 +187,9 @@
 				current: 0,
 				current1: 0,
 				listdata: [],
-				pagesize:2,
+				pagesize:10,
 				page:1,
+				total:0,
 				shopGoodsList:[]
 			};
 		},
@@ -251,12 +252,11 @@
 								console.log(city);
 							},
 							fail: function(res) {
-								uni.showToast({
-									title: '定位失败',
-									duration: 2000,
-									icon: "none"
-								})
-								console.log(res);
+								// uni.showToast({
+								// 	title: '定位失败',
+								// 	duration: 2000,
+								// 	icon: "none"
+								// })
 							},
 							complete: function(res) {
 								console.log(res);
@@ -376,7 +376,7 @@
 				let that = this;
 				myRequest({
 					url: "/api/ShopCollocation/hotList",
-					method: 'get',
+					method: 'post',
 					data: {page:that.page,pagesize:that.pagesize}
 				}).then(res => {
 					if (res.data.code == 200) {
@@ -387,6 +387,7 @@
 								id:item.id
 							})
 						})
+						that.total=res.data.data.total;
 					} else {
 						that.$refs.toast.show({
 							model: 'error',
@@ -420,6 +421,8 @@
 				})
 			},
 			gengmore() {
+				this.page=this.page+1;
+				this.getHot();
 			},
 			jihuashang() {
 				if (this.current1 == 0) {

+ 42 - 10
pages/luru/index.vue

@@ -26,17 +26,17 @@
 					<tm-button :round="24" class="mb-40" @click="paizhao()" block>拍照录入</tm-button>
 				</view>
 				<view v-if="active==2">
-					<image block class="nicheng" mode="widthFix" :src="koutu"></image>
+					<image v-if="alldata" block class="nicheng" mode="widthFix" :src="alldata.img"></image>
 					<view class="you black mt-30">
 						<view v-for="(item,index) in arrbig">
-							<tm-pickers class="tan" v-if="item.type=='select'"  @confirm="xuanze" :indexfu="item.name" :list="item.value">
+							<tm-pickers :default-value="getshow(item)" class="tan" 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.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>
-									<view  class="seka" :style="{'backgroundColor':buttonColor}" @tap="showPickerColorPop"></view>
+									<view  class="seka" :style="{'backgroundColor':item.choosevalue}" @tap="showPickerColorPop"></view>
 									<picker-color :isShow="showPickerColor" :bottom="bottomPickerColor"  @callback='getPickerColor' />
 								</view>
 							</view>
@@ -83,6 +83,7 @@ export default {
 			active:1,
 			role_arr:[],
 			fenlei:[],
+			alldata:{}
 		};
 	},
 	onLoad() {
@@ -93,6 +94,9 @@ export default {
 		this.getCY();
 	},
 	methods: {
+		getshow(data){
+			return [data.choosevalue]
+		},
 		/* 显示获取颜色选择弹窗 */
 		showPickerColorPop(){
 			this.showPickerColor=true;
@@ -104,6 +108,12 @@ export default {
 			/* 判断颜色值是否有效 */
 			if(color){
 				this.buttonColor=color;
+				var xunhuan=this.arrbig;
+				for(let i=0;i<xunhuan.length;i++){
+					if(xunhuan[i].name=="颜色"){
+						xunhuan[i].choosevalue=color
+					}
+				}
 			}
 		},
 		showPickerColorPop(){
@@ -157,6 +167,12 @@ export default {
 		quindex(){
 			uni.switchTab({
 				url: "/pages/wardrobe/index",
+				success: function (e) {
+					var page = getCurrentPages()[0]
+					console.log(getCurrentPages())
+					if (page == undefined || page == null) return;
+					page.shuaxin(); 
+				 }
 			})
 		},
 		paizhao(){
@@ -195,7 +211,14 @@ export default {
 					// 	{name:"尺码",value:["S","L","M"],choosevalue:'L',type:'select'},
 					// 	{name:"材质",value:["牛仔","纯棉","羊毛"],choosevalue:'纯棉',type:'select'}
 					// ]
+					that.alldata=res.data.data;
 					that.arrbig=res.data.data.parm;
+					// var xunhuan=that.arrbig;
+					// for(let i=0;i<xunhuan.length;i++){
+					// 	if(xunhuan[i].name=="颜色"){
+					// 		that.buttonColor="#"+xunhuan[i].choosevalue
+					// 	}
+					// }
 					myRequest({
 						url: "/api/Category/list",
 						method:'post',
@@ -212,7 +235,7 @@ export default {
 							
 							var arrsmall=[
 								{name:"分类",value:valuearr,choosevalue:'',type:'select',classid:''},
-								{name:"所属成员",value:rolevaluearr,choosevalue:'',type:'select',classid:''},
+								{name:"所属成员",value:rolevaluearr,choosevalue:'',type:'select',memberid:''},
 							];
 							that.arrbig=arrsmall.concat(that.arrbig)
 							that.fenlei=res.data.data;
@@ -274,17 +297,26 @@ export default {
 				}
 			}
 			// 成员id
+			console.log(that.role_arr)
 			for(let i=0;i<that.role_arr.length;i++){
-				if(that.role_arr[i].category_name==that.arrbig[0].choosevalue){
-					that.arrbig[0].classid=that.role_arr[i].id
+				if(that.role_arr[i].username==that.arrbig[1].choosevalue){
+					that.arrbig[1].memberid=that.role_arr[i].id
 				}
 			}
-			console.log(that.arrbig)
-			// that.reqData.image=that.koutu;
+			// 去掉图片的头
+			var img=""
+			if(that.alldata.img){
+				var oldimg=that.alldata.img;
+				img=oldimg.substr(24)
+			}
 			myRequest({
 				url: "/api/Goods/addGodds",
 				method:'post',
-				data:that.arrbig
+				data:{
+					img:img,
+					id:that.alldata.id,
+					parm:that.arrbig
+				}
 			}).then(res => {
 				if (res.data.code == 200) {
 					that.active=3;
@@ -336,5 +368,5 @@ export default {
 	.logincla{margin-top: 100px;}
 	/deep/ .logincla .primary{background-color: #303440 !important;}
 	/deep/ .quindex uni-button{background-color: #0A84FF !important;}
-	.seka{width: 40px;height: 20px;}
+	.seka{width: 40px;height: 20px;border:1px solid white;}
 </style>

+ 1 - 1
pages/wardrobe/index.vue

@@ -403,7 +403,7 @@ export default {
 	}
 	/deep/ .qiehuan .tm-tabs-con-item-border{display: none;}
 	.yiguicla image{width: 95%;display: block;margin: 0 auto;margin-top: 5px;height: 90px;}
-	.yiguicla{width: 30%;border-radius: 10px;}
+	.yiguicla{width: 30%;border-radius: 10px;height: 130px;overflow: hidden;}
 	.more{text-align: center;}
 	.more image{margin-right: 10px;vertical-align: middle;width: 30px;}
 	.fudong{position:fixed;right:10px;bottom:150px;background: #303030;width: 130px;height: 60px;

+ 107 - 25
pages/yifu/index.vue

@@ -19,7 +19,23 @@
 						<text>{{xianshi?'修改':'保存'}}</text>
 					</view>
 					<view class="you black mt-30" v-if="alldata !=0">
-						<tm-input :disabled="xianshi" :required="true" title="商品名称" v-model="alldata.detail.goods_name" align="right"></tm-input>
+						<!-- <tm-pickers :default-value="selected" @confirm="xuanzeaa" :list="['苹果','香蕉','可口可乐','新西兰','日本']">
+							<tm-input title="嗷嗷" align="right" v-model="selected[0]" disabled right-icon="icon-angle-right"></tm-input>
+						</tm-pickers> -->
+						<view v-for="(item,index) in alldata.detail.parameter">
+							<tm-pickers :default-value="getshow(item)" :disabled="xianshi" class="tan" 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 :disabled="xianshi" 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>
+									<view  class="seka" :style="{'backgroundColor':item.choosevalue}" @tap="showPickerColorPop"></view>
+									<picker-color :isShow="showPickerColor" :bottom="bottomPickerColor"  @callback='getPickerColor' />
+								</view>
+							</view>
+						</view>
+						<!-- <tm-input :disabled="xianshi" :required="true" title="商品名称" v-model="alldata.detail.goods_name" align="right"></tm-input>
 						<tm-pickers :disabled="xianshi" class="tan" :default-value.sync="category_danarr" rang-key="category_name" :list="category_arr">
 							<tm-input :required="true" title="分类" placeholder="请选择分类" disabled :value="obTstr1(category_danarr,'category_name')" right-icon="icon-angle-right"></tm-input>
 						</tm-pickers>
@@ -33,7 +49,7 @@
 						</tm-pickers>
 						<tm-input :disabled="xianshi" title="适用人群" v-model="alldata.detail.type" align="right"></tm-input>
 						<tm-input :disabled="xianshi" title="品牌" v-model="alldata.detail.brand" align="right"></tm-input>
-						<tm-input :disabled="xianshi" title="材料" v-model="alldata.detail.science" align="right"></tm-input>
+						<tm-input :disabled="xianshi" title="材料" v-model="alldata.detail.science" align="right"></tm-input> -->
 					</view>
 				</view>
 			</tm-sheet>
@@ -108,9 +124,18 @@
 </template>	
 <script>
 import{myRequest} from '@/api/request.js'
+import pickerColor from "@/components/helang-pickerColor/helang-pickerColor.vue"
 export default {
+	components: {
+		"picker-color":pickerColor,
+	},
 	data() {
 		return {
+			selected:['裤子'],
+			buttonColor:"#0099FF",
+			showPickerColor:false,
+			bottomPickerColor:0,
+			arrbig:[],
 			category_arr:[],
 			category_danarr:[],
 			role_arr:[],
@@ -160,6 +185,42 @@ export default {
 		this.sys = uni.getSystemInfoSync();
 	},
 	methods: {
+		getshow(data){
+			return [data.choosevalue]
+		},
+		/* 显示获取颜色选择弹窗 */
+		showPickerColorPop(){
+			if(this.xianshi){
+				return
+			}
+			this.showPickerColor=true;
+		},
+		/* 获取颜色选择回调 */
+		getPickerColor(color){
+			/* 隐藏弹窗 */
+			this.showPickerColor=false;
+			/* 判断颜色值是否有效 */
+			if(color){
+				this.buttonColor=color;
+				var xunhuan=this.alldata.detail.parameter;
+				for(let i=0;i<xunhuan.length;i++){
+					if(xunhuan[i].name=="颜色"){
+						xunhuan[i].choosevalue=color
+					}
+				}
+			}
+		},
+		xuanzeaa(data){
+			console.log(data)
+			this.selected=[data[0].data]
+		},
+		xuanze(data){
+			for(let i=0;i<this.alldata.detail.parameter.length;i++){
+				if(this.alldata.detail.parameter[i].name==data[0].name){
+					this.alldata.detail.parameter[i].choosevalue=data[0].data
+				}
+			}
+		},
 		quxchuFun(){
 			var that=this;
 			console.log(that.chukudata[0].id)
@@ -285,6 +346,12 @@ export default {
 			}).then(res => {
 				if (res.data.code == 200) {
 					that.alldata=res.data.data;
+					// var xunhuan=that.alldata.detail.parameter;
+					// for(let i=0;i<xunhuan.length;i++){
+					// 	if(xunhuan[i].name=="颜色"){
+					// 		that.buttonColor="#"+xunhuan[i].choosevalue
+					// 	}
+					// }
 					that.getFl();
 					that.getCY();
 				}else{
@@ -317,38 +384,52 @@ export default {
 		xiugaiFun(){
 			var that=this;
 			if(! this.xianshi){
-				if(that.category_danarr.length==0){
-					that.$refs.toast.show({model:'warn',label:'请选择分类'})
-					return
-				}else{
-					that.reqData.category_id=that.category_danarr[0].id
+				var databaocun=that.alldata.detail.parameter;
+				console.log(databaocun)
+				for(let i=0;i<databaocun.length;i++){
+					if(databaocun[i].choosevalue==""){
+						that.$refs.toast.show({model:'warn',label:'请将数据填写完整'})
+						return
+					}
 				}
-				if(that.role_danarr.length==0){
-					that.$refs.toast.show({model:'warn',label:'请选择成员'})
-					return
-				}else{
-					that.reqData.role_id=that.role_danarr[0].id
+				// 分类id
+				for(let i=0;i<that.category_arr.length;i++){
+					if(that.category_arr[i].category_name==databaocun[0].choosevalue){
+						databaocun[0].classid=that.category_arr[i].id
+					}
 				}
-				if(that.size_danarr.length!=0){
-					that.reqData.size=that.size_danarr[0].id
+				// // 成员id
+				for(let i=0;i<that.role_arr.length;i++){
+					if(that.role_arr[i].username==databaocun[1].choosevalue){
+						databaocun[1].memberid=that.role_arr[i].id
+					}
 				}
-				that.reqData.goods_name=that.alldata.detail.goods_name;
-				if(that.reqData.goods_name==""){
-					that.$refs.toast.show({model:'warn',label:'请输入商品名称'})
-					return
+				// 去掉图片的头
+				var img=""
+				if(that.alldata.detail.image){
+					var oldimg=that.alldata.detail.image;
+					img=oldimg.substr(24)
 				}
-				that.reqData.year=that.alldata.detail.year;
-				that.reqData.color=that.alldata.detail.color;
-				that.reqData.type=that.alldata.detail.type;
-				that.reqData.brand=that.alldata.detail.brand;
-				that.reqData.science=that.alldata.detail.science;
-				that.reqData.id=that.alldata.detail.id;
 				myRequest({
 					url: "/api/Goods/updateGoods",
 					method:'post',
-					data:that.reqData
+					data:{
+						img:img,
+						id:that.alldata.detail.id,
+						parm:databaocun
+					}
 				}).then(res => {
 					if (res.data.code == 200) {
+						setTimeout(function(){
+							let pages = getCurrentPages(); // 当前页面
+							let beforePage = pages[pages.length - 2]; // 前一个页面
+							uni.navigateBack({
+								delta: 1,
+								success: function() {
+									beforePage.$vm.shuaxin()
+								}
+							});
+						},2000)
 						that.$refs.toast.show({model:'success',label:res.data.msg})
 					}else{
 						that.$refs.toast.show({model:'error',label:res.data.msg})
@@ -442,4 +523,5 @@ export default {
 	.yiguicla1{width: 47%;border-radius: 10px;}
 	.more{text-align: center;}
 	.more image{margin-right: 10px;vertical-align: middle;width: 30px;}
+	.seka{width: 40px;height: 20px;border:1px solid white;}
 </style>