Selaa lähdekoodia

优化 增加iphone 11 以上手机型号适配

zhengjinyi 5 vuotta sitten
vanhempi
commit
47eb783ffa
5 muutettua tiedostoa jossa 54 lisäystä ja 47 poistoa
  1. 5 2
      App.vue
  2. 3 3
      components/cm-custom/cm-drag.vue
  3. 1 0
      pages.json
  4. 22 20
      pages/goods/cart.vue
  5. 23 22
      pages/tabBar/cart/cart.vue

+ 5 - 2
App.vue

@@ -12,8 +12,11 @@
 			uni.getSystemInfo({
 				success: function(e) {
 					let modelmes = e.model;
-					if (modelmes.search('iPhone X') != -1) { //XS,XR,XS MAX均可以适配
-					  self.$store.dispatch('setVariableFun',true)
+					console.log(e);
+					if (modelmes.search('iPhone 11') || modelmes.search('iPhone 11 Pro Max') ||modelmes.search('iPhone X') != -1) { //XS,XR,XS MAX均可以适配
+						self.$store.dispatch('setVariableFun',true)
+					}else{
+						self.$store.dispatch('setVariableFun',false)
 					}
 					// #ifndef MP
 					Vue.prototype.StatusBar = e.statusBarHeight;

+ 3 - 3
components/cm-custom/cm-drag.vue

@@ -59,15 +59,15 @@
 			if (sys.windowTop) {
 				this.windowHeight += sys.windowTop;
 			}
-			console.log(sys)
+			// console.log(sys)
 			const query = uni.createSelectorQuery().in(this);
 			query.select('#_drag_button').boundingClientRect(data => {
 				this.width = data.width;
 				this.height = data.height;
 				this.offsetWidth = data.width / 2;
 				this.offsetHeight = data.height / 2;
-				this.left = this.windowWidth - this.width - this.edge;
-				this.top = this.windowHeight - this.height - this.edge;
+				this.left = this.windowWidth - this.width - this.edge-5;
+				this.top = this.windowHeight - this.height - this.edge-150;
 			}).exec();
 		},
 		methods: {

+ 1 - 0
pages.json

@@ -75,6 +75,7 @@
 			"path": "pages/goods/cart",
 			"style": {
 				"navigationBarTitleText": "购物车",
+				"enablePullDownRefresh":true,
 				"navigationStyle":"custom"
 			}
 		},{

+ 22 - 20
pages/goods/cart.vue

@@ -4,7 +4,7 @@
 		<tui-skeleton v-if="skeletonShow" backgroundColor="#fafafa" borderRadius="10rpx" :isLoading	="true" :loadingType="5"></tui-skeleton>
 		<view class="container-cart-main tui-skeleton">
 			<view v-if="!isEmpty" class="container-cart">
-				<scroll-view class="cart-content"  scroll-y  @scrolltolower="toLower" :style="{paddingBottom :isIphoneX ? (68+100)+'rpx' : '100rpx'}">
+				<view class="cart-content" :style="{paddingBottom :isIphoneX ? (68+100)+'rpx' : '100rpx'}">
 					<view class="goods-list">
 						<view v-for="(item, index) in goodsList" :key="index" class="goods-item">
 							<view class="shoptitle">
@@ -67,9 +67,8 @@
 									<!--选择商品-->
 									<view class="checkbox-box" @click.stop="ischeckFailure(failure)" v-if="isshowDelbtn">
 										<button class="checkbox iconfont" 
-										:disabled="!isCheckAll"
-										:class="[failure.productsChecked ?'icon-gouxuanl':'icon-weigouxuan']">
-									</button>
+												:class="[ failure.productsChecked ? 'icon-gouxuanl':'icon-weigouxuan']">
+										</button>
 									</view>
 									<view class="pros-img">
 										<image :src="failure.mainImage ? failure.mainImage:''" alt="" />
@@ -85,7 +84,7 @@
 							</view>
 						</view>	
 					</view>
-				</scroll-view>
+				</view>
 				<!-- 脚部菜单 -->
 				<view class="footer" :style="{paddingBottom :isIphoneX ? '68rpx' : '0rpx'}">
 					<view class="footer-le">
@@ -283,7 +282,8 @@
 				})
 			},
 			ischeckFailure(failure){
-				failure.productsChecked = !failure.productsChecked;
+				failure.productsChecked = !failure.productsChecked
+				this.updateCheckAllBtn()
 			},
 			ischeck(item,pro){//为未选中的时候改变为true,反之为true
 				pro.productsChecked = !pro.productsChecked;
@@ -313,8 +313,8 @@
 			updateCheckAllBtn() {// 全选勾选判断
 				let goodsCheckedLength = 0,
 					disabledListLength = 0,
-					goodsList = this.goodsList;
-					
+					goodsList = this.goodsList,
+					failureList = this.failureList;
 				goodsList.forEach(item => {
 					if(item.checked) {
 						goodsCheckedLength++;
@@ -323,7 +323,12 @@
 						disabledListLength++;
 					}
 				})
-				this.isCheckAll = goodsCheckedLength === goodsList.length - disabledListLength;
+				failureList.forEach(failureItem=>{
+					if(failureItem.productsChecked){
+						goodsCheckedLength++;
+					}
+				})
+				this.isCheckAll = goodsCheckedLength === goodsList.length+failureList.length - disabledListLength;
 			},
 			checkShop(item){//与单选商品类似
 				item.checked = !item.checked;
@@ -347,10 +352,7 @@
 						pros.productsChecked = false;
 					}
 				})
-				//删除按钮 全选包括失效商品勾选
-				this.failureList.forEach(failureItem=>{
-					failureItem.productsChecked = !failureItem.productsChecked;
-				})
+				
 			},
 			updateBothCheckBtn() {
 				if(this.isshowDelbtn) {
@@ -359,7 +361,10 @@
 						item.checked = this.isCheckAll;
 						this.setProductChecked(item);
 					})
-					
+					//删除按钮 全选包括失效商品勾选
+					this.failureList.forEach(failureItem=>{
+						failureItem.productsChecked = this.isCheckAll;
+					})
 				} else {
 					this.goodsList.forEach((item)=>{
 						item.checked = this.isCheckAll && !item.isDisabled;
@@ -612,7 +617,6 @@
 					this.$util.msg("请选择要删除的商品~",2000);
 					return
 				}else{			
-					console.log(this.delGoodsList);
 					this.$util.modal('','确定删除选中的商品吗?','确定','取消',true,() =>{
 						shoppingCartDelete({userID:this.userID,productIDs:this.delGoodsList}).then(response =>{
 							this.$util.msg('删除成功',2000);
@@ -627,9 +631,7 @@
 				}
 			},
 			deletefailureList(){
-				this.failureList.forEach(failure=>{
-					this.delGoodsList += failure.productID+','
-				})
+				this.failureList.forEach(failure=>{ this.delGoodsList += failure.productID+',' })
 				this.$util.modal('','确定清空全部失效商品吗?','确定','取消',true,() =>{
 					shoppingCartDelete({userID:this.userID,productIDs:this.delGoodsList}).then(response =>{
 						this.$util.msg('删除成功',2000);
@@ -1038,7 +1040,7 @@
 				}
 				.pros-marks{
 					width: 722rpx;
					height: 250rpx;
-					z-index: 8888;
+					z-index: 90;
 					background: rgba(0,0,0,.05);
 					position: absolute;
 					left:0;
@@ -1125,7 +1127,7 @@
 		height: 110rpx;
 		position: fixed;
 		bottom: 0rpx;
-		z-index: 10;
+		z-index: 100;
 		.footer-le{
 			width: 490rpx;
 			height: 100%;

+ 23 - 22
pages/tabBar/cart/cart.vue

@@ -3,7 +3,7 @@
 		<tui-skeleton v-if="skeletonShow" backgroundColor="#fafafa" borderRadius="10rpx" :isLoading	="true" :loadingType="5"></tui-skeleton>
 		<view class="container-cart-main tui-skeleton">
 			<view v-if="!isEmpty" class="container-cart">
-				<scroll-view class="cart-content"  scroll-y  @scrolltolower="toLower" :style="{paddingBottom :isIphoneX ? (68+100)+'rpx' : '100rpx'}">
+				<view class="cart-content" :style="{paddingBottom :isIphoneX ? '130rpx' : '100rpx'}">
 					<view class="goods-list">
 						<view v-for="(item, index) in goodsList" :key="index" class="goods-item">
 							<view class="shoptitle">
@@ -67,9 +67,8 @@
 									<!--选择商品-->
 									<view class="checkbox-box" @click.stop="ischeckFailure(failure)" v-if="isshowDelbtn">
 										<button class="checkbox iconfont" 
-										:disabled="!isCheckAll"
-										:class="[failure.productsChecked ?'icon-gouxuanl':'icon-weigouxuan']">
-									</button>
+												:class="[ failure.productsChecked ? 'icon-gouxuanl':'icon-weigouxuan']">
+										</button>
 									</view>
 									<view class="pros-img">
 										<image :src="failure.mainImage ? failure.mainImage:''" alt="" />
@@ -85,9 +84,9 @@
 							</view>
 						</view>	
 					</view>
-				</scroll-view>
+				</view>
 				<!-- 脚部菜单 -->
-				<view class="footer" :style="{paddingBottom :isIphoneX ? '68rpx' : '0rpx'}">
+				<view class="footer">
 					<view class="footer-le">
 						<view class="foot-check checkbox-box" @tap.stop="checkAll()">
 							<button class="checkbox iconfont" :class="[isCheckAll?'icon-gouxuan':'icon-weigouxuan']"></button> 
@@ -275,7 +274,8 @@
 				})
 			},
 			ischeckFailure(failure){
-				failure.productsChecked = !failure.productsChecked;
+				failure.productsChecked = !failure.productsChecked
+				this.updateCheckAllBtn()
 			},
 			ischeck(item,pro){//为未选中的时候改变为true,反之为true
 				pro.productsChecked = !pro.productsChecked;
@@ -305,8 +305,8 @@
 			updateCheckAllBtn() {// 全选勾选判断
 				let goodsCheckedLength = 0,
 					disabledListLength = 0,
-					goodsList = this.goodsList;
-					
+					goodsList = this.goodsList,
+					failureList = this.failureList;
 				goodsList.forEach(item => {
 					if(item.checked) {
 						goodsCheckedLength++;
@@ -315,7 +315,12 @@
 						disabledListLength++;
 					}
 				})
-				this.isCheckAll = goodsCheckedLength === goodsList.length - disabledListLength;
+				failureList.forEach(failureItem=>{
+					if(failureItem.productsChecked){
+						goodsCheckedLength++;
+					}
+				})
+				this.isCheckAll = goodsCheckedLength === goodsList.length+failureList.length - disabledListLength;
 			},
 			checkShop(item){//与单选商品类似
 				item.checked = !item.checked;
@@ -339,10 +344,7 @@
 						pros.productsChecked = false;
 					}
 				})
-				//删除按钮 全选包括失效商品勾选
-				this.failureList.forEach(failureItem=>{
-					failureItem.productsChecked = !failureItem.productsChecked;
-				})
+				
 			},
 			updateBothCheckBtn() {
 				if(this.isshowDelbtn) {
@@ -351,7 +353,10 @@
 						item.checked = this.isCheckAll;
 						this.setProductChecked(item);
 					})
-					
+					//删除按钮 全选包括失效商品勾选
+					this.failureList.forEach(failureItem=>{
+						failureItem.productsChecked = this.isCheckAll;
+					})
 				} else {
 					this.goodsList.forEach((item)=>{
 						item.checked = this.isCheckAll && !item.isDisabled;
@@ -604,7 +609,6 @@
 					this.$util.msg("请选择要删除的商品~",2000);
 					return
 				}else{			
-					console.log(this.delGoodsList);
 					this.$util.modal('','确定删除选中的商品吗?','确定','取消',true,() =>{
 						shoppingCartDelete({userID:this.userID,productIDs:this.delGoodsList}).then(response =>{
 							this.$util.msg('删除成功',2000);
@@ -619,9 +623,7 @@
 				}
 			},
 			deletefailureList(){
-				this.failureList.forEach(failure=>{
-					this.delGoodsList += failure.productID+','
-				})
+				this.failureList.forEach(failure=>{ this.delGoodsList += failure.productID+',' })
 				this.$util.modal('','确定清空全部失效商品吗?','确定','取消',true,() =>{
 					shoppingCartDelete({userID:this.userID,productIDs:this.delGoodsList}).then(response =>{
 						this.$util.msg('删除成功',2000);
@@ -781,7 +783,6 @@
 	.goods-list{
 		width: 100%;
 		height: auto;
-		border-top: 1px solid #EBEBEB;
 		background-color: #F7F7F7;
 		.goods-item{
 			width: 702rpx;
@@ -1059,7 +1060,7 @@
 				}
 				.pros-marks{
 					width: 722rpx;
					height: 250rpx;
-					z-index: 9;
+					z-index: 90;
 					background: rgba(0,0,0,.05);
 					position: absolute;
 					left:0;
@@ -1146,7 +1147,7 @@
 		height: 110rpx;
 		position: fixed;
 		bottom: 0rpx;
-		z-index: 10;
+		z-index: 100;
 		.footer-le{
 			width: 490rpx;
 			height: 100%;