guhongwei 2 年之前
父節點
當前提交
b649df5057
共有 2 個文件被更改,包括 23 次插入16 次删除
  1. 16 8
      pages/home/index.vue
  2. 7 8
      pagesHome/order/detail.vue

+ 16 - 8
pages/home/index.vue

@@ -34,14 +34,14 @@
 					</view>
 				</view>
 				<view class="zero five">
-					<view class="list" v-for="(item,index) in marketList" :key="index" @tap="toCommon('pagesHome/order/detail')">
-						<image class="image" :src="item.url" mode=""></image>
+					<view class="list" v-for="(item,index) in marketList" :key="index" @tap="toBuy(item)">
+						<image class="image" :src="item.file&&item.file.length>0?item.file[0].url:''" mode=""></image>
 						<view class="name">
 							{{item.name}}
 						</view>
 						<view class="other">
 							<view class="money">
-								<text>¥</text><text>{{item.money}}</text>
+								<text>¥</text><text>{{item.money||'暂无'}}</text>
 							</view>
 							<view class="btn">
 								<button type="default" size="mini">购买</button>
@@ -183,6 +183,10 @@
 					});
 					that.$set(that, `btnList`, data);
 				}
+				res = await that.$api(`/goods`, `GET`, {});
+				if (res.errcode == '0') {
+					that.$set(that, `marketList`, res.data)
+				}
 			},
 			// 公共跳转
 			toCommon(e) {
@@ -190,12 +194,11 @@
 					url: `/${e}`
 				})
 			},
-			toPath(e) {
-				if (e && e.route) uni.redirectTo({
-					url: `/${e.route}`
+			toBuy(e) {
+				uni.navigateTo({
+					url: `/pagesHome/order/detail?id=${e.id}`
 				})
 			},
-
 			// 计算高度
 			handleScroll(e) {
 				const that = this;
@@ -207,7 +210,12 @@
 			backTop() {
 				const that = this;
 				that.topItem = 'top'
-			}
+			},
+			toPath(e) {
+				if (e && e.route) uni.redirectTo({
+					url: `/${e.route}`
+				})
+			},
 		}
 	}
 </script>

+ 7 - 8
pagesHome/order/detail.vue

@@ -2,12 +2,10 @@
 	<mobile-frame>
 		<view class="main">
 			<view class="onemain">
-				<scroll-view scroll-y="true" class="scroll-view" scroll-with-animation :scroll-into-view="topItem"
-					@scroll="handleScroll">
+				<scroll-view scroll-y="true" class="scroll-view" scroll-with-animation :scroll-into-view="topItem" @scroll="handleScroll">
 					<view class="list-scroll-view" id="top">
 						<view class="one">
-							<swiper class="swiper" circular :indicator-dots="true" indicator-color="#ffffff"
-								indicator-active-color="#FB1438" :autoplay="true" :interval="3000" :duration="1000">
+							<swiper class="swiper" circular :indicator-dots="true" indicator-color="#ffffff" indicator-active-color="#FB1438" :autoplay="true" :interval="3000" :duration="1000">
 								<swiper-item class="list" v-for="(item,index) in bannerList" :key="index">
 									<image class="image" :src="item.url" mode=""></image>
 								</swiper-item>
@@ -69,8 +67,7 @@
 				</scroll-view>
 			</view>
 			<view class="foot">
-				<uni-goods-nav :options="options" :button-group="buttonGroup" @click="onClick"
-					@buttonClick="buttonClick" />
+				<uni-goods-nav :options="options" :button-group="buttonGroup" @click="onClick" @buttonClick="buttonClick" />
 			</view>
 		</view>
 		<view class="collect">
@@ -108,8 +105,7 @@
 				</view>
 				<view class="two">
 					<view class="two_1">口味</view>
-					<view class="two_2"><text @click="toStyle"
-							:style="{color:color,background:background}">{{info.specs.flavor}}</text></view>
+					<view class="two_2"><text @click="toStyle" :style="{color:color,background:background}">{{info.specs.flavor}}</text></view>
 				</view>
 				<view class="thr">
 					<text>数量:</text>
@@ -230,6 +226,9 @@
 				type: '0'
 			};
 		},
+		onLoad: function(e) {
+			console.log(e);
+		},
 		onShow: function() {},
 		methods: {
 			onClick(e) {