
<template>
	
  <view class="container">
    
	<!-- 进度 -->
	<view class="stepcon">
		<u-steps :list="step" :current="current" mode="number" active-color="#3690ff"></u-steps>
	</view> 

    <!-- 配送单扫描区域 -->
    <view class="section">

      
      <view class="order-details">
		
		<!-- 存放地址 -->
		<view class="detail-header">
		  <view class="detail-title" style="width: 150rpx;"><text style="color: #fa3534;">*</text>存放地址</view>
		  <view class="detail-tip">
			  <view class="selarr" @click="showaddress()">
			  	<text class="txt" v-if="itemList.departCode">
			  	{{ retType(itemList.departCode,2)}} {{itemList.workshop}} {{itemList.location}} {{itemList.address}} </text>
				<text class="txt" v-else style="color:#999">请选择</text>
			  	<uni-icons type="right" size="20" color="#999"></uni-icons>
			  </view>
		  </view>
		</view>
		 <!-- 备注 -->
		<view class="detail-item" style="margin-top: 10rpx;">
		  <view class="item-label">备注</view>
		  <view class="item-value">
			  <u-input :border="true" :height="60" placeholder="请输入" input-align="left" v-model="itemList.remark" type="textarea" maxlength="500"></u-input>
		  </view>
		</view>
      </view>
	  
    </view>

    <!-- 托盘管理区域 -->
    <view class="section">
		
		<view class="section-header">
		  <text class="section-title">已添加工装托盘</text>
		  <text class="section-count">({{ palletData.length }})</text>
		</view>

		<uni-collapse  v-if="palletData.length > 0" class="pallet-list" :border="true">
		<u-checkbox-group class="checkBox" :wrap="true" @change="checkboxChange">
			<uni-collapse-item titleBorder="none" v-for="(pallet, index) in palletData" :key="index" :open="pallet.isOpen" class="pallet-card">
				<template v-slot:title>
					<view class="pallet-info">
					  <view class="pallet-number" @click="openPalletDetail(pallet)">{{ pallet.palletNo}}</view>
					  <view class="sright">
					  	<u-checkbox shape="square" :iconSize="30" :size="40" v-model="pallet.checked" :key="index">
							勾选接收
						</u-checkbox>
					  </view>
					</view>
				</template>
				<u-upload ref="uUpload" :auto-upload="false" upload-text='' :max-size="10 * 1024 * 1024" :max-count="3" :width="100" :height="100"
				:deletable="true" :source-type="sourceType" style="background-color: #ecf5ff;"
				@on-remove="onRemove($event,index)" @on-choose-complete="onChooseComplete($event,index)" :file-list="pallet.files">
				</u-upload>
			</uni-collapse-item>
		</u-checkbox-group>
		</uni-collapse>
		
		
		<view class="tpcon">
			<view class="input-group">
			  <view class="label">编号</view>
			  <view class="input-container">
			    <input
			      v-model="palletNo"
			      class="input-field"
			      placeholder="请输入"
			      maxlength="50"
			    />
				<view class="scan-btn" @click="scanPallet">
				  <uni-icons type="scan" size="20" color="#007AFF"></uni-icons>
				</view>
			  </view> 
			</view>
			<view class="add-pallet-btn" @click="addPallet">
			  <uni-icons type="plusempty" size="15" color="#fff"></uni-icons>
			  <view class="btn-text">添加</view>
			</view>
		</view>
		
	  
    </view>
	
    <!-- 底部操作栏 -->
    <view class="bottom-actions">
      <button class="action-btn complete-btn" @click="finishLoading">接收</button>
    </view>
	
	<!-- 提示窗示例 -->
	<uni-popup ref="alertDialog" type="dialog">
		<uni-popup-dialog :type="msgType" cancelText="关闭" confirmText="确定" title="消息" :content="messageText"></uni-popup-dialog>
	</uni-popup>
	
	<!-- 托盘详情 -->
	<u-popup v-model="showpl"  @close="closepl" mode="center" :mask="true" :closeable="true" :border-radius="20" close-icon-pos="top-right">
		<view class="ppcon">
			<psDetail :palletAll="palletAll"></psDetail>
		</view>
	</u-popup>
	
	<!-- 扫码组件 jsQR -->
	<!-- <scanQR ref="scan" @scanSuccess="scanSuccess"></scanQR> -->
	
	<!-- 扫码组件 html5-qrcode -->
	<scan-code ref="scan"></scan-code>
	
	<!-- 选择存放 -->
	<selXP ref="clsel" :clist="address" :cur="1" :value="itemList.id" @change="selXPDO" @cancel="cancelClDO"></selXP>
	
	<u-toast ref="uToast" />
	
  </view>
</template>


<script>
import psDetail from "@/components/psDetail.vue";
import selXP from "@/components/selXP.vue";

// 扫二维码 jsQR
// import scanQR from "@/components/scanQR.vue"; 

// 扫二维码 html5-qrcode
import scanCode from '@/components/easy-scancode/easy-scancode.vue'

// 图片处理
import EXIF from 'exif-js';
import Compressor from 'compressorjs';

export default {
	components: {
	  psDetail,
	  selXP,
	  // scanQR,
	  scanCode
	},
	data() {
		return {
			current:1,
			step:[
				{
					name:"转运",
					key:"ps",
				},
				{
					name:"接收",
					key:"js",
				},
			],
			sourceType:['album', 'camera'], // 选择图片的来源，album-从相册选图，camera-使用相机，默认二者都有（默认['album', 'camera']）
			palletNo:'',// 托盘编号
			palletAll:'', // 配送单信息
			pallet:{}, // 托盘信息
			palletData:[], // 接收托盘列表信息
			showpl: false,
			palletAll:"", // 托盘信息
			messageText: "",
			msgType: "info",//success error warn info
			// 闲置/装盘/配送/周转/接收/卸盘
			status:[
				{
					key:"xz",
					value:"闲置",
				},
				{
					key:"zp",
					value:"装盘",
				},
				{
					key:"ps",
					value:"配送",
				},
				{
					key:"zz",
					value:"周转",
				},
				{
					key:"js",
					value:"接收",
				},
				{
					key:"xp",
					value:"卸盘",
				}
			],
			itemList:{
				deliveryNo: '',// 配送单号
				remark: '',
				data: [],
				deliveryCar:'',// 车牌号
				departCode:"",
				workshop:"",
				location:"",
				address:"",
				id:"",
			},
			selids:[], // 选中托盘 
			address:[],
			
		};
	},
	onLoad(options) {
		// 获取操作数据
		this.getTypes();
	},
	methods: {
		// 选择接收地址
		showaddress(e) {
			this.$refs.clsel._show();
		},
		selXPDO(e){
			// 选择接收地址
			console.log(e);
			if(e){
				this.itemList.id=e.id?e.id:'';
				this.itemList.departCode=e.departCode?e.departCode:'';
				this.itemList.workshop=e.workshop?e.workshop:'';
				this.itemList.location=e.location?e.location:'';
				this.itemList.address=e.address?e.address:'';
			}
			else{
				this.itemList.id='';
				this.itemList.departCode='';
				this.itemList.workshop='';
				this.itemList.location='';
				this.itemList.address='';
			}
			this.$forceUpdate();
		},
		cancelClDO(e){
			// 取消选择接收
			console.log(e);
			this.$forceUpdate();
		},
		
		/**
		 * h5扫码返回
		*/
		scanSuccess(qrcode){
			console.log("qrcode",qrcode);
			this.palletNo=qrcode;
			this.$forceUpdate();
			this.getPalletDetail();
		},
		closepl() {
			this.showpl = false;
		},
		openpl() {
			this.showpl = true;
		},
		// 显示托盘详情
		async openPalletDetail(pallet) {
			if(pallet.palletNo){
				uni.showLoading({
					title: '数据加载中...'
				});
				const {data: res} = await uni.$http.get('/getPalletAll',{
					code: pallet.palletNo,
					type: '20'
				});
				if(res.success){ 
					if(res.data)
					{
						this.palletAll=res.data;
						this.$forceUpdate();
						// 打开托盘详情弹框
						this.openpl();
					}
				}
				else{
					this.$refs.uToast.show({
					  title: "暂无托盘详情信息！",
					  type: "warning",
					  duration: 3000,
					});
				}
			}
		},
		
		onChooseComplete(files,ii){
			// console.log("onChooseComplete")
			console.log(files)
			files.forEach((item,index)=>{ 
				//区分APP与H5不同端调用不同的方法
				// #ifdef APP-PLUS
					/**
					 * APP端图片压缩
					 *  参数说明：
					 *  img 图片url
					 *  scale缩放比例 1-100
					 *  callback 回调设置返回值 
					*/
				    var that = this;
				    this.translateapp(item.url, 60, imgUrl => {
					    // 打印压缩后返回的图片url
						console.log("imgUrl",imgUrl); 
						that.ploadFilePromiseSync(imgUrl,index,ii);
					});
				// #endif
								
				// #ifdef H5
				if(item.file){
					this.uploadAndCompressImage(item.file,index,ii);
				}
				// #endif
			});
		},
		translateapp(img, scale, callback) {
			plus.io.resolveLocalFileSystemURL(img, (entry) => { //通过URL参数获取目录对象或文件对象
				entry.file((file) => { // 可通过entry对象操作图片 
					console.log('压缩前图片信息:' + JSON.stringify(file)); //压缩前图片信息
					if (file.size > 504800) { //   如果大于500Kb进行压缩
						plus.zip.compressImage({ // 5+ plus.zip.compressImage 了解一下，有详细的示例
							src: img, //src: 压缩原始图片的路径    
							dst: img.replace('.png', 'yasuo.png').replace('.PNG',
									'yasuo.PNG').replace('.jpg', 'yasuo.jpg')
								.replace('.JPG', 'yasuo.JPG'),
							width: '40%', //dst: (String 类型 )压缩转换目标图片的路径，这里先在后面原始名后面加一个yasuo区分一下
							height: '40%', //width,height: (String 类型 )缩放图片的宽度,高度
							quality: scale, //quality: (Number 类型 )压缩图片的质量
							overwrite: true, //overwrite: (Boolean 类型 )覆盖生成新文件
							// format:'jpg'   //format: (String 类型 )压缩转换后的图片格式
						}, (event) => {
							console.log('压缩后图片信息:' + JSON.stringify(event)); 
							//返回压缩后的图片路径
							callback(event.target);
						}, function(err) {
							 console.log('Resolve file URL failed: ' + err.message);
						});
					} else { //else小于500kb跳过压缩，直接返回现有的src
						callback(img);
						
					}
				});
			}, (e) => { // 返回错误信息
				 console.log('Resolve file URL failed: ' + e.message);
			});
		},
		ploadFilePromiseSync(url,index,ii){
			var that = this;
			return new Promise((resolve, reject) => {
				// #ifdef APP-PLUS
				plus.io.resolveLocalFileSystemURL(url, (entry) => {
				entry.file((file) => {
				let fileReader = new plus.io.FileReader();
				
				fileReader.onloadend = (evt) => {
				const base64 = evt.target.result.substr(22)
				console.log("base64",base64)
				resolve(base64)
				that.palletData[ii].files[index]="data:image/png;base64"+base64;
				that.$forceUpdate();
				};
				
				fileReader.readAsDataURL(file)
				
				});
				
				}, (e) => {
				reject("Resolve file URL failed: " + e.message)
				
				});
				
				// #endif
			});
		},
		uploadAndCompressImage(file,index,ii) {
			var that = this;
			const promise = new Promise((resolve, reject) => { 
				// console.log(resolve, reject,Compressor)
				// console.log(Compressor)
		       const Compressor1 = new Compressor(file, {
		        quality: 0.6, // 压缩质量，范围是0-1
		        success: (compressedFile) => {
					// console.log("compressedFile",compressedFile)
		          // 读取压缩后的图片文件为base64
		          const reader = new FileReader();
		          reader.onload = (e) => {
		            const base64 = e.target.result;
					// console.log("base64",base64)
		            resolve(base64);
					that.palletData[ii].files[index]={
						url:base64
					};
					that.$forceUpdate();
					console.log("palletData",that.palletData)
		          };
		          reader.onerror = (error) => {
		            reject(error); 
		          };
		          reader.readAsDataURL(compressedFile);
		        },
		        error(err) {
					console.log(err)
		          reject(err);
		        },
		      }); 
			  console.log(Compressor1)
			  return Compressor1;
		    }); 
			console.log("promise",promise)
			return promise;
		},
		onRemove(index,ii) {
			console.log("onRemove",index,ii);
			delete this.palletData[ii].files[index];
			this.$forceUpdate();
		},
		 
		prviewImage(imgs,index) {
			if(imgs){
				uni.previewImage({
					urls: imgs,
					current: index
				});
			}
		},
		
		// 选中
		checkboxChange() {
			// this.selids=[];
			// this.palletList.forEach(cell=>{
			// 	if(cell.checked){
			// 		this.selids.push(cell.palletNo);
			// 	}
			// });
			// this.$forceUpdate();
			// console.log(this.selids);
		},
		dialogToggle(type) {
			this.msgType = type
			this.$refs.alertDialog.open()
		},
		// 折叠
		change(e) {
			console.log(e);
		}, 
		// 扫描托盘
		scanPallet(){
			var that = this;
			const _that = this;
			// #ifdef H5
			// 扫码识别托盘
			// _that.palletNo="XZG0005"; // XZG0004 XZG0005
			// _that.getPalletDetail();
			// this.$refs.scan.showScan();
			this.$refs.scan.start({
			    success: (val, res)=> {
			        console.log('扫描成功',val,res);
					_that.palletNo=val;
					_that.$forceUpdate();
					_that.getPalletDetail();
			    },
			    fail: (rej)=>{
			        console.log('扫描失败',rej);
					uni.showToast({
						title: '请在HTTPS环境下点击开启',
						icon: 'none',
						duration: 3000
					});
			    }
			})
			// #endif
			
			// #ifdef APP-PLUS
			// 允许从相机和相册扫码
			//qrCode,barCode
			// uni.scanCode({
			// 	scanType: ['qrCode', 'barCode'],
			// 	success: function(res) {
			// 		var xjbm=res.result;
			// 		_that.palletNo=res.result;
			// 		_that.getPalletDetail();
			// 	}
			// });
			var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
			mpaasScanModule.mpaasScan({
			    // 扫码识别类型，参数可多选，qrCode、barCode，不设置，默认识别所有
			    'scanType':  ['qrCode','barCode'],
			    // 是否隐藏相册，默认false不隐藏
			    'hideAlbum': false,
			    //ios需要设置这个参数，只支持中英文 zh-Hans、en，默认中文                       
			    'language' : 'en',
			    //相册选择照片识别错误提示(ios)
			    'failedMsg': '未识别到二维码，请重试',
			    //Android支持全屏需要设置此参数
			    'screenType': 'full' ,
			    'timeoutInterval':'10', //设置超时时间
			    'timeoutText':'未识别到二维码？' //超时提醒文本             
			},(ret) => {
				if(ret.resp_code==1000){
					// 扫码成功
					_that.palletNo=ret.resp_result;
					_that.getPalletDetail();
				}
			})
			// #endif
		},
		// 添加托盘
		addPallet(){
			if(!this.palletNo){
				this.$refs.uToast.show({
				  title: "请先输入托盘编号!",
				  type: "warning",
				  duration: 3000,
				});
			}
			else {
				this.getPalletDetail();
			}
		},
		async getPalletDetail(){
			if(!this.palletNo){
				this.$refs.uToast.show({
				  title: "托盘编码为空!请扫码添加托盘信息!",
				  type: "warning",
				  duration: 3000,
				});
				return false
			}
			
			var ifexit=0;
			this.palletData.forEach((item,index)=>{
				if(this.palletNo==item.palletNo){
					ifexit++;
				}
			});
			if(ifexit>0){
				this.$refs.uToast.show({
				  title: "托盘编码已存在!不可重复添加!",
				  type: "warning",
				  duration: 3000,
				});
				this.palletNo='';
				this.$forceUpdate();
				return false;
			}
			
			// 托盘详情
			uni.showLoading({
				title: '数据加载中...'
			});
			const {data: res} = await uni.$http.get('/getPallet',{palletNo:this.palletNo});
			if(res.success){
				if(res.data&&res.data.palletNo){
					var data =res.data;
					if(!data.files){
						data["files"]=[];
					}
					else{
						var files=[]
						data.files.forEach(item=>{
							files.push({
								url:item
							})
						});
						data.files=files;
					}
					var ifexit=0;
					this.palletData.forEach((item,index)=>{
						if(data.palletNo==item.palletNo){
							ifexit++;
						}
					});
					if(ifexit>0){
						this.$refs.uToast.show({
						  title: "托盘编码已存在!不可重复添加!请扫码重试!",
						  type: "warning",
						  duration: 3000,
						});
					}
					else{
						var palletadd={
							...data, isOpen: true,checked:true
						};
						this.palletData.push(palletadd);
						this.$forceUpdate();
					}
				}
				else{
					this.$refs.uToast.show({
					  title: "托盘获取失败!请重试!",
					  type: "warning",
					  duration: 3000,
					});
				}
			}
			else{
				this.$refs.uToast.show({
				  title: "托盘获取失败!请重试!",
				  type: "warning",
				  duration: 3000,
				});
			}
			this.palletNo='';
			this.$forceUpdate();
		},
		// 完成接收
		finishLoading(){
			console.log('完成接收');
			
			if(!this.itemList.departCode||!this.itemList.workshop||!this.itemList.location||!this.itemList.address){
				this.$refs.uToast.show({
				  title: "请选择正确的存放地址!",
				  type: "warning",
				  duration: 3000,
				});
				return false
			}
			
			var data=[];
			this.palletData.forEach((item,index)=>{
				if(item.checked){
					// 图片重新设置
					var files=[];
					item.files.forEach(item=>{
						files.push(item.url);
					});
					data.push({
						palletNo:item.palletNo,
						files:files
					})
				}
			});
			if(data.length<1){
				this.$refs.uToast.show({
				  title: "请选择托盘进行接收!",
				  type: "warning",
				  duration: 3000,
				});
				return false
			}
			this.itemList.data=data;
			console.log(this.itemList)
			uni.showModal({
				title: '提示',
				content: '确定要转运接收吗？',
				cancelText: '取消',
				confirmText: '确定',
				success: ress => {
					if (ress.confirm) {
						this.jsdo();
					}
					else{
						return false
					}
				}
			});
			
		},
		async jsdo(){
			uni.showLoading({
				title: '接收提交中...'
			});
			const {data: res} = await uni.$http.post('/sendReceiveData',this.itemList);
			if(res.success){
				this.$refs.uToast.show({
				  title: "转运接收成功！",
				  type: "success",
				  duration: 2000,
				});
				setTimeout(() => {
				  uni.navigateBack({
				    //返回
				    delta: 1,
				  });
				}, 3000);
			}
			else{
				this.$refs.uToast.show({
				  title: res.message? res.message:"转运接收失败！",
				  type: "warning",
				  duration: 3000,
				});
			}
		},
		
		getTypes() {
			//获取数据字典
			this.gcs=[];
			this.status=[];
			var commondata = uni.getStorageSync("commondata");
			if(commondata){
				var data = JSON.parse(commondata);
				if(data){
					this.users=data.users;
					this.dicts=data.dicts;
					this.depts=data.depts;
					// this.address=data.address;
					this.dicts.forEach(cell=>{
						if("PJCD"==cell.bmlb&&cell.zfbz!=='1'){
							// 工程
							this.gcs.push(cell);
						}
						if("TPZT"==cell.bmlb){
							// 托盘转运状态
							this.status.push(cell);
						}
					});
					this.$forceUpdate();
				}
			}
			else{
				this.users=[];
				this.dicts=[];
				this.depts=[];
				// this.address=[];
			}
			this.getList();
		},
		retType(type,str) {
			var rets = '';
			if(str==1){
				// 状态
				this.status.forEach((cell,idx)=>{
					if(type==cell.bm){
						rets=cell.bmsm;
						return;
					}
				});
				if(!rets){
					rets="其他"
				}
			}
			else if(str==2){
				// 部门
				this.depts.forEach((cell,idx)=>{
					if(type==cell.departCode){
						rets=cell.departName;
						return;
					}
				});
			}
			if(!rets){
				rets=type
			}
			return rets;
		},
		async getList() {
			const {data: res} = await uni.$http.get('/userAddr/myAddr');
			if(res.data&&res.data.length>0){
				this.address=res.data;
				this.$forceUpdate();
				if(this.address.length==1){
					var e=this.address[0];
					this.itemList.id=e.id?e.id:'';
					this.itemList.departCode=e.departCode?e.departCode:'';
					this.itemList.workshop=e.workshop?e.workshop:'';
					this.itemList.location=e.location?e.location:'';
					this.itemList.address=e.address?e.address:'';
					this.$forceUpdate();
				}
				 
			}
			else{
				this.address=[];
				this.$forceUpdate();
			}
		},
	}
}; 
 
</script>

<style lang="scss" scoped>
page {
  height: 100%;
  background-color: #f5f5f5;
}

.ppcon{
		width: calc(100vw - 60rpx);
		height: calc(100vh - 100rpx) !important;
		/* #ifdef H5 */
		height: calc(100vh - var(--window-top) - 100rpx) !important;
		/* #endif */
		overflow-y: auto;
	}
::v-deep .uni-collapse-item__wrap{
	background-color: #f9f9f9 !important;
}
::v-deep .uni-collapse-item__wrap-content.uni-collapse-item--border{
	border-bottom-width:0 !important;
}
::v-deep .uni-collapse-item__title-arrow{
	margin-right: 0 !important;
}
::v-deep .u-list-item{
	background-color: #ffffff !important;
}
 
::v-deep .u-checkbox-group{
	display: flex !important;
	flex-direction: column;
	width: 100%;
}

.new-data-box {
	width: calc(100vw - 80rpx);
	height: calc(100vh - 150rpx) !important;
	/* #ifdef H5 */
	height: calc(100vh - var(--window-top) - 150rpx) !important;
	/* #endif */ 
	margin-top: 50rpx;
}
.container {
  min-height: 100%;
  padding-bottom: 0;
  box-sizing: border-box;
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 88rpx;
  padding: 0 30rpx;
  background-color: #fff;
  position: relative;
  box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
}

.nav-left {
  width: 60rpx;
  height: 60rpx;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-title {
  font-size: 36rpx;
  font-weight: bold;
  color: #333;
}

.nav-right .complete-btn {
  font-size: 30rpx;
  color: #007aff;
}
.stepcon{
	margin: 20rpx;
}
.section {
  margin: 20rpx;
  background-color: #fff;
  border-radius: 16rpx;
  padding: 30rpx;
  box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
}

.tpcon{
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: center;
	padding:30rpx 20rpx;
	border: 4rpx dashed #ddd;
	border-radius: 16rpx;
	cursor: pointer;
	margin-bottom: 100rpx;
}

.input-group {
	display: flex;
	flex-direction: row;
	align-items: center;
	width: 100%;
}

.label {
  display: block;
  font-size: 30rpx;
  color: #333;
  margin-right: 10rpx;
}

.input-container {
  display: flex;
  flex:1;
  align-items: center;
  border: 2rpx solid #ddd;
  border-radius: 12rpx;
  padding: 10rpx 16rpx;
}

.input-field {
  flex: 1;
  font-size: 30rpx;
  color: #333;
}
.qd-btn{
	color:#007AFF;
}
.scan-btn {
  width: 60rpx;
  height: 60rpx;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hint {
  display: block;
  font-size: 24rpx;
  color: #999;
  margin-top: 10rpx;
}

.scan-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding:30rpx;
  border: 4rpx dashed #ddd;
  border-radius: 16rpx;
  cursor: pointer;
  margin-bottom: 100rpx;
  margin-top: 10rpx;
}

.scan-icon {
  margin-bottom: 20rpx;
}

.scan-title {
  font-size: 32rpx;
  color: #333;
  margin-bottom: 10rpx;
}

.scan-desc {
  font-size: 26rpx;
  color: #999;
}

.order-details {
  margin-top: 2rpx;
}

.detail-header {
	display: flex;
	flex-direction: row;
  padding-bottom: 20rpx;
  border-bottom: 2rpx solid #eee;
  margin-bottom: 20rpx;
  align-items: center;
}

.detail-title {
  font-size: 32rpx;
  font-weight: bold;
  color: #333;
  display: flex;
  margin-right: 20rpx;
}
.detail-tip {
  font-size: 28rpx;
  color: #666;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
  flex:1;
}
.selarr {
  width: 100%;
  height: 100%;
  line-height: 1;
  text-align: right;
  display: flex;
  flex-direction: row;
  align-items: center;
  .txt{
	  display: flex;
	  justify-content: flex-end;
	  flex: 1;
  }
}
.tip{
	display: flex;
	flex: 1;
	justify-content: flex-end;
	align-items: center;
	margin-right: 10rpx;
}
.detail-item {
  display: flex;
  align-items: center;
  margin-bottom: 15rpx;
}

.item-label {
  font-size: 28rpx;
  color: #666;
  width: 80rpx;
}

.item-value {
  font-size: 28rpx;
  color: #333;
  flex: 1;
}

.list-section {
  margin-top: 25rpx;
}

.list-title {
  font-size: 30rpx;
  font-weight: bold;
  color: #333;
  margin-bottom: 15rpx;
}

.list-item {
  padding: 15rpx 0;
  border-bottom: 1rpx solid #f0f0f0;
}
.devpicon{
	padding: 15rpx 0;
}
.item-text {
  font-size: 28rpx;
  color: #555;
}

.section-header {
  display: flex;
  align-items: center;
  margin-bottom: 25rpx;
}

.section-title {
  font-size: 32rpx;
  font-weight: bold;
  color: #333;
}

.section-count {
  font-size: 28rpx;
  color: #999;
  margin-left: 10rpx;
}

.pallet-list {
  margin-bottom: 30rpx;
}

.pallet-card {
  background-color: #f9f9f9;
  border-radius: 12rpx;
  padding: 20rpx;
  margin-bottom: 20rpx;
}

.pallet-info {
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  margin-bottom: 10rpx;
  margin-right: 10rpx;
}

.pallet-number {
  font-size: 30rpx;
  font-weight: bold;
  color: #333;
  display: flex;
  flex: 1;
}

.pallet-status {
  font-size: 24rpx;
  color: #999;
  padding: 5rpx 15rpx;
  border-radius: 20rpx;
  background-color: #f0f0f0;
  margin-right: 10rpx;
}

.pallet-status.status-zp{
  color: #4cd964;
  background-color: #f0faf4;
}
.pallet-status.status-ps{
  color: #e6a23c;
  background-color: #faecd8;
}
.pallet-status.status-zz{
  color: #6366F1;
  background-color: #E0E7FF;
}
.pallet-status.status-js{
  color: #8B5CF6;
  background-color: #EDE9FE;
}
.pallet-status.status-xp{
  color: #EC4899;
  background-color: #FDF2FB;
}

.pallet-materials {
  margin-bottom: 10rpx;
}

.material-text {
  display: block;
  font-size: 26rpx;
  color: #666;
  margin-bottom: 5rpx;
}

.pallet-time {
  text-align: right;
}

.time-text {
  font-size: 24rpx;
  color: #999;
}

.add-pallet-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80rpx;
  background-color: #007aff;
  border-radius: 12rpx;
  color: #fff;
  font-size: 28rpx;
  cursor: pointer;
  width: 140rpx;
  margin-left: 10rpx;
}

.btn-text {
  margin-left: 2rpx;
}

.bottom-actions {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  padding: 20rpx 30rpx;
  background-color: #fff;
  border-top: 2rpx solid #eee;
  box-sizing: border-box;
}

.image-grid {
	  display: grid;
	  grid-template-columns: repeat(3, 1fr);
	  gap: 20rpx;
	  padding: 10rpx 0;
	}
	
	.image-item {
	  border-radius: 12rpx;
	  overflow: hidden;
	  aspect-ratio: 1;
	}
	
	.image {
	  width: 100%;
	  height: 100%;
	}
	
.action-btn {
  flex: 1;
  height: 80rpx;
  border-radius: 12rpx;
  font-size: 32rpx;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
}

.continue-btn {
  background-color: #007aff;
  color: #fff;
  margin-right: 20rpx;
}

.complete-btn {
  background-color: #4cd964;
  color: #fff;
}

</style>

