Explorar o código

多种支付方式,设置支付密码等

gcz hai 1 ano
pai
achega
7fd286869e

+ 2 - 1
center/center.vue

@@ -80,7 +80,8 @@
 					// {name:'领券中心',url:'/center/mycoupon',ico:this.$commonConfig.staticUrl+'/img/center-coupon.png',checkauth:true},
 					// {name:'开具发票',url:'center/invoice',ico:this.$commonConfig.staticUrl+'/img/center-ticket.png',checkauth:true},
 					{name:'报名记录',url:'center/applylist',ico:this.$commonConfig.staticUrl+'/img/center-order.png',checkauth:true},
-					{name:'订单记录',url:'center/order',ico:this.$commonConfig.staticUrl+'/img/center-order.png',checkauth:true},
+					{name:'订单记录',url:'center/order',ico:this.$commonConfig.staticUrl+'/img/center-record.svg',checkauth:true},
+					{name:'余额中心',url:'center/mybalance',ico:this.$commonConfig.staticUrl+'/img/center-yue.svg',checkauth:true},
 					// {name:'客服热线',url:'',ico:this.$commonConfig.staticUrl+'/img/center-call.png',checkauth:true,phone:''},
 					// {name:'在线客服',chat:'1',ico:this.$commonConfig.staticUrl+'/img/center-call.png'},
 				]

+ 257 - 0
center/choosePayment.vue

@@ -0,0 +1,257 @@
+<template>
+	<view class="pages">
+		<view class="" :style="{height: navHeight+'px' }"></view>
+		<u-navbar 
+			title="订单详情" 
+			:safeAreaInsetTop="true" 
+			@leftClick="leftClick" 
+			:titleStyle="{color:'#fff'}" 
+			leftIconColor="#fff" 
+			bgColor="#ED0000">
+		</u-navbar>
+		<view class="page-wrap">
+			<view class="pay-list">
+				 <radio-group @change="payRadioChange">
+					<view class="pay-list-item u-flex u-row-between" @click="payRadioClick('weixin')">
+						<view class="left u-flex">
+						 	<image class="icon" :src="staticUrl+'/img/share-ico.png'" ></image>
+							<view class="name">微信支付</view>
+						</view>
+						<radio color="#2DCF8C" value="weixin" :checked="'weixin' === radioCurrent" />
+					</view>
+					<view class="pay-list-item u-flex u-row-between" @click="payRadioClick('yue')">
+						<view class="left u-flex">
+						 	<image class="icon" :src="staticUrl+'/img/share-ico.png'" ></image>
+							<view class="name">账户余额</view>
+							<view class="num">剩余¥:2000</view>
+						</view>
+						<radio color="#2DCF8C" value="yue" :checked="'yue' === radioCurrent" />
+					</view>
+					<view class="pay-list-item u-flex u-row-between" @click="payRadioClick('shouxin')">
+						<view class="left u-flex">
+						 	<image class="icon" :src="staticUrl+'/img/share-ico.png'" ></image>
+							<view class="name">授信余额</view>
+							<view class="num">剩余¥:2000</view>
+						</view>
+						<radio color="#2DCF8C" value="shouxin" :checked="'shouxin' === radioCurrent" />
+					</view>
+				 </radio-group>
+			</view>
+			<view class="full-btn" @click="submit">支付</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import { systemInfo } from "@/mixin.js";
+	// #ifdef H5
+	import wxH5 from "weixin-jsapi";
+	// #endif
+	export default{
+		mixins:[systemInfo],
+		name:'',
+		components:{
+			
+		},
+		props:{
+			
+		},
+		data(){
+			return{
+				staticUrl:this.$commonConfig.staticUrl,
+				// 支付方式选择
+				radioCurrent: 'weixin',
+				
+			}
+		},
+		onLoad(){
+			this.getSystemInfo();
+			
+		},
+		methods:{
+			leftClick(e){
+				let pages = getCurrentPages();
+				if(pages.length==1){
+					uni.$u.route('/pages/index/index')
+				}else{
+					uni.navigateBack()
+				};
+			},
+			payRadioChange({ detail }) {
+			  this.radioCurrent = detail.value;
+			},
+			payRadioClick(value) {
+			  this.radioCurrent = value;
+			},
+			submit(){
+				console.log('this.radioCurrent', this.radioCurrent);
+			},
+			getTemplateIdList(){
+				this.$u.api.templateIdList({templateLabel:'order_pay'}).then(res=>{
+					console.log('getTemplateIdList',res.data);
+					this.templateIdList = res.data.list.map(item=>{
+						return item.templateId
+					});
+					// if(this.templateIdList.length>0){
+					// 	this.templateEven();
+					// }
+				}).catch(err=>{
+					console.log('getTemplateIdList',err);
+				})
+			},
+			pay(item){
+				// #ifdef H5
+					this.gotoPay(this.orderDetails.id);
+				// #endif
+				// #ifdef MP
+					this.setTemplate(this.orderDetails.id);
+				// #endif
+			},
+			gotoPay(orderId){
+				this.$u.api.gotoPay({orderId:orderId,openid:''}).then(res=>{
+					this.payResult = res.data.payInfo;
+					this.payResult.package = res.data.payInfo.packageValue;
+					// #ifdef H5
+					this.initConfig(this.payResult)
+					// #endif 
+					// #ifdef MP
+					this.wxPay()
+					// #endif 
+					// if(this.params.paymentMode==1||this.params.paymentMode==4){
+					// 	this.wxPay()
+					// }else{
+					// 	uni.$u.route('/shopping/paysuccess');
+					// }
+					console.log('gotoPayres',res.data);
+				}).catch(err=>{
+					this.paypass = '';
+					this.checkPassShow = false;
+					console.log('gotoPay',err);
+				})				
+			},
+			wxPay(){
+				let that = this;
+				uni.requestPayment({
+					... this.payResult,
+				    "provider": "wxpay", 
+				    "orderInfo": {
+				        // "appid": "wx499********7c70e",  // 微信开放平台 - 应用 - AppId,注意和微信小程序、公众号 AppId 可能不一致
+				        // "noncestr": "c5sEwbaNPiXAF3iv", // 随机字符串
+				        // "package": "Sign=WXPay",        // 固定值
+				        // "partnerid": "148*****52",      // 微信支付商户号
+				        // "prepayid": "wx202254********************fbe90000", // 统一下单订单号 
+				        // "timestamp": 1597935292,        // 时间戳(单位:秒)
+				        // "sign": "A842B45937F6EFF60DEC7A2EAA52D5A0" // 签名,这里用的 MD5/RSA 签名
+				    },
+				    success(res) {
+						that.payQuery();
+					},
+				    fail(e) {
+						console.log('wxPayfail',e);
+					}
+				})				
+			},
+			payQuery(){
+				let that = this;
+				let retryCount = 0;
+				let maxRetryCount = 5; // 设置最大重试次数
+				let interval = 2000; // 设置间隔时间为2秒
+				let timeout = 10000; // 设置超时时间为10秒
+				let timer;
+				uni.showLoading({
+					title:'支付结果查询中'
+				})
+				timer = setInterval(() => {
+					retryCount++;
+					if (retryCount > maxRetryCount || retryCount * interval > timeout) {
+						clearInterval(timer);
+						  uni.hideLoading();
+						console.log("支付查询超时或达到最大重试次数");
+						// 在这里添加超时或达到最大重试次数的处理逻辑
+						this.reloadList()
+					} else {
+						console.log("第" + retryCount + "次查询");
+						// 调用查询支付状态的方法
+						// 如果支付状态为成功,则清除定时器并处理成功的逻辑
+						// 如果支付状态为失败,则清除定时器并处理失败的逻辑
+						this.$u.api.payQuery({orderId:this.orderId}).then(res=>{
+							// 0-未支付 1-已支付 2-支付中 3-支付失败 4-支付退款
+							let payStatus = res.data.payStatus;
+							if(payStatus===1){
+								uni.$u.route('/center/paysuccess');
+							}else if(payStatus===0||payStatus===2){
+								this.payQuery()
+							}else if(payStatus===3){
+								uni.toast('支付失败')
+							}
+							clearInterval(timer);
+						}).catch(err=>{
+							console.log('payQuery',err);
+						}).finally(()=>{
+							uni.hideLoading()
+						})
+					}
+				}, interval);
+			},
+			/**
+			 * 公众号微信支付
+			 */
+			initConfig() {
+				// #ifdef H5
+				let that = this
+				wxH5.config({
+					debug: false, // 这里一般在测试阶段先用ture,等打包给后台的时候就改回false, 
+					appId: that.payResult.appId, // 必填,公众号的唯一标识 
+					timestamp: that.payResult.timeStamp, // 必填,生成签名的时间戳     
+					nonceStr: that.payResult.nonceStr, // 必填,生成签名的随机串 
+					signature: that.payResult.paySign, // 必填,签名 
+					jsApiList: ['chooseWXPay', 'checkJsApi'] // 必填,需要使用的JS接口列表 
+				})
+				wxH5.ready(() => {
+					wxH5.chooseWXPay({
+						timestamp: that.payResult.timeStamp, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符     
+						nonceStr: that.payResult.nonceStr, // 支付签名随机串,不长于 32 位         
+						package: that.payResult.packageValue, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=\*\*\*)     
+						signType: 'SHA1', // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'     
+						paySign: that.payResult.paySign, // 支付签名     
+						success: () => {
+							that.payQuery();
+						},
+						fail: (e) => {
+							uni.$u.route('/center/order', {
+								status: 0
+							});
+							console.log('wxPayfail', e);
+						},
+						cancel: () => {
+							uni.$u.route('/center/order', {
+								status: 0
+							});
+							that.cansubmit = true;
+						}
+					})
+				})
+				// #endif
+			},
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+.pay-list{
+	.pay-list-item{
+		margin-bottom: 24rpx;
+		.icon{
+			width: 40rpx;
+			height: 40rpx;
+			margin-right: 24rpx;
+		}
+		.name{
+			margin-right: 24rpx;
+		}
+		.num{
+			
+		}
+	}
+}
+</style>

+ 201 - 0
center/dealList.vue

@@ -0,0 +1,201 @@
+<template>
+	<view class="">
+		<u-navbar
+			title="交易明细"
+			:placeholder="true"
+			:autoBack="true"
+			@leftClick="leftClick"
+			 :safeAreaInsetTop="true"
+		>
+		</u-navbar>
+		<view class="tabs-wrap">
+			<u-tabs 
+			:list="tabsList" 
+			lineColor="#EF2121" 
+			 :activeStyle="{color:'#333','font-weight': '600','font-size':'30rpx'}"
+			 :inactiveStyle="{color:'#999'}"
+			@click="tabsClick"></u-tabs>
+		</view>
+		<mescroll-body class="" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
+			<view class="page-wrap" v-if="dataList.length>0" >
+				<view class="list">
+					<view class="item u-flex u-row-between" v-for="item in dataList" :key="item.id">
+						<view class="left">
+							<view class="name">{{item.title}}</view>
+							<view class="time">{{item.createTime}}</view>
+						</view>
+						<view class="right">
+							<text class="num plus" v-if="item.type==1">+{{item.num}}</text>
+							<text class="num" v-else>-{{item.num}}</text>
+							<!-- <view class="remark">{{item.remark}}</view> -->
+						</view>
+						
+					</view>
+				</view>
+			</view>
+		</mescroll-body>
+	</view>
+</template>
+
+<script>
+	// 引入mescroll-mixins.js
+	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
+	export default {
+		mixins: [MescrollMixin], // 使用mixin
+		data() {
+			return {
+				credit:'',
+				downOption: {},
+				// 上拉加载的配置(可选, 绝大部分情况无需配置)
+				upOption: {
+					page: {
+						size: 10 // 每页数据的数量,默认10
+					},
+					noMoreSize: 5, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
+					empty: {
+						tip: '暂无相关数据'
+					}
+				},
+				tabsList:[{name:'收入',recordType:1},{name:'支出',recordType:2}],
+				params:{
+					type:''
+				},
+				activeIndex:0,
+				dataList: []
+			}
+		},
+		onShow() {
+			
+		},
+		onLoad() {
+			this.params.type = this.tabsList[this.activeIndex].recordType;
+			// console.log('1111', this.tabsList[this.activeIndex]);
+		},
+		methods: {
+			leftClick(e){
+				let pages = getCurrentPages();
+				if(pages.length==1){
+					uni.$u.route('/pages/index/index')
+				}else{
+					uni.navigateBack()
+				};
+			},
+			/*下拉刷新的回调, 重置列表为第一页 (此处可删,mixins已默认)
+			downCallback(){
+				this.mescroll.resetUpScroll();
+			},
+			/*上拉加载的回调*/
+			upCallback(page) {
+				// 此处可以继续请求其他接口
+				// if(page.num == 1){
+				// 	// 请求其他接口...
+				// }
+			
+				// 如果希望先请求其他接口,再触发upCallback,可参考以下写法
+				// if(!this.params.id){
+				// 	this.mescroll.endErr()
+				// 	return // 此处return,先获取xx
+				// }
+			
+				let pageNum = page.num; // 页码, 默认从1开始
+				let pageSize = page.size; // 页长, 默认每页10条isAsc:0//时间排序 0:降序 1:升序 (默认星级降序排序)
+
+				this.params = Object.assign(this.params,{pageNum:pageNum,pageSize:pageSize});
+				this.$u.api.selectBalanceLogList(this.params).then(data => {
+					console.log('data',JSON.parse(JSON.stringify(data)));
+					// 接口返回的当前页数据列表 (数组)
+					let curPageData = data.data.rows;
+					console.log('curPageData',JSON.parse(JSON.stringify(curPageData)));
+					// 接口返回的当前页数据长度 (如列表有26个数据,当前页返回8个,则curPageLen=8)
+					let curPageLen = curPageData.length; 
+					// 接口返回的总页数 (如列表有26个数据,每页10条,共3页; 则totalPage=3)
+					// let totalPage =  data.data.data.totalPage; 
+					// 接口返回的总数据量(如列表有26个数据,每页10条,共3页; 则totalSize=26)
+					let totalSize = data.data.total; 
+					// 接口返回的是否有下一页 (true/false)
+					// let hasNext = data.xxx; 
+					// console.log('totalPage',totalPage,'curPageLen',curPageLen);
+					//设置列表数据
+					if(page.num == 1) this.dataList = []; //如果是第一页需手动置空列表
+					this.dataList = this.dataList.concat(curPageData); //追加新数据
+					// 请求成功,隐藏加载状态
+					//方法一(推荐): 后台接口有返回列表的总页数 totalPage
+					// this.mescroll.endByPage(curPageLen, totalPage); 
+					//方法二(推荐): 后台接口有返回列表的总数据量 totalSize
+					this.mescroll.endBySize(curPageLen, totalSize); 
+				}).catch(err => {
+					this.mescroll.endErr()
+					console.log(err)
+				});	
+			
+			},
+			/*若希望重新加载列表,只需调用此方法即可(内部会自动page.num=1,再主动触发up.callback)*/
+			reloadList() {
+				this.mescroll.resetUpScroll();
+			},
+			tabsClick(item){
+				this.params.type = item.recordType;
+				this.reloadList()
+				// console.log('item',item);
+			},
+		}
+	}
+</script>
+<style>
+page{
+	background-color: #f5f5f5;
+}
+</style>
+<style lang="scss" scoped>
+.credit{
+	padding: 20rpx;
+	background-color: #fff;
+	border-radius: 8rpx;
+	margin: 0 20rpx 20rpx;
+	font-size: 36rpx;
+	font-weight: 600;
+	color: #00A447;
+}
+.tabs-wrap{
+	background-color: #fff;
+	margin-bottom: 10rpx;
+}
+.list{
+	border-radius: 8rpx;
+	padding: 0 20rpx 20rpx;
+	background-color: #fff;
+	.item{
+		padding: 20rpx 0;
+		border-bottom: 0.5px solid #ddd;
+		.name{
+			font-size: 30rpx;
+			font-weight: 400;
+			color: #333333;
+			line-height: 42rpx;
+			margin-bottom: 8rpx;
+		}
+		.time{
+			font-size: 24rpx;
+			font-weight: 400;
+			color: #999999;
+			line-height: 33rpx;
+		}
+		.right{
+			text-align: right;
+			.remark{
+				font-size: 24rpx;
+				font-weight: 400;
+				color: #999999;
+			}
+		}
+		.num{
+			font-size: 30rpx;
+			font-weight: 600;
+			color: #FFB100;
+			&.plus{
+				color: #00A447;
+			}
+		}
+	}
+}
+</style>

+ 104 - 0
center/findpaypass.vue

@@ -0,0 +1,104 @@
+<template>
+	<view class="page-wrap">
+		<u-navbar
+			title="忘记密码"
+			:placeholder="true"
+			:autoBack="true"
+			 :safeAreaInsetTop="true"
+		>
+		</u-navbar>
+		<view class="title">手机验证身份</view>
+		<view class="phone">
+			<text v-if="leftTime>0">验证码已发送</text>
+			<text v-else>手机号:</text>
+			{{vuex_member_info.mobile|hidePhoneNumber}}</view>
+		<u-code-input 
+			v-model="value" 
+			mode="line" 
+			:maxlength="4"
+			@finish="finish">
+		</u-code-input>
+		<u-button class="button" type="primary" :disabled="leftTime>0" @click="sendSMS" :text="btnStatus"></u-button>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				value:'',
+				leftTime: 0, // 剩余时间
+				btnStatus: '发送验证码', // 按钮状态
+				params:{
+				}
+				
+			}
+		},
+		onShow() {
+			
+		},
+		onLoad() {
+
+		},
+		methods: {
+			sendSMS() {
+			  // console.log('发送短信验证码到:', 手机号码);
+			  this.$u.api.getCode({mobile:this.vuex_member_info.mobile}).then(res=>{
+				  this.leftTime = 60;
+				  this.btnStatus = `${this.leftTime}秒后重试`;
+				  const timer = setInterval(() => {
+					this.leftTime--;
+					this.btnStatus = `${this.leftTime}秒后重试`;
+					if (this.leftTime <= 0) {
+					  clearInterval(timer);
+					  this.btnStatus = '重新发送验证码';
+					}
+				  }, 1000);
+			  	console.log('res',res.data);
+			  }).catch(err=>{
+			  	console.log('getCode',err);
+			  });
+			},
+			finish(){
+				console.log('value',this.value);
+				this.$u.api.verifyCode({mobile:this.vuex_member_info.mobile,code:this.value}).then(res=>{
+					uni.$u.route('/center/setPaypass', {
+						fromPage: 'forget',
+						code:this.value
+					});
+					console.log('res',res.data);
+				}).catch(err=>{
+					console.log('getCode',err);
+				});
+				
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+.page-wrap{
+	text-align: center;
+	.title{
+		font-size: 32rpx;
+		font-weight: 600;
+		color: #333333;
+		line-height: 45rpx;
+		margin: 40rpx auto 30rpx;
+	}
+	.phone{
+		font-size: 26rpx;
+		font-weight: 400;
+		color: #999999;
+		line-height: 37rpx;
+		margin-bottom: 130rpx;
+	}
+}
+/deep/ .u-code-input__item{
+	flex-grow: 1;
+}
+/deep/ .u-button{
+	margin-top: 80rpx;
+	width: 80%!important;
+}
+</style>

+ 133 - 0
center/mybalance.vue

@@ -0,0 +1,133 @@
+<template>
+	<view class="page-wrap">
+		<u-navbar
+			title="余额中心"
+			:placeholder="true"
+			:autoBack="false"
+			 @leftClick="leftClick"
+			 :safeAreaInsetTop="true"
+		>
+		</u-navbar>
+		<view class="panel">
+			<view class="title">账户余额(元)</view>
+			<view class="number-wrap">
+				<view class="total">
+					¥ <text class="number">{{balanceInfo.balance}}</text> 
+				</view>
+				<view class="other u-flex">
+					<view class="" style="margin-right: 20rpx;">
+						授信额度:{{balanceInfo.grantQuota}}
+					</view>
+					<view class="" style="margin-right: 20rpx;">
+						授信余额:{{balanceInfo.grantSurplus}}
+					</view>
+					<view class="">
+						授信欠款:{{ balanceInfo.grantUsed }}
+					</view>
+				</view>
+			</view>
+			<!-- <view class="btn-wrap">
+				<text class="btn" @click="$u.route('/center/recharge')">充值</text>
+			</view> -->
+			<view class="shape shape1"></view>
+			<view class="shape shape2"></view>
+		</view>
+		
+		<u-cell-group>
+			<u-cell @click="$u.route('/center/dealList')" icon="order" title="交易明细" :isLink="true"></u-cell>
+			<u-cell @click="$u.route('/center/setPaypass',{fromPage:'reset'})" icon="setting-fill" title="支付密码" :isLink="true"></u-cell>
+			<u-cell @click="$u.route('/center/findpaypass')" icon="fingerprint" title="找回支付密码" :isLink="true"></u-cell>
+		</u-cell-group>
+			
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				balanceInfo:{},
+				params:{
+				}
+				
+			}
+		},
+		onShow() {
+			this.getBalanceInfo();
+		},
+		onLoad() {
+
+		},
+		methods: {
+			leftClick(){
+				uni.reLaunch({url: '/center/center'});
+			},
+			getBalanceInfo(){
+				this.$u.api.balanceInfo({id:this.vuex_member_info.id}).then(res=>{
+					this.balanceInfo = res.data;
+					// this.avatar =  res.data.avatar;
+					// console.log('balanceInfo',this.balanceInfo);
+					}).catch(err=>{
+					console.log('getBalanceInfo',err.data);
+				})
+			},
+
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+.panel{
+	// min-height: 284rpx;
+	position: relative;
+	overflow: hidden;
+	box-sizing: border-box;
+	background-color: #ddd;
+	padding: 40rpx;
+	border-radius: 8rpx;
+	margin-bottom: 40rpx;
+	color: #FFFFFF;
+	background: linear-gradient(147deg, #FF7979 0%, #ED0000 100%);
+	.title{
+		font-size: 26rpx;
+		font-weight: 400;
+		line-height: 37rpx;
+	}
+	.number-wrap{
+		font-size: 24rpx;
+		.number{
+			font-size: 58rpx;
+			font-weight: 600;
+			line-height: 81rpx;
+			margin-bottom: 50rpx;
+			margin-left: 10rpx;
+		}
+	}
+	.btn-wrap{
+		position: relative;
+		z-index: 99;
+		text-align: right;
+		.btn{
+			display: inline-block;
+			padding: 7rpx 20rpx;
+			border-radius: 30rpx;
+			background: rgba(255,255,255,0.16);
+		}
+	}
+	.shape{
+		width: 326rpx;
+		height: 372rpx;
+		position: absolute;
+		border-radius: 50% 50%;
+		top: -50rpx;
+	}
+	.shape1{
+		background: rgba(255,255,255,0.1);
+		right: -50rpx;
+	}
+	.shape2{
+		background: rgba(255,255,255,0.2);
+		right: -170rpx;
+	}
+}
+</style>

+ 8 - 5
center/order.vue

@@ -281,17 +281,20 @@
 			},
 			pay(item){
 				console.log('pay',item);
+				uni.$u.route('/center/pay', {
+					orderId: item.id,
+					// openid: that.vuex_wechatOpenid,
+					payAmount:item.orderPrice
+				});
+				return
+				
 				// #ifdef H5
 				this.gotoPay(item.id);
 				// #endif
 				// #ifdef MP
 				this.setTemplate(item.id);
 				// #endif
-				// uni.$u.route('/shopping/pay', {
-				// 	orderId: item.id,
-				// 	// openid: that.vuex_wechatOpenid,
-				// 	payAmount:item.orderPrice
-				// });
+				
 			},
 			evaluate(item){
 				// console.log('logistics',item);

+ 9 - 2
center/orderdetails.vue

@@ -11,7 +11,7 @@
 					<view class="text"><text v-if="countdown&&countdown!='支付超期'"> 请尽快完成付款,还剩 </text>{{countdown}}</view>
 					<view class="btn-wrap u-flex u-row-center">
 						<view class="btn cancel" @click="cancelOrder">取消订单</view>
-						<view class="btn" @click="gotoPay(orderDetails.id)">立即支付</view>
+						<view class="btn" @click="gotoPay(orderDetails)">立即支付</view>
 					</view>
 				</view>
 				<view class="status-item" v-else-if="orderDetails.status==3">
@@ -499,7 +499,14 @@
 					}  
 				})  
 			},
-			gotoPay(orderId){
+			gotoPay(item){
+				console.log('pay',item);
+				uni.$u.route('/center/pay', {
+					orderId: item.id,
+					// openid: that.vuex_wechatOpenid,
+					payAmount:item.orderPrice
+				});
+				return
 				this.$u.api.gotoPay({orderId:orderId,openid:''}).then(res=>{
 					this.payResult = res.data.payInfo;
 					this.payResult.package = res.data.payInfo.packageValue;

+ 464 - 0
center/pay.vue

@@ -0,0 +1,464 @@
+<template>
+	<view class="">
+		<u-navbar
+			title="收银台"
+			:placeholder="true"
+			@leftClick="leftClick"
+			:autoBack="false"
+			 :safeAreaInsetTop="true"
+		>
+		</u-navbar>
+		<view class="page-wrap">
+			<view class="pay-way page-wrap">
+				  <u-radio-group  v-model="params.paymentMode" placement="column" @change="groupChange">
+				   <view class="pay-way-item u-flex u-row-between">
+				    	<view class="left u-flex">
+				    		<image class="icon" :src="staticUrl+'/img/payway-wx.png'" mode="aspectFill"></image>
+				    		<view class="name">微信支付</view>
+				    	</view>
+				    	<u-radio name="wx" activeColor="#1677FF" size="36rpx"></u-radio>
+				    </view>
+					<view :class="{disabled:balanceInfo.balance<params.payAmount}" class="pay-way-item u-flex u-row-between">
+						<view class="left u-flex">
+							<image class="icon" :src="staticUrl+'/img/pyway-yue.png'" mode="aspectFill"></image>
+							<view class="name">账户余额</view>
+							¥ {{balanceInfo.balance}}
+						</view>
+						<u-radio name="yue" :disabled="balanceInfo.balance<params.payAmount" activeColor="#1677FF" size="36rpx"></u-radio>
+					</view>
+					<view :class="{disabled:balanceInfo.grantSurplus<params.payAmount}" class="pay-way-item u-flex u-row-between">
+						<view class="left u-flex">
+							<image class="icon" :src="staticUrl+'/img/pyway-shouxin.png'" mode="aspectFill"></image>
+							<view class="name">授信余额</view>
+							¥ {{balanceInfo.grantSurplus}}
+						</view>
+						<u-radio name="shouxin" :disabled="balanceInfo.grantSurplus<params.payAmount" activeColor="#1677FF" size="36rpx"></u-radio>
+					</view>
+				  </u-radio-group>
+			</view>
+			<view class="full-btn" @click="payRoute">去支付<text>¥ {{params.payAmount}}</text></view>
+			<u-popup :show="checkPassShow" @close="checkPassClose" mode="center">
+				<view class="check-pass">
+					<view class="title">请输入支付密码</view>
+					<!-- <view class="name">商城</view> -->
+					<view class="number">¥{{params.payAmount}}</view>
+					<view class="the-way u-flex u-row-between">
+						<view class="left">支付方式</view>
+						<view class="right u-flex">
+							<u--image class="image" :src="staticUrl+'/img/qian.png'" width="32rpx" height="32rpx"></u--image>
+							<text style="margin-left: 10px;">余额</text>
+						</view>
+					</view>
+					<u-code-input v-model="paypass" 
+						:space="0"
+						:size="40" 
+						@finish="checkPayPassword" 
+						:maxlength="6" 
+						:adjustPosition="true"
+						:dot="true"
+						:focus="true"
+						:disabled-keyboard="false" >
+					</u-code-input>
+					<!-- <view class="btn-wrap u-flex">
+						<u-button text="取消" @click="checkPassShow=false"></u-button>
+						<u-button text="确认" @click="checkPassShow=false"></u-button>
+					</view> -->
+				</view>
+			</u-popup>
+		</view>
+	</view>
+</template>
+
+<script>
+	// #ifdef H5
+	import wxH5 from "weixin-jsapi";
+	// #endif
+	export default {
+		data() {
+			return {
+				staticUrl:this.$commonConfig.staticUrl,
+				fromPage:'',
+				customBalance:'',
+				credit:'',
+				params:{
+					paymentMode:null,
+					orderId:'',
+					openid:'',
+					payAmount:'',
+					payResult:{},
+				},
+				checkPassShow:false,
+				paypass:'',
+				noPaypass:true,
+				balanceInfo:{
+					balance:0,//	用户余额
+					grantQuota:0,//	授信额度
+					grantUsed:0,//已使用的额度
+					grantSurplus:0,//剩余额度
+					isSetPayPassword:0,//是否设置支付密码 0-否 1-是
+				},
+				
+			}
+		},
+		onShow() {	
+			this.getBalanceInfo();
+		},
+		onLoad(page) {
+			console.log('page',page);
+			this.fromPage = page.fromPage;
+			this.params.orderId = page.orderId;
+			this.params.openid = this.vuex_wechatOpenid;
+			this.params.payAmount = page.payAmount;
+			this.params.paymentMode = page.paymentMode;
+		},
+		methods: {
+			leftClick(){
+				uni.showModal({
+				    title: '提示',
+				    content: '是否放弃本次付款!',
+				    success: res => {
+						if (res.confirm) {
+							uni.navigateBack()
+						} else if (res.cancel) {
+							console.log('用户点击取消');
+						}
+				    }
+				});
+			},
+			getBalanceInfo(){
+				this.$u.api.balanceInfo({id:this.vuex_user_info.userid}).then(res=>{
+					this.balanceInfo= res.data;
+				}).catch(err=>{
+					console.log('balanceInfo',err.data);
+				})
+			},
+			checkPassClose(){
+				this.checkPassShow = false
+			},
+			payRoute(){
+				if(this.params.paymentMode!='wx'){
+					this.checkExistPayPassword();
+				}else{
+					this.gotoPay();
+				}
+			},
+			checkExistPayPassword(){
+				if(this.balanceInfo.isSetPayPassword==0){
+					this.noPaypass = true;
+					uni.showModal({
+						title: '还未设置支付密码',
+						content: '请先设置支付密码!',
+						success: res => {
+							if (res.confirm) {
+								uni.$u.route('/center/setPaypass', {
+									from: 'pay',
+									backUrl:'/shopping/order'
+								});
+							}
+						}
+					})
+				}else{
+					this.noPaypass = false;
+					this.checkPassShow = true
+				}
+			},
+			checkPayPassword(){
+				this.$u.api.checkPayPassword({payPassword:this.paypass}).then(res=>{
+					// console.log('res',res.data);
+					if(res.msg=='操作成功'){//密码正确
+						if(this.params.paymentMode=='wx'){
+							this.gotoPay();
+						}else if(this.params.paymentMode=='yue'){
+							this.gotoBalancePay()
+						}else if(this.params.paymentMode=='shouxin'){
+							this.gotoQuotaPay()
+						}
+					}else{
+						this.paypass = '';
+						uni.showToast({
+							title:'密码错误',
+							icon:'error'
+						});
+					}
+					
+				}).catch(err=>{
+					this.paypass = '';
+					uni.showToast({
+						title:'密码错误',
+						icon:'error'
+					});
+					console.log('checkPayPassword',err);
+				})
+			},
+			gotoPay() {
+				this.$u.api.gotoPay(this.params).then(res => {
+					// this.payResult = res.data.payInfo;
+					// this.payResult.package = res.data.payInfo.packageValue;
+					
+					// ygh
+					if(!res.data.needPay){
+						//this.payQuery();
+						uni.$u.route('/center/orderdetails', {
+							type:'redirectTo',
+							id: this.params.orderId
+						});
+					}else {
+						this.payResult = res.data.payInfo;
+						this.payResult.package = res.data.payInfo.packageValue;
+						
+						// #ifdef H5
+						this.initConfig(this.payResult)
+						// #endif 
+						// #ifdef MP
+						this.wxPay()
+						// #endif 
+					}
+					
+					// if(this.params.paymentMode==1||this.params.paymentMode==4){
+					// 	this.wxPay()
+					// }else{
+					// 	uni.$u.route('/shopping/paysuccess');
+					// }
+					// console.log('gotoPayres', res.data);
+				}).catch(err => {
+					this.cansubmit = true;
+					// this.paypass = '';
+					// this.checkPassShow = false;
+					console.log('gotoPay', err);
+				})
+			},
+			gotoBalancePay(){
+				let that = this;
+				this.$u.api.balancePay({orderId:this.params.orderId}).then(res=>{
+					// console.log('res',res);
+					uni.showToast({
+						title:res.msg,
+						icon:'none'
+					})
+					setTimeout(()=>{
+						uni.reLaunch({
+							url: `/center/orderdetails?type=redirectTo&id=${that.params.orderId}`
+						});
+					},1500)
+				}).catch(err=>{
+					console.log('balancePay',err.data);
+				})
+			},
+			gotoQuotaPay(){
+				let that = this;
+				this.$u.api.quotaPay({orderId:this.params.orderId}).then(res=>{
+					// console.log('res',res);
+					uni.showToast({
+						title:res.msg,
+						icon:'none'
+					})
+					setTimeout(()=>{
+						uni.reLaunch({
+							url: `/center/orderdetails?type=redirectTo&id=${that.params.orderId}`
+						});
+					},1500)
+				}).catch(err=>{
+					console.log('quotaPay',err.data);
+				})
+			},
+			wxPay(){
+				uni.requestPayment({
+					... this.payResult,
+				    "provider": "wxpay", 
+				    "orderInfo": {
+				        // "appid": "wx499********7c70e",  // 微信开放平台 - 应用 - AppId,注意和微信小程序、公众号 AppId 可能不一致
+				        // "noncestr": "c5sEwbaNPiXAF3iv", // 随机字符串
+				        // "package": "Sign=WXPay",        // 固定值
+				        // "partnerid": "148*****52",      // 微信支付商户号
+				        // "prepayid": "wx202254********************fbe90000", // 统一下单订单号 
+				        // "timestamp": 1597935292,        // 时间戳(单位:秒)
+				        // "sign": "A842B45937F6EFF60DEC7A2EAA52D5A0" // 签名,这里用的 MD5/RSA 签名
+				    },
+				    success(res) {
+						uni.$u.route('/shopping/paysuccess');
+					},
+				    fail(e) {
+						console.log('wxPayfail',e);
+					}
+				})				
+			},
+			/**
+			 * 公众号微信支付
+			 */
+			initConfig() {
+				// #ifdef H5
+				let that = this
+				wxH5.config({
+					debug: false, // 这里一般在测试阶段先用ture,等打包给后台的时候就改回false, 
+					appId: that.payResult.appId, // 必填,公众号的唯一标识 
+					timestamp: that.payResult.timeStamp, // 必填,生成签名的时间戳     
+					nonceStr: that.payResult.nonceStr, // 必填,生成签名的随机串 
+					signature: that.payResult.paySign, // 必填,签名 
+					jsApiList: ['chooseWXPay', 'checkJsApi'] // 必填,需要使用的JS接口列表 
+				})
+				wxH5.ready(() => {
+					wxH5.chooseWXPay({
+						timestamp: that.payResult.timeStamp, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符     
+						nonceStr: that.payResult.nonceStr, // 支付签名随机串,不长于 32 位         
+						package: that.payResult.packageValue, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=\*\*\*)     
+						signType: 'SHA1', // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'     
+						paySign: that.payResult.paySign, // 支付签名     
+						success: () => {
+							// setTimeout(()=>{
+							// 	uni.$u.route('/center/orderdetails', {
+							// 		type:'redirectTo',
+							// 		id: that.params.orderId
+							// 	});
+							// },1500)
+							that.payQuery();
+						},
+						fail: (e) => {
+							uni.$u.route('/center/order', {
+								status: 0
+							});
+							console.log('wxPayfail', e);
+						},
+						cancel: () => {
+							uni.$u.route('/center/order', {
+								status: 0
+							});
+							that.cansubmit = true;
+						}
+					})
+				})
+				// #endif
+			},
+			payQuery(){
+				let that = this;
+				let retryCount = 0;
+				let maxRetryCount = 5; // 设置最大重试次数
+				let interval = 2000; // 设置间隔时间为2秒
+				let timeout = 10000; // 设置超时时间为10秒
+				let timer;
+				uni.showLoading({
+					title:'支付结果查询中'
+				})
+				timer = setInterval(() => {
+					retryCount++;
+					if (retryCount > maxRetryCount || retryCount * interval > timeout) {
+						clearInterval(timer);
+						  uni.hideLoading();
+						console.log("支付查询超时或达到最大重试次数");
+						// 在这里添加超时或达到最大重试次数的处理逻辑
+						this.reloadList()
+					} else {
+						console.log("第" + retryCount + "次查询");
+						// 调用查询支付状态的方法
+						// 如果支付状态为成功,则清除定时器并处理成功的逻辑
+						// 如果支付状态为失败,则清除定时器并处理失败的逻辑
+						this.$u.api.payQuery({orderId:this.params.orderId}).then(res=>{
+							// 0-未支付 1-已支付 2-支付中 3-支付失败 4-支付退款
+							let payStatus = res.data.payStatus;
+							if(payStatus===1){
+								uni.reLaunch({
+									url: `/center/orderdetails?type=redirectTo&id=${that.params.orderId}`
+								});
+							}else if(payStatus===0||payStatus===2){
+								this.payQuery()
+							}else if(payStatus===3){
+								uni.toast('支付失败')
+							}
+							clearInterval(timer);
+						}).catch(err=>{
+							console.log('payQuery',err);
+						}).finally(()=>{
+							uni.hideLoading()
+						})
+					}
+				}, interval);
+			},
+			groupChange(e){
+				console.log('groupChange',e);
+			}
+			
+		}
+	}
+</script>
+<style>
+	page{
+		background-color: #F5F5F5;
+	}
+</style>
+<style lang="scss" scoped>
+.pay-way{
+	background-color: #fff;
+	border-radius: 8rpx;
+	.pay-way-item {
+		padding: 30rpx 10rpx;
+		.left{
+			.icon{
+				width: 40rpx;
+				height: 40rpx;
+				margin-right: 16rpx;
+			}
+			.name{
+				font-weight: bold;
+				margin-right: 40rpx;
+			}
+		}
+		&:not(:last-child){
+			border-bottom: 0.5px solid #eee;
+		}
+		&.disabled{
+			.left{
+				color: #D8D8D8;
+			}
+		}
+	}
+	.left{
+		font-size: 30rpx;
+		font-weight: 500;
+		color: #333333;
+		line-height: 42rpx;
+	}
+}
+.full-btn{
+	margin-top: 100rpx;
+}
+/deep/ .u-popup__content{
+	overflow: hidden;
+	border-radius: 8rpx;
+}
+.check-pass{
+	padding: 24rpx 40rpx 40rpx;
+ 	.title{
+		margin-bottom: 30rpx;
+		font-size: 36rpx;
+		font-weight: 600;
+		color: #333333;
+		line-height: 50rpx;
+		text-align: center;
+	}
+	.name{
+		text-align: center;
+		font-size: 30rpx;
+		font-weight: 400;
+		color: #666666;
+		line-height: 42rpx;
+		margin-bottom: 10rpx;
+	}
+	.number{
+		text-align: center;
+		font-size: 58rpx;
+		font-weight: 600;
+		color: #FF3538;
+		line-height: 81rpx;
+		margin-bottom: 30rpx;
+	}
+	.the-way{
+		font-size: 30rpx;
+		font-weight: 400;
+		color: #333333;
+		line-height: 42rpx;
+		margin-bottom: 25rpx;
+	}
+	.btn-wrap{
+		
+	}
+}
+</style>

+ 238 - 0
center/recharge.vue

@@ -0,0 +1,238 @@
+<template>
+	<view class="">
+		<u-navbar
+			title="充值中心"
+			:placeholder="true"
+			:autoBack="true"
+			@leftClick="leftClick"
+			:safeAreaInsetTop="true"
+		>
+		</u-navbar>
+		<view class="balance u-flex u-row-between">
+			<view class="left">个人余额</view>
+			<view class="right number">¥ {{memberInfo.balance||"0"}}</view>
+		</view>
+		<view class="">
+			<view class="num-wrap">
+				<view class="title">充值金额</view>
+				<view class="customize" :class="{active:usecustomize}" >
+					<u--input
+						prefixIcon="rmb"
+						type="number"
+					    placeholder="请输入"
+					    border="bottom"
+					    v-model="customizeVal"
+						clearable
+						fontSize="36rpx"
+						:customStyle="{height:'50rpx'}"
+					></u--input>
+				</view>
+				<view class="title">其他充值金额</view>
+				<view class="inner u-flex u-row-around u-flex-wrap">
+					<view class="num-item" 
+						:class="{active:activeIndex == index&&!usecustomize}" 
+						@click="numClick(index)"
+						v-for="(item,index) in numItem" :key="item">
+						{{item}} 元
+					</view>
+				</view>
+				
+				<view class="rule-wrap u-flex u-flex-wrap">
+					<u-checkbox-group v-model="checked" @change="checkboxChange" placement="row">
+						<u-checkbox activeColor="#3B49BF" name="同意" labelSize="26rpx" label="点击确认充值,即表示您已经同意"></u-checkbox>
+					</u-checkbox-group>
+					<text class="link" @click="$u.route('/credits/regulation',{regulationName:'充值协议'})">《充值协议》</text>
+				</view>
+				<view class="full-btn" @click="submit">立即充值</view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				checked:false,
+				checkboxVal:null,
+				customizeVal:null,
+				activeIndex:0,
+				numItem:[10,30,50,100,200,300],
+				payResult:{},
+				memberInfo:{},
+			}
+		},
+		onShow() {
+			this.getMemberInfo();
+		},
+		onLoad() {
+
+		},
+		computed:{
+			usecustomize:function(){
+				if(this.customizeVal){
+					return true
+				}else{
+					return false
+				}
+			}
+		},
+		methods: {
+			leftClick(e){
+				let pages = getCurrentPages();
+				if(pages.length==1){
+					uni.$u.route('/pages/index/index')
+				}else{
+					uni.navigateBack()
+				};
+			},
+			getMemberInfo(){
+				this.$u.api.memberInfo({id:this.vuex_member_info.id}).then(res=>{
+					this.memberInfo = res.data;
+					this.avatar =  res.data.avatar;
+					this.$u.vuex('vuex_member_info', res.data);
+					// console.log('memberInfo',this.memberInfo);
+					}).catch(err=>{
+					console.log('memberInfo',err.data);
+				})
+			},
+			numClick(index){
+				this.customizeVal = '';
+				this.activeIndex = index
+			},
+			submit(){
+				// uni.reLaunch({url: '/center/rechargesuccess'})
+				// console.log('usecustomize',this.usecustomize);
+				if(!this.checkboxVal){
+					uni.showToast({
+						title:'请先同意充值协议',
+						icon:'none'
+					})
+					return
+				}
+				let num = Number(this.usecustomize?this.customizeVal:this.numItem[this.activeIndex]);
+				console.log('num',num);
+				// const env = uni.getAccountInfoSync().miniProgram.envVersion;
+				// if((!num||num<100||num>10000)&&env!='develop'){
+				// 	this.customizeVal = null;
+				// 	uni.showToast({
+				// 		title:'请正确输入金额',
+				// 		icon:'error'
+				// 	})
+				// 	return
+				// }
+				let payParams={
+					orderPrice:num,
+					isCreditDesc:this.checkboxVal?1:0,
+				};
+				this.$u.api.addRechargeOrder(payParams).then(res=>{//提交充值订单
+					console.log('res',res.data);
+					if(res.code!=200&&res.msg){
+						uni.$u.toast(res.msg)
+					}
+					this.gotoPay({orderId:res.data.orderId,openid:this.vuex_wechatOpenid,paymentMode:4});
+				}).catch(err=>{
+					console.log('charge',err);
+				})
+			},
+			gotoPay(params){//获取支付参数
+				console.log('gotoPay',this.params);
+				this.$u.api.rechargePay(params).then(res=>{
+					this.payResult = res.data.payResult;
+					this.wxPay()
+				}).catch(err=>{
+					console.log('gotoPay',err);
+				})				
+			},
+			wxPay(){
+				uni.requestPayment({
+					... this.payResult,
+				    "provider": "wxpay",
+				    success(res) {
+						uni.reLaunch({url: '/center/rechargesuccess'})
+					},
+				    fail(e) {
+						console.log('充值失败',e);
+					}
+				})				
+			},
+			checkboxChange(e){
+				this.checkboxVal = e[0];
+			}
+		}
+	}
+</script>
+<style>
+page{
+	background-color: #F5F5F5;
+}
+</style>
+<style lang="scss" scoped>
+.balance{
+	height: 180rpx;
+	background: #3B49BF;
+	border-radius: 8rpx;
+	margin-bottom: 20rpx;
+	padding: 0 30rpx;
+	font-size: 30rpx;
+	font-weight: 400;
+	color: #FFFFFF;
+	.number{
+		font-size: 54rpx;
+		font-weight: 600;
+		font-family: PingFangSC-Semibold, PingFang SC;
+	}
+}
+.num-wrap{
+	padding: 30rpx;
+	background-color: #fff;
+	border-radius: 8rpx;
+	.title{
+		font-size: 32rpx;
+		font-weight: 400;
+		color: #333333;
+		line-height: 45rpx;
+		margin-bottom: 20rpx;
+	}
+	.inner{
+		margin-bottom: 40rpx;
+		.num-item{
+			width: 30%;
+			height: 88rpx;
+			line-height: 88rpx;
+			background-color: #F5F5F5;
+			border: 4rpx solid #F5F5F5;
+			text-align: center;
+			font-size: 30rpx;
+			font-weight: 600;
+			color: #3B49BF;
+			margin-bottom: 20rpx;
+			font-family: PingFangSC-Semibold, PingFang SC;
+			&.active{
+				border-color: #3B49BF;
+			}
+		}
+	}
+	.full-btn{
+		background-color: #3B49BF;;
+	}
+}
+.customize{
+	margin-bottom: 50rpx;
+	&.active{
+		/deep/ .u-input{
+			border-color: #3B49BF!important;
+		}
+	}
+}
+
+.rule-wrap{
+	margin: 40rpx auto;
+	font-size: 26rpx;
+	line-height: 1.5;
+	.link{
+		white-space: nowrap;
+		color: #3B49BF;
+	}
+}
+</style>

+ 80 - 0
center/rechargesuccess.vue

@@ -0,0 +1,80 @@
+<template>
+	<view class="pages">
+		<view class="icon-wrap u-flex u-row-center">
+			<u-icon name="checkmark" color="#fff" size="80"></u-icon>
+		</view>
+		<view class="title">{{title}}</view>
+		<view class="" v-if="noPaypass==true">
+			<view class="tip">为了您的支付安全,请务必设置支付密码</view>
+			<view class="full-btn" @click="goSetPaypass">设置支付密码</view>
+		</view>
+		<view v-else class="full-btn" @click="btnClick">完成</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				noPaypass:true,
+				title:'恭喜你您,充值成功'
+			}
+		},
+		onShow() {		
+			this.checkPaypass();
+		},
+		onLoad() {
+
+		},
+		methods: {
+			btnClick(){
+				uni.reLaunch({url: '/center/center'});
+			},
+			goSetPaypass(){
+				uni.reLaunch({url: '/center/setPaypass'});
+			},
+			checkPaypass(){
+				this.$u.api.getExistPayPassword().then(res=>{
+					// console.log('res',res.data);
+					if(res.data==0){
+						this.noPaypass = true
+					}else{
+						this.noPaypass = false
+					}
+					console.log('this.noPaypass',this.noPaypass);
+				}).catch(err=>{
+					console.log('checkPaypass',err);
+				})
+			}
+		}
+	}
+</script>
+<style>
+	page{
+		background-color: #F5F5F5;
+	}
+</style>
+<style lang="scss" scoped>
+.pages{
+	text-align: center;
+}
+
+.icon-wrap{
+	width: 180rpx;
+	height: 180rpx;
+	margin: 120rpx auto 20rpx;
+	padding: 20rpx;
+	background-color: #00A447;
+	border-radius: 50%;
+}
+.title{
+	font-size: 32rpx;
+	font-weight: 600;
+	color: #333333;
+	line-height: 40rpx;
+	margin-bottom: 120rpx;
+}
+.full-btn{
+	margin: 20rpx 10%;
+}
+</style>

+ 225 - 0
center/setPaypass.vue

@@ -0,0 +1,225 @@
+<template>
+	<view class="page-wrap">
+		<u-navbar
+			v-if="fromPage=='reset'"
+			:placeholder="true"
+			title="密码设置"
+			:autoBack="true"
+			 :safeAreaInsetTop="true"
+		>
+		</u-navbar>
+		<view class="step-reset" v-show="step=='reset'&&noPaypass==false">
+			<view class="title">请输入当前密码,以身份认证</view>
+			<u-code-input v-model="paypass0" 
+				ref="paypass0"
+				:space="codeInput.space" 
+				:size="codeInput.size" 
+				@finish="finish0" 
+				:maxlength="codeInput.maxlength" 
+				:adjustPosition="codeInput.adjustPosition"
+				:dot="codeInput.dot"
+				:focus="true"
+				:disabled-keyboard="codeInput.disabledKeyboard" >
+			</u-code-input>
+			<view class="findpaypass" @click="$u.route('/center/findpaypass')">忘记密码?</view>
+		</view>
+		<view class="step-1" v-show="step==1">
+			<view class="title">设置6位数数字支付密码</view>
+			<u-code-input v-model="paypass1" 
+				ref="paypass1"
+				:space="codeInput.space" 
+				:size="codeInput.size" 
+				@finish="finish1" 
+				:maxlength="codeInput.maxlength" 
+				:adjustPosition="codeInput.adjustPosition"
+				:dot="codeInput.dot"
+				:focus="true"
+				:disabled-keyboard="codeInput.disabledKeyboard" >
+			</u-code-input>
+			<view class="tip">建议密码不重复,不连续,不同于登录密码</view>
+		</view>
+		<view class="step-2" v-show="step==2">
+			<view class="title">请在再次输入</view>
+			<u-code-input v-model="paypass2" 
+				ref="paypass2"
+				:space="codeInput.space"
+				:size="codeInput.size" 
+				@finish="finish2" 
+				:maxlength="codeInput.maxlength" 
+				:adjustPosition="codeInput.adjustPosition"
+				:dot="codeInput.dot"
+				:focus="true"
+				:disabled-keyboard="codeInput.disabledKeyboard" >
+			</u-code-input>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				noPaypass:true,
+				fromPage:'',
+				step:1,
+				paypass0:'',
+				paypass1:'',
+				paypass2:'',
+				codeInput:{
+					space:10,
+					size:45,
+					maxlength:6,
+					adjustPosition:false,
+					dot:true,
+					disabledKeyboard:false
+				},
+				code:'',
+			}
+		},
+		onShow() {	
+			this.checkPaypass()
+		},
+		onLoad(page) {
+			this.fromPage = page.fromPage;
+			this.code = page.code;
+			
+		},
+		methods: {
+			checkPaypass(){
+				this.$u.api.balanceInfo().then(res=>{
+					// console.log('res',res.data);
+					if(res.data.isSetPayPassword==0){
+						this.noPaypass = true
+					}else{
+						this.noPaypass = false;
+						this.step = 1;
+						if(this.fromPage=='reset'){
+							this.step = 'reset'
+						}
+					}
+					console.log('this.noPaypass',this.noPaypass);
+				}).catch(err=>{
+					console.log('checkPaypass',err);
+				})
+			},
+			finish0(){
+				this.$u.api.checkPayPassword({payPassword:this.paypass0}).then(res=>{
+					console.log('res',res.data);
+					if(res.msg=='操作成功'){//密码正确
+						this.step = 1
+					}else{
+						this.paypass0 = ''
+					}
+					
+				}).catch(err=>{
+					if(err.msg=='密码错误!'){
+						this.paypass0 = '';
+					}
+					console.log('checkPayPassword',err);
+				})
+			},
+			finish1(){
+				this.step = 2;
+				console.log('paypass',this.paypass1);
+				console.log('paypass2',this.paypass2);
+			},
+			finish2(){
+				console.log('paypass1',this.paypass1);
+				console.log('paypass2',this.paypass2);
+				let that = this;
+				if(this.paypass1==this.paypass2){
+					console.log('两次密码一样');
+					if(this.fromPage == 'forget'){
+						this.resetPayPassword();
+					}else{
+						this.updatePayPassword();
+					}
+				}else{
+					uni.showModal({
+						showCancel:false,
+					    title: '提示',
+					    content: '两次密码不一样!',
+					    success: res => {
+							if (res.confirm) {
+								that.paypass1 = '';
+								that.paypass2 = '';
+								that.step = 1;
+							} else if (res.cancel) {
+								console.log('用户点击取消');
+							}
+					    }
+					});
+				}
+			},
+			updatePayPassword(){
+				this.$u.api.updatePayPassword({payPassword:this.paypass2}).then(res=>{
+					uni.showToast({
+						title:res.msg,
+						icon:'success',
+						complete() {
+							setTimeout(()=>{
+								uni.reLaunch({url: '/center/center'});
+							},2000)
+						}
+					})
+					console.log('res',res.data);
+				}).catch(err=>{
+					console.log('setPaypass',err);
+				})
+			},
+			resetPayPassword(){
+				let params = {
+					payPassword:this.paypass2,
+					code:this.code,
+					mobile:this.vuex_member_info.mobile
+				}
+				this.$u.api.resetPayPassword(params).then(res=>{
+					uni.showToast({
+						title:res.msg,
+						icon:'success',
+						complete() {
+							setTimeout(()=>{
+								uni.reLaunch({url: '/center/center'});
+							},2000)
+						}
+					})
+					console.log('res',res.data);
+				}).catch(err=>{
+					setTimeout(()=>{
+						uni.reLaunch({url: '/center/findpaypass'});
+					},2000)
+					console.log('setPaypass',err);
+				})
+			}
+		}
+	}
+</script>
+<style>
+page{
+	padding-top: 100rpx;
+}
+</style>
+<style lang="scss" scoped>
+.page-wrap{
+	text-align: center;
+	/deep/ .u-code-input__item{
+		flex-grow: 1!important;
+	}
+}
+.title{
+	font-size: 40rpx;
+	font-weight: 600;
+	margin-bottom: 40rpx;
+}
+
+.tip{
+	margin: 24rpx auto 40rpx;
+	color: #999;
+}
+.findpaypass{
+	text-align: right;
+	margin-top: 40rpx;
+	color: #999;
+	font-size: 24rpx;
+}
+</style>

+ 46 - 0
common/apiurl.js

@@ -239,6 +239,52 @@ const apiurl = {
 		type: 'get'
 	},
 	
+	// 获取余额信息
+	balanceInfo: {
+		url: '/member/marketTeam/getBalanceInfo',
+		type: 'get'
+	},
+	// 校验支付密码
+	checkPayPassword: {
+		url: '/member/marketTeam/checkPayPassword',
+		type: 'post'
+	},
+	// 设置支付密码
+	updatePayPassword: {
+		url: '/member/marketTeam/updatePayPassword',
+		type: 'post'
+	},
+	// 找回密码-重置
+	updatePassword: {
+		url: '/member/marketTeam/resetPayPassword',
+		type: 'post'
+	},
+	// 交易明细-分页
+	selectBalanceLogList : {
+		url: '/member/marketTeam/balancePageList',
+		type: 'get'
+	},
+	// 余额支付
+	balancePay: {
+		url: '/order/orderInfo/gotoBalancePay',
+		type: 'post'
+	},
+	// 授信额度支付
+	quotaPay: {
+		url: '/order/orderInfo/gotoQuotaPay',
+		type: 'post'
+	},
+	// 发送短信
+	getCode : {
+		url: '/system/common/getVerifyCode',
+		type: 'post'
+	},
+	// 验证短信
+	verifyCode : {
+		url: '/system/common/verifyCode',
+		type: 'post'
+	},
+	
 	
 	/**
 	 * @author ygh

+ 56 - 0
pages.json

@@ -193,6 +193,62 @@
 						"navigationBarTitleText": "查看退款",
 						"navigationStyle": "custom"
 					}
+				},
+				{
+					"path": "mybalance",
+					"style": {
+						"navigationBarTitleText": "余额中心",
+						"navigationStyle": "custom"
+					}
+				},
+				{
+					"path": "setPaypass",
+					"style": {
+						"navigationBarTitleText": "设置支付密码",
+						"navigationStyle": "custom"
+					}
+				},
+				{
+					"path": "findpaypass",
+					"style": {
+						"navigationBarTitleText": "找回支付密码",
+						"navigationStyle": "custom"
+					}
+				},
+				{
+					"path": "choosePayment",
+					"style": {
+						"navigationBarTitleText": "选择支付方式",
+						"navigationStyle": "custom"
+					}
+				},
+				{
+					"path": "recharge",
+					"style": {
+						"navigationBarTitleText": "充值",
+						"navigationStyle": "custom"
+					}
+				},
+				{
+					"path": "rechargesuccess",
+					"style": {
+						"navigationBarTitleText": "充值",
+						"navigationStyle": "custom"
+					}
+				},
+				{
+					"path": "pay",
+					"style": {
+						"navigationBarTitleText": "收银台",
+						"navigationStyle": "custom"
+					}
+				},
+				{
+					"path": "dealList",
+					"style": {
+						"navigationBarTitleText": "交易明细",
+						"navigationStyle": "custom"
+					}
 				}
 			]
 		}