Ver Fonte

修复bug,调整功能

gcz há 2 anos atrás
pai
commit
07131a8bed

+ 2 - 2
center/center.vue

@@ -22,7 +22,7 @@
 				<view class="up">
 					<u-icon :name="staticUrl+'/img/paycode.png'" color="#333333" size="42rpx"></u-icon>
 				</view>
-				<view class="down">付款码</view>
+				<view class="down">会员码</view>
 			</view>
 			<view class="property-item" @click="$u.route('/center/mybalance')">
 				<view class="up">{{memberInfo.balance}}</view>
@@ -105,7 +105,7 @@
 					refundNum:'0',
 				},
 				tools:[
-					{name:'充值中心',url:'/center/recharge',ico:this.$commonConfig.staticUrl+'/img/tool-chongzhi.png'},
+					// {name:'充值中心',url:'/center/recharge',ico:this.$commonConfig.staticUrl+'/img/tool-chongzhi.png'},
 					{name:'地址管理',url:'/center/addrlist',ico:this.$commonConfig.staticUrl+'/img/tool-map.png'},
 				]
 			}

+ 21 - 6
shopping/cart.vue

@@ -21,7 +21,7 @@
 					<u-swipe-action-item :show="item.show" :index="index" @click="swipeClick(index)" :options="options">
 					<view class="swipe-action">
 					<view class="swipe-action__content u-flex">
-					 <u-checkbox shape="circle" activeColor="#00A447" :key="index" :name="item.name" :checked="item.checked" @change="toggleCheck(index)" class="checkbox" />
+					<u-checkbox shape="circle" :disabled="item.quantity>item.stock" activeColor="#00A447" :key="index" :name="item.name" :checked="item.checked" @change="toggleCheck(index)" class="checkbox" />
 					<u--image @click="$u.route('/shopping/productdetails',{id:item.goodsId})" :showLoading="true" :src="item.mainImg" width="180rpx" height="180rpx"></u--image>
 					<view class="text">
 						<view class="name ellipsis-2" @click="$u.route('/shopping/productdetails',{id:item.goodsId})">{{item.goodsName}}</view>
@@ -42,11 +42,18 @@
 									<!-- <text class="sales gray">销量999+</text> -->
 								</view>
 							</view>
-							<u-number-box v-model="item.quantity" @change="changeQuantity(index, $event)" integer></u-number-box>
+							<u-number-box 
+								v-model="item.quantity" 
+								:max="item.stock" 
+								:asyncChange="true"
+								@change="changeQuantity(index, $event)" integer>
+							</u-number-box>
 						</view>
 					</view>
+					
 					</view>
 					</view>
+					<view class="tip" v-if="item.quantity>item.stock">库存不足</view>
 					</u-swipe-action-item>
 					</u-swipe-action>
 				</view>
@@ -240,9 +247,12 @@
 			// 切换全选状态
 			allCheckboxChange(n){
 				// console.log('allCheckboxChange',n[0]);
+				console.log('allCheckboxChange',n);
 				let selectAll = n[0]?true:false;
 				this.dataList.forEach(item => {
-				    item.checked = selectAll
+					if(item.quantity<=item.stock){
+						item.checked = selectAll
+					}
 				})
 			},
 			checkboxChange(n){
@@ -255,11 +265,11 @@
             },
             // 改变商品数量
             changeQuantity(index, value) {
-				this.changeQuantityApi(this.dataList[index].id,value.value)
+				this.changeQuantityApi(this.dataList[index].id,value.value,index)
             },
-			changeQuantityApi(id,num){
+			changeQuantityApi(id,num,index){
 				this.$u.api.updateQuantity({id:id,quantity:num}).then(res=>{
-					// this.dataList[index].quantity = num
+					this.dataList[index].quantity = num;
 					console.log('res',res.data);
 					}).catch(err=>{
 					console.log('changeQuantityApi',err.data);
@@ -402,6 +412,11 @@
 			border-radius: 20rpx;
 		}
 	}
+	.tip{
+		text-align: right;
+		margin-top: 20rpx;
+		color: #999;
+	}
 }
 .recommend{
 	padding: 0 20rpx 20rpx;

+ 15 - 10
shopping/order.vue

@@ -78,11 +78,11 @@
 				tabsCurrent:1,
 				tabsList:[
 					{name:'全部',status:'',},
-					{name:'待付款',status:'0',badge:{isDot:false}},
-					{name:'待出库',status:'1',badge:{isDot:false}},
-					{name:'待收货',status:'2',badge:{isDot:false}},
-					{name:'待评价',status:'3',badge:{isDot:false}},
-					{name:'退款/售后',status:'7',badge:{isDot:false}}
+					{name:'待付款',status:'0',badge:{isDot:false,value:null}},
+					{name:'待出库',status:'1',badge:{isDot:false,value:null}},
+					{name:'待收货',status:'2',badge:{isDot:false,value:null}},
+					{name:'待评价',status:'3',badge:{isDot:false,value:null}},
+					{name:'退款/售后',status:'7',badge:{isDot:false,value:null}}
 				],
 				status:'',
 				dataList:[],
@@ -314,19 +314,24 @@
 					let {noPayNum,deliverNum,collectNum,commentNum,refundNum} = res.data;
 					let noPayNumindex = this.tabsList.findIndex(item => item.status == 0);
 					if(noPayNum>0){
-						this.tabsList[1].badge.isDot = true;
+						this.tabsList[1].badge.isDot = false;
+						this.tabsList[1].badge.value = noPayNum;
 					}
 					if(deliverNum>0){
-						this.tabsList[2].badge.isDot = true;
+						this.tabsList[2].badge.isDot = false;
+						this.tabsList[2].badge.value = deliverNum;
 					}
 					if(collectNum>0){
-						this.tabsList[3].badge.isDot = true;
+						this.tabsList[3].badge.isDot = false;
+						this.tabsList[3].badge.value = collectNum;
 					}
 					if(commentNum>0){
-						this.tabsList[4].badge.isDot = true;
+						this.tabsList[4].badge.isDot = false;
+						this.tabsList[4].badge.value = commentNum;
 					}
 					if(refundNum>0){
-						this.tabsList[5].badge.isDot = true;
+						this.tabsList[5].badge.isDot = false;
+						this.tabsList[5].badge.value = refundNum;
 					}
 					// console.log('statisticsOrder',res.data);
 					// console.log('this.orderBadge',this.orderBadge);

+ 1 - 1
shopping/orderdetails.vue

@@ -162,7 +162,7 @@
 					1:[{name:'订单编号',key:'orderNum'},{name:'下单时间',key:'createTime'},{name:'支付方式',key:'payType'},{name:'支付时间',key:'payTime'}],
 					2:[{name:'订单编号',key:'orderNum'},{name:'下单时间',key:'createTime'},{name:'支付方式',key:'payType'},{name:'支付时间',key:'payTime'}],
 					3:[{name:'订单编号',key:'orderNum'},{name:'下单时间',key:'createTime'},{name:'支付方式',key:'payType'},{name:'支付时间',key:'payTime'}],
-					4:[{name:'订单编号',key:'orderNum'},{name:'下单时间',key:'createTime'},{name:'支付方式',key:'payType'},{name:'支付时间',key:'payTime'}],
+					4:[{name:'订单编号',key:'orderNum'},{name:'下单时间',key:'createTime'}],
 					5:[{name:'订单编号',key:'orderNum'},{name:'下单时间',key:'createTime'},{name:'支付方式',key:'payType'},{name:'支付时间',key:'payTime'}],
 					6:[{name:'订单编号',key:'orderNum'},{name:'下单时间',key:'createTime'},{name:'支付方式',key:'payType'},{name:'支付时间',key:'payTime'}],
 					7:[{name:'订单编号',key:'orderNum'},{name:'下单时间',key:'createTime'},{name:'支付方式',key:'payType'},{name:'支付时间',key:'payTime'}],

+ 15 - 5
shopping/productdetails.vue

@@ -94,13 +94,19 @@
 						<u-badge class="badge" numberType="overflow" type="error " max="99" :value="cartTotal" :absolute="true" :offset="[0,0]"></u-badge>
 					</view>
 				</view>
-				<view class="right u-flex" v-if="details.isCredit==1">
-					<view class="btn add-btn" @click="addCreditOrder(details.id)">立即兑换</view>
+				<view class="right" v-if="details.stock>0">
+					<view class="u-flex" v-if="details.isCredit==1">
+						<view class="btn add-btn" @click="addCreditOrder(details.id)">立即兑换</view>
+					</view>
+					<view class=" u-flex" v-else>
+						<view class="btn add-btn" @click="addCart(details.id)">加入购物车</view>
+						<view class="btn buy-btn" @click="buyNow(details.id)">立即购买</view>
+					</view>
 				</view>
-				<view class="right u-flex" v-else>
-					<view class="btn add-btn" @click="addCart(details.id)">加入购物车</view>
-					<view class="btn buy-btn" @click="buyNow(details.id)">立即购买</view>
+				<view class="right" v-else>
+					<view class="btn gray">暂无库存</view>
 				</view>
+				
 			</view>
 		</view>
 		<u-toast ref="uToast"></u-toast>
@@ -334,6 +340,10 @@
 		.buy-btn{
 			background-color: #FF3C3F;
 		}
+		.gray{
+			background-color: #ddd;
+			color: #999;
+		}
 	}
 	.share-btn{
 		padding: 0;

+ 12 - 6
shopping/submitorder.vue

@@ -46,7 +46,13 @@
 								<text class="price">¥ <text class="price-num">{{item.salePrice}}</text></text>
 							</view>
 						</view>
-						<u-number-box v-if="fromPage!='creditOrder'" v-model="item.quantity" @change="changeQuantity(index, $event)" integer></u-number-box>
+						<u-number-box 
+							v-if="fromPage!='creditOrder'" 
+							v-model="item.quantity" 
+							:max="item.stock" 
+							:asyncChange="true"
+							@change="changeQuantity(index, $event)" integer>
+						</u-number-box>
 					</view>
 				</view>
 			</view>
@@ -199,11 +205,11 @@
 			// },
 			// 改变商品数量
 			changeQuantity(index, value) {
-				console.log('goodsList',this.orderInfo.goodsList);
-				this.$nextTick(()=>{
-					this.settlement();
-				})
-				
+				// console.log('goodsList',this.orderInfo.goodsList);
+				// console.log('index',index);
+				// console.log('value',value);
+				this.orderInfo.goodsList[index].quantity = value.value;
+				this.settlement();
 			},
 			settlement(){
 				let orderType = 1;

+ 9 - 1
xushuo/cooperation.vue

@@ -114,7 +114,15 @@
 					// uni.$u.toast('校验通过')
 					// console.log('form',this.form);
 					this.$u.api.shopContact(this.form).then(res=>{
-						uni.$u.toast(res.msg)
+						uni.showToast({
+							title:'提交成功,工作人员将在3个工作日内联系您!',
+							icon:'none',
+							duration:5000
+						});
+						this.form={
+							name:'',
+							mobile:''
+						};
 						// uni.navigateBack()
 						// console.log('res',res.msg);
 					}).catch(err=>{