<import src="detail.skeleton.wxml" />
<template is="skeleton" wx:if="{{loading}}" />

<view class="intr">
	<view class="num">
		{{detail.sonum}}
	</view>
	<view class="tags">
		<text wx:if="{{detail.brandname}}" style="background-color: #0079FE;">{{detail.brandname}}</text>
		<text wx:if="{{detail.tradefield}}" style="background-color: #4BD863;">{{detail.tradefield}}</text>
		<!-- <text wx:if="{{detail.status=='新建' && detail.type=='项目订单'}}" style="background-color: #4BD863;" bindtap="setBraned">设置品牌/领域</text> -->
	</view>
	<view class="exp" wx:if="{{userrole!='经销商'}}">经销商：{{detail.enterprisename || ' --'}}</view>
	<view class="exp" wx:if="{{detail.type=='项目订单'}}">关联项目：{{detail.projectname || '暂无'}}</view>
	<view class="exp">订单类型：{{detail.type}}</view>
	<view class="exp">订单状态：{{detail.status}}</view>
	<view class="exp">单据日期：{{detail.billdate || '暂无'}}</view>
	<view class="exp">创建日期：{{detail.createdate}}</view>
	<!-- <van-button custom-class='copy' bindtap="copyItem">一键复制订单</van-button> -->
</view>

<navigator url="#" class="box location" bindtap="selectFinance">
	<view class="content">
		<view class="name">
			开票单位
		</view>
		<view class="address">
			{{detail.finance.enterprisename || '暂无'}}
		</view>
	</view>
	<view class="iconfont icon-dibu-bianji" />
</navigator>

<view class="box pay">
	<view class="title">
		支付信息
	</view>
	<navigator url="#" class="row" bindtap="selectAgent">
		<view class="label">结算人</view>
		<view style="font-size: 28rpx;">
			{{detail.pay_enterprisename || '暂无'}}
			<van-icon name="arrow" />
		</view>
	</navigator>

	<view class="row">
		<view class="label">支付账户</view>
		<view style="font-size: 28rpx; text-align: right;">
			{{account.name}}
			<text style="font-size: 22rpx;">{{account.text}}</text>
		</view>
	</view>
</view>
<view class="box" style="padding: 10rpx 30rpx;">
	<view class="row">
		<view class="label">订单备注</view>
		<textarea disabled="{{detail.status!='新建'}}" bindtap="isEdit" class="remarks" placeholder-class='placeholder' bindblur="changeRemarks" value="{{detail.remarks}}" auto-height placeholder="订单备注" />
	</view>
</view>
<view style="height: 20rpx;" />
<Yl_FunTabs list='{{tabsList}}' active='{{tabsActive}}' bind:onChenge="tabsChange">
	<Product slot='产品明细' id='Product' disabled="{{detail.status!='新建'}}" />
	<Yl_Attachment slot='附件' id='Yl_Attachment' ownertable="sa_order" ownerid="{{detail.sa_orderid}}" disabled="{{detail.status!='新建'}}" />
	<Progress slot='订单进度' id='Progress' />
</Yl_FunTabs>

<view style="height: 130rpx;" />
<view class="footer">
	<view class="price">
		<view class="count">
			{{handleHide.query(amount,hidePrice)}}元
		</view>
		<view>
			{{logistics}}
		</view>
	</view>
	<view class="but-box">
		<van-button custom-class='but delete' wx:if="{{detail.status=='新建'&& enable.query(options,'delete')}}" bind:click="deleteItem">删除订单</van-button>
		<block wx:if="{{detail.type=='特殊订单'}}">
			<van-button custom-class='but' wx:if="{{detail.status=='新建' && enable.query(options,'insubmit')}}" data-isrecheck="1" bind:click="presubmission">预提交</van-button>
			<van-button custom-class='but' wx:if="{{detail.status=='预提交' && enable.query(options,'revocation')}}" data-isrecheck="0" bind:click="presubmission">撤回</van-button>
			<van-button custom-class='but' wx:if="{{detail.status=='确认' && enable.query(options,'submit')}}" bind:click="submit">提交订单</van-button>
		</block>
		<block wx:else>
			<van-button custom-class='but' wx:if="{{detail.status=='新建' && enable.query(options,'submit')}}" bind:click="submit">提交订单</van-button>
		</block>
	</view>
</view>

<wxs src="/utils/hidePrice.wxs" module="handleHide" />
<wxs src="/utils/wxmlQueryPer.wxs" module="enable" />