<wxs module="formatTimeTwo">

var formatNumber = function (n) {
  n = n.toString()
  return n[1] ? n : '0' + n
}

  var regYear = getRegExp("(y+)", "i");
  function formatTimeTwo(timestamp, format) {
    if (!format) {
      format = "yyyy-MM-dd hh:mm:ss";
    }
    timestamp = parseInt(timestamp);
    // 通过getDate()方法获取date类型的时间
    var realDate = getDate(timestamp);
    function timeFormat(num) {
      return num < 10 ? '0' + num : num;
    }
    var date = [
      ["M+", timeFormat(realDate.getMonth() + 1)],
      ["d+", timeFormat(realDate.getDate())],
      ["h+", timeFormat(realDate.getHours())],
      ["m+", timeFormat(realDate.getMinutes())],
      ["s+", timeFormat(realDate.getSeconds())],
      ["q+", Math.floor((realDate.getMonth() + 3) / 3)],
      ["S+", realDate.getMilliseconds()],
    ];
    var reg1 = regYear.exec(format);
    // console.log(reg1[0]);
    if (reg1) {
      format = format.replace(reg1[1], (realDate.getFullYear() + '').substring(4 - reg1[1].length));
    }
    for (var i = 0; i < date.length; i++) {
      var k = date[i][0];
      var v = date[i][1];
      // getRegExp初始化一个正则表达式对象
      var reg2 = getRegExp("(" + k + ")").exec(format);
      if (reg2) {
        format = format.replace(reg2[1], reg2[1].length == 1
          ? v : ("00" + v).substring(("" + v).length));
      }
    }
  return format;
}
  module.exports = formatTimeTwo;
</wxs>
<view id="grab_group_my">
    <view class="top-member">
      <view class="info">
        <image
          src="{{member.avatar_image}}"
          alt=""
          class="avator"
        />
        <view class="info-left">
          <view class="name">{{member.nickname}}</view>
          <view class="number">
            可发团次数
            <view class="info-left-total">{{numberRounds}}</view>
          </view>
        </view>
      </view>
      <view class="recording">
        <i class="iconfont icon-qt_icon_record"></i>
        <view class="recording-text">中奖纪录</view>
        <view class="record-btn" catchtap="gotoRecord">点击查看 <icon class="iconfont icon-advertise-next"></icon></view>
      </view>
    </view>

    <view class="content">
      <van-tabs active="{{active}}" bind:click="handleClick" sticky>
        <van-tab title="{{item}}" wx:for="{{titleArr}}" >
          <view class="list_box">
            <view class="list" wx:for="{{dataList}}" wx:for-index="idx" wx:for-item="child">
              <view class="time_state">
                <view class="time">开团时间：{{formatTimeTwo(child.start_time*1000)}}</view>
                <view class="state" wx:if="{{active == 0}}">抢团中,还差{{child.surplus_number}}人</view>
                <view wx:if="{{active != 0}}">{{active == 1 ? '抢团成功' : '抢团失败'}}</view>
              </view>
              <view class="goods_box">
                <view class="goods_img">
                  <image src="{{child.thumb}}" />
                </view>
                <view class="goods_name">
                  <view class="name_price">
                    <view class="name" style="-webkit-box-orient: vertical;">{{child.title}}</view>
                  </view>
                  <view class="option">
                    <view class="total_price"
                      ><view class="small">{{language['money']}}</view>
                      {{ child.price }}</view
                    >
                  </view>
                </view>
              </view>
              <view class="allbt">
                <view class="button"
                  type="button"
                  class="button"
                  catchtap="operation"
                  data-barter="{{child.barter}}"
                  data-data="{{bottonChild}}"
                  data-orderid="{{child.order_id}}"
                  wx:for="{{child.button_models}}"
                  wx:for-index="idx" wx:for-item="bottonChild"
                  wx:if="{{active==1&&bottonChild.name!= '退款'}}"
                >
                  {{ bottonChild.name }}
                </view>
                <view class="button" wx:if="{{child.is_partake == 1}}" type="button" catchtap="gotoOrderDetail" data-id="{{child.order_id}}">
                  订单详情
                </view>
                <view type="button" catchtap="gotoGroup"  data-id="{{child.leader_id}}" class="groupDetail button">
                  抢团详情
                </view>
              </view>
            </view>
          </view>
        </van-tab>
      </van-tabs>

      <view class="is_none" wx:if="{{dataList.length<1}}">
        <view class="box">
          <view class="none">
            <image src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/energytank_blank@2x.png"></image>
          </view>
          <view class="is_none_text">暂无订单信息</view>
        </view>
      </view>
    </view>
  </view>

  <van-dialog use-slot title="易货兑换" show="{{ showBarter }}" show-cancel-button  bind:confirm='confirmBarter' bind:close="cancelBarter" confirm-button-text='兑换' class="barter_dialog">
    <view class="barter_dialog_1">是否确认易货兑换</view>
    <view class="barter_dialog_2">该商品可兑换易货值为{{ showBarter_value }}</view>
  </van-dialog>