浏览代码

支付。跳转

hmp 4 年之前
父节点
当前提交
a7e5077f59

+ 1 - 0
assets/http/api.js

@@ -4,6 +4,7 @@ import {http} from './service.js'
 const wxApp={
 	getOpenId:p => http.get('/wx-app/getOpenId', {params:p}),
 	getOpenData:p => http.post('/wx-app/getOpenData',p),
+	getGenerateScheme:p => http.get('/wx-app/getGenerateScheme', {params:p}),
 }
 
 //字典

+ 6 - 2
pages/activity/detail.vue

@@ -20,7 +20,11 @@
 			<text class="title">{{detail.title}}</text>
 			<view class="data" style="margin-top: 30rpx;">
 				<u-icon name="clock" color="#EF9944"></u-icon>
-				<text class="margin-left-10">{{detail.beginTime | date('mm/dd hh:MM:ss')}} 至 {{detail.endTime | date('mm/dd hh:MM:ss')}}</text>
+				<text class="margin-left-10">开始时间:{{detail.beginTime}}</text>
+			</view>
+			<view class="data" style="margin-top: 30rpx;">
+				<u-icon name="clock" color="#EF9944"></u-icon>
+				<text class="margin-left-10">结束时间:{{detail.endTime}}</text>
 			</view>
 			<!-- <view class="data">
 				<u-icon name="map"></u-icon>
@@ -33,7 +37,7 @@
 				</view>
 				<view class="flex margin-left-50">
 					<u-icon name="bag" color="#EF9944"></u-icon>
-					<text class="margin-left-10">活动供应价{{detail.supplyPrice}}%</text>
+					<text class="margin-left-10">活动折扣 {{detail.supplyPrice/10}} 折</text>
 				</view>
 			</view>
 			<view class="data">

+ 153 - 108
pages/checkstand/index.vue

@@ -6,29 +6,25 @@
 		</view>
 		<!-- #endif -->
 
-		<view class="check-panel flex-direction">
-			<image :src="shopDetail.cover" class="buyer-logo"></image>
-			<view class="title center">{{shopDetail.name}}</view>
-			<view class="input-content">
-				<view class="tips">交易金额</view>
-				<view class="input-bar center" @tap="show=true">
+		<view class="shopInfo">
+			<image :src="shopDetail.cover" mode=""></image>
+			<text>{{shopDetail.name}}</text>
+		</view>
+		<view class="data">
+			<text style="color: #000;">付款金额</text>
+			<view class="price">
+				<view class="input-bar center" @tap="show">
 					<view class="icon center">¥</view>
-					<view class="input center">
-						<view :style="!$isEmpty(orderAmount)?'margin-left: -15%;':''">{{orderAmount}}</view>
-						<view class="cusor" :style="$isEmpty(orderAmount)?'margin-left: -15%;':''"></view>
+					<view class="input" style="display: flex; align-items: center;">
+						<view style="font-size: 80rpx;">{{filterMoney(orderAmount)}}</view>
+						<view class="cusor"></view>
 					</view>
 				</view>
-				<view style="height: 50rpx;"></view>
-				<view class="" style="z-index: 99;">
-					<u-button throttle-time="1200"  class="button" type="warning" @click="pay">付款</u-button>
-				</view>
 			</view>
-
-			<view class="bottom-line center"> -- 联兑通提供技术支持 --</view>
-			<u-keyboard z-index="9" ref="uKeyboard" :show-tips="false" :safe-area-inset-bottom="true" :mask="false"
-				v-model="show" @change="handleInput" @confirm="pay" @backspace="handleDelete"></u-keyboard>
 		</view>
-		
+		<amountInput ref="amountInput" confirmText="付款" btnColor="#ff9900" placeholder="请输入交易金额" @change="change"
+			@confirm="$u.debounce(pay, 1000)"></amountInput>
+
 		<u-modal v-model="payModalShow" :showCancelButton="true" confirm-color="#FF9447">
 			<view class="center flex-direction text-df" style="padding: 30rpx 40rpx;">
 				<view>您的积分可足额抵扣支付</view>
@@ -36,28 +32,42 @@
 			</view>
 		</u-modal>
 
-		<u-modal v-model="modalShow"  :showCancelButton="true" @cancel="payOfh5"  @confirm="jumpLDT" cancel-text="直接付款" confirm-color="#FF9447"
-			confirmText="去联兑通支付" content="去联兑通小程序付款会有更多优惠哟~"></u-modal>
+		<u-modal v-model="modalShow" :showCancelButton="true" @cancel="payOfh5" @confirm="jumpLDT" cancel-text="直接付款"
+			confirm-color="#FF9447" confirmText="去联兑通支付" content="去联兑通小程序付款会有更多优惠哟~"></u-modal>
 	</view>
 </template>
 
 <script>
+	import amountInput from '@/components/amountInput/amountInput.vue';
 	export default {
-		onLoad(option) {},
+		components: {
+			amountInput
+		},
 		data() {
 			return {
-				payModalShow:false,
-				modalShow: false,
-				show: false,
-				logo: "/static/bank/CMBCHINA.png",
-				buyer: "联兑通",
 				orderAmount: '',
+				payModalShow: false,
+				modalShow: false,
 				shopId: '',
 				shopDetail: {}
 			}
 		},
 		onLoad(options) {
-			this.shopId = options.id
+			if (!this.$isEmpty(options.query)) {
+				let params = options.query.split(";")
+				this.shopId = params[0]
+				this.orderAmount = params[1]
+			} else {
+				this.shopId = options.id
+			}
+			//如果是新用户通过微信支付扫码进入此页面,跳回首页
+			if (this.$isEmpty(this.vuex_userId)) {
+				uni.reLaunch({
+					url:"/pages/mine/mine?query="+ this.shopId + ";" + this.orderAmount
+				})
+				return
+			}
+			
 			if (this.$isEmpty(this.shopId)) {
 				this.$dialog.showModal('商户id不能为空', false).then(() => {
 					uni.navigateBack()
@@ -73,13 +83,11 @@
 				}).then(res => {
 					if (this.$isEmpty(res.data)) {
 						this.$dialog.showModal('获取不到商户信息', false).then(() => {
-							this.show = false
 							uni.navigateBack({
 								delta: 1
 							})
 						})
 					} else {
-						this.show = true
 						this.shopDetail = res.data
 					}
 				}).catch(err => {
@@ -90,39 +98,57 @@
 					})
 				})
 			},
-			handleInput(num) {
-				if (this.orderAmount.length > 12) {
-					return
+			show() {
+				this.$refs.amountInput.show()
+			},
+			change(e) {
+				if (!e) {
+					this.orderAmount = 0
+				} else {
+					this.orderAmount = e
 				}
-				this.orderAmount = this.orderAmount + num
 			},
-			handleDelete() {
-				if (this.$isEmpty(this.orderAmount)) {
-					return
+			filterMoney(value) {
+				if (!value) {
+					return ''
+				} else {
+					value = value.replace(/\$\s?|(,*)/g, '')
+					return value.replace(/\B(?=(\d{3})+(?!\d))/g, ',')
 				}
-				this.orderAmount = this.orderAmount.substr(0, this.orderAmount.length - 1)
 			},
-			jumpLDT() {
-				location.href = "weixin://dl/business/?t=X2CyIQDbgtm"
+			async jumpLDT() {
+				this.$dialog.showLoading('打开中..')
+				let params = {
+					path: "/pages/checkstand/index",
+					query: "query=" + this.shopId + ";" + this.orderAmount
+				}
+				let res = await this.$api.wxApp.getGenerateScheme(params)
+				if (res.data.openlink) {
+					location.href = res.data.openlink
+				} else {
+					location.href = "weixin://dl/business/?t=X2CyIQDbgtm"
+				}
+				uni.hideLoading()
 			},
 			async payOfh5() {
-				let expireTime=this.$dateTime.getExpireTime(5)
-				let params={
-					money:this.orderAmount,
-					shopId:this.shopId,
-					billsTitle:'用户微信扫码支付',
+				let expireTime = this.$dateTime.getExpireTime(5)
+				let params = {
+					money: this.orderAmount,
+					shopId: this.shopId,
+					billsTitle: '用户微信扫码支付',
 					expireTime
 				}
-				let resp=await this.$api.loginUser.payBeforeForNormal(params)
-				let payObj={
-					orderType:this.$global.orderType.USER_PAY,
-					orderId:resp.data.id
+				let resp = await this.$api.loginUser.payBeforeForNormal(params)
+				let payObj = {
+					orderType: this.$global.orderType.USER_PAY,
+					orderId: resp.data.id
 				}
-				let res=await this.$api.pay.payOrderOfscanCode(payObj)
+				let res = await this.$api.pay.payOrderOfscanCode(payObj)
 				if (!this.$isEmpty(res.data.qrCodeUrl)) {
-					location.href=res.data.qrCodeUrl
+					location.href = res.data.qrCodeUrl
+				}else{
+					this.$u.toast('支付失败')
 				}
-				this.$u.toast('支付失败')
 			},
 			async pay() {
 				if (this.$isEmpty(this.orderAmount)) {
@@ -134,17 +160,17 @@
 				// #endif
 
 				// #ifdef MP-WEIXIN
-				let flag=false
+				let flag = false
 				if (flag) {
 					//可以足额支付
-					this.payModalShow=true
-				}else{
+					this.payModalShow = true
+				} else {
 					//积分不足额支付,调易宝支付
 					this.toWXPay()
 				}
 				// #endif
 			},
-			async toWXPay(){
+			async toWXPay() {
 				let expireTime = this.$dateTime.getExpireTime(5)
 				let params = {
 					shopId: this.shopId,
@@ -157,6 +183,18 @@
 					type: 1 //type: 1-用户扫商户收款码支付 2-商户扫用户付款码支付
 				}
 				let resp = await this.$api.loginUser.payBefore(params)
+				if (!resp.success) {
+					this.$u.toast(resp.msg)
+					return
+				}
+				if (resp.data.payAmount==0) {
+					this.$dialog.showModal('已使用积分抵扣成功',false).then(()=>{
+						uni.navigateBack({
+							delta:1
+						})
+					})
+					return
+				}
 				let obj = {
 					orderType: this.$global.orderType.USER_PAY,
 					orderId: resp.data.id,
@@ -173,72 +211,79 @@
 	}
 </script>
 
+<style>
+	page{
+		background-color: #ffff;
+	}
+</style>
+
 <style lang="scss" scoped>
-	.check-panel {
-		.buyer-logo {
-			width: 130rpx;
-			height: 130rpx;
-			margin-top: 50rpx;
-			margin-left: calc(50% - 65rpx);
+	.shopInfo {
+		margin: 60rpx 0 20rpx;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		flex-direction: column;
+
+		image {
 			border-radius: 50%;
+			width: 140rpx;
+			height: 140rpx;
 		}
 
-		.title {
-			font-weight: 800;
-			height: 70rpx;
-			letter-spacing: 3rpx;
-			color: #5D5D5D;
+		text {
+			margin-top: 30rpx;
+			font-size: 32rpx;
 		}
+	}
 
-		.input-content {
-			margin-top: 50rpx;
-			padding: 50rpx;
-			background-color: #FFFFFF;
-			width: 100%;
-			border-radius: 25rpx 25rpx 0 0;
-
-			.tips {
-				height: 100rpx;
-				font-size: 30rpx;
-				display: flex;
-				justify-content: left;
-				align-items: center;
+	.data {
+		padding: 50rpx;
+		display: flex;
+		justify-content: flex-start;
+		flex-direction: column;
+
+		.price {
+
+			&-icon {
+				font-size: 40rpx;
+				font-weight: 800;
 			}
+		}
+	}
 
-			.input-bar {
-				height: 150rpx;
-				border-bottom: 1rpx solid #DDDDDD;
+	.center {
+		display: flex;
+		justify-content: center;
+		align-items: center;
+	}
 
-				.icon {
-					width: 15%;
-					font-size: 70rpx;
-					font-weight: 900;
-					height: 100%;
-				}
+	.input-bar {
+		height: 150rpx;
+		border-bottom: 1rpx solid #DDDDDD;
 
-				.input {
-					width: 85%;
-					height: 100%;
-					overflow: hidden;
-					font-size: 70rpx;
-				}
+		.icon {
+			width: 15%;
+			font-size: 70rpx;
+			font-weight: 900;
+			height: 100%;
+		}
 
-				.cusor {
-					width: 2rpx;
-					height: 80%;
-					background-color: #FD711B;
-					animation: blink 1500ms infinite ease-in-out;
-				}
-			}
+		.input {
+			width: 85%;
+			height: 100%;
+			overflow: hidden;
+			font-size: 70rpx;
 		}
-	}
 
-	.bottom-line {
-		position: absolute;
-		bottom: 50rpx;
-		left: 0;
-		width: 100%;
-		color: #dddddd;
+		.cusor {
+			margin-left: 10rpx;
+			width: 6rpx;
+			border-radius: 20rpx;
+			height: 60%;
+			background-color: #ff9900;
+			animation: blink 1200ms infinite ease-in-out;
+		}
 	}
 
 	@keyframes blink {

+ 8 - 7
pages/mine/bill-detail.vue

@@ -36,7 +36,7 @@
 					</view>
 					<view class="item">
 						<text>支付方式</text>
-						<text>积分</text>
+						<text>{{item.payWay}}</text>
 					</view>
 				</block>
 				<block v-if="item.type==4"></block>
@@ -66,7 +66,8 @@
 			<view class="card">
 				<view class="item">
 					<text>交易状态</text>
-					<text>{{item.payStatus==0?'待付款':item.payStatus==1?'已付款':'已取消'}}</text>
+					<text v-if="item.billRecordStatus==0">待付款</text>
+					<text v-if="item.billRecordStatus==1">已付款</text>
 				</view>
 				<view class="item">
 					<text>交易时间</text>
@@ -74,7 +75,7 @@
 				</view>
 				<view class="item">
 					<text>支付方式</text>
-					<text>积分</text>
+					<text>{{item.payWay}}</text>
 				</view>
 				<view class="item">
 					<text>交易单号</text>
@@ -88,10 +89,10 @@
 		</block>
 		
 		
-		<view class="question">
-			<text>对订单有疑问</text>
-			<text class="cuIcon-right" style="margin-top: 5rpx;"></text>
-		</view>
+		<button open-type="contact" class="question" style="height: 86rpx;font-size: 28rpx;">
+			<text class="center">对订单有疑问</text>
+			<text class="cuIcon-right center" style="margin-top: 5rpx;"></text>
+		</button>
 	</view>
 </template>
 

+ 18 - 4
pages/mine/mine.vue

@@ -1,6 +1,5 @@
 <template>
 	<view >
-		
 		<!-- 扫一扫错误回调 -->
 		<u-modal title="扫描异常"  confirm-color="#dc9b21"  v-model="scanNotify.scan" :content="scanNotify.scanMessage"></u-modal>
 		<view style="position: relative;">
@@ -157,16 +156,23 @@
 				gainList:[],
 				pointsList:[],
 				//用户信息
-				userInfo:{}
+				userInfo:{},
+				
+				//跳回收银台的逻辑
+				query:''
 			}
 		},
 		onPageScroll(obj){
 			this.toumindu = obj.scrollTop*0.006;
 		},
-		onLoad() {
-			this.fetchStatic()
+		onLoad(options) {
+			//获取从收银台传过来的参数,处理新用户扫码进入收银台再进入首页的情况
+			if (!this.$isEmpty(options.query)) {
+				this.query=options.query
+			}
 		},
 		onShow() {
+			this.fetchStatic()
 			this.login()
 		},
 		methods: {
@@ -219,6 +225,14 @@
 				}
 				//获取数据
 				this.init()
+				
+				//处理跳回收银台的情况
+				if (!this.$isEmpty(this.query)) {
+					uni.redirectTo({
+						url:"/pages/checkstand/index?query="+this.query
+					})
+				}
+				
 			},
 			async login(e){
 				if (this.$isEmpty(this.vuex_userId)) {

+ 9 - 7
pages/mine/my-balance/my-balance.vue

@@ -3,7 +3,7 @@
 		<u-picker v-model="showTime" mode="time" :params="params" :default-time="defaultTime" @confirm="confirmTime"></u-picker>
 		<view class="top">
 			<view class="value">
-				<text>我的余额</text>
+				<text>积分余额</text>
 				<text>{{pointValue}}</text>
 			</view>
 		</view>
@@ -26,7 +26,7 @@
 		<view class="card">
 			<mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption"
 				:up="upOption">
-				<view @click="$jump('/pages/bill/bill-detail?bill-detail='+JSON.stringify(item)+'&type==balance')" class="item" hover-class="hoverClass"
+				<view @click="$jump('/pages/mine/bill-detail?billDetail='+JSON.stringify(item)+'&type=balance')" class="item" hover-class="hoverClass"
 					v-for="(item,index) in list" :key="index">
 					<view class="area1">
 						<view class="item-padding">
@@ -41,7 +41,7 @@
 					<view v-if="item.type==3" class="area3 text-area u-flex-1" >
 						<view class="item-padding" style="text-align: right;flex:1;font-size: 34rpx;color: #000000;margin-right: 20rpx;">-¥{{item.pointValue}}</view>
 					</view>
-					<view v-if="item.type==2" class="area3 text-area u-flex-1" >
+					<view v-else class="area3 text-area u-flex-1" >
 						<view class="item-padding" style="text-align: right;flex:1;font-size: 34rpx;color: #F39248;margin-right: 20rpx;">+¥{{item.pointValue}}</view>
 					</view>
 				</view>
@@ -73,10 +73,7 @@
 			if(options.pointValue){
 				this.pointValue = options.pointValue
 			}
-			let m = new Date().getMonth() + 1
-			let y = new Date().getFullYear()
-			let m1 = m<10? ("0" + m) : m
-			this.defaultTime = y + '-' + m1
+			this.defaultTime =this.$dateTime.format(new Date(),'YYYY-mm')
 		},
 		methods: {
 			confirmTime(e){
@@ -90,6 +87,11 @@
 					userId:this.vuex_userId,
 					monthTime:this.defaultTime
 				}
+				if (this.defaultTime) {
+					params.monthTime=this.defaultTime
+				}else{
+					params.monthTime=this.$dateTime.format(new Date(),'YYYY-mm')
+				}
 				try {
 					this.$api.account.remainList(params).then(res => {
 						let data = res.data.records

+ 7 - 2
pages/mine/my-points/my-points.vue

@@ -42,7 +42,7 @@
 			</view>
 			<mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption"
 				:up="upOption">
-				<view @click="$jump('/pages/bill/bill-detail?bill-detail='+JSON.stringify(item))+'&type==point'" class="item" hover-class="hoverClass"
+				<view @click="$jump('/pages/mine/bill-detail?billDetail='+JSON.stringify(item))+'&type=point'" class="item" hover-class="hoverClass"
 					v-for="(item,index) in list" :key="index">
 					<view class="area1">
 						<view class="item-padding">
@@ -93,7 +93,6 @@
 			this.defaultTime=this.$dateTime.format(new Date(),'YYYY-mm')
 		},
 		onLoad(options) {
-			this.defaultTime=this.$dateTime.format(new Date(),'YYYY-mm')
 			if(options.point){
 				this.point = options.point
 			}
@@ -110,6 +109,12 @@
 					userId:this.vuex_userId,
 					monthTime:this.defaultTime
 				}
+				if (this.defaultTime) {
+					params.monthTime=this.defaultTime
+				}else{
+					params.monthTime=this.$dateTime.format(new Date(),'YYYY-mm')
+				}
+				
 				try {
 					this.$api.account.pointList(params).then(res => {
 						let data = res.data.records

二进制
static/icon/await.png


二进制
static/icon/fail.png


二进制
static/icon/pass.png