<template>
	<div>
		<div v-for="(item,index) in itemData" :key="index" class="as-radius-8px" style="margin: 10px 10px 0 10px;background-color: #ECECEC" @click="listItem(item)">
			<div class="as-gravity-center" style="background-color: #1A73E8;color: #FFFFFF;border-radius: 8px 8px 0 0;padding: 16rpx">{{item.channelName}}</div>
			<div style="padding: 16rpx">
				<div style="flex: 1">渠道编号：{{item.channelCode}}</div>
				<div class="top">渠道描述：{{item.channelDesc}}</div>
				<div class="top">是否支持信用卡：{{item.isSupportCredit === 1 ? '支持' : '不支持'}}</div>
				<div class="top">是否支持借记卡：{{item.isSupportDebit === 1 ? '支持' : '不支持'}}</div>
				<div class="as-layout-horizontal top">
					<div style="flex: 1">设备费：{{item.equipFee * 0.01}} 元</div>
					<div style="flex: 1">服务费比例：{{item.serviceFeeRatio}} %</div>
				</div>
			</div>
		</div>
	</div>
</template>
<script setup lang='ts'>
	import {
		request
	} from '../../static/js/network/request'
	import {
		storageKey
	} from '../../static/data/storageKey'
	import {
		ref,
		reactive
	} from 'vue'

	let param = {
		channelCode: '',
		userType: null,
		userIdNum: uni.getStorageSync(storageKey.userIdNum),
		userIdType: uni.getStorageSync(storageKey.userIdType)
	}
	let itemData = reactive([])
	//查询签约渠道
	request('IF01001202209060882', {
		data: param
	}).then((res) => {
		itemData.push(...res.rd.data.signChannels)
	})

	function listItem(item: any) {
		uni.setStorageSync(storageKey.signChannel, item);
		let signChannel = uni.getStorageSync(storageKey.signChannel);
		param.channelCode = item.channelCode
		param.userType = '1'
		//签约申请
		request('IF01001202209060891', {
			data: param
		}).then((res) => {
			uni.setStorageSync(storageKey.signId, res.rd.data.signId); 
			uni.navigateTo({
				url: '/pages/sigManage/signAContract?signId=' + res.rd.data.signId,
				animationType: 'pop-in',
				animationDuration: 500
			})
		})
	}
</script>
<!-- 签约管理 -->
<style lang='scss' scoped>
.top{
	margin-top: 4px;
}
</style>
