<template>
	<view class="">

		<view class='page'>
			<view class='body'>
				<view class='order-no'>
					<view class='order-no-num flex-row'>
						<view class='order-no-num-left flex-grow-1'> 订单编号：{{order_info.order_no}} </view>
						<view @click='copyText(order_info.order_no)'
							class='order-no-num-right flex-grow-0 flex-y-center flex-x-center'
							:data-text='order_info.order_no'> 复制 </view>
					</view>
					<view class='order-add-time'>下单时间：{{order_info.create_time}} </view>
				</view>

				<view class='order-info'>
					<view class='order-info-item flex-row'>
						<view class='order-info-title flex-grow-1'> 商品总额 </view>
						<view class='order-info-val flex-grow-1'> {{order_info.integral}}积分 <block
								v-if='order_info.total_price > 0'>+ ¥ {{order_info.total_price}}</block>
						</view>
					</view>
					<view class='order-info-item flex-row'>
						<view class='order-info-title flex-grow-1'> 商品数量 </view>
						<view class='order-info-val flex-grow-1'>×1</view>
					</view>
					<view class='order-info-item flex-row'>
						<view class='order-info-title flex-grow-1'> 运费 </view>
						<view class='order-info-val flex-grow-1'> ¥ {{order_info.express_price}} </view>
					</view>
					<view class='order-info-item flex-row' v-if="order_info.remark">
						<view class='order-info-title flex-grow-1'> 备注 </view>
						<view class='order-info-val flex-grow-1'> {{order_info.remark}} </view>
					</view>

				</view>

				<view class='order-total-price'> 合计：
					<text style='color:#ff5c5c;'>{{order_info.integral}}积分</text>
				</view>

				<view class='order-goods flex-row'>
					<view class='flex-grow-0 goods-image'>
						<image :src='URL+order_info.thumb'></image>
					</view>
					<view class='flex-grow-1 flex-col'>
						<view class='flex-grow-1'>
							<view class='goods-name'>{{order_info.goods.name}}</view>
							<view class='attr-list flex-row'>
								¥：{{order_info.goods.price}}
							</view>
						</view>

						<view class='flex-grow-0 flex-row order-price'>
							<view class='flex-grow-1 num'>×1</view>
							<view class='flex-grow-0 price'>{{order_info.integral}}积分
							</view>
						</view>
					</view>
				</view>

			</view>
		</view>

		<view class="footer-bar">
			<view class="content flex flex-center" @click="hex" >
				<!-- <button class="btn" hover-class="none" form-type="submit"> -->
					确认核销
				<!-- </button> -->
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				URL: getApp().globalData.URL,
				page: 1,
				order_info: {
					create_time: "",
					order_no: "",
					address: '',
					name: "",
					mobile: "",
					express_no: "",
					total_price: "",
					integral: "",
					express_price: "",
				},
				qrcode: '',code:'',
				is_hide: false
			}
		},

		onLoad(e) {
			this.http(e.code);
			this.code=e.code;
		},

		methods: {
			copyText(e) {
				uni.setClipboardData({
					data: e,
					success: function() {
						console.log('success');
					}
				});
			},
			http(order_id) {
				this.request({
					url: "Smdcshop/ZtCode_info",
					data: {
						order_id: order_id,
					},
				}).then(res => {
					if (res.code == "200") {
						this.order_info = res.data;
					}
				}).catch((res) => {
					console.log(res, "666")
					uni.showToast({
						title: res.message,
						icon: 'none'
					})
				});
			},
			
			//请求详情
			hex() {
				this.request({
					url: "Smdcshop/ZtCode_Hx",
					data: {
						store_id: uni.getStorageSync("store_id"),
						admin_id: uni.getStorageSync("admin_id"),
						order_id: this.code,
					},
				}).then(res => {
					if (res.code == "200") {
						uni.showModal({
							title: '温馨提示',
							content: '核销成功',
							showCancel: false,
							confirmColor: "#000000",
							confirmText: '确定',
							success: (res) => {
								if (res.confirm) {
									uni.navigateBack()
								}
							},
							fail: () => {},
							complete: () => {}
						});
					}
				}).catch((res) => {
					console.log(res, "666")
					uni.showToast({
						title: res.message,
						icon: 'none'
					})
					setTimeout(()=>{
						uni.navigateBack()
					},2000)
				});
			},
		}
	}
</script>

<style>
	page {
		background: #F1F1F1;
	}

	.footer-bar {
		margin-top: 50rpx;
	}

	.footer-bar .content {
		    width: 600rpx;
		    margin: 0 auto;
		    background: #C9271B;
		    text-align: center;
		    height: 100rpx;
		    line-height: 100rpx;
		    color: #fff;
		    border-radius: 10px;
		    margin-top: 100rpx;
	}

	.popupModel {
		position: fixed;
		top: 0;
		left: 0;
		background: rgba(0, 0, 0, 0.5);
		width: 100%;
		height: 100%;
	}

	.popupModel image {
		width: 300rpx;
		height: 300rpx;
	}

	.model {
		width: 200rpx;
		height: 200rpx;
		background: #FFFFFF;
	}

	.code-btn {
		width: 600rpx;
		margin: 0 auto;
		background: #C9271B;
		text-align: center;
		height: 100rpx;
		line-height: 100rpx;
		color: #fff;
		border-radius: 100px;
		margin-top: 100rpx;
	}

	.order-status {
		font-size: 13pt;
		margin-bottom: 14rpx;
	}

	.order-time {
		font-size: 10pt;
	}

	.user-info-mobile {
		text-align: right;
	}

	.order-address {
		background-color: #ffffff;
		padding: 32rpx 24rpx;
		font-size: 11pt;
		color: #353535;
	}

	.user-address-info {
		padding-top: 19rpx;
	}

	.order-no {
		margin-top: 20rpx;
		padding: 32rpx 24rpx;
		font-size: 11pt;
		color: #353535;
		background-color: #ffffff;
	}

	.order-no-num-right {
		text-align: right;
		width: 74rpx;
		height: 44rpx;
		border: 1rpx solid #dddddd;
		border-radius: 5rpx;
		font-size: 7pt;
		color: #666666;
	}

	.order-add-time {
		margin-top: 20rpx;
	}

	.order-info-val {
		text-align: right;
	}

	.order-info {
		margin-top: 20rpx;
		padding: 12rpx 24rpx 32rpx 24rpx;
		background-color: #ffffff;
		font-size: 11pt;
		color: #353535;
	}

	.order-info-item {
		padding-top: 20rpx;
	}

	.order-total-price {
		border-top: 1rpx solid #e2e2e2;
		background-color: #ffffff;
		line-height: 96rpx;
		text-align: right;
		height: 96rpx;
		padding: 0 24rpx;
		color: #353535;
		font-size: 13pt;
	}

	.order-goods {
		margin-top: 20rpx;
		background-color: #ffffff;
		padding: 0 24rpx 30rpx 24rpx;
		color: #353535;
	}

	.goods-image image {
		width: 156rpx;
		height: 156rpx;
		margin-right: 26rpx;
		margin-top: 30rpx;
	}

	.goods-name {
		font-size: 11pt;
		margin-top: 32rpx;
		line-height: 1;
	}

	.attr-list {
		font-size: 9pt;
		line-height: 1;
		margin-top: 12rpx;
		margin-bottom: 5rpx;
	}

	.order-price {
		font-size: 10pt;
	}

	.order-footer {
		height: 98rpx;
		margin-top: 20rpx;
		border-top: 1rpx solid #e2e2e2;
		background-color: #ffffff;
		padding: 0 24rpx;
		text-align: right;
		justify-content: flex-end;
	}

	.play-btn {
		height: 64rpx;
		border: 1rpx solid #ff5c5c !important;
		color: #ff5c5c;
		border-radius: 10rpx;
		line-height: 64rpx;
		text-align: center;
		padding: 0 20rpx !important;
		margin: 0 !important;
		background-color: transparent !important;
	}

	button::after {
		content: normal;
	}

	.express-info {
		padding: 20rpx 24rpx;
		background-color: #ffffff;
		font-size: 11pt;
		color: #353535;
		margin-bottom: 20rpx;
	}

	.express-info-right image {
		width: 16rpx;
		height: 26rpx;
	}

	.express {
		margin-bottom: 20rpx;
	}

	.block {
		margin-top: 20rpx;
	}

	.block-row {
		padding-bottom: 20rpx;
	}
</style>
