<wxs module="utils" src="../wxs/utils.wxs"/>

<van-popup
        bind:after-leave="onAfterLeave"
        bind:close="onClickOverlay"
        close-on-click-overlay="{{ closeOnClickOverlay }}"
        custom-class="van-dialog van-dialog--{{ theme }}{{ className }} custom-class"
        custom-style="width: {{ utils.addUnit(width) }};{{ customStyle }}"
        overlay="{{ overlay }}"
        overlay-style="{{ overlayStyle }}"
        root-portal="{{ rootPortal }}"
        show="{{ show }}"
        transition="{{ transition }}"
        z-index="{{ zIndex }}"
>
    <view
            class="{{ utils.bem('dialog__header', { isolated: !(message || useSlot) }) }}"
            wx:if="{{ title || useTitleSlot  }}"
    >
        <slot name="title" wx:if="{{ useTitleSlot }}"/>
        <block wx:elif="{{ title }}">{{ title }}</block>
    </view>

    <slot wx:if="{{ useSlot }}"/>
    <view
            class="{{ utils.bem('dialog__message', [theme, messageAlign, { hasTitle: title }]) }}"
            wx:elif="{{ message }}"
    >
        <text class="van-dialog__message-text">{{ message }}</text>
    </view>

    <van-goods-action custom-class="van-dialog__footer--round-button" wx:if="{{ theme === 'round-button' }}">
        <van-goods-action-button
                bind:click="onCancel"
                class="van-dialog__button van-hairline--right"
                custom-class="van-dialog__cancel cancle-button-class"
                custom-style="color: {{ cancelButtonColor }}"
                loading="{{ loading.cancel }}"
                size="large"
                wx:if="{{ showCancelButton }}"
        >
            {{ cancelButtonText }}
        </van-goods-action-button>
        <van-goods-action-button
                app-parameter="{{ appParameter }}"
                bind:click="onConfirm"
                bindagreeprivacyauthorization="onAgreePrivacyAuthorization"
                bindcontact="onContact"
                binderror="onError"
                bindgetRealTimePhoneNumber="onGetRealTimePhoneNumber"
                bindgetphonenumber="onGetPhoneNumber"
                bindgetuserinfo="onGetUserInfo"
                bindlaunchapp="onLaunchApp"
                bindopensetting="onOpenSetting"
                business-id="{{ businessId }}"
                button-id="{{ confirmButtonId }}"
                class="van-dialog__button"
                custom-class="van-dialog__confirm confirm-button-class"
                custom-style="color: {{ confirmButtonColor }}"
                lang="{{ lang }}"
                loading="{{ loading.confirm }}"
                open-type="{{ confirmButtonOpenType }}"
                send-message-img="{{ sendMessageImg }}"
                send-message-path="{{ sendMessagePath }}"
                send-message-title="{{ sendMessageTitle }}"
                session-from="{{ sessionFrom }}"
                show-message-card="{{ showMessageCard }}"
                size="large"
                wx:if="{{ showConfirmButton }}"
        >
            {{ confirmButtonText }}
        </van-goods-action-button>
    </van-goods-action>

    <view class="van-hairline--top van-dialog__footer" wx:elif="{{ showCancelButton || showConfirmButton }}">
        <block wx:if="{{ showCancelButton }}">
            <slot name="cancel-button" wx:if="{{ useCancelButtonSlot }}"/>

            <van-button
                    bind:click="onCancel"
                    class="van-dialog__button van-hairline--right"
                    custom-class="van-dialog__cancel cancle-button-class"
                    custom-style="color: {{ cancelButtonColor }}"
                    loading="{{ loading.cancel }}"
                    size="large"
                    wx:else
            >
                {{ cancelButtonText }}
            </van-button>
        </block>

        <block wx:if="{{ showConfirmButton }}">
            <slot name="confirm-button" wx:if="{{ useConfirmButtonSlot }}"/>

            <van-button
                    app-parameter="{{ appParameter }}"
                    bind:click="onConfirm"
                    bindagreeprivacyauthorization="onAgreePrivacyAuthorization"
                    bindcontact="onContact"
                    binderror="onError"
                    bindgetRealTimePhoneNumber="onGetRealTimePhoneNumber"
                    bindgetphonenumber="onGetPhoneNumber"
                    bindgetuserinfo="onGetUserInfo"
                    bindlaunchapp="onLaunchApp"
                    bindopensetting="onOpenSetting"
                    business-id="{{ businessId }}"
                    button-id="{{ confirmButtonId }}"
                    class="van-dialog__button"
                    custom-class="van-dialog__confirm confirm-button-class"
                    custom-style="color: {{ confirmButtonColor }}"
                    lang="{{ lang }}"
                    loading="{{ loading.confirm }}"
                    open-type="{{ confirmButtonOpenType }}"
                    send-message-img="{{ sendMessageImg }}"
                    send-message-path="{{ sendMessagePath }}"
                    send-message-title="{{ sendMessageTitle }}"
                    session-from="{{ sessionFrom }}"
                    show-message-card="{{ showMessageCard }}"
                    size="large"
                    wx:else
            >
                {{ confirmButtonText }}
            </van-button>
        </block>
    </view>
</van-popup>
