zhengjinyi 4 سال پیش
والد
کامیت
a6273852b0

+ 16 - 8
components/cm-module/orderDetails/orderButton.vue

@@ -2,16 +2,16 @@
 	<view class="button-template" :style="{paddingBottom :isIphoneX ? '68rpx' : '0rpx'}">
 		<!-- 底部按钮 -->
 		<view class="button-content">
-			<view class="btn btn-pay" v-if="btnState.isPay" @click.stop="btnConfirm('pay')">付款</view>
+			<view class="btn btn-pay" v-if="btnState.isPay" @click.stop="btnConfirm('pay',order)">付款</view>
 			<view class="btn btn-share" @click.stop="onShareCode">
 				<view class="tips" v-if="shareCode">分享码:{{shareCode}}</view>
 				分享订单
 			</view>
-			<view class="btn btn-confirm" v-if="btnState.isConfirmation" @click.stop="btnConfirm('confirmation')">确认订单</view>
-			<view class="btn btn-cancel" v-if="btnState.isCancel" @click.stop="btnConfirm('cancel')">取消订单</view>
-			<view class="btn btn-delete" v-if="btnState.isDelete" @click.stop="btnConfirm('delete')">删除订单</view>
-			<view class="btn btn-query" v-if="btnState.isQuery" @click.stop="btnConfirm('query')">查看物流</view>
-			<view class="btn btn-confirm" v-if="btnState.isConfirm" @click.stop="btnConfirm('confirm')">确认收货</view>
+			<view class="btn btn-confirm" v-if="btnState.isConfirmation" @click.stop="btnConfirm('confirmation',order)">确认订单</view>
+			<view class="btn btn-cancel" v-if="btnState.isCancel" @click.stop="btnConfirm('cancel',order)">取消订单</view>
+			<view class="btn btn-delete" v-if="btnState.isDelete" @click.stop="btnConfirm('delete',order)">删除订单</view>
+			<view class="btn btn-query" v-if="btnState.isQuery" @click.stop="btnConfirm('query',order)">查看物流</view>
+			<view class="btn btn-confirm" v-if="btnState.isConfirm" @click.stop="btnConfirm('confirm',order)">确认收货</view>
 		</view>
 	</view>
 </template>
@@ -23,6 +23,9 @@
 			status:{
 				type:Number
 			},
+			order: {
+				type:Object
+			},
 			shareCode:{
 				type:String
 			},
@@ -92,8 +95,13 @@
 				this.$parent.isShareModal = true
 				this.$emit('shareConfirm')
 			},
-			btnConfirm(type){
-				this.$emit('buttonConfirm',type)
+			btnConfirm(type,order){
+				let data = {
+						type:type,
+						orderId:order.orderID,
+						order:order
+					}
+				this.$emit('buttonConfirm',data)
 			}
 		}
 	}

+ 62 - 8
pages/user/order/order-details.vue

@@ -22,9 +22,17 @@
 						  v-if= "isRequest" 
 						  :status= "btnStatus" 
 						  :shareCode= "shareCode"
+						  :order="orderInfo" 
 						   @buttonConfirm="handButtonConfirm">
 			</order-button>
 		</view>
+		<!-- 付款弹窗 -->
+		<order-model v-if="isPayModel" 
+					:payModelData="payModelData" 
+					:modelType='modelType' 
+					@cancelConfirm = "hanldCancelConfirm"
+					@paymentConfirm ='hanldPaymentConfirm'/>
+		<!-- 分享弹窗 -->			
 		<share-alert  :orderID="orderID" 
 					  v-if="isShareModal"  
 					  @shareConfirm ='onShareAppMessage'>
@@ -43,6 +51,7 @@
 	import refundRecord from '@/components/cm-module/orderDetails/refundRecord'		 //退款记录
 	import orderButton from '@/components/cm-module/orderDetails/orderButton'			 //底部按钮
 	import shareAlert from '@/components/cm-module/modelAlert/shareAlert.vue'			 //分享弹窗
+	import orderModel from '@/components/cm-module/modelAlert/order-alert'			 //付款弹窗
 	import { queryOrderDetails,cancelOrder,deleteOrder,confirmReceipt,affirmOrder } from "@/api/order.js" 
 	export default {
 		components:{
@@ -56,6 +65,7 @@
 			refundRecord,
 			orderButton,
 			shareAlert,
+			orderModel
 		},
 		data() {
 			return {
@@ -71,6 +81,7 @@
 				isRequest:false,			//是否加载完成渲染子组件
 				isOrderShare:false,
 				isShareModal:false,
+				orderInfo:{},
 				addressData:{},				//地址信息初始化
 				information:{},				//订单信息初始化
 				shopOrderData:{},			//商品信息初始化
@@ -110,6 +121,7 @@
 				queryOrderDetails({ orderID : this.orderID }).then(response =>{
 					let resData = response.data;
 					this.isRequest = true
+					this.orderInfo = resData.order
 					this.userID = resData.order.userID
 					this.shareCode = resData.shareCode
 					this.addressData = resData.userInfo
@@ -133,8 +145,8 @@
 			handButtonConfirm(data){//监听点击时间的按钮类型并执行...
 				this.handShowAlert(data)
 			},
-			handShowAlert(type){//判断点击的按钮类型并执行...
-				switch(type){
+			handShowAlert(data){//判断点击的按钮类型并执行...
+				switch(data.type){
 					case 'delete':
 						this.handOrderDetele();
 						break
@@ -148,18 +160,60 @@
 						this.handOrderConfirm()
 						break
 					case 'pay':
-						if(this.onlinePayFlag == '1'){
-							let Amount = this.payableAmount - this.receiptAmount
-							this.$api.navigateTo(`/pages/user/order/order-payment?type=onlinePay&orderID=${this.orderID}&payAmount=${Amount}`)
-						}else{
-							this.$api.navigateTo(`/pages/user/order/order-payment?type=payfirm&orderID=${this.orderID}`)
-						}
+						this.getOrderPaymentValidation(data)
 						break
 					case 'confirmation':
 						this.handOrderConfirmation()
 						break
 				}
 			},
+			getOrderPaymentValidation(data){//监听根据付款状态做操作
+				this.OrderService.OrderPaymentValidation({orderId:data.orderId}).then(response =>{
+					let dataCode = response.data.code
+					this.payModelData = response.data
+					switch(dataCode){
+						case 1:
+							this.isPayModel = true;
+							this.modelType = 1
+							break;
+						case 2:
+							this.isPayModel = true;
+							this.modelType = 2
+							break;
+						case -1:
+							this.$util.modal('','订单已申请全部退款,无需再付款!','确定','',false,() =>{})
+							break;
+						default:
+							if(data.onlinePayFlag == '1'){
+								this.$api.navigateTo(`/pages/user/order/order-payment?type=onlinePay&orderID=${data.orderId}`)
+							}else{
+								this.$api.navigateTo(`/pages/user/order/order-payment?type=payfirm&orderID=${data.orderId}`)
+							}
+					}
+					
+				}).catch(error =>{
+					this.$util.msg(error.msg,2000)
+				})	
+			},
+			hanldPaymentConfirm(data){//余额抵扣跳转
+				this.OrderService.OrderBalanceDeduction({orderId:data.order.orderId}).then(response =>{
+					if(data.type === 2){
+						let _data = {orderID:data.order.orderId}
+						this.$api.navigateTo(`/pages/user/order/success?type=deduction&data=${JSON.stringify({data:_data})}`)
+					}else{
+						this.$api.navigateTo(`/pages/user/order/order-payment?type=payfirm&orderID=${data.order.orderId}`)
+					}
+				}).catch(error =>{
+					this.$util.msg(error.msg,2000)
+				})	
+			},
+			hanldCancelConfirm(data){//不使用余额抵扣直接跳转收银台
+				if(data.onlinePayFlag == '1'){
+					this.$api.navigateTo(`/pages/user/order/order-payment?type=onlinePay&orderID=${data.orderId}`)
+				}else{
+					this.$api.navigateTo(`/pages/user/order/order-payment?type=payfirm&orderID=${data.orderId}`)
+				}
+			},
 			handOrderConfirm(){//确认收货
 				this.$util.modal('提示','是否确认收货','确定','取消',true,() =>{
 					confirmReceipt({orderID:this.orderID}).then(response =>{

+ 3 - 4
pages/user/order/order-list.vue

@@ -366,11 +366,10 @@
 				})	
 			},
 			hanldCancelConfirm(data){//不使用余额抵扣直接跳转收银台
-				console.log(data)
-				if(data.order.onlinePayFlag == '1'){
-					this.$api.navigateTo(`/pages/user/order/order-payment?type=onlinePay&orderID=${data.order.orderId}`)
+				if(data.onlinePayFlag == '1'){
+					this.$api.navigateTo(`/pages/user/order/order-payment?type=onlinePay&orderID=${data.orderId}`)
 				}else{
-					this.$api.navigateTo(`/pages/user/order/order-payment?type=payfirm&orderID=${data.order.orderId}`)
+					this.$api.navigateTo(`/pages/user/order/order-payment?type=payfirm&orderID=${data.orderId}`)
 				}
 			},
 			handOrderConfirm (id){//确认收货

+ 9 - 3
pages/user/order/order-payment.vue

@@ -121,6 +121,7 @@
 				btnColor:'#09BB07',
 				receiptStatus:'',
 				invoiceStatus:false,
+				optionType:'',
 				onlinePayFlag:'',
 				payBringTitle:'本次交易暂不支持线上支付,请使用线下转账方式付款',
 				payStatusText:'使用微信和企业网银支付全部金额后,供应商会在24小时后发货(周末、节假日顺延)。若着急发货,可以选择使用线下转账进行付款。'
@@ -154,8 +155,9 @@
 		},
 		methods:{
 			initData(e){
-				this.orderID = e.orderID
+				this.orderID = e.orderID;
 				this.payOrderId ='#'+e.orderID+'#';
+				this.optionType = e.type;
 				switch(e.type){
 					case 'confirm':
 						this.nvabarData.haveBack = false
@@ -173,7 +175,6 @@
 						this.nvabarData.haveBack = true
 						this.nvabarData.haveHome = false
 						this.nvabarData.title = '付款提示'
-						this.invoiceStatus = true
 						this.PayOrderCheckoutCounter(this.orderID)
 						this.payBringTitle = '您已通过线下转账的方式支付了订单部分款项,剩余款项依然需要使用线下转账方式,给您带来的不便敬请谅解'
 						break;
@@ -184,8 +185,13 @@
 					let data = response.data.order
 					this.payableAmount = data.payableAmount - data.receiptAmount  //待付金额
 					this.receiptStatus =  data.receiptStatus
-					this.invoiceStatus = data.invoiceStatus
 					this.onlinePayFlag = data.onlinePayFlag
+					//判断线上线下显示
+					if(this.optionType == 'onlinePay'){
+						this.invoiceStatus = true
+					}else{
+						this.invoiceStatus = data.invoiceStatus
+					}
 					if(data.receiptAmount>0){
 						this.payStatusText = '使用微信和企业网银支付全部金额后,供应商会在24小时后发货(周末、节假日顺延)。'
 						this.isReceiptStatus = false