Przeglądaj źródła

commit - m 抽离订单、超级会员、优惠券微信小程序支付处理

zhengjinyi 3 lat temu
rodzic
commit
369eb793e9

+ 11 - 45
components/cm-module/cart-components/index.vue

@@ -480,9 +480,11 @@ import tuiNomore from '@/components/tui-components/nomore/nomore'
 import activiPopup from '@/components/cm-module/productDetails/cm-activipopu'
 import couponTabs from '@/components/cm-module/coupon/tui-tabs.vue'
 import modalLayer from '@/components/modal-layer'
+import wechatPay from '@/utils/mixins/wechatPay.js'
 import { mapState, mapMutations } from 'vuex'
 export default {
 	name: 'cartComponents',
+	mixins: [wechatPay],
 	props: {
 		pathType: {
 			type: Number
@@ -1521,51 +1523,15 @@ export default {
 		},
 		async MiniWxPayFor(coupon,couponRecordId){
 			const wechatcode = await authorize.getCode('weixin')
-			this.PayService.WeChatCouponMiniWxPay(
-				{
-					userId: this.userId,
-					couponId: coupon.couponId,
-					couponRecordId:couponRecordId,
-					payWay: 'WEIXIN',
-					code: wechatcode,
-					source: 1 //支付来源 1 小程序 2 WWW
-				}
-			)
-			.then(response => {
-				// 友盟埋点收集微信支付
-				if (process.env.NODE_ENV != 'development') {
-					this.$uma.trackEvent('Um_Event_cartCouponPay', {
-						Um_Key_PageName: '机构购物车',
-						Um_Key_SourcePage: '线上支付优惠券',
-						Um_Key_CouponId: `${coupon.couponId}`,
-						Um_Key_userId: `${this.userId}`
-					})
-				}
-				let PayInfo = JSON.parse(response.data.data.payInfo)
-				this.WxRequestPayment(PayInfo)
-			})
-			.catch(error => {
-				this.$util.msg(error.msg, 2000)
-			})
-		},
-		WxRequestPayment(data){
-			let self = this
-			wx.requestPayment({
-				'timeStamp': data.timeStamp,
-				'nonceStr': data.nonceStr,
-				'package': data.package,
-				'signType': data.signType,
-				'paySign': data.paySign,
-				'success':function(res){
-					wx.reLaunch({url: '/pages/tabBar/user/user'})
-				},
-				'fail':function(res){
-					self.$util.msg('用户取消支付~')
-				},
-				'complete':function(res){
-		
-				}
-			})
+			const params = {
+				userId: this.userId,
+				couponId: coupon.couponId,
+				couponRecordId:couponRecordId,
+				payType:'XCX',
+				code: wechatcode,
+				source: 1 //支付来源 1 小程序 2 WWW
+			}
+			this.weChatMiniCouponWxPay(params,'Um_Event_cartCouponPay','机构购物车','线上支付优惠券',coupon.couponId,this.userId)
 		},
 		hideMobel(){
 			this.modal = false

+ 7 - 0
pages.json

@@ -347,6 +347,13 @@
                         "navigationStyle": "custom"
                     }
                 },
+                {
+                    "path": "order/order-payhlb",
+                    "style": {
+                        "navigationBarTitleText": "收银台",
+                        "navigationStyle": "custom"
+                    }
+                },
                 {
                     "path": "order/orderShareLogin",
                     "style": {

+ 11 - 45
pages/goods/product.vue

@@ -627,8 +627,10 @@ import couponTabs from '@/components/cm-module/coupon/tui-tabs.vue'
 import authorize from '@/common/config/authorize.js'
 import wxLogin from '@/common/config/wxLogin.js'
 import { debounce } from '@/common/config/common.js'
+import wechatPay from '@/utils/mixins/wechatPay.js'
 var isPreviewImg
 export default {
+	mixins: [wechatPay],
 	components: {
 		customP,
 		parser,
@@ -1166,51 +1168,15 @@ export default {
 		},
 		async MiniWxPayFor(coupon,couponRecordId){
 			const wechatcode = await authorize.getCode('weixin')
-			this.PayService.WeChatCouponMiniWxPay(
-				{
-					userId: this.userId,
-					couponId: coupon.couponId,
-					couponRecordId:couponRecordId,
-					payWay: 'WEIXIN',
-					code: wechatcode,
-					source: 1 //支付来源 1 小程序 2 WWW
-				}
-			)
-			.then(response => {
-				// 友盟埋点收集微信支付
-				if (process.env.NODE_ENV != 'development') {
-					this.$uma.trackEvent('Um_Event_productCouponPay', {
-						Um_Key_PageName: '商品详情',
-						Um_Key_SourcePage: '线上支付优惠券',
-						Um_Key_CouponId: `${coupon.couponId}`,
-						Um_Key_userId: `${this.userId}`
-					})
-				}
-				let PayInfo = JSON.parse(response.data.data.payInfo)
-				this.WxRequestPayment(PayInfo)
-			})
-			.catch(error => {
-				this.$util.msg(error.msg, 2000)
-			})
-		},
-		WxRequestPayment(data){
-			let self = this
-			wx.requestPayment({
-				'timeStamp': data.timeStamp,
-				'nonceStr': data.nonceStr,
-				'package': data.package,
-				'signType': data.signType,
-				'paySign': data.paySign,
-				'success':function(res){
-					wx.reLaunch({url: '/pages/tabBar/user/user'})
-				},
-				'fail':function(res){
-					self.$util.msg('用户取消支付~')
-				},
-				'complete':function(res){
-		
-				}
-			})
+			const params = {
+				userId: this.userId,
+				couponId: coupon.couponId,
+				couponRecordId:couponRecordId,
+				payType:'XCX',
+				code: wechatcode,
+				source: 1 //支付来源 1 小程序 2 WWW
+			}
+			this.weChatMiniCouponWxPay(params,'Um_Event_productCouponPay','商品详情','线上支付优惠券',coupon.couponId,this.userId)
 		},
 		hideMobel(){
 			this.modal = false

+ 6 - 36
pages/seller/cart/coupon-share.vue

@@ -59,7 +59,9 @@
 import { mapState, mapMutations } from 'vuex'
 import wxLogin from '@/common/config/wxLogin.js'
 import authorize from '@/common/config/authorize.js'
+import wechatPay from '@/utils/mixins/wechatPay.js'
 export default {
+	mixins: [wechatPay],
 	data() {
 		return {
 			StaticUrl: this.$Static,
@@ -154,47 +156,15 @@ export default {
 		},
 		async MiniWxPayFor(couponRecordId) {
 			const wechatcode = await authorize.getCode('weixin')
-			this.PayService.WeChatCouponMiniWxPay({
+			const params = {
 				userId: this.userId,
 				couponId: this.couponId,
 				couponRecordId:couponRecordId,
-				payWay: 'WEIXIN',
+				payType:'XCX',
 				code: wechatcode,
 				source: 1 //支付来源 1 小程序 2 WWW
-			})
-				.then(response => {
-					// 友盟埋点收集微信支付
-					if (process.env.NODE_ENV != 'development') {
-						this.$uma.trackEvent('Um_Event_shareCouponPay', {
-							Um_Key_PageName: '分享优惠券',
-							Um_Key_SourcePage: '线上支付优惠券',
-							Um_Key_CouponId: `${this.couponId}`,
-							Um_Key_userId: `${this.userId}`
-						})
-					}
-					let PayInfo = JSON.parse(response.data.data.payInfo)
-					this.WxRequestPayment(PayInfo)
-				})
-				.catch(error => {
-					this.$util.msg(error.msg, 2000)
-				})
-		},
-		WxRequestPayment(data) {
-			let self = this
-			wx.requestPayment({
-				timeStamp: data.timeStamp,
-				nonceStr: data.nonceStr,
-				package: data.package,
-				signType: data.signType,
-				paySign: data.paySign,
-				success: function(res) {
-					wx.reLaunch({ url: '/pages/tabBar/home/index' })
-				},
-				fail: function(res) {
-					self.$util.msg('用户取消支付~')
-				},
-				complete: function(res) {}
-			})
+			}
+			this.weChatMiniCouponWxPay(params,'Um_Event_shareCouponPay','分享优惠券','线上支付优惠券',this.couponId,this.userId)
 		},
 		hideMobel(){
 			this.modal = false

+ 1 - 1
pages/seller/order/create-order.vue

@@ -507,7 +507,7 @@
 							productType:item.giftType
 						})
 					})
-					return {shopId:el.shopId,note:el.note?el.note:'',productInfo:productInfo}
+					return {splitCode:el.splitCode,shopId:el.shopId,note:el.note?el.note:'',productInfo:productInfo}
 				})
 				this.confirmParam.payInfo.postage = parseInt(this.handleFreightData.postage).toFixed(2)
 				this.confirmParam.payInfo.postageFlag = parseInt(this.handleFreightData.postageFlag)

+ 22 - 36
pages/user/coupon/coupon-activity.vue

@@ -108,7 +108,9 @@ import { mapState, mapMutations } from 'vuex'
 import authorize from '@/common/config/authorize.js'
 import wxLogin from '@/common/config/wxLogin.js'
 import couponTabs from '@/components/cm-module/coupon/tui-tabs.vue'
+import wechatPay from '@/utils/mixins/wechatPay.js'
 export default {
+	mixins: [wechatPay],
 	components: {
 		couponTabs
 	},
@@ -362,47 +364,31 @@ export default {
 		},
 		async MiniWxPayFor(coupon,couponRecordId) {
 			const wechatcode = await authorize.getCode('weixin')
-			this.PayService.WeChatCouponMiniWxPay({
+			const params = {
 				userId: this.listQuery.userId,
 				couponId: coupon.couponId,
 				couponRecordId:couponRecordId,
-				payWay: 'WEIXIN',
+				payWay:'WEIXIN',
 				code: wechatcode,
 				source: 1 //支付来源 1 小程序 2 WWW
-			})
-				.then(response => {
-					// 友盟埋点收集微信支付
-					if (process.env.NODE_ENV != 'development') {
-						this.$uma.trackEvent('Um_Event_meibohuiCouponPay', {
-							Um_Key_PageName: '美博会优惠券活动页',
-							Um_Key_SourcePage: '线上支付优惠券',
-							Um_Key_CouponId: `${coupon.couponId}`,
-							Um_Key_userId: `${this.userId}`
-						})
-					}
-					let PayInfo = JSON.parse(response.data.data.payInfo)
-					this.WxRequestPayment(PayInfo)
-				})
-				.catch(error => {
-					this.$util.msg(error.msg, 2000)
-				})
-		},
-		WxRequestPayment(data) {
-			let self = this
-			wx.requestPayment({
-				timeStamp: data.timeStamp,
-				nonceStr: data.nonceStr,
-				package: data.package,
-				signType: data.signType,
-				paySign: data.paySign,
-				success: function(res) {
-					wx.reLaunch({ url: '/pages/tabBar/user/user' })
-				},
-				fail: function(res) {
-					self.$util.msg('用户取消支付~')
-				},
-				complete: function(res) {}
-			})
+			}
+			this.weChatMiniCouponWxPay(params,'Um_Event_meibohuiCouponPay','美博会优惠券活动页','线上支付优惠券',coupon.couponId,this.userId)
+				// .then(response => {
+				// 	// 友盟埋点收集微信支付
+				// 	if (process.env.NODE_ENV != 'development') {
+				// 		this.$uma.trackEvent('Um_Event_meibohuiCouponPay', {
+				// 			Um_Key_PageName: '美博会优惠券活动页',
+				// 			Um_Key_SourcePage: '线上支付优惠券',
+				// 			Um_Key_CouponId: `${coupon.couponId}`,
+				// 			Um_Key_userId: `${this.userId}`
+				// 		})
+				// 	}
+				// 	let PayInfo = JSON.parse(response.data.rt10_payInfo)
+				// 	this.WxRequestPayment(PayInfo)
+				// })
+				// .catch(error => {
+				// 	this.$util.msg(error.msg, 2000)
+				// })
 		},
 		hideMobel(){
 			this.modal = false

+ 6 - 36
pages/user/coupon/coupon-collection.vue

@@ -96,7 +96,9 @@
 import { mapState, mapMutations } from 'vuex'
 import authorize from '@/common/config/authorize.js'
 import couponTabs from '@/components/cm-module/coupon/tui-tabs.vue'
+import wechatPay from '@/utils/mixins/wechatPay.js'
 export default {
+	mixins: [wechatPay],
 	components: {
 		couponTabs
 	},
@@ -340,47 +342,15 @@ export default {
 		},
 		async MiniWxPayFor(coupon,couponRecordId) {
 			const wechatcode = await authorize.getCode('weixin')
-			this.PayService.WeChatCouponMiniWxPay({
+			const params = {
 				userId: this.listQuery.userId,
 				couponId: coupon.couponId,
 				couponRecordId:couponRecordId,
-				payWay: 'WEIXIN',
+				payWay:'WEIXIN',
 				code: wechatcode,
 				source: 1 //支付来源 1 小程序 2 WWW
-			})
-			.then(response => {
-				// 友盟埋点收集微信支付
-				if (process.env.NODE_ENV != 'development') {
-					this.$uma.trackEvent('Um_Event_userCouponCollectionPay', {
-						Um_Key_PageName: '领券中心',
-						Um_Key_SourcePage: '线上支付优惠券',
-						Um_Key_CouponId: `${coupon.couponId}`,
-						Um_Key_userId: `${this.userId}`
-					})
-				}
-				let PayInfo = JSON.parse(response.data.data.payInfo)
-				this.WxRequestPayment(PayInfo)
-			})
-			.catch(error => {
-				this.$util.msg(error.msg, 2000)
-			})
-		},
-		WxRequestPayment(data) {
-			let self = this
-			wx.requestPayment({
-				timeStamp: data.timeStamp,
-				nonceStr: data.nonceStr,
-				package: data.package,
-				signType: data.signType,
-				paySign: data.paySign,
-				success: function(res) {
-					wx.reLaunch({ url: '/pages/tabBar/user/user' })
-				},
-				fail: function(res) {
-					self.$util.msg('用户取消支付~')
-				},
-				complete: function(res) {}
-			})
+			}
+			this.weChatMiniCouponWxPay(params,'Um_Event_userCouponCollectionPay','领券中心','线上支付优惠券',coupon.couponId,this.userId)
 		},
 		hideMobel(){
 			this.modal = false

+ 11 - 8
pages/user/member/member-pay.vue

@@ -69,7 +69,9 @@
 <script>
 import authorize from '@/common/config/authorize.js'
 const thorui = require('@/components/clipboard/clipboard.thorui.js')
+import wechatPay from '@/utils/mixins/wechatPay.js'
 export default {
+	mixins: [wechatPay],
 	data() {
 		return {
 			isIphoneX: this.$store.state.isIphoneX,
@@ -167,14 +169,15 @@ export default {
 		async MiniWxPayFor() {
 			// 使用微信支付
 			this.payParams.code = await authorize.getCode('weixin')
-			this.PayService.PayOrderVipWechat(this.payParams)
-				.then(response => {
-					let PayInfo = JSON.parse(response.data.data.payInfo)
-					this.WxRequestPayment(PayInfo)
-				})
-				.catch(error => {
-					this.$util.msg(error.msg, 2000)
-				})
+			this.weChatMiniVipWxPay(this.payParams)
+			// this.PayService.PayOrderVipWechat(this.payParams)
+			// 	.then(response => {
+			// 		let PayInfo = JSON.parse(response.data.rt10_payInfo)
+			// 		this.WxRequestPayment(PayInfo)
+			// 	})
+			// 	.catch(error => {
+			// 		this.$util.msg(error.msg, 2000)
+			// 	})
 		},
 		WxRequestPayment(data) {
 			// 微信支付Api

+ 1 - 1
pages/user/order/create-order.vue

@@ -575,7 +575,7 @@
 							productType:item.giftType
 						})
 					})
-					return {shopId:el.shopId,note:el.note?el.note:'',productInfo:productInfo}
+					return {splitCode:el.splitCode,shopId:el.shopId,note:el.note?el.note:'',productInfo:productInfo}
 				})
 				this.confirmParam.payInfo.postage = parseInt(this.hanldFreight).toFixed(2)
 				this.confirmParam.payInfo.postageFlag = parseInt(this.hanldFreePostFlag)

+ 799 - 0
pages/user/order/order-payhlb.vue

@@ -0,0 +1,799 @@
+<template>
+	<view class="container cashier"  v-show="isRepuest">
+		<cu-custom :navbar-data='nvabarData' @navigateBack="hanldNavigateBack"></cu-custom>
+		<view class="container-cash clearfix" :style="{marginTop:CustomBar+'px'}">
+			<view class="container-wrapper">
+				<view class="pay-content">
+					<view class="pay-top">
+						<view class="pay-paid">
+							<text class="txt-m">待付金额</text>
+							<text class="txt-b"><text class="small">¥</text>{{payableAmount | NumFormat}}</text>
+						</view>
+						<view class="pay-payd">
+							<view class="pay-paids">
+								<text class="txt-m">应付总额</text>
+								<text class="txt-b">¥{{payableAmount | NumFormat}}</text>
+							</view>
+							<view class="pay-paids">
+								<text class="txt-m">已支付金额</text>
+								<text class="txt-b">¥{{receiptAmount | NumFormat}}</text>
+							</view>
+						</view>
+					</view>
+					<view class="pay-bot">
+						<view class="bot-title"><text>本次支付金额</text></view>
+						<view class="bot-input">
+							<text>¥</text>
+ 					<!-- 	<view class="input" @click.stop="focusInput">
+								<text class="text" v-if="payAmount>=0">{{payAmount}}</text>
+								<text class="none" v-else>输入金额不能大于待付金额</text>
+							</view> -->
+							<input  class="input"
+									type="digit"
+									v-model="payAmount"
+									@focus="focusInput"
+									@blur="blurInput"
+									placeholder="输入金额不能大于待付金额"
+									placeholder-class="placeholder"/>
+						</view>
+						<view class="bot-resid">
+							<text>应付剩余¥{{balanceAmount|NumFormat}}</text>
+						</view>
+					</view>
+				</view>
+				<view class="pay-record" :style="{paddingBottom:isIphoneX ? '156rpx' : '112rpx'}">
+					<view class="record-title"><text>支付记录</text></view>
+					<view class="record-list">
+						<view class="list-main" v-if="discernReceipt.length>0">
+							<view class="list-item" v-for="(item,index) in discernReceipt" :key="index">
+								<text class="text row-1">¥{{item.receiptAmount | NumFormat}}</text>
+								<text class="text row-2">{{payTypeText(item.payType)}}</text>
+								<text class="text row-3">{{item.receiptDate}}</text>
+							</view>
+						</view>
+						<view class="list-none" v-else>暂无支付记录</view>
+					</view>
+				</view>
+			</view>
+			<view class="pay-button" :style="{paddingBottom:isIphoneX ? '68rpx' : '24rpx'}">
+				<view class="btn" @click.stop="buttonSubMit" :style="{'background':btnColor}">{{buttonText}}</view>
+			</view>
+		</view>
+		<view class="alert spec" :class="specClass" v-if="isShowTip">
+			<!-- 选择支付弹窗说明 -->
+			<view class="freight-alert"  @tap="hideTips">
+				<view class="content">
+					<view class="title">
+						<text>支付链接</text>
+						<text class="iconfont icon-iconfontguanbi" @click.stop="hideTips"></text>
+					</view>
+					<view class="text-content">
+						<view class="text">请复制以下链接,并发送至电脑端,在浏览器访问该链接并选择银行尽快完成支付</view>
+						<view class="text-p">{{payHttpUrl}}</view>
+						<view class="text-b">链接有效期为72小时</view>
+					</view>
+					<view class="text-button" @click.stop="clipboard(payHttpUrl)">复制链接</view>
+				</view>
+			</view>
+		</view>
+		<!--大额转账弹窗  -->
+		<tui-modal :show="modal" :padding="'30rpx 30rpx'" @cancel="hideMobel(0)" :custom="true" fadeIn >
+			<view class="tui-modal-custom">
+				<view class="tui-prompt-title">大额银联转账信息</view>
+				<view class="tui-prompt-text">
+					<view class="tui-prompt-tips">请使用银行手机app或者网银输入以下信息进行转账。每次发起支付请求,收款账号都会变化,请使用最新的收款账号进行转账。</view>
+					<view class="tui-prompt-item">
+						<text class="text">户名:</text>
+						{{ bigPayInfo.receiveName }}
+						<view class="copy" @click.stop="copyClipboard(bigPayInfo.receiveName)"><text class="iconfont icon-fuzhi_o"></text></view>
+					</view>
+					<view class="tui-prompt-item">
+						<text class="text">收款账号:</text>
+						{{ bigPayInfo.receiveAccountNo }}
+						<view class="copy" @click.stop="copyClipboard(bigPayInfo.receiveAccountNo)"><text class="iconfont icon-fuzhi_o"></text></view>
+					</view>
+					<view class="tui-prompt-item">
+						<text class="text">银行:</text>
+						{{ bigPayInfo.accountName }}
+					</view>
+					<view class="tui-prompt-item">
+						<text class="text">收款方开户地:</text>
+						{{ bigPayInfo.areaInfo }}
+					</view>
+					<view class="tui-prompt-item">
+						<text class="text">收款网点:</text>
+						{{ bigPayInfo.accountName }}
+					</view>
+				</view>
+				<view class="tui-prompt-flex">
+					<view class="btn btn-confirm" @click="handleClick">已完成转账,请点击</view>
+					<view class="btn btn-cancel" @click="hideMobel">关闭</view>
+				</view>	
+			</view>
+		</tui-modal>	
+	</view>
+</template>
+
+<script>
+	import authorize from '@/common/config/authorize.js'
+	import thorui from '@/components/clipboard/clipboard.thorui.js'
+	import wechatPay from '@/utils/mixins/wechatPay.js'
+	export default{
+		mixins: [wechatPay],
+		data(){
+			return{
+				orderId:'',
+				payType:'',
+				payWay:'',
+				isRepuest:false,
+				payableAmount:0,
+				receiptAmount:0,
+				balanceAmount:0,
+				payTotalFee:0,
+				payAmount:0,
+				nvabarData: {		//顶部自定义导航
+					showCapsule:1, // 是否显示左上角图标  1表示显示  0表示不显示,
+					showSearch: 0,
+					title: '收银台',  // 导航栏 中间的标题
+					haveBack:true,
+					textLeft:this.$store.state.isIphone
+				},
+				idCardList:[],
+				isIphoneX:this.$store.state.isIphoneX,
+				CustomBar:this.CustomBar,// 顶部导航栏高度
+				tabCurrentIndex:0,
+				isShowTip:false,
+				buttonText:'去支付',
+				btnColor:'#09BB07',
+				discernReceipt:[],
+				showDigitKeyboard:false,
+				payHttpUrl:'',
+				bigPayInfo:{},// 大额网银转账
+				mbOrderId:0, // 支付记录订单Id
+				modal:false,
+			}
+		},
+		onLoad(option) {
+			this.initData(option)
+		},
+		filters: {
+			NumFormat(value) {
+				if(!value) return '0.00'
+				/*原来用的是Number(value).toFixed(0),这样取整时有问题,例如0.51取整之后为1,感谢Nils指正*/
+				/*后来改成了 Number(value)|0,但是输入超过十一位就为负数了,具体见评论 */
+				var intPart = Number(value) - Number(value)%1 //获取整数部分(这里是windy93的方法)
+				var intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') //将整数部分逢三一断
+				var floatPart = '.00' //预定义小数部分
+				var value2Array = value.toString().split('.')
+				//=2表示数据有小数位
+				if(value2Array.length == 2) {
+					floatPart = value2Array[1].toString() //拿到小数部分
+					if(floatPart.length == 1) { //补0,实际上用不着
+						return intPartFormat + '.' + floatPart + '0'
+					} else {
+						return intPartFormat + '.' + floatPart
+					}
+				} else {
+					return intPartFormat + floatPart
+				}
+			}
+		},
+		methods:{
+			initData(e){
+				this.payType = e.type
+				console.log(this.payType)
+				this.orderId = e.orderId
+				switch(this.payType){
+					case '0':
+						this.payWay = 'WEIXIN'
+						this.btnColor='#09BB07'
+						this.buttonText = '去支付'
+						break
+					case '1':
+						this.payWay = 'UNIONPAY'
+						this.btnColor='#034582'
+						this.buttonText = '生成企业网银支付链接'
+						break
+					case '2':
+						this.payWay = 'UNIONPAY'
+						this.btnColor='#034582'
+						this.buttonText = '生成个人网银支付链接'
+						break
+					case '3':
+						this.payWay = 'UNIONPAY'
+						this.btnColor='#034582'
+						this.buttonText = '去转账'
+						break
+				}
+				this.GetPayOrderInfo()
+			},
+			GetPayOrderInfo(){//初始化支付信息
+				this.PayService.PayOrderCheckoutCounter({orderId:this.orderId}).then(response =>{
+					this.isRepuest = true
+					this.discernReceipt = response.data.discernReceipt 			// 支付记录
+					this.payTotalFee = response.data.order.payTotalFee  		// 订单总额
+					this.receiptAmount = response.data.order.receiptAmount  	// 已付金额
+					this.payableAmount = (response.data.order.payableAmount*100 - this.receiptAmount*100)/100// 已付金额
+					this.payAmount = this.toFixedFn(this.payableAmount)			// 自定义金额
+					console.log('this.payAmount',this.payAmount)
+					this.balanceAmount = this.payableAmount - this.payAmount	// 计算剩余支付金额
+				}).catch(error =>{
+					this.$util.msg(error.msg,2000)
+				})
+			},
+			buttonSubMit(){
+				switch(this.payType){
+					case '0':// 微信支付
+						// 友盟埋点收集微信支付
+						if(process.env.NODE_ENV != 'development'){
+							this.$uma.trackEvent('Um_Event_ConfirmWechatPay', {
+								Um_Key_PageName: '微信支付',
+								Um_Key_SourcePage: '线上支付',
+								Um_Key_PayName:`${this.buttonText}`,
+								Um_Key_PayOrderID:`${this.orderId}`
+							})
+						}
+						this.MiniWxPayFor()
+						break
+					case '1':// 企业网银
+						// 友盟埋点收集企业网银
+						if(process.env.NODE_ENV != 'development'){
+							this.$uma.trackEvent('Um_Event_ConfirmEbankPay', {
+								Um_Key_PageName: '企业网银',
+								Um_Key_SourcePage: '线上支付',
+								Um_Key_PayName:`${this.buttonText}`,
+								Um_Key_PayOrderID:`${this.orderId}`
+							})
+						}
+						this.BuildCatenate()
+						break
+					case '2':// 个人网银
+						// 友盟埋点收集个人网银
+						if(process.env.NODE_ENV != 'development'){
+							this.$uma.trackEvent('Um_Event_ConfirmAbankPay', {
+								Um_Key_PageName: '个人网银',
+								Um_Key_SourcePage: '线上支付',
+								Um_Key_PayName:`${this.buttonText}`,
+								Um_Key_PayOrderID:`${this.orderId}`
+							})
+						}
+						this.BuildCatenate()
+						break
+					case '3':// 大额支付
+						// 友盟埋点收集大额支付
+						if(process.env.NODE_ENV != 'development'){
+							this.$uma.trackEvent('Um_Event_ConfirmBigbankPay', {
+								Um_Key_PageName: '大额支付',
+								Um_Key_SourcePage: '线上支付',
+								Um_Key_PayName:`${this.buttonText}`,
+								Um_Key_PayOrderID:`${this.orderId}`
+							})
+						}
+						this.LargePayment()
+						break
+				}
+			},
+			LargePayment(){// 大额银联
+				if(this.payAmount == 0){
+					this.$util.msg('请输入本次支付的金额',2000)
+					return
+				}
+				if(this.payAmount <=12){
+					this.$util.msg('网银支付的金额必须大于¥12.00',2000)
+					return
+				}
+				this.PayService.PayOrderTransferUnion({payAmount:this.accMul(this.payAmount,100),orderId:this.orderId}).then(response =>{
+					this.bigPayInfo = JSON.parse(response.data.data.payInfo)
+					this.mbOrderId = response.data.data.mbOrderId
+					this.modal = true
+					console.log('PayInfo',this.bigPayInfo)
+				})
+			},
+			handleClick(){// 查询是否支付成功
+				this.PayService.PayOrderFindOrderStatus({mbOrderId:this.mbOrderId}).then(response =>{
+					const data = response.data.data
+					const linkData =  {
+							  payAmount:this.payAmount,
+							  orderId:this.orderId,
+							  type:data.status === '1' ? 'success' : 'error'
+						}
+					if(data.status === '1'){
+						this.$api.navigateTo(`/pages/user/order/order-success?data=${JSON.stringify({ data: linkData })}`)
+					}else{
+						this.$api.navigateTo(`/pages/user/order/order-success-tips?data=${JSON.stringify({ data: linkData })}`)
+					}	
+				})
+			},
+			hideMobel(){
+				this.modal = false
+			},
+			BuildCatenate(){// 企业网银  个人网银
+				if(this.payAmount == 0){
+					this.$util.msg('请输入本次支付的金额',2000)
+					return
+				}
+				if(this.payAmount <=10){
+					this.$util.msg('网银支付的金额必须大于¥10.00',2000)
+					return
+				}
+				this.PayService.PayOrderPayLink({unpaidAmount:this.payAmount,orderId:this.orderId,payType:this.payType}).then(response =>{
+					this.payHttpUrl = response.data
+					this.isShowTip = true
+				})
+			},
+			async MiniWxPayFor(){// 微信支付
+				if(this.payAmount > 5000){
+					this.$util.modal('','本次支付金额已超出微信支付限额,请输入小于5千的金额进行支付','知道了','',false,() =>{})
+					return
+				}
+				if(this.payAmount == 0){
+					this.$util.msg('请输入本次支付的金额',2000)
+					return
+				}
+				if(this.payAmount*100 < 2){
+					this.$util.msg('本次支付的金额必须大于¥0.02',2000)
+					return
+				}
+				// 获取微信code
+				const wechatCode = await authorize.getCode('weixin')
+				const params = {
+						payAmount:this.payAmount,
+						payType:'XCX',
+						code:wechatCode,
+						orderId:this.orderId
+				}
+				this.weChatMiniOrderWxPay(params)
+			},
+			confirmEvent(value){//点击自定义键盘完成的回调函数
+				this.chechValue(value)
+				this.showDigitKeyboard = false
+			},
+			blurInput(e){
+				this.chechValue(e.detail.value)
+			},
+			focusInput(){
+				// this.showDigitKeyboard = true
+			},
+			hideKeyboard(){
+				this.showDigitKeyboard = false
+			},
+			chechValue(value){
+				let patern = /\d+\.\d+/g
+				if(value && value.split('.').length > 2) {
+					value= patern.exec(value)
+				}
+				if(value == '' || value <0 ){
+					this.payAmount = ''
+					this.balanceAmount = this.payableAmount
+				}else if( value > this.payableAmount){
+					this.payAmount = this.toFixedFn(this.payableAmount)
+					this.balanceAmount = this.toFixedFn(this.payableAmount - this.payAmount)
+				}else{
+					this.payAmount = this.toFixedFn(value)
+					this.balanceAmount = this.toFixedFn(this.payableAmount - this.payAmount)
+				}
+			},
+			hanldNavigateBack(){//页面返回
+				uni.navigateBack({
+					delta: 1
+				})
+			},
+			payTypeText (state){//处理支付记录文字
+				let stateText = '',
+					stateTextObject={
+						12:'企业网银',
+						13:'微信支付',
+						14:'支付宝',
+						15:'微信支付',
+						16:'余额抵扣',
+					}
+				Object.keys(stateTextObject).forEach(key => {
+					if(key == state){
+						stateText = stateTextObject[key]
+					}
+				})
+				return stateText
+			},
+			hideTips(){//隐藏弹窗
+				this.isShowTip = false
+			},
+			toFixedFn(text){//处理小数点后两位数
+				return Number(text).toFixed(2)
+			},
+			copyClipboard(data){
+				//复制账号
+				thorui.getClipboardData(data, (res) => {
+					if (res) {
+						this.$util.msg('已复制',2000)
+					} else {
+						this.$util.msg('复制失败',2000)
+					}
+				})
+			},
+			clipboard(data) {//复制链接
+				console.log('data',data)
+				thorui.getClipboardData(data, (res) => {
+					if (res) {
+						this.isShowTip = false
+						this.$util.msg('已复制',2000)
+						// 友盟埋点收集复制网银链接
+						if(process.env.NODE_ENV != 'development'){
+							this.$uma.trackEvent('Um_Event_CopyUnionPay', {
+								Um_Key_PageName: '网银支付',
+								Um_Key_SourcePage: '线上支付',
+								Um_Key_PayName:`${this.buttonText}`,
+								Um_Key_PayOrderID:`${this.orderId}`
+							})
+						}
+					} else {
+						this.$util.msg('复制失败',2000)
+					}
+				})
+			},
+			discard(){
+				//丢弃
+			}
+		},
+		onShow() {
+
+		}
+	}
+</script>
+
+<style lang="scss">
+	page{height: auto !important;background-color: #FFFFFF;}
+	.container-cash{
+		width: 100%;
+		.container-wrapper{
+			width:100%;
+			margin: 0 auto;
+			.pay-content{
+				width: 662rpx;
+				height: 420rpx;
+				padding: 64rpx 44rpx 0 44rpx;
+				background: url(https://img.caimei365.com/group1/M00/03/BD/Cmis218elN6AY6VeAAqw4n3n4nw186.png) no-repeat;
+				background-size: cover;
+				float: left;
+				position: relative;
+				.pay-top{
+					width: 100%;
+					height: auto;
+					float: left;
+					margin-bottom: 44rpx;
+					.pay-paid{
+						width: 100%;
+						height: auto;
+						margin-bottom: 38rpx;
+						text{
+							line-height: 48rpx;
+							text-align: left;
+							color: #FFFFFF;
+							width: 100%;
+						}
+						.txt-m{
+							font-size: $font-size-26;
+							opacity: 0.7;
+							display: inline-block;
+						}
+						.txt-b{
+							font-size: $font-size-48;
+							display: inline-block;
+							.small{
+								font-size: $font-size-32;
+							}
+						}
+					}
+					.pay-payd{
+						width: 100%;
+						height: auto;
+						.pay-paids{
+							height: auto;
+							float: left;
+							margin-right: 48rpx;
+							text{
+								line-height: 48rpx;
+								text-align: left;
+								color: #FFFFFF;
+							}
+							.txt-m{
+								width: 100%;
+								display: inline-block;
+								font-size: $font-size-26;
+								opacity: 0.7;
+							}
+							.txt-b{
+								width: 100%;
+								display: inline-block;
+								font-size: $font-size-32;
+							}
+						}
+					}
+				}
+				.pay-bot{
+					width: 614rpx;
+					height: 184rpx;
+					padding: 24rpx;
+					background: #FFFFFF;
+					border-radius: 20rpx;
+					box-shadow:0 2px 6px rgba(255, 77, 0, .17);
+					position: absolute;
+					bottom: -92rpx;
+					left:44rpx;
+					.bot-title{
+						line-height: 36rpx;
+						font-size: $font-size-26;
+						color: #666666;
+					}
+					.bot-input{
+						width: 100%;
+						height: 66rpx;
+						margin: 15rpx 0;
+						border-bottom: 1px solid #EBEBEB;
+						line-height: 66rpx;
+						font-size: $font-size-32;
+						color: $text-color;
+						text{
+							display: block;
+							float: left;
+						}
+						.input{
+							font-size: $font-size-40;
+							width: 500rpx;
+							height: 66rpx;
+							padding: 0 10rpx;
+							line-height: 66rpx;
+							float: left;
+							.none{
+								color:$text-color;
+								opacity: 0.3;
+							}
+							.text{
+								color:$text-color;
+							}
+						}
+						.placeholder{
+							font-size: $font-size-26;
+						}
+					}
+					.bot-resid{
+						line-height: 36rpx;
+						font-size: $font-size-26;
+						color: #666666;
+						margin-top: 24rpx;
+						color: $color-system;
+					}
+				}
+			}
+			.pay-record{
+				float: left;
+				background: #FFFFFF;
+				width: 702rpx;
+				height: auto;
+				padding: 0 24rpx;
+				margin-top: 112rpx;
+				.record-title{
+					width: 100%;
+					float: left;
+					font-size: $font-size-28;
+					color: $text-color;
+					line-height: 80rpx;
+					height: 80rpx;
+					border-bottom: 1px solid #F8F8F8;
+				}
+				.record-list{
+					width: 100%;
+					height: auto;
+					float: left;
+					.list-none{
+						line-height: 80rpx;
+						font-size: $font-size-26;
+						color: #999999;
+						text-align: left;
+					}
+					.list-main{
+						height: auto;
+						display: flex;
+						flex-direction:column;
+						.list-item{
+							width: 100%;
+							height:80rpx;
+							display: flex;
+							flex: 1;
+							line-height: 80rpx;
+							font-size: $font-size-26;
+							color: $text-color;
+							.text{
+								&.row-1{
+									flex: 3;
+								}
+								&.row-2{
+									flex: 3;
+								}
+								&.row-3{
+									flex: 4;
+									text-align: right;
+									color: #999999;
+								}
+							}
+						}
+					}
+				}
+			}
+		}
+		.pay-button{
+			width: 100%;
+			background-color: #FFFFFF;
+			position: fixed;
+			height: 88rpx;
+			padding-top: 24rpx;
+			bottom: 0;
+			.btn{
+				width: 702rpx;
+				height: 88rpx;
+				border-radius: 44rpx;
+				font-size: $font-size-28;
+				line-height: 88rpx;
+				color: #FFFFFF;
+				margin: 0 auto;
+				text-align: center;
+				background: $btn-confirm;
+			}
+		}
+	}
+	.freight-alert{
+		width: 100%;
+		height: 100%;
+		background: rgba(0,0,0,.5);
+		position: fixed;
+		top: 0;
+		left: 0;
+		z-index: 8888;
+		transition: all 0.4s;
+		&.none{
+			display: none;
+		}
+		&.show{
+			display: block;
+		}
+		.content{
+			width: 422rpx;
+			height:434rpx;
+			position: absolute;
+			background: $bg-color;
+			left: 0;
+			right: 0;
+			bottom: 0;
+			top: 0;
+			margin: auto;
+			padding: 20rpx 32rpx;
+			border-radius: 12rpx;
+			.title{
+				width: 100%;
+				height: 68rpx;
+				line-height: 68rpx;
+				font-size: $font-size-28;
+				color: $text-color;
+				text-align: center;
+				position: relative;
+				.icon-iconfontguanbi{
+					width: 68rpx;
+					height: 68rpx;
+					text-align: center;
+					line-height: 68rpx;
+					position: absolute;
+					right: 0;
+					top: 0;
+					font-size: $font-size-36;
+					color: #999999;
+				}
+			}
+			.text-content{
+				width: 100%;
+				height: auto;
+				.text{
+					padding: 20rpx 0 0 0;
+					line-height: 44rpx;
+					font-size: $font-size-26;
+					color:#666666;
+					text-align: justify;
+				}
+				.text-p{
+					width: 100%;
+					line-height: 44rpx;
+					font-size: $font-size-26;
+					color:$color-system;
+					text-align: left;
+					text-overflow:ellipsis;
+					display: -webkit-box;
+					word-break: break-all;
+					-webkit-box-orient: vertical;
+					-webkit-line-clamp: 1;
+					overflow: hidden;
+				} 
+				.text-b{
+					line-height: 44rpx;
+					font-size: $font-size-24;
+					color:#999999;
+					text-align: left;
+				}
+			}
+			.text-button{
+				width: 100%;
+				height: 88rpx;
+				line-height: 88rpx;
+				background: $btn-confirm;
+				font-size: $font-size-28;
+				border-radius: 44rpx;
+				color:#FFFFFF;
+				text-align: center;
+				margin-top: 20rpx;
+			}
+		}
+	}
+	.tui-prompt-title{
+		width: 100%;
+		height: 44rpx;
+		line-height: 44rpx;
+		padding: 20rpx 0;
+		text-align: center;
+		color: #333333;
+		border-bottom: 1px solid #E2E7EF;
+	}
+	.tui-prompt-text{
+		padding-top: 20rpx;
+		.tui-prompt-tips{
+			width: 100%;
+			line-height: 36rpx;
+			font-size: $font-size-22;
+			color: #E15616;
+			text-align: justify;
+			margin-bottom: 24rpx;
+		}
+		.tui-prompt-item{
+			width: 100%;
+			line-height: 60rpx;
+			color: #333333;
+			font-size: $font-size-26;
+			.text{
+				font-weight: bold;
+			}
+			.copy{
+				height: 38rpx;
+				box-sizing: border-box;
+				padding: 0 24rpx;
+				text-align: center;
+				line-height: 36rpx;
+				display: inline-block;
+				.iconfont{
+					font-size: $font-size-40;
+					color: #666666;
+				}
+			}
+		}	
+	}
+	.tui-prompt-flex{
+		width: 100%;
+		height: auto;
+		margin-top: 20rpx;
+		box-sizing: border-box;
+		padding: 0 35rpx;
+		.btn{
+			width: 100%;
+			line-height: 84rpx;
+			font-size: $font-size-26;
+			text-align: center;
+			color: #FFFFFF;
+			border-radius: 44rpx;
+			margin: 20rpx 0;
+			&.btn-cancel{
+				background: #FFFFFF;
+				color: #333333;
+				border: 1px solid #979797;
+			}
+			&.btn-confirm{
+				background: $btn-confirm;
+			}
+		}
+		
+	}
+</style>

+ 4 - 4
pages/user/order/order-payment.vue

@@ -273,16 +273,16 @@
 					}
 					switch(this.tabCurrentIndex){
 						case 0:
-							this.$api.navigateTo(`/pages/user/order/order-pay?type=0&orderId=${this.orderId}`)
+							this.$api.navigateTo(`/pages/user/order/order-payhlb?type=0&orderId=${this.orderId}`)
 							break
 						case 1:
-							this.$api.navigateTo(`/pages/user/order/order-pay?type=1&orderId=${this.orderId}`)
+							this.$api.navigateTo(`/pages/user/order/order-payhlb?type=1&orderId=${this.orderId}`)
 							break
 						case 2:
-							this.$api.navigateTo(`/pages/user/order/order-pay?type=2&orderId=${this.orderId}`)
+							this.$api.navigateTo(`/pages/user/order/order-payhlb?type=2&orderId=${this.orderId}`)
 							break
 						case 3:
-							this.$api.navigateTo(`/pages/user/order/order-pay?type=3&orderId=${this.orderId}`)
+							this.$api.navigateTo(`/pages/user/order/order-payhlb?type=3&orderId=${this.orderId}`)
 							break
 					}
 				}

+ 18 - 1
services/pay.service.js

@@ -25,7 +25,7 @@ export default class PayService {
         })
     }
     /**
-	 *小程序支付-微信支付
+	 *小程序支付-米花微信支付
 	 *@param  amount支付金额,单位分,必须大于2
 	 *@param  payWay银联:UNIONPAY,微信:WEIXIN,支付宝:ALIPAY
 	 *@param  payType 微信小程序支付: MINIAPP_WEIXIN ,微信公众号支付: JSAPI_WEIXIN
@@ -40,6 +40,23 @@ export default class PayService {
             loadText:'请求支付中...'    
         })
     }
+    /**
+	 *小程序支付-合利宝微信支付
+	 *@param  amount支付金额,单位分,必须大于2
+	 *@param  payWay银联:UNIONPAY,微信:WEIXIN,支付宝:ALIPAY
+	 *@param  payType 微信小程序支付: MINIAPP_WEIXIN ,微信公众号支付: JSAPI_WEIXIN
+	 *@param  code  微信小程序code,微信小程序支付使用
+	 *@param  orderId  主订单ID
+	 */
+    WeChatScanMiniWxPay (data = {}) {
+        console.log('合利宝微信支付')
+        return this.AjaxService.post({ 
+            url:'/order/pay/online', 
+            data, 
+            isLoading: true ,
+            loadText:'请求支付中...'    
+        })
+    }
     /**
 	 *小程序支付-微信支付
 	 *@param  payWay银联:UNIONPAY,微信:WEIXIN,支付宝:ALIPAY

+ 71 - 31
utils/mixins/wechatPay.js

@@ -1,4 +1,4 @@
-import authorize from '@/common/authorize.js'
+import authorize from '@/common/config/authorize.js'
 
 // 调用微信支付
 function wxRequestPayment(payData) {
@@ -20,44 +20,84 @@ function wxRequestPayment(payData) {
 }
 
 // 微信支付
-const wechatCouponPay = {
+const wechatPay = {
     data() {
         
     },
     methods: {
-        // 获取微信支付payment
-        async weChatMiniWxPay(data) {
+        // 微信支付正常订单
+        async weChatMiniOrderWxPay(params) {
             try {
-                // 获取微信code
-                const wechatCode = await authorize.getCode('weixin')
-                // 微信支付请求 返回支付信息
-                const response = await this.PayService.WeChatCouponMiniWxPay({
-                    userId: this.listQuery.userId,
-                    couponId: coupon.couponId,
-                    payWay: 'WEIXIN',
-                    code: wechatcode
-                })
-                // 处理支付信息 调用微信支付
-                const payment = JSON.parse(response.data.data.payInfo)
-                const payFlag = await wxRequestPayment(payment)
-                // debugger
-                // console.log(this.hanldOrder)
-                // 支付成功重定向
-                uni.setStorageSync('orderInfo', this.hanldOrder.order)
-                if (payFlag) {
-                    // 微信支付成功回调 在页面onload中通过this.$on监听orderPaySuccess事件回调
-                    uni.reLaunch({url: '/pages/tabBar/user/user'})
-                } else {
-                    uni.reLaunch({ url: '/pages/order/error' })
+			    // 微信支付请求 返回支付信息
+			    const response = await this.PayService.WeChatScanMiniWxPay(params)
+			    // 处理支付信息 调用微信支付
+			    const payment = JSON.parse(response.data.rt10_payInfo)
+                console.log('payment',payment)
+			    const payFlag = await wxRequestPayment(payment)
+			    console.log('payFlag',this.payFlag)
+			    if (payFlag) {
+			        // 微信支付成功回调
+			        uni.reLaunch({url: '/pages/tabBar/user/user'})
+			    } else {
+			        this.$util.msg('用户取消支付~',2000)
+			    }
+			 } catch (error) {
+                // 微信支付失败
+                this.$util.msg(error.msg,2000)
+			 } 
+        },
+        // 微信支付优惠券
+        async weChatMiniCouponWxPay(params,UmEvent,UmPageName,UmSourcePage,UmCouponId,UmUserId) {
+            try {
+                console.log('params',params)
+			    // 微信支付请求 返回支付信息
+			    const response = await this.PayService.WeChatCouponMiniWxPay(params)
+			    // 处理支付信息 调用微信支付
+			    const payment = JSON.parse(response.data.rt10_payInfo)
+                // 友盟埋点收集微信支付
+                if (process.env.NODE_ENV != 'development') {
+                    this.$uma.trackEvent(UmEvent, {
+                        Um_Key_PageName: UmPageName,
+                        Um_Key_SourcePage: UmSourcePage,
+                        Um_Key_CouponId: UmCouponId,
+                        Um_Key_userId: UmUserId
+                    })
                 }
-            } catch (error) {
+			    const payFlag = await wxRequestPayment(payment)
+			    if (payFlag) {
+			        // 微信支付成功回调
+			        uni.reLaunch({url: '/pages/tabBar/user/user'})
+			    } else {
+			        this.$util.msg('用户取消支付~',2000)
+			    }
+			 } catch (error) {
                 // 微信支付失败
-                this.$util.msg(error.msg, 2000)
-            } 
+                this.$util.msg(error.msg,2000)
+			 } 
+        },
+        // 微信支付超级会员
+        async weChatMiniVipWxPay(params) {
+            try {
+                console.log('params',params)
+			    // 微信支付请求 返回支付信息
+			    const response = await this.PayService.PayOrderVipWechat(params)
+			    // 处理支付信息 调用微信支付
+			    const payment = JSON.parse(response.data.rt10_payInfo)
+                console.log('payment',payment)
+			    const payFlag = await wxRequestPayment(payment)
+			    console.log('payFlag',this.payFlag)
+			    if (payFlag) {
+			        // 微信支付成功回调
+			        uni.reLaunch({url: '/pages/tabBar/user/user'})
+			    } else {
+			        this.$util.msg('用户取消支付~',2000)
+			    }
+			 } catch (error) {
+                // 微信支付失败
+                this.$util.msg(error.msg,2000)
+			 } 
         }
     }
 }
 
-export default {
-    wechatCouponPay
-}
+export default wechatPay