<!--packageF/debt/creditor/creditorindex.wxml-->
<wxs module="add">
    var addA = function addB(a,b){
        return (a + b).toFixed(2)
    }
    module.exports.addM = addA
</wxs>
<view id="creditorindex">
    <view class="headTop" wx:if="{{userInfo.member}}">
        <view class="headImg">
            <view class="img">
                <image src="{{userInfo.member.avatar}}" alt="" />
            </view>
            <view class="name">{{userInfo.member.nickname}}</view>
        </view>
        <view class="ticket">
            <view class="ticket_txt">总提货券</view>
            <view class="ticket_price">￥{{add.addM(userInfo.common_credit,userInfo.frozen_credit)}}</view>
        </view>
        <view class="headTopList">
            <view class="headTopLis">
                <view class="price">￥{{userInfo.common_credit}}</view>
                <view class="txt">{{plugin_setting.common_credit_name || '消费账户'}}</view>
            </view>
            <view class="headTopLis">
                <view class="price">￥{{userInfo.frozen_credit}}</view>
                <view class="txt">{{plugin_setting.frozen_credit_name || "锁定账户"}}</view>
            </view>
            <view class="headTopLis">
                <view class="price">{{userInfo.order_count}}</view>
                <view class="txt">已完成订单数</view>
            </view>
        </view>
    </view>
    <view class="contenBox">
        <view class="contenlis" wx:for="{{listData}}" wx:key="index">
            <view class="contenlis_top">
                <view class="contenlis_topLeft">
                    <view class="img">
                        <image src="{{item.has_one_debtor_member.avatar}}" alt="" />
                    </view>
                    <view class="user">
                        <view class="nameTxt">{{item.has_one_debtor.name}}</view>
                        <view class="time">化债期：{{item.end_time_str}}</view>
                    </view> 
                    <view class="shopBtn" wx:if="{{item.is_expire == 0 && item.status == 1}}" catchtap="toShop" data-id='{{item.has_one_debtor.id}}'>进店</view>
                </view>
            </view>
            <view class="contenlis_lis">
                <view class="contenlis_lisline">
                    <view>总提货券:</view>
                    <view class="contenlis_lisline_Price">￥{{item.sum_credit}}</view>
                </view>
                <view class="contenlis_lisline">
                    <view>{{plugin_setting.common_credit_name || '消费账户'}}:</view>
                    <view class="contenlis_lisline_Price">￥{{item.common_credit}}</view>
                </view>
                <view class="contenlis_lisline">
                    <view>{{plugin_setting.frozen_credit_name || "锁定账户"}}:</view>
                    <view class="contenlis_lisline_Price">￥{{item.frozen_credit}}</view>
                </view>
                <view class="contenlis_lisline">
                    <view>订单数：</view>
                    <view class="contenlis_lisline_Price">{{item.has_many_order_count}}</view>
                </view>
            </view>
            <view class="cardRenew">
                <view class="cardRenewleft">身份有效期：{{item.has_one_owner.end_time_str}}</view>
                <view class="cardRenewRight" wx:if="{{item.has_one_owner.status == '-1' || item.has_one_owner.status == '1'}}" catchtap="renewTap" data-item='{{item}}'>续费</view>
            </view>
        </view>
    </view>
    <view class="posBtn set-pc-style">
        <view class="posBtnView" catchtap="toApply">债权人申请</view>
    </view>
    <van-popup show="{{RenewShow}}" bind:close="tapclose" position="bottom" custom-style="height: 492rpx, borderRadius: 10rpx 10rpx 0px 0px" closeable>
        <view class="shopShowTxt">续费</view>
        <view class="flexCell">
            <view>当前拥有商品数量：{{owner_goods_count}}</view>
            <view class="right">
                <view class="pay" catchtap='goGoods'>
                    购买商品
                    <i class="iconfont icon-member_right"></i>
                </view>
            </view>
        </view>
        <view class="flexCell">
            <view>充值数量</view>
            <view class="right">
                <van-stepper bind:change='stepperTap' class="pay" model:value="{{goodsTotal}}" theme="round" button-size="22" />
            </view>
        </view>
        <view class="btn" catchtap='renewPost'>充值</view>
    </van-popup>
</view>