<template>
	<view class="page">
		<manager :height="height" v-if="userInfo.isManager === 1"></manager>
		<attach :height="height" v-if="userInfo.isManager === 0 && userInfo.roleTag == '0'"></attach>
		<view v-if="userInfo.isManager === 0 && userInfo.roleTag == '1'">
			<text>合作伙伴</text>
		</view>
	</view>
</template>

<script>
	import manager from "./manager/manager";
	import attach from "./attach/attach"
	export default {
		components: {
			manager,
			attach
		},
		data() {
			return {
				height: '',
				ruleList: [],
				roleList: [],
				roleBindRuleParam: {},
				userInfo: {}
			}
		},
		onLoad() {
			let sysInfo = uni.getSystemInfoSync()
			this.height = sysInfo.windowHeight + 'px'
		},
		onShow() {
			this.userInfo = uni.getStorageSync('spreadUserInfo')
			console.log('时间戳',new Date().getTime())
		},
		methods: {
			// 微信支付
			wechatPay() {
				const that = this;
				// 用户信息
				this.$api.service.wechatPay({
					orderNo: 'CZ20240223125943175'
				}).then((res) => {
					var param = res.data.data;
					uni.requestPayment({
						appId: param.appid,
						timeStamp: param.timestamp + "",
						nonceStr: param.noncestr,
						package: "prepay_id=" + param.prepayid,
						signType: "RSA",
						paySign: param.sign,
						success: res => {
							uni.showToast({
								title: '支付成功!'
							});
							// 刷新用户信息
							that.getUserInfo()
						},
						fail: res => {
							uni.showModal({
								content: '支付失败',
								showCancel: false
							});
						}
					});
				})
			},

		}
	}
</script>

<style scoped lang="scss">
	@import './index.rpx.css';
</style>
