diff --git a/api/common.js b/api/common.js index 849c381..c1ddd42 100644 --- a/api/common.js +++ b/api/common.js @@ -1,7 +1,7 @@ import request from './request' let app = getApp(); -export default { +const commonApi = { getConfig:()=>request.get('/api/config'), community:{ list:(data)=>request.get('/api/community',data), @@ -36,7 +36,11 @@ export default { receive:(activity_id)=>request.post(`/api/coupon-activities/${activity_id}/receive`,{},{noTips:true}) }, getPickupCodeWidthImgUrl:(url)=>request.post('/api/ai/recognition/pickup_code_with_url',{url}), - uploadImg(file,progress){ + getPickupCodeWidthFile:(file,options)=>{ + return commonApi.uploadImg(file,{...options,requestUrl:'/api/ai/recognition/pickup_code'}); + }, + uploadImg(file,options){ + options = options||{}; if(!app)app = getApp(); return new Promise((rs,rj)=>{ const task = wx.uploadFile({ @@ -45,7 +49,7 @@ export default { header:{ Authorization: `Bearer ${app?.globalData?.accessToken}` }, - url: request.baseUrl+'/api/upload/image', + url: `${request.baseUrl}${options.requestUrl||'/api/upload/image'}`, success:(res)=>{ const response = JSON.parse(res.data); rs(response.data); @@ -54,10 +58,12 @@ export default { rj(res); } }) - if(progress){ - progress.task = task; + if(options&&options.progress){ task.onProgressUpdate(progress); } + file.task = task; }); } -} \ No newline at end of file +} + +export default commonApi; \ No newline at end of file diff --git a/app.wxss b/app.wxss index cb5cdea..7a5d077 100644 --- a/app.wxss +++ b/app.wxss @@ -394,3 +394,9 @@ list-view{ background-size:100% } +.weui-loading.white{ + font-size:16px;width:1em;height:1em;display:inline-block;vertical-align:middle; + background:transparent url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg width='160rpx' height='160rpx' viewBox='0 0 80 80' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Ctitle%3Eloading%3C/title%3E%3Cdefs%3E%3ClinearGradient x1='94.0869141%25' y1='0%25' x2='94.0869141%25' y2='90.559082%25' id='linearGradient-1'%3E%3Cstop stop-color='%23ededed' stop-opacity='0' offset='0%25'%3E%3C/stop%3E%3Cstop stop-color='%23ededed' stop-opacity='0.3' offset='100%25'%3E%3C/stop%3E%3C/linearGradient%3E%3ClinearGradient x1='100%25' y1='8.67370605%25' x2='100%25' y2='90.6286621%25' id='linearGradient-2'%3E%3Cstop stop-color='%23ededed' offset='0%25'%3E%3C/stop%3E%3Cstop stop-color='%23ededed' stop-opacity='0.3' offset='100%25'%3E%3C/stop%3E%3C/linearGradient%3E%3C/defs%3E%3Cg stroke='none' stroke-width='1' fill='none' fill-rule='evenodd' opacity='0.9'%3E%3Cg%3E%3Cpath d='M40,0 C62.09139,0 80,17.90861 80,40 C80,62.09139 62.09139,80 40,80 L40,73 C58.2253967,73 73,58.2253967 73,40 C73,21.7746033 58.2253967,7 40,7 L40,0 Z' fill='url(%23linearGradient-1)'%3E%3C/path%3E%3Cpath d='M40,0 L40,7 C21.7746033,7 7,21.7746033 7,40 C7,58.2253967 21.7746033,73 40,73 L40,80 C17.90861,80 0,62.09139 0,40 C0,17.90861 17.90861,0 40,0 Z' fill='url(%23linearGradient-2)'%3E%3C/path%3E%3Ccircle id='Oval' fill='%23ededed' cx='40.5' cy='3.5' r='3.5'%3E%3C/circle%3E%3C/g%3E%3CanimateTransform attributeName='transform' begin='0s' dur='1s' type='rotate' values='0 40 40;360 40 40' repeatCount='indefinite'/%3E%3C/g%3E%3C/svg%3E%0A") no-repeat; + background-size:100% +} + diff --git a/assets/icon/help/ai.png b/assets/icon/help/ai.png new file mode 100644 index 0000000..7d6454f Binary files /dev/null and b/assets/icon/help/ai.png differ diff --git a/components/modalView/index.js b/components/modalView/index.js index 3445025..df4e7cc 100644 --- a/components/modalView/index.js +++ b/components/modalView/index.js @@ -1,6 +1,6 @@ -// components/modalView/index.js -Component({ +const app = getApp(); +Component({ /** * 组件的属性列表 */ @@ -17,6 +17,14 @@ Component({ type:Boolean, value:false }, + editRequired:{ + type:Boolean, + value:false + }, + row:{ + type:Number, + value:4 + }, content:{ type:String, value:'' @@ -29,6 +37,10 @@ Component({ type:Boolean, value:true }, + isShowOk:{ + type:Boolean, + value:true + }, cancelButtonText:{ type:String, value:'取消' @@ -50,60 +62,77 @@ Component({ }) }).exec(); } + this.setData({ + _show:show + }) } - } + }, + overlayClose:{ + type:Boolean, + value:true + }, + showCloseButton:{ + type:Boolean, + value:false + }, + autoFocus:{ + type:Boolean, + value:false + }, + useInput:{ + type:Boolean, + value:false + }, }, - /** * 组件的初始数据 */ data: { - dynamicsStyle:'' + dynamicsStyle:'', + textareaHeight:124, + _show:false }, /** * 组件的方法列表 */ methods: { + abc(event){ + console.log(event); + }, cancelButtonTap(){ - wx.showTabBar({ - complete:()=>{ - this.setData({ - show:false - }); - this.triggerEvent('cancel'); - } - }) + this.setData({ + _show:false + }); + this.triggerEvent('cancel'); }, okButtonTap(){ - wx.showTabBar({ - complete:()=>{ - this.setData({ - show:false - }); - this.triggerEvent('ok'); - } + if(this.properties.editRequired){ + const valid = app.validateForm({ + content:{ + required:true, + message:this.properties.contentPlaceholder, + shake:true, + // autoFocus:true //textarea 有 bug + } + },this); + if(valid.length>0)return; + } + this.setData({ + show:false }); + this.triggerEvent('ok',this.properties.content); }, - enterPageContainer(){ - wx.hideTabBar(); - }, - leavePageContainer(){ - wx.showTabBar(); + afterLeave(event){ + this.setData({ + show:false + }) } }, lifetimes:{ - // attached(){ - // console.log(this); - // const windowInfo = wx.getWindowInfo(); - // this.createSelectorQuery().select('#modalViewMain').boundingClientRect((res)=>{ - // const viewHeight = res.height; - // console.log(res); - // this.setData({ - // dynamicsStyle:`top:${(windowInfo.screenHeight-viewHeight)/2}px;height:${viewHeight}px;` - // }) - // }).exec(); - // } + attached(){ + console.log('init model view'); + } } }) \ No newline at end of file diff --git a/components/modalView/index.json b/components/modalView/index.json index e8cfaaf..8b37bbf 100644 --- a/components/modalView/index.json +++ b/components/modalView/index.json @@ -1,4 +1,5 @@ { "component": true, - "usingComponents": {} + "usingComponents": {}, + "styleIsolation": "apply-shared" } \ No newline at end of file diff --git a/components/modalView/index.wxml b/components/modalView/index.wxml index a67aa41..4fa37d6 100644 --- a/components/modalView/index.wxml +++ b/components/modalView/index.wxml @@ -1,16 +1,27 @@ - + + + - {{titleText}} - - - {{content}} + + {{titleText}} + + + - - - + + + {{content}} + + + + + \ No newline at end of file diff --git a/components/modalView/index.wxss b/components/modalView/index.wxss index 33c99bb..2a54b58 100644 --- a/components/modalView/index.wxss +++ b/components/modalView/index.wxss @@ -1,47 +1,104 @@ .custom-modal-view{ border-radius: 20px; } +.custom-modal-view-overlay{ + position: fixed; + top:0;left:0;right:0; + height:100vh; + opacity: 0; +} .custom-modal-view .title{ - font-size: 34rpx; + font-size: 36rpx; font-weight: 500; line-height: 50rpx; + position: relative; } .custom-modal-view .title.center{ text-align: center; } +.close-btn-area{ + position: absolute; + right:-32rpx;top:-32rpx; + width:100rpx;height:82rpx; + display: flex; + align-items: flex-end; + justify-content: center; +} +.custom-modal-view .title .close-btn{ + position: relative; + width:50rpx;height:50rpx; +} +.custom-modal-view .title .close-btn::before,.custom-modal-view .title .close-btn::after{ + content: ''; + position: absolute; + width:80%; + height:4rpx; + left:10%;top:50%; + margin-top:-2rpx; + background-color: #999999; + transform: rotate(45deg); +} +.custom-modal-view .title .close-btn::after{ + width:4rpx; + height:80%; + left:50%;top:10%; + margin-top:0; + margin-left: -2rpx; +} .modal-view-main{ border-radius: 24rpx; background-color: #fff; padding:32rpx; + position: relative; + z-index: 111; } -.modal-view-main .content .text{ +.custom-modal-view .textarea{ + border: 1.2px solid rgba(85, 85, 85, 0.3); + border-radius: 18px; + margin:30rpx 0; + padding:24rpx 20rpx; + font-size: 34rpx; + width:100%; + box-sizing: border-box; + line-height:50rpx; + height: 214rpx; +} +.custom-modal-view .content-input{ + background-color: rgba(124, 134, 149, 0.08); + border-radius: 12rpx; + padding:20rpx; + margin-top:20rpx; +} +.custom-modal-view .content-text{ color: #666666; font-size: 28rpx; text-align: center; margin:16rpx 0 40rpx 0; } -.custom-modal-view .textarea{ - +.custom-modal-view .textarea.error{ + border-color:red; } .modal-view-main .btns{ margin-top:32rpx; display: flex; - gap: 20rpx; + gap: 18rpx; } .modal-view-main .btns .button{ flex:1; - font-size: 32rpx; - padding:32rpx; + font-size: 16px; + padding:16px; line-height: 1; font-weight: 500; - border-width: 2rpx; + border-width: 2rpx;/* 边框显示不完整 bug */ } + .modal-view-main .btns .button.cancel{ border-color:rgba(153, 153, 153, 0.5); background-color: rgba(153, 153, 153, 0.1); color:var(--main-font-color); } + .modal-view-main .btns .button.confirm{ font-weight: bold; } \ No newline at end of file diff --git a/pages/help/address/edit/index.wxss b/pages/help/address/edit/index.wxss index 883cc8a..e9d646c 100644 --- a/pages/help/address/edit/index.wxss +++ b/pages/help/address/edit/index.wxss @@ -11,7 +11,7 @@ .radio-group .item{ padding:20rpx 0; } -.button{ +.editor .button{ margin:30rpx!important; } .picker.cell-bd{ diff --git a/pages/help/index/index.js b/pages/help/index/index.js index d9cf3b1..de2a00d 100644 --- a/pages/help/index/index.js +++ b/pages/help/index/index.js @@ -74,13 +74,9 @@ Page({ success:(res)=>{ const name = []; let count = 0; - if(res.data.price_request.pickup_images){ - name.push('图片取件'); - count+=res.data.price_request.pickup_images_count; - } res.data.price_request.packages.map((item)=>{ - name.push(item.station_name); - count+=item.pickup_codes.split(',').length; + name.push(item.name); + count+=item.pickup_codes.length; }); this.setData({ package:{ @@ -176,7 +172,18 @@ Page({ community_id:this.data.currentCommunity.id }; if(res.data.price_request.packages&&res.data.price_request.packages.length>0){ - params.packages = res.data.price_request.packages; + let realItem = []; + res.data.price_request.packages.map((item)=>{ + let p = { + pickup_codes:item.pickup_codes.join(','), + station_name:item.name + } + if(item.id){ + p.station_id = item.id + } + realItem.push(p) + }) + params.packages = realItem; } if(res.data.price_request.pickup_images){ params.pickup_images_count = res.data.price_request.pickup_images_count; @@ -225,6 +232,21 @@ Page({ success:(res)=>{ res.data.addressid = this.data.currentAddress.id; res.data.price_request.community_id = this.data.currentCommunity.id; + + if(res.data.price_request.packages&&res.data.price_request.packages.length>0){ + let realItem = []; + res.data.price_request.packages.map((item)=>{ + let p = { + pickup_codes:item.pickup_codes.join(','), + station_name:item.name + } + if(item.id){ + p.station_id = item.id + } + realItem.push(p) + }) + res.data.price_request.packages = realItem; + } userApi.order.real(res.data).then((data)=>{ this.setData({ isShowOrderConfirm:false, @@ -240,6 +262,10 @@ Page({ }) } }); + }).catch((e)=>{ + this.setData({ + ordering:false + }); }); } }); diff --git a/pages/help/package/index.js b/pages/help/package/index.js index 7cc64c4..3c9277b 100644 --- a/pages/help/package/index.js +++ b/pages/help/package/index.js @@ -10,66 +10,71 @@ Page({ */ data: { stationList:[], + choosedStationList:[], sendType:'DELIVERY_AT_DOORSTEP',//默认方式 - tempImgs:[], imgUploading:false, - imgOrderCount:0, - maxChooseImgCount:10, sendTypeKV:userApi.order.orderDeliverStatusKV, timePeriods:[], timePeriodsIndex:-1, - isShowDeliverType:false - }, - validator:{ - imgOrderCount:{min:1,shake:true} + isShowDeliverType:false, + + recogniting:false, + + isShowStationEditor:false, + + currentEditStation:{} }, async bottomBarButtonTap(){ - if(this.data.tempImgs&&this.data.tempImgs.length>0){ - const valid = app.validateForm(this.validator,this); - console.log(this.validator,valid); - if(valid.length>0){ - wx.showToast({ - icon:'none', - title: '请选择包裹数量', - }) - return; - } - this.setData({ - imgUploading:true - }) - const rs = await this.uploadImages(); - this.setData({ - imgUploading:false - }) - if(rs instanceof Error){ - return; - } - } const data = []; - this.data.stationList.map((item)=>{ - if(item.package.length>0&&item.package[0]!=''){ + let hasSame = false; + this.data.choosedStationList.find((item,index)=>{ + if(item.pickup_codes.length>0&&item.pickup_codes[0]!=''){ + //倒着找相同的索引 因为需要从后往前找 + const codes = item.pickup_codes.join(',').split(',').reverse(); + let sameValue = ''; + let findIndex = codes.findIndex((_item)=>{ + let sames = codes.filter((__item)=>_item==__item); + //找到了相同的 + if(sames.length>1){ + sameValue = _item; + hasSame = true; + return true; + } + }) + if(findIndex>-1){ + //再反转取得最后一个相同的 index + findIndex = item.pickup_codes.length - findIndex - 1; + this.data.choosedStationList[index].focus = true; + this.data.choosedStationList[index].focusIndex = findIndex; + console.log(findIndex,sameValue); + wx.showToast({ + icon:'none', + title: '取件码重复', + }) + console.log(this.data.choosedStationList[index],'----'); + this.setData({ + [`choosedStationList[${index}]`]:this.data.choosedStationList[index] + }) + return true; + } data.push({ - station_id:item.id, - station_name:item.name, - pickup_codes:item.package.filter((item)=>item!='').join(',') + id:item.id||'', + name:item.name, + imgUrl:item.imgUrl||'', + service_text:item.service_text, + pickup_codes:item.pickup_codes.filter((item)=>item!='') }); } }) - //录入了有效取件码 或者 上传了取件图片 - if(data.length>0||this.data.tempImgs.length>0){ + console.log(hasSame,'----'); + if(hasSame)return; + //录入了有效取件码 或者 上传了取件图片||this.data.tempImgs.length>0 + if(data.length>0){ let priceRequest = { packages:data }; - if(this.data.tempImgs.length>0){ - let imgs = []; - this.data.tempImgs.map((item)=>{ - imgs.push(item.serverUrl); - }); - priceRequest.pickup_images_count = this.data.imgOrderCount; - priceRequest.pickup_images = imgs.join(',') - } if(this.data.timePeriodsIndex==-1){ wx.showToast({ icon:'none', @@ -80,14 +85,15 @@ Page({ }) return; } - console.log('this.data.sendType',this.data.sendType) + const periodId = this.data.timePeriods[this.data.timePeriodsIndex].communtiy_time_period_id; + const deliveryDate = this.data.timePeriods[this.data.timePeriodsIndex].time_period_date; wx.setStorage({ key:'pre-order', data:{ price_request:priceRequest, delivery_method:this.data.sendType, - community_time_period_id:this.data.timePeriods[this.data.timePeriodsIndex].communtiy_time_period_id, - delivery_date:this.data.timePeriods[this.data.timePeriodsIndex].time_period_date + community_time_period_id:periodId, + delivery_date:deliveryDate }, success(){ wx.navigateBack(); @@ -105,58 +111,64 @@ Page({ addPackage(event){ const index = event.currentTarget.dataset.index; - let packages = this.data.stationList[index].package; - if(!packages){ - packages = []; - } - if(packages.length>1){ - if(packages.filter((item)=>item==packages[packages.length-1]).length>1){ - wx.showToast({ - icon:'none', - title: '取件码重复' - }) - this.data.stationList[index].focus = true; - this.setData({ - [`stationList[${index}].focus`]:true - }); - return; - } - } + let packages = this.data.choosedStationList[index].pickup_codes; let hasEmptyInput = packages.find((item)=>item=='')!=undefined; if(!hasEmptyInput){ packages.push(''); } - this.data.stationList[index].focus = true; + this.data.choosedStationList[index].focus = true; this.setData({ - [`stationList[${index}]`]:this.data.stationList[index] + [`choosedStationList[${index}]`]:this.data.choosedStationList[index] }); }, deletePackage(event){ const itemIndex = event.currentTarget.dataset.index; const packageIndex = event.currentTarget.dataset.p_index; - this.data.stationList[itemIndex].package.splice(packageIndex,1); - this.setData({ - [`stationList[${itemIndex}].package`]:this.data.stationList[itemIndex].package - }) + this.data.choosedStationList[itemIndex].pickup_codes.splice(packageIndex,1); + if(this.data.choosedStationList[itemIndex].pickup_codes.length==0){ + //code 删完了就删除station + this.data.choosedStationList.splice(itemIndex,1); + this.setData({ + choosedStationList:this.data.choosedStationList + }) + }else{ + //仅仅删除 code + this.setData({ + [`choosedStationList[${itemIndex}].pickup_codes`]:this.data.choosedStationList[itemIndex].pickup_codes + }) + } }, setPackageCode(event){ const itemIndex = event.currentTarget.dataset.index; const packageIndex = event.currentTarget.dataset.p_index; - this.data.stationList[itemIndex].package[packageIndex] = event.detail.value; + this.data.choosedStationList[itemIndex].pickup_codes[packageIndex] = event.detail.value; }, checkInput(event){ const itemIndex = event.currentTarget.dataset.index; const packageIndex = event.currentTarget.dataset.p_index; - let packages = this.data.stationList[itemIndex].package; + let packages = this.data.choosedStationList[itemIndex].pickup_codes; if(packages.length>1){ if(packages.filter((item)=>item==packages[packages.length-1]).length>1){ wx.showToast({ icon:'none', title: '取件码重复' }) + //清空 + // this.setData({ + // [`choosedStationList[${itemIndex}].pickup_codes[${packageIndex}]`]:'' + // }); + + //体验不好 + // this.data.choosedStationList[itemIndex].focus = true; + // this.data.choosedStationList[itemIndex].focusIndex = packageIndex; + // this.setData({ + // [`choosedStationList[${itemIndex}]`]:this.data.choosedStationList[itemIndex] + // }) + + //清除焦点 有时候 setdata 会触发获取焦点 this.setData({ - [`stationList[${itemIndex}].package[${packageIndex}]`]:'' - }); + [`choosedStationList[${itemIndex}].focus`]:false + }) } } }, @@ -166,37 +178,17 @@ Page({ onLoad(options) { let preOrder = wx.getStorageSync('pre-order'); this.savedTimePeriodId = preOrder.community_time_period_id; + if(preOrder&&preOrder.price_request){ + this.setData({ + choosedStationList:preOrder.price_request.packages + }) + } commonApi.station.list(options.communityId).then((data)=>{ - - data.items.map((item,index)=>{ - if(preOrder){ - const __item = preOrder.price_request.packages.find((_item)=>_item.station_id==item.id); - if(__item){ - item.package = __item.pickup_codes.split(',')||[]; - return; - } - } - item.package = []; - }); - let tempImgs = [],imgOrderCount = 0; - if(preOrder?.price_request?.pickup_images){ - const imgs = preOrder.price_request.pickup_images.split(','); - imgs.map((item)=>{ - tempImgs.push({ - serverUrl:item, - uploaded:true - }) - }); - imgOrderCount = preOrder.price_request.pickup_images_count||0; - } this.setData({ sendType:preOrder.delivery_method||this.data.sendType, stationList:data.items, - tempImgs, - imgOrderCount }); - //获取配送时段 return commonApi.community.timePeriods(options.communityId); }).then((data)=>{ @@ -224,80 +216,106 @@ Page({ }) }, + manuallyAdd(){ + let stationNames = this.data.stationList.map((item)=>item.name); + wx.showActionSheet({ + itemList: stationNames, + success:(res)=>{ + const station = this.data.stationList[res.tapIndex]; + const alreadyIndex = this.data.choosedStationList.findIndex((item)=>item.id==station.id); + if(alreadyIndex>-1){ + const _package = this.data.choosedStationList[alreadyIndex].pickup_codes; + if((_package[_package.length-1]||'').trim()!=''){ + _package.push(''); + } + this.data.choosedStationList[alreadyIndex].focus = true; + this.setData({ + [`choosedStationList[${alreadyIndex}]`]:this.data.choosedStationList[alreadyIndex] + }) + }else{ + this.data.choosedStationList.unshift({ + id:station.id, + name:station.name, + service_text:station.service_text, + pickup_codes:[''], + focus:true + }) + this.setData({ + choosedStationList:this.data.choosedStationList + }) + } + } + }) + }, chooseImage(){ + if(this.data.imgUploading||this.data.recogniting)return; wx.chooseMedia({ - count:this.data.maxChooseImgCount - this.data.tempImgs.length, + count:1, mediaType:['image'], success:(res)=>{ this.setData({ - tempImgs:this.data.tempImgs.concat(res.tempFiles) - }); - wx.nextTick(()=>{ - this.uploadImages(); + imgUploading:true + }) + commonApi.uploadImg(res.tempFiles[0]).then((data)=>{ + this.setData({ + imgUploading:false + }) + this.recognition(data.url); }) } }) }, - async uploadImages(){ - let imgIndex = -1; - const file = this.data.tempImgs.find((item,index)=>{ - imgIndex = index; - return !item.uploaded; - }); - if(!file){ - return; - } - var onProgress = (res)=>{ - //进度 - this.setData({ - [`tempImgs[${imgIndex}].progress`]:res.progress - }) - } - //无奈之举,不大范围改动代码的同时,我需要获取到上传任务task,来中断上传操作,不然要出问题task在上传时被附加到了onProgress - this.data.tempImgs[imgIndex].onProgress = onProgress; - let uploadResult = {}; - try{ - uploadResult = await commonApi.uploadImg(file,onProgress); - }catch(e){ - // await this.uploadImages(); - // return; - } - if(uploadResult.url){ - this.setData({ - [`tempImgs[${imgIndex}].uploaded`]:true, - [`tempImgs[${imgIndex}].serverUrl`]:uploadResult.url - }) - await this.uploadImages(); - }else{ - //上传失败 + async recognition(url){ + this.setData({ + recogniting:true + }) + commonApi.getPickupCodeWidthImgUrl(url).then((data)=>{ + if(data[0]&&data[0].stations){ + const stations = data[0].stations; + let s = []; + stations.map((item)=>{ + s.push({ + imgUrl:url, + name:item.name, + pickup_codes:item.pickup_codes + }); + }) + this.setData({ + choosedStationList:s.concat(this.data.choosedStationList) + }) + } wx.showToast({ - icon:'error', - title: '图片上传失败', + icon:'none', + title: '识别成功', }) - return new Error('失败') - } + }).catch(()=>{ + }).finally(()=>{ + this.setData({ + recogniting:false + }) + }) + }, - removeImage(event){ + showStationName(event){ const index = event.currentTarget.dataset.index; - if(this.data.tempImgs[index].onProgress&&this.data.tempImgs[index].onProgress.task){ - this.data.tempImgs[index].onProgress.task.abort(); - } - console.log('remove',new Date().getTime()); - this.data.tempImgs.splice(index,1); + let item = this.data.choosedStationList[index]; this.setData({ - tempImgs:this.data.tempImgs - }); - }, - reduceImgOrderCount(){ - if(this.data.imgOrderCount<=1)return; - this.setData({ - imgOrderCount:this.data.imgOrderCount-1 + isShowStationEditor:true, + currentEditStation:item }) }, - plusImgOrderCount(){ + editStationName(event){ + if(event.detail.trim()==''){ + wx.showToast({ + icon:'none', + title: '驿站名称不能为空', + }) + return; + } + const index = this.data.choosedStationList.findIndex((item)=>item.imgUrl==this.data.currentEditStation.imgUrl); this.setData({ - imgOrderCount:this.data.imgOrderCount+1 + [`choosedStationList[${index}].name`]:event.detail }) }, showSendType(){ @@ -324,6 +342,12 @@ Page({ }) } }, + viewImage(event){ + const url = event.currentTarget.dataset.url; + wx.previewImage({ + urls: [url], + }) + }, /** * 生命周期函数--监听页面初次渲染完成 */ diff --git a/pages/help/package/index.json b/pages/help/package/index.json index 4bbf394..f52009a 100644 --- a/pages/help/package/index.json +++ b/pages/help/package/index.json @@ -1,5 +1,6 @@ { "usingComponents": { + "modal-view":"/components/modalView" }, "navigationStyle": "default", "navigationBarTitleText": "添加快递信息" diff --git a/pages/help/package/index.wxml b/pages/help/package/index.wxml index 332fedd..300aa7c 100644 --- a/pages/help/package/index.wxml +++ b/pages/help/package/index.wxml @@ -1,56 +1,48 @@ - - - - - 快捷下单 - + + + + + 上传图片 + + 上传含有驿站,取件码信息的截图 + + - 上传取件信息图片时,图片需清晰显示取件位置信息 + {{ + imgUploading?'上传图片...':recogniting?'AI图像识别中...':'' + }} - - - - - - - - - - - - - - - - - 请正确选择包裹数量 - - - {{imgOrderCount}} - - - - - + + + 手动录入取件码 + + + - - {{item.name}} + AI识别 + + {{item.name}} + + + + - + {{item.service_text}} - + - + @@ -77,26 +69,16 @@ - - + - + 投递方式 @@ -113,4 +95,8 @@ - \ No newline at end of file + + + \ No newline at end of file diff --git a/pages/help/package/index.wxss b/pages/help/package/index.wxss index d765577..7969d60 100644 --- a/pages/help/package/index.wxss +++ b/pages/help/package/index.wxss @@ -1,20 +1,50 @@ -.page-container{ - +.station{ + padding-top:16rpx; } -.page-container .head{ - padding-bottom:14rpx; +.station .head{ + white-space: nowrap; } -.page-container .head .icon{ +.station .head .icon{ width:40rpx;height:40rpx; margin-right: 20rpx; } -.page-container .head .title{ +.station .head .icon.ai{ + background-color: var(--main-color); + font-size: 24rpx; + border-radius: 8rpx; + padding:8rpx 12rpx; + color:#fff; + font-weight: 500; + width: auto; + height: auto; +} +.station .head .edit{ + width:36rpx;height:36rpx; + padding:16rpx 20rpx; + /* 要被压缩 */ + min-width: 36rpx; +} +.station .head .right{ + flex:1; + display: flex; + justify-content: flex-end; + align-items: center; +} +.station .head .view-image{ + width:40rpx;height:40rpx; + padding:14rpx; +} +.station .head .title{ font-size: 36rpx; font-weight: 500; display: flex; align-items: center; } -.page-container .head .sub-title{ +.station .head .title .name{ + overflow: hidden; + text-overflow: ellipsis; +} +.station .head .sub-title{ font-size:26rpx; color: #888888; margin-top:24rpx; @@ -52,6 +82,8 @@ } .package-list .item .input{ border-radius: 0 12rpx 12rpx 0; + font-size: 34rpx; + font-weight: 600; flex:1; } .package-list .item .button{ @@ -64,125 +96,10 @@ width:36rpx;height:36rpx; } -.img-area.page-container .head .sub-title{ - padding-left:0; -} - -.img-area .photos{ - margin-top:26rpx; - display: flex; - flex-wrap: wrap; - gap: 26rpx; -} -.img-area .photos .item{ - text-align: center; - width:144rpx; - height:144rpx; - border-radius: 18rpx; - position: relative; -} -.img-area .photos .item .close-area{ - position: absolute; - right:-16rpx;top:-16rpx; - z-index: 2; - padding:5rpx; - display: flex; - align-items: center; -} -.img-area .photos .item .close-area .icon{ - width:28rpx;height:28rpx; -} -.img-area .photos .item .progress{ - position: absolute; - top:0;left:0; - width:100%; - z-index: 1; -} -.img-area .photos .item.loading::after{ - content: ''; - position: absolute; - width:100%;height:100%; - left:0;top:0; - background-color: rgba(0, 0, 0, 0.3); - z-index: 0; -} -.img-area .photos .item .image{ - width:100%;height:100%; - border-radius: 18rpx; -} -.img-area .photos .take-photo{ - border: 1.2rpx dashed rgba(124, 134, 149, 0.3); - border-radius: 18rpx; - display: flex; - align-items: center; - justify-content: center; -} -.img-area .photos .take-photo .icon{ - width:36rpx;height:36rpx; -} -.img-area .photos .take-photo .title{ - font-size: 24rpx; - color: #7C8695; - margin-top:16rpx; -} -.img-area .img-count{ - display: flex; - align-items: center; -} -.img-area .spliter{ - margin:30rpx 0; -} -.img-area .img-count .tips{ - flex:1; - font-size: 30rpx; - color: #555555; -} -.img-area .img-count .number-selector{ - display: flex; - align-items: center; -} -.number-selector .value{ - font-size: 36rpx; - padding:0 28rpx; -} -.number-selector .button{ - width:48rpx;height:48rpx; - line-height: 1; - padding:0; - text-align: center; - color: #fff; - position: relative; - background-color: var(--main-color); - border-radius: 50%; - border: 1rpx solid #FFC300; -} -.number-selector .button.disabled{ - background-color: #fff; -} -.number-selector .reduce::before, -.number-selector .plus::before, -.number-selector .plus::after{ - content: ''; - width:50%; - height:4rpx; - background-color: #fff; - position:absolute; - left:25%;top:22rpx; -} -.number-selector .reduce.disabled::before, -.number-selector .plus.disabled::before, -.number-selector .plus.disabled::after{ - background-color: var(--main-color); -} -.number-selector .plus::after{ - width:4rpx; - height:50%; - left:22rpx;top:25%; - z-index: 100; -} .cells .cell{ position: relative; + padding:0 20rpx 0 30rpx; } .cells .cell .cell-hd{ font-size: 34rpx; @@ -193,12 +110,14 @@ flex-direction: column; align-items: flex-end; justify-content: center; - gap: 26rpx; + gap: 30rpx; min-height: auto; - padding:36rpx 40rpx 36rpx 0; + padding:30rpx 40rpx 36rpx 0; + color: #555555; } .cells .cell .cell-ft{ padding: 0; + color: #222222; } .cells .cell .line1{ font-size: 32rpx; @@ -267,4 +186,67 @@ } .deliver-type-content .button{ margin-top:40rpx; +} + +.ai-img-area{ + min-height: 280rpx; + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; + position: relative; + box-sizing: border-box; +} +.ai-img-area::before{ + content: ''; + position: absolute; + left:10rpx;top:10rpx;right:10rpx;bottom:10rpx; + border: 2rpx dashed rgba(153, 153, 153, 0.3); + border-radius: 16rpx; +} +.ai-img-area.hover::before{ + border-color: var(--main-color); +} +.ai-img-area .title{ + font-size: 40rpx; + font-weight: 500; + color: #000; + display: flex; + align-items: center; + gap: 12rpx; +} +.ai-img-area .title .icon{ + width:66rpx;height:66rpx; +} +.ai-img-area .sub-title{ + margin-top:28rpx; + font-size: 25rpx; + color: #555555; +} +.ai-img-area .loading{ + position: absolute; + width:100%;height:100%; + top:0;left:0; + background-color: #fff; + /* opacity: .7; */ + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + border-radius: 18rpx; +} +.ai-img-area .loading .weui-loading{ + width:30px;height:30px; +} + +.manually-code{ + color: #888888; + display: flex; + align-items: center; + justify-content: center; + padding:36rpx; +} +.manually-code .icon{ + width:28rpx;height:28rpx; + margin-right:12rpx; } \ No newline at end of file