From 3088532b460b50ebdff5f94ae16e5bdced6a92bc Mon Sep 17 00:00:00 2001 From: zmj <1493694146@qq.com> Date: Wed, 15 Nov 2023 18:47:53 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../logistiCard/logistiCard.vue | 88 ++- pages.json | 17 - pages/logistics/index.vue | 2 + pages/logistics/logisticDetil.vue | 45 +- pages/logistics/te.vue | 347 --------- subpkg/buyShare/buyShare.vue | 16 +- uni_modules/uni-file-picker/changelog.md | 67 ++ .../uni-file-picker/choose-and-upload-file.js | 224 ++++++ .../uni-file-picker/uni-file-picker.vue | 667 ++++++++++++++++++ .../uni-file-picker/upload-file.vue | 325 +++++++++ .../uni-file-picker/upload-image.vue | 292 ++++++++ .../components/uni-file-picker/utils.js | 109 +++ uni_modules/uni-file-picker/package.json | 83 +++ uni_modules/uni-file-picker/readme.md | 11 + 14 files changed, 1892 insertions(+), 401 deletions(-) delete mode 100644 pages/logistics/te.vue create mode 100644 uni_modules/uni-file-picker/changelog.md create mode 100644 uni_modules/uni-file-picker/components/uni-file-picker/choose-and-upload-file.js create mode 100644 uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.vue create mode 100644 uni_modules/uni-file-picker/components/uni-file-picker/upload-file.vue create mode 100644 uni_modules/uni-file-picker/components/uni-file-picker/upload-image.vue create mode 100644 uni_modules/uni-file-picker/components/uni-file-picker/utils.js create mode 100644 uni_modules/uni-file-picker/package.json create mode 100644 uni_modules/uni-file-picker/readme.md diff --git a/components/logistiComptent/logistiCard/logistiCard.vue b/components/logistiComptent/logistiCard/logistiCard.vue index c832e95..662d55e 100644 --- a/components/logistiComptent/logistiCard/logistiCard.vue +++ b/components/logistiComptent/logistiCard/logistiCard.vue @@ -190,7 +190,6 @@ {{goodsInfo.qh_time}} - @@ -226,10 +225,7 @@ 查看详情 - - - @@ -240,7 +236,6 @@ {{goodsInfo.receiver_phone}} - @@ -253,9 +248,6 @@ - - - @@ -278,15 +270,8 @@ 查看详情 - - - - - - - @@ -296,7 +281,16 @@ - + + + + + + {{tit}} + + + + @@ -314,6 +308,8 @@ props: ['goodsInfo'], data() { return { + tit: "", + showToast: false, is_captain: 0, list: [], flag: undefined, @@ -347,6 +343,8 @@ // 扫码 qrqodeFn() { + + let that = this uni.scanCode({ onlyFromCamera: true, @@ -363,8 +361,11 @@ order_id: this.goodsInfo.order_id, order_sn: sn }).then(res => { - console.log(res) - this.$emit('showTost') + this.tit = "骑手取货完成" + this.showToast = true + setTimeout(() => { + this.showToast = false + }, 1000) this.$emit('getlist') }).catch(err => { Toast(err.msg) @@ -374,6 +375,9 @@ }, confirm() { + + + if (!this.take_code) { return } @@ -388,8 +392,12 @@ take_code: this.take_code, logistics_id: this.goodsInfo.id }).then(res => { - console.log(res) - this.$emit('showTost') + this.tit = "骑手送货完成" + this.showPop = false + this.showToast = true + setTimeout(() => { + this.showToast = false + }, 1000) this.$emit('getlist') }).catch(err => { console.log(err.msg) @@ -527,4 +535,44 @@ margin-right: 30rpx } } + + .rect { + width: 455.61rpx; + height: 210.28rpx; + background-color: white; + border-radius: 21.03rpx 21.03rpx 21.03rpx 21.03rpx; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + + .cont { + color: #0022C7; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + font-size: 35.05rpx; + } + } + + .rect { + width: 455.61rpx; + height: 210.28rpx; + background-color: white; + border-radius: 21.03rpx 21.03rpx 21.03rpx 21.03rpx; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + + .cont { + color: #0022C7; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + font-size: 35.05rpx; + } + } \ No newline at end of file diff --git a/pages.json b/pages.json index 80f514f..eb6ff10 100644 --- a/pages.json +++ b/pages.json @@ -133,23 +133,6 @@ "navigationBarTextStyle": "white" } - }, { - "path": "pages/logistics/te", - "style": { - "navigationBarTitleText": "测试", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#0122C7", - "navigationBarTextStyle": "white" - } - }, { - "path": "pages/logistics/te", - "style": { - "navigationBarTitleText": "测试", - "enablePullDownRefresh": false, - "navigationBarBackgroundColor": "#0122C7", - "navigationBarTextStyle": "white" - } - }, { "path": "pages/logistics/logisticDetil", "style": { diff --git a/pages/logistics/index.vue b/pages/logistics/index.vue index cafb95b..a30c34c 100644 --- a/pages/logistics/index.vue +++ b/pages/logistics/index.vue @@ -20,6 +20,7 @@ + @@ -42,6 +43,7 @@ }, data() { return { + showToast: false, is_captain: "", notArr: [], keywords: "", diff --git a/pages/logistics/logisticDetil.vue b/pages/logistics/logisticDetil.vue index e7b14ee..ad52179 100644 --- a/pages/logistics/logisticDetil.vue +++ b/pages/logistics/logisticDetil.vue @@ -248,6 +248,15 @@ + + + + + 骑手送货完成 + + + + @@ -268,6 +277,7 @@ export default { data() { return { + showToast: false, showPop: false, showLoading: true, goodsDetil: undefined, @@ -293,12 +303,16 @@ return name[0] + fuzzyChars; }, confirm() { + if (!this.take_code) return doneDelivery({ take_code: this.take_code, logistics_id: this.goodsDetil.logistics.id }).then(res => { - this.showToast() + this.showToast = true + setTimeout(() => { + this.showToast = false + }, 1000) setTimeout(() => { uni.navigateBack() }, 2000) @@ -306,14 +320,7 @@ this.showPop = false }, - showToast() { - this.$refs.uToast.show({ - type: 'success', - title: '成功主题(带图标)', - message: "操作成功", - iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png' - }) - }, + }, onLoad(options) { getDetil({ @@ -447,4 +454,24 @@ } } + + .rect { + width: 455.61rpx; + height: 210.28rpx; + background-color: white; + border-radius: 21.03rpx 21.03rpx 21.03rpx 21.03rpx; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + + .cont { + color: #0022C7; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + font-size: 35.05rpx; + } + } \ No newline at end of file diff --git a/pages/logistics/te.vue b/pages/logistics/te.vue deleted file mode 100644 index 967a0ce..0000000 --- a/pages/logistics/te.vue +++ /dev/null @@ -1,347 +0,0 @@ - - - - - \ No newline at end of file diff --git a/subpkg/buyShare/buyShare.vue b/subpkg/buyShare/buyShare.vue index 08c96bf..90cd095 100644 --- a/subpkg/buyShare/buyShare.vue +++ b/subpkg/buyShare/buyShare.vue @@ -75,7 +75,8 @@ @click="navTo(`/subpkg/topUp/topUp?task_id=${task_id}`)"> --> - + + + + diff --git a/uni_modules/uni-file-picker/components/uni-file-picker/upload-file.vue b/uni_modules/uni-file-picker/components/uni-file-picker/upload-file.vue new file mode 100644 index 0000000..625d92e --- /dev/null +++ b/uni_modules/uni-file-picker/components/uni-file-picker/upload-file.vue @@ -0,0 +1,325 @@ + + + + + diff --git a/uni_modules/uni-file-picker/components/uni-file-picker/upload-image.vue b/uni_modules/uni-file-picker/components/uni-file-picker/upload-image.vue new file mode 100644 index 0000000..2a29bc2 --- /dev/null +++ b/uni_modules/uni-file-picker/components/uni-file-picker/upload-image.vue @@ -0,0 +1,292 @@ + + + + + diff --git a/uni_modules/uni-file-picker/components/uni-file-picker/utils.js b/uni_modules/uni-file-picker/components/uni-file-picker/utils.js new file mode 100644 index 0000000..60aaa3e --- /dev/null +++ b/uni_modules/uni-file-picker/components/uni-file-picker/utils.js @@ -0,0 +1,109 @@ +/** + * 获取文件名和后缀 + * @param {String} name + */ +export const get_file_ext = (name) => { + const last_len = name.lastIndexOf('.') + const len = name.length + return { + name: name.substring(0, last_len), + ext: name.substring(last_len + 1, len) + } +} + +/** + * 获取扩展名 + * @param {Array} fileExtname + */ +export const get_extname = (fileExtname) => { + if (!Array.isArray(fileExtname)) { + let extname = fileExtname.replace(/(\[|\])/g, '') + return extname.split(',') + } else { + return fileExtname + } + return [] +} + +/** + * 获取文件和检测是否可选 + */ +export const get_files_and_is_max = (res, _extname) => { + let filePaths = [] + let files = [] + if(!_extname || _extname.length === 0){ + return { + filePaths, + files + } + } + res.tempFiles.forEach(v => { + let fileFullName = get_file_ext(v.name) + const extname = fileFullName.ext.toLowerCase() + if (_extname.indexOf(extname) !== -1) { + files.push(v) + filePaths.push(v.path) + } + }) + if (files.length !== res.tempFiles.length) { + uni.showToast({ + title: `当前选择了${res.tempFiles.length}个文件 ,${res.tempFiles.length - files.length} 个文件格式不正确`, + icon: 'none', + duration: 5000 + }) + } + + return { + filePaths, + files + } +} + + +/** + * 获取图片信息 + * @param {Object} filepath + */ +export const get_file_info = (filepath) => { + return new Promise((resolve, reject) => { + uni.getImageInfo({ + src: filepath, + success(res) { + resolve(res) + }, + fail(err) { + reject(err) + } + }) + }) +} +/** + * 获取封装数据 + */ +export const get_file_data = async (files, type = 'image') => { + // 最终需要上传数据库的数据 + let fileFullName = get_file_ext(files.name) + const extname = fileFullName.ext.toLowerCase() + let filedata = { + name: files.name, + uuid: files.uuid, + extname: extname || '', + cloudPath: files.cloudPath, + fileType: files.fileType, + url: files.path || files.path, + size: files.size, //单位是字节 + image: {}, + path: files.path, + video: {} + } + if (type === 'image') { + const imageinfo = await get_file_info(files.path) + delete filedata.video + filedata.image.width = imageinfo.width + filedata.image.height = imageinfo.height + filedata.image.location = imageinfo.path + } else { + delete filedata.image + } + return filedata +} diff --git a/uni_modules/uni-file-picker/package.json b/uni_modules/uni-file-picker/package.json new file mode 100644 index 0000000..35c926c --- /dev/null +++ b/uni_modules/uni-file-picker/package.json @@ -0,0 +1,83 @@ +{ + "id": "uni-file-picker", + "displayName": "uni-file-picker 文件选择上传", + "version": "1.0.4", + "description": "文件选择上传组件,可以选择图片、视频等任意文件并上传到当前绑定的服务空间", + "keywords": [ + "uni-ui", + "uniui", + "图片上传", + "文件上传" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, +"dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", + "type": "component-vue" + }, + "uni_modules": { + "dependencies": ["uni-scss"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "n" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} diff --git a/uni_modules/uni-file-picker/readme.md b/uni_modules/uni-file-picker/readme.md new file mode 100644 index 0000000..c8399a5 --- /dev/null +++ b/uni_modules/uni-file-picker/readme.md @@ -0,0 +1,11 @@ + +## FilePicker 文件选择上传 + +> **组件名:uni-file-picker** +> 代码块: `uFilePicker` + + +文件选择上传组件,可以选择图片、视频等任意文件并上传到当前绑定的服务空间 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-file-picker) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file