<view class="gen-page">
  <custom-nav content-height="62" padding-x="34">
    <view class="gen-nav">
      <view class="nav-back" bindtap="handleBack"><text></text></view>
      <text class="nav-title">生成视频</text>
      <view class="coin-pill">
        <!-- <image class="coin-icon icon-placeholder" src="/static/images/my/image.png" mode="aspectFit"></image>
        <text>金币</text>
        <text class="coin-count">128</text> -->
      </view>
    </view>
  </custom-nav>

  <view class="gen-content">
    <view class="confirm-card">
      <text class="card-title">生成确认</text>
      <view class="info-list">
        <view class="info-row avatar-row">
          <text class="info-label">数字人形象</text>
          <image class="small-avatar icon-placeholder" src="{{ taskinfo.avatar.image_url }}" mode="aspectFit"></image>
        </view>
        <view class="info-row">
          <text class="info-label">背景模板</text>
          <text class="info-value">清新直播间</text>
        </view>
        <view class="info-row">
          <text class="info-label">音色</text>
          <view class="voice-value">
            <image class="voice-icon icon-placeholder" src="/static/images/yinse.png" mode="aspectFit"></image>
            <text>已上传专属音色</text>
          </view>
        </view>
        <view class="info-row script-row">
          <text class="info-label">文案摘要</text>
          <view class="script-summary">
            <text>{{ taskinfo.script_text }}</text>
            <view class="view-script" bindtap="handleViewScript">
              <text>查看完整文案</text>
              <text class="right-arrow"></text>
            </view>
          </view>
        </view>
      </view>
    </view>

    <view class="cost-card" wx:if="{{!start}}">
      <view class="cost-row">
        <text>本次生成消耗</text>
        <view class="amount"><text>{{price}}</text><text>金币</text></view>
      </view>
      <view class="cost-row">
        <text>当前余额</text>
        <view class="balance-line">
          <view class="amount"><text>{{userinfo.diamond}}</text><text>金币</text></view>
          <view class="{{ userinfo.diamond < price ?'enough-waring': 'enough'}}">
            <text></text><text>{{userinfo.diamond < price? '余额不足' : '余额充足'}}</text>
          </view>
        </view>
      </view>
      <view class="generate-action" bindtap="handleGenerate">
        <image class="sparkle icon-placeholder" src="/static/images/filter-3-filled.png" mode="aspectFit"></image>
        <text>一键生成数字人视频</text>
      </view>
    </view>

    <view wx:if="{{start}}" style="display:flex;flex-direction: column;gap: 30rpx;">
      <view class="result-title">
        <image class="result-icon icon-placeholder" src="/static/images/my/image.png" mode="aspectFit"></image>
        <text>生成结果</text>
      </view>

      <view class="video-preview">
        <view class="preview-bg">
          <image class="preview-plant plant-left icon-placeholder" src="/static/images/my/image.png" mode="aspectFit">
          </image>
          <image class="preview-plant plant-right icon-placeholder" src="/static/images/my/image.png" mode="aspectFit">
          </image>
          <image class="preview-avatar icon-placeholder" src="/static/images/my/image.png" mode="aspectFit"></image>
          <image class="play-btn icon-placeholder" src="/static/images/my/image.png" mode="aspectFit"></image>
        </view>
      </view>

      <view class="bottom-actions">
        <view class="action-primary" bindtap="handleDownload">
          <image class="download-icon icon-placeholder" src="/static/images/download.png" mode="aspectFit"></image>
          <text>下载视频</text>
        </view>
        <view class="action-outline" bindtap="handleRegenerate">
          <image class="refresh-icon icon-placeholder" src="/static/images/currency-exchange.png" mode="aspectFit">
          </image>
          <text>重新生成</text>
        </view>
        <view class="action-outline" bindtap="handleHome">
          <image class="home-icon icon-placeholder" src="/static/images/to_index.png" mode="aspectFit"></image>
          <text>返回首页</text>
        </view>
      </view>

      <view class="save-tip">
        <image class="tip-icon icon-placeholder" src="/static/images/info-circle.png" mode="aspectFit"></image>
        <text>视频已为你自动保存到【创作记录】</text>
      </view>
    </view>
  </view>
</view>
