<table border="0" align="center" cellpadding="0" cellspacing="0" id="mian" ms-controller="marketingmaterialscoupon">
    <tbody>
        <tr>
            <!--leftNav-->
            <td width="198" height="450" valign="top" id="tdleft">
                <div id="left" ms-widget="materialsGiftMenu">
                </div>
                <!--End leftNav-->
            </td>
            <td valign="top" id="right" class="addrightbg">
                <div class="boxtip" id="boxtip">
                    <h1>优惠劵列表 </h1>
                    <p>列出优惠劵，方便平时的使用和管理。</p>
                    <a href="javascript:history.go(-1)" class="btn_back"></a>
                </div>
                <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" class="seacrhTable">
                    <tbody>
                        <tr>
                            <td width="460" class="searchico">
                                <div class="input-append" style="margin-bottom: 10px;">
                                    <input type="text" class="span4" ms-duplex="keyword" placeholder="请输入优惠劵名称快速检索">
                                    <button class="add-on ibtsearch" type="button" id="btnsel" ms-click="search" style="height: 28px; font-size: 12px; padding: 3px 12px;">
                                        {{lang.SearchBtn}}
                                    </button>
                                    <button class="add-on ibtsearch clearall" type="button" ms-click="clear" style="height: 28px; font-size: 12px; padding: 3px 12px;">
                                        {{lang.ShowAllBtn}}</button>
                                </div>
                            </td>
                            <td class="fgray">
                                <span style="float: left;">{{lang.SearchHistory}}</span><div class="hotlist">
                                    <span class="bindSearchHistory" ms-each-item="history">
                                        <a href="javascript:void(0)" ms-value="item" ms-click="historyClick">{{item}}&nbsp;&nbsp;</a>
                                    </span>
                                </div>
                            </td>
                        </tr>
                    </tbody>
                </table>
                <table width="100%" border="0" cellspacing="0" cellpadding="0" class="seacrhField">
                    <tbody>
                        <tr class="quickword">
                            <td>
                                <span id="coupontype">打折方式</span>
                                <div style="display: inline;">
                                    <a href="javascript:void(0)" class="selected" ms-click="itemClick" value="0" key="coupontype">不限</a>
                                    <a href="javascript:void(0)" ms-click="itemClick" value="1" key="coupontype">金额优惠</a>
                                    <a href="javascript:void(0)" ms-click="itemClick" value="2" key="coupontype">折扣率优惠</a>
                                </div>
                            </td>
                        </tr>
                        <tr class="quickword">
                            <td>
                                <span id="stocknum" style="padding-right: 16px;">剩余量</span>
                                <div style="display: inline;">
                                    <a href="javascript:void(0)" class="selected" ms-click="itemClick" value="0" key="stocknum">全部</a>
                                    <a href="javascript:void(0)" ms-click="itemClick" value="1" key="stocknum">0</a>
                                    <a href="javascript:void(0)" ms-click="itemClick" value="2" key="stocknum">1—50</a>
                                    <a href="javascript:void(0)" ms-click="itemClick" value="3" key="stocknum">51—100</a>
                                    <a href="javascript:void(0)" ms-click="itemClick" value="4" key="stocknum">101—300</a>
                                    <a href="javascript:void(0)" ms-click="itemClick" value="5" key="stocknum">300以上</a>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" class="seabox"><span class="first">{{lang.CurrSearchCondition}}</span>
                                <div style="display: inline;" ms-with="showItem">
                                    <span class="searchItem" ms-if="$val">{{$val}}<i><a href="javascript:void(0)" ms-click="remove"></a></i></span>
                                </div>
                                <span class="last" ms-if="has"><a href="javascript:void(0)" ms-click="clear">{{lang.ClearAll}}</a></span>
                            </td>
                        </tr>
                    </tbody>
                </table>
                <!--<div class="boxTitlenob">
                    <h2>优惠劵列表</h2>
                </div>-->
                <table width="100%" border="0" cellspacing="1" cellpadding="0" class="tableList bottom10" id="tableList">
                    <thead>
                        <tr class="dobtn" style="background-color: rgb(255, 255, 255);">
                            <td colspan="9">
                                <a ms-if="ADD" href="javascript:void(0)" class="doadd" ms-click="doadd">{{lang.AddBtn}}</a>
                                <a ms-if="DELETE" href="javascript:void(0)" class="doalldel" ms-click="doalldel">{{lang.BtachDelBtn}}</a>
                            </td>
                        </tr>
                        <tr class="head" style="background-color: rgb(250, 250, 250);">
                            <td width="3%" align="center">
                                <input type="checkbox" class="checkAll">
                            </td>
                            <td width="23%" align="center">优惠券编号
                            </td>
                            <td width="24%" align="center">优惠券名称
                            </td>
                            <td width="10%" align="center">优惠打折方式
                            </td>
                            <td width="10%" align="center">兑换积分
                            </td>
                            <td width="10%" align="center">券剩余量
                            </td>
                            <td width="10%" align="center">发布日期
                            </td>
                            <td width="10%" align="center">操作
                            </td>
                        </tr>
                    </thead>
                    <tbody>
                        <tr ms-repeat-item="materialscouponList" style="background-color: rgb(255, 255, 255);">
                            <td align="center">
                                <input type="checkbox" name="checkbox" ms-value="item.Id">
                            </td>
                            <td align="left">
                                <a href="javascript:void(0)" ms-click="doview" ms-value="item.Id">{{item.CouponNumber}}</a>
                            </td>
                            <td align="left">
                                <a href="javascript:void(0)" ms-click="doview" ms-value="item.Id">{{item.CouponName}}</a>
                            </td>
                            <td align="center">{{item.CouponTypeDisplay}}
                            </td>
                            <td align="center">{{item.Integral}}
                            </td>
                            <td width="10%" align="center">{{item.Stock}}
                            </td>
                            <td align="center">{{item.PublishDate|truncate(10,'')}}
                            </td>
                            <td align="center">
                                <a ms-if="item.NECK" ms-href="'#/Market/MaterialsCouponUse/'+item.Id+'/'+ encodeURI(item.CouponName)" class="doneck" title="领用"></a>
                                <a href="javascript:void(0)" class="doview" ms-click="doview" ms-value="item.Id" ms-title="lang.ViewBtn"></a>
                                <a ms-if="item.EDIT" href="javascript:void(0)" class="doedit" ms-click="doedit" ms-value="item.Id" ms-title="lang.EditBtn"></a>
                                <a ms-if="!item.EDIT" href="javascript:void(0)" class="noedit" ms-title="lang.EditBtn"></a>
                                <a ms-if="item.DELETE" href="javascript:void(0)" class="dodel" ms-click="dodel" ms-attr-index="$index" ms-value="item.Id" ms-title="lang.DelBtn"></a>
                                <a ms-if="!item.DELETE" href="javascript:void(0)" class="nodel" ms-title="lang.DelBtn"></a>
                            </td>
                        </tr>
                    </tbody>
                    <tfoot>
                        <tr style="background-color: rgb(255, 255, 255);">
                            <td colspan="9" ms-widget='paging,upaing,materialscouponpaing'></td>
                        </tr>
                    </tfoot>
                </table>
            </td>
        </tr>
    </tbody>
</table>

<!--新增或修改--->
<noscript type="text/avalon" id="formTemplateCoupon">
    <table cellspacing="0" cellpadding="0" width="98%" border="0" class="formTable">
        <tbody>
            <tr>
                <td width="120">归属战役：</td>
                <td width="320" align="left">
                    <input type="hidden" ms-duplex="entity.CampaignId" />
                    <input type="text" ms-duplex="entity.CampaignDisplay" readonly="readonly" style="width: 200px;">
                    <button type="button" class="myfbt" ms-click="selectCampaign">
                        <i class="customer"></i>
                    </button>
                    <div ms-visible="campaignPanel" class="dropdownPanel" style="width: 610px; position: absolute;" ms-mousedown="mousedownstop">
                        <div>
                            <div class="boxTitlenob" style="margin-left: 0;">
                                <h2>
                                    <span class="rseachbox">
                                        <input style="margin-bottom: 0px;" ms-duplex="campaignKey" type="text">
                                        <button type="button" class="inputbt" ms-click="searchCampaign">
                                        </button>
                                    </span>
                                    <span style="float: right">
                                        <button type="button" ms-click="closeCampaignPanel">{{lang.Close}}</button>
                                        <button type="button" ms-click="clearCampaignValue">清空</button>
                                    </span>
                                </h2>
                            </div>
                            <div style="height: 200px; overflow: auto; background-color: rgb(255, 255, 255);">
                                <table width="100%" align="center" border="0" cellspacing="1" cellpadding="0" class="tableList">
                                    <thead>
                                        <tr class="head">
                                            <td width="20%" align="center">{{lang.CampaignTitle}}</td>
                                            <td width="8%" align="center">{{lang.CampaignType}}</td>
                                            <td width="10%" align="center">{{lang.StartDate}}</td>
                                            <td width="10%" align="center">{{lang.EndDate}}</td>
                                            <td width="7%" align="center">{{lang.CampaignSponsor}}</td>
                                        </tr>
                                    </thead>
                                    <tbody ms-each-item="campaignList">
                                        <tr style="background-color: rgb(255, 255, 255); cursor: pointer;" ms-live-click="clickCampaign" ms-attr-key="item.Id" ms-attr-alt="item.CampaignTheme">
                                            <td align="center">{{item.CampaignTheme}}
                                            </td>
                                            <td align="center">{{item.CampaignTypeDisplay}}
                                            </td>
                                            <td align="center">{{item.StartDate | truncate(10,'')}}
                                            </td>
                                            <td align="center">{{item.EndDate | truncate(10,'')}}
                                            </td>
                                            <td align="center">{{item.CampaignSponsorDisplay}}
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </td>
                <td width="90">归属活动：</td>
                <td align="left">
                    <input type="hidden" ms-duplex="entity.ActivityId" />
                    <input type="text" ms-duplex="entity.ActivityDisplay" readonly="readonly" style="width: 200px;">
                    <button type="button" class="myfbt" ms-click="selectActivity">
                        <i class="customer"></i>
                    </button>
                    <div ms-visible="activityPanel" class="dropdownPanel" style="width: 610px; position: absolute; right: 50px;" ms-mousedown="mousedownstop">
                        <div>
                            <div class="boxTitlenob" style="margin-left: 0;">
                                <h2>
                                    <span class="rseachbox">
                                        <input style="margin-bottom: 0px;" ms-duplex="activityKey" type="text">
                                        <button type="button" class="inputbt" ms-click="searchActivity">
                                        </button>
                                    </span>
                                    <span style="float: right">
                                        <button type="button" ms-click="closeActivityPanel">{{lang.Close}}</button>
                                        <button type="button" ms-click="clearActivityValue">清空</button>
                                    </span>
                                </h2>
                            </div>
                            <div style="height: 200px; overflow: auto; background-color: rgb(255, 255, 255);">
                                <table width="100%" align="center" border="0" cellspacing="1" cellpadding="0" class="tableList">
                                    <thead>
                                        <tr class="head">
                                            <td width="20%" align="center">{{lang.ActivityTheme}}</td>
                                            <td width="8%" align="center">{{lang.ActivityType}}</td>
                                            <td width="15%" align="center">{{lang.ConscientiousPerson}}</td>
                                            <td width="8%" align="center">{{lang.CostBudget}}</td>
                                            <td width="10%" align="center">{{lang.DiscountType}}</td>
                                            <td width="15%" align="center">{{lang.StartDate}}</td>
                                            <td width="15%" align="center">{{lang.EndDate}}</td>
                                        </tr>
                                    </thead>
                                    <tbody ms-each-item="activityList">
                                        <tr style="background-color: rgb(255, 255, 255); cursor: pointer;" ms-live-click="clickActivity" ms-attr-key="item.Id" ms-attr-alt="item.ActivityTheme">
                                            <td align="center">{{item.ActivityTheme}}
                                            </td>
                                            <td align="center">{{item.ActivityTypeDisplay}}
                                            </td>
                                            <td align="center">{{item.ConscientiousPersonDisplay}}
                                            </td>
                                            <td align="right">{{item.CostBudget}}
                                            </td>
                                            <td align="center">{{item.DiscountType}}
                                            </td>
                                            <td align="center">{{item.StartDate|truncate(10,'')}}
                                            </td>
                                            <td align="center">{{item.EndDate|truncate(10,'')}}
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </td>
            </tr>
            <tr>
                <td>优惠券编号：
                </td>
                <td width="*" align="left">
                    <input ms-duplex="entity.CouponNumber" type="text" style="width: 200px;"><span class="must">*</span>
                </td>
                <td>优惠券名称：
                </td>
                <td width="*" align="left">
                    <input ms-duplex="entity.CouponName" type="text" style="width: 200px;"><span class="must">*</span>
                </td>
            </tr>
            <tr>
                <td>优惠使用说明：
                </td>
                <td width="*" align="left">
                    <input ms-duplex="entity.UseDescription" type="text" style="width: 200px;">
                </td>
                <td>开始日期：
                </td>
                <td width="*" align="left">
                    <input type="text" ms-duplex="entity.StartDate" ms-widget="date,startdateid,startdateOpts" style="width: 80px;" readonly="readonly" />
                    至
                <input type="text" ms-duplex="entity.EndDate" ms-widget="date,enddateid,enddateOpts" style="width: 80px;" readonly="readonly" />
                </td>
            </tr>
            <tr>
                <td>每次交易限使用数量：
                </td>
                <td width="*" align="left">
                    <div class="input-append">
                        <input ms-duplex="entity.LimitedVal" type="text" value="0" style="width: 70px;">
                        <span class="add-on">张</span>
                    </div>
                </td>
                <td>满足金额：
                </td>
                <td width="*" align="left">
                    <div class="input-append">
                        <input ms-duplex="entity.MeetsVal" type="text" style="width: 70px;">
                        <span class="add-on">元</span>
                    </div>
                    <span class="helptip">
                        <a href="#" data-toggle="tooltip" data-placement="top" title="如填：3000，则订单金额&gt;3000即可享受对应打折。">&nbsp;&nbsp; </a>
                    </span>
                </td>
            </tr>
            <tr>
                <td>优惠打折方式：</td>
                <td width="*" align="left" colspan="3">
                    <label>
                        <input type="radio" ms-duplex-text="entity.CouponType" value="1">金额优惠</label>
                    <label>
                        <input type="radio" ms-duplex-text="entity.CouponType" value="2">折扣率优惠</label>
                </td>
            </tr>
            <tr ms-visible="entity.CouponType+''=='1'">
                <td>优惠金额值：
                </td>
                <td width="*" align="left">
                    <div class="input-append">
                        <input ms-duplex="entity.CouponVal" type="text" style="width: 70px;">
                        <span class="add-on">元</span>
                    </div>
                    <span class="helptip">
                        <a href="#" data-toggle="tooltip" data-placement="top" title="此处填上具体的金额，如100。">&nbsp;&nbsp; </a>
                    </span>
                </td>
                <td width="*" align="right">&nbsp;
                </td>
                <td width="*" align="left">&nbsp;
                </td>
            </tr>
            <tr ms-visible="entity.CouponType+''=='2'" style="display: none;">
                <td>折扣比率值：
                </td>
                <td width="*" align="left">
                    <div class="input-append">
                        <input ms-duplex="entity.CouponRatio" type="text" style="width: 70px;">
                        <span class="add-on">%</span>
                    </div>
                    <span class="helptip">
                        <a href="#" data-toggle="tooltip" data-placement="top" title="此处填上具体的折扣率。如80%，但填时，只有填80，我们即知道这是80%。">&nbsp;&nbsp; </a>
                    </span>
                </td>
                <td width="*" align="right">&nbsp;
                </td>
                <td width="*" align="left">&nbsp;
                </td>
            </tr>
            <tr>
                <td>派发数量(总数量)：
                </td>
                <td width="*" align="left">
                    <div class="input-append">
                        <input ms-blur="setResidualVal" ms-duplex="entity.Stock" type="text" style="width: 70px;">
                        <span class="add-on">张</span>
                    </div>
                </td>
                <td>兑换需积分：
                </td>
                <td width="*" align="left">
                    <div class="input-append">
                        <input ms-duplex="entity.Integral" type="text" style="width: 70px;">
                        <span class="add-on">分</span>
                    </div>
                    <span class="helptip">
                        <a href="#" data-toggle="tooltip" data-placement="top" title="兑换时所需的积分。">&nbsp;&nbsp; </a>
                    </span>
                </td>
            </tr>
            <tr>
                <td>券剩余可用数量：
                </td>
                <td width="*" align="left">
                    <div class="input-append">
                        <input ms-duplex="entity.ResidualVal" type="text" value="0" readonly="readonly" style="width: 70px;">
                        <span class="add-on">张</span>
                    </div>
                </td>
            </tr>
            <tr>
                <td>发布人：
                </td>
                <td width="*" align="left">
                    <input ms-duplex="entity.PublisherDisplay" type="text" style="width: 100px;" readonly="readonly">
                </td>
                <td>发布日期：
                </td>
                <td width="*" align="left">
                    <input ms-duplex="entity.PublishDate" type="text" style="width: 120px;" readonly="readonly">
                </td>
            </tr>
        </tbody>
    </table>

</noscript>

<!--查看-->
<noscript type="text/avalon" id="viewTemplateCoupon">
    <table cellspacing="1" cellpadding="0" width="98%;" border="0" class="tablecInfo">
        <tbody>
            <tr>
                <td width="120px">归属战役：</td>
                <td width="40%" align="left">{{entity.CampaignDisplay}}
                </td>
                <td width="120px">归属活动：</td>
                <td width="*" align="left">{{entity.ActivityDisplay }}
                </td>
            </tr>
            <tr>
                <td>优惠券编号：
                </td>
                <td width="*" align="left">{{entity.CouponNumber}}
                </td>
                <td>优惠券名称：
                </td>
                <td width="*" align="left">{{entity.CouponName}}
                </td>
            </tr>
            <tr>
                <td>优惠使用说明：
                </td>
                <td width="*" align="left">{{entity.UseDescription}}
                </td>
                <td>开始日期：
                </td>
                <td width="*" align="left">{{entity.StartDate|truncate(10,'')}}
                    至
                    {{entity.EndDate|truncate(10,'')}}
                </td>
            </tr>
            <tr>
                <td>每次交易限使用数量：
                </td>
                <td width="*" align="left">{{entity.LimitedVal}}
                </td>
                <td>满足金额：
                </td>
                <td width="*" align="left">{{entity.MeetsVal}}
                </td>
            </tr>
            <tr>
                <td>优惠打折方式：</td>
                <td width="*" align="left" colspan="3">{{entity.CouponTypeDisplay}}
                </td>
            </tr>
            <tr ms-visible="entity.CouponType+''=='1'">
                <td>优惠金额值：</td>
                <td width="*" align="left" colspan="3">{{entity.CouponVal}}元 
                </td>
            </tr>
            <tr ms-visible="entity.CouponType+''=='2'" style="display: none;">
                <td>折扣比率值：
                </td>
                <td width="*" align="left" colspan="3">{{entity.CouponRatio}}% 
                </td>
            </tr>
            <tr>
                <td>派发数量(总数量)：
                </td>
                <td width="*" align="left">{{entity.Stock}}
                </td>
                <td>兑换需积分：
                </td>
                <td width="*" align="left">{{entity.Integral}}
                </td>
            </tr>
            <tr>
                <td>券剩余可用数量：
                </td>
                <td width="*" align="left" colspan="3">{{entity.ResidualVal}}
                </td>
            </tr>
            <tr>
                <td>发布人：
                </td>
                <td width="*" align="left">{{entity.PublisherDisplay}}
                </td>
                <td>发布日期：
                </td>
                <td width="*" align="left">{{entity.PublishDate}}
                </td>
            </tr>
        </tbody>
    </table>
</noscript>
