hejie 3 лет назад
Родитель
Сommit
69ad6397f8

+ 5 - 2
src/manifest.json

@@ -62,13 +62,16 @@
             "urlCheck" : false,
             "es6" : true,
             "postcss" : true,
-            "minified" : false
+            "minified" : true
         },
         "usingComponents" : true,
         "permission" : {}
     },
     "mp-alipay" : {
-        "usingComponents" : true
+        "usingComponents" : true,
+        "uniStatistics" : {
+            "enable" : false
+        }
     },
     "mp-baidu" : {
         "usingComponents" : true

+ 18 - 3
src/pages.json

@@ -155,14 +155,29 @@
 			"style": {
 				"navigationBarTitleText": "充值"
 			}
+		},
+				{
+		    "path" : "pages/aytonym-status/index",
+		    "style" : {
+				"navigationBarTitleText": "实名认证"
+			}
 		},
 		{
-			"path": "pages/autoym-submit/index",
-			"style": {
+		    "path" : "pages/autonym-submit/index",
+		    "style" : {
 				"navigationBarTitleText": "实名认证"
 			}
 		}
-	],
+	    ,{
+            "path" : "pages/autonym-pay/index",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "",
+                "enablePullDownRefresh": false
+            }
+            
+        }
+    ],
 	"tabBar": {
 		"color": "#505050",
 		"selectedColor": "#12B280",

+ 231 - 0
src/pages/autonym-pay/index.vue

@@ -0,0 +1,231 @@
+<template>
+	<view class="container">
+		<!-- 实名费用 -->
+		<view class="auto_cost flex_r flex_ac flex_jb mar_t20">
+			<view class="auto_name">实名费用</view>
+			<view class="price"><text>¥</text>4</view>
+		</view>
+		<!-- 实名费用-end -->
+
+		<!-- 微信支付 -->
+		<view class="option flex_c mar_t20">
+			<view class="list_name">充值方式</view>
+			<view class="option_con flex_r flex_ac flex_jb mar_t16" @tap="setPayWay">
+				<view class="way_con flex_r flex_ac">
+					<image class="way_img" src="/static/weixin_icon.png" mode=""></image>
+					<view class="way_text">微信支付</view>
+				</view>
+				<view class="way_radio" :class="isSelect ? 'select' : ''"></view>
+			</view>
+		</view>
+		<!-- 微信支付-end -->
+
+		<!-- 按钮 -->
+		<view class="btn flex_r flex_ac flex_jc" @tap="autoOrderPay">下一步</view>
+		<!-- 按钮-end -->
+	</view>
+</template>
+
+<script>
+	let page = 1;
+	let app = getApp();
+	var appEv = app.$vm.$options;
+	import {
+		ToPayOpre
+	} from "@/utils/reqTools.js";
+	let toPayOpre = new ToPayOpre();
+	import {
+		post
+	} from "@/request/api.js";
+	export default {
+		data() {
+			return {
+				price: '',
+				isSelect: false
+			};
+		},
+		onLoad: function() {
+			// this.loadData()
+		},
+		methods: {
+			loadData: function() {
+				let that = this;
+				const info = reqApi.identifyPrice()
+				if (info) {
+					info.then(res => {
+						if (res.data.status == 200) {
+							that.price = res.data.price
+						}
+					})
+				}
+			},
+			autoOrderPay: function() {
+				if (!this.isSelect) {
+					appEv.errTips('请选择支付方式')
+					return false
+				}
+				// #ifdef  H5
+				let type = "H5";
+				// #endif
+				// #ifdef  APP
+				let type = "app";
+				// #endif
+				// #ifdef  MP-WEIXIN
+				let type = "jsapi";
+				// #endif
+				let data = {
+					trade_type: type
+				};
+				post("/user/authPay", data).then(res => {
+					if (res.code === 0) {
+						console.log("走了这里", res.data.data);
+						let data = res.data.data
+						// #ifdef  MP-WEIXIN
+						// #endif
+						toPayOpre.toPay(data, (rea) => {
+							if (!rea) {
+								// 支付成功
+								uni.redirectTo({
+									url: '/pages/autonym-submit/index'
+								})
+							} else {
+								// 支付失败
+								appEv.errTips('支付已取消')
+							}
+						});
+					}
+				})
+				return
+				// let that = this;
+				// let data = {
+				// 	price:this.price * 100
+				// }
+				// return
+				// const info = reqApi.identifyPayment(data)
+				// if(info){
+				// 	info.then(res => {
+				// 		if(res.data.status == 200){
+				// 			toPayOpre.toPay(res.data.payParam, (rea) => {
+				// 				if (!rea) {
+				// 					// 支付成功
+				// 					uni.redirectTo({
+				// 						url: '/pages/autonym-submit/index'
+				// 					})
+				// 				} else {
+				// 					// 支付失败
+				// 					appEv.errTips('支付已取消')
+				// 				}
+				// 			});
+				// 		}
+				// 	})
+				// }
+			},
+			setPayWay: function() {
+				this.isSelect = !this.isSelect
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	// 页面配置
+	page {
+		background: #F4F4F4;
+	}
+
+	// 页面配置-end
+
+	// 实名费用
+	.price {
+		font-size: 36rpx;
+		color: #E75B25;
+		font-family: "SourceHanSansCN-Medium";
+	}
+
+	.auto_name {
+		font-size: 28rpx;
+		color: #121212;
+		font-family: "SourceHanSansCN-Medium";
+	}
+
+	.price text {
+		font-size: 24rpx;
+		color: #E75B25;
+		font-family: "SourceHanSansCN-Medium";
+	}
+
+	.auto_cost {
+		width: 100%;
+		height: 104rpx;
+		background: #fff;
+		padding: 0 30rpx;
+		box-sizing: border-box;
+	}
+
+	// 实名费用-end
+
+	// 微信支付
+	.option_con {
+		width: 100%;
+		overflow: hidden;
+	}
+
+	.way_img {
+		width: 52rpx;
+		height: 52rpx;
+		margin-right: 8rpx;
+	}
+
+	.way_text {
+		font-size: 22rpx;
+		color: #333333;
+		font-family: "SourceHanSansCN-Medium";
+	}
+
+	.list_name {
+		color: #333333;
+		font-size: 28rpx;
+		font-family: "SourceHanSansCN-Medium";
+		font-weight: 500;
+	}
+
+	.option {
+		width: 100%;
+		overflow: hidden;
+		padding: 20rpx 30rpx 60rpx;
+		box-sizing: border-box;
+		background: #fff;
+	}
+
+	.way_radio {
+		width: 39rpx;
+		height: 35rpx;
+		background: url("~@/static/weixuanzhong.png");
+		background-repeat: no-repeat;
+		background-size: 35rpx 35rpx;
+		background-position: center center;
+	}
+
+	.select {
+		background: url("~@/static/consent.png");
+		background-repeat: no-repeat;
+		background-size: 39rpx 35rpx;
+		background-position: center center;
+	}
+
+	// 微信支付-end
+
+	// 按钮
+	.btn {
+		width: 689rpx;
+		height: 92rpx;
+		background: #17BB87;
+		border-radius: 10rpx;
+		font-family: "SourceHanSansCN-Medium";
+		font-size: 42rpx;
+		color: #fff;
+		margin: 167rpx auto;
+	}
+
+	// 按钮-end
+</style>

+ 15 - 2
src/pages/autoym-submit/index.vue → src/pages/autonym-submit/index.vue

@@ -27,6 +27,8 @@ let app = getApp();
 var appEv = app.$vm.$options;
 // import { ReqApi } from "@/utils/reqTools.js";
 import { post } from "@/request/api.js";
+import { ToPayOpre } from "@/utils/reqTools.js";
+let toPayOpre = new ToPayOpre();
 export default {
   data() {
     return {
@@ -49,9 +51,20 @@ export default {
       let data = {
         name: this.name,
         card: this.code,
-        trade_type:type
+        trade_type: type
       };
-      post("/user/authentication", data).then(res => {});
+      post("/user/authentication", data).then(res => {
+        if (res.code === 0) {
+          let data = res.data;
+		  toPayOpre.topay(data).then(res => {
+			  if(!res){
+				  console.log("实名认证成功")
+			  }else{
+				  appEv.errTips('支付已取消')
+			  }
+		  })
+        }
+      });
       //   let that = this;
       //   let data = {
       //     name: this.name,

+ 61 - 0
src/pages/aytonym-status/index.vue

@@ -0,0 +1,61 @@
+<template>
+	<view class="container">
+		<image class="status_img" :src="isPass == 1 ? 'https://tea.soowin.com/mnt/image/success.png' : '/static/error.png'" mode=""></image>
+		<view class="hint flex_r flex_jc" v-if="isPass == 0">失败原因:{{msg}}</view>
+		<view class="status_con flex_r flex_ac flex_jc">
+			<block v-if="isPass == 1">
+				<view class="confim_btn flex_r flex_ac flex_jc" @tap="returnPage">认证通过</view>
+			</block>
+			<block v-else>
+				<view class="return flex_r flex_ac flex_jc" @tap="returnPage">返回</view>
+				<view class="err_btn flex_r flex_ac flex_jc" @tap="reapply">重新申请</view>
+			</block>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				isPass:0 ,// 0:失败;1:成功
+				msg:'' // 失败原因
+			};
+		},
+		onLoad:function(e){
+			this.isPass = e.status
+			if(e.msg){
+				this.msg = e.msg
+			}
+		},
+		methods:{
+			reapply(){
+				uni.redirectTo({
+					url:'/pages/autonym-submit/index'
+				})
+			},
+			returnPage:function(){
+				uni.navigateBack({
+					delta:1
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+// 页面配置
+.container{border-top: 16rpx solid #f4f4f4;}
+// 页面配置-end
+
+.status_con{width: 100%;overflow: hidden;margin-top:61rpx;}
+.hint{width: 100%;overflow: hidden;font-size: 30rpx;color:#5A5A5A}
+.status_img{width: 366rpx;height: 249rpx;margin: 127rpx auto 0;display: block;}
+.confim_btn{width: 317rpx;height: 74rpx;background: #17BB87;color:#fff;font-size: 36rpx;border-radius: 37rpx;margin:0 auto;}
+
+// 审核失败按钮
+.return,.err_btn{width: 241rpx;height: 74rpx;border-radius: 37rpx;font-size: 36rpx;color:#fff;margin-right: 133rpx;}
+.err_btn{margin-right: 0;background: #1FBF8D;}
+.return{background: #E75B25;}
+// 审核失败按钮-end
+</style>

+ 2 - 3
src/pages/my/index.vue

@@ -479,6 +479,7 @@ export default {
         post("/user/userinfo").then((res) => {
             if (res.code === 0) {
                 uni.setStorageSync('userinfo', res.data.data);
+                this.userinfo = res.data.data
             }
         });
     },
@@ -502,16 +503,14 @@ export default {
       var that = this;
       uni.showLoading({ mask: true });
       appEv.setData((res) => {
-        that.loadData();
         uni.hideLoading();
         that.showAuth = false;
       });
     },
     // 跳转到实名页面
     goToAutonym() {
-      console.log("qqqqqqqqq");
       uni.navigateTo({
-        url: "/pages/autoym-submit/index",
+        url: "/pages/autonym-pay/index",
       });
     },
     // 关闭实名信息

BIN
src/static/consent.png


+ 50 - 0
src/utils/reqTools.js

@@ -0,0 +1,50 @@
+var app = getApp();
+var appEv = app.$vm.$options;
+
+class ToPayOpre {
+    // 支付
+    toPay(info = appEv.parameter("info"), callback) {
+        var that = this;
+		console.log('info',info)
+        uni.requestPayment({
+            ...info,
+            success: function (res) {
+                that.payReturn(false, callback);
+            },
+            fail: function (res) {
+				console.log(res,"报错信息")
+                that.payReturn(true, callback);
+            }
+        })
+    }
+    payReturn(isFail, callback) {
+        uni.hideLoading();
+        // 支付失败
+        if (isFail) {
+            appEv.errTips('支付失败', 3000);
+        } else {
+            // 支付成功
+            uni.showToast({
+                title: '支付成功',
+                icon: 'success',
+                duration: 1200,
+                mask: true
+            })
+        }
+        
+        // 跳转订单列表
+        setTimeout(function () {
+            if (callback) {
+                callback(isFail);
+            } else {
+                uni.redirectTo({
+                    url: '/pages/chengbei-order-list/index'
+                })
+            }
+        }, 1200);
+    }
+}
+
+export {
+    ToPayOpre
+}

+ 45 - 1
src/utils/utils.js

@@ -542,6 +542,49 @@ function checkPhoneNum(str){
     return phoneTest.test(str);
 }
 
+class ToPayOpre {
+    // 支付
+    toPay(info = appEv.parameter("info"), callback) {
+        var that = this;
+        uni.requestPayment({
+            ...info,
+            success: function (res) {
+                that.payReturn(false, callback);
+            },
+            fail: function (res) {
+                that.payReturn(true, callback);
+            }
+        })
+    }
+    payReturn(isFail, callback) {
+        uni.hideLoading();
+        // 支付失败
+        if (isFail) {
+            appEv.errTips('支付失败', 3000);
+        } else {
+            // 支付成功
+            uni.showToast({
+                title: '支付成功',
+                icon: 'success',
+                duration: 1200,
+                mask: true
+            })
+        }
+        
+        // 跳转订单列表
+        setTimeout(function () {
+            if (callback) {
+                callback(isFail);
+            } else {
+                uni.redirectTo({
+                    url: '/pages/chengbei-order-list/index'
+                })
+            }
+        }, 1200);
+    }
+}
+
+
 module.exports = {
     compareVersion: compareVersion,
     formatTime: formatTime,
@@ -557,5 +600,6 @@ module.exports = {
     emoji_uncodeUtf16,
     formatDateTime,
     transformContentToMultiLineText,
-    getTwoFloat
+    getTwoFloat,
+	ToPayOpre
 }