From 9e5d5c5c8f198f0a1a707302e5e32be81f618eb2 Mon Sep 17 00:00:00 2001 From: 396316021 <396316021@qq.com> Date: Fri, 24 Nov 2023 16:28:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/PetPage/index.vue | 26 ++- pages/CardDetail/index.vue | 8 +- pages/FeedLog/components/FeedLog.vue | 221 ++++++++++-------- pages/OrderConfirm/end.vue | 2 +- pages/OrderConfirm/start.vue | 41 ++-- pages/OrderDetail/components/fomItem.vue | 38 ++- pages/OrderDetail/components/index.scss | 5 - pages/OrderDetail/index.vue | 19 +- pages/OrderPage/index.vue | 8 +- .../components/uv-upload/uv-upload.vue | 2 +- 10 files changed, 194 insertions(+), 176 deletions(-) diff --git a/components/PetPage/index.vue b/components/PetPage/index.vue index a88cfdf..9e7df4b 100644 --- a/components/PetPage/index.vue +++ b/components/PetPage/index.vue @@ -804,18 +804,22 @@ }); }); for (let i = 0; i < lists.length; i++) { + const fileType = api.getFileType(lists[i].url); + console.log(fileType) + let thumb; + const file = await api.uploadOssFile(lists[i].url); + if(fileType === 'video')thumb = await api.uploadOssFile(lists[i].thumb); + let item = this.imagesList[fileListLen]; - api.uploadOssFile(lists[i].url).then(res => { - let item = this.imagesList[fileListLen]; - this.imagesList.splice(fileListLen, 1, { - ...item, - status: 'success', - message: '', - url: res.show_path, - thumb: res.show_path, - }); - fileListLen++; - }) + this.imagesList.splice(fileListLen, 1, { + ...item, + status: 'success', + message: '', + url: file.show_path, + thumb: thumb?.show_path ? thumb.show_path : file.show_path, + type: fileType + }); + fileListLen++; } }, async afterVideoRead (event){ diff --git a/pages/CardDetail/index.vue b/pages/CardDetail/index.vue index ff0ce8a..3e4d943 100644 --- a/pages/CardDetail/index.vue +++ b/pages/CardDetail/index.vue @@ -94,8 +94,8 @@ 我已阅读并同意 - 《付费权益卡协议》 - 《上门洗护次卡协议》 + 《上门喂养次卡须知》 + 《上门洗护次卡须知》 @@ -323,12 +323,12 @@ export default { }, showAgreement() { let type; - if(this.type == 1){ + if(this.cardDetail.order_type === 1){ type = 'PayCardPolicy'; }else{ type = 'bathe_card'; } - getConfig('PayCardPolicy').then(res => { + getConfig(type).then(res => { this.PayCardPolicy = res.data[type]; }) this.$refs.agreement.open(); diff --git a/pages/FeedLog/components/FeedLog.vue b/pages/FeedLog/components/FeedLog.vue index 8bba986..e4fa84e 100644 --- a/pages/FeedLog/components/FeedLog.vue +++ b/pages/FeedLog/components/FeedLog.vue @@ -13,19 +13,19 @@ 爱称: - {{detail.name}} + {{ detail.name }} 性别: - {{detail.sex}} + {{ detail.sex }} 体重: - {{detail.weight}}kg + {{ detail.weight }}kg 种类: - {{detail.type_name}} + {{ detail.type_name }} @@ -37,7 +37,7 @@ - + @@ -45,8 +45,10 @@ name="collapse" title="水碗饭碗" > - + - + - + - + - + - + - + - + { - return {url:item.url,type:item.type}; + return {url: item.url, type: item.type, thumb:(item.thumb || item.url)}; }) }, - uploadShow(data,fileName = ''){ + uploadShow(data, fileName = '') { let result = []; - try{ + try { data.forEach(item => { - result.push({url:item.url,type:item.type}) + result.push({url: item.url, type: item.type,thumb:(item.thumb || item.url)}) }) - }catch (e){ + } catch (e) { this.images[fileName] = []; } this.images[fileName] = result; }, - uploadPut(event,fileName = ''){ + async uploadPut(event, fileName = '') { let lists = [].concat(event.file); let fileListLen = this.images[fileName].length; lists.map((item) => { @@ -407,27 +424,29 @@ export default { }); }); for (let i = 0; i < lists.length; i++) { + const fileType = api.getFileType(lists[i].url); + let thumb; + const file = await api.uploadOssFile(lists[i].url); + if (fileType === 'video') thumb = await api.uploadOssFile(lists[i].thumb); + let item = this.images[fileName][fileListLen]; - api.uploadOssFile(lists[i].url).then(res => { - let item = this.images[fileName][fileListLen]; - this.images[fileName].splice(fileListLen, 1, { - ...item, - status: 'success', - message: '', - url: res.show_path, - thumb: res.show_path, - type:api.getFileType(res.show_path) - }); - fileListLen++; - }) + this.images[fileName].splice(fileListLen, 1, { + ...item, + status: 'success', + message: '', + url: file.show_path, + thumb: thumb?.show_path ? thumb.show_path : file.show_path, + type: fileType + }); + fileListLen++; } }, - uploadDel(fileIndex,fileName = ''){ - this.images[fileName].splice(fileIndex.index,1); + uploadDel(fileIndex, fileName = '') { + this.images[fileName].splice(fileIndex.index, 1); }, - navTo(url){ + navTo(url) { uni.navigateTo({ - url:url + url: url }) }, getFeedLog(pet_id) { @@ -435,7 +454,7 @@ export default { feedLog(pet_id).then(data => { let feedlist = this.detail.feedlist; this.detail = data.data; - if(data.data.feedlist.length===0){ + if (data.data.feedlist.length === 0) { this.detail.feedlist = feedlist; } this.detail = data.data; @@ -450,17 +469,17 @@ export default { 'note_imgs', 'other_imgs' ]; - images.forEach((item,index) => { - that.uploadShow(data.data.feedlist[item],item); + images.forEach((item, index) => { + that.uploadShow(data.data.feedlist[item], item); }); this.collapseValue = ['collapse']; // } }) }, - submit(){ + submit() { let that = this; - let data = [ + let data = [ 'meal_imgs', 'food_imgs', 'snack_imgs', @@ -470,15 +489,15 @@ export default { 'note_imgs', 'other_imgs' ]; - new Promise((resolve,reject)=>{ - data.forEach((item,index) => { - that.uploadSubmit(this.images[item],item); - if(index === data.length-1){ + new Promise((resolve, reject) => { + data.forEach((item, index) => { + that.uploadSubmit(this.images[item], item); + if (index === data.length - 1) { resolve() } }); }).then(res => { - console.log('this.detail.feedlist',this.detail.feedlist) + console.log('this.detail.feedlist', this.detail.feedlist) this.detail.feedlist.pet_id = this.pet_id editFeed(this.detail.feedlist).then(res => { console.log(res) @@ -492,9 +511,9 @@ export default { mounted() { this.getFeedLog(this.pet_id); }, - watch:{ - pet_id(newValue){ - if(this.type === 'detail'){ + watch: { + pet_id(newValue) { + if (this.type === 'detail') { this.getFeedLog(newValue); } } diff --git a/pages/OrderConfirm/end.vue b/pages/OrderConfirm/end.vue index 308fa97..3d2ba0b 100644 --- a/pages/OrderConfirm/end.vue +++ b/pages/OrderConfirm/end.vue @@ -2449,7 +2449,7 @@ export default { status: 'success', message: '', url: file.show_path, - thumb: thumb.show_path || file.show_path, + thumb: thumb?.show_path ? thumb.show_path : file.show_path, type: fileType }); fileListLen++; diff --git a/pages/OrderConfirm/start.vue b/pages/OrderConfirm/start.vue index 5a7c952..e852fcf 100644 --- a/pages/OrderConfirm/start.vue +++ b/pages/OrderConfirm/start.vue @@ -363,22 +363,24 @@ export default { }, uploadSubmit(data,fileName = ''){ this.model[fileName] = data.map(item => { - return {url:item.url,type:item.type}; + return {url:item.url,type:item.type, thumb:(item.thumb || item.url)}; }) }, - uploadShow(data,fileName = ''){ + uploadShow(data, fileName = '') { let result = []; - try{ + try { data.forEach(item => { - result.push({url:item.url}) + result.push({url: item.url, type: item.type,thumb:(item.thumb || item.url)}) }) - }catch (e){ + } catch (e) { this.images[fileName] = []; } this.images[fileName] = result; }, - uploadPut(event,fileName = ''){ + async uploadPut(event, fileName = '') { + console.log('event', event) let lists = [].concat(event.file); + console.log('lists', lists) let fileListLen = this.images[fileName].length; lists.map((item) => { this.images[fileName].push({ @@ -387,21 +389,24 @@ export default { message: '上传中', }); }); + console.log(lists) for (let i = 0; i < lists.length; i++) { const fileType = api.getFileType(lists[i].url); console.log(fileType) - api.uploadOssFile(lists[i].url).then(res => { - let item = this.images[fileName][fileListLen]; - this.images[fileName].splice(fileListLen, 1, { - ...item, - status: 'success', - message: '', - url: res.show_path, - thumb: res.show_path, - type:fileType - }); - fileListLen++; - }) + let thumb; + const file = await api.uploadOssFile(lists[i].url); + if(fileType === 'video')thumb = await api.uploadOssFile(lists[i].thumb); + let item = this.images[fileName][fileListLen]; + + this.images[fileName].splice(fileListLen, 1, { + ...item, + status: 'success', + message: '', + url: file.show_path, + thumb: thumb?.show_path ? thumb.show_path : file.show_path, + type: fileType + }); + fileListLen++; } }, uploadDel(fileIndex,fileName = ''){ diff --git a/pages/OrderDetail/components/fomItem.vue b/pages/OrderDetail/components/fomItem.vue index 7db03a7..df0b335 100644 --- a/pages/OrderDetail/components/fomItem.vue +++ b/pages/OrderDetail/components/fomItem.vue @@ -27,8 +27,12 @@ export default { imageShow: false, videoUrl: '', videoShow: false, + showItem:false, } }, + mounted() { + this.showItem = this.getShowStatus(); + }, methods: { showBigImage(imgUrl) { this.imageUrl = imgUrl; @@ -49,24 +53,22 @@ export default { } }, getShowStatus(){ - // console.log(this.name) - if(!this.isShow){ - if(this.type === 'media' || this.type === 'text'){ - return (Object.keys(this.data).length>0); - }else{ - return (this.data.value || this.data.option || this.data.remark || (typeof this.data.upload === 'object' && Object.keys(this.data.upload).length > 0)) + if(!this.isShow){ + if(this.type === 'media' || this.type === 'text'){ + return (Object.keys(this.data).length>0); + }else{ + return (this.data.value || this.data.option || this.data.remark || (typeof this.data.upload === 'object' && Object.keys(this.data.upload).length > 0)) + } + }else { + return true; } - }else{ - return true; - } - }, }, }