<wxs module="m1">
  var LotteryAttendIconMap = {
    lotteryBox: '../assets/lottery_detail_title_box.svg',
    slotMachine: '../assets/lottery_detail_title_machine.svg',
  };
  var getImage = function(AwardThemeUrl, IsUseDarkTheme) {
    return LotteryAttendIconMap[AwardThemeUrl] || (IsUseDarkTheme ? '../assets/lottery_detail_title_dark.svg' : '../assets/lottery_detail_title_default.svg');
  }
  module.exports.getImage = getImage;
</wxs>
<Drawer id='lottery-drawer' needCancel="{{false}}" bind:myCancel="myCancel">
  <view wx:if="{{visible && type === 'detail' && data}}" class="lottery-detail{{regulation ? ' regulation' : ''}}{{IsUseDarkTheme ? ' lottery-detail-dark' : ''}}{{data.AwardThemeUrl === 'lotteryBox' ? ' lottery-detail-box' : ''}}{{data.AwardThemeUrl === 'slotMachine' ? ' lottery-detail-machine' : '' }}">
    <image wx:if="{{!IsUseDarkTheme && data.AwardThemeUrl !== 'lotteryBox' && data.AwardThemeUrl !== 'slotMachine'}}" class="lottery-detail-bg" style="position: absolute" src="../assets/questionaireImage.png" />
    <view class="lottery-detail-header {{data.showCountDown ? '' : 'lottery-detail-header-no-count-down'}}">
      <view class="lottery-datail-icon" bindtap="openRegulation">
        <!-- <mp-icon icon="help" color="#737a87" size="{{20}}" class="help" /> -->
      </view>
      <view class="lottery-detail-icon-close" bindtap="closeAwardDrawer">
        <mp-icon icon="close" color="#737a87" size="{{20}}" class="close" />
      </view>
      <image src="{{m1.getImage(data.AwardThemeUrl, IsUseDarkTheme)}}" />
      <view class="lottery-detail-title">即将开奖</view>
      <count-down type="lottery" wx:if="{{data.showCountDown && data.SendTime && status === 0}}" sendTime="{{data.SendTime}}" deadLine="{{data.DeadLine}}" useDarkTheme="{{IsUseDarkTheme}}" bind:onCountDown="onCountDown" awardThemeUrl="{{data.AwardThemeUrl}}" deadLineSecond="{{data.DeadLineSecond}}" />
    </view>
    <view wx:if="{{regulation}}" class="regulation-content">
      <view class="lottery-datail-icon" style="left: 8px" bindtap="closeRegulation">
        <mp-icon icon="back" color="#737a87" size="{{20}}" class="lottery-header-icon-left" />
      </view>
      <view className="lottery-datail-iframe-container">
        <web-view height="100%" width="100%" style="border: none" src="https://www.volcengine.com/docs/3019/67124" />
      </view>
    </view>
    <view wx:else>
      <award-card status="{{status}}" data="{{data}}" IsUseDarkTheme="{{IsUseDarkTheme}}" />
      <condition-item wx:if="{{data.hasCondition}}" data="{{data}}" status="{{status}}" IsUseDarkTheme="{{IsUseDarkTheme}}" />
      <button wx:if="{{status === 0}}" type="{{data.UndoAwardCondition ? 'default' : 'primary'}}" class="lottery-detail-button {{data.UndoAwardCondition ? 'lottery-detail-button-default' : 'lottery-detail-button-primary'}}" loading="{{isAttendLoading}}" bindtap="attendLottery">
        {{data.UndoAwardCondition ? '完成全部任务即可参与' : '立即参与'}}
      </button>
      <button wx:else type="default" class="lottery-detail-button lottery-detail-button-default" bindtap="closeAwardDrawer">
        {{status === 4 ? '抽奖已结束，您未参与': '等待开奖'}}
      </button>
    </view>
  </view>
</Drawer>
