<view class="coupon_edit">
  <view class="content">
    <view class="coupon_open">
      <view class="h1">优惠券</view>
      <view class="list ul">
        <view class="li">
          <view class="span" style="width:200rpx;">排序</view>
          <van-field value="{{  display_order }}" style="width:490rpx;" placeholder="请输入优惠券排序" border="{{ false }}" bind:blur="clearSrcollSort" />
        </view>
        <view class="li">
          <view class="span" style="width:200rpx;">名称</view>
          <van-field value="{{  name }}" style="width:490rpx;" placeholder="请输入优惠券名称" border="{{ false }}" bind:blur="clearSrcollName" />
        </view>
        <view class="li">
          <view class="span" style="width:200rpx;">是否开启</view>
          <van-radio-group value="{{status}}" bind:change="onChange">
            <van-radio checked-color="#f15353" name="1" style="width:240rpx;">开启</van-radio>
            <van-radio checked-color="#f15353" name="0" style="width:240rpx;">不开启</van-radio>
          </van-radio-group>
        </view>
      </view>
    </view>
    <view class="coupon_condition">
      <view class="h1">使用条件</view>
      <view class="list ul">
        <view class="li">
          <view class="span">订单金额</view>
          <van-field value="{{  enough }}" placeholder="消费满多少金额才可以使用该优惠券" border="{{ false }}" bind:blur="clearSrcollEnough" />
        </view>
        <view class="member-level li">
          <view class="span">会员等级</view>
          <!-- show1 = true -->
          <view style="display:flex;align-items: center;" catchtap="tapshowMember">
            <van-field value="{{chooseVip}}" readonly placeholder="选择会员等级" border="{{ false }}" />
            <van-icon name="arrow" size="48rpx" color="#c9c9c9" />
          </view>
        </view>
        <view class="li">
          <view class="span">使用时间限制</view>
          <van-radio-group style="justify-content:none;" value="{{time_limit}}" bind:change="onChangeData">
            <van-radio checked-color="#f15353" name="0">有效天数</van-radio>
            <van-radio checked-color="#f15353" name="1">日期</van-radio>
          </van-radio-group>
        </view>
        <view class="li" wx:if="{{time_limit==0}}">
          <view class="span" style="width:200rpx;">有效期</view>
          <van-field value="{{  time_days }}" placeholder="0为不限时间" border="{{ false }}" bind:blur="clearSrcollTime" />
        </view>
        <view wx:if="{{time_limit==1}}" class="timeLimitOne li">
          <view class="span">开始时间</view>
          <view catchtap="tapIShow" style="width:100%;display:flex;margin-left:60rpx;">
            <view style="flex:1;">{{time_start}}</view>
            <van-icon name="arrow" size="48rpx" color="#c9c9c9" />
          </view>
        </view>
        <view wx:if="{{time_limit==1}}" class="timeLimitTwo li">
          <view class="span">结束时间</view>
          <view catchtap="tapIShowOne" style="width:100%;display:flex;margin-left:60rpx;">
            <view style="flex:1;">{{time_end}}</view>
            <van-icon name="arrow" size="48rpx" color="#c9c9c9" />
          </view>
        </view>
        <view class="li">
          <view class="span" style="width:200rpx;">使用方式</view>
          <van-radio-group value="{{is_complex}}" bind:change="onChangeNum">
            <van-radio checked-color="#f15353" name="0">单张使用</van-radio>
            <van-radio checked-color="#f15353" name="1" style="width:240rpx;">多张一起使用</van-radio>
          </van-radio-group>
        </view>
        <view class="li">
          <view class="span" style="width:200rpx;">优惠方式</view>
          <van-radio-group value="{{coupon_method}}" bind:change="onChangeAdd">
            <van-radio checked-color="#f15353" name="1">立减</van-radio>
            <van-radio checked-color="#f15353" name="2">打折</van-radio>
          </van-radio-group>
        </view>
        <view class="sum li" wx:if="{{coupon_method==1}}">
          <view class="box">
            立减
            <van-field value="{{  deduct }}" style="width:280rpx;height:60rpx;line-height:60rpx;border-left:solid 2rpx #ebebeb;border-bottom:solid 2rpx #ebebeb;border-right: solid 2rpx #ebebeb;" placeholder="请输入金额" border="{{ false }}" bind:blur="clearSrcollDeduct" />
            {{language['元']}}
          </view>
        </view>
        <view class="sum li" wx:if="{{coupon_method==2}}">
          <view class="box">
            打折
            <van-field value="{{  discount }}" style="width:280rpx;height:60rpx;line-height:60rpx;border-left:solid 2rpx #ebebeb;border-bottom:solid 2rpx #ebebeb;border-right: solid 2rpx #ebebeb;" placeholder="请输入范围" border="{{ false }}" bind:blur="clearSrcollDis" />
            折
          </view>
        </view>
        <view class="li" style="margin-top:20px;height:160rpx;clear:both;">
          <view class="span" style="height:160rpx;width:200rpx;">使用范围</view>
          <van-radio-group value="{{use_type}}" bind:change="onChangeCate" style="height:160rpx;margin-top:35rpx;display:block;width:500rpx;">
            <view style="width:240rpx;float:left;">
              <van-radio checked-color="#f15353" name="5">全类适用</van-radio>
            </view>
            <view style="width:240rpx;float:left;">
              <van-radio checked-color="#f15353" name="1">指定分类适用</van-radio>
            </view>
            <view style="width:240rpx;float:left;margin-top:20rpx;">
              <van-radio checked-color="#f15353" name="2" style="text-align:left;">指定商品</van-radio>
            </view>
          </van-radio-group>
        </view>
        <view class="range li">
          <!-- <view class="span"></view> -->
          <button wx:if="{{use_type==1}}" catchtap="inniClassify">
            <view style="width:200rpx;height:60rpx;line-height:60rpx;text-align:center;font-size:12px;">
              <icon class="iconfont icon-life-game-plus"></icon>
              添加分类
            </view>
          </button>
          <button type="button" wx:if="{{use_type==2}}" catchtap="inniGoods">
            <view style="width:200rpx;height:60rpx;line-height:60rpx;text-align:center;font-size:12px;">
              <icon class="iconfont icon-life-game-plus"></icon>
              添加商品
            </view>
          </button>
        </view>
        <view class="fenleisort li" wx:if="{{fenleirange.length>0&&use_type==1&&Id=='abc'}}">
          <view class="span">添加的分类</view>
          <view class="item">
            <view class="p" wx:for="{{fenleirange}}" wx:key="{{item}}">
              <view class="name span">{{item.name}}</view>
              <view class="delete span" data-item="{{item}}" catchtap="classifyDelete" style="margin-right:10px;height:60rpx;line-height:60rpx;">
                X
              </view>
            </view>
          </view>
        </view>
        <view class="fenleisort li" wx:if="{{category.length>0&&use_type==1&&Id!='abc'}}">
          <view class="span">添加的分类</view>
          <view class="item">
            <view wx:for="{{category}}" wx:key="{{item}}" class="p">
              <view class="name span">{{item.name}}</view>
              <view class="delete span" data-item="{{item}}" catchtap="classifyDDelete" style="margin-right:10px;height:60rpx;line-height:60rpx;">
                X
              </view>
            </view>
          </view>
        </view>
        <view class="goodssort li" wx:if="{{goodsrange.length>0&&use_type==2&&Id=='abc'}}">
          <view class="span">添加的商品</view>
          <view class="item">
            <view class="p" wx:for="{{ goodsrange}}" wx:key="{{item}}">
              <view class="name span">{{item.title}}</view>
              <view class="delete span" data-item="{{item}}" catchtap="goodsDelete" style="margin-right:10px;height:60rpx;line-height:60rpx;">
                X
              </view>
            </view>
          </view>
        </view>
        <view class="goodssort li" wx:if="{{goods.length>0&&use_type==2&&Id!='abc'}}">
          <view class="span">添加的商品</view>
          <view class="item">
            <view class="p" wx:for="{{goods}}" wx:key="{{item}}">
              <view class="name span">{{item.title}}</view>
              <view class="delete span" data-item="{{item}}" catchtap="goodsDDelete" style="margin-right:10px;height:60rpx;line-height:60rpx;">
                X
              </view>
            </view>
          </view>
        </view>
      </view>
    </view>
    <view class="coupon_receive">
      <view class="h1">领取发放</view>
      <view class="list ul">
        <view class="li">
          <view class="span" style="width:200rpx;">可否领取</view>
          <van-radio-group value="{{get_type}}" bind:change="onChangeforu">
            <van-radio checked-color="#f15353" name="1">可以</van-radio>
            <van-radio checked-color="#f15353" name="0">不可以</van-radio>
          </van-radio-group>
        </view>
        <view class="li" wx:if="{{get_type==1}}" style="display:flex;align-items:center;">
          <view class="span">限领张数</view>
          <van-field type="number" value="{{  get_max }}" placeholder="" input-align="right" border="{{ false }}" bind:blur="clearSrcollGetMax" />
        </view>
        <view class="li">
          <view class="span">发放总数</view>
          <van-field type="number" value="{{  total }}" placeholder="" input-align="right" border="{{ false }}" bind:blur="clearSrcollTotal" />
        </view>
        <view class="li">
          <view class="span">每人每日限领</view>
          <van-field type="number" value="{{  onceTotal }}" placeholder="" border="{{ false }}" input-align="right" bind:blur="clearSrcollonceTotal" />
        </view>
      </view>
    </view>
    <van-popup show="{{show1}}" custom-style="width:100%;height:100%;background:#fff;" position="bottom" bind:click-overlay="onCloseShow" class="fenlei">
      <view class="select_box">
        <view class="title">
          <view class="h2">选择会员等级</view>
          <icon class="iconfont icon-guanbi" catchtap="close"></icon>
        </view>
        <view class="list">
          <van-radio-group value="{{level_limit}}" id="groupOisss" style="display:flex;flex-direction:column;" custom-class="width:100%;display:flex;flex-direction:column;" bind:change="onChangeLimt">
            <van-radio checked-color="#f15353" name="-1" style="width:100%;height:94rpx;line-height:94rpx;padding-left: 20px;border-bottom: solid 2rpx #ebebeb;display:flex;align-items:center;">
              所有会员
            </van-radio>
            <van-radio checked-color="#f15353" style="width:100%;height:94rpx;line-height:94rpx;padding-left: 20px;border-bottom: solid 2rpx #ebebeb;display:flex;align-items:center;" wx:for="{{Vip}}" wx:key="{{item}}" name="{{item.id}}">
              会员{{item.level_name}}
            </van-radio>
          </van-radio-group>
        </view>
        <view class="select_btn" catchtap="finish">
          <button type="button">完成</button>
        </view>
      </view>
    </van-popup>
    <van-popup show="{{show2}}" custom-style="width:100%;height:100%;background:#fff;" position="bottom" bind:click-overlay="onCloseShow" class="fenlei">
      <view class="selectBox">
        <view class="title">
          <view class="h2">添加分类</view>
          <icon class="iconfont icon-guanbi" catchtap="closeClassify"></icon>
        </view>
        <view>
          <view class="input">
            <view class="classify">
              <van-field type="text" class="sousuo classify" value="{{  keyword }}" placeholder="" border="{{ false }}" bind:change="clearSrcollCate" />
            </view>
            <view class="classify_span span" catchtap="ClassifySousuo" wx:if="{{use_type==1&& Id == 'abc'}}">
              搜索
            </view>
            <view class="classify_span span" catchtap="categorySousuo" wx:if="{{use_type==1&& Id != 'abc' }}">
              搜索
            </view>
          </view>
        </view>
        <view class="list">
          <van-checkbox-group value="{{fenleiSelect}}" bind:change="onchangeGroup">
            <van-checkbox wx:for="{{sousuoInfo}}" style="margin:10px;color:#333;" wx:key="{{item}}" name="{{item.name}}" shape="square" data-name="{{item.name}}" checked-color="#f15353">
              {{ item.name }}
            </van-checkbox>
          </van-checkbox-group>
        </view>
        <view class="select_btn" catchtap="finishClassify" wx:if="{{Id=='abc'}}">
          <button type="button">确定</button>
        </view>
        <view class="select_btn" catchtap="finishcategory" wx:if="{{Id!='abc'}}">
          <button type="button">确定</button>
        </view>
      </view>
    </van-popup>
    <van-popup show="{{show3}}" custom-style="width:100%;height:100%;background:#fff;" position="bottom" bind:click-overlay="onCloseShow" class="fenlei">
      <view class="selectBox">
        <view class="title">
          <view class="h2">添加商品</view>
          <icon class="iconfont icon-guanbi" catchtap="closeGoods"></icon>
        </view>
        <view>
          <view class="input">
            <view class="classify">
              <van-field type="text" width="1000px;" class="sousuo classify" value="{{  goodsKeyword }}" placeholder="" border="{{ false }}" bind:change="clearSrcoll" />
            </view>
            <view class="classify_span span" catchtap="goodsousuo" wx:if="{{use_type==2&&Id=='abc'}}">
              搜索
            </view>
            <view class="classify_span span" catchtap="goodSousuo" wx:if="{{use_type==2&&Id!='abc'}}">
              搜索
            </view>
          </view>
        </view>
        <view class="list">
          <van-checkbox-group value="{{goodsSelect}}" style="margin:10px;" bind:change="onchangeSelect">
            <van-checkbox wx:for="{{goodsSousuo}}" style="margin:10px;color:#333;" shape="square" wx:key="{{item}}" name="{{item.title}}" checked-color="#f15353">
              {{ item.title }}
            </van-checkbox>
          </van-checkbox-group>
        </view>
        <view class="select_btn" catchtap="finishGoods" wx:if="{{Id=='abc'}}">
          <button type="button">确定</button>
        </view>
        <view class="select_btn" catchtap="finishgoods" wx:if="{{Id!='abc'}}">
          <button type="button">确定</button>
        </view>
      </view>
    </van-popup>
    <van-popup show="{{show4}}" position="bottom" bind:click-overlay="onCloseShow">
      <van-datetime-picker formatter="{{ formatter }}" value="{{time_startTimes}}"  min-date="{{ minDate }}"  type="datetime" min-hour="{{ 9 }}" max-hour="{{ 23 }}" bind:cancel="onInput" bind:confirm="firmOnye" />
    </van-popup>
    <van-popup show="{{show5}}" position="bottom" bind:click-overlay="onCloseShow">
      <van-datetime-picker formatter="{{ formatter }}" value="{{time_endTimes}}" min-date="{{ minDate }}" type="datetime" min-hour="{{ 9 }}" max-hour="{{ 23 }}" bind:cancel="onInput" bind:confirm="firmOnyeOpios" />
    </van-popup>
  </view>
  <view id="btn">
    <button type="button" wx:if="{{Id=='abc'}}" catchtap="publishInfo">确认发布</button>
    <button type="button" wx:if="{{Id!='abc'}}" catchtap="editInfo">确认编辑</button>
  </view>
</view>
<!-- <shopfoot></shopfoot> -->
