瀏覽代碼

收款短息

zhengjinyi 3 年之前
父節點
當前提交
6e0a8f53ac

+ 293 - 264
common/config/caimeiApi.js

@@ -5,292 +5,321 @@
  */
 // import requestUrl from './config.js'
 const caimeiApi = {
-	/**
+    /**
 	 * @封装公共get数据请求方法无加载动画
 	 * @方法参数:请求地址,请求后台需要的参数字段,回调函数
 	 * @自定义请求头信息
 	 */
-	get:function(url,data,callback){
+    get:function(url,data,callback){
 		 uni.request({
-			url: requestUrl + url,
-			data:data,
-			header: {
-				'Accept': 'application/json',
-				'Content-Type': 'application/x-www-form-urlencoded', 
-				'X-Token': uni.getStorageSync('token') ? uni.getStorageSync('token') : 'token',
-				'cookie': uni.getStorageSync('sessionid')
-			},
-			method: 'GET',
-			success: (response) => {
-				if(response.statusCode !== 200){
-					uni.showToast({icon: 'none',title:'服务器连接错误',duration: 2000})
-					callback(response.statusCode);
-				}else{
-					callback(response.data);
-				}
-			},
-			fail: (error) => {
-				if (error) {
-					uni.showToast({icon: 'none',title: '网络错误,请稍后重试',duration: 2000})
-				}
-			}
-		 });
-	},
-	/**
+            url: requestUrl + url,
+            data:data,
+            header: {
+                'Accept': 'application/json',
+                'Content-Type': 'application/x-www-form-urlencoded', 
+                'X-Token': uni.getStorageSync('token') ? uni.getStorageSync('token') : 'token',
+                'cookie': uni.getStorageSync('sessionid')
+            },
+            method: 'GET',
+            success: (response) => {
+                if(response.statusCode !== 200){
+                    uni.showToast({icon: 'none',title:'服务器连接错误',duration: 2000})
+                    callback(response.statusCode)
+                }else{
+                    callback(response.data)
+                }
+            },
+            fail: (error) => {
+                if (error) {
+                    uni.showToast({icon: 'none',title: '网络错误,请稍后重试',duration: 2000})
+                }
+            }
+		 })
+    },
+    /**
 	 * @封装公共get数据请求方法有加载动画
 	 * @方法参数:请求地址,请求后台需要的参数字段,回调函数
 	 * @自定义请求头信息
 	 */
-	lodingGet:function(url,data,callback){
-		 uni.showLoading({mask: true,title:'加载中~',});
+    lodingGet:function(url,data,callback){
+		 uni.showLoading({mask: true,title:'加载中~',})
 		 uni.request({
-			url: requestUrl + url,
-			data:data,
-			header: {
-				'Accept': 'application/json',
-				'Content-Type': 'application/x-www-form-urlencoded', 
-				'X-Token': uni.getStorageSync('token') ? uni.getStorageSync('token') : 'token',
-				'cookie': uni.getStorageSync('sessionid')
-			},
-			method: 'GET',
-			success: (response) => {
-				if(response.statusCode !== 200){
-					uni.showToast({icon: 'none',title: '服务器连接错误',duration: 2000})
-					callback(response.statusCode);
-				}else{
-					callback(response.data);
-				}
-			},
-			fail: (error) => {
-				if (error) {
-					uni.showToast({icon: 'none',title: '网络错误,请稍后重试',duration: 2000})
-				}
-			},
-			complete: () => {
-				setTimeout(function () {
-					uni.hideLoading();
-				}, 250);
-			}
-		 });
-	},
-	/**
+            url: requestUrl + url,
+            data:data,
+            header: {
+                'Accept': 'application/json',
+                'Content-Type': 'application/x-www-form-urlencoded', 
+                'X-Token': uni.getStorageSync('token') ? uni.getStorageSync('token') : 'token',
+                'cookie': uni.getStorageSync('sessionid')
+            },
+            method: 'GET',
+            success: (response) => {
+                if(response.statusCode !== 200){
+                    uni.showToast({icon: 'none',title: '服务器连接错误',duration: 2000})
+                    callback(response.statusCode)
+                }else{
+                    callback(response.data)
+                }
+            },
+            fail: (error) => {
+                if (error) {
+                    uni.showToast({icon: 'none',title: '网络错误,请稍后重试',duration: 2000})
+                }
+            },
+            complete: () => {
+                setTimeout(function () {
+                    uni.hideLoading()
+                }, 250)
+            }
+		 })
+    },
+    /**
 	 * @封装公共post数据请求方法
 	 * @方法参数:请求地址,请求后台需要的参数字段,回调函数
 	 */
-	post:function(url,data,loadingStatus,callback){
-		if(loadingStatus){uni.showLoading({mask: true,title:'加载中~'})}
-		uni.request({
-			url: requestUrl+url,
-			data:data,
-			header: {
-				'Accept': 'application/json',
-				'Content-Type': 'application/x-www-form-urlencoded',
-				'X-Token': uni.getStorageSync('token') ? uni.getStorageSync('token') : 'token',
-				'cookie': uni.getStorageSync('sessionid')
-			},
-			method: 'POST',
-			success: (response) => {
-				if(loadingStatus){uni.hideLoading()}
-				const result = response.data
-				callback(result)
-			},
-			fail: (error) => {
-				uni.hideLoading()
-				if (error) {
-					uni.showToast({icon: 'none',title: '网络错误,请稍后重试',duration: 2000})
-				}
-			}
-		})
-	},
-	getComStorage:function(key){// 获取本地Storage
-		return new Promise(function(resolve,reject) {
-			uni.getStorage({
-				key: key,
-				success: function (res){
-					resolve(res.data);
-				}
-			})
-		});
-	},
-	setStorage:function(key,data){// 存储本地Storage
-		return new Promise(function(resolve,reject) {
-			uni.setStorage({
-				key: key,
-				data:data,
-				success: function (res){
-				}
-			})
-		});
-	},
-	getStorage:function(){// 获取本地userInfo
-		return new Promise(function(resolve,reject) {
-			uni.getStorage({
-				key: 'userInfo',
-				success: function (res){
-					resolve(res.data);
-				},
-				fail: function(res){
-					reject(false)
-				}
-			})
-		});
-	},
-	getStorageAddressKey:function(){// 获取本地地址信息
-		return new Promise(function(resolve,reject) {
-			uni.getStorage({
-				key: 'address_key',
-				success: function (res){
-					resolve(res.data);
-				}
-			})
-		});
-	},
-	loginStatus:function(){
-	// 获取用户是否登陆 1:已登陆,否则未登陆
-		return new Promise(function(resolve,reject) {
-			uni.getStorage({
-				key: 'userInfo',
-				success: function (res){
-					if(res.data.code == '1'){
-						resolve(true);
-					} else {
-						resolve(false);
-					}
-				}
-			})
-		});
-	},
-	navToListPage:function({type,value,id,lType} = {}){	
-	// 跳转到列表页
-		if(lType=='4'){
-			const pages = getCurrentPages();
-			const prevPage = pages[pages.length-2];
-			prevPage.refresh = true;
-			prevPage.listData = {
-				type: type,
-				from: value,
-				id: id
-			}
-			uni.navigateBack({
-				delta: 1
-			})
-		}else{
-			uni.navigateTo({
-				url:`/pages/goods/goods?type=${type}&from=${value}&id=${id}`
-			})
-		}
-	},
-	navigateTo:function(url){
-		//路由跳转:页面之间路由跳转
-		uni.navigateTo({
-			url:url
-		})
-	},
-	redirectTo:function(url){
-	//路由跳转:关闭当前页跳转到新页面	
-		uni.redirectTo({
-			url:url
-		})
-	},
-	switchTabTo:function(url){
-	//路由跳转:底部 tab页
-		uni.switchTab({
-			url:url
-		})
-	},
-	isNumber:function(value){
-	//验证是否为数字
-	    var patrn = /^(-)?\d+(\.\d+)?$/;
-	    if (patrn.exec(value) == null || value == "") {
+    post:function(url,data,loadingStatus,callback){
+        if(loadingStatus){uni.showLoading({mask: true,title:'加载中~'})}
+        uni.request({
+            url: requestUrl+url,
+            data:data,
+            header: {
+                'Accept': 'application/json',
+                'Content-Type': 'application/x-www-form-urlencoded',
+                'X-Token': uni.getStorageSync('token') ? uni.getStorageSync('token') : 'token',
+                'cookie': uni.getStorageSync('sessionid')
+            },
+            method: 'POST',
+            success: (response) => {
+                if(loadingStatus){uni.hideLoading()}
+                const result = response.data
+                callback(result)
+            },
+            fail: (error) => {
+                uni.hideLoading()
+                if (error) {
+                    uni.showToast({icon: 'none',title: '网络错误,请稍后重试',duration: 2000})
+                }
+            }
+        })
+    },
+    getComStorage:function(key){// 获取本地Storage
+        return new Promise(function(resolve,reject) {
+            uni.getStorage({
+                key: key,
+                success: function (res){
+                    resolve(res.data)
+                }
+            })
+        })
+    },
+    setStorage:function(key,data){// 存储本地Storage
+        return new Promise(function(resolve,reject) {
+            uni.setStorage({
+                key: key,
+                data:data,
+                success: function (res){
+                }
+            })
+        })
+    },
+    getStorage:function(){// 获取本地userInfo
+        return new Promise(function(resolve,reject) {
+            uni.getStorage({
+                key: 'userInfo',
+                success: function (res){
+                    resolve(res.data)
+                },
+                fail: function(res){
+                    reject(false)
+                }
+            })
+        })
+    },
+    getStorageAddressKey:function(){// 获取本地地址信息
+        return new Promise(function(resolve,reject) {
+            uni.getStorage({
+                key: 'address_key',
+                success: function (res){
+                    resolve(res.data)
+                }
+            })
+        })
+    },
+    loginStatus:function(){
+        // 获取用户是否登陆 1:已登陆,否则未登陆
+        return new Promise(function(resolve,reject) {
+            uni.getStorage({
+                key: 'userInfo',
+                success: function (res){
+                    if(res.data.code == '1'){
+                        resolve(true)
+                    } else {
+                        resolve(false)
+                    }
+                }
+            })
+        })
+    },
+    navToListPage:function({type,value,id,lType} = {}){	
+        // 跳转到列表页
+        if(lType=='4'){
+            const pages = getCurrentPages()
+            const prevPage = pages[pages.length-2]
+            prevPage.refresh = true
+            prevPage.listData = {
+                type: type,
+                from: value,
+                id: id
+            }
+            uni.navigateBack({
+                delta: 1
+            })
+        }else{
+            uni.navigateTo({
+                url:`/pages/goods/goods?type=${type}&from=${value}&id=${id}`
+            })
+        }
+    },
+    navigateTo:function(url){
+        //路由跳转:页面之间路由跳转
+        uni.navigateTo({
+            url:url
+        })
+    },
+    redirectTo:function(url){
+        //路由跳转:关闭当前页跳转到新页面	
+        uni.redirectTo({
+            url:url
+        })
+    },
+    switchTabTo:function(url){
+        //路由跳转:底部 tab页
+        uni.switchTab({
+            url:url
+        })
+    },
+    isNumber:function(value){
+        //验证是否为数字
+	    var patrn = /^(-)?\d+(\.\d+)?$/
+	    if (patrn.exec(value) == null || value == '') {
 	         return false
 	    } else {
 	         return true  
-		}	 
-	},
-	getWindowHeight:function(){
-		// 获取窗口高度
-		const {windowHeight, pixelRatio} = wx.getSystemInfoSync();
-		return windowHeight;
-	},
-	adaptRichTextImg:function(res){
-		/**
+        }	 
+    },
+    getWindowHeight:function(){
+        // 获取窗口高度
+        const {windowHeight, pixelRatio} = wx.getSystemInfoSync()
+        return windowHeight
+    },
+    adaptRichTextImg:function(res){
+        /**
 		 *@富文本实现图片自适应
 		 *@style再添加自适应样式
 		 */ 
-		const html = res.replace(/<img[^>]*>/gi,function(match,capture){			
-			let match1 = match.replace(/<img*/gi, '<img style="width:100% !important;height:auto !important;float:left !important;"'),
-				results = match1.replace(/style=/gi, 'style="width:100%;height:auto;float:left;"');
-			return results;
-		})
-		return html;	
-	},
-	FormatMoney:function(num){
-		// 金额千分位
-		return num.toString().replace(/\d+/, function (n) { // 先提取整数部分
-			return n.replace(/(\d)(?=(\d{3})+$)/g, function ($1) { // 对整数部分添加分隔符
-				return $1 + ",";
-			});
-		});
-	},
-	formatDate:function(){
-		//获取当前时间
-		let date = new Date();
-		let y = date.getFullYear();
-		let MM = date.getMonth() + 1;
-		MM = MM < 10 ? ('0' + MM) : MM;
-		let d = date.getDate();
-		d = d < 10 ? ('0' + d) : d;
-		let h = date.getHours();
-		h = h < 10 ? ('0' + h) : h;
-		let m = date.getMinutes();
-		m = m < 10 ? ('0' + m) : m;
-		let s = date.getSeconds();
-		s = s < 10 ? ('0' + s) : s;
-	    return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s;
-	},
-	regexSets:function() {
-		let sets = {
-			'companyName': /^[\u4e00-\u9fa5\(\)()\s\da-zA-Z&]{2,50}$/gi,
-			'phoneAndTelephone': /^([1]\d{10}|([\((]?0[0-9]{2,3}[)\)]?[-]?)?([2-9][0-9]{6,7})+(\-[0-9]{1,4})?)$/,
-			'bankNum': /^([1-9]{1})(\d{18})$/,
-			'invalidChar': /^[\s\u4e00-\u9fa5a-z0-9_-]{0,}$/
-		};
-		return sets;
-	},
-	timestampToTime:function(timestamp) {
-		// 时间戳转日期
-	   let date = new Date(timestamp * 1000);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
-	   let Y = date.getFullYear() + '-';
-	   let M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
-	   let D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()) + ' ';
-	   let h = (date.getHours() < 10 ? '0'+date.getHours() : date.getHours()) + ':';
-	   let m = (date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes()) + ':';
-	   let s = (date.getSeconds() < 10 ? '0'+date.getSeconds() : date.getSeconds());
-	   return `${Y}${M}${D}${h}${m}${s}`;
-	}
+        const html = res.replace(/<img[^>]*>/gi,function(match,capture){			
+            let match1 = match.replace(/<img*/gi, '<img style="width:100% !important;height:auto !important;float:left !important;"'),
+                results = match1.replace(/style=/gi, 'style="width:100%;height:auto;float:left;"')
+            return results
+        })
+        return html	
+    },
+    FormatMoney:function(num){
+        // 金额千分位
+        return num.toString().replace(/\d+/, function (n) { // 先提取整数部分
+            return n.replace(/(\d)(?=(\d{3})+$)/g, function ($1) { // 对整数部分添加分隔符
+                return $1 + ','
+            })
+        })
+    },
+    formatDate:function(){
+        //获取当前时间
+        let date = new Date()
+        let y = date.getFullYear()
+        let MM = date.getMonth() + 1
+        MM = MM < 10 ? ('0' + MM) : MM
+        let d = date.getDate()
+        d = d < 10 ? ('0' + d) : d
+        let h = date.getHours()
+        h = h < 10 ? ('0' + h) : h
+        let m = date.getMinutes()
+        m = m < 10 ? ('0' + m) : m
+        let s = date.getSeconds()
+        s = s < 10 ? ('0' + s) : s
+	    return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s
+    },
+    regexSets:function() {
+        let sets = {
+            'companyName': /^[\u4e00-\u9fa5\(\)()\s\da-zA-Z&]{2,50}$/gi,
+            'phoneAndTelephone': /^([1]\d{10}|([\((]?0[0-9]{2,3}[)\)]?[-]?)?([2-9][0-9]{6,7})+(\-[0-9]{1,4})?)$/,
+            'bankNum': /^([1-9]{1})(\d{18})$/,
+            'invalidChar': /^[\s\u4e00-\u9fa5a-z0-9_-]{0,}$/
+        }
+        return sets
+    },
+    timestampToTime:function(timestamp) {
+        // 时间戳转日期
+	   let date = new Date(timestamp * 1000)//时间戳为10位需*1000,时间戳为13位的话不需乘1000
+	   let Y = date.getFullYear() + '-'
+	   let M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-'
+	   let D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()) + ' '
+	   let h = (date.getHours() < 10 ? '0'+date.getHours() : date.getHours()) + ':'
+	   let m = (date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes()) + ':'
+	   let s = (date.getSeconds() < 10 ? '0'+date.getSeconds() : date.getSeconds())
+	   return `${Y}${M}${D}${h}${m}${s}`
+    },
+    getNowFormatDate:function () {
+	    var date = new Date()
+	    var seperator1 = '-'
+	    var year = date.getFullYear()
+	    var month = date.getMonth() + 1
+	    var strDate = date.getDate()
+	    var bours =date.getHours()
+	    var min = date.getMinutes()
+	    var s = date.getSeconds()
+	    if (month >= 1 && month <= 9) {
+	        month = '0' + month
+	    }
+	    if (strDate >= 0 && strDate <= 9) {
+	        strDate = '0' + strDate
+	    }
+	    if (bours >= 0 && bours <= 9) {
+	        bours = '0' + bours
+	    }
+	    if (min >= 0 && min <= 9) {
+	        min = '0' + min
+	    }
+	    if (s >= 0 && s <= 9) {
+	        s = '0' + s
+	    }
+		
+	    var currentdate = year + seperator1 + month + seperator1 + strDate +' ' + bours+ ':'+ min+ ':'+ s
+	    return currentdate
+    }
 }
 
 /**
  *@导出
  */ 
 module.exports = {
-	get: caimeiApi.get,
-	post: caimeiApi.post,
-	lodingGet: caimeiApi.lodingGet,
-	isNumber: caimeiApi.isNumber,
-	FormatMoney: caimeiApi.FormatMoney,
-	navigateTo: caimeiApi.navigateTo,
-	redirectTo: caimeiApi.redirectTo,
-	switchTabTo: caimeiApi.switchTabTo,
-	formatDate: caimeiApi.formatDate,
-	loginStatus: caimeiApi.loginStatus,
-	setStorage: caimeiApi.setStorage,
-	getStorage: caimeiApi.getStorage,
-	getComStorage: caimeiApi.getComStorage,
-	navToListPage: caimeiApi.navToListPage,
-	getWindowHeight: caimeiApi.getWindowHeight,
-	adaptRichTextImg: caimeiApi.adaptRichTextImg,
-	getStorageAddressKey: caimeiApi.getStorageAddressKey,
-	regexSets: caimeiApi.regexSets,
-	timestampToTime: caimeiApi.timestampToTime
-};
+    get: caimeiApi.get,
+    post: caimeiApi.post,
+    lodingGet: caimeiApi.lodingGet,
+    isNumber: caimeiApi.isNumber,
+    FormatMoney: caimeiApi.FormatMoney,
+    navigateTo: caimeiApi.navigateTo,
+    redirectTo: caimeiApi.redirectTo,
+    switchTabTo: caimeiApi.switchTabTo,
+    formatDate: caimeiApi.formatDate,
+    loginStatus: caimeiApi.loginStatus,
+    setStorage: caimeiApi.setStorage,
+    getStorage: caimeiApi.getStorage,
+    getComStorage: caimeiApi.getComStorage,
+    navToListPage: caimeiApi.navToListPage,
+    getWindowHeight: caimeiApi.getWindowHeight,
+    adaptRichTextImg: caimeiApi.adaptRichTextImg,
+    getStorageAddressKey: caimeiApi.getStorageAddressKey,
+    regexSets: caimeiApi.regexSets,
+    timestampToTime: caimeiApi.timestampToTime,
+    getNowFormatDate : caimeiApi.getNowFormatDate 
+}

+ 135 - 135
common/config/common.js

@@ -1,141 +1,141 @@
 //公共js,主要做表单验证,以及基本方法封装
 const utils = {
-	isNullOrEmpty: function(value) {
-		//是否为空
-		return (value === null || value === '' || value === undefined) ? true : false;
-	},
-	trim: function(value) {
-		//去空格
-		return value.replace(/(^\s*)|(\s*$)/g, "");
-	},
-	isEmail: function(value){
-		//是否为邮箱
-		 return RegExp(/^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/).test(value);
-	},
-	isMobile: function(value) {
-		//是否为手机号
-		return RegExp(/^1[1-9][0-9]{9}$/).test(value);
-	},
-	isFloat: function(value) {
-		//金额,只允许保留两位小数
-		return RegExp(/^([0-9]*[.]?[0-9])[0-9]{0,1}$/).test(value);
-	},
-	isNum: function(value) {
-		//是否全为数字
-		return RegExp(/^[0-9]+$/).test(value);
-	},
-	isEmailCode:function(value) {
-	    return RegExp(/^\d{4}$/).test(value);
-	},
-	isMobileCode:function(value) {
-	    return RegExp(/^\d{6}$/).test(value);
-	},
-	isCredit:function(value) {//统一社会信用代码
-	    return RegExp(/^[0-9A-HJ-NPQRTUWXY]{2}\\d{6}[0-9A-HJ-NPQRTUWXY]{10}$/).test(value);
-	},
-	checkPwd: function(value) {
-		//密码为8~20位数字和字母组合
-		return RegExp(/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$/).test(value);
-	},
-	hidePhone:function(value) {
-		return value.replace(/^(\d{3})\d{4}(\d+)/,"$1****$2")
-	},
-	desensitizationName:function(value){
-		if(null != value && value != undefined){
-			if(value.length <= 3){
-				let ruten = value.substring(1);
-				return value.replace(ruten,'**');
-			} else if(value.length > 3 && value.length <= 6){
-				let ruten = value.substring(2);
-				return value.replace(ruten,'**');
-			} 
-		} else {
-			return "";
-		}
-	},
-	formatNum: function(num) {
-		//格式化手机号码
-		if (utils.isMobile(num)) {
-			num = num.replace(/^(\d{3})\d{4}(\d{4})$/, '$1****$2')
-		}
-		return num;
-	},
-	rmoney: function(money) {
-		//金额格式化
-		return parseFloat(money).toFixed(2).toString().split('').reverse().join('').replace(/(\d{3})/g, '$1,').replace(
-			/\,$/, '').split('').reverse().join('');
-	},
-	bankRegex:function(num){
-		let bankNum = ''
-		bankNum = num.replace(/\D/g, '').replace(/(....)(?=.)/g, '$1 ');
-		return bankNum
-	},
-	checkData:function(value){
-		let data;
-		if(value == null || value ==""){
-			data = ''
-		}else{
-			data = value
-		}
-		return data
-	},
-	formatDate: function(formatStr, fdate) {
-		//日期格式化
-		if (fdate) {
-			if (~fdate.indexOf('.')) {
-				fdate = fdate.substring(0, fdate.indexOf('.'));
-			}
-			fdate = fdate.toString().replace('T', ' ').replace(/\-/g, '/');
-			var fTime, fStr = 'ymdhis';
-			if (!formatStr)
-				formatStr = "y-m-d h:i:s";
-			if (fdate)
-				fTime = new Date(fdate);
-			else
-				fTime = new Date();
-			var month = fTime.getMonth() + 1;
-			var day = fTime.getDate();
-			var hours = fTime.getHours();
-			var minu = fTime.getMinutes();
-			var second = fTime.getSeconds();
-			month = month < 10 ? '0' + month : month;
-			day = day < 10 ? '0' + day : day;
-			hours = hours < 10 ? ('0' + hours) : hours;
-			minu = minu < 10 ? '0' + minu : minu;
-			second = second < 10 ? '0' + second : second;
-			var formatArr = [
-				fTime.getFullYear().toString(),
-				month.toString(),
-				day.toString(),
-				hours.toString(),
-				minu.toString(),
-				second.toString()
-			]
-			for (var i = 0; i < formatArr.length; i++) {
-				formatStr = formatStr.replace(fStr.charAt(i), formatArr[i]);
-			}
-			return formatStr;
-		} else {
-			return "";
-		}
-	},
+    isNullOrEmpty: function(value) {
+        //是否为空
+        return (value === null || value === '' || value === undefined) ? true : false
+    },
+    trim: function(value) {
+        //去空格
+        return value.replace(/(^\s*)|(\s*$)/g, '')
+    },
+    isEmail: function(value){
+        //是否为邮箱
+		 return RegExp(/^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/).test(value)
+    },
+    isMobile: function(value) {
+        //是否为手机号
+        return RegExp(/^1[1-9][0-9]{9}$/).test(value)
+    },
+    isFloat: function(value) {
+        //金额,只允许保留两位小数
+        return RegExp(/^([0-9]*[.]?[0-9])[0-9]{0,1}$/).test(value)
+    },
+    isNum: function(value) {
+        //是否全为数字
+        return RegExp(/^[0-9]+$/).test(value)
+    },
+    isEmailCode:function(value) {
+	    return RegExp(/^\d{4}$/).test(value)
+    },
+    isMobileCode:function(value) {
+	    return RegExp(/^\d{6}$/).test(value)
+    },
+    isCredit:function(value) {//统一社会信用代码
+	    return RegExp(/^[0-9A-HJ-NPQRTUWXY]{2}\\d{6}[0-9A-HJ-NPQRTUWXY]{10}$/).test(value)
+    },
+    checkPwd: function(value) {
+        //密码为8~20位数字和字母组合
+        return RegExp(/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$/).test(value)
+    },
+    hidePhone:function(value) {
+        return value.replace(/^(\d{3})\d{4}(\d+)/,'$1****$2')
+    },
+    desensitizationName:function(value){
+        if(null != value && value != undefined){
+            if(value.length <= 3){
+                let ruten = value.substring(1)
+                return value.replace(ruten,'**')
+            } else if(value.length > 3 && value.length <= 6){
+                let ruten = value.substring(2)
+                return value.replace(ruten,'**')
+            } 
+        } else {
+            return ''
+        }
+    },
+    formatNum: function(num) {
+        //格式化手机号码
+        if (utils.isMobile(num)) {
+            num = num.replace(/^(\d{3})\d{4}(\d{4})$/, '$1****$2')
+        }
+        return num
+    },
+    rmoney: function(money) {
+        //金额格式化
+        return parseFloat(money).toFixed(2).toString().split('').reverse().join('').replace(/(\d{3})/g, '$1,').replace(
+            /\,$/, '').split('').reverse().join('')
+    },
+    bankRegex:function(num){
+        let bankNum = ''
+        bankNum = num.replace(/\D/g, '').replace(/(....)(?=.)/g, '$1 ')
+        return bankNum
+    },
+    checkData:function(value){
+        let data
+        if(value == null || value ==''){
+            data = ''
+        }else{
+            data = value
+        }
+        return data
+    },
+    formatDate: function(formatStr, fdate) {
+        //日期格式化
+        if (fdate) {
+            if (~fdate.indexOf('.')) {
+                fdate = fdate.substring(0, fdate.indexOf('.'))
+            }
+            fdate = fdate.toString().replace('T', ' ').replace(/\-/g, '/')
+            var fTime, fStr = 'ymdhis'
+            if (!formatStr)
+                formatStr = 'y-m-d h:i:s'
+            if (fdate)
+                fTime = new Date(fdate)
+            else
+                fTime = new Date()
+            var month = fTime.getMonth() + 1
+            var day = fTime.getDate()
+            var hours = fTime.getHours()
+            var minu = fTime.getMinutes()
+            var second = fTime.getSeconds()
+            month = month < 10 ? '0' + month : month
+            day = day < 10 ? '0' + day : day
+            hours = hours < 10 ? ('0' + hours) : hours
+            minu = minu < 10 ? '0' + minu : minu
+            second = second < 10 ? '0' + second : second
+            var formatArr = [
+                fTime.getFullYear().toString(),
+                month.toString(),
+                day.toString(),
+                hours.toString(),
+                minu.toString(),
+                second.toString()
+            ]
+            for (var i = 0; i < formatArr.length; i++) {
+                formatStr = formatStr.replace(fStr.charAt(i), formatArr[i])
+            }
+            return formatStr
+        } else {
+            return ''
+        }
+    },
 }
 
 module.exports = {
-	isNullOrEmpty: utils.isNullOrEmpty,
-	trim: utils.trim,
-	isMobile: utils.isMobile,
-	isEmail: utils.isEmail,
-	isFloat: utils.isFloat,
-	isNum: utils.isNum,
-	isEmailCode:utils.isEmailCode,
-	isMobileCode:utils.isMobileCode,
-	checkPwd: utils.checkPwd,
-	formatNum:utils.formatNum,
-	rmoney: utils.rmoney,
-	formatDate: utils.formatDate,
-	bankRegex: utils.bankRegex,
-	checkData:utils.checkData,
-	hidePhone:utils.hidePhone,
-	desensitizationName:utils.desensitizationName
+    isNullOrEmpty: utils.isNullOrEmpty,
+    trim: utils.trim,
+    isMobile: utils.isMobile,
+    isEmail: utils.isEmail,
+    isFloat: utils.isFloat,
+    isNum: utils.isNum,
+    isEmailCode:utils.isEmailCode,
+    isMobileCode:utils.isMobileCode,
+    checkPwd: utils.checkPwd,
+    formatNum:utils.formatNum,
+    rmoney: utils.rmoney,
+    formatDate: utils.formatDate,
+    bankRegex: utils.bankRegex,
+    checkData:utils.checkData,
+    hidePhone:utils.hidePhone,
+    desensitizationName:utils.desensitizationName
 }

+ 7 - 3
common/css/iconfont.scss

@@ -1,8 +1,8 @@
 @font-face {
   font-family: "iconfont"; /* Project id 3182369 */
-  src: url('//at.alicdn.com/t/font_3182369_vc57ueycvk.woff2?t=1644825900659') format('woff2'),
-       url('//at.alicdn.com/t/font_3182369_vc57ueycvk.woff?t=1644825900659') format('woff'),
-       url('//at.alicdn.com/t/font_3182369_vc57ueycvk.ttf?t=1644825900659') format('truetype');
+  src: url('//at.alicdn.com/t/font_3182369_fmba8bc8wln.woff2?t=1644889171295') format('woff2'),
+       url('//at.alicdn.com/t/font_3182369_fmba8bc8wln.woff?t=1644889171295') format('woff'),
+       url('//at.alicdn.com/t/font_3182369_fmba8bc8wln.ttf?t=1644889171295') format('truetype');
 }
 
 .iconfont {
@@ -13,6 +13,10 @@
   -moz-osx-font-smoothing: grayscale;
 }
 
+.icon-fanhui2:before {
+  content: "\e6ae";
+}
+
 .icon-guanbi:before {
   content: "\e639";
 }

+ 1 - 0
components/thorui/tui-datetime/tui-datetime.vue

@@ -278,6 +278,7 @@
 			},
 			hide() {
 				this.isShow = false;
+				this.$emit('cancel',{})
 			},
 			change(e) {
 				this.value = e.detail.value;

+ 17 - 2
pages.json

@@ -1,7 +1,7 @@
 {
 	"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
 		{
-			"path": "pages/distinguish/index",
+			"path": "pages/collection/index",
 			"style": {
 				"navigationBarTitleText": "",
 				"enablePullDownRefresh":true,
@@ -9,13 +9,28 @@
 			}
 		},
 		{
-			"path": "pages/distinguish/nosms",
+			"path": "pages/collection/nosms",
 			"style": {
 				"navigationBarTitleText": "",
 				"enablePullDownRefresh":true,
 				"navigationStyle":"custom"
 			}
 		},
+		{
+			"path": "pages/collection/list",
+			"style": {
+				"navigationBarTitleText": "",
+				"enablePullDownRefresh":true,
+				"navigationStyle":"custom"
+			}
+		},
+		{
+			"path": "pages/collection/detail",
+			"style": {
+				"navigationBarTitleText": "",
+				"navigationStyle":"custom"
+			}
+		},
 		{
 			"path": "pages/login/login-account",
 			"style": {

File diff suppressed because it is too large
+ 317 - 0
pages/collection/detail.vue


+ 275 - 63
pages/distinguish/nosms.vue → pages/collection/index.vue

@@ -4,9 +4,9 @@
 		<view class="tui-header-box first"
 			:style="{height:isCmcustomClass == 'fiexd'? CustomBar+10+'px' : CustomBar+30+'px'}"
 			:class="isCmcustomClass">
-			<view class="tui-header" :style="{paddingTop:top+'px',lineHeight: CustomBar+30+'px'}"></view>
+			<view class="header-top" :style="{paddingTop:top+'px',lineHeight: CustomBar+30+'px'}"></view>
 			<view class="header-sit">
-				<text>无短信收款</text>
+				<text>款项识别</text>
 			</view>
 		</view>
 		<view class="tui-header-box" :style="{height:CustomBar+30+'px',backgroundImage: 'url('+statistic_bg1+')'}">
@@ -14,53 +14,133 @@
 		<view class="distinguish-section" :style="{top:CustomBar+'px',left:0+'px'}">
 			<view class="distinguish-section-conten">
 				<view class="section-top">
-					<view class="button">
+					<view class="title">收款短信</view>
+					<view class="button" @click="toNoSms('/pages/collection/list')">
 						<text class="iconfont icon-wodedingdan"></text>
 						收款列表
 					</view>
 				</view>
-				<view class="section-rows">
-					<view class="rows-label">款项类型:</view>
-					<view class="rows-mains">
-						<input class="input" type="text" disabled="true" placeholder="请选择款项类型"/>
-					</view>
-					<text class="iconfont icon-xiayibu"></text>
+				<view class="section-textarea">
+					<textarea class="textarea" placeholder="收款短信内容..." v-model="textarea" @blur="onTextareaInput" />
 				</view>
-				<view class="section-rows">
-					<view class="rows-label">收款时间:</view>
-					<view class="rows-mains">
-						<input class="input" type="text" disabled="true" placeholder="请选择收款时间"/>
+				<template v-if="!isConfirm">
+					<view class="section-rows">
+						<view class="rows-label">款项类型:</view>
+						<view class="rows-mains">
+							<picker
+								@change="bindPickerChange(1, $event)"
+								:value="index"
+								:range="paymentActions"
+								range-key="name"
+							>
+								<input
+									class="input"
+									type="text"
+									disabled="true"
+									v-model="paymentTypeText"
+									value=""
+									placeholder="请选择款项类型"
+								/>
+							</picker>
+						</view>
+						<text class="iconfont icon-xiayibu"></text>
 					</view>
-					<text class="iconfont icon-xiayibu"></text>
-				</view>
-				<view class="section-rows">
-					<view class="rows-label">收款类型:</view>
-					<view class="rows-mains">
-						<input class="input" type="text" disabled="true" placeholder="请选择收款类型"/>
+					<view class="section-rows">
+						<view class="rows-label">收款时间:</view>
+						<view class="rows-mains">
+							<input
+								class="input"
+								type="text"
+								v-model="params.time"
+								disabled="true"
+								placeholder="请选择收款时间"
+								@click="showTuiDateTime"
+							/>
+						</view>
+						<text class="iconfont icon-xiayibu"></text>
 					</view>
-					<text class="iconfont icon-xiayibu"></text>
-				</view>
-				<view class="section-rows">
-					<view class="rows-label">收款金额:</view>
-					<view class="rows-mains">
-						<input class="input" type="text" placeholder="请输入收款金额"/>
+					<view class="section-rows">
+						<view class="rows-label">收款类型:</view>
+						<view class="rows-mains">
+							<picker
+								@change="bindPickerChange(2, $event)"
+								:value="index"
+								:range="banksActions"
+								range-key="name"
+							>
+								<input
+									class="input"
+									type="text"
+									disabled="true"
+									v-model="banksTypeText"
+									placeholder="请选择收款类型"
+								/>
+							</picker>
+						</view>
+						<text class="iconfont icon-xiayibu"></text>
 					</view>
-				</view>
-				<view class="section-rows">
-					<view class="rows-label">手续费:</view>
-					<view class="rows-mains">
-						<input class="input" type="text" placeholder="请输入手续费"/>
+					<view class="section-rows">
+						<view class="rows-label">收款金额:</view>
+						<view class="rows-mains">
+							<input
+								class="input"
+								v-model="params.amount"
+								@blur="changeNumber($event)"
+								type="number"
+								placeholder="请输入收款金额"
+							/>
+						</view>
 					</view>
-				</view>
-				<view class="section-text">收款短信(备注,必填)</view>
-				<view class="section-textarea">
-					<textarea class="textarea" placeholder="请输入收款短信备注..." v-model="textarea" @input="onTextareaInput" />
-				</view>
+					<view class="section-rows" :class="isCheckedCharge ? '' : 'disabled'">
+						<view class="rows-label">
+							<text
+								class="iconfont"
+								:class="isCheckedCharge ? 'icon-yixuanze' : 'icon-weixuanze'"
+								@click="checkedCharge"
+							></text>
+							手续费:
+						</view>
+						<view class="rows-mains">
+							<input
+								class="input"
+								v-model="params.chargeValue"
+								:disabled="!isCheckedCharge"
+								type="text"
+								placeholder="请输入手续费"
+							/>
+						</view>
+					</view>
+				</template>
 			</view>
 			<view class="distinguish-button">
 				<view class="button" :disabled="isConfirm" :class="[isConfirm ? 'disabled':'']" @click="confirmDistinguish">收款</view>
 			</view>
+			<view class="distinguish-button-text" @click="toNoSms('/pages/collection/nosms')">无短信收款</view>
 		</view>
+		<!-- 时间组件 -->
+		<tui-datetime
+			ref="dateTime"
+			:type="7"
+			:startYear="startYear"
+			:endYear="endYear"
+			cancelColor="#555555"
+			color="#4688fa"
+			@confirm="bindStartDateChange"
+		></tui-datetime>
+		<!-- 弹窗提示 -->
+		<tui-modal
+			:show="modal"
+			@click="handleClick"
+			@cancel="hideMobel"
+			:title="contentModalTitle"
+			:content="contentModalText"
+			:button="modalButton"
+			color="#333"
+			:size="32"
+			shape="circle"
+			:maskClosable="false"
+		>
+		</tui-modal>
 	</view>
 </template>
 <script>
@@ -85,9 +165,6 @@
 					bgColor: '#D33020',
 					textColor: '#ffffff'
 				},
-				params:{
-					type:''
-				},
 				textarea: '',
 				infoData: {},
 				isCmcustomClass: 'left',
@@ -98,7 +175,56 @@
 				top: 0, //标题图标距离顶部距离
 				scrollH: 0, //滚动总高度
 				opcity: 1,
-				isConfirm: true
+				isConfirm: true,
+				type: 7,
+				setDateTime: '',
+				startYear: 1980,
+				endYear: 2030,
+				modalButton: [
+					{
+						text: '取消',
+						type: 'gray',
+						plain: true //是否空心
+					},
+					{
+						text: '确认',
+						customStyle: {
+							color: '#fff',
+							bgColor: '#4688fa'
+						},
+						plain: false
+					}
+				],
+				paymentActions: [
+					{ name: '普通款项', value: 1 },
+					{ name: '返佣款项', value: 2 },
+					{ name: '供应商退款', value: 3 }
+				],
+				banksActions: [
+					{ name: '建设银行-7297', value: 1 },
+					{ name: '广发银行-0115', value: 2 },
+					{ name: '中信银行-7172', value: 3 },
+					{ name: '中信银行-0897', value: 4 },
+					{ name: '中信银行0897-财付通', value: 5 },
+					{ name: '中信银行0897-支付宝', value: 6 },
+					{ name: '支付宝', value: 7 },
+					{ name: '微信支付', value: 8 },
+					{ name: '快钱支付', value: 9 }
+				],
+				paymentTypeText: '普通款项', // 款项类型显示文案
+				banksTypeText: '建设银行-7297', // 款项类型显示文案
+				params: {
+					type: 1,
+					banksType: 1,
+					amount: '',
+					chargeValue: '',
+					remarks: '',
+					time: this.$api.getNowFormatDate()
+				},
+				isCheckedCharge: false,
+				contentModalTitle:'',
+				contentModalText: '', //操作文字提示语句
+				modal: false,
 			}
 		},
 		onLoad() {
@@ -131,20 +257,94 @@
 			...mapState(['hasLogin', 'userInfo'])
 		},
 		methods: {
-			confirmDistinguish(){
+			onTextareaInput(e){
+			   this.textarea = e.detail.value
+			   this.initInput()
+			},
+			initInput() {
+				if (this.textarea != '') {
+					this.isConfirm = false
+				} else {
+					this.isConfirm = true
+				}
+			},
+			bindPickerChange(type, e) {
+				// 选择选项
+				switch (type) {
+					case 1:
+						this.paymentTypeText = this.paymentActions[e.target.value].name
+						this.params.type = this.paymentActions[e.target.value].value
+						console.log('款项类型', this.paymentTypeText)
+						console.log('款项类型', this.params.type)
+						break
+					case 2:
+						this.banksTypeText = this.paymentActions[e.target.value].name
+						this.params.banksType = this.paymentActions[e.target.value].value
+						console.log('收款类型', this.params.banksType)
+						break
+				}
+			},
+			showTuiDateTime() {
+				this.$refs.dateTime.show()
+			},
+			bindStartDateChange(event) {
+				//开始时间
+				console.log('开始时间==>', event.result)
+				this.params.time = event.result
+			},
+			confirmDistinguish() {
 				if(this.isConfirm){return}
+				if (this.params.amount == '') {
+					this.$util.msg('请输入收款金额', 2000)
+					return
+				}
+				if (this.isCheckedCharge) {
+					if (this.params.chargeValue == '') {
+						this.$util.msg('请输入手续费', 2000)
+						return
+					}
+				}
+				if (this.params.remarks == '') {
+					this.$util.msg('请填写收款备注', 2000)
+					return
+				}
+				if(this.params.type == 1){
+					this.contentModalTitle ='确定收款吗?'
+					this.contentModalText ='确认前请仔细检查各项数据是否正确,确认收款后将不能进行修改。' //操作文字提示语句
+				}else if(this.params.type == 2){
+					this.contentModalTitle =''
+					this.contentModalText ='确定返佣收款吗?' //操作文字提示语句
+				}else if(this.params.type == 3){
+					this.contentModalTitle =''
+					this.contentModalText = '确定供应商退款吗?' //操作文字提示语句
+				}
+				this.modal = true
 				console.log('收款')
 			},
-			onTextareaInput(e){
-			   this.textarea = e.detail.value;
-			   this.initInput();
+			handleClick(e){
+				// 确认收款
+				if (e.index == 1) {
+					
+				}
+				this.modal = false
 			},
-			initInput() {
-				if (this.textarea != "") {
-					this.isConfirm = false;
+			hideMobel(){
+				this.modal = false
+			},
+			checkedCharge() {
+				// 勾选手续费
+				this.isCheckedCharge = !this.isCheckedCharge
+			},
+			changeNumber(e) {
+				// 校验输入为数字
+				if (!this.$api.isNumber(e.detail.value)) {
+					this.params.amount = ''
 				} else {
-					this.isConfirm = true;
+					this.params.amount = e.detail.value
 				}
+			},
+			toNoSms(url){
+				this.$api.navigateTo(url)
 			}
 		},
 		onPageScroll(e) { //实时获取到滚动的值
@@ -194,7 +394,7 @@
 		}
 	}
 
-	.tui-header {
+	.header-top {
 		width: 100%;
 		font-size: 16px;
 		font-weight: 500;
@@ -207,7 +407,7 @@
 	}
 
 	.header-sit {
-		width: 400rpx;
+		width: 200rpx;
 		height: 80rpx;
 		line-height: 80rpx;
 		box-sizing: border-box;
@@ -265,23 +465,32 @@
 				color: #FFFFFF;
 			}
 		}
-		.section-rows{
+		.section-rows {
 			width: 100%;
 			height: 80rpx;
 			box-sizing: border-box;
 			padding: 0 20rpx;
 			border-radius: 8rpx;
-			background: #F8F8F8;
+			background: #f8f8f8;
 			margin-bottom: 20rpx;
 			line-height: 80rpx;
 			display: flex;
 			position: relative;
-			.rows-label{
+			&.disabled {
+				background: #e1e1e1;
+			}
+			.rows-label {
 				flex: 3;
+				.iconfont {
+					margin-right: 8rpx;
+					&.icon-yixuanze {
+						color: $color-system;
+					}
+				}
 			}
-			.rows-mains{
+			.rows-mains {
 				flex: 7;
-				.input{
+				.input {
 					width: 100%;
 					height: 80rpx;
 					box-sizing: border-box;
@@ -291,7 +500,7 @@
 					color: #333333;
 				}
 			}
-			.iconfont{
+			.icon-xiayibu {
 				display: block;
 				width: 40rpx;
 				height: 80rpx;
@@ -301,20 +510,14 @@
 				font-size: $font-size-32;
 			}
 		}
-		.section-text{
-			width: 100%;
-			height: 66rpx;
-			line-height: 66rpx;
-			font-size: $font-size-24;
-			color: #333333;
-		}
 		.section-textarea {
 			width: 100%;
-			height: 260rpx;
+			height: 300rpx;
 			box-sizing: border-box;
 			padding: 20rpx;
 			background: #F7F7F7;
 			border-radius: 8rpx;
+			margin-bottom: 20rpx;
 			.textarea {
 				width: 100%;
 				height: 100%;
@@ -346,6 +549,15 @@
 		}
 	}
 
+	.distinguish-button-text {
+		width: 100%;
+		height: 80rpx;
+		line-height: 80rpx;
+		text-align: center;
+		color: $btn-confirm;
+		font-size: $font-size-28;
+	}
+
 	.uni-badge--small {
 		-webkit-transform: scale(.8);
 		-ms-transform: scale(.8);

File diff suppressed because it is too large
+ 762 - 0
pages/collection/list.vue


File diff suppressed because it is too large
+ 375 - 0
pages/collection/nosms.vue


File diff suppressed because it is too large
+ 0 - 160
pages/distinguish/index.vue


Some files were not shown because too many files changed in this diff