<template>
	<view class="container">
		<Navbar title="订单详情" :canBack="true"></Navbar>
		<view class="topTitleCss">
			<view class="text-xxl text-bold">
				{{detailForm.fDdzt}}
			</view>
      <view class="text-gray text-lg margin-top">
        订单完成时间：{{ detailForm.fSjwcsj?detailForm.fSjwcsj:detailForm.fDdzt==='待配送'? "等待配送中":detailForm==='已取消'?'已取消':detailForm.fDdzt }}
      </view>
		</view>
		<view class="orderCard">
			<view class="flex align-center">
				<view class="flex align-center w80" @click="goStorePage">
					<u-icon name="/static/images/home/shopTitle.png" size="20"></u-icon>
					<view class="margin-left-xs overflow-one-lines">
						{{detailForm.fCzmc}}
					</view>
				</view>
				<!-- <view class="themeColor">
					待配送
				</view> -->
			</view>
			<u-divider></u-divider>
			<view class="" v-for="(item,index) in detailForm.ddxqList" :key="index">
				<view class="flex justify-between margin-top">
					<view class="">
						<u-image width="80px" height="80px" :src="item.fTp"></u-image>
					</view>
					<view class="w60 flex flex-direction  justify-between margin-left-xs">
						<view class="overflow-one-lines">
							{{item.fSpmc}}
						</view>
						<view class="text-sm text-gray overflow-one-lines">
							规格：{{item.fMs}}
						</view>
						<view class="text-lg text-bold overflow-one-lines">
							￥{{item.fDj}}
						</view>
					</view>
					<view class="flex align-end">
						X {{item.fSl}}
					</view>
				</view>
				<!-- <u-divider></u-divider> -->
			</view>
			<view class="flex margin-top-lg w90">
				<view class="text-gray overflow-one-lines">
					订单编号：{{detailForm.fDddh}}
				</view>
			</view>
			<view class="flex  margin-top-sm w90">
				<view class="text-gray overflow-one-lines">
					备注信息：{{detailForm.fMjly}}
				</view>
			</view>
			<view class="flex margin-top-lg margin-bottom-lg justify-end">
				<view class="text-gray">
					<!-- 共3件商品 -->
					合计：
				</view>
				<view class="themeColor">
					￥{{detailForm.fDdje}}
				</view>
			</view>
		</view>

		<!-- 收货信息 -->
		<view class="contactsCardCss" v-if="detailForm.fShlxr">
			<view class="margin-top text-lg">
				收货信息
			</view>
			<view class="flex flex-direction margin-top-xs">
				<view class="flex justify-between align-center margin-top">
					<view class="text-gray w30">
						联系人
					</view>
					<view class="flex justify-end w70">
						{{detailForm.fShlxr}}
					</view>
				</view>
				<view class="flex justify-between align-center margin-top">
					<view class="text-gray">
						联系方式
					</view>
					<view class="flex justify-end w70">
						{{detailForm.fShlxrdh}}
					</view>
				</view>
				<view class="flex justify-between align-center margin-top">
					<view class="text-gray">
						联系地址
					</view>
					<view class="flex justify-end w70">
						{{detailForm.fShsf}} {{detailForm.fShs}} {{detailForm.fShq}} {{detailForm.fShjd}} {{detailForm.fShxxdz}}
					</view>
				</view>
			</view>
		</view>


		<view class="productCardCss">
			<view class="flex margin-top justify-between align-center">
				<view class=" text-lg">
					商品总价
				</view>
				<view class="themeColor text-xl">
					￥{{detailForm.fDdje}}
				</view>
			</view>
			<view class="flex flex-direction margin-top-xs">
				<view class="flex justify-between align-center margin-top">
					<view class="text-gray w30">
						订单编号
					</view>
					<view class="flex justify-end w70">
						{{detailForm.fDddh}}
					</view>
				</view>
				<view class="flex justify-between align-center margin-top">
					<view class="text-gray">
						下单时间
					</view>
					<view class="flex justify-end w70">
						{{detailForm.fCjsj}}
					</view>
				</view>
			<!-- 	<view class="flex justify-between align-center margin-top">
					<view class="text-gray">
						支付方式
					</view>
					<view class="flex justify-end w70">
						微信支付
					</view>
				</view> -->
				<view class="flex justify-between align-center margin-top">
					<view class="text-gray">
						提取方式
					</view>
					<view class="flex justify-end w70">
            {{detailForm.fPsfs}}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		components: {},
		props: {

		},
		data() {
			return {
				detailForm:{
					ddxq:[],
					fCzmc:'',
					fDdjg:'',
					fDdzt:'',
					fQpbh:'',
				}
			}
		},
		computed: {

		},
		async onLoad(options) {
			console.log('打印options',options);
			if(options.id){
				await this.getDetailInfo(options.id);
			}

		},
		methods: {
			async  getDetailInfo(id){
				let result = await this.$api.orderApi.getOrderDetail(id);
				console.log('打印getDetailInfo===result',result);
				let {
					code,
					value
				} = result;
				if(code == 200){
					this.detailForm = value;
					this.detailForm.ddxqList.map(async item =>{
						let JsonParse = JSON.parse(item.fTp);
						item.fTp = await this.$getPhotoUrl(JsonParse[0].response.fileId);
					});
				}

			},

		}
	}
</script>

<style lang="scss" scoped>
	.container{
		padding-bottom: 10px;
	}
	.topTitleCss {
		margin: 20px 10px;
	}

	.orderCard {
		margin: 10px;
		padding: 10px;
		background: #fff;
		border-radius: 15px;
	}

	.contactsCardCss {
		margin: 10px;
		padding: 10px;
		background: #fff;
		border-radius: 15px;
	}

	.productCardCss {
		margin: 10px;
		padding: 10px;
		background: #fff;
		border-radius: 15px;
	}
</style>
