<cu-custom isBack="{{true}}">
  <view slot="content">商品管理</view>
</cu-custom>
<scroll-view class="margin-bottom-xxl padding-bottom-xxl ">
  <form wx:if="{{goodsBean != null}}">
    <!-- 商品名称 -->
    <view class="cu-form-group margin-top-xs text-left">
      <view class="title">
        <text class="text-gray">商品名称</text><text class="iconfont icon-star-red margin-left-xs"></text>
      </view>
      <input placeholder="请输入商品名称" bindinput="inputWatch" data-model="goodsName" model:value="{{goodsName}}"></input>
    </view>
    <!-- 商品状态 -->
    <view class="cu-form-group block solid-top">
      <view class="title">
        <text class="text-gray">是否热门</text><text class="iconfont icon-star-red margin-left-xs"></text>
      </view>
      <view>
        <switch class="blue sm" checked="{{isPopular}}" bindchange="selGoodsPopular"></switch>
      </view>
    </view>
    <!-- 商品数量 -->
    <view class="cu-form-group text-left">
      <view class="title">
        <text class="text-gray">商品数量</text><text class="iconfont icon-star-red margin-left-xs"></text>
      </view>
      <input placeholder="请输入商品数量" bindinput="inputWatch" type="number" data-model="goodsCount"
        model:value="{{goodsCount}}"></input>
    </view>
    <!-- 商品单价 -->
    <view class="cu-form-group text-left">
      <view class="title">
        <text class="text-gray">商品单价</text><text class="iconfont icon-star-red margin-left-xs"></text>
      </view>
      <input placeholder="请输入商品单价" bindinput="inputWatch" type="number" data-model="goodsPrice"
        model:value="{{goodsPrice}}"></input>
    </view>
    <!-- 商品单位 -->
    <view class="cu-form-group text-left">
      <view class="title">
        <text class="text-gray">商品单位</text><text class="iconfont icon-star-red margin-left-xs"></text>
      </view>
      <input placeholder="请输入商品单位" bindinput="inputWatch" data-model="goodsUnit" model:value="{{goodsUnit}}"></input>
    </view>
    <!-- 商品状态 -->
    <radio-group class="block solid-top" bindchange="selGoodsStatus">
      <view class="cu-form-group">
        <view class="title">
          <text class="text-gray">商品状态</text><text class="iconfont icon-star-red margin-left-xs"></text>
        </view>
        <view>
          <radio class="blue radio" value="1" checked="{{goodsBean.goodsStatus=='1' }}"></radio>上架
          <radio class="blue radio" value="2" checked="{{goodsBean.goodsStatus=='2'}}"></radio>下架
        </view>
      </view>
    </radio-group>
    <!-- 支付类型 -->
    <radio-group class="block solid-top" bindchange="selGoodsPay">
      <view class="cu-form-group">
        <view class="title">
          <text class="text-gray">支付方式</text><text class="iconfont icon-star-red margin-left-xs"></text>
        </view>
        <view>
          <radio class="blue radio" value="1" checked="{{goodsBean.paymentType=='1'}}"></radio>线上
          <radio class="blue radio" value="2" checked="{{goodsBean.paymentType=='2'}}"></radio>线下
        </view>
      </view>
    </radio-group>
    <!-- 商品Logo  -->
    <view class="cu-bar bg-white margin-top">
      <view class="action">
        <text class="text-gray">商品Logo</text><text class="iconfont icon-star-red margin-left-xs"></text>
      </view>
      <view class="action">
        {{goodsLogoPhotos.length}}/1
      </view>
    </view>
    <view class="cu-form-group">
      <view class="grid col-3 grid-square flex-sub">
        <view class="bg-img" wx:for="{{goodsLogoPhotos}}" wx:key="index" bindtap="viewLogo"
          data-url="{{goodsLogoPhotos[index].path}}">
          <image src='{{goodsLogoPhotos[index].path}}' mode='aspectFill'></image>
          <view class="cu-tag bg-red" catchtap="delLogo" data-index="{{index}}">
            <text class="cuIcon-close"></text>
          </view>
        </view>
        <view class="solids" bindtap="chooseLogo" wx:if="{{goodsLogoPhotos.length<1}}">
          <text class="cuIcon-cameraadd"></text>
        </view>
      </view>
    </view>
    <!-- 商品图片  -->
    <view class="cu-bar bg-white margin-top">
      <view class="action">
        <text class="text-gray">商品图片</text><text class="iconfont icon-star-red margin-left-xs"></text>
      </view>
      <view class="action">
        {{goodsPhotos.length}}/9
      </view>
    </view>
    <view class="cu-form-group">
      <view class="grid col-3 grid-square flex-sub">
        <view class="bg-img" wx:for="{{goodsPhotos}}" wx:key="index" bindtap="viewPhoto"
          data-url="{{goodsPhotos[index].path}}">
          <image src='{{goodsPhotos[index].path}}' mode='aspectFill'></image>
          <view class="cu-tag bg-red" catchtap="delPhoto" data-index="{{index}}">
            <text class="cuIcon-close"></text>
          </view>
        </view>
        <view class="solids" bindtap="choosePhoto" wx:if="{{goodsPhotos.length<9}}">
          <text class="cuIcon-cameraadd"></text>
        </view>
      </view>
    </view>
    <!-- 商品视频  -->
    <view class="cu-bar bg-white margin-top">
      <view class="action">
        商品视频
      </view>
      <view class="action">
        {{goodsVideos.length}}/1
      </view>
    </view>
    <view class="cu-form-group">
      <view class="grid col-3 grid-square flex-sub">
        <view class="bg-img" wx:for="{{goodsVideos}}" wx:key="index" bindtap="viewVideo"
          data-url="{{goodsVideos[index].videoUrl}}">
          <image src='{{goodsVideos[index].path}}' mode='aspectFill'></image>
          <view class="cu-tag bg-red" catchtap="delVideo" data-index="{{index}}">
            <text class="cuIcon-close"></text>
          </view>
        </view>
        <view class="solids" bindtap="chooseVideo" wx:if="{{goodsVideos.length<1}}">
          <text class="cuIcon-cameraadd"></text>
        </view>
      </view>
    </view>
    <!-- 商品说明 -->
    <view class="cu-bar bg-white margin-top-xs">
      <view class="action">
        商品说明
      </view>
    </view>
    <view class="bg-white">
      <view class="cu-form-group">
        <textarea class="border-line padding-left-xs padding-right-xs margin-left-xs margin-right-xs" maxlength="-1"
          bindinput="goodsSummaryInput" placeholder="请输入商品说明" model:value="{{goodsSummary}}"></textarea>
      </view>
    </view>
    <!-- 商品排序 -->
    <view class="cu-form-group solid-top solid-bottom text-left">
      <view class="title">
        商品排序
      </view>
      <input placeholder="请输入商品排序" bindinput="inputWatch" type="number" data-model="goodsOrder"
        model:value="{{goodsOrder}}"></input>
    </view>
  </form>
  <van-empty description="暂无数据" wx:else />
</scroll-view>
<view class="padding-xs foot bg-white grid" style="align-items:center;justify-content:center;">
  <view class="flex" style="width:80%;">
    <button class="flex-sub cu-btn bg-red" bindtap="doDelGoods">立即删除</button>
    <button class="flex-sub cu-btn bg-blue" style="margin-left:20rpx;" bindtap="doUpdate">立即更新</button>
  </view>
</view>