lhl 4 years ago
parent
commit
0bf8a6cded
2 changed files with 29 additions and 5 deletions
  1. 12 2
      pages/product/wholesale.vue
  2. 17 3
      pages/product/wholesaleDetail.vue

+ 12 - 2
pages/product/wholesale.vue

@@ -27,10 +27,10 @@
 			<!-- <empty v-if="loadingType == 'noMore' && list.length === 0"></empty> -->
 			<view class="good-wrap">
 
-				<view class="good" v-for="item in list" @click="navto('/pages/product/wholesaleDetail')">
+				<view class="good" v-for="item in list" @click="gotoDetail(item)">
 					<image src="" mode="" class="goo-img"></image>
 					<view class="good-tit clamp">
-						{{item.order_id}}
+						{{item.whole.title}}
 					</view>
 					<view class="good-price flex">
 						<view class="new-price">
@@ -132,6 +132,16 @@
 			}
 		},
 		methods: {
+			gotoDetail(item) {
+				let obj = this
+				if(obj.status == '' ) {
+					
+				}
+				let query = 'id=' + item.id + '&time=' + item.time_id + '&status=' + item.status
+				
+				
+				obj.navto('/pages/product/wholesaleDetail?' + query)
+			},
 			navto(url) {
 				uni.navigateTo({
 					url: url

+ 17 - 3
pages/product/wholesaleDetail.vue

@@ -19,7 +19,7 @@
 		<view class="btn-ts" style="height: 130rpx; background-color: #fff;">
 
 		</view>
-		<view class="btm-btn" @click="reservePackage">
+		<view class="btm-btn" @click="loading? '':reservePackage">
 			立即预约
 		</view>
 	</view>
@@ -48,7 +48,8 @@
 				time_id: '',
 				status: 1,
 				is_new: 0,//是否是新人 0->是 1->不是
-				description: ''
+				description: '',
+				loading: false,
 			}
 		},
 		onLoad(opt) {
@@ -69,6 +70,7 @@
 					obj.description = data.storeInfo.description.replace(/\<img/gi, '<img class="rich-img"')
 				})
 			},
+			// 预约包
 			reservePackage() {
 				let obj = this
 				let updata = {
@@ -79,8 +81,20 @@
 					first_price: obj.is_new == 0?'':0,
 					last_id: obj.is_new== 0? '': 0
 				}
+				obj.loading = true
 				reservePackage(updata).then(res => {
-					console.log(res)
+					uni.showToast({
+						title:'预约成功',
+						duration:2000
+					});
+					setTimeout(function() {
+						uni.navigateTo({
+							url: '/pages/user/myWholesale'
+						});
+					}, 800);
+				}).catch( err => {
+					obj.loading = false
+					console.log(err)
 				})
 			}
 		}