lilei hai 9 meses
pai
achega
99abe51ec8

+ 2 - 2
App.vue

@@ -1,9 +1,9 @@
 <script>
 	export default {
 		globalData: {
-			// baseUrl: 'http://192.168.2.113:9110/saas/clz/', // 本地
+			baseUrl: 'http://192.168.2.113:9110/saas/clz/', // 本地
 			// baseUrl: 'https://md.test.zyucgj.com/saas/clz/', // 预发布
-			baseUrl: 'https://car.zyucgj.com/saas/clz/' // 生产
+			// baseUrl: 'https://car.zyucgj.com/saas/clz/' // 生产
 		},
 		onLaunch: function() {
 			console.log('App Launch');

+ 4 - 0
pages/index/index.vue

@@ -631,6 +631,9 @@
 			// 商城信息, flag: true 再次刷新,false 首次加载
 			getHasShopping(flag){
 				if(!flag){
+					uni.showLoading({
+						title: '加载中'
+					})
 					getShopStatus().then(res => {
 						this.hasShopiing = res.data && res.data.paramValue == 1
 						// 有商城
@@ -648,6 +651,7 @@
 						}
 						// 查询是否有数字货架
 						this.getStoreShelf(flag)
+						uni.hideLoading()
 					})
 				}else{
 					if(!this.hasShopiing){

+ 49 - 24
pagesB/cart/index.vue

@@ -21,7 +21,7 @@
 				@scrolltolower="onreachBottom">
 					<sticky-header>
 						 <!-- 头部 -->
-						 <view class="cart-head">
+						 <view class="cart-head" v-if="total>0">
 						 	<view class="cart-head-left">共<text>{{total}}</text>款商品</view>
 						 	<view class="cart-head-right">
 								<view class="cart-head-btton blue" @click="editAll">
@@ -40,14 +40,14 @@
 					@remove="removeCart">
 					</productItem>
 					<!-- loading -->
-					<view class="loading-bar" v-if="list.length==0 && status!='loading'">{{noDataText}}</view>
-					<view class="empty-bar" v-if="(total>=list.length&&list.length)||status!='loading'">
+					<view class="loading-bar" v-if="total>0 && status!='loading'">{{noDataText}}</view>
+					<view class="empty-bar" v-if="total==0 && status!='loading'">
 						<image mode="aspectFit" :src="empty.imgUrl"></image>
 						<view>{{empty.tip}}</view>
 					</view>
 				</scroll-view>
 				<!-- 底部 -->
-				<view class="cart-footer">
+				<view class="cart-footer" v-if="total>0">
 					<view class="cart-footer-box">
 						<view class="cart-footer-left">
 								<view class="cart-footer-left-all" @click="chooseAll">
@@ -60,7 +60,7 @@
 								</view>
 						</view>
 						<view class="cart-footer-right">
-							<view class="cart-footer-left-price" v-if="!editFlag">
+							<view class="cart-footer-left-price" v-if="!editFlag && totalAmount">
 								<view class="cart-footer-left-price-text">
 									<text>合计:</text>
 								</view>
@@ -72,7 +72,7 @@
 								<text>清空购物车</text>
 							</view> -->
 							<view class="cart-footer-right-button">
-								<button class="btns" v-if="!editFlag" type="warn" size="mini" @click="settlement">去结算</button>
+								<button class="btns" v-if="!editFlag" type="warn" size="mini" @click="settlement">去结算({{totalNum}})</button>
 								<button v-else class="btns" type="warn" plain size="mini" @click="batchRemove">删除</button>
 							</view>
 						</view>
@@ -157,10 +157,24 @@
 			  getCartList(params).then(res => {
 				if (res.status == 200) {
 				  const list = res.data.list
+				  const ret = []
 				  list.forEach(key => {
-				  		key.checked = this.allChecked
+						ret.push({
+							id: key.id,
+							checked: this.allChecked,
+							cartSn: key.cartSn,
+							price: key.price,
+							qty: key.qty,
+							productSn: key.productSn,
+							productName: key.productEntity.productName,
+							productImage: key.productEntity.images,
+							productCode: key.productEntity.code,
+							productOrigCode: key.productEntity.origCode,
+							unit: key.productEntity.unit,
+							enabledFlag: key.enabledFlag
+						})
 				  })
-				  _this.list.push(list)
+				  _this.list.push(ret)
 				  _this.total = res.data.count || 0
 				} else {
 				  _this.list = []
@@ -172,11 +186,14 @@
 			},
 			// scroll-view到底部加载更多
 			onreachBottom() {
-				if(this.list.length < this.total){
+				// 判断是否最后一页
+				const maxPages = Math.ceil(this.total / this.pageSize)
+				if(this.pageNo >= maxPages){
+					this.status = "nomore"
+					this.noDataText = '没有更多了'
+				}else{
 					this.pageNo += 1
 					this.getRow()
-				}else{
-					this.status = "nomore"
 				}
 			},
 			// 根据cartSn查找
@@ -187,6 +204,9 @@
 			},
 			// 已选产品变更数量
 			changeQty(val,cartSn){
+				uni.showLoading({
+					title: '加载中'
+				})
 				updateCart({
 					cartSn: cartSn,
 					qty: val
@@ -200,6 +220,7 @@
 							this.getChooseHeji()
 						}
 					}
+					uni.hideLoading()
 				})
 			},
 			// 选择
@@ -287,37 +308,42 @@
 							const snList = []
 							 _this.list.forEach(item => {
 							 	item.filter(k=>k.checked).forEach(s=>{
-							 		snList.push(s.cartSns)
+							 		snList.push(s.cartSn)
 							 	})
 							 })
+							  
 							 // 删除购物车
-							 this.removeCart(snList)
+							 _this.removeCart(snList,true)
 						}
 					}
 				})
 			},
 			// 删除商品
-			removeCart(snList){
+			removeCart(snList,isBatch){
 				const _this = this
+				uni.showLoading({
+					title: '删除中'
+				})
 				deleteCart({cartSns:snList}).then(ret => {
 					 if(ret.status == 200){
 						 uni.showToast({
 							 title: '删除成功',
 							 icon: 'none'
 						 })
-						 // 如果全选
-						 if(_this.allChecked){
-							 _this.list = []
-							 _this.allChecked = false
-						 }
 						 snList.forEach(sn => {
-							 _this.removeChoose(sn,snList.length>1)
+							 _this.removeChoose(sn,isBatch)
 						 })
-						 // 合计
-						 if(snList.length>1){
+						 // 合计,批量操作
+						 if(isBatch){
+							 // 如果全选
+							 if(_this.allChecked){
+								 _this.list = []
+								 _this.allChecked = false
+							 }
 							 _this.getChooseHeji()
 						 }
 					 }
+					 uni.hideLoading()
 				})
 			},
 			// 去结算
@@ -337,7 +363,7 @@
 				this.totalNum = 0
 				this.list.forEach(key => {
 					key.filter(item=>item.checked).forEach(item => {
-						this.totalAmount += item.cost * item.qty // 总金额
+						this.totalAmount += item.price * item.qty // 总金额
 						this.totalNum += item.qty // 总数量
 					})
 				})
@@ -501,7 +527,6 @@
 					margin-left: 20rpx;
 					text-align: right;
 					.btns{
-						width: 120rpx;
 						border-radius: 100rpx;
 						height: 36px;
 					}

+ 2 - 2
pagesB/cart/productitem.vue

@@ -21,7 +21,7 @@
 						<text max-lines="2" overflow="ellipsis">{{item.productOrigCode}}</text>
 					</view>
 					<view class="choose-product-item-left-info-price">
-						<view class="price-txt">¥<text>{{item.cost}}</text></view>
+						<view class="price-txt">¥<text>{{item.price}}</text></view>
 						<view>
 							<view :style="{opacity:!item.edit?1:0,width:!item.edit?'auto':0}">
 								<view class="flex align_center qty-box">
@@ -67,7 +67,7 @@
 				this.$emit('changeQty', e, cartSn)
 			},
 			remove(cartSn){
-				this.$emit('remove', [cartSn])
+				this.$emit('remove', [cartSn], false)
 			},
 			checkItem(cartSn){
 				this.$emit('check',cartSn)

+ 4 - 3
pagesB/components/chooseProductItemSkline.vue

@@ -7,8 +7,8 @@
 		>
 			 <view>
 				 <view class="choose-product-item-img">
-					<image mode="aspectFit" :src="item.productImage+'?x-oss-process=image/resize,p_30'" style="width: 100%;height: 180rpx;"></image>
-					<view class="back-price" v-if="item.promoRuleValue">返<text>{{item.promoRuleValue}}</text>元</view>
+					<image mode="aspectFit" :src="item.productImage+'?x-oss-process=image/resize,p_30'" style="width: 100%;height: 100%;"></image>
+					<view class="back-price" v-if="item.promoRuleValue&&!isView">返<text>{{item.promoRuleValue}}</text>元</view>
 					<view class="choose-product-item-left-info-code ellipsis-one">{{item.productCode}}</view>
 				 </view>
 				 <view class="choose-product-item-info">
@@ -17,7 +17,7 @@
 						<text class="ellipsis-two" max-lines="2" overflow="ellipsis">{{item.productOrigCode}}</text>
 					</view>
 					<view class="choose-product-item-left-info-price">
-						<view class="price-txt">¥<text>{{item.cost}}</text></view>
+						<view class="price-txt">¥<text>{{isView ? item.price : item.cost}}</text></view>
 						<view v-if="!isView">
 							<uni-number-box v-if="!edit" v-model="item.qty" :min="1" :max="999999" @change="v=>{changeQty(v,item.id)}"></uni-number-box>
 							<view v-else class="edit-qty">
@@ -98,6 +98,7 @@
 		.choose-product-item-img{
 			margin-right: 20rpx;
 			width: 30%;
+			height: 180rpx;
 			position: relative;
 			overflow: hidden;
 			border: 1px solid #eee;

+ 2 - 2
pagesB/shopiing/productDetail.vue

@@ -129,7 +129,7 @@
 			// 购物车数量
 			this.cartCount()
 			// 获取产品详情
-			this.getDetail()
+			// this.getDetail()
 		},
 		// 分享
 		onShareAppMessage(e){
@@ -155,8 +155,8 @@
 					productSn: this.productSn
 				}).then(res => {
 					if(res.status == 200){
-						uni.hideLoading()
 					}
+					uni.hideLoading()
 				})
 			},
 			// 购物车数量

+ 21 - 1
pagesB/shopiing/searchProduct.vue

@@ -24,6 +24,7 @@
 				<!-- body -->
 				<scroll-view 
 				class="scrollPage-body" 
+				:class="clzId?'right-item':''"
 				:style="{height: (screenHeight - statusBarHeight - safeAreaBottom - 40) + 'px'}" 
 				scroll-y="true" 
 				type="custom" 
@@ -31,7 +32,7 @@
 					<!-- 搜索,吸顶 -->
 					<sticky-header>
 						<view class="search-head">
-							<uni-search-bar v-model="queryWord" :focus="focus" radius="100" placeholder="请输入商品名称/产品编码/原厂编码" bgColor="#fff" textColor="#666" clearButton="auto" cancelButton="none" @confirm="searchList" @clear="searchList" />
+							<uni-search-bar v-model="queryWord" :focus="focus" radius="100" placeholder="请输入商品名称/产品编码/原厂编码" :bgColor="clzId?'#f5f5f5':'#fff'" textColor="#666" clearButton="auto" cancelButton="none" @confirm="searchList" @clear="searchList" />
 						</view>
 					</sticky-header>
 					<!-- 产品列表 -->
@@ -40,6 +41,7 @@
 					:key="item.id"  
 					:index="index"
 					:list="item" 
+					:isView="true"
 					>
 					</chooseProductItem>
 					<!-- loading -->
@@ -294,6 +296,10 @@
 				width:100%;
 				.search-head input{
 					background-color: #FFFFFF;
+					border-radius: 10px;
+				}
+				/deep/ .choose-product-item{
+					background-color: #FFFFFF;
 				}
 				.loading-bar{
 					text-align: center;
@@ -353,6 +359,20 @@
 					}
 				}
 			}
+			.right-item{
+				/deep/ .choose-product-item{
+					margin: 5px 8px;
+					.choose-product-item-img{
+						height: 130rpx;
+					}
+					.choose-product-item-info .choose-product-item-left-info-name{
+						font-weight: normal;
+					}
+				}
+				.search-head{
+					background-color: #FFFFFF;
+				}
+			}
 		}
 	}
 }