lilei 7 months ago
parent
commit
096187019d

+ 9 - 2
pages.json

@@ -460,14 +460,21 @@
 			}
 		},
 		{
-			"path" : "procureOrder",
+			"path" : "procureOrder/creatOrder",
+			"style" : 
+			{
+				"navigationBarTitleText" : "确定采购订单"
+			}
+		},
+		{
+			"path" : "procureOrder/orderDetail",
 			"style" : 
 			{
 				"navigationBarTitleText" : "采购订单"
 			}
 		},
 		{
-			"path" : "procureOrderList",
+			"path" : "procureOrder/orderList",
 			"style" : 
 			{
 				"navigationBarTitleText" : "采购订单"

+ 1 - 1
pages/morePage/morePage.vue

@@ -171,7 +171,7 @@
 								text: '采购订单',
 								icon: 'purchaseorder',
 								auth: this.$hasPermissions('M_procureOrder_mini'),
-								path: '/pagesB/procureOrderList',
+								path: '/pagesB/procureOrder/orderList',
 								color: '#ffaa00'
 							}
 						],

+ 1 - 1
pagesB/cart/index.vue

@@ -556,7 +556,7 @@
 						res.data.detailList = []
 						this.$store.state.vuex_tempData = res.data
 						uni.navigateTo({
-							url: "/pagesB/procureOrder"
+							url: "/pagesB/procureOrder/orderDetail"
 						})
 					}else{
 						uni.showToast({

+ 22 - 0
pagesB/procureOrder/creatOrder.vue

@@ -0,0 +1,22 @@
+<template>
+	<view>
+		
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				
+			}
+		},
+		methods: {
+			
+		}
+	}
+</script>
+
+<style>
+
+</style>

+ 0 - 0
pagesB/procureOrder.vue → pagesB/procureOrder/orderDetail.vue


+ 1 - 1
pagesB/procureOrderList.vue → pagesB/procureOrder/orderList.vue

@@ -231,7 +231,7 @@
 			viewRow(item){
 				this.$store.state.vuex_tempData = item
 				uni.navigateTo({
-					url: "/pagesB/procureOrder?purchaseSn="+item.purchaseSn+"&state="+item.billStatus
+					url: "/pagesB/procureOrder/orderDetail?purchaseSn="+item.purchaseSn+"&state="+item.billStatus
 				})
 			}
 		}

+ 353 - 53
pagesB/shopiing/productDetail.vue

@@ -79,7 +79,7 @@
 					</view>
 				</view>
 				<view class="footer-right">
-					<view class="footer-right-item" @click="addCart($event)">
+					<view class="footer-right-item" @click="toAddCart">
 						<text>加入购物车</text>
 					</view>
 					<view class="footer-right-item" @click="toBuy">
@@ -91,16 +91,17 @@
 		</view>
 		<!-- 购物车动画 -->
 		<uni-cart-animation ref="cartAnimation" @animationfinish="animationfinish"></uni-cart-animation>
-		<!-- 立即购买 -->
+		<!-- 立即购买和付款 -->
 		<page-container
 		:show="showPopu" 
 		:round="true"
 		:z-index="100"
-		position="center" 
-		customStyle="right: 0; left: 0; top: 0; bottom: 0; margin: auto 10%;width: fit-content;height: fit-content;border-radius:15px;"
+		position="bottom" 
+		customStyle="border-radius:15px 15px 0 0;"
 		@afterleave="closePopu">
-			<view class="popu-content" v-if="detail">
-				<view class="popu-close" @click="showPopu=false">
+			<!-- 确认订单 -->
+			<view class="popu-content" v-if="detail&&!showPay">
+				<view class="popu-close" @click="cancelBuy">
 					<uni-icons size="26" type="closeempty"></uni-icons>
 				</view>
 				<view class="pupu-box">
@@ -126,10 +127,6 @@
 								特价<text>¥{{detail.orginPrice}}</text>
 							</view>
 						</view>
-						<view class="popu-content-num flex align_center justify_between">
-							<text>数量</text>
-							<uni-number-box v-model="qty" :input-width="150" :input-height="60" :min="1" :max="999"></uni-number-box>
-						</view>
 					</view>
 				</view>
 				<view class="pupu-box gift-box" v-if="giftNum">
@@ -151,12 +148,82 @@
 						</view>
 					</view>
 				</view>
+				<view class="pupu-box-item">
+					<view class="popu-content-num flex align_center justify_between">
+						<text>数量</text>
+						<!-- <uni-number-box v-model="qty" :input-width="60" :input-height="40" :min="1" :max="999"></uni-number-box> -->
+						<view class="flex align_center qty-box">
+							<view class="qty-btn" @click="changeQty(qty-1)" :class="(qty <= 1)?'qty-disabled':''">-</view>
+							<view class="qty-num" @click="$refs.showPopu.open()" :style="{width:Number(qty).toString().length*8+10+'px'}">
+								{{qty}}
+							</view>
+							<view class="qty-btn" @click="changeQty(qty+1)" :class="(qty >= 999)?'qty-disabled':''">+</view>
+						</view>
+					</view>
+					<view class="flex align_center justify_between" v-if="shelfInfo">
+						<text>配送商:{{shelfInfo.dealerName}}</text>
+						<view @click="callPhone()"><uni-icons size="18" type="phone" color="dodgerblue"></uni-icons><text style="font-size:12px;">拨打</text></view>
+					</view>
+					<!-- <view class="flex align_center justify_between" v-if="shelfInfo">
+						<text>支付方式:在线支付</text>
+						<view><uni-icons size="18" type="right" color="dodgerblue"></uni-icons></view>
+					</view> -->
+				</view>
 				<view class="popu-content-btn">
-					<view class="popu-content-btn-item cancelBtn" @click="showPopu=false">取消</view>
-					<view class="popu-content-btn-item okbtn" @click="toBuy">确定采购</view>
+					<view class="popu-content-btn-item cartbtn" v-if="isAddCart" @click="submitCart($event)">加入购物车</view>
+					<view class="popu-content-btn-item okbtn" v-if="!isAddCart" @click="toBuy">
+						{{hasPay?'立即支付':'确定采购'}}
+						<text class="payAmount" v-if="payAmount&&hasPay">¥{{payAmount}}</text>
+					</view>
+				</view>
+			</view>
+			<!-- 确认付款 -->
+			<view class="popu-content" v-if="payInfo&&showPay">
+				<view class="popu-close" @click="cancelPay">
+					<uni-icons size="26" type="closeempty"></uni-icons>
+				</view>
+				<view class="pupu-box-pay-item">
+					<view class="popu-content-amount flex align_center justify_center">
+						<view>¥{{payInfo.totalAmount}}</view>
+					</view>
+					<view class="flex align_center justify_between" v-if="payInfo.totalSpecialGiveAmount>0">
+						<text>总优惠</text>
+						<view class="popu-content-price">¥{{payInfo.totalSpecialGiveAmount}}</view>
+					</view>
+					<view class="flex align_center justify_between" v-if="payInfo.totalTicketGiveAmount>0">
+						<text>代金券</text>
+						<view class="popu-content-price">¥{{payInfo.totalTicketGiveAmount}}</view>
+					</view>
+					<view style="height: 10px;background: #f8f8f8;"></view>
+					<view class="popu-content-title flex align_center justify_between">
+						<text>付款方式</text>
+						<view></view>
+					</view>
+					<view class="popu-content-pay flex align_center justify_between">
+						<view><uni-icons size="20" type="weixin" color="#4CAF50"></uni-icons> <text style="margin-left: 5px;">微信支付</text></view>
+						<view><uni-icons size="22" type="checkbox-filled" color="red"></uni-icons></view>
+					</view>
+				</view>
+				<view class="popu-content-btn">
+					<view class="popu-content-btn-item okbtn" @click="confirmPay">确定付款</view>
 				</view>
 			</view>
 		</page-container>
+		<!-- 修改数量弹框 -->
+		<uni-popup ref="showPopu" type="center" style="z-index: 1500;" :maskClick="false">
+			<view class="popu-nums-content">
+				<view class="popu-close" @click="$refs.showPopu.close()">
+					<uni-icons size="26" type="closeempty"></uni-icons>
+				</view>
+				<view class="popu-content-title flex align_center justify_center"><text>修改商品数量</text></view>
+				<view class="popu-content-num flex align_center justify_center">
+					<uni-number-box v-model="qty" :size="28" :input-width="280" :input-height="70" :min="1" :max="999"></uni-number-box>
+				</view>
+				<view class="popu-content-btn">
+					<view class="popu-content-btn-item okbtn" @click="$refs.showPopu.close()">确定</view>
+				</view>
+			</view>
+		</uni-popup>
 	</view>
 </template>
 
@@ -185,8 +252,12 @@
 				    x: 10,
 				    y:uni.getSystemInfoSync().windowHeight - 30
 				},
-				submitOk: false,
-				refashOk: false
+				submitOk: false, // 是否成功
+				cacelOk: false, // 是否取消
+				refashOk: false, // 是否刷新页面
+				showPay: false, // 是否显示付款信息
+				hasPay: true ,// 是否开通支付
+				isAddCart: false, // 是否加入购物车
 			}
 		},
 		onLoad(option) {
@@ -213,12 +284,30 @@
 			userInfo(){
 				return this.$store.state.vuex_userInfo
 			},
+			// 货架经销商信息
+			shelfInfo(){
+				return this.$store.state.vuex_storeShelf
+			},
+			// 经销商电话
+			dealerPhone(){
+				const shelfInfo = this.shelfInfo
+				return shelfInfo&&shelfInfo.contactMobile ? shelfInfo.contactMobile : ''
+			},
 			totalNum(){
 				return this.hasLogin&&this.userInfo.sysUserFlag == '1' ? this.$store.state.vuex_cartTotal : 0
 			},
 			// 赠品数量
 			giftNum(){
 				return this.detail && this.detail.promoType=='BUY_PROD_GIVE_PROD' ? Math.floor(this.qty / this.detail.conditionValue)*this.detail.resultValue : 0
+			},
+			// 支付总金额
+			payAmount(){
+				const price = this.detail && this.detail.priceStr ? this.detail.priceStr.join('.') : 0
+				return price ? Number(price*this.qty).toFixed(2) : 0
+			},
+			// 付款信息
+			payInfo(){
+				return this.$store.state.vuex_tempData
 			}
 		},
 		methods: {
@@ -243,6 +332,14 @@
 					urls: this.imgList
 				})
 			},
+			// 联系经销商
+			callPhone() {
+				if(this.dealerPhone!=''){
+					uni.makePhoneCall({
+						phoneNumber: this.dealerPhone
+					})
+				}
+			},
 			// 产品详情
 			getDetail(){
 				uni.showLoading({
@@ -289,34 +386,47 @@
 			animationfinish(){
 				this.loading = false
 			},
+			changeQty(value) {
+				const max = 999
+				const v = value > max ? max : (value==''||value==0?1:value)
+				this.qty = v
+			},
 			// 加入购物车
-			addCart(event){
+			toAddCart(){
+				// 未登录
 				if(this.hasLogin){
 					// 游客未认证
 					if(this.userInfo.sysUserFlag == '0'){
 						toAuthStore()
 					}else{
-						if(this.loading){
-							return
-						}
-						this.loading = true
-						this.$refs.cartAnimation.touchOnGoods(event,this.busPos);
-						// 加入购物车
-						addCart({
-							qty: 1,
-							price: this.detail.price,
-							productSn: this.detail.productSn
-						}).then(res => {
-							if(res.status == 200){
-								uni.$emit('refashCart')
-							}
-						})
+						// 打开确认数量弹框
+						this.isAddCart = true
+						this.showPopu = true
 					}
 				}else{
 					toLogin()
 				}
 			},
-			// 打开购物车
+			// 确定加入购物车
+			submitCart(event){
+				if(this.loading){
+					return
+				}
+				this.loading = true
+				this.$refs.cartAnimation.touchOnGoods(event,this.busPos);
+				// 加入购物车
+				addCart({
+					qty: this.qty,
+					price: this.detail.price,
+					productSn: this.detail.productSn
+				}).then(res => {
+					if(res.status == 200){
+						uni.$emit('refashCart')
+						this.showPopu = false
+					}
+				})
+			},
+			// 打开购物车页面
 			toCart(){
 				if(this.hasLogin){
 					// 游客未认证
@@ -348,8 +458,8 @@
 							if(!this.showPopu){
 								this.showPopu = true
 							}else{
-								// 提交
-								this.submitOrder()
+								// 去结算生产订单
+								this.creatOrder()
 							}
 						}
 					}
@@ -357,8 +467,12 @@
 					toLogin()
 				}
 			},
+			// 取消立即购买
+			cancelBuy(){
+				this.resetPage()
+			},
 			// 去结算
-			submitOrder(){
+			creatOrder(){
 				uni.showLoading({
 					title: '提交中...',
 					mask: true
@@ -425,6 +539,7 @@
 							}
 				})
 			},
+			// 创建订单
 			submitForm(detailList){
 				uni.showLoading({
 					title: '提交中...',
@@ -436,8 +551,15 @@
 					if(res.status == 200){
 						res.data.detailList = []
 						this.$store.state.vuex_tempData = res.data
-						this.showPopu = false
-						this.submitOk = true
+						// 打开确认付款弹框,这里判断是否开通支付,如果开通
+						if(this.hasPay){
+							this.showPay = true
+						}else{
+							// 创建成功,跳转到订单详情页
+							this.showPopu = false
+							this.submitOk = true
+						}
+						uni.hideLoading()
 					}else{
 						uni.hideLoading()
 						uni.showToast({
@@ -447,25 +569,87 @@
 					}
 				})
 			},
-			// 关闭后
+			// 关闭确定订单弹窗
 			closePopu(){
 				this.showPopu = false
-				this.qty = 1
 				// 刷新页面
 				if(this.refashOk){
+					this.qty = 1
 					this.getDetail()
+				}else{
+					// 开通了支付
+					if(this.hasPay){
+						// 付款
+						if(this.showPay){
+							// 确定取消付款或付款失败
+							if(this.cacelOk){
+								this.cacelOk = false
+							}
+							// 确定付款成功
+							if(this.submitOk){
+								this.submitOk = false
+							}
+							// 去订单详情页
+							this.toOrderDetial()
+						}else{
+							// 取消立即购买
+							this.resetPage()
+						}
+					}else{
+						// 未开通支付
+						// 去订单详情页
+						if(this.submitOk){
+							this.submitOk = false
+							this.toOrderDetial()
+						}else{
+							// 取消采购
+							this.resetPage()
+						}
+					}
 				}
-				// 提交代码
-				if(this.submitOk){
-					this.submitOk = false
-					uni.navigateTo({
-						url: "/pagesB/procureOrder"
-					})
-				}
+			},
+			// 确认付款
+			confirmPay(){
+				this.showPopu = false
+				this.submitOk = true
+			},
+			// 确认取消付款弹框
+			cancelPay(){
+				const _this = this
+				uni.showModal({
+					title: '确定取消支付吗?',
+					content: '您的订单在30分钟内未支付将被取消,请尽快完成支付。',
+					confirmText: '继续支付',
+					cancelText: '取消支付',
+					success(ret) {
+						// 确定取消,跳转到订单详情页
+						if(!ret.confirm){
+							_this.showPopu = false
+							_this.cacelOk = true
+						}
+					}
+				})
+			},
+			// 重置页面
+			resetPage(){
+				this.qty = 1
+				this.isAddCart = false
+				this.showPopu = false
+				this.showPay = false
+				this.cacelOk = false
+				this.submitOk = false
 				setTimeout(()=>{
 					uni.hideLoading()
 				},300)
 			},
+			// 订单详情页
+			toOrderDetial(){
+				this.resetPage()
+				// 跳转到订单详情页面
+				uni.navigateTo({
+					url: "/pagesB/procureOrder/orderDetail"
+				})
+			}
 		}
 	}
 </script>
@@ -629,7 +813,7 @@
 				display: flex;
 				align-items: center;
 				justify-content: space-between;
-				height: 50px;
+				height: 45px;
 			}
 			.footer-left{
 				display: flex;
@@ -664,9 +848,12 @@
 			}
 			.footer-right{
 				width: 60%;
-				height: 100%;
+				height: 80%;
 				display: flex;
 				align-items: center;
+				border-radius: 50px;
+				overflow: hidden;
+				margin: 0 5px;
 				.footer-right-item{
 					height: 100%;
 					display: flex;
@@ -685,7 +872,58 @@
 				}
 			}
 		}
-		
+		.popu-nums-content{
+			background-color: #FFFFFF;
+			border-radius: 10px;
+			width: 300px;
+			display: flex;
+			flex-direction: column;
+			align-items: center;
+			padding: 10px 15px;
+			.popu-close{
+				padding: 10px;
+				position: absolute;
+				right: 0;
+				top: 0;
+			}
+			.popu-content-title{
+				padding: 10px;
+				font-size: 16px;
+			}
+			.popu-content-num{
+				font-size: 14px;
+				color: #999999;
+				padding: 10px 0;
+				> text{
+					margin-right: 10px;
+					font-size: 10px;
+				}
+			}
+			.popu-content-btn{
+				width: 100%;
+				display: flex;
+				align-items: center;
+				justify-content: space-around;
+				margin: 20px 0 10px;
+				.popu-content-btn-item{
+					width: 40%;
+					height: 32px;
+					font-size: 14px;
+					display: flex;
+					align-items: center;
+					justify-content: center;
+					border-radius: 100px;
+				}
+				.cancelBtn{
+					background-color: #f8f8f8;
+					color: #666;
+				}
+				.okbtn{
+					background-color: #f70000;
+					color: #FFFFFF;
+				}
+			}
+		}
 		.popu-content{
 				display: flex;
 				flex-direction: column;
@@ -697,6 +935,38 @@
 					right: 0;
 					top: 0;
 				}
+				.qty-box{
+					display: flex;
+					.qty-btn{
+						display: flex;
+						align-items: center;
+						justify-content: center;
+						width: 22px;
+						height: 20px;
+						border-radius: 50px;
+						font-size: 18px;
+						color: #066cff;
+						&.qty-disabled{
+							color: #999;
+						}
+					}
+					.qty-num{
+						width: 24px;
+						height: 20px;
+						line-height: 20px;
+						text-align: center;
+						background-color: #efefef;
+						margin: 0 3px;
+						border-radius: 3px;
+						font-size: 12px;
+						input{
+							width: 100%;
+							height: 100%;
+							text-align: center;
+							color: #333;
+						}
+					}
+				}
 				.pupu-box{
 					display: flex;
 					justify-content: space-between;
@@ -737,6 +1007,9 @@
 					}
 					.popu-content-num{
 						padding:5px 0;
+						>text{
+						  font-size: 10px;
+						}
 					}
 					.rebate-tag{
 						margin: 0 5px 0 0;
@@ -765,13 +1038,31 @@
 						}
 					}
 				}
+				.pupu-box-item,.pupu-box-pay-item{
+					width: 100%;
+					padding-top: 10px;
+					> view{
+						padding: 10px 0;
+					}
+				}
+				.pupu-box-pay-item{
+					> view{
+						padding: 6px 0;
+					}
+					.popu-content-amount{
+						font-size: 24px;
+						color: red;
+					}
+					.popu-content-title{
+						font-weight: bold;
+					}
+					.popu-content-pay{
+						padding: 10px 0;
+					}
+				}
 				.popu-content-num{
-					font-size: 12px;
-					color: #999999;
-					padding: 10px 0;
 					> text{
 						margin-right: 10px;
-						font-size: 10px;
 					}
 				}
 				.popu-content-btn{
@@ -781,7 +1072,7 @@
 					justify-content: space-around;
 					margin: 20px 0 10px;
 					.popu-content-btn-item{
-						width: 40%;
+						width: 30%;
 						height: 34px;
 						font-size: 14px;
 						display: flex;
@@ -796,6 +1087,15 @@
 					.okbtn{
 						background-color: #f70000;
 						color: #FFFFFF;
+						width: 65%;
+						.payAmount{
+							margin-left: 5px;
+						}
+					}
+					.cartbtn{
+						background-color: #ffa60c;
+						color: #FFFFFF;
+						width: 65%;
 					}
 				}
 		}