<template>
	<view class="card">
		<view class="tit" @click.stop="goDetil(goodsInfo.id)">
			<view v-if="goodsInfo.status==0">取货点:&nbsp;&nbsp;{{goodsInfo.shop_name}}</view>
			<view v-else>收货人:&nbsp;&nbsp;{{ fuzzyName(goodsInfo.receiver_name) }}</view>
			<view style="float: right;">
				<u-icon name="arrow-right" color="black" size="20"></u-icon>
			</view>
		</view>
		<view class="content" @click="callFn(goodsInfo.shop_phone)">
			<view v-if="goodsInfo.status==0">
				<view class="address">店主姓名:&nbsp;&nbsp;{{goodsInfo.shop_user}}</view>
				<view @click.stop="callFn(goodsInfo.shop_phone)" class="address">
					联系电话:&nbsp;&nbsp; <u-icon style="display: inline-block;margin-left: 5rpx;" name="phone"
						color="#0122c7" size="22"></u-icon>
					<text>{{goodsInfo.shop_phone}}</text>
				</view>
				<view class="address">取货地址:&nbsp;&nbsp;{{goodsInfo.shop_address}}</view>
				<view class="address">通知日期:&nbsp;&nbsp;{{goodsInfo.create_time}}</view>
			</view>
			<view v-if="goodsInfo.status==1">
				<view class="address" @click.stop="callFn(goodsInfo.receiver_phone)">
					联系电话:&nbsp;&nbsp;<u-icon style="display: inline-block;margin-left: 5rpx;" name="phone"
						color="#FF7C32" size="22"></u-icon>{{goodsInfo.receiver_phone}}</view>
				<view class="address">收货地址:&nbsp;&nbsp;{{goodsInfo.receiver_address}}</view>
				<view class="address">通知日期:&nbsp;&nbsp;{{goodsInfo.qh_time}}</view>
			</view>
		</view>

		<view class="qh_btn" v-if='goodsInfo.status==0' @click.stop="goDetil(goodsInfo.id)">
			<u-button type="primary" class="custom-style" style="background-color: #0122C7;border: 0;">
				<u-icon v-if="!is_captain" name="scan" color="white" size="25" style="margin-right: 10rpx;"></u-icon>
				<text v-if="!is_captain">待取货/</text>点击查看</u-button>

		</view>
		<view class="" v-if='goodsInfo.status==1' @click.stop="goDetil(goodsInfo.id)">
			<u-button type="primary" style="background-color: #FF7C32; border: 0;"><u-icon v-if="!is_captain"
					name="car-fill" color="white" size="25" style="margin-right: 10rpx;"></u-icon> <text
					v-if="!is_captain">待配送/</text>点击查看</u-button>
		</view>
	</view>
</template>
<script>
	import {
		navigateTo
	} from '../../../libs/uniApi'
	export default {
		props: ['goodsInfo'],
		data() {
			return {
				is_captain: 0,
			}
		},

		mounted() {
			this.is_captain = JSON.parse(uni.getStorageSync("USER_INFO")).is_captain
		},
		methods: {
			fuzzyName(name) {
				let length = name.length;
				let fuzzyChars = "*".repeat(length - 1);
				return name[0] + fuzzyChars;
			},

			callFn(num) {
				uni.makePhoneCall({
					phoneNumber: num //仅为示例
				});
				// console.log(9999)
			},
			goDetil(id) {
				uni.navigateTo({
					url: `/pages/logistics/${this.goodsInfo.status==1?"logisticDetil":"deliveryDetil"}?id=${id}`,

				})
			}

		},

	}
</script>

<style lang="scss" scoped>
	.card {
		width: 92vw;
		height: AUTO;
		background-color: #fff;
		overflow: hidden;
		border-radius: 2vw;
		box-sizing: border-box;
		margin-bottom: 30rpx;

		.tit {
			border-bottom: 3px solid #F5F5F5;
			font-size: 30rpx;
			font-weight: bold;
			padding: 20rpx 15rpx;
			display: flex;
			justify-content: space-between
		}

		.content {
			padding: 20rpx 15rpx;

			.address {
				margin: 10rpx 0;



				// white-space: nowrap;
				// overflow: hidden;
				// text-overflow: ellipsis;
			}
		}

	}
</style>