Ver Fonte

库存修改

wcni há 5 anos atrás
pai
commit
26cea4e049

+ 34 - 3
component/popup.vue

@@ -12,6 +12,9 @@
 
 <script>
 	import uniPopup from './newpoup.vue'
+	import {
+		mapMutations,mapState
+	} from 'vuex'
 	export default {
 		props: {
 			ishow: {
@@ -80,14 +83,42 @@
 				return true;
 			}
 		},
+		watch: {
+			// 'successlogion':function(val) {
+			//    if(val) {
+			// 	  uni.navigateTo({
+			// 	  	url:'/pages/myCenter/definite'
+			// 	  })
+			//    }else {
+			// 	  uni.navigateTo({
+			// 	  	url: './logion'
+			// 	  })
+			//    }
+			// },
+		},
+		computed:{
+			...mapState([
+			  'hasLogin',
+			  'userInfo',
+			  'successlogion'
+			]),
+		},
 		methods: {
 			togglePopup() {
 				this.type = false;
 			},
 			gomoney() {
-				uni.navigateTo({
-					url:'/pages/myCenter/definite'
-				})
+				console.log(this.successlogion && this.hasLogin)
+				if(this.successlogion && this.hasLogin) {
+					uni.navigateTo({
+						url:'/pages/myCenter/definite'
+					})
+				}else {
+					uni.navigateTo({
+						url: '/pages/myCenter/logion'
+					})
+				}
+				
 			}
 		}
 	};

+ 8 - 2
component/shopList.vue

@@ -21,6 +21,10 @@ export default {
 	props: {
 		productList: {
 		  type: Array
+		},
+		// 酒店总id
+		goodId: {
+			type: Number
 		}
 	},
     data() {
@@ -33,9 +37,11 @@ export default {
     methods: {
        goshop(e) {
 		   let id = e.goods_commonid;
-		   let store_id = e.store_id;
+		   let goodIds = e.store_id; // 商品单个酒店id
+		   let stoe_ids = this.goodId;
+		 
 		   uni.navigateTo({
-		   	url:`/pages/index/shop?id=${id}&store_id=${store_id}`
+		   	url:`/pages/index/shop?id=${id}&store_id=${stoe_ids}&goodId=${goodIds}`
 		   })
 	   }
     },

+ 4 - 4
component/uploadImage.vue

@@ -5,7 +5,7 @@
 				<view class="uni-uploader__files">
 					<block v-for="(image,index) in imageList" :key="index">
 						<view class="uni-uploader__file" style="position: relative;">
-							<image class="uni-uploader__img" :src="image" :data-src="image" ></image>
+							<image mode="aspectFit" class="uni-uploader__img" :src="image" :data-src="image" ></image>
 							<view @click="deleteImg(index)" style="position: absolute;right:0;top:0;">X</view>
 						</view>
 					</block>
@@ -25,15 +25,15 @@
 				imageList:[],
 				filelist:[],
 				sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
-				sourceType: ['album'], //从相册选择
+				sourceType: ['album','camera'], //从相册选择
 				countIndex: 1,
-				count: [1, 2, 3]
+				count: [0,1,2]
 			}
 		},
 		onUnload() {
 			    this.imageList = [],
 				this.sourceTypeIndex = 2,
-				this.sourceType =  ['album'],
+				this.sourceType =  ['album','camera'],
 				this.sizeType = ['original', 'compressed'],
 				this.countIndex = 1;
 		},

+ 2 - 11
pages/index/hotel.vue

@@ -120,7 +120,7 @@
 						  </view> 
 				  </view>
                  <!-- 商品列表 -->
-                 <shopList :productList="goods_list" />
+                 <shopList :goodId="goodId" :productList="goods_list" />
                   </view> 
                  </van-tab>
                     <van-tab  :name="1" :title="'评价' +'  '+feedback_count">
@@ -259,16 +259,7 @@
         },
         // 初次渲染进来关闭分享菜单栏
         onReady:function(){
-            // uni.hideShareMenu({
-            //       success(res) {
-            //           console.log(res)
-            //           console.log("kkkkkkkkkkkk")
-            //       },
-            //       fail(res){
-            //           console.log(res)
-            //           console.log("dddddd")
-            //       } 
-            // });
+        
         },
 		onLoad(options){
 			this.goodId = options.id;  // 商品和酒店Id

+ 2 - 1
pages/index/hoteldetail.vue

@@ -46,6 +46,7 @@
 			
 	  </view>
 	     <view style="clear: both;
+		    width: 100%;
 			overflow: hidden;
 			position: fixed;
 			z-index: 99;
@@ -62,7 +63,7 @@
 		   :scroll-top="scrollTop" scroll-y="true"  @scroll="scroll"  @scrolltoupper="upper" @scrolltolower="lower"
 		   refresher-enabled="true">
 		  <!-- 商品列表 -->
-		  <shopList :productList="goods_list" />
+		  <shopList  :goodId="store_id" :productList="goods_list" />
 		   </scroll-view>
 		    <Gobacktop @getop="getop" v-if="isTop" />
 		  </view>

+ 1 - 1
pages/index/hotelsearch.vue

@@ -81,7 +81,7 @@
 		     </view>
 		 			
 		 </view>
-		  <shopList :productList="goods_list" />
+		  <shopList :goodId="goodId" :productList="goods_list" />
 	 </view>
 </template>
 

+ 4 - 0
pages/index/index.vue

@@ -143,6 +143,9 @@
 			  'beginload'
 			]),
 		},
+		onShow() {
+			//this.getpicture();
+		},
 		onLoad() {
 			if(this.beginload) {
 			this.getpicture(); // 开机广告
@@ -198,6 +201,7 @@
 			    return new Number(val).toFixed(1);
 			},
 			getpicture() {
+				console.log("jdjdj")
 				this.request({
 					url: '/v1/entry/poster',
 					method: 'get',

+ 39 - 14
pages/index/shop.vue

@@ -39,7 +39,7 @@
 					<text class="m-price">¥{{datalist.goods_marketprice}}</text>
 					<text class="price-tip" style="color: #D9332E;" 
 					v-if="datalist.goods_storage == 0 ||
-					datalist.store_id == 1 
+					datalist.store_id!= store_id 
 					|| datalist.goods_state != 1
 					">已下架</text>
 				</view>
@@ -146,11 +146,11 @@
  				<view v-for="(item,index) in datalist.spec_list" :key="index" class="attr-list">
  					<text>{{item.spec_name}}</text>
  					<view class="item-list">
-						<!-- 	v-if="childItem.pid === item.id"  , disabled: childItem.goods_storage==0-->
+						<!-- 	v-if="childItem.pid === item.id"   disabled: childItem.goods_storage==0, disabled: childItem.goods_storage==0-->
  						<text 
  							v-for="(childItem, childIndex) in item.value_list" 
  							:key="childIndex" class="tit"
- 							:class="{selected: childItem.selected, disabled: childItem.goods_storage==0}"
+ 							:class="{selected: childItem.selected, disabled:childItem.disabled}"
  							@click="selectSpec(index, childItem.value_id, childItem, item,childItem.goods_storage)"
  						>
  							{{childItem.value_name}}
@@ -255,7 +255,8 @@
  					
  				`,
  				specList: [
- 				]
+ 				],
+				onlystoreId: 0 // 总酒店id
  			};
  		},
 		onLaunch: function(){
@@ -281,8 +282,9 @@
 			});
 		},
  		async onLoad(options){
- 			this.goodId = options.id;  // 商品Id
-			this.store_id =  options.store_id;
+ 			this.goodId = options.id;  // 商品公共id
+			this.store_id =  options.store_id; // 酒店id
+			this.onlystoreId = options.goodId;
 			this.getshopdetail(); // 获取商品详情
 			uni.$on('changshow', (e) => {
 				this.changeshow();			
@@ -452,7 +454,7 @@
 			// 立即购买
 			buynow() {
 				if(this.hasLogin  && this.successlogion) {
-					if(this.datalist.store_id == 1 || this.datalist.goods_state != 1 || this.datalist.goods_storage < 1) {
+					if(this.datalist.store_id != this.store_id || this.datalist.goods_state != 1 || this.datalist.goods_storage < 1) {
 						this.$msg("商品已下架");
 						return;
 					}
@@ -498,7 +500,7 @@
 			// 加入购物车
 			addCar() {
 				if(this.hasLogin && this.successlogion) {
-					if(this.datalist.store_id == 1 || this.datalist.goods_state != 1 || this.datalist.goods_storage < 1) {
+					if(this.datalist.store_id != this.store_id  || this.datalist.goods_state != 1 || this.datalist.goods_storage < 1) {
 						this.$msg("商品已下架");
 						return;
 					}
@@ -544,10 +546,10 @@
 			},
  			//选择规格
  			selectSpec(index, pid,chose,first,goods_storage){
-				if(goods_storage == 0) {
-					this.$msg("商品没库存啦");
-					return;
-				}
+				// if(goods_storage == 0) {
+				// 	this.$msg("商品没库存啦");
+				// 	return;
+				// }
 				let obj = {};
 				obj.spec_id = first.spec_id;
 				obj.value_name = chose.value_name;
@@ -580,10 +582,33 @@
 					}
 				}
 				this.arrayId = array;
+				// if(this.arrayId.length == this.datalist.spec_list.length) {
+				// 	let goodIds = this.datalist.spec_map[this.scopemapId];
+				// 	let itemsa = this.datalist.goods_list[goodIds]
+				// 	console.log(itemsa);
+				// 	// if(itemsa.goods_storage == 0) {
+				// 	// 	this.$msg("商品没库存啦");
+				// 	// 	return;
+				// 	// }
+				// 	return;
+				// }
+				
 				if(this.arrayId.length == this.datalist.spec_list.length) {
 					this.scopemapId = array.join("_");
 					let goodId = this.datalist.spec_map[this.scopemapId]; //
 					let items = this.datalist.goods_list[goodId]
+					if(items.goods_storage == 0) {
+						this.$msg("商品没库存啦");
+						this.datalist.spec_list[index].value_list.forEach(item=>{
+							if(item.value_id === pid){ 
+								this.$set(item, 'selected', false);
+								// this.$set(item, 'disabled', true);
+							}else {
+								// this.$set(item, 'disabled', false);
+							}
+						})
+						return;
+					}
 					items.value_name = chose.value_name;
 					this.nuberImg = items.spec_img;
 					this.specSelected.push(items)
@@ -592,7 +617,7 @@
 					this.firstprice = items.goods_price;
 					this.totalprice = items.goods_price*this.shopnumber;
 				}
-			
+			   
 				// if(this.arrayId.length == this.datalist.spec_list.length) {
 					
 				// }
@@ -654,7 +679,7 @@
  			//收藏
  			toFavorite(){
 				if(this.hasLogin && this.successlogion) {
-					if(this.datalist.store_id == 1 || this.datalist.goods_state != 1 || this.datalist.goods_storage < 1) {
+					if(this.datalist.store_id != this.store_id  || this.datalist.goods_state != 1 || this.datalist.goods_storage < 1) {
 						this.$msg("商品已下架");
 						return;
 					}

+ 3 - 1
pages/myCenter/index.vue

@@ -159,8 +159,10 @@
 			  
 			]),
 		},
+		onShow() {
+			this.getuserinfo();
+		},
 		onLoad() {
-			console.log(this.$store)
 			console.log(this.hasLogin)
 			console.log(this.userInfo)
 			if(this.successlogion && this.hasLogin) {

+ 7 - 3
pages/myCenter/logion.vue

@@ -89,9 +89,13 @@
 				let  that = this;
 				    uni.getUserInfo({
 					     success: (res) => {
-							 that.login(res.userInfo);
-							 that.showDialog(true); // 改变haslogion的值
-							 that.$msg("授权成功");
+						     console.log(res)
+							 let userInfo = res.userInfo;
+							 that.login(userInfo);
+							 if(userInfo!='') {
+								 that.showDialog(true); // 改变haslogion的值
+								 that.$msg("授权成功");
+							 }
 							 if(this.successlogion) {
 								uni.navigateBack();
 							 }

+ 13 - 7
pages/myOrder/reminder.vue

@@ -16,19 +16,20 @@
 			return{
 				tips: '填写催单内容',
 				reminder: '',
-				order_id:''
+				order_id:'',
+				types: 0
 			}
 		},
 		onLoad(e) {
-			console.log(a);
+			console.log(e.a);
 			this.order_id = e.order_id;
-			let a = e.a;
-			if(a == 1) {
+			this.types = e.a;
+			if(this.types== 1) {
 				uni.setNavigationBarTitle({
 				    title: '催单'
 				});
 				this.tips="填写催单内容";
-			}else if(a == 2) {
+			}else if(this.types== 2) {
 				uni.setNavigationBarTitle({
 				    title: '联系酒店'
 				});
@@ -41,7 +42,7 @@
 			},
 			submitRemin() {
 			   if(this.reminder == '') {
-				   this.$msg("请填写催单内容");
+				   this.$msg("请填写内容");
 				   return;
 			   }
 			   this.request({
@@ -53,7 +54,12 @@
 				   },
 				   success:(res) => {
 					   if(res.data.code == 1000) {
-						   this.$msg("催单成功");
+						   if(this.types == 1) {
+							   this.$msg("催单成功");
+						   }else if(this.types== 2) {
+							    this.$msg("联系酒店成功");
+						   }
+						   
 						   setTimeout(() => {
 							  uni.navigateBack();
 						   }, 500)

+ 3 - 1
pages/myone/oneIndex.vue

@@ -73,6 +73,7 @@
 			      },
 			goIndex(items) {
 				let article_id = items.article_id;
+				let article_thumb =items.article_thumb;
 				let ac_id = items.ac_id;
 				let name = '';
 				this.typelist.forEach((item, index) => {
@@ -80,8 +81,9 @@
 						name = item.ac_name;
 					}
 				})
+				//  :src=" pictureUrl + '/' + item.article_thumb"
 				uni.navigateTo({
-				        url: `/pages/myone/onedetail?id=${article_id}&name=${name}`
+				        url: `/pages/myone/onedetail?id=${article_id}&name=${name}&article_thumb=${article_thumb}`
 				});
 			},
 			getype() {

+ 20 - 0
pages/myone/onedetail.vue

@@ -24,11 +24,31 @@
 				pictureUrl: this.pictureUrl,
 				article_id: '',
 				nodes:'',
+				article_thumb:'',
 				aricte: {}
 		    }
 		},
+		
+		// onShareAppMessage(res) {
+		// 	uni.showShareMenu({
+		// 	     withShareTicket: true  
+		// 	});  
+		// 	let that = this;
+		// 	let id = this.article_id;  // 酒店id
+		// 	console.log(id);
+		// 	if (res.from === 'button') {
+		//       // 来自页面内分享按钮
+		// 	}
+		// 	return {
+		// 		title: that.hotelitle,
+		// 		path: `/pages/myone/onedetail?id=${id}`,
+		// 		imageUrl: this.pictureUrl+'/'+this.article_thumb
+		// 	}
+		// },
 		onLoad(a) {
+			console.log(a);
 			this.article_id = a.id;
+			this.article_thumb = a.article_thumb;
 			let name = a.name;
 			uni.setNavigationBarTitle({
 			    title: name