<!-- start 面包屑 -->
<app-breadcrumb></app-breadcrumb>
<!-- end 面包屑 -->

<!--条件搜索-->
<div class="inner-content">
    <form nz-form [formGroup]="searchForm" (ngSubmit)="getRequest(true , searchForm.value)">
        <div nz-row>
            <div nz-col nzSpan="8">
                <nz-form-item>
                    <nz-form-label [nzSpan]="6">产品名称</nz-form-label>
                    <nz-form-control [nzSpan]="16">
                        <input nz-input formControlName="productName"/>
                    </nz-form-control>
                </nz-form-item>
            </div>
<!--            <div nz-col nzSpan="8">-->
<!--                <nz-form-item>-->
<!--                    <nz-form-label [nzSpan]="6">产品类型</nz-form-label>-->
<!--                    <nz-form-control [nzSpan]="16">-->
<!--                        <nz-select nzShowSearch nzAllowClear formControlName="productType" nzPlaceHolder="请选择价格状态">-->
<!--                            <nz-option nzLabel="星巴克" [nzValue]="1"></nz-option>-->
<!--                            <nz-option nzLabel="肯德基" [nzValue]="2"></nz-option>-->
<!--                        </nz-select>-->
<!--                    </nz-form-control>-->
<!--                </nz-form-item>-->
<!--            </div>-->
        </div>


        <div nz-row>
            <div nz-col nzSpan="24" class="search-button">
                <button nz-button nzType="primary"><i nz-icon nzType="search" nzTheme="outline"></i>搜索</button>
                <button nz-button nzType="default" (click)="resetForm()"><i nz-icon nzType="reload"
                                                                            nzTheme="outline"></i>重置
                </button>
            </div>
        </div>
    </form>
</div>


<div class="inner-content">
    <span>共计 {{total}} 条数据</span>
    <div class="operating-button">
        <button nz-button nzType="primary" class="right-btn" (click)="getEdit()"><i nz-icon nzType="plus" nzTheme="outline"></i>添加</button>
    </div>
    <nz-table
            class="table"
            #ajaxTable
            nzShowSizeChanger
            [nzFrontPagination]="false"
            [nzData]="requestData"
            [nzLoading]="loading"
            [nzTotal]="total"
            [(nzPageIndex)]="pageNum"
            [(nzPageSize)]="pageSize"
            [nzScroll]="{ x: '1200px' }"
            (nzPageIndexChange)="getRequest(false , searchForm.value)"
            (nzPageSizeChange)="getRequest(false , searchForm.value)">
        <thead nzSingleSort>
        <tr>
            <th nzWidth="60px">编号</th>
<!--            <th nzWidth="90px">产品类型</th>-->
            <th nzWidth="90px">产品名称</th>
            <th nzWidth="90px">利润比例</th>
            <th nzWidth="120px">积分抵扣比例</th>
            <th nzWidth="100px">支付方式</th>
            <th nzWidth="100px">展示平台</th>
            <th nzWidth="120px">创建时间</th>
            <th nzRight nzWidth="80px">操作</th>
        </tr>
        </thead>
        <tbody>
        <tr *ngFor="let data of ajaxTable.data; let i = index">
            <td>{{i + 1}}</td>
<!--            <td>{{data.productType == 1 ? '星巴克' : '肯德基'}}</td>-->
            <td>{{data.productName}}</td>
            <td>{{data.discount + "%"}}</td>
            <td>{{data.integralDiscount + "%"}}</td>
            <td>{{data.productPayTypeString.substring(0 , data.productPayTypeString.length - 1)}}</td>
            <td>{{data.productPlatformString.substring(0 , data.productPlatformString.length - 1)}}</td>
            <td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td>
            <td nzRight class="table-td-operation">
                <a nz-dropdown [nzDropdownMenu]="menu">更多操作<i nz-icon nzType="down"></i></a>
                <nz-dropdown-menu #menu="nzDropdownMenu">
                    <ul nz-menu nzSelectable>
                        <li nz-menu-item  *ngIf="data.status != 1"><a (click)="getEdit(data.id)">编辑</a></li>
<!--                        <li nz-menu-item  *ngIf="data.status != 1"><a (click)="getForbiddenUserD(data.id)">删除</a></li>-->
                    </ul>
                </nz-dropdown-menu>
            </td>
        </tbody>
    </nz-table>
</div>

<nz-modal [(nzVisible)]="isVisible" nzTitle="产品配置" (nzOnCancel)="handleCancel()" (nzOnOk)="handleOk()">
    <form nz-form [formGroup]="validateForm" class="login-form">
        <nz-form-item>
            <nz-form-label [nzSpan]="6" nzRequired>产品类型</nz-form-label>
            <nz-form-control [nzSpan]="16" nzErrorTip="请选择产品类型!">
                <nz-select nzShowSearch nzAllowClear formControlName="productType" nzPlaceHolder="请选择产品类型">
                    <nz-option nzLabel="星巴克" [nzValue]="1"></nz-option>
                    <nz-option nzLabel="肯德基" [nzValue]="2"></nz-option>
                    <nz-option nzLabel="充值产品" [nzValue]="3"></nz-option>
                </nz-select>
            </nz-form-control>
        </nz-form-item>
        <nz-form-item>
            <nz-form-label [nzSpan]="6" nzRequired>展示平台</nz-form-label>
            <nz-form-control [nzSpan]="16" nzErrorTip="请选择展示平台!">
                <nz-select
                        nzMode="multiple"
                        formControlName="productPlatform"
                        nzPlaceHolder="请选择展示平台"
                >
                    <nz-option *ngFor="let item of productPlatformArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option>
                </nz-select>
            </nz-form-control>
        </nz-form-item>
        <nz-form-item>
            <nz-form-label [nzSpan]="6" nzRequired>支付方式</nz-form-label>
            <nz-form-control [nzSpan]="16" nzErrorTip="请选择支付方式!">
                <nz-select
                        nzMode="multiple"
                        formControlName="payType"
                        nzPlaceHolder="请选择支付方式"
                >
                    <nz-option *ngFor="let item of priceTypeArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option>
                </nz-select>
            </nz-form-control>
        </nz-form-item>
        <nz-form-item>
            <nz-form-label [nzSpan]="6" nzRequired>利润比例</nz-form-label>
            <nz-form-control [nzSpan]="16" nzErrorTip="请输入利润比例!">
                <nz-input-number
                        style="width: 200px"
                        formControlName="discount"
                        [nzMin]="1"
                        [nzMax]="100"
                        [nzStep]="1"
                        [nzPrecision]="2"
                        nzPrecisionMode="cut"
                        nzPlaceHolder="请输入利润比例!"
                        [nzFormatter]="formatterPercent"
                        [nzParser]="parserPercent"
                ></nz-input-number>
            </nz-form-control>
        </nz-form-item>
        <nz-form-item>
            <nz-form-label [nzSpan]="6" nzRequired>积分支付比例</nz-form-label>
            <nz-form-control [nzSpan]="16" nzErrorTip="请输入积分支付比例!">
                <nz-input-number
                        style="width: 200px"
                        formControlName="integralDiscount"
                        [nzMin]="0"
                        [nzMax]="100"
                        [nzStep]="1"
                        [nzPrecision]="2"
                        nzPrecisionMode="cut"
                        nzPlaceHolder="请输入积分支付比例!"
                        [nzFormatter]="formatterPercent"
                        [nzParser]="parserPercent"
                ></nz-input-number>
            </nz-form-control>
        </nz-form-item>
    </form>
</nz-modal>

<nz-modal [(nzVisible)]="isVisibleProduct" nzTitle="商品详情" nzWidth="1200" (nzOnOk)="isVisibleProduct = false"
          (nzOnCancel)="isVisibleProduct = false">
    <nz-descriptions nzBordered [nzColumn]="{ xxl: 4, xl: 3, lg: 3, md: 3, sm: 2, xs: 1 }">
        <nz-descriptions-item nzTitle="类别名称">{{data['categoryName']}}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="商品名称">{{data['name']}}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="商品图片"><img style="width: 80px;" src="{{data['defaultImage']}}" alt=""></nz-descriptions-item>
        <nz-descriptions-item nzTitle="杯型">{{data['cupSize']}}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="温度">{{data['temperature']}}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="奶油">{{data['cream']}}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="浓缩咖啡">{{data['espresso']}}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="牛奶">{{data['milk']}}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="奶泡">{{data['milkBubble']}}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="中杯市场价（元）">¥{{data['marketTallPrice']}}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="大杯市场价（元）">¥{{data['marketGrandePrice']}}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="超大杯市场价（元）">¥{{data['marketVentiPrice']}}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="中杯销售价（元）">¥{{data['salesTallPrice']}}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="大杯销售价（元）">¥{{data['salesGrandePrice']}}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="超大杯销售价（元）">¥{{data['salesVentiPrice']}}</nz-descriptions-item>
    </nz-descriptions>
</nz-modal>
