<template>
	<view class="main pt0">
		<button class="btn" @click="exit()">退出登陆</button>
		<!-- <button class="btn" @click="pay()">支付测试</button> -->
	</view>
</template>

<script>
export default {
	data() {
		return {};
	},
	methods: {
		pay() {
			this.http.request({
				url: '/app/wxPay/jsApiPay',
				method: 'POST',
				success: (res) => {
					wx.requestPayment({
						appId: res.data.data.appId,
						nonceStr: res.data.data.nonceStr,
						package: res.data.data.package,
						paySign: res.data.data.paySign,
						timeStamp: res.data.data.timeStamp,
						signType: res.data.data.signType,
						success: (r) => {
							uni.showModal({
								title: '提示',
								content: '下单成功',
								showCancel: false,
								success: (res) => {
									uni.navigateBack({ delta: 2 });
								}
							});
						},
						fail: (r) => {
							console.log("asd:"+JSON.stringify(r));
						}
					});
				}
			});
		},
		exit() {
			uni.showModal({
				title: '提示',
				content: '确定退出登陆?',
				success: (res) => {
					if (res.confirm) {
						this.http.request({
							url: '/app/user/exit',
							success: (res) => {
								uni.removeStorageSync('user');
								uni.navigateBack();
							}
						});
					}
				}
			});
		}
	}
};
</script>

<style lang="scss"></style>
