<template>
	<view>
		<view class="cmain">
			<view class="box order_detail">
				<view class="item">
					<text class="label">商品名称</text>
					<text class="desc omit">{{ item.goodsNames }}</text>
				</view>
				<view class="item">
					<text class="label">订单编号</text>
					<text class="desc omit">{{ item.tradeNo }}</text>
				</view>
				<view class="item">
					<text class="label">商品重量</text>
					<text class="desc">{{ item.totalWeight }}</text>
				</view>
				<view class="item">
					<text class="label">商品单位</text>
					<text class="desc">{{ item.goodsUnit }}</text>
				</view>
				<view class="item">
					<text class="label">转售金额（必填）</text>
					<text class="desc">
						<input type="number" v-model="order.resalePrice" placeholder="请输入(元)" />
					</text>
				</view>
			</view>
			<u-divider text="费项明细"></u-divider>
			<view class="box">
				<u-collapse v-for="(item,index) in feeItemLIst" :key="index">
					<u-collapse-item :title="item.name" class="cell_title" >
						<view class="itm">1、收费企业：{{ item.companyName }}</view>
						<view class="itm" v-if="item.feeType ==1">2、收费类型：按交易额收取</view>
						<view class="itm" v-if="item.feeType ==2">2、收费类型：按次收取</view>
						<view class="itm" v-if="item.feeType ==1">3、收费%(按交易额)：<span style="color: coral;">{{ item.percent }} %</span></view>
						<view class="itm" v-if="item.feeType ==1">4、当前订单收取金额：<span style="color: coral;">{{ (item.percent * order.resalePrice)/100}} 元</span></view>
						<view class="itm" v-if="item.feeType ==2">3、收费金额(按次收)：<span style="color: coral;">{{ item.feeMoney }} 元</span></view>
						<view class="itm" v-if="item.feeType ==2">4、当前订单收取金额：<span style="color: coral;">{{ item.feeMoney }} 元</span></view>
						</br>
						<view class="itm">当前费项收取金额以最后结算时为准</view>
					</u-collapse-item>
					<!-- <u-collapse-item title="会员有什么用?" class="cell_title">
						<view class="itm">1、普能会员：只浏览平台信息，不可下载平台上的相关附件。</view>
						<view class="itm">2、专业会员：上传展示产品与服务内容、上传相关附件，后台审核方可在平台展示。可下载其他专业会员上传的附件。</view>
						<view class="itm">3、专家会员：只有专家会员才能接受评测邀请。</view>
					</u-collapse-item>
					<u-collapse-item title="积分如何使用?" class="cell_title"><text class="coll">获得的积分可以去线下店铺使用享受折扣哦</text></u-collapse-item>
					<u-collapse-item title="如何申请高级会员?" class="cell_title">
						<view class="itm">1、普能会员：只浏览平台信息，不可下载平台上的相关附件。</view>
						<view class="itm">2、专业会员：上传展示产品与服务内容、上传相关附件，后台审核方可在平台展示。可下载其他专业会员上传的附件。</view>
						<view class="itm">3、专家会员：只有专家会员才能接受评测邀请。</view>
					</u-collapse-item>
					<u-collapse-item title="如何购买产品?" class="cell_title">
						<text class="coll">目前无法在线购买产品，如你想购买某款产品，可以去线下的店购买</text>
					</u-collapse-item> -->
				</u-collapse>
			</view>
		</view>
		<view class="mfooter" v-if="item.resaleStatus != 1">
			<view class="flex">
				<view class="f">
					<button class="btn" @click="ok()">提交</button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			user: this.getUser(),
			item: {},
			order: {
				resalePrice: '',
				levelOneOrderId: '',
				goodsId: '',
				goodsName: '',
				goodsUnit: '',
				tradeAreaId: '',
				tradeAreaName: '',
			},
			feeItemLIst: []
		};
	},
	onLoad(e) {
		if (e.item) {
			this.item = JSON.parse(e.item);
			this.order.levelOneOrderId = this.item.id;
			this.order.goodsId = this.item.goodsId;
			this.order.goodsName = this.item.goodsNames;
			this.order.goodsUnit = this.item.goodsUnit;
			this.order.tradeAreaId = this.item.tradeAreaId;
			this.order.tradeAreaName = this.item.tradeAreaName;
		}
		console.log("this.item",this.item)
		this.getFeeItem();
	},
	methods: {
		//费项明细
		getFeeItem(){
			this.http.request({
				url: '/level-two-server/app/TbFeeItem/getList',
				success: res => {
					this.feeItemLIst = res.data.data
				}
			});
		},
		ok() {
			let rule = [{ name: 'resalePrice', checkType: 'notnull', errorMsg: '请输入转售金额' }];
			if (!this.verify.check(this.order, rule)) {
				uni.showModal({ content: this.verify.error, showCancel: false });
				return false;
			}
			uni.showModal({
				title: '提示',
				content: '我已核对转售信息',
				success: res => {
					if (res.confirm) {
						this.http.request({
							url: '/level-two-server/app/TbOrders/addOrderByResale',
							method: 'POST',
							data: this.order,
							success: res => {
								uni.showToast({title: '提交成功'});
								this.item.resaleStatus = 1;
							}
						});
					}
				}
			});
		}
	}
};
</script>

<style lang="scss">
page {
	background-color: $pg;
}
.item {
	input{
		margin-top: 0px!important;
	}
	}

</style>
