zhengkaixin 2 gadi atpakaļ
vecāks
revīzija
d9ddcb4271

+ 0 - 197
apis/common.js

@@ -1,197 +0,0 @@
-import request from '@/apis/utils/request'
- 
-import Qs from 'qs';
-
-export function uploadPicture(formData) {
-	return request({
-		url: '/uploadPicture',
-		header:{
-			   'Content-Type': 'application/x-www-form-urlencoded'
-
-		},
-		data: formData,
-		method: 'post',
-		
-	})
-}
-
-
-export function getBannerInfo(formData) {
-	return request({
-		url: '/mobile/bannerInfo/getBannerInfo',
-		data: formData,
-		method: 'post',
-		
-	})
-}
-export function readMessageNum() {
-	return request({
-		url: '/mobile/messageApi/readMessageNum',
-		//data: formData,
-		method: 'post',
-		
-	})
-}
-
-export function getScreenList(formData) {
-	return request({
-		url: '/mobile/recruitmentApi/getScreenList',
-		data: formData,
-		method: 'post',
-		
-	})
-}
-
-//字典表
-export function getData(id) {
-	return request({
-		url: '/sys/dataDictionary/queryChildrenApi',
-		data: {
-			parentId:id
-		},
-		method: 'post',
-		timeout: 60000,
-	})
-}
-//上传图片
-export function upload(formData) {
-	return request({
-		url: '/mobile/jobUserApi/upload',
-		data: formData,
-		method: 'post',
-		
-	})
-}
-
-//上传图片
-export function uploadBase64(formData) {
-	var localData = formData.photoFile?formData.photoFile:formData.photoBase64Data;
-	
-	if (localData.indexOf('data:image') != 0) {
-	    //判断是否有这样的头部
-	    localData = 'data:image/jpeg;base64,' + localData
-	}
-	formData.photoBase64Data = localData.replace(/\r|\n/g, '').replace('data:image/jgp', 'data:image/jpeg')
-	
-	
-	return request({
-		url: '/mobile/jobUserApi/uploadBase64',
-		data: formData,
-		method: 'post',
-		timeout: 60000,
-	})
-}
-
-
-export function getSchoolServeList(params) {
-	return request({
-		url: '/mobile/companyInfoApi/schoolServeList',
-		data: Qs.stringify(params),
-		method: 'post',
-	})
-}
-
-
-
-//综合订单
-export function mergeInfo(id) {
-	return request({
-		url: '/mobile/passengerApi/mergeInfo',
-		data: Qs.stringify({
-			outOrderNo: id
-		}),
-		method: 'post',
-	})
-}
-//发送短信
-export function sendMsg(params) {
-	return request({
-		url: '/mobile/personInfoApi/getVerifyCode',
-		data: Qs.stringify(params),
-		method: 'post',
-	})
-}
-
-//验证验证码并登录
-export function validateCode(params) {
-	return request({
-		url: '/mobile/personInfoApi/validateCode',
-		data: Qs.stringify(params),
-		method: 'post',
-	})
-}
-
-//验证验证码并登录
-export function submitAuthentication(params) {
-	return request({
-		url: '/mobile/jobUserApi/submitAuthentication',
-		data: Qs.stringify(params),
-		method: 'post',
-	})
-}
-
-
-export function messageClassify(formData) {
-	return request({
-		url: '/mobile/messageApi/messageClassify',
-		data: formData,
-		method: 'post',
-		
-	})
-}
-
-export function messageList(formData) {
-	return request({
-		url: '/mobile/messageApi/messageList',
-		data: formData,
-		method: 'post',
-		
-	})
-}
-
-
-export function messageDetail(id) {
-	return request({
-		url: '/mobile/messageApi/messageDetail',
-		data: Qs.stringify({
-			messageId: id
-		}),
-		method: 'post',
-	})
-}
-
-export function messageClassifyHR(formData) {
-	return request({
-		url: '/mobile/messageApi/messageClassifyHR',
-		data:formData,
-		method: 'post',
-	})
-}
-
-
-export function changeAgree(formData) {
-	return request({
-		url: '/mobile/messageApi/changeAgree',
-		data:formData,
-		method: 'post',
-	})
-}
-
-
-//推荐简历
-export function positionResumeList(formData) {
-	return request({
-		url: '/mobile/resumeApi/positionResumeList',
-		data:formData,
-		method: 'post',
-	})
-}
-
-//推荐职位
-export function positionRecruitmentList(formData) {
-	return request({
-		url: '/mobile/recruitmentApi/positionRecruitmentList',
-		data:formData,
-		method: 'post',
-	})
-}

+ 11 - 0
apis/pagejs/storeManagement.js

@@ -62,3 +62,14 @@ export function inRecordDetail(data) {
 		url: url
 	})
 }
+
+//recordId
//deviceData: recordDeviceId deviceId remark status imgUrls
+export function saveRecordIn(data) {
+	var url = 'mobile/in/saveRecordIn';
+	return request({
+		method: 'post',
+		data: data,
+		url: url
+	})
+}
+

+ 0 - 20
apis/utils/AMap.js

@@ -1,20 +0,0 @@
-export default function MapLoader() {
-
-	return new Promise((resolve, reject) => {
-		 
-		if (window.AMap) {
-			resolve(window.AMap)
-		} else {
-//			console.log("map")
-			var script = document.createElement('script')
-			script.type = 'text/javascript'
-			script.async = true
-			script.src = 'https://webapi.amap.com/maps?v=1.4.15&callback=initAMap&key=de735ff06aec63f6bc109c9fb805fc3d'
-			script.onerror = reject
-			document.head.appendChild(script)
-		}
-		window.initAMap = () => {
-			resolve(window.AMap)
-		}
-	})
-}

+ 0 - 31
apis/utils/alipay.js

@@ -1,31 +0,0 @@
-function onBridgeReady(params) {
-	AlipayJSBridge.call("tradePay", {
-		tradeNO: params.tradeNo,
-	}, function(result) {
-		if (result.resultCode == '9000') {
-			location.href = params.succUrl
-		} else {
-			location.href = params.cancelUrl;
-		}
-		//alert(JSON.stringify(result));
-	});
-}
-
-export const aliPayJs = (params) => {
-	if (typeof window.WeixinJSBridge === 'undefined') {
-		if (document.addEventListener) {
-			document.addEventListener('AlipayJSBridgeReady', function() {
-				onBridgeReady(params)
-			}, false)
-		} else if (document.attachEvent) {
-			document.attachEvent('AlipayJSBridgeReady', function() {
-				onBridgeReady(params)
-			})
-			document.attachEvent('AlipayJSBridgeReady', function() {
-				onBridgeReady(params)
-			})
-		}
-	} else {
-		onBridgeReady(params)
-	}
-}

+ 0 - 45
apis/utils/initALI.js

@@ -1,45 +0,0 @@
-import carhelp from '@/apis/utils/mixin.js'
-import * as API_WeiXin from '@/apis/weixin.js'
-
-import {
-	getUrlParam,
-	getAlipayRedirectURI,
- 
-} from '@/apis/utils'
-var checkOpenId = true; //是否需要获取openId
-var openId = carhelp.getOpenIdALI();
-
-var app = {
-	init: function() {
-		 
-		if (!openId) {
-			this.getOpenId();
-		} 
-		
-		
-	},
-	
-	getOpenId() {
-		
-		const code = getUrlParam('auth_code');
-		var openId= carhelp.getOpenIdALI()
-		
-		if (!openId) {
-			if (!code) {
-				
-				var authUrl = document.URL//.replace('pages/parking/search', 'pages/parking/auth');
-				window.location.href = getAlipayRedirectURI(process.car.VUE_APP_ALIAPPID, authUrl );
-			} else {
-				
-				API_WeiXin.getDataByCodeALI(code).then(response => {
-					
-					carhelp.setOpenIdALI(response.data.openid)
-					 location.reload();
-				}).catch(error => {
-					console.log(error);
-				});
-			}
-		}
-	}
-}
-module.exports = app

+ 0 - 236
apis/utils/wxJsApi.js

@@ -1,236 +0,0 @@
-import wx from 'weixin-js-sdk'
-import * as API_WeiXin from '@/apis/weixin.js'
-import * as API_Common from '@/apis/common.js'
-
-import Qs from 'qs';
-import request from './request.js'
-export function addSysLog(message) {
-
-	return request({
-		url: '/mobile/sysLogApi/submit',
-		data: Qs.stringify({
-			message: JSON.stringify(message)
-		}),
-		method: 'post',
-	})
-}
-//获取微信配置
-export function getWxConfig(jsApiList) {
-	var jsApiList = jsApiList || ['chooseImage', 'getLocalImgData', 'scanQRCode','openLocation'];
-	 
-	let promise = (jsApiList => {
-		return new Promise((resolve, reject) => {
-//			console.log(jsApiList);
-			API_WeiXin.getConfig().then(response => {
-				var wxconfig = response.data.wxConfig;
-			
-				wx.config({
-					debug: false, // 开启调试模式,
-					appId: wxconfig.appId, // 必填,企业号的唯一标识,此处填写企业号corpid
-					timestamp: wxconfig.timestamp, // 必填,生成签名的时间戳
-					nonceStr: wxconfig.nonceStr, // 必填,生成签名的随机串
-					signature: wxconfig.signature, // 必填,签名,见附录1
-					jsApiList: jsApiList, // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
-					openTagList:['wx-open-subscribe']
-				});
-				wx.ready(function() {
-					resolve(response.data);
-				})
-				wx.error(function(res) {
-					reject('微信api配置出错');
-				});
-			}).catch(error => {
-				//mui.toast(error);
-				reject(error);
-			})
-		})
-	})(jsApiList)
-
-	return promise;
-}
-
-//选择图片,多图上传和单图上传的回调处理不一样
-export function chooseImage(count,islocalId) {
-	var count = count || 1;
-	let promise = new Promise((resolve, reject) => {
-		wx.chooseImage({
-			count: count,
-			sizeType: ['compressed'],
-			sourceType: ['album', 'camera'],
-			success: function(res) {
-				 
-				var localIds = res.localIds;
-				
-				if(islocalId){
-					
-					resolve(localIds);
-				}else{
-					if (count == 1) {
-						wx.getLocalImgData({
-							localId: localIds[0],
-							success: function(res) {
-								resolve(res);
-							}
-						});
-					} else {
-						resolve(localIds);
-					}
-				}
-				
-			}
-		});
-	});
-	return promise;
-}
-
-
-
-
-//获取图片,用于多图上传时的递归处理
-export function getLocalImgData(localId, fun) {
-	wx.getLocalImgData({
-		localId: localId,
-		success: function(res) {
-			fun(res);
-		}
-	});
-}
-
-//上传图片
-export function uploadPic(imgBase64) {
-	let promise = new Promise((resolve, reject) => {
-		var formData = new FormData();
-		formData.append('photoName', '1.jpg');
-		formData.append('photoBase64Data', imgBase64);
-
-	
-		API_Common.uploadBase64(formData).then(response => {
-			resolve(response);
-		}).catch(error => {
-			//mui.toast(error);
-			reject(error);
-		})
-	});
-	return promise;
-}
-
-//获取坐标
-export function getLocation() {
-	if(process.env.NODE_ENV === "development" && process.car.SIMPLE_RUN){
-		
-		let promise =new Promise((resolve, reject) => {
-			var obj= {
-			longitude:112.28541,
-			latitude:30.308354,
-			errMsg:"getLocation:ok"
-			}
-			resolve(obj);
-		})
-		return promise
-	}
-	let promise = new Promise((resolve, reject) => {
-		
-		wx.ready(function() {
-			wx.getLocation({
-				type: 'gcj02', // 默认为wgs84的gps坐标,可传入'gcj02'
-				success: function(res) {
-					resolve(res);
-				},
-				faile: function(res) {
-					reject(res);
-				},
-				fail: function(res) {
-					if (res.errMsg == 'getLocation:timeout') {
-						
-						res="定位超时,请检查是否开启'定位'"
-					} else if (res.errMsg == 'getLocation:ERROR_NETWORK') {
-						//mui.alert("网络异常");
-						res="定位超时,请检查是否开启'定位'"
-					} else if (res.errMsg == 'getLocation:ERROR_NOCELL&WIFI_LOCATIONSWITCHOFF') {
-						res="没开启系统定位"
-						//mui.alert("没开启系统定位");
-					} else if (res.errMsg == 'getLocation:system permission denied') {
-						res="未给微信位置授权"
-						//mui.alert("未给微信位置授权");
-					} else if (res.errMsg == 'getLocation:location permission') {
-						res="未给微信位置授权"
-						//mui.alert("未给微信位置授权");
-					} else if (res.errMsg == 'getLocation:auth denied') {
-						res="用户在小程序中未授权"
-						//mui.alert("用户在小程序中未授权");
-					} else if (res.errMsg == 'getLocation:fail authorize no response') {
-						res="用户在小程序中未授权"
-						//mui.alert("用户在小程序中未授权");
-					} else if (res.errMsg == 'getLocation:gps closed') {
-						res="用户已取消定位"
-						//mui.alert("用户已取消定位");
-					}
-					reject(res);
-				},
-				complete() {}
-			})
-		})
-	})
-	return promise;
-}
-
-//扫描二维码
-export function scanQRCode(needResult,obj) {
-	var needResult = needResult || 1;
-	let promise = new Promise((resolve, reject) => {
-		wx.scanQRCode({
-			needResult: needResult,
-			scanType: ["qrCode"],
-			success: function(res) {
-				var url = res.resultStr;
-				resolve(url);
-			},
-			faile: function(res) {
-				reject(res);
-			},
-			
-			fail: function(res) {
-
-				reject(res);
-			},
-			complete() {
-				if(obj){
-					obj.showLoading(false)	
-				}
-			}
-		})
-	});
-	return promise;
-}
-
-export function requestSubscribeMessage(sz) {
-	 
-	let promise = new Promise((resolve, reject) => {
-		wx.ready(function() {
-			wx.requestSubscribeMessage({
-			
-			tmplIds: sz,
-			
-				success(res) { 
-						resolve(res);
-				}
-				
-			})
-		})
-		
-
-	});
-	return promise;
-}
-
-
-
-
-//扫描二维码
-export function openLocation(obj) {
- 
-	let promise = new Promise((resolve, reject) => {
-		wx.openLocation(obj)
-	});
-	return promise;
-}

+ 0 - 52
apis/utils/wxpay.js

@@ -1,52 +0,0 @@
- 
-function onBridgeReady(params) {
-	console.log("onBridgeReady+"+new Date().getTime())
-	
-	uni.showLoading({
-		mask:true,title:'加载中...'
-	})
-	//记录要回跳的url
-	window.WeixinJSBridge.invoke(
-		'getBrandWCPayRequest', {
-			'appId': params.appId, // 公众号名称,由商户传入
-			'timeStamp': params.timeStamp, // 时间戳,自1970年以来的秒数
-			'nonceStr': params.nonceStr, // 随机串
-			'package': params.package,
-			'signType': params.signType, // 微信签名方式:
-			'paySign': params.paySign // 微信签名
-		},
-		(res) => {
-			//alert(JSON.stringify(res)); // 支付取消会执行 支付成功不会
-			if (res.err_msg == 'get_brand_wcpay_request:ok') {
-				//alert("支付成功") // 不会执行
-				//window.location.href = params.url
-			} else if (res.err_msg == "get_brand_wcpay_request:cancel") {
-				//alert("支付取消") // 会执行
-				 uni.hideLoading();
-			} else {
-				 uni.hideLoading();
-			}
-		}
-	)
-}
-
-export const wxPayJs = (params) => {
-	console.log("wxPayJs+"+new Date().getTime())
-	
-	if (typeof window.WeixinJSBridge === 'undefined') {
-		if (document.addEventListener) {
-			document.addEventListener('WeixinJSBridgeReady', function() {
-				onBridgeReady(params)
-			}, false)
-		} else if (document.attachEvent) {
-			document.attachEvent('WeixinJSBridgeReady', function() {
-				onBridgeReady(params)
-			})
-			document.attachEvent('onWeixinJSBridgeReady', function() {
-				onBridgeReady(params)
-			})
-		}
-	} else {
-		onBridgeReady(params)
-	}
-}

+ 0 - 15
apis/weixin.js

@@ -1,6 +1,4 @@
 import request from '@/apis/utils/requestWhite'
-import requestWhite from '@/apis/utils/requestWhite.js';
-// import requestAli from '../utils/requestParking.js';
  
 
 
@@ -21,16 +19,3 @@ export function findAppletUserInfo(code) {
 		method: 'get',
 	})
 }
-
-
-
-//获得配置
-export function getConfig() {
-	return requestWhite({
-		url: '/wechat/getConfig',
-		data: {
-			url: window.location.href.split('#')[0]
-		},
-		method: 'get',
-	})
-}

BIN
assets/img/暂无数据-缺省页.png


+ 1 - 1
components/equipmentRetrieval.vue

@@ -209,7 +209,7 @@
 					
 				}else{
 					uni.navigateTo({
-						url:"./equipmentDetail?id="+item.id
+						url:"./equipmentDetail?name="+item.title
 					})
 				}
 			},

+ 1 - 1
main.js

@@ -1,7 +1,7 @@
 import App from './App'
 import Vue from 'vue'
 import getOpenId from './apis/utils/init.js'
-import getALIOpenId from './apis/utils/initALI.js'
+//import getALIOpenId from './apis/utils/initALI.js'
 import './assets/font/font.css'
 // var IS_WEIXIN = /MicroMessenger/.test(window.navigator.userAgent)
 // var IS_ALI = /AlipayClient/.test(window.navigator.userAgent)

+ 16 - 22
pages/otherFunctions/equipmentRetrieval/equipmentDetail.vue

@@ -1,10 +1,10 @@
 <template>
 	<view>
-		<u-navbar title="接地线无杆(新)"></u-navbar>
+		<u-navbar :title="info.title"></u-navbar>
 		<!-- 图片 -->
 		<view class="picture">
-			<img :src="info.img" alt="">
-			<view class="amount">
+			<img :src="info.imgUrl" alt="">
+			<view class="amount" v-if="false">
 				<text>1</text>/
 				<text>5</text>
 			</view>
@@ -12,10 +12,10 @@
 		<!-- 信息 -->
 		<view class="main">
 			<view class="title">
-				接地线无杆(新)
+				{{info.title}}
 			</view>
 			<!-- 标签 -->
-			<view class="tabs ">
+			<view class="tabs " v-if="false">
 				<u-tabs bar-width="120" inactive-color="#999999" active-color="#000000"   :list="list" :is-scroll="false" :current="current" @change="change"></u-tabs>
 			</view>
 			<view class="content">
@@ -34,7 +34,7 @@
 								规格
 							</view>
 							<view class="item-value">
-								220kV
+								{{info.specifications}}
 							</view>
 						</view>
 						
@@ -43,7 +43,7 @@
 								购置时间
 							</view>
 							<view class="item-value">
-								2022.5
+								{{info.buyTime}}
 							</view>
 						</view>
 						<view class="item" >
@@ -51,23 +51,16 @@
 								数量
 							</view>
 							<view class="item-value">
-								48
-							</view>
-						</view>
-						<view class="item" >
-							<view class="item-title">
-								设备状况
-							</view>
-							<view class="item-value">
-								合格
+								{{info.count}}
 							</view>
 						</view>
+						
 						<view class="item" >
 							<view class="item-title">
 								单位
 							</view>
 							<view class="item-value">
-								
+								{{info.unit}}
 							</view>
 						</view>
 						<view class="item" >
@@ -75,7 +68,7 @@
 								试验时间
 							</view>
 							<view class="item-value">
-								2022.05.19
+								{{info.experimentLastTime}}
 							</view>
 						</view>
 						<view class="item" >
@@ -83,7 +76,7 @@
 								制造厂家
 							</view>
 							<view class="item-value">
-								鸿瑞电力工程有限公司
+								{{info.manufactor}}
 							</view>
 						</view>
 						<view class="item" >
@@ -91,7 +84,7 @@
 								试验周期
 							</view>
 							<view class="item-value">
-								1年
+								{{info.experimentPeriod?info.experimentPeriod+'年':''}}
 							</view>
 						</view>
 						<view class="item" >
@@ -99,7 +92,7 @@
 								单价
 							</view>
 							<view class="item-value">
-								无
+								{{info.unitPrice?info.unitPrice+'元':''}}
 							</view>
 						</view>
 					</view>
@@ -118,7 +111,7 @@
 					
 					<view class="details">
 						<view class="location">
-							荆力总包仓库A区C货架2-12
+							{{info.addressName}}
 						</view>
 					</view>
 					
@@ -304,6 +297,7 @@
 					name:this.name
 				}).then((res) => {
 					uni.hideLoading();
+					this.info=res.data.deviceInfo;
 				}).catch(error => {
 					uni.showToast({
 						title: error,

+ 625 - 58
pages/storeManagement/equipmentEnter/deliveryDetails.vue

@@ -42,77 +42,164 @@
 			</view>
 
 		</view>
-		<!-- 出库设备清单 -->
-		<view class="list">
-			<view class="list-head">
-				<view class="title">
-					出库设备清单
-				</view>
-				<view class="amount">
-					全部 <text>{{deviceInfoList.length}}</text> 件设备
-					<!-- <u-icon name="arrow-right"></u-icon> -->
-				</view>
-			</view>
-			<!-- 清单信息 -->
-			<view class="list-infos" v-for="(item,i) in deviceInfoList" :key="i" >
-				<view class="infos-head">
-					<view class="name">
-						{{item.title}}
-					</view>
-					<view class="state" v-if="false">
-						 <text>2</text>
-					</view>
-				</view>
-				<view class="infos">
-					<view class="infos-1">
-						<view class="infos-item">
-							<view class="item-name">
-								编号:
+		
+				<u-popup  v-model="showpopup" class=""  mode="bottom" 
+		border-radius="14"
+		:closeable="true" >
+					<view class="scantitle">连续扫码</view>
+					<view class="list">
+					<view class=" list-infos">
+						<view class="infos-head">
+							<view class="name">
+								{{nowscan.title?nowscan.title:'扫码后出当前结果'}}
 							</view>
-							<view class="item-value">
-								{{item.code}}
+						
+							<view class="name">
+								编号:{{nowscan.code}}
 							</view>
 						</view>
-						<view class="infos-item">
-							<view class="item-name">
-								单位:
+						<view class="infos">
+							<view class="infos-1">
+								<view class="infos-item">
+									<view class="item-name">
+										厂家:
+									</view>
+									<view class="item-value">
+										{{nowscan.manufactor}}
+									</view>
+								</view>
+								<view class="infos-item">
+									<view class="item-name">
+										单位:
+									</view>
+									<view class="item-value">
+										{{nowscan.unit}}
+									</view>
+								</view>
 							</view>
-							<view class="item-value">
-								{{item.unit}}
+							<view class="infos-2">
+								<view class="infos-item">
+									<view class="item-name">
+										规格:
+									</view>
+									<view class="item-value">
+										{{nowscan.specifications}}
+									</view>
+								</view>
+								<view class="infos-item">
+									<view class="item-name">
+										型号:
+									</view>
+									<view class="item-value">
+										{{nowscan.model}}
+									</view>
+								</view>
 							</view>
+						
+						</view>
 						</view>
 					</view>
-					<view class="infos-2">
-						<view class="infos-item">
-							<view class="item-name">
-								规格:
-							</view>
-							<view class="item-value">
-								{{item.specifications}}
+					
+					<!--  #ifdef  MP-WEIXIN -->
+					<camera mode="scanCode"   resolution='medium' 
+					 @scancode="takeCode"  v-if="showpopup"
+					 device-position="back" flash="off" @error="error"
+					 style="width: 100%; height: 300px;"></camera>
+					<!--  #endif -->
+				</u-popup>
+		<!-- 出库设备清单 -->
+		<view class="container">
+			<view class="main">
+				<view class="list-item" v-for="(item,index) in deviceInfoList" :key="index">
+					<!--信息 -->
+					<view class="list-infos">
+						<view class="infos-head">
+							<view class="name">
+								{{item.deviceInfo.title}}
 							</view>
+							<template v-if="info.status==0">
+							
+								<view class="qr-code" v-if="deviceReList[index].deviceIdScan==0"  @click="gotoscan('')">
+									<text><u-icon name="scan"></u-icon></text>
+									<text>扫码核验</text>
+								</view>
+								<view class="qr-code2" v-else    @click="gotoscan('')" >
+									<text><u-icon name="checkmark-circle" color="#45BA45" ></u-icon></text >
+									<text>已收到</text>
+								</view>
+							</template>
 						</view>
-						<view class="infos-item">
-							<view class="item-name">
-								型号:
+						<view class="infos">
+							<view class="infos-1">
+								<view class="infos-item">
+									<view class="item-name">
+										型号:
+									</view>
+									<view class="item-value">
+										{{item.deviceInfo.model}}
+									</view>
+								</view>
+		
 							</view>
-							<view class="item-value">
-								{{item.model}}
+							<view class="infos-2">
+								<view class="infos-item">
+									<view class="item-name">
+										设备编号:
+									</view>
+									<view class="item-value">
+										{{item.deviceInfo.code}}
+									</view>
+								</view>
+		
 							</view>
+		
 						</view>
+		
+					</view>
+					<view class="receive-options">
+						<view class="title">
+							是否收到
+						</view>
+						<view class="receive-radio">
+							<u-radio-group v-model="deviceReList[index].status" @change="radioGroupChange">
+								<u-radio @change="radioChange" v-for="(radio, index2) in radiolist" :key="index2"
+									:name="radio.value" :disabled="radio.disabled">
+									{{radio.name}}
+								</u-radio>
+							</u-radio-group>
+						</view>
+					</view>
+					<!-- 备注 -->
+					<textarea class="uni-textarea" v-model="deviceReList[index].remark" placeholder="备注" name="" id="" cols="30" rows="10"></textarea>
+				
+				<!-- 上传图片 -->
+					<view class="upload-img" v-if="info.status=='0'">
+						<u-upload width="144" height="144" :ref="'uUpload'+index" 
+						 :key="2"
+						 name="photoFile" :multiple="false"
+						 :form-data="formData" :header="header" :action="action"
+						 max-count="4"  upload-text=" " del-bg-color="#0051FF"  ></u-upload>
+					</view>
+					<view class="upload-img" v-else >
+						<u-upload width="144" height="144"  :key="1"
+						 v-if="deviceReList[index].imgUrls"
+						 :fileList="deviceReList[index].imgUrls.split(',').map(item=>{return {url:item,view:1}})"
+						 name="photoFile" :multiple="false" :deletable="false"
+						
+						 max-count="0"  upload-text=" " del-bg-color="#0051FF"  ></u-upload>
 					</view>
-
 				</view>
-
+		
+				
 			</view>
-
 		</view>
 		
     </view>
-	<view class="bottom"  >
-		
-		<u-button  type="primary"  @click="gotoOut()" >确认归还</u-button>
-		
-	</view>
+		<view class="bottom" v-if="info.status==0" >
+			
+			<u-button  type="primary"  @click="gotoOut()" >确认归还</u-button>
+			
+		</view>
 	</view>
 </template>
 
@@ -125,6 +212,39 @@
 	export default {
 		data() {
 			return {
+				nowscan:{
+					"title": "",
+					"specifications": "",
+					
+					"manufactor": "",
+					"unit": "",
+					"model": "",
+					"code": "",
+				
+				},
+				scanList: [],
+				scanFunctionIsUseable:true,
+				showpopup:false,
+				action:"",
+				formData:{
+					subFolder:"equipmentEnter"
+				},
+				header:{
+					
+				},
+				radiolist: [{
+						name: '已收到',
+						value:"1",
+						disabled: false
+					},
+					{
+						name: '未收到',
+						value:"2",
+						disabled: false
+					},
+				
+				],
+				value: '已收到',
 				id:"",
 				info:{
 					projectName:"",
@@ -137,16 +257,28 @@
 					name:"",
 					headImg:""
 				},
-				deviceInfoList:{},
+				deviceInfoList:[],
+				deviceReList:[],
 			}
 		},
 		onLoad(op){
 			this.id=op.id
 			this.getInfo()
+			
+			this.action=process.car.BASE_URL+"uploadPicture"
+			
+			this.formData.subFolder="feedback"
+			//接口应该免登陆
+			var token=this.carhelp.getToken()
+			
+			this.header={
+					
+				'Authorization':token
+			}
 		},
 		methods:{
 			recordStatus,recordStatusColor,
-			getInfo(){
+			getInfo(bl){
 				uni.showLoading({
 					title: "加载中",
 					mask: true,
@@ -156,8 +288,33 @@
 				}).then((res) => {
 					uni.hideLoading();
 					this.info=res.data.inRecord;
-					this.deviceInfoList=res.data.deviceInfoList;
+					this.deviceInfoList=res.data.inRecordDeviceList;
 					//this.outUser=res.data.outUser;
+					if(bl){
+						const eventChannel = this.getOpenerEventChannel();
+						eventChannel.emit('refreshData');
+					}
+					
+					this.deviceReList=this.deviceInfoList.map(item=>{
+						if(this.info.status==0){
+							return {
+								recordDeviceId:item.id,
+								deviceId:item.deviceInfo.id,
+								remark:"",
+								deviceIdScan:0,
+								status:"2",
+							}
+						}else{
+							return {
+								recordDeviceId:item.id,
+								deviceId:item.deviceInfo.id,
+								remark:item.remark,
+								imgUrls:item.imgUrls,
+								status:item.status,
+							}
+						}
+						
+					})
 					
 				}).catch(error => {
 					uni.showToast({
@@ -165,9 +322,195 @@
 						icon: "none"
 					})
 				})
+			},
+			submitInfo(obj){
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				API.saveRecordIn(obj).then((res) => {
+					uni.hideLoading();
+					
+					this.getInfo(true)
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
 			},gotoOut(){
+				var returnObj=[...this.deviceReList]
+			
+				var bl=true;
+				for(var x in this.deviceReList){
+					var obj=returnObj[x];
+					
+					delete obj.deviceIdScan;
+					var lists1=[];
+					var lists2 =this.$refs["uUpload"+x][0].lists
+					
+					for(var i in lists2){
+						var item=lists2[i]
+						
+						if(item.progress==100&&item.response&&item.response.result){
+							
+						}else{
+							uni.showToast({
+								title:"第"+x+"行图片上传中,请稍后"
+							})
+							bl=false
+							break;
+						}
+						
+						var p =item.response.data.fileUrl;
+						
+						lists1.push(p);
+						
+					}
+					if(!bl){
+						break;
+					}
+					obj.imgUrls=lists1.join()
+					returnObj[x]=obj;
+					
+				}
+				if(!bl){
+					return;
+				}
+				console.log(returnObj);
+				var json={
+					recordId:this.id,
+					deviceData:returnObj
+					
+				}
+				this.submitInfo({
+					recordData:JSON.stringify(json)
+				})
 				
-			}
+			},// 选中某个单选框时,由radio时触发
+			radioChange(e) {
+				// console.log(e);
+			},
+			// 选中任一radio时,由radio-group触发
+			radioGroupChange(e) {
+				// console.log(e);
+			},
+			beforeUpload(index, list) {
+							// 只上传偶数索引的文件
+							if(index % 2 == 0) return true;
+							else return false;
+						}, error(e) {
+			            console.log(e.detail);
+			 },
+			 gotoscan(val){
+				// if(this.deviceposition=='back'){
+				// 	this.deviceposition="front"
+				// }else{
+				// 	this.deviceposition="back"
+				// }
+				 
+				 // #ifdef H5
+				 	this.gotoscanH5(val)
+				 // #endif
+				 
+				 // #ifdef MP-WEIXIN
+				 	
+				 		this.gotoscanMP(val)
+				 // #endif
+				 
+			 },
+			 takeCode(e){
+				 console.log(e);
+				  if(this.scanFunctionIsUseable) {
+				         this.scanFunctionIsUseable = false;
+				         // 对扫码结果进行处理
+				         console.log(e.detail.result);
+						this.getscan(e.detail.result)
+				         // 扫码间隔两秒
+				         setTimeout(() => {
+				         this.scanFunctionIsUseable = true;
+						
+				         }, 1000)
+				     }
+				
+			 },
+			 gotoscanMP(val){
+				 this.showpopup=true;
+				  // const ctx = uni.createCameraContext();
+				  //            ctx.takePhoto({
+				  //                quality: 'high',
+				  //                success: (res) => {
+				  //                    this.src = res.tempImagePath
+				  //                }
+				  //            });
+			 },
+			gotoscanH5(val) {
+				console.log('111')
+				
+				var _this = this;
+				uni.showModal({
+					title: '提示',
+					editable: true,
+					//content: '这是一个模态弹窗',
+					success: function(res) {
+						if (res.confirm) {
+							_this.getscan(res.content)
+						} else if (res.cancel) {
+							console.log('用户点击取消');
+						}
+					}
+				});
+
+
+			},getscan(val) {
+				 this.showpopup=true;
+				
+				
+				
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				API.queryDeviceByCode({
+					code: val,
+				}).then((res) => {
+					uni.hideLoading();
+					if (res.data.deviceInfo) {
+						console.log(res.data.deviceInfo)
+						this.nowscan=res.data.deviceInfo;
+						
+						var c = this.deviceInfoList.findIndex(item => {
+							return item.deviceInfo.id == res.data.deviceInfo.id
+						})
+						uni.showToast({
+							title: "扫码成功",
+							icon: "none"
+						})
+						if (c!=-1) {
+							this.deviceReList[c].status='1'
+							this.deviceReList[c].deviceIdScan=1;
+							
+						} else {
+							
+						}
+					
+
+
+					} else {
+						uni.showToast({
+							title: "二维码无效",
+							icon: "none"
+						})
+					}
+
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
+			
 		}
 	}
 </script>
@@ -176,7 +519,231 @@
 	page {
 		padding-bottom: 200rpx;
 	}
-
+	.scantitle{
+		text-align: center;
+		font-size: 44rpx;
+		 padding-top: 20px;
+	}
+	.list {
+		background-color: #fff;
+		margin: 24rpx;
+		padding: 22rpx 32rpx;
+	
+		// 清单信息
+		.list-infos {
+			border-radius: 8px;
+	
+			.infos-head {
+				display: flex;
+				justify-content: space-between;
+				align-items: center;
+				margin-bottom: 24rpx;
+	
+				.name {
+					color: rgba(51, 51, 51, 1);
+					font-size: 32rpx;
+				}
+	
+				.qr-code {
+					border-radius: 4px;
+					background: linear-gradient(180deg, rgba(22, 119, 255, 1) 0%, rgba(16, 98, 213, 1) 100%);
+					color: rgba(255, 255, 255, 1);
+					font-size: 24rpx;
+					width: 160rpx;
+					text-align: center;
+					line-height: 64rpx;
+	
+					text {
+						img {
+							vertical-align: middle;
+						}
+					}
+				}
+			}
+	
+			.infos {
+				margin-top: 16rpx;
+				display: flex;
+				color: #777777;
+				font-size: 24rpx;
+	
+				.infos-1 {
+					margin-right: 68rpx;
+				}
+	
+	
+				.infos-item {
+					display: flex;
+					margin-bottom: 8rpx;
+				}
+	
+			}
+	
+			.address,
+			.remark {
+				display: flex;
+				color: #777777;
+				font-size: 24rpx;
+				margin-bottom: 8rpx;
+			}
+		}
+	}
+	.container {
+		.main {
+			padding: 0 24rpx;
+	
+			.list-item {
+				border-radius: 8px;
+				padding: 24rpx;
+				background-color: #fff;
+				margin-top: 24rpx;
+			}
+	
+			// 信息
+			.list-infos {
+				padding-bottom: 24rpx;
+				border-bottom: 1px solid rgba(232, 232, 232, 1);
+	
+				.infos-head {
+					display: flex;
+					justify-content: space-between;
+					align-items: center;
+					margin-bottom: 24rpx;
+	
+					.name {
+						color: rgba(51, 51, 51, 1);
+						font-size: 32rpx;
+					}
+	
+					.state {
+						border: 1px solid rgba(69, 186, 69, 1);
+						border-radius: 4px;
+						color: rgba(69, 186, 69, 1);
+						font-size: 24rpx;
+						line-height: 48rpx;
+						width: 160rpx;
+						text-align: center;
+	
+						text {
+							img {
+								vertical-align: middle;
+								margin-right: 4rpx;
+							}
+						}
+					}
+					.qr-code2 {
+						border-radius: 4px;
+						//background: linear-gradient(180deg, rgba(22, 119, 255, 1) 0%, rgba(16, 98, 213, 1) 100%);
+						color: #45BA45 ;
+						border: 1px solid rgba(69, 186, 69, 1);
+						font-size: 24rpx;
+						width: 160rpx;
+						text-align: center;
+						line-height: 48rpx;
+						
+						text {
+							img {
+								vertical-align: middle;
+							}
+						}
+					}
+					.qr-code {
+						border-radius: 4px;
+						background: linear-gradient(180deg, rgba(22, 119, 255, 1) 0%, rgba(16, 98, 213, 1) 100%);
+						color: rgba(255, 255, 255, 1);
+						font-size: 24rpx;
+						width: 160rpx;
+						text-align: center;
+						line-height: 48rpx;
+	
+						text {
+							img {
+								vertical-align: middle;
+							}
+						}
+					}
+				}
+	
+				.infos {
+					margin-top: 16rpx;
+					display: flex;
+					justify-content: space-between;
+					color: #777777;
+					font-size: 24rpx;
+	
+					.infos-1 {}
+	
+					.infos-item {
+						display: flex;
+						margin-bottom: 8rpx;
+					}
+				}
+			}
+	
+			// 接收选项
+			.receive-options {
+			 display: flex;
+				align-items: center;
+				padding: 24rpx 0;
+	
+				.title {
+					color: #333333;
+					margin-right: 24rpx;
+				}
+	
+				.receive-radio {
+					flex: 1;
+	
+					/deep/.u-radio-group {
+						width: 100%;
+	
+					}
+	
+					/deep/.u-radio {
+						margin-right: 48rpx;
+					}
+				}
+	
+			}
+	
+			// 备注
+			uni-textarea,.uni-textarea{
+				width: 100%;
+				height: 80rpx;
+				line-height: 80rpx;
+				text-indent: 24rpx;
+				background-color: rgba(241, 242, 245, 1);
+				color: rgba(136, 136, 136, 1);
+				border-radius: 8px;
+				font-family: Microsoft Yahei;
+				font-size: 28rpx;
+			}
+			// 上传图片
+			.upload-img{
+				margin-top: 24rpx;
+				/deep/.u-add-tips{
+					margin-top: 0;
+				}
+				// 右上角删除图标
+				/deep/.u-delete-icon{
+					top: -8rpx;
+					right: -8rpx;
+					width: 36rpx;
+					height: 36rpx;
+				}
+				/deep/.u-list-item{
+					overflow: inherit;
+				}
+				/deep/.u-list-item{
+					margin-right: 8rpx;
+				}
+			}
+	
+		}
+	
+	
+	
+	}
 	// 出库单状态
 	.head {
 		background-color: #fff;

+ 17 - 10
pages/storeManagement/equipmentEnter/equipmentEnter.vue

@@ -24,32 +24,35 @@
 						待入库
 					</view> -->
 				</view>
+				
 				<view class="group">
 					<view class="name">
-						入库位置
+						提交人
 					</view>
 					<view class="value">
-						十号路仓库
+						{{item.createByName}}
 					</view>
 				</view>
 				<view class="group">
 					<view class="name">
-						交接人
+						创建时间
 					</view>
 					<view class="value">
-						孙斌
+						{{item.createTime}}
 					</view>
 				</view>
-				<view class="group">
+				<view class="group" v-if="item.approveTime">
 					<view class="name">
-						创建时间:
+						入库时间:
 					</view>
 					<view class="value">
-						2023/03/15 16:15:31
+						{{item.approveTime}}
 					</view>
 				</view>
-				
 			</view>
+			<u-divider  v-if="list[current].recordsTotal==list[current].list.length"
+			 :isnone="list[current].recordsTotal==0" nonetext="没有找到相关内容" 
+			border-color="#CFD2D5">已经到底了</u-divider>
 		</view>
 		
 		
@@ -69,14 +72,14 @@
 					pageIndex: 1,
 					pageSize: 20,
 					recordsTotal: 1,
-					 typeId:"1",
+					 status:"0",
 					list:[]
 				}, {
 					name: '已入库',
 					pageIndex: 1,
 					pageSize: 20,
 					recordsTotal: 1,
-					 typeId:"2",
+					 status:"1",
 					list:[]
 				}],
 				current: 0
@@ -150,6 +153,10 @@
 			},
 			change(index) {
 				this.current = index;
+				var list = this.list[this.current].list
+				if (list.length == 0) {
+					this.getList();
+				}
 			}
 		}
 	}

+ 0 - 678
uni_modules/uview-ui/components/u-upload-file/u-upload-file.vue

@@ -1,678 +0,0 @@
-<template>
-	<view class="u-upload" v-if="!disabled">
-		<view
-			v-if="showUploadList"
-			class="u-list-item u-preview-wrap"
-			v-for="(item, index) in lists"
-			:key="index"
-			:style="{
-				width: $u.addUnit(width),
-				height: $u.addUnit(height)
-			}"
-		>
-			<view
-				v-if="deletable"
-				class="u-delete-icon"
-				@tap.stop="deleteItem(index)"
-				:style="{
-					background: delBgColor
-				}"
-			>
-				<u-icon class="u-icon" :name="delIcon" size="20" :color="delColor"></u-icon>
-			</view>
-			<u-line-progress
-				v-if="showProgress && item.progress > 0 && item.progress != 100 && !item.error"
-				:show-percent="false"
-				height="16"
-				class="u-progress"
-				:percent="item.progress"
-			></u-line-progress>
-			<view @tap.stop="retry(index)" v-if="item.error" class="u-error-btn2 u-error-btn">点击重试</view>
-			<view  v-if="item.progress==100" class="u-error-btn2 u-primary-btn">上传成功</view>
-			<view  v-if="item.progress!=100" class="u-error-btn2 u-warning-btn">上传中</view>
-			
-			
-			<video v-if="item.fileType=='video/mp4'" :src="item.url"
-			                    enable-danmu danmu-btn controls></video>
-			<image  class="u-preview-image" v-else :src="item.url || item.path" :mode="imageMode"></image>
-
-		</view>
-		<slot name="file" :file="lists"></slot>
-		<view style="display: inline-block;" @tap="selectFile" v-if="maxCount > lists.length">
-			<slot name="addBtn"></slot>
-			<view
-				v-if="!customBtn"
-				class="u-list-item u-add-wrap"
-				hover-class="u-add-wrap__hover"
-				hover-stay-time="150"
-				:style="{
-					width: $u.addUnit(width),
-					height: $u.addUnit(height)
-				}"
-			>
-				<u-icon name="plus" class="u-add-btn" size="40"></u-icon>
-				<view class="u-add-tips">{{ uploadText }}</view>
-			</view>
-		</view>
-	</view>
-</template>
-
-<script>
-/**
- * upload 图片上传
- * @description 该组件用于上传图片场景
- * @tutorial https://www.uviewui.com/components/upload.html
- * @property {String} action 服务器上传地址
- * @property {String Number} max-count 最大选择图片的数量(默认99)
- * @property {Boolean} custom-btn 如果需要自定义选择图片的按钮,设置为true(默认false)
- * @property {Boolean} show-progress 是否显示进度条(默认true)
- * @property {Boolean} disabled 是否启用(显示/移仓)组件(默认false)
- * @property {String} image-mode 预览图片等显示模式,可选值为uni的image的mode属性值(默认aspectFill)
- * @property {String} del-icon 右上角删除图标名称,只能为uView内置图标
- * @property {String} del-bg-color 右上角关闭按钮的背景颜色
- * @property {String | Number} index 在各个回调事件中的最后一个参数返回,用于区别是哪一个组件的事件
- * @property {String} del-color 右上角关闭按钮图标的颜色
- * @property {Object} header 上传携带的头信息,对象形式
- * @property {Object} form-data 上传额外携带的参数
- * @property {String} name 上传文件的字段名,供后端获取使用(默认file)
- * @property {Array<String>} size-type original 原图,compressed 压缩图,默认二者都有(默认['original', 'compressed'])
- * @property {Array<String>} source-type 选择图片的来源,album-从相册选图,camera-使用相机,默认二者都有(默认['album', 'camera'])
- * @property {Boolean} preview-full-image	是否可以通过uni.previewImage预览已选择的图片(默认true)
- * @property {Boolean} multiple	是否开启图片多选,部分安卓机型不支持(默认true)
- * @property {Boolean} deletable 是否显示删除图片的按钮(默认true)
- * @property {String Number} max-size 选择单个文件的最大大小,单位B(byte),默认不限制(默认Number.MAX_VALUE)
- * @property {Array<Object>} file-list 默认显示的图片列表,数组元素为对象,必须提供url属性
- * @property {Boolean} upload-text 选择图片按钮的提示文字(默认“选择图片”)
- * @property {Boolean} auto-upload 选择完图片是否自动上传,见上方说明(默认true)
- * @property {Boolean} show-tips 特殊情况下是否自动提示toast,见上方说明(默认true)
- * @property {Boolean} show-upload-list 是否显示组件内部的图片预览(默认true)
- * @event {Function} on-oversize 图片大小超出最大允许大小
- * @event {Function} on-preview 全屏预览图片时触发
- * @event {Function} on-remove 移除图片时触发
- * @event {Function} on-success 图片上传成功时触发
- * @event {Function} on-change 图片上传后,无论成功或者失败都会触发
- * @event {Function} on-error 图片上传失败时触发
- * @event {Function} on-progress 图片上传过程中的进度变化过程触发
- * @event {Function} on-uploaded 所有图片上传完毕触发
- * @event {Function} on-choose-complete 每次选择图片后触发,只是让外部可以得知每次选择后,内部的文件列表
- * @example <u-upload :action="action" :file-list="fileList" ></u-upload>
- */
-export default {
-	name: 'u-upload',
-	props: {
-		//是否显示组件自带的图片预览功能
-		showUploadList: {
-			type: Boolean,
-			default: true
-		},
-		// 后端地址
-		action: {
-			type: String,
-			default: ''
-		},
-		// 最大上传数量
-		maxCount: {
-			type: [String, Number],
-			default: 52
-		},
-		//  是否显示进度条
-		showProgress: {
-			type: Boolean,
-			default: true
-		},
-		// 是否启用
-		disabled: {
-			type: Boolean,
-			default: false
-		},
-		// 预览上传的图片时的裁剪模式,和image组件mode属性一致
-		imageMode: {
-			type: String,
-			default: 'aspectFill'
-		},
-		// 头部信息
-		header: {
-			type: Object,
-			default() {
-				return {};
-			}
-		},
-		// 额外携带的参数
-		formData: {
-			type: Object,
-			default() {
-				return {};
-			}
-		},
-		// 上传的文件字段名
-		name: {
-			type: String,
-			default: 'photoFile'
-		},
-		// 所选的图片的尺寸, 可选值为original compressed
-		sizeType: {
-			type: Array,
-			default() {
-				return ['original', 'compressed'];
-			}
-		},
-		sourceType: {
-			type: Array,
-			default() {
-				return ['album', 'camera'];
-			}
-		},
-		// 是否在点击预览图后展示全屏图片预览
-		previewFullImage: {
-			type: Boolean,
-			default: true
-		},
-		// 是否开启图片多选,部分安卓机型不支持
-		multiple: {
-			type: Boolean,
-			default: false
-		},
-		// 是否展示删除按钮
-		deletable: {
-			type: Boolean,
-			default: true
-		},
-		// 文件大小限制,单位为byte
-		maxSize: {
-			type: [String, Number],
-			default: Number.MAX_VALUE
-		},
-		// 显示已上传的文件列表
-		fileList: {
-			type: Array,
-			default() {
-				return [];
-			}
-		},
-		// 上传区域的提示文字
-		uploadText: {
-			type: String,
-			default: '图片/视频'
-		},
-		// 是否自动上传
-		autoUpload: {
-			type: Boolean,
-			default: true
-		},
-		// 是否显示toast消息提示
-		showTips: {
-			type: Boolean,
-			default: true
-		},
-		// 是否通过slot自定义传入选择图标的按钮
-		customBtn: {
-			type: Boolean,
-			default: false
-		},
-		// 内部预览图片区域和选择图片按钮的区域宽度
-		width: {
-			type: [String, Number],
-			default: 200
-		},
-		// 内部预览图片区域和选择图片按钮的区域高度
-		height: {
-			type: [String, Number],
-			default: 200
-		},
-		// 右上角关闭按钮的背景颜色
-		delBgColor: {
-			type: String,
-			default: '#fa3534'
-		},
-		// 右上角关闭按钮的叉号图标的颜色
-		delColor: {
-			type: String,
-			default: '#ffffff'
-		},
-		// 右上角删除图标名称,只能为uView内置图标
-		delIcon: {
-			type: String,
-			default: 'close'
-		},
-		// 如果上传后的返回值为json字符串,是否自动转json
-		toJson: {
-			type: Boolean,
-			default: true
-		},
-		// 上传前的钩子,每个文件上传前都会执行
-		beforeUpload: {
-			type: Function,
-			default: null
-		},
-		// 移除文件前的钩子
-		beforeRemove: {
-			type: Function,
-			default: null
-		},
-		// 允许上传的图片后缀
-		limitType:{
-			type: Array,
-			default() {
-				// 支付宝小程序真机选择图片的后缀为"image"
-				// https://opendocs.alipay.com/mini/api/media-image
-				return ['png', 'jpg', 'jpeg', 'webp', 'gif', 'image','mp4'];
-			}
-		},
-		// 在各个回调事件中的最后一个参数返回,用于区别是哪一个组件的事件
-		index: {
-			type: [Number, String],
-			default: ''
-		}
-	},
-	mounted() {},
-	data() {
-		return {
-			lists: [],
-			isInCount: true,
-			uploading: false
-		};
-	},
-	watch: {
-		fileList: {
-			immediate: true,
-			handler(val) {
-				val.map(value => {
-					// 首先检查内部是否已经添加过这张图片,因为外部绑定了一个对象给fileList的话(对象引用),进行修改外部fileList
-					// 时,会触发watch,导致重新把原来的图片再次添加到this.lists
-					// 数组的some方法意思是,只要数组元素有任意一个元素条件符合,就返回true,而另一个数组的every方法的意思是数组所有元素都符合条件才返回true
-					let tmp = this.lists.some(val => {
-						return val.url == value.url;
-					})
-					// 如果内部没有这个图片(tmp为false),则添加到内部
-					!tmp && this.lists.push({ url: value.url, error: false, progress: 100 });
-				});
-			}
-		},
-		// 监听lists的变化,发出事件
-		lists(n) {
-			this.$emit('on-list-change', n, this.index);
-		}
-	},
-	methods: {
-		// 清除列表
-		clear() {
-			this.lists = [];
-		},
-		// 重新上传队列中上传失败的所有文件
-		reUpload() {
-			this.uploadFile();
-		},
-		// 选择图片
-		selectFile() {
-			if (this.disabled) return;
-			const { name = '', maxCount, multiple, maxSize, sizeType, lists, camera, compressed, maxDuration, sourceType } = this;
-			let chooseFile = null;
-			const newMaxCount = maxCount - lists.length;
-			// 设置为只选择图片的时候使用 chooseImage 来实现
-			chooseFile = new Promise((resolve, reject) => {
-				uni.chooseFile({
-					count: multiple ? (newMaxCount > 9 ? 9 : newMaxCount) : 1,
-					sourceType: sourceType,
-					sizeType,
-					extension:this.limitType,
-					success: resolve,
-					
-					fail: reject
-				});
-			});
-			chooseFile
-				.then(res => {
-					let file = null;
-					let listOldLength = this.lists.length;
-					res.tempFiles.map((val, index) => {
-						// 检查文件后缀是否允许,如果不在this.limitType内,就会返回false
-						if(!this.checkFileExt(val)) return ;
-						
-						// 如果是非多选,index大于等于1或者超出最大限制数量时,不处理
-						if (!multiple && index >= 1) return;
-						if (val.size > maxSize) {
-							this.$emit('on-oversize', val, this.lists, this.index);
-							this.showToast('超出允许的文件大小'+(maxSize/1024/1024)+"M");
-						} else {
-							if (maxCount <= lists.length) {
-								this.$emit('on-exceed', val, this.lists, this.index);
-								this.showToast('超出最大允许的文件个数');
-								return;
-							}
-							 
-							lists.push({
-								url: val.path,
-								progress: 0,
-								error: false,
-								file: val,
-								fileType:val.type
-							});
-						}
-					});
-					// 每次图片选择完,抛出一个事件,并将当前内部选择的图片数组抛出去
-					this.$emit('on-choose-complete', this.lists, this.index);
-					if (this.autoUpload) this.uploadFile(listOldLength);
-				})
-				.catch(error => {
-					this.$emit('on-choose-fail', error);
-				});
-		},
-		// 提示用户消息
-		showToast(message, force = false) {
-			if (this.showTips || force) {
-				uni.showToast({
-					title: message,
-					icon: 'none'
-				});
-			}
-		},
-		// 该方法供用户通过ref调用,手动上传
-		upload() {
-			this.uploadFile();
-		},
-		// 对失败的图片重新上传
-		retry(index) {
-			this.lists[index].progress = 0;
-			this.lists[index].error = false;
-			this.lists[index].response = null;
-			uni.showLoading({
-				title: '重新上传'
-			});
-			this.uploadFile(index);
-		},
-		// 上传图片
-		async uploadFile(index = 0) {
-			if (this.disabled) return;
-			if (this.uploading) return;
-			// 全部上传完成
-			if (index >= this.lists.length) {
-				this.$emit('on-uploaded', this.lists, this.index);
-				return;
-			}
-			// 检查是否是已上传或者正在上传中
-			if (this.lists[index].progress == 100) {
-				if (this.autoUpload == false) this.uploadFile(index + 1);
-				return;
-			}
-			// 执行before-upload钩子
-			if(this.beforeUpload && typeof(this.beforeUpload) === 'function') {
-				// 执行回调,同时传入索引和文件列表当作参数
-				// 在微信,支付宝等环境(H5正常),会导致父组件定义的customBack()函数体中的this变成子组件的this
-				// 通过bind()方法,绑定父组件的this,让this.customBack()的this为父组件的上下文
-				// 因为upload组件可能会被嵌套在其他组件内,比如u-form,这时this.$parent其实为u-form的this,
-				// 非页面的this,所以这里需要往上历遍,一直寻找到最顶端的$parent,这里用了this.$u.$parent.call(this)
-				// 明白意思即可,无需纠结this.$u.$parent.call(this)的细节
-				let beforeResponse = this.beforeUpload.bind(this.$u.$parent.call(this))(index, this.lists);
-				// 判断是否返回了promise
-				if (!!beforeResponse && typeof beforeResponse.then === 'function') {
-					await beforeResponse.then(res => {
-						// promise返回成功,不进行动作,继续上传
-					}).catch(err => {
-						// 进入catch回调的话,继续下一张
-						return this.uploadFile(index + 1);
-					})
-				} else if(beforeResponse === false) {
-					// 如果返回false,继续下一张图片的上传
-					return this.uploadFile(index + 1);
-				} else {
-					// 此处为返回"true"的情形,这里不写代码,就跳过此处,继续执行当前的上传逻辑
-				}
-			}
-			// 检查上传地址
-			if (!this.action) {
-				this.showToast('请配置上传地址', true);
-				return;
-			}
-			this.lists[index].error = false;
-			this.uploading = true;
-			// 创建上传对象
-			const task = uni.uploadFile({
-				url: this.action,
-				filePath: this.lists[index].url,
-				name: this.name,
-				formData: this.formData,
-				header: this.header,
-				// #ifdef MP-ALIPAY
-				fileType:'image',
-				// #endif
-				success: res => {
-					// 判断是否json字符串,将其转为json格式
-					
-					let data = this.toJson && this.$u.test.jsonString(res.data) ? JSON.parse(res.data) : res.data;
-					if (![200, 201, 204].includes(res.statusCode)) {
-						this.uploadError(index, data);
-					} else {
-						// 上传成功
-						this.lists[index].response = data;
-						this.lists[index].progress = 100;
-						this.lists[index].error = false;
-						this.$emit('on-success', data, index, this.lists, this.index);
-					}
-				},
-				fail: e => {
-					this.uploadError(index, e);
-				},
-				complete: res => {
-					uni.hideLoading();
-					this.uploading = false;
-					this.uploadFile(index + 1);
-					this.$emit('on-change', res, index, this.lists, this.index);
-				}
-			});
-			task.onProgressUpdate(res => {
-				if (res.progress > 0) {
-					this.lists[index].progress = res.progress;
-					this.$emit('on-progress', res, index, this.lists, this.index);
-				}
-			});
-		},
-		// 上传失败
-		uploadError(index, err) {
-			this.lists[index].progress = 0;
-			this.lists[index].error = true;
-			this.lists[index].response = null;
-			this.$emit('on-error', err, index, this.lists, this.index);
-			this.showToast('上传失败,请重试');
-		},
-		// 删除一个图片
-		deleteItem(index) {
-			uni.showModal({
-				title: '提示',
-				content: '您确定要删除此项吗?',
-				success: async (res) => {
-					if (res.confirm) {
-						// 先检查是否有定义before-remove移除前钩子
-						// 执行before-remove钩子
-						if(this.beforeRemove && typeof(this.beforeRemove) === 'function') {
-							// 此处钩子执行 原理同before-remove参数,见上方注释
-							let beforeResponse = this.beforeRemove.bind(this.$u.$parent.call(this))(index, this.lists);
-							// 判断是否返回了promise
-							if (!!beforeResponse && typeof beforeResponse.then === 'function') {
-								await beforeResponse.then(res => {
-									// promise返回成功,不进行动作,继续上传
-									this.handlerDeleteItem(index);
-								}).catch(err => {
-									// 如果进入promise的reject,终止删除操作
-									this.showToast('已终止移除');
-								})
-							} else if(beforeResponse === false) {
-								// 返回false,终止删除
-								this.showToast('已终止移除');
-							} else {
-								// 如果返回true,执行删除操作
-								this.handlerDeleteItem(index);
-							}
-						} else {
-							// 如果不存在before-remove钩子,
-							this.handlerDeleteItem(index);
-						}
-					}
-				}
-			});
-		},
-		// 执行移除图片的动作,上方代码只是判断是否可以移除
-		handlerDeleteItem(index) {
-			// 如果文件正在上传中,终止上传任务,进度在0 < progress < 100则意味着正在上传
-			if (this.lists[index].progress < 100 && this.lists[index].progress > 0) {
-				typeof this.lists[index].uploadTask != 'undefined' && this.lists[index].uploadTask.abort();
-			}
-			this.lists.splice(index, 1);
-			this.$forceUpdate();
-			this.$emit('on-remove', index, this.lists, this.index);
-			this.showToast('移除成功');
-		},
-		// 用户通过ref手动的形式,移除一张图片
-		remove(index) {
-			// 判断索引的合法范围
-			if (index >= 0 && index < this.lists.length) {
-				this.lists.splice(index, 1);
-				this.$emit('on-list-change', this.lists, this.index);
-			}
-		},
-		// 预览图片
-		doPreviewImage(url, index) {
-			if (!this.previewFullImage) return;
-			const images = this.lists.map(item => item.url || item.path);
-			uni.previewImage({
-				urls: images,
-				current: url,
-				success: () => {
-					this.$emit('on-preview', url, this.lists, this.index);
-				},
-				fail: () => {
-					uni.showToast({
-						title: '预览图片失败',
-						icon: 'none'
-					});
-				}
-			});
-		},
-		// 判断文件后缀是否允许
-		checkFileExt(file) {
-			// 检查是否在允许的后缀中
-			let noArrowExt = false;
-			// 获取后缀名
-			let fileExt = '';
-			const reg = /.+\./;
-			// 如果是H5,需要从name中判断
-			// #ifdef H5
-			fileExt = file.name.replace(reg, "").toLowerCase();
-			// #endif
-			// 非H5,需要从path中读取后缀
-			// #ifndef H5
-			fileExt = file.path.replace(reg, "").toLowerCase();
-			// #endif
-			// 使用数组的some方法,只要符合limitType中的一个,就返回true
-			noArrowExt = this.limitType.some(ext => {
-				// 转为小写
-				return ext.toLowerCase() === fileExt;
-			})
-			if(!noArrowExt) this.showToast(`不允许选择${fileExt}格式的文件`);
-			return noArrowExt;
-		}
-	}
-};
-</script>
-
-<style lang="scss" scoped>
-@import '../../libs/css/style.components.scss';
-
-.u-upload {
-	@include vue-flex;
-	flex-wrap: wrap;
-	width: 100%;
-	align-items: center;
-}
-
-.u-list-item {
-	width: 200rpx;
-	height: 200rpx;
-	overflow: hidden;
-	margin: 10rpx;
-	background: rgb(244, 245, 246);
-	position: relative;
-	border-radius: 10rpx;
-	/* #ifndef APP-NVUE */
-	display: flex;
-	/* #endif */
-	align-items: center;
-	justify-content: center;
-}
-
-.u-preview-wrap {
-	border: 1px solid rgb(235, 236, 238);
-}
-
-.u-add-wrap {
-	flex-direction: column;
-	color: $u-content-color;
-	font-size: 26rpx;
-}
-
-.u-add-tips {
-	margin-top: 20rpx;
-	line-height: 40rpx;
-}
-
-.u-add-wrap__hover {
-	background-color: rgb(235, 236, 238);
-}
-
-.u-preview-image {
-	display: block;
-	width: 100%;
-	height: 100%;
-	border-radius: 10rpx;
-}
-
-.u-delete-icon {
-	position: absolute;
-	top: 10rpx;
-	right: 10rpx;
-	z-index: 10;
-	background-color: $u-type-error;
-	border-radius: 100rpx;
-	width: 44rpx;
-	height: 44rpx;
-	@include vue-flex;
-	align-items: center;
-	justify-content: center;
-}
-
-.u-icon {
-	@include vue-flex;
-	align-items: center;
-	justify-content: center;
-}
-
-.u-progress {
-	position: absolute;
-	bottom: 10rpx;
-	left: 8rpx;
-	right: 8rpx;
-	z-index: 9;
-	width: auto;
-}
-.u-primary-btn {
-	background-color: #59ba73;
-}
-.u-warning-btn {
-	background-color: #e6a23c;
-}
-.u-error-btn{
-	background-color: $u-type-error;
-}
-.u-error-btn2 {
-	color: #ffffff;
-	
-	font-size: 20rpx;
-	padding: 4px 0;
-	text-align: center;
-	position: absolute;
-	bottom: 0;
-	left: 0;
-	right: 0;
-	z-index: 9;
-	line-height: 1;
-}
-</style>

+ 42 - 9
uni_modules/uview-ui/components/u-upload/u-upload.vue

@@ -22,12 +22,18 @@
 			</view>
 			<u-line-progress
 				v-if="showProgress && item.progress > 0 && item.progress != 100 && !item.error"
-				:show-percent="false"
+				:show-percent="true"
 				height="16"
 				class="u-progress"
-				:percent="item.progress"
+				 
 			></u-line-progress>
-			<view @tap.stop="retry(index)" v-if="item.error" class="u-error-btn">点击重试</view>
+			<template v-if="!item.view">
+				<view @tap.stop="retry(index)" v-if="item.error" class=" u-error-btn2 u-error-btn">点击重试</view>
+				<view  v-if="item.progress==100&&item.response&&item.response.result" class="u-error-btn2 u-primary-btn">上传成功</view>
+				<view  v-else-if="!item.error" class="u-error-btn2 u-warning-btn">上传中</view>
+			</template>
+			
+			
 			<image @tap.stop="doPreviewImage(item.url || item.path, index)" class="u-preview-image" v-if="!item.isImage" :src="item.url || item.path" :mode="imageMode"></image>
 		</view>
 		<slot name="file" :file="lists"></slot>
@@ -277,7 +283,7 @@ export default {
 						return val.url == value.url;
 					})
 					// 如果内部没有这个图片(tmp为false),则添加到内部
-					!tmp && this.lists.push({ url: value.url, error: false, progress: 100 });
+					!tmp && this.lists.push({ url: value.url,view:value.view, error: false, progress: 100 });
 				});
 			}
 		},
@@ -425,16 +431,24 @@ export default {
 				fileType:'image',
 				// #endif
 				success: res => {
+					
 					// 判断是否json字符串,将其转为json格式
 					let data = this.toJson && this.$u.test.jsonString(res.data) ? JSON.parse(res.data) : res.data;
 					if (![200, 201, 204].includes(res.statusCode)) {
 						this.uploadError(index, data);
 					} else {
-						// 上传成功
-						this.lists[index].response = data;
-						this.lists[index].progress = 100;
-						this.lists[index].error = false;
-						this.$emit('on-success', data, index, this.lists, this.index);
+						
+						if(data.result){
+							
+							// 上传成功
+							this.lists[index].response = data;
+							this.lists[index].progress = 100;
+							this.lists[index].error = false;
+							this.$forceUpdate()
+							this.$emit('on-success', data, index, this.lists, this.index);
+						}else{
+								this.uploadError(index, data.message);
+						}
 					}
 				},
 				fail: e => {
@@ -641,6 +655,12 @@ export default {
 	width: auto;
 }
 
+.u-primary-btn {
+	background-color: #59ba73;
+}
+.u-warning-btn {
+	background-color: #e6a23c;
+}
 .u-error-btn {
 	color: #ffffff;
 	background-color: $u-type-error;
@@ -654,4 +674,17 @@ export default {
 	z-index: 9;
 	line-height: 1;
 }
+.u-error-btn2 {
+	color: #ffffff;
+	
+	font-size: 20rpx;
+	padding: 4px 0;
+	text-align: center;
+	position: absolute;
+	bottom: 0;
+	left: 0;
+	right: 0;
+	z-index: 9;
+	line-height: 1;
+}
 </style>