<!--packageF/storeManagement/components/permissions/permissions.wxml-->

<view>
  <van-cell is-link data-index="{{1}}" bindtap="setShowPopup" border="{{false}}">
    <view class="title" slot="title">会员等级浏览权限：</view>
    <view class="desc">{{hyll_Model ? hyll_Model : '请选择'}}</view>
  </van-cell>
  <van-cell is-link data-index="{{2}}" bindtap="setShowPopup" border="{{false}}">
    <view class="title" slot="title">会员等级购买权限：</view>
    <view class="desc">{{hygm_Model ? hygm_Model : '请选择'}}</view>
  </van-cell>
  <van-cell is-link data-index="{{3}}" bindtap="setShowPopup" border="{{false}}">
    <view class="title" slot="title">会员组浏览权限：</view>
    <view class="desc">{{hyzll_Model ? hyzll_Model : '请选择'}}</view>
  </van-cell>
  <van-cell is-link data-index="{{4}}" bindtap="setShowPopup" border="{{false}}">
    <view class="title" slot="title">会员组购买权限：</view>
    <view class="desc">{{hyzgm_Model ? hyzgm_Model : '请选择'}}</view>
  </van-cell>
</view>


<view class="cell">
  <van-field title-width="180rpx" model:value="{{once_buy_limit}}" type="number" placeholder="请输入每次下单限购数量">
    <view class="title" slot="label">每次限购数量：</view>
  </van-field>
  <van-field title-width="190rpx" model:value="{{total_buy_limit}}" type="number" placeholder="请输入会员限购的总数">
    <view class="title" slot="label">会员限购总数：</view>
  </van-field>
  <van-field title-width="230rpx" model:value="{{day_buy_limit}}" type="number" placeholder="请输入会员每天限购数量">
    <view class="title" slot="label">会员每天限购总数：</view>
  </van-field>
  <van-field title-width="260rpx" model:value="{{week_buy_limit}}" type="number" placeholder="请输入会员每周期限购数量">
    <view class="title" slot="label">会员每周期限购数量：</view>
  </van-field>
  <van-field title-width="240rpx" model:value="{{month_buy_limit}}" type="number" placeholder="请输入会员每月限购数">
    <view class="title" slot="label">会员每月限购数量：</view>
  </van-field>
</view>






<van-popup show="{{isShowPopup}}" position="bottom" bind:click-overlay="cancelShowPop">
  <view class="wrapper">
    <view class="header">
      <van-nav-bar title="{{popTitle}}" bind:click-left="onClickLeft">
        <!-- <text slot="left" style="color:#838383;" bindtap="showPopup">取消</text>
        <text slot="right" style="color:#f15353;" bindtap="confirmType">确认</text> -->
      </van-nav-bar>
    </view>

    <view class="pop-list" wx:if="{{show1}}">
      <view class="pop-checkbox">
        <van-checkbox value="{{show_levels.length==levelList.length ? true : false}}" data-name="show_levels_CheckedAll"
          bindchange="changeType" class="pop-text" use-icon-slot>
          <view class="display-flex">
            <i class="iconfont icon-all_select_active {{show_levels.length==levelList.length ? 'active' : ''}}"></i>
            <text class="pop-text">全选</text>
          </view>
        </van-checkbox>
      </view>
      <van-checkbox-group value="{{show_levels}}" data-name="show_levels" style="text-align:left"
        checked-color="#f15353" bindchange="changeType">
        <view class="pop-checkbox" wx:for="{{levelList}}" wx:key="index">
          <van-checkbox name="{{item.id}}" class="deletaAtfer" use-icon-slot>
            <view class="display-flex">
              <i class="iconfont icon-all_select_active {{tool.indexOf(show_levels,item.id)>=0 ? 'active' : ''}}"></i>
              <text class="pop-text">{{item.level_name}}</text>
            </view>
          </van-checkbox>
        </view>
      </van-checkbox-group>
    </view>

    <view class="pop-list" wx:if="{{show2}}">
      <view class="pop-checkbox">
        <van-checkbox value="{{buy_levels.length==levelList.length ? true : false}}" data-name="buy_levels_CheckedAll"
          bindchange="changeType" class="pop-text" use-icon-slot>
          <view class="display-flex">
            <i class="iconfont icon-all_select_active {{buy_levels.length==levelList.length ? 'active' : ''}}"></i>
            <text class="pop-text">全选</text>
          </view>
        </van-checkbox>
      </view>
      <van-checkbox-group value="{{buy_levels}}" data-name="buy_levels" style="text-align:left" checked-color="#f15353"
        bindchange="changeType">
        <view class="pop-checkbox" wx:for="{{levelList}}" wx:key="index">
          <van-checkbox name="{{item.id}}" class="deletaAtfer" use-icon-slot>
            <view class="display-flex">
              <i class="iconfont icon-all_select_active {{tool.indexOf(buy_levels,item.id)>=0 ? 'active' : ''}}"></i>
              <text class="pop-text">{{item.level_name}}</text>
            </view>

          </van-checkbox>
        </view>
      </van-checkbox-group>
    </view>

    <view class="pop-list" wx:if="{{show3}}">
      <view class="pop-checkbox">
        <van-checkbox value="{{show_groups.length==groupsList.length ? true : false}}"
          data-name="show_groups_CheckedAll" bindchange="changeType" class="pop-text" use-icon-slot>
          <view class="display-flex">
            <i class="iconfont icon-all_select_active {{show_groups.length==groupsList.length ? 'active' : ''}}"></i>
            <text class="pop-text">全选</text>
          </view>
        </van-checkbox>
      </view>
      <van-checkbox-group value="{{show_groups}}" data-name="show_groups" style="text-align:left"
        checked-color="#f15353" bindchange="changeType">
        <view class="pop-checkbox" wx:for="{{groupsList}}" wx:key="index">
          <van-checkbox name="{{item.id}}" class="deletaAtfer" use-icon-slot>
            <view class="display-flex">
              <i class="iconfont icon-all_select_active {{tool.indexOf(show_groups,item.id)>=0 ? 'active' : ''}}"></i>
              <text class="pop-text">{{item.group_name}}</text>
            </view>
          </van-checkbox>
        </view>
      </van-checkbox-group>
    </view>

    <view class="pop-list" wx:if="{{show4}}">
      <view class="pop-checkbox">
        <van-checkbox value="{{buy_groups.length==groupsList.length ? true : false}}" data-name="buy_groups_CheckedAll"
          bindchange="changeType" use-icon-slot>
          <view class="display-flex">
            <i class="iconfont icon-all_select_active {{buy_groups.length==groupsList.length ? 'active' : ''}}"></i>
            <text class="pop-text">全选</text>
          </view>
        </van-checkbox>
      </view>
      <van-checkbox-group value="{{buy_groups}}" data-name="buy_groups" style="text-align:left" checked-color="#f15353"
        bindchange="changeType">
        <view class="pop-checkbox" wx:for="{{groupsList}}" wx:key="index">
          <van-checkbox name="{{item.id}}" class="deletaAtfer" use-icon-slot>
            <view class="display-flex">
              <i class="iconfont icon-all_select_active {{tool.indexOf(buy_groups,item.id)>=0 ? 'active' : ''}}"></i>
              <text class="pop-text">{{item.group_name}}</text>
            </view>
          </van-checkbox>
        </view>
      </van-checkbox-group>
    </view>




  </view>
</van-popup>




<wxs module="tool">
  function indexOf(arr, content) {
    content = content + "";
    return arr.indexOf(content);
  }

  module.exports.indexOf = indexOf;

</wxs>