<script setup>
	/**
	 * name：
	 * user：sa0ChunLuyu
	 * date：2022-04-20 09:02:17
	 */
	import {
		ref
	} from 'vue'
	const pat_test = ref('')
	const payTest = (e) => {
		drawer_ref.value.open()
	}
	const payTestDo = () => {
		let pay_info = JSON.parse(pat_test.value);
		wx.requestPayment({
			'timeStamp': pay_info.timeStamp,
			'nonceStr': pay_info.nonceStr,
			'package': pay_info.package,
			'signType': 'RSA',
			'paySign': pay_info.paySign,
			'success': function(res) {
				console.log(res)
			},
			'fail': function(res) {
				console.log(res)
			},
			'complete': function(res) {}
		});
	}
  
  const drawer_ref = ref(null)
  const drawerRef = (e) => {
    drawer_ref.value = e
  }
</script>
<template>
  <uni-drawer :ref="drawerRef" mode="right">
    <view class="navbar_wrapper"></view>
    <textarea :maxlength="-1" class="textarea_wrapper" v-model="pat_test" />
    <button size="mini" @click="payTestDo()">测试</button>
  </uni-drawer>
  
  <uni-section title="支付测试" type="line">
    <view class="uni-ma-5 uni-pb-5 example_item_wrapper">
       <button size="mini" @click="payTest()">测试</button>
    </view>
  </uni-section>
</template>
<style scoped>
  .textarea_wrapper {
    margin-top: 100rpx;
    height: 400rpx;
  }
</style>
