<!--
	The ID "widget-grid" will start to initialize all widgets below 
	You do not need to use widgets if you dont want to. Simply remove 
	the <section></section> and you can use wells or panels instead 
	-->

<!-- widget grid -->
<section id="widget-grid" class="">

	<!-- row -->
	<div class="row">

		<!-- NEW WIDGET START -->
		<article class="col-xs-12 col-sm-12 col-md-12 col-lg-12">

			<!-- Widget ID (each widget will need unique ID)-->
			<div class="jarviswidget" id="wid-id-4">
				<!-- widget options:
                usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false">

                data-widget-colorbutton="false"
                data-widget-editbutton="false"
                data-widget-togglebutton="false"
                data-widget-deletebutton="false"
                data-widget-fullscreenbutton="false"
                data-widget-custombutton="false"
                data-widget-collapsed="true"
                data-widget-sortable="false"

                -->
				<header>
					<span class="widget-icon"> <i class="fa fa-table"></i> </span>
					<h2>卡券列表</h2>
				</header>
				<!-- widget div-->
				<div>
					<!-- widget edit box -->
					<div class="jarviswidget-editbox">
						<!-- This area used as dropdown edit box -->
					</div>
					<!-- end widget edit box -->
					<!-- widget content -->
					<div class="widget-body no-padding">
						<div class="dt-toolbar">
							<div class="col-xs-3 col-sm-3">
								<div class="dataTables_filter">
									<label>
										<span class="input-group-addon"><i class="glyphicon glyphicon-search"></i></span>
										<input type="search" placeholder="卡号/券号/描述" data-ng-keyup="getCouponList()" ng-model="queryParam.keyword" class="form-control" aria-controls="dt_basic"></label>
								</div>
							</div>
                            <div class="col-sm-3">
                                <div class="dataTables_filter">
                                    <label>
                                        <select ug-select2 ug-select2-config="ugSelect2Config" style="width: 250px;" ng-change="getCouponList()" ng-model="queryParam.couponCategoryId" name="couponCategoryId" >
                                            <option value="">--请选择卡类别--</option>
                                            <option value="{{category.id}}" ng-repeat="category in categoryList">{{category.categoryName}}</option>
                                        </select>
                                    </label>
                                </div>
                            </div>
                            <div class="col-xs-3 col-sm-3">
                                <div class="dataTables_filter">
                                    <label>
                                        <span class="input-group-addon"><i class="glyphicon glyphicon-search"></i></span>
                                        <input type="search" placeholder="批号" data-ng-keyup="getCouponList()" ng-model="queryParam.batch" class="form-control" aria-controls="dt_basic"></label>
                                </div>
                            </div>

                            <div class="col-sm-12">

                                <button class="btn btn-primary" type="button" data-ng-click="open()">
                                    <i class="fa fa-plus"></i>
                                    新增卡券
                                </button>

                                <button class="btn btn-primary" type="button" data-ng-click="getCouponList()">
                                    <i class="fa fa-refresh"></i>
                                    刷新
                                </button>
                                <button class="btn btn-primary" type="button" data-ng-click="open()">
                                    <i class="fa fa-plus"></i>
                                    新增卡券
                                </button>
                                <button class="btn btn-primary" type="button" data-ng-click="openSendMoreCoupon()">
                                    <i class="fa fa-upload"></i>
                                    批量发卡
                                </button>
                                <button class="btn btn-primary" type="button" data-ng-click="updateBatchCouponModel()">
                                    <i class="fa fa-upload"></i>
                                    更新客服经理/公司
                                </button>
                                <button class="btn btn-primary" type="button" data-ng-click="updateBatchCouponTypeModel()">
                                    <i class="fa fa-upload"></i>
                                    批量更改类型
                                </button>
                                        <button type="button" data-ng-click="downImportTemplate();" class="btn btn-outline btn-primary ml12">下载模板</button>
                                        <input ux-upload ux-upload-config="fileUploadConfig" id="file" ng-model="fileUrl" type="file" multiple="true">
                            </div>
						</div>
						<div class="table-responsive">
							<table class="table table-striped table-condensed table-hover smart-form has-tickbox">
								<thead>
								<tr>
									<th style="width: 20px;">
										<label class="checkbox">
                                            <input type="checkbox" ng-model="isCheckCoupon" ng-true-value="0" ng-false-value="1" ng-change="checkedAllCoupon()" />
											<i></i>
										</label>
									</th>
									<th >卡券类型</th>
                                    <th >卡劵类别</th>
                                    <th >付费方式</th>
									<th >描述</th>
									<th >卡号/劵号</th>
									<th >面值</th>
                                    <th >余额</th>
									<th >有效日期</th>
									<th >使用状态</th>
									<th >激活状态</th>
									<th >是否赠送</th>
                                    <th >是否发卡</th>
                                    <th >批次号</th>
                                    <th >发放单位</th>
                                    <th >发放客户经理</th>
									<th >备注</th>
									<th stype="">操作</th>
								</tr>
								</thead>
								<tbody>
								<tr ng-repeat="coupon in couponList  | orderBy:'couponType'"  ng-if="couponList.length > 0" ng-mouseenter="show=true" ng-mouseleave="show=false">
									<td style="width: 20px;">
										<label class="checkbox">
                                            <input type="checkbox"
                                                   checklist-model="chooseCoupon"
                                                   ng-change="changeCouponList()"
                                                   checklist-value="coupon">
											<i></i>
										</label>
									</td>
                                    <td ><span ng-if="coupon.couponType == 1">卡</span><span ng-if="coupon.couponType == 2">消费劵</span></td>
                                    <td  ng-bind="coupon.categoryName"></td>
                                    <td ><span ng-if="coupon.paymentType == 1">预付款</span><span ng-if="coupon.paymentType == 2">后付款</span></td>
                                    <td  ng-bind="coupon.couponDesc"></td>
									<td  ng-bind="coupon.couponNumber"></td>
									<td  ng-bind="coupon.couponValue"></td>
                                    <td  ng-bind="coupon.userPrice"></td>
									<td >{{coupon.beginTime | date: 'yyyy-MM-dd'}} 至 {{coupon.endTime | date: 'yyyy-MM-dd'}}</td>
                                    <td ><span ng-if="coupon.isUsed == 0">未使用</span><span ng-if="coupon.isUsed == 1">已使用</span></td>
                                    <td ><span ng-if="coupon.isUseful == 0">未激活</span><span ng-if="coupon.isUseful == 1">已激活</span></td>
                                    <td ><span ng-if="coupon.isGift == 0">未赠送</span><span ng-if="coupon.isGift == 1">已赠送</span></td>
                                    <td ><span ng-if="coupon.isSend == 0">未发卡</span><span ng-if="coupon.isSend == 1">已发卡</span></td>
                                    <td  ng-bind="coupon.batch"></td>
                                    <td  ng-bind="coupon.companyName"></td>
                                    <td  ng-bind="coupon.managerName"></td>
									<td  ng-bind="coupon.notes"></td>
									<td >
										<div ng-show="show" >
                                            <a href="javascript:void(0);" ng-show="coupon.couponType == 1" data-ng-click="openUpdateUserPrice(coupon)" title="调整余额">
                                                <span class="fa fa-cny"></span>
                                            </a>
                                            <span> | </span>
                                            <a href="javascript:void(0);" data-ng-click="updateCoupon(coupon)" title="编辑">
                                                <span class="fa fa-pencil"></span>
                                            </a>
											<span ng-show="coupon.isSend == 0"> | </span>
                                            <a href="javascript:void(0);" ng-show="coupon.isSend == 0" data-ng-click="removeCoupon(coupon)" title="删除">
                                                <span class="glyphicon glyphicon-remove-circle"></span>
                                            </a>
                                            <span ng-show="coupon.couponType == 1 && coupon.isSend == 0 && coupon.isUseful == 0 "> | </span>
                                            <a href="javascript:void(0);" ng-show="coupon.couponType == 1 && coupon.isSend == 0 && coupon.isUseful == 0 " data-ng-click="openSendCoupon(coupon)" title="发卡">
                                                <span class="fa fa-puzzle-piece"></span>
                                            </a>
                                            <span> | </span>
                                            <a href="javascript:void(0);" ng-show="coupon.couponType == 1" data-ng-click="writeCard(coupon)" title="写卡">
                                                <span class="fa fa-upload"></span>
                                            </a>
										</div>
									</td>
								</tr>
								<tr ng-if="couponList == null || couponList.length == 0">
									<td colspan="11">
										<div>暂无数据</div>
									</td>
								</tr>
								</tbody>
							</table>
						</div>
						<div class="dt-toolbar-footer">
							<div class="col-xs-12 col-sm-12">
								<ug-pagination page-info="pageInfoSetting" ></ug-pagination>
							</div>
						</div>
					</div>
					<!-- end widget content -->
				</div>
				<!-- end widget div -->
			</div>
			<!-- end widget -->

		</article>
		<!-- WIDGET END -->

	</div>

	<!-- end row -->

</section>
<!-- end widget grid -->
<!--调整余额-->
<script type="text/ng-template" id="updateUserPrice.html">
    <div class="modal-header">
        <h3 class="modal-title">卡券信息</h3>
    </div>
    <div class="modal-body">
        <div class="widget-body">
            <form class="form-horizontal" ug-validate="updateUserPriceFrom" name="updateUserPriceFrom2" novalidate="">
                <fieldset>
                    <div class="form-group">
                        <label class="col-md-2 control-label">卡号/劵号<span class="vaild">*</span></label>
                        <div class="col-md-10 input-group">
                            <input class="form-control" required="true"  ng-model="coupon.couponNumber" name="couponNumber" placeholder="卡号/劵号" type="text">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">余额</label>
                        <div class="col-md-10 input-group">
                            <input class="form-control" disabled  ng-model="coupon.userPrice" name="userPrice" placeholder="余额" type="text">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">调整金额<span class="vaild">*</span></label>
                        <div class="col-md-10 input-group">
                            <input class="form-control"  required="true"   ng-model="coupon.updatePrice" name="updatePrice"  data-rule-number="true" placeholder="调整金额" type="text">
                           <span class="vaild"> 添加请填写正数，扣除请添加负数</span>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">备注<span class="vaild">*</span></label>
                        <div class="col-md-10 input-group">
                            <textarea class="form-control" required="true"   ng-model="coupon.remark" rows="5" name="notes" placeholder="备注" ></textarea>
                        </div>
                    </div>

                    <div class="form-group" ng-if="errors">
                        <label class="col-md-2 control-label"></label>
                        <div class="col-md-10 error">
                            {{errors.message}}
                        </div>
                    </div>
                </fieldset>
            </form>
        </div>
    </div>
    <div class="modal-footer">
        <button class="btn btn-primary" type="submit" data-ng-click="updateUserPrice()">
            <i class="fa fa-save"></i>
            调整
        </button>
        <button class="btn btn-warning" ng-click="cancel()">关闭</button>
    </div>
</script>

<script type="text/ng-template" id="addCoupon.html">
	<div class="modal-header">
		<h3 class="modal-title">卡券信息</h3>
	</div>
	<div class="modal-body">
		<div class="widget-body">

			<form class="form-horizontal" ug-validate="addCouponForm" name="addCouponForm" novalidate="">

				<fieldset>
					<div class="form-group">
						<label class="col-md-2 control-label">类型</label>
						<div class="col-md-10 input-group">
							<label class="radio radio-inline">
								<input type="radio" class="radiobox" ng-model="coupon.couponType" value="1" ng-checked="coupon.couponType==1" ng-change="selectCategory()" name="couponType">
								<span>卡</span>
							</label>
							<label class="radio radio-inline">
								<input type="radio" class="radiobox" ng-model="coupon.couponType" value="2" ng-checked="coupon.couponType==2" ng-change="selectCategory()" name="couponType">
								<span>消费券</span>
							</label>
						</div>
					</div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">付费类型</label>
                        <div class="col-md-10 input-group">
                            <label class="radio radio-inline">
                                <input type="radio" class="radiobox" ng-model="coupon.paymentType" ng-disabled="coupon.couponType == 2" value="1" ng-checked="coupon.paymentType==1"  name="paymentType">
                                <span>预付款</span>
                            </label>
                            <label class="radio radio-inline">
                                <input type="radio" class="radiobox" ng-model="coupon.paymentType" ng-disabled="coupon.couponType == 2" value="2" ng-checked="coupon.paymentType==2" name="paymentType">
                                <span>后付款</span>
                            </label>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">类别<span class="vaild">*</span></label>
                        <div class="col-md-10 input-group">
                            <select ug-select2 ug-select2-config="ugSelect2Config" style="width: 100%;" required="true" ng-model="coupon.couponCategory" name="couponCategory" >
                                <option value="">--请选择--</option>
                                <option value="{{category.id}}" ng-repeat="category in categoryList">{{category.categoryName}}</option>
                            </select>
                        </div>
                    </div>
					<div class="form-group">
						<label class="col-md-2 control-label">描述</label>
						<div class="col-md-10 input-group">
							<input class="form-control"  ng-model="coupon.id" name="id" type="hidden">
							<input class="form-control"  ng-model="coupon.couponDesc" name="couponDesc" placeholder="描述" type="text">
						</div>
					</div>

					<div class="form-group">
						<label class="col-md-2 control-label">卡号/劵号<span class="vaild">*</span></label>
						<div class="col-md-10 input-group">
							<input class="form-control" required="true"  ng-model="coupon.couponNumber" name="couponNumber" placeholder="卡号/劵号" type="text">
						</div>
					</div>

                    <div class="form-group" ng-show="coupon.couponType == 1">
                        <label class="col-md-2 control-label">卡密码</label>
                        <div class="col-md-10 input-group">
                            <input class="form-control"  ng-model="coupon.couponPassword" name="couponNumber" placeholder="卡密码" type="text">
                        </div>
                    </div>
					<div class="form-group">
						<label class="col-md-2 control-label">面值<span class="vaild" ng-show="coupon.paymentType == 2">*</span></label>
						<div class="col-md-10 input-group">
							<input class="form-control"  ng-disabled="coupon.id != null"  ng-model="coupon.couponValue" name="couponValue" placeholder="面值" type="text">
						</div>
					</div>
                    <div class="form-group" ng-show="coupon.couponType == 1">
                        <label class="col-md-2 control-label">余额</label>
                        <div class="col-md-10 input-group">
                            <input class="form-control" ng-disabled="coupon.id != null" ng-model="coupon.userPrice" name="couponValue" placeholder="余额" type="text">
                        </div>
                    </div>
					<div class="form-group">
						<label class="col-md-2 control-label">起始时间</label>
						<div class="col-md-10 input-group">
							<input type="text" class="form-control"
								   datepicker-popup="yyyy-MM-dd"
								   placeholder="起始日期"
								   ng-model="coupon.beginTime"
								   close-text="关闭"
								   current-text="今日"
								   clear-text="清除"
								   is-open="datepickerSetting.beginTime.opened"
								    />
							<span class="input-group-btn">
                                <button type="button" class="btn btn-default" ng-click="open($event, 0)"><i class="glyphicon glyphicon-calendar"></i></button>
							</span>
						</div>
					</div>
					<div class="form-group">
						<label class="col-md-2 control-label">截止日期</label>
						<div class="col-md-10 input-group">
							<input type="text" class="form-control" datepicker-popup="yyyy-MM-dd"
								   placeholder="截止日期"
								   ng-model="coupon.endTime"
								   close-text="关闭"
								   current-text="今日"
								   clear-text="清除"
								   is-open="datepickerSetting.endTime.opened"
								    />
							<span class="input-group-btn">
                                <button type="button" class="btn btn-default" ng-click="open($event, 1)"><i class="glyphicon glyphicon-calendar"></i></button>
							</span>
						</div>
					</div>

					<div class="form-group">
						<label class="col-md-2 control-label">备注</label>
						<div class="col-md-10 input-group">
							<textarea class="form-control" ng-model="coupon.notes" rows="5" name="notes" placeholder="备注" ></textarea>
						</div>
					</div>

					<div class="form-group" ng-if="errors">
						<label class="col-md-2 control-label"></label>
						<div class="col-md-10 error">
							{{errors.message}}
						</div>
					</div>
				</fieldset>
			</form>
		</div>
	</div>
	<div class="modal-footer">
		<button class="btn btn-primary" type="submit" data-ng-click="saveCoupon()">
			<i class="fa fa-save"></i>
			保存
		</button>
		<button class="btn btn-warning" ng-click="cancel()">关闭</button>
	</div>
</script>

<script type="text/ng-template" id="sendOneCoupon.html">
    <div class="modal-header">
        <h3 class="modal-title">单卡发放</h3>
    </div>
    <div class="modal-body">
        <div class="widget-body">

            <form class="form-horizontal" ug-validate="sendCouponForm" name="sendCouponForm" novalidate="">
                <fieldset>
                    <div class="form-group">
                        <label class="col-md-2 control-label">卡号</label>
                        <div class="col-md-10 input-group">
                            <input class="form-control" required disabled ng-model="coupon.couponNumber" name="number" placeholder="卡号" type="text">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">卡类别</label>
                        <div class="col-md-10 input-group">
                            <input class="form-control" required disabled ng-model="coupon.categoryName" name="number" placeholder="卡类别" type="text">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">批次</label>
                        <div class="col-md-10 input-group">
                            <input class="form-control" required ng-model="coupon.batch" name="batch" placeholder="批次" type="text">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">公司/单位<span class="vaild">*</span></label>
                        <div class="col-md-10 input-group">
                            <select ug-select2 style="width: 100%;" required="true" ng-model="coupon.cdCompanyId" name="company" ng-change="changeCompany(coupon.cdCompanyId)">
                                <option value="">--请选择--</option>
                                <option value="{{company.id}}" ng-repeat="company in companyList">{{company.companyName}}</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">客户经理<span class="vaild">*</span></label>
                        <div class="col-md-10 input-group">
                            <select ug-select2 style="width: 100%;" required="true" ng-model="coupon.customerMangerId" name="customerManager" >
                                <option value="">--请选择--</option>
                                <option value="{{customerManager.customerMangerId}}" ng-repeat="customerManager in companyCustomerManagers">{{customerManager.customerManger}}</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">是否赠送<span class="vaild">*</span></label>
                        <div class="col-md-10 input-group">
                            <div class="col-md-10 input-group">
                                <label class="radio radio-inline">
                                    <input type="radio" class="radiobox"  ng-model="coupon.isGift" value="0" ng-checked="coupon.isGift==0"  name="isGift">
                                    <span>未赠送</span>
                                </label>
                                <label class="radio radio-inline">
                                    <input type="radio" class="radiobox" ng-model="coupon.isGift" value="1" ng-checked="coupon.isGift==1" name="isGift">
                                    <span>已赠送</span>
                                </label>
                            </div>
                        </div>
                    </div>
                    <div class="form-group" ng-if="errors">
                        <label class="col-md-2 control-label"></label>
                        <div class="col-md-10 error">
                            {{errors.message}}
                        </div>
                    </div>
                </fieldset>
            </form>
        </div>
    </div>
    <div class="modal-footer">
        <button class="btn btn-primary" type="submit" data-ng-click="sendOneCoupon()">
            <i class="fa fa-save"></i>
            发卡
        </button>
        <button class="btn btn-warning" ng-click="cancel()">取消</button>
    </div>
</script>

<script type="text/ng-template" id="sendMoreCoupon.html">
    <div class="modal-header">
        <h3 class="modal-title">批量发卡</h3>
    </div>
    <div class="modal-body">
        <div class="widget-body">
            <div class="jarviswidget" id="wid-id-4">
                <header>
                    <span class="widget-icon"> <i class="fa fa-table"></i> </span>
                    <h2>卡券列表</h2>
                </header>
                <!-- widget div-->
                <div>
                    <!-- widget edit box -->
                    <div class="jarviswidget-editbox">
                        <!-- This area used as dropdown edit box -->
                    </div>
                    <!-- end widget edit box -->
                    <!-- widget content -->
                    <div class="widget-body no-padding">
                        <div class="dt-toolbar">
                            <div class="col-sm-4">
                                <div class="dataTables_filter">
                                    <label>
                                        <span class="input-group-addon"><i class="glyphicon glyphicon-search"></i></span>
                                        <input type="search" placeholder="卡号/券号/描述" data-ng-keyup="getCouponList()" ng-model="queryParam.keyword" class="form-control" aria-controls="dt_basic"></label>
                                </div>
                            </div>
                            <div class="col-sm-4">
                                <div class="dataTables_filter">
                                    <label>
                                        <select ug-select2 ug-select2-config="ugSelect2Config" style="width: 250px;"ng-change="getCouponList()" ng-model="queryParam.couponCategoryId" name="couponCategoryId" >
                                            <option value="">--请选择--</option>
                                            <option value="{{category.id}}" ng-repeat="category in categoryList">{{category.categoryName}}</option>
                                        </select>
                                    </label>
                                </div>
                            </div>
                            <div class="col-sm-2">
                                <button class="btn btn-primary" type="button" data-ng-click="getCouponList()">
                                    <i class="fa fa-refresh"></i>
                                    查找
                                </button>
                            </div>
                        </div>
                        <div class="table-responsive">
                            <table class="table table-striped table-condensed table-hover smart-form has-tickbox">
                                <thead>
                                <tr>
                                    <th style="width: 20px;">
                                        <label class="checkbox">
                                            <input type="checkbox" ng-model="chooseAllCheck.isCheckCoupon" ng-true-value="0" ng-false-value="1" ng-change="checkedAllCoupon()" />
                                            <i></i>
                                        </label>
                                    </th>
                                    <th>卡券类型</th>
                                    <th>卡劵类别</th>
                                    <th>卡号/劵号</th>
                                    <th>描述</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr ng-repeat="coupon in couponList  | orderBy:'couponType'"  ng-if="couponList.length > 0" ng-mouseenter="show=true" ng-mouseleave="show=false">
                                    <td style="width: 20px;">
                                        <label class="checkbox">
                                            <input type="checkbox"
                                                   checklist-model="chooseCoupon"
                                                   checklist-before-change="changeCouponList()"
                                                   checklist-value="coupon">
                                            <i></i>
                                        </label>
                                    </td>
                                    <td><span ng-if="coupon.couponType == 1">卡</span><span ng-if="coupon.couponType == 2">消费劵</span></td>
                                    <td ng-bind="coupon.categoryName"></td>
                                    <td ng-bind="coupon.couponNumber"></td>
                                    <td ng-bind="coupon.couponDesc"></td>
                                </tr>
                                <tr ng-if="couponList == null || couponList.length == 0">
                                    <td colspan="11">
                                        <div>暂无数据</div>
                                    </td>
                                </tr>
                                </tbody>

                            </table>
                        </div>
                        <div class="dt-toolbar-footer">
                            <div class="col-xs-12 col-sm-12">
                                <ug-pagination page-info="pageCouponSetting" ></ug-pagination>
                            </div>
                        </div>
                    </div>
                    <!-- end widget content -->
                </div>
                <!-- end widget div -->
            </div>
            <form class="form-horizontal" ug-validate="sendMoreCouponForm" name="sendMoreCouponForm" novalidate="">
                <fieldset>
                    <h2>已选择的数量：{{sendMorecouponLength}}</h2>
                    <div class="form-group">
                        <label class="col-md-2 control-label">已选择卡/劵号</label>
                        <div class="col-md-10 input-group">
                            <textarea ng-model="coupon.couponNumberList" placeholder="选择的卡/劵号" rows="10" cols="100" readonly>
                            </textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">批次</label>
                        <div class="col-md-10 input-group">
                            <input class="form-control" required ng-model="coupon.batch" name="batch" placeholder="批次" type="text">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">公司/单位<span class="vaild">*</span></label>
                        <div class="col-md-10 input-group">
                            <select ug-select2 style="width: 100%;" required="true" ng-model="coupon.cdCompanyId" name="company" ng-change="changeCompany(coupon.cdCompanyId)">
                                <option value="">--请选择--</option>
                                <option value="{{company.id}}" ng-repeat="company in companyList">{{company.companyName}}</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">客户经理<span class="vaild">*</span></label>
                        <div class="col-md-10 input-group">
                            <select ug-select2 style="width: 100%;" required="true" ng-model="coupon.customerMangerId" name="customerManager" >
                                <option value="">--请选择--</option>
                                <option value="{{customerManager.customerMangerId}}" ng-repeat="customerManager in companyCustomerManagers">{{customerManager.customerManger}}</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">是否赠送<span class="vaild">*</span></label>
                        <div class="col-md-10 input-group">
                            <div class="col-md-10 input-group">
                                <label class="radio radio-inline">
                                    <input type="radio" class="radiobox"  ng-model="coupon.isGift" value="0" ng-checked="coupon.isGift==0"  name="isGift">
                                    <span>未赠送</span>
                                </label>
                                <label class="radio radio-inline">
                                    <input type="radio" class="radiobox" ng-model="coupon.isGift" value="1" ng-checked="coupon.isGift==1" name="isGift">
                                    <span>已赠送</span>
                                </label>
                            </div>
                        </div>
                    </div>
                    <div class="form-group" ng-if="errors">
                        <label class="col-md-2 control-label"></label>
                        <div class="col-md-10 error">
                            {{errors.message}}
                        </div>
                    </div>
                </fieldset>
            </form>
        </div>
    </div>
    <div class="modal-footer">
        <button class="btn btn-primary" type="submit" data-ng-click="sendMoreCoupon()">
            <i class="fa fa-save"></i>
            发卡
        </button>
        <button class="btn btn-warning" ng-click="cancel()">取消</button>
    </div>
</script>


<script type="text/ng-template" id="updateBatchCouponModel.html">
    <div class="modal-header">
        <h3 class="modal-title">更新公司/客服经理</h3>
    </div>
    <div class="modal-body">
        <div class="widget-body">
            <div class="jarviswidget" id="wid-id-4">
                <header>
                    <span class="widget-icon"> <i class="fa fa-table"></i> </span>
                    <h2>卡券列表</h2>
                </header>
                <!-- widget div-->
                <div>
                    <!-- widget edit box -->
                    <div class="jarviswidget-editbox">
                        <!-- This area used as dropdown edit box -->
                    </div>
                    <!-- end widget edit box -->
                    <!-- widget content -->
                    <div class="widget-body no-padding">
                        <div class="dt-toolbar">
                            <div class="col-sm-4">
                                <div class="dataTables_filter">
                                    <label>
                                        <span class="input-group-addon"><i class="glyphicon glyphicon-search"></i></span>
                                        <input type="search" placeholder="批号" data-ng-keyup="getCouponList()" ng-model="queryParam.batch" class="form-control" aria-controls="dt_basic"></label>
                                </div>
                            </div>
                            <div class="col-sm-4">
                                <div class="dataTables_filter">
                                    <label>
                                        <span class="input-group-addon"><i class="glyphicon glyphicon-search"></i></span>
                                        <input type="search" placeholder="卡号/券号/描述" data-ng-keyup="getCouponList()" ng-model="queryParam.keyword" class="form-control" aria-controls="dt_basic"></label>
                                </div>
                            </div>
                            <div class="col-sm-2">
                                <button class="btn btn-primary" type="button" data-ng-click="getCouponList()">
                                    <i class="fa fa-refresh"></i>
                                    查找
                                </button>
                            </div>
                        </div>
                        <div class="table-responsive">
                            <table class="table table-striped table-condensed table-hover smart-form has-tickbox">
                                <thead>
                                <tr>
                                    <th style="width : 20px;">
                                        <label class="checkbox">
                                            <input type="checkbox" ng-model="chooseAllCheck.isCheckCoupon" ng-true-value="0" ng-false-value="1" ng-change="checkedAllCoupon()" />
                                            <i></i>
                                        </label>
                                    </th>
                                    <th>卡券类型</th>
                                    <th>卡劵类别</th>
                                    <th>卡号/劵号</th>
                                    <th>批次</th>
                                    <th>描述</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr ng-repeat="coupon in couponList  | orderBy:'couponType'"  ng-if="couponList.length > 0" ng-mouseenter="show=true" ng-mouseleave="show=false">
                                    <td style="width : 20px;">
                                        <label class="checkbox">
                                            <input type="checkbox"
                                                   checklist-model="chooseCoupon"
                                                   checklist-before-change="changeCouponList()"
                                                   checklist-value="coupon">
                                            <i></i>
                                        </label>
                                    </td>
                                    <td><span ng-if="coupon.couponType == 1">卡</span><span ng-if="coupon.couponType == 2">消费劵</span></td>
                                    <td ng-bind="coupon.categoryName"></td>
                                    <td ng-bind="coupon.couponNumber"></td>
                                    <td ng-bind="coupon.batch"></td>
                                    <td ng-bind="coupon.couponDesc"></td>
                                </tr>
                                <tr ng-if="couponList == null || couponList.length == 0">
                                    <td colspan="11">
                                        <div>暂无数据</div>
                                    </td>
                                </tr>
                                </tbody>

                            </table>
                        </div>
                        <div class="dt-toolbar-footer">
                            <div class="col-xs-12 col-sm-12">
                                <ug-pagination page-info="pageCouponSetting" ></ug-pagination>
                            </div>
                        </div>
                    </div>
                    <!-- end widget content -->
                </div>
                <!-- end widget div -->
            </div>
            <form class="form-horizontal" ug-validate="updateBatchCouponFrom" name="updateBatchCouponFrom2" novalidate="">
                <fieldset>
                    <h2>已选择的数量：{{couponLength}}</h2>
                    <div class="form-group">
                        <label class="col-md-2 control-label">已选择卡/劵号</label>
                        <div class="col-md-10 input-group">
                            <textarea ng-model="coupon.couponNumberList" placeholder="选择的卡/劵号" rows="10" cols="100" readonly>
                            </textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">公司/单位<span class="vaild">*</span></label>
                        <div class="col-md-10 input-group">
                            <select ug-select2 style="width: 100%;" required="true" ng-model="coupon.cdCompanyId" name="company" ng-change="changeCompany(coupon.cdCompanyId)">
                                <option value="">--请选择--</option>
                                <option value="{{company.id}}" ng-repeat="company in companyList">{{company.companyName}}</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">客户经理<span class="vaild">*</span></label>
                        <div class="col-md-10 input-group">
                            <select ug-select2 style="width: 100%;" required="true" ng-model="coupon.customerMangerId" name="customerManager" >
                                <option value="">--请选择--</option>
                                <option value="{{customerManager.customerMangerId}}" ng-repeat="customerManager in companyCustomerManagers">{{customerManager.customerManger}}</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group" ng-if="errors">
                        <label class="col-md-2 control-label"></label>
                        <div class="col-md-10 error">
                            {{errors.message}}
                        </div>
                    </div>
                </fieldset>
            </form>
        </div>
    </div>
    <div class="modal-footer">
        <button class="btn btn-primary" type="submit" data-ng-click="updateBatchCoupon()">
            <i class="fa fa-save"></i>
            更新
        </button>
        <button class="btn btn-warning" ng-click="cancel()">取消</button>
    </div>
</script>


<script type="text/ng-template" id="updateBatchCouponTypeModel.html">
    <div class="modal-header">
        <h3 class="modal-title">批量更改卡类型</h3>
    </div>
    <div class="modal-body">
        <div class="widget-body">
            <div class="jarviswidget" id="wid-id-4">
                <header>
                    <span class="widget-icon"> <i class="fa fa-table"></i> </span>
                    <h2>卡券列表</h2>
                </header>
                <!-- widget div-->
                <div>
                    <!-- widget edit box -->
                    <div class="jarviswidget-editbox">
                        <!-- This area used as dropdown edit box -->
                    </div>
                    <!-- end widget edit box -->
                    <!-- widget content -->
                    <div class="widget-body no-padding">
                        <div class="dt-toolbar">
                            <div class="col-sm-4">
                                <div class="dataTables_filter">
                                    <label>
                                        <span class="input-group-addon"><i class="glyphicon glyphicon-search"></i></span>
                                        <input type="search" placeholder="批号" data-ng-keyup="getCouponList()" ng-model="queryParam.batch" class="form-control" aria-controls="dt_basic"></label>
                                </div>
                            </div>
                            <div class="col-sm-4">
                                <div class="dataTables_filter">
                                    <label>
                                        <span class="input-group-addon"><i class="glyphicon glyphicon-search"></i></span>
                                        <input type="search" placeholder="卡号/券号/描述" data-ng-keyup="getCouponList()" ng-model="queryParam.keyword" class="form-control" aria-controls="dt_basic"></label>
                                </div>
                            </div>
                            <div class="col-sm-2">
                                <button class="btn btn-primary" type="button" data-ng-click="getCouponList()">
                                    <i class="fa fa-refresh"></i>
                                    查找
                                </button>
                            </div>
                        </div>
                        <div class="table-responsive">
                            <table class="table table-striped table-condensed table-hover smart-form has-tickbox">
                                <thead>
                                <tr>
                                    <th style="width : 20px;">
                                        <label class="checkbox">
                                            <input type="checkbox" ng-model="chooseAllCheck.isCheckCoupon" ng-true-value="0" ng-false-value="1" ng-change="checkedAllCoupon()" />
                                            <i></i>
                                        </label>
                                    </th>
                                    <th>卡券类型</th>
                                    <th>卡劵类别</th>
                                    <th>卡号/劵号</th>
                                    <th>批次</th>
                                    <th>描述</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr ng-repeat="coupon in couponList  | orderBy:'couponType'"  ng-if="couponList.length > 0" ng-mouseenter="show=true" ng-mouseleave="show=false">
                                    <td style="width : 20px;">
                                        <label class="checkbox">
                                            <input type="checkbox"
                                                   checklist-model="chooseCoupon"
                                                   checklist-before-change="changeCouponList()"
                                                   checklist-value="coupon">
                                            <i></i>
                                        </label>
                                    </td>
                                    <td><span ng-if="coupon.couponType == 1">卡</span><span ng-if="coupon.couponType == 2">消费劵</span></td>
                                    <td ng-bind="coupon.categoryName"></td>
                                    <td ng-bind="coupon.couponNumber"></td>
                                    <td ng-bind="coupon.batch"></td>
                                    <td ng-bind="coupon.couponDesc"></td>
                                </tr>
                                <tr ng-if="couponList == null || couponList.length == 0">
                                    <td colspan="11">
                                        <div>暂无数据</div>
                                    </td>
                                </tr>
                                </tbody>

                            </table>
                        </div>
                        <div class="dt-toolbar-footer">
                            <div class="col-xs-12 col-sm-12">
                                <ug-pagination page-info="pageCouponSetting" ></ug-pagination>
                            </div>
                        </div>
                    </div>
                    <!-- end widget content -->
                </div>
                <!-- end widget div -->
            </div>
            <form class="form-horizontal" ug-validate="updateBatchCouponTypeFrom" name="updateBatchCouponTypeFrom2" novalidate="">
                <fieldset>
                    <h2>已选择的数量：{{couponLength}}</h2>
                    <div class="form-group">
                        <label class="col-md-2 control-label">已选择卡/劵号</label>
                        <div class="col-md-10 input-group">
                            <textarea ng-model="coupon.couponNumberList" placeholder="选择的卡/劵号" rows="10" cols="100" readonly>
                            </textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">类型<span class="vaild">*</span></label>
                        <div class="col-md-10 input-group">
                            <select ug-select2 style="width: 100%;" required="true" ng-model="coupon.couponCategoryId" name="couponCategoryId">
                                <option value="">--请选择--</option>
                                <option value="{{category.id}}" ng-repeat="category in categoryList">{{category.categoryName}}</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group" ng-if="errors">
                        <label class="col-md-2 control-label"></label>
                        <div class="col-md-10 error">
                            {{errors.message}}
                        </div>
                    </div>
                </fieldset>
            </form>
        </div>
    </div>
    <div class="modal-footer">
        <button class="btn btn-primary" type="submit" data-ng-click="updateBatchCoupon()">
            <i class="fa fa-save"></i>
            更新
        </button>
        <button class="btn btn-warning" ng-click="cancel()">取消</button>
    </div>
</script>

<style>
    table tbody {
        display:block;
        height:400px;
        overflow-y:scroll;
    }

    table thead, tbody tr {
        display:table;
        width:100%;
        table-layout:fixed;
    }

    table thead {
        width: calc( 100% - 1em )
    }
</style>
