<template>
	<view>
		<view style="padding: 30rpx;">
			<view  v-for="(item, index) in goodlist" :key="index" style="margin-bottom:20rpx;" >
				<view class="b1" style="border-radius: 10rpx 10rpx 0 0;font-size: 30rpx;">
					<text style="float: left;color:#f1a325;">{{item.type}}</text>
					<text style="color: #fff;padding: 3rpx 6rpx;background: #ea644a;float: right;font-size: 28rpx;" @click="del(item.id)">删除</text>
				</view>
				<view style="background: #fff;padding: 20rpx;font-size: 30rpx;line-height: 200%;">
					<view v-if="item.type=='银行卡支付'">开户行：{{item.khh}}</view>
					<view>账户名称：{{item.zhmc}}</view>
					<view v-if="item.type=='USDT支付'">手机账号：{{item.sjh}}</view>
					<view v-if="item.type=='银行卡支付' || item.type=='支付宝支付' || item.type=='拍拍宝'">账号：{{item.skzh}}</view>
					<view v-if="item.type=='银行卡支付'">开户行地址：{{item.fhh}}</view>
					<view v-if="item.type=='微信支付'">收款码：
					<view>
						<image :src="item.skm" style="width: 150rpx;height: 150rpx;" @click="skm(item.skm)">
					</view>
					</view>
				</view>
			</view>
			
			<view style="color: #fff;border-bottom: #333 solid 1px;padding-bottom: 15rpx;" @click="add">
				<text style="font-weight: bold;">+</text>添加收款方式
			</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[],
				userinfo:[],
				goodlist:[]
			}
		},
		methods: {
			sklist(){
				var data = new Object();
				data.uid = this.userinfo.id;
				this.$api
					.MhGetModel(data, 'user/sklist')
					.then(res => {		
						this.goodlist = res.data.data;
					})
					.catch(err => {
						// console.log('request fail', JSON.stringify(err));
					});
			},
			add(){
				uni.navigateTo({
					url: '/pages/shoukuan/add'
				});
			},
			skm(skm){
				uni.navigateTo({
					url: '/pages/shoukuan/cktp?src='+skm
				});
			},
			del(id){
				//// console.log(id)
				var that=this				
				uni.showModal({
					title: '提示',
					content: '是否确认删除',
					success: function (res) {
						if (res.confirm) {
							var data = new Object();
							data.uid = that.userinfo.id;
							data.id=id;	
							that.$api
								.MhGetModel(data, 'user/skdel')
								.then(res => {		
									that.sklist();
								})
								.catch(err => {
									// console.log('request fail', JSON.stringify(err));
								});
						} else if (res.cancel) {
							// console.log('用户点击取消');
						}
					}
				});
			}
		},
		onShow() {
			var user = this.$api.getUserinfo();
			this.userinfo = user;
			this.sklist()
		}
	}
</script>

<style>
page{padding: 15rpx;background:   #98a737;background-attachment: fixed !important;
    background-repeat: no-repeat !important;}
.b1 {
    overflow: hidden;
    padding: 10rpx 15rpx;
    color: #f1a325;
    background: #fff0d5;
    border: 1rpx solid #ffdcbc;
}
</style>
