Browse Source

Merge branch 'master' of http://git.liuniu946.com/hwq/supermyc

hwq 1 year ago
parent
commit
cba928f851
2 changed files with 31 additions and 4 deletions
  1. 5 3
      pages/cart/cart.vue
  2. 26 1
      pages/product/supermarket.vue

+ 5 - 3
pages/cart/cart.vue

@@ -153,7 +153,9 @@
 			//请求数据
 			async loadData() {
 				let obj = this;
-				getCartList({})
+				getCartList({
+					type:0
+				})
 					.then(function(e) {
 						// 获取当前购物车物品增加数量
 						let nub = obj.cartList.length;
@@ -466,7 +468,7 @@
 	/* 底部栏 */
 	.action-section {
 		/* #ifdef H5 */
-		margin-bottom: 168rpx;
+		margin-bottom: 50px;
 		/* #endif */
 		position: fixed;
 		left: 0rpx;
@@ -599,7 +601,7 @@
 		padding-left: 28rpx;
 		padding-right: 26rpx;
 		position: sticky;
-		top: 10rpx;
+		top: 0rpx;
 		z-index: 99;
 
 		.hand-tit {

+ 26 - 1
pages/product/supermarket.vue

@@ -15,12 +15,21 @@
 			</view>
 			<uni-load-more :status="loadingType"></uni-load-more>
 		</view>
+		
+		<view class="cart">
+			
+		</view>
+		
+		
 	</view>
 </template>
 
 <script>
 	import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
 	import empty from '@/components/empty';
+	import {
+		getCartList,
+	} from '@/api/cart.js';
 	import {
 		getProducts,
 		cartAdd
@@ -32,6 +41,7 @@
 				limit: 20,
 				loadingType: 'more',
 				list: [],
+				total:0
 			};
 		},
 		components: {
@@ -40,13 +50,28 @@
 		},
 		onLoad() {
 			this.loadData();
+			
+		},
+		onShow() {
+			this.loadCart();
 		},
-		onShow() {},
 		onReachBottom() {
 			this.loadData();
 		},
 		onReady() {},
 		methods: {
+			async loadCart() {
+				let obj = this;
+				getCartList({
+					type:1
+				})
+					.then(function(e) {
+						obj.total = e.data.valid.length;
+					})
+					.catch(function(e) {
+						console.log(e);
+					});
+			},
 			loadData() {
 				if (this.loadingType == 'loading' || this.loadingType == 'nomore') {
 					return