<!-- pages/sjpaidan/sjpaidan.wxml -->
<view class="page-container" style="background-image: url('{{bgImageUrl}}');">
  <view class="balance-card">
    <text class="balance-label">可用余额</text>
    <view class="balance-amount">
      <text class="amount-value">{{sjyue}}</text>
      <text class="amount-unit">元</text>
    </view>
    <text class="balance-tip">派单将从此余额扣除</text>
  </view>

  <view class="section">
    <text class="section-title">选择订单类型</text>
    <scroll-view class="type-scroll" scroll-x="true" enable-flex>
      <block wx:for="{{shangpinList}}" wx:key="id">
        <view 
          class="type-item {{selectedTypeId === item.id ? 'type-active' : ''}}"
          data-id="{{item.id}}"
          data-item="{{item}}"
          bindtap="onSelectType"
        >
          <text class="type-text">{{item.jieshao}}</text>
        </view>
      </block>
    </scroll-view>
  </view>

  <view class="section" wx:if="{{isSpecialType && currentTypeGoodsList.length > 0}}">
    <text class="section-title">选择商品模板（点击直接选中）</text>
    <scroll-view class="goods-scroll" scroll-x="true" enable-flex>
      <block wx:for="{{currentTypeGoodsList}}" wx:key="id">
        <view 
          class="goods-item {{selectedGoodsId === item.id ? 'goods-selected' : ''}}"
          data-id="{{item.id}}"
          bindtap="onGoodsItemTap"
        >
          <text class="goods-title">{{item.biaoqian}}</text>
          <text class="goods-detail-hint">点击选中</text>
        </view>
      </block>
    </scroll-view>
  </view>

  <view class="form-container">
    <view class="form-item">
      <text class="form-label required">订单介绍</text>
      <scroll-view wx:if="{{isSpecialType}}" class="form-input form-input-scroll" scroll-y="true">
        <text>{{dingdanJieshao}}</text>
      </scroll-view>
      <input wx:else
        class="form-input"
        placeholder="请输入订单主要内容（必填，最多50字）"
        maxlength="50"
        value="{{dingdanJieshao}}"
        bindinput="onDingdanJieshaoInput"
      />
      <text class="word-count">{{dingdanJieshao.length}}/50</text>
    </view>

    <view class="form-item" wx:if="{{!isSpecialType}}">
      <text class="form-label">订单备注（选填）</text>
      <input 
        class="form-input" 
        placeholder="填写或补充其他信息" 
        maxlength="50"
        value="{{dingdanBeizhu}}"
        bindinput="onDingdanBeizhuInput"
      />
      <text class="word-count">{{dingdanBeizhu.length}}/50</text>
    </view>

    <view class="form-item">
      <text class="form-label required">老板昵称/ID</text>
      <input 
        class="form-input" 
        placeholder="请输入（必填，最多15字）" 
        maxlength="15"
        value="{{laobanName}}"
        bindinput="onLaobanNameInput"
      />
      <text class="word-count">{{laobanName.length}}/15</text>
    </view>

    <view class="form-item">
      <text class="form-label">指定UID（选填）</text>
      <input 
        class="form-input" 
        placeholder="请输入指定UID" 
        maxlength="10"
        value="{{zhidingUid}}"
        bindinput="onZhidingUidInput"
      />
    </view>

    <view class="form-item">
      <text class="form-label required">订单价格（元）</text>
      <input 
        class="form-input" 
        type="digit"
        placeholder="0.1 - 10000，支持两位小数"
        value="{{jiage}}"
        bindinput="onJiageInput"
      />
      <text class="price-tip">范围：0.1 - 10000元</text>
    </view>

    <view class="form-item" wx:if="{{currentTypeChenghaoList.length > 0}}">
      <text class="form-label">要求打手标签*如金牌打手（选填）</text>
      <picker 
        mode="selector" 
        range="{{currentTypeChenghaoList}}" 
        range-key="mingcheng" 
        bindchange="onLabelChange"
      >
        <view class="picker-view">
          <text>{{selectedLabelName || '无'}}</text>
        </view>
      </picker>
    </view>

    <view class="form-item commission-item">
      <text class="form-label">要求打手押金（建议≤50元）</text>
      <switch checked="{{commissionEnabled}}" disabled="{{commissionLocked}}" bindchange="onCommissionToggle"/>
      <input 
        wx:if="{{commissionEnabled}}" 
        class="commission-input {{commissionLocked ? 'input-disabled' : ''}}" 
        type="digit" 
        placeholder="押金金额" 
        value="{{commissionValue}}"
        disabled="{{commissionLocked}}"
        bindinput="onCommissionValueInput"
      />
    </view>
  </view>

  <view class="btn-container">
    <view 
      class="submit-btn {{isSubmitting ? 'btn-disabled' : ''}}" 
      bindtap="onSubmit"
      hover-class="btn-hover"
    >
      <text class="btn-text">{{isSubmitting ? '派发中...' : '立即派发'}}</text>
    </view>
  </view>

  <view class="loading-mask" wx:if="{{isLoading}}">
    <view class="loading-content">
      <view class="loading-spinner"></view>
      <text class="loading-text">加载中...</text>
    </view>
  </view>

  <global-notification id="global-notification" />

  <view 
    class="tutorial-btn {{tutorialBtnHidden ? 'tutorial-btn-hidden' : ''}}"
    bindtap="onTutorialBtnTap"
    hover-class="tutorial-btn-hover"
  >
    <text class="tutorial-btn-text">教程</text>
  </view>

  <popup-notice id="popupNotice" />
</view>