android添加银行插件
diff --git a/pages/sub_medical/pay.vue b/pages/sub_medical/pay.vue
index 5c9ebe5..52266e6 100644
--- a/pages/sub_medical/pay.vue
+++ b/pages/sub_medical/pay.vue
@@ -15,10 +15,11 @@
 			<u-cell-item title="退款状态" :arrow="false" :value="msg.refundflag_ok" :value-style="msg.refundflag=='refund'?status_style:vstyle"
 			 v-if="msg.refundflag == 'wip' || msg.refundflag == 'refund'"></u-cell-item>
 		</u-cell-group>
-		<u-button @click="msg.status=='wip'?query():open()" :custom-style="payBtn" v-if="kind =='unpay'">{{msg.status=='wip'?'查询订单状态':'立即支付'}}</u-button>
+		<u-button @click="msg.status=='wip'?query():payInit()" :custom-style="payBtn" v-if="kind =='unpay'">{{msg.status=='wip'?'查询订单状态':'立即支付'}}</u-button>
 		<u-button @click="notify_hosiptal" :custom-style="payBtn" v-if="kind =='payed'&& msg.notifyStatus == false">通知医院</u-button>
+		<u-button @click="refund" :custom-style="payBtn" v-if="kind =='payed'">申请退款</u-button>
 		<!-- 支付密码弹框 -->
-		<uni-popup ref="showPassword" class="pwd-wrapper">
+		<!-- <uni-popup ref="showPassword" class="pwd-wrapper">
 			<view class="uni-tip uni-pwd">
 				<text class="uni-tip-title">请输入支付密码</text>
 				<view class="pwd-text-wrap">
@@ -26,25 +27,29 @@
 				</view>
 			</view>
 		</uni-popup>
-		<keyboard-package ref="number" @onInput="onInput" @onDelete="onDelete" @onConfirm="onConfirm" :disableDot="true" />
+		<keyboard-package ref="number" @onInput="onInput" @onDelete="onDelete" @onConfirm="onConfirm" :disableDot="true" /> -->
 	</view>
 </template>
 
 <script>
-	import keyboardPackage from "./z_components/keyboard-package/keyboard-package.vue"
-	import passwordInput from "./z_components/password-input/password-input.vue"
-	import uniPopup from './z_components/uni-popup/uni-popup.vue'
+	// import keyboardPackage from "./components/keyboard-package/keyboard-package.vue"
+	// import passwordInput from "./components/password-input/password-input.vue"
+	// import uniPopup from './components/uni-popup/uni-popup.vue'
+	// #ifdef APP-PLUS
+	const Ynrcc = uni.requireNativePlugin('ynrcc-pay')
+	// console.log(Ynrcc)
+	// #endif
 	export default {
-		components: {
-			uniPopup,
-			keyboardPackage,
-			passwordInput
-		},
+		// components: {
+		// 	uniPopup,
+		// 	keyboardPackage,
+		// 	passwordInput
+		// },
 		data() {
 			return {
-				numberList: [],
-				length: 6,
-				type: 'number',
+				// numberList: [],
+				// length: 6,
+				// type: 'number',
 				tstyle: {
 					marginLeft: '10rpx',
 					fontWeight: 'bold'
@@ -71,56 +76,112 @@
 			}
 		},
 		methods: {
-			// 呼起键盘
-			openKeyBoard(key) {
-				this.type = key;
-				this.$refs[key].open();
-			},
-			// 输入密码
-			onInput(val) {
-				this.numberList.push(val)
-				if (this.numberList.length == this.length) {
-					this.$refs.showPassword.close()
-					this.$refs[this.type].close()
-					this.pay()
-				}
-			},
-			//完成输入点击完成
-			onConfirm() {
-				let length = this.numberList.length
-				if (length == this.length) {
-					this.$refs.showPassword.close()
-					this.$refs[this.type].close()
-				} else {
-					this.numberList = []
-					uni.showToast({
-						title: '密码错误',
-						icon: 'none'
-					})
-				}
-			},
-			//删除密码
-			onDelete(val) {
-				this.numberList.pop(val)
-			},
-			//打开密码输入框
-			open() {
-				this.numberList = []
-				this.$refs.showPassword.open()
-				this.openKeyBoard('number')
-			},
-			pay() {
+			// // 呼起键盘
+			// openKeyBoard(key) {
+			// 	this.type = key;
+			// 	this.$refs[key].open();
+			// },
+			// // 输入密码
+			// onInput(val) {
+			// 	this.numberList.push(val)
+			// 	if (this.numberList.length == this.length) {
+			// 		this.$refs.showPassword.close()
+			// 		this.$refs[this.type].close()
+			// 		this.payInit()
+			// 	}
+			// },
+			// //完成输入点击完成
+			// onConfirm() {
+			// 	let length = this.numberList.length
+			// 	if (length == this.length) {
+			// 		this.$refs.showPassword.close()
+			// 		this.$refs[this.type].close()
+			// 	} else {
+			// 		this.numberList = []
+			// 		uni.showToast({
+			// 			title: '密码错误',
+			// 			icon: 'none'
+			// 		})
+			// 	}
+			// },
+			// //删除密码
+			// onDelete(val) {
+			// 	this.numberList.pop(val)
+			// },
+			// //打开密码输入框
+			// open() {
+			// 	this.numberList = []
+			// 	this.$refs.showPassword.open()
+			// 	this.openKeyBoard('number')
+			// },
+			payInit() {
 				let that = this
-				let pwd = ''
+				// let pwd = ''
 				let billno = that.msg.billNo
-				that.numberList.forEach(item => {
-					pwd += item + ''
-				})
+				// that.numberList.forEach(item => {
+				// 	pwd += item + ''
+				// })
 				let param = {
-					paypwd: pwd,
+					// paypwd: pwd,
 					billno
 				}
-				that.$u.post('/medicalapi/pay', param).then(res => {
+				that.$u.post('/medicalapi/quickpay/payinit', param).then(res => {
+					let code = res.code
+					console.log(res)
+					if(code == 501){
+						uni.showModal({
+							title:'提示',
+							content:'您还未与银行进行签约,暂时无法支付',
+							confirmText:'去签约',
+							success(res) {
+								if(res.confirm){
+									that.getCardsiInfor()
+								}
+							}
+						})
+					}else{
+						let plain_payInit = res.data.plain
+						let signature_payInit = res.data.signature
+						let billno = res.data.billno
+						that.pay(billno,plain_payInit,signature_payInit)
+					}
+				})
+			},
+			pay(billno,plain,signature) {
+				let that = this
+				let params = {
+					plain,
+					signature
+				}
+				console.log(params)
+				Ynrcc.pay(params, res => {
+					console.log(res)
+					let plain_payConfirm = res.plain
+					let signature_payConfirm = res.signature
+					if(!plain_payConfirm && !signature_payConfirm){
+						let obj = res ,code,msg
+						for(let key in obj){
+							code = key
+							msg = obj[key]
+						}
+						uni.showModal({
+							title:'提示',
+							content:code + ':' +msg,
+							showCancel:false
+						})
+						return
+					}
+					that.pay_confirm(billno,plain_payConfirm,signature_payConfirm)
+				})
+			},
+			pay_confirm(billno,plain,signature){
+				let that = this
+				let params = {
+					billno,
+					plain,
+					signature
+				}
+				that.$u.post('/medicalapi/quickpay/confirm',params).then(res=>{
 					let status = res.status
 					let obj = that.msg
 					let date = res.transdate.substr(0, 4) +
@@ -133,6 +194,112 @@
 					}, 1500)
 				})
 			},
+			getCardsiInfor() {
+				let that = this
+				that.$u.post("/medicalapi/quickpay/signinfo").then((res) => {
+					console.log(res)
+					console.log(that.msg.hospitalcode)
+					let bankno = res.bankcardno
+					that.sign_init(bankno,that.msg.hospitalcode)
+				})
+			},
+			sign_init(bankcardno,hospitalcode){
+				let that = this
+				let params = {
+					hospitalcode,
+					bankcardno
+				}
+				that.$u.post('/medicalapi/quickpay/signinit',params).then(res=>{
+					console.log(res)
+					let authsign = res.data.authSign
+					let signature = res.data.signature
+					let user = res.data.signUserData
+					let plain = res.data.plain
+					let signno = res.data.signNo
+					if(!!!authsign){
+						that.sign(plain,signature,user,signno)
+					}else{
+						that.auth_sign(plain,signature,signno)
+					}
+				})
+			},
+			sign(plain,signature,user,signno) {
+				let that = this
+				let params = {
+					plain,
+					signature,
+					name: user.name,
+					id_type: user.idType,
+					id_no: user.idNo,
+					ac_no: user.acNo
+				}
+				Ynrcc.sign(params, res => {
+					let plain_sign = res.plain
+					let signature_sign = res.signature
+					if(!plain_sign && !signature_sign){
+						let obj = res ,code,msg
+						for(let key in obj){
+							code = key
+							msg = obj[key]
+						}
+						uni.showModal({
+							title:'提示',
+							content:code + ':' +msg,
+							showCancel:false
+						})
+						return
+					}
+					that.sign_confirm(plain_sign,signature_sign,signno)
+				})
+			},
+			auth_sign(plain,signature,signno) {
+				let that = this
+				let params = {
+					plain,
+					signature,
+				}
+				Ynrcc.authSign(params, res => {
+					console.log(res)
+					let plain_authSign = res.plain
+					let signature_authSign = res.signature
+					if(!plain_authSign && !signature_authSign){
+						let obj = res ,code,msg
+						for(let key in obj){
+							code = key
+							msg = obj[key]
+						}
+						uni.showModal({
+							title:'提示',
+							content:code + ':' +msg,
+							showCancel:false
+						})
+						return
+					}
+					that.sign_confirm(plain_authSign,signature_authSign,signno)
+				})
+			},
+			sign_confirm(plain,signature,signno){
+				let that = this
+				let params = {
+					signno,
+					plain,
+					signature
+				}
+				that.$u.post('/medicalapi/quickpay/signconfirm',params).then(res=>{
+					uni.showModal({
+						title:'提示',
+						content:'签约成功',
+						showCancel:false,
+						confirmText:'继续支付',
+						success(res){
+							if(res.confirm){
+								// that.open()
+								that.payInit()
+							}
+						}
+					})
+				})
+			},
 			query() {
 				let that = this
 				let billno = that.msg.billNo
@@ -174,10 +341,25 @@
 						}
 					})
 				})
-			}
+			},
+			refund(){
+				let that = this
+				let billno = that.msg.billno
+				let param = {
+					billno
+				}
+				that.$u.post('/medicalapi/medical/quickpay/refund/test',param).then(res=>{
+					uni.showModal({
+						title:'提示',
+						content:'退款成功',
+						showCancel:false,
+					})
+				})
+			},
 		},
 		onLoad(options) {
 			let msg = JSON.parse(options.msg)
+			//console.log(msg)
 			let id = options.id
 			this.kind = id
 			if (id == 'unpay') {