diff --git a/api/order.js b/api/order.js new file mode 100644 index 0000000..b304c5d --- /dev/null +++ b/api/order.js @@ -0,0 +1,27 @@ +import request from './request'; + +export default { + status:{ + created:'CREATED', + cancelled:'CANCELLED', + received:'RECEIVED', + delivering:'DELIVERING', + unpaid:'UNPAID', + completed:'COMPLETED' + }, + statusKV:{ + CREATED:'已创建',CANCELLED:'已取消',RECEIVED:'已接单',DELIVERING:'配送中',UNPAID:'未支付',COMPLETED:'已完成' + }, + deliverStatusKV:{ + DELIVERY_AT_DOORSTEP:"放在门口", + DELIVERY_TO_ROOM:"敲门递件" + }, + + buildingList:(community_id,status)=>request.get('/api/order/community_building/count',{community_id,status}), + list:(data)=>request.get('/api/order/deliveryman/list',data,true), + + statusDetail:(community_id)=>request.get('/api/order/status/count',{community_id}), + receive:(orderid)=>request.post(`/api/order/${orderid}/deliveryman/receive`), + pickup:(orderid)=>request.post(`/api/order/${orderid}/deliveryman/pickup`), + complete:(orderid,images)=>request.post(`/api/order/${orderid}/deliveryman/complete`,{images:JSON.stringify(images)}) +} \ No newline at end of file diff --git a/api/request.js b/api/request.js new file mode 100644 index 0000000..f3fe8b1 --- /dev/null +++ b/api/request.js @@ -0,0 +1,69 @@ +const baseUrl = 'https://api-dev.beefast.co'; +let app = getApp(); + +const sendRequest = (options)=>{ + if(!app)app = getApp(); + let timer; + if(options.delayLoading){ + timer = setTimeout(()=>{ + wx.showLoading({ + title: '加载中...', + }) + },800) + } + return new Promise((rs,rj)=>{ + wx.request({ + url: `${baseUrl}${options.url}`, + success:(result)=>{ + if(timer){ + clearTimeout(timer); + wx.hideLoading(); + } + if(result.statusCode==200){ + if(result.data.code==200){ + rs(result.data.data); + }else{ + wx.showToast({ + icon:'error', + title: result.data.message, + }); + rj(result.data); + } + }else if(result.statusCode==401){ + wx.navigateTo({ + url: '/pages/login/login', + }) + } + }, + + method:options.method, + data:options.data, + header:{ + Authorization: `Bearer ${app.globalData.accessToken}`, + "content-type":options.data&&options.data.file?'application/x-www-form-urlencoded':'application/json' + }, + fail:(res)=>{ + wx.showToast({ + title: 'Request Error', + }) + rj(res); + } + }) + }) +} + +export default { + baseUrl:baseUrl, + get(url,data,delayLoading){ + return sendRequest({url,method:'get',data,delayLoading}); + }, + post(url,data){ + return sendRequest({url,method:'post',data}); + }, + put(url,data){ + return sendRequest({url,method:'put',data}); + }, + delete(url,data){ + return sendRequest({url,method:'delete',data}); + } +} \ No newline at end of file diff --git a/api/user.js b/api/user.js new file mode 100644 index 0000000..51084b4 --- /dev/null +++ b/api/user.js @@ -0,0 +1,34 @@ +import request from './request'; +let app = getApp(); +const token = wx.getStorageSync('accessToken'); + +export default { + genderKV:{ + MALE:'先生',FEMALE:'女士' + }, + login:(phone,password)=>request.post('/api/user/password-login',{phone,password,role:'deliveryman'}), + userInfo:()=>request.get('/api/user/info'), + summary:()=>request.get('/api/account/summary'), + incomeList:(data)=>request.get('/api/account/details',data), + + uploadImg(file,progress){ + return new Promise((rs,rj)=>{ + const task = wx.uploadFile({ + filePath: file.tempFilePath, + name: 'file', + header:{ + Authorization: `Bearer ${token||app.globalData.accessToken}` + }, + url: request.baseUrl+'/api/upload/image', + success:(res)=>{ + const response = JSON.parse(res.data); + rs(response.data); + }, + fail:(res)=>{ + rj(res); + } + }); + task.onProgressUpdate(progress); + }); + } +} \ No newline at end of file diff --git a/app.js b/app.js index 1ed57c4..a9115ed 100644 --- a/app.js +++ b/app.js @@ -1,19 +1,55 @@ -// app.js +import userApi from './api/user'; +const token = wx.getStorageSync('accessToken'); + +const date = new Date(); App({ onLaunch() { - // 展示本地存储能力 - const logs = wx.getStorageSync('logs') || [] - logs.unshift(Date.now()) - wx.setStorageSync('logs', logs) - - // 登录 - wx.login({ - success: res => { - // 发送 res.code 到后台换取 openId, sessionKey, unionId + if(!token){ + wx.navigateTo({ + url: '/pages/login/index', + }) + } + wx.onAppShow((options) => { + if(token){ + // this.getUserInfo(); } }) }, + forceGetUserInfo(){ + this.globalData.userInfoGetTime = null; + return this.getUserInfo(); + }, + async getUserInfo(){ + if(this.globalData.userInfoGetTime&& + this.globalData.userInfo&& + new Date()-this.globalData.userInfoGetTime<1000*60*5){ + return this.globalData.userInfo; + } + const data = await userApi.userInfo(); + this.globalData.userInfo = data; + this.globalData.userInfoGetTime = new Date(); + return data; + }, + + + forceGetSummary(){ + this.globalData.summaryGetTime = null; + return this.getSummary(); + }, + async getSummary(){ + if(this.globalData.summaryGetTime&& + this.globalData.summary&& + new Date()-this.globalData.summaryGetTime<1000*60*5){ + return this.globalData.summary; + } + const data = await userApi.summary(); + this.globalData.summary = data; + this.globalData.summaryGetTime = new Date(); + return data; + }, globalData: { - userInfo: null + userInfo: null, + accessToken:token, + summary:null } }) diff --git a/app.json b/app.json index 0e75b00..ae81040 100644 --- a/app.json +++ b/app.json @@ -1,7 +1,12 @@ { "pages": [ "pages/index/index", - "pages/order-detail/index" + "pages/order-detail/index", + "pages/login/index", + "pages/user/info/index", + "pages/withdraw/index/index", + "pages/withdraw/success/index", + "pages/user/income/index" ], "window": { "navigationBarTextStyle": "black", @@ -12,4 +17,4 @@ "componentFramework": "glass-easel", "sitemapLocation": "sitemap.json", "lazyCodeLoading": "requiredComponents" -} +} \ No newline at end of file diff --git a/app.wxss b/app.wxss index 0ffc008..8cc41f2 100644 --- a/app.wxss +++ b/app.wxss @@ -255,6 +255,7 @@ page-container .content{ .cells .cell-ft{ position: relative; padding-right:40rpx; + color:#999; } .cells .cell-ft::after{ content:" "; diff --git a/assets/icon/agreement.png b/assets/icon/agreement.png new file mode 100644 index 0000000..fc7b7de Binary files /dev/null and b/assets/icon/agreement.png differ diff --git a/assets/icon/back.png b/assets/icon/back.png new file mode 100644 index 0000000..4c947f7 Binary files /dev/null and b/assets/icon/back.png differ diff --git a/assets/icon/card.png b/assets/icon/card.png new file mode 100644 index 0000000..11bb7e6 Binary files /dev/null and b/assets/icon/card.png differ diff --git a/assets/icon/password.png b/assets/icon/password.png new file mode 100644 index 0000000..b5fc69d Binary files /dev/null and b/assets/icon/password.png differ diff --git a/assets/icon/plus.png b/assets/icon/plus.png new file mode 100644 index 0000000..f7a60b5 Binary files /dev/null and b/assets/icon/plus.png differ diff --git a/assets/icon/right-arrow-small.png b/assets/icon/right-arrow-small.png new file mode 100644 index 0000000..0d5f206 Binary files /dev/null and b/assets/icon/right-arrow-small.png differ diff --git a/assets/icon/service.png b/assets/icon/service.png new file mode 100644 index 0000000..0f083ad Binary files /dev/null and b/assets/icon/service.png differ diff --git a/assets/icon/success.png b/assets/icon/success.png new file mode 100644 index 0000000..259fa0d Binary files /dev/null and b/assets/icon/success.png differ diff --git a/assets/img/login-bg.png b/assets/img/login-bg.png new file mode 100644 index 0000000..652ad3a Binary files /dev/null and b/assets/img/login-bg.png differ diff --git a/components/navBar/index.js b/components/navBar/index.js new file mode 100644 index 0000000..28d0974 --- /dev/null +++ b/components/navBar/index.js @@ -0,0 +1,53 @@ +// components/navBar.js +Component({ + + /** + * 组件的属性列表 + */ + properties:{ + back:{ + type:Boolean, + value:false + }, + backTitle:{ + type:String, + value:'' + }, + share:{ + type:Boolean, + value:false + }, + background:{ + type:String, + value:'' + } + }, + + /** + * 组件的初始数据 + */ + data: { + statusBarHeight:0, + navBarHeight:44 + }, + lifetimes:{ + attached(){ + console.log('1212121212'); + const windowInfo = wx.getWindowInfo(); + + this.setData({ + statusBarHeight:windowInfo.statusBarHeight + }) + } + }, + /** + * 组件的方法列表 + */ + methods: { + back(){ + wx.navigateBack(); + }, + share(){ + }, + } +}) \ No newline at end of file diff --git a/components/navBar/index.json b/components/navBar/index.json new file mode 100644 index 0000000..c07b0d2 --- /dev/null +++ b/components/navBar/index.json @@ -0,0 +1,5 @@ +{ + "component": true, + "usingComponents": {}, + "styleIsolation": "shared" +} \ No newline at end of file diff --git a/components/navBar/index.wxml b/components/navBar/index.wxml new file mode 100644 index 0000000..a0eabbd --- /dev/null +++ b/components/navBar/index.wxml @@ -0,0 +1,16 @@ + + + + + + + + + {{backTitle}} + + + + + + + \ No newline at end of file diff --git a/components/navBar/index.wxss b/components/navBar/index.wxss new file mode 100644 index 0000000..3605b44 --- /dev/null +++ b/components/navBar/index.wxss @@ -0,0 +1,51 @@ +/* components/navBar.wxss */ +.nav-bar{ +} +.nav-bar-content{ + display: flex; + align-items: center; + justify-content: space-between; + padding:0 34rpx; +} +.nav-bar-content .left{ + flex:1; + display: flex; + align-items: center; +} +.nav-bar-content .left .btns{ + display: inline-flex; + align-items: center; + border-radius: 60rpx; + vertical-align: middle; +} +.nav-bar-content .left .spliter{ + width:1.2rpx;height:36rpx; + background-color:#D8D8D8; +} +/*单一一个返回或者加上 backTitle的时候*/ +.nav-bar-content .back{ + width:40rpx;height:40rpx; + padding:12rpx 14rpx 12rpx 0; +} +.nav-bar-content .left .btns.border{ + border: 1.2px solid #D8D8D8; +} +/*有俩按钮 back+share 的时候*/ +.nav-bar-content .left .btns.border .back{ + padding:12rpx 24rpx; + width:36rpx;height:36rpx; +} +.nav-bar-content .back-title{ + font-size: 36rpx; + font-weight: 600; + white-space: nowrap; +} +.nav-bar-content .share{ + width:30rpx;height:34rpx; + padding:12rpx 28rpx; +} +.nav-bar-content .center{ + flex:1; + text-align: center; +} +.nav-bar-content .right{flex:1;} \ No newline at end of file diff --git a/components/swipeButton/index.js b/components/swipeButton/index.js new file mode 100644 index 0000000..6caa00d --- /dev/null +++ b/components/swipeButton/index.js @@ -0,0 +1,88 @@ +// components/swipeButton/index.js +Component({ + + /** + * 组件的属性列表 + */ + properties: { + loading:{ + type:Boolean, + value:false + }, + buttonText:{ + type:String, + value:'我要接单' + }, + buttonLoadingText:{ + type:String, + value:'接单中' + } + }, + /** + * 组件的初始数据 + */ + data: { + moveEvent:null, + moveAreaWidth:0, + moveViewWidth:92, + + + textOpacity:1, + textRight:120, + moveViewX:0 + }, + + /** + * 组件的方法列表 + */ + methods: { + buttonOnMove(event){ + this.data.moveEvent = event; + if(!this.data.moveAreaWidth){ + this.createSelectorQuery().select('#moveArea'+index).boundingClientRect((res)=>{ + this.data.moveAreaWidth = res.width; + }).exec(); + } + let x = this.data.moveEvent.detail.x; + let opacity = 1 - x/(this.data.moveAreaWidth - this.data.moveViewWidth); + let right = opacity*120; + this.setData({ + textOpacity:opacity, + textRight:right + }) + }, + buttonMoveCancel(event){ + const x = this.data.moveEvent.detail.x; + //给 10 像素边界 + //moveAreaWidth - this.data.moveViewWidth - 10 <= x + let viewX = 0,loading = false; + if((this.data.moveAreaWidth - this.data.moveViewWidth)/3*2 < x){ + viewX = this.data.moveAreaWidth - this.data.moveViewWidth; + loading = true; + this.triggerEvent('done'); + } + console.log(viewX,this.data.moveAreaWidth,this.data.moveViewWidth,x); + this.setData({ + moveViewX:viewX, + loading:loading + }); + } + }, + + lifetimes:{ + attached(){ + this.createSelectorQuery().select('#moveArea').boundingClientRect((res)=>{ + this.data.moveAreaWidth = res.width; + }).exec(); + } + }, + observers:{ + "loading"(l){ + if(!l){ + this.setData({ + moveViewX:0, + }); + } + } + } +}) \ No newline at end of file diff --git a/components/swipeButton/index.json b/components/swipeButton/index.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/swipeButton/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/swipeButton/index.wxml b/components/swipeButton/index.wxml new file mode 100644 index 0000000..18cbfe4 --- /dev/null +++ b/components/swipeButton/index.wxml @@ -0,0 +1,9 @@ + + + + + {{buttonText}} + {{buttonLoadingText}} + \ No newline at end of file diff --git a/components/swipeButton/index.wxss b/components/swipeButton/index.wxss new file mode 100644 index 0000000..b7bf17c --- /dev/null +++ b/components/swipeButton/index.wxss @@ -0,0 +1,35 @@ +.move-area{ + background-color: var(--main-color); + border-radius: 12rpx; + width:100%; + height:100%; +} +.move-area .tips{ + position: absolute; + /* right:120rpx; */ + top:30rpx; + color: #000000; + font-size: 36rpx; + z-index: 0; + font-weight: 500; + transition-duration: .1s; +} +.move-area .tips.loading{ + transition-duration: .4s; + left:110rpx; +} + +.move-view{ + background-color: #fff; + /* 为了精确定位width 用 px 单位 包括下面的 border*/ + width: 88px;height:88rpx; + display: flex; + align-items: center; + justify-content:center; + border-radius: 12rpx; + border:2px solid var(--main-color); + z-index: 1; +} +.move-view .icon{ + width:56rpx;height:56rpx; +} \ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js index f567908..840d568 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -1,49 +1,201 @@ +import orderApi from '../../api/order'; +import userApi from '../../api/user'; + +const app = getApp(); Page({ + currentOrder:null, data: { statusBarHeight:0, - list:[{}], - moveEvent:null, - moveViewX:0, - tipsOpacity:1, - tipsRight:120, - moveAreaWidth:0, - moveViewWidth:92, - receiving:false, + list:[], + leftPanelEvent:null, scrollViewHeight:0, + pager:{limit:10,loading:false,loadAll:false,pageIndex:0,refreshTrigger:false}, isShowConfirm:false, isShowLeftPanel:false, + isShowLeftPanelMask:false, + leftPanelMoveViewX:0, tempImgs:[], - maxChooseImgCount:10 + maxChooseImgCount:10, + + userInfo:{}, + userInfoTrigger:false, + summary:{}, + statusDetail:{ + created:{ + key:'CREATED',value:0,text:"待接单" + }, + received:{ + key:'RECEIVED',value:0,text:"待取货" + }, + delivering:{ + key:'DELIVERING',value:0,text:"送货中" + }, + completed:{ + key:'COMPLETED',value:0,text:"已送达" + } + }, + statusDetailKey:'created', + buildingList:[], + buildingIndex:0, + + orderStatus:orderApi.status, + orderStatusKV:orderApi.statusKV, + + deliverStatusKV:orderApi.deliverStatusKV, + + genderKV:userApi.genderKV }, onLoad(){ const windowInfo = wx.getWindowInfo(); - console.log(windowInfo); + this.setData({ statusBarHeight:windowInfo.statusBarHeight, scrollViewHeight:windowInfo.windowHeight-windowInfo.statusBarHeight-44 - 125 }); - //增加列表之后 放在列表加载之后 优化动画效果 - this.createSelectorQuery().select('#moveArea0').boundingClientRect((res)=>{ - console.log(res); - this.data.moveAreaWidth = res.width; - }).exec(); + + app.getUserInfo().then((data)=>{ + this.setData({ + userInfo:data + }); + return this.loadStatusDetail(); + }).then((data)=>{ + return this.loadBuilding(); + }).then((data)=>{ + this.loadList(); + }); + app.getSummary().then((data)=>{ + this.setData({ + summary:data + }); + }); }, - confirmSend(){ - this.setData({ - isShowConfirm:true + getUserInfo(){ + app.forceGetUserInfo().then((data)=>{ + this.setData({ + userInfo:data, + userInfoTrigger:false + }) }) }, + setStatus(event){ + const status = event.currentTarget.dataset.item; + console.log(status); + //先不setData 让加载出来之后再设置 + this.loadBuilding().then((data)=>{ + this.data.statusDetailKey = status.key.toLowerCase(); + this.data.pager.pageIndex = 0; + this.data.pager.loadAll = false; + this.loadList(); + }) + }, + setBuilding(event){ + const buildingIndex = event.currentTarget.dataset.index; + //先不setData 让加载出来之后再设置 + this.data.buildingIndex = buildingIndex; + this.data.pager.pageIndex = 0; + this.data.pager.loadAll = false; + this.loadList(); + }, + refreshList(){ + this.loadStatusDetail().then(()=>{ + return this.loadBuilding(); + }).then(()=>{ + this.data.pager.pageIndex = 0; + this.data.pager.loadAll = false; + this.loadList(); + }) + }, + async loadStatusDetail(){ + const data = await orderApi.statusDetail(this.data.userInfo.community_id); + data.map((item)=>{ + this.data.statusDetail.completed.value = 0; + if(item.status==this.data.orderStatus.unpaid||item.status==this.data.orderStatus.completed){ + this.data.statusDetail.completed.value += item.count; + }else{ + this.data.statusDetail[item.status.toLowerCase()].value = item.count; + } + }); + this.setData({ + statusDetail:this.data.statusDetail + }) + }, + async loadBuilding(){ + const cid = this.data.userInfo.community_id; + const status = this.data.statusDetailKey; + const data = await orderApi.buildingList(cid,status); + this.setData({ + buildingList:data + }); + }, + loadList(){ + if(this.data.pager.loading||this.data.pager.loadAll){ + return; + } + this.setData({ + "pager.loading":true + }); + let params = { + building_id:this.data.buildingList[this.data.buildingIndex].building_id, + skip:this.data.pager.pageIndex*this.data.pager.limit, + limit:this.data.pager.limit, + } + if(this.data.statusDetailKey=='completed'){ + params.status = `${this.data.orderStatus.unpaid},${this.data.orderStatus.completed}` + }else{ + params.status = this.data.statusDetailKey; + } + orderApi.list(params).then((data)=>{ + if(this.data.pager.pageIndex==0){ + this.data.list = data.items; + }else{ + this.data.list = this.data.list.concat(data.items); + } + this.data.pager.loading = false; + this.data.pager.pageIndex++; + this.data.pager.refreshTrigger = false; + if(data.items.length{ + item.packages.map((pItem)=>{ + pItem.pickup_codes = pItem.pickup_codes.split(','); + }) + }) + this.setData({ + list:this.data.list, + pager:this.data.pager, + statusDetailKey:this.data.statusDetailKey, + buildingIndex:this.data.buildingIndex + }); + console.log(this.data.list); + }) + }, + + openLeftPanel(){ this.setData({ - isShowLeftPanel:true + isShowLeftPanel:true, + }); + wx.nextTick(()=>{ + this.setData({ + isShowLeftPanelMask:true, + leftPanelMoveViewX:560 + }) }) }, closeLeftPanel(){ this.setData({ - isShowLeftPanel:false - }) + leftPanelMoveViewX:0, + isShowLeftPanelMask:false + }); + setTimeout(()=>{ + this.setData({ + isShowLeftPanel:false, + }) + },400) }, refund(){ wx.showModal({ @@ -79,45 +231,106 @@ Page({ }) }, + //接单 + getOrder(event){ + const item = event.currentTarget.dataset.item; - buttonOnMove(event){ - if(this.data.receiving)return; - this.setData({ - moveEvent:event - }); - const index = event.currentTarget.dataset.index; - if(!this.data.moveAreaWidth){ - this.createSelectorQuery().select('#moveArea'+index).boundingClientRect((res)=>{ - this.data.moveAreaWidth = res.width; - }).exec(); - } - let x = this.data.moveEvent.detail.x; - let opacity = 1 - x/(this.data.moveAreaWidth - this.data.moveViewWidth); - let right = opacity*120 - this.setData({ - tipsOpacity:opacity, - tipsRight:right + orderApi.receive(item.orderid).then((data)=>{ + wx.showToast({ + icon:'success', + title: '接单成功', + }) + this.refreshList(); }) }, - buttonMoveCancel(event){ - if(this.data.receiving)return; - const index = event.currentTarget.dataset.index; - this.createSelectorQuery().select('#moveArea'+index).boundingClientRect((res)=>{ - const x = this.data.moveEvent.detail.x; - const moveAreaWidth = res.width; - //给 10 像素边界 - //moveAreaWidth - this.data.moveViewWidth - 10 <= x - if((moveAreaWidth - this.data.moveViewWidth)/3*2 < x){ - console.log('success'); - this.setData({ - moveViewX:moveAreaWidth - this.data.moveViewWidth, - receiving:true - }); - }else{ - this.setData({ - moveViewX:0 - }); - } - }).exec(); + //取货完毕 + receivedOrder(event){ + const item = event.currentTarget.dataset.item; + orderApi.pickup(item.orderid).then((data)=>{ + wx.showToast({ + icon:'success', + title: '取货成功', + }) + this.refreshList(); + }) + }, + //完成配送 选择图片 + confirmSend(event){ + this.currentOrder = event.currentTarget.dataset.item; + this.setData({ + isShowConfirm:true + }) + }, + //完成配送 + uploadAndConfirmSend(){ + console.log(this.currentOrder); + if(this.data.tempImgs.length==0){ + wx.showToast({ + icon:'error', + title: '请选择快递照片', + }) + return; + } + this.uploadImages().then(()=>{ + let urls = []; + this.data.tempImgs.map((item)=>{ + urls.push(item.serverUrl); + }) + console.log('uploadAndConfirmSend',urls); + // return; + orderApi.complete(this.currentOrder.orderid,urls).then((data)=>{ + wx.showToast({ + icon:'success', + title: '订单已完成', + }) + }) + }); + }, + async uploadImages(){ + let imgIndex = -1; + const file = this.data.tempImgs.find((item,index)=>{ + imgIndex = index; + return !item.uploaded; + }); + if(!file){ + return; + } + const uploadResult = await userApi.uploadImg(file,(res)=>{ + //进度 + this.setData({ + [`tempImgs[${imgIndex}].progress`]:res.progress + }) + }); + console.log(uploadResult); + if(uploadResult.url){ + this.setData({ + [`tempImgs[${imgIndex}].uploaded`]:true, + [`tempImgs[${imgIndex}].serverUrl`]:uploadResult.url + }) + await this.uploadImages(); + }else{ + //上传失败 + return new Error('失败') + } + }, + leftPanelMove(event){ + this.setData({ + leftPanelEvent:event + }); + }, + leftPanelMoveCancel(){ + const leftPanelWidth = 280; + if(this.data.leftPanelEvent.detail.x<280/4*3){ + this.closeLeftPanel(); + }else{ + this.setData({ + leftPanelMoveViewX:560 + }) + } + }, + navToUserInfo(){ + wx.navigateTo({ + url: '/pages/user/info/index', + }) } }) diff --git a/pages/index/index.json b/pages/index/index.json index f397104..1322457 100644 --- a/pages/index/index.json +++ b/pages/index/index.json @@ -1,6 +1,8 @@ { "usingComponents": { - "list-view":"/components/listView" + "list-view":"/components/listView", + "swipe-button":"/components/swipeButton" }, - "navigationStyle": "custom" + "navigationStyle": "custom", + "navigationBarTextStyle": "white" } \ No newline at end of file diff --git a/pages/index/index.wxml b/pages/index/index.wxml index c13bcb0..5726e74 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -3,62 +3,70 @@ - + - - 待接单(0) - 待取货(0) - 送货中(0) - 已送达(0) + + + + {{item.text}}({{item.value}}) + - - 1栋(10) - 2栋(10) - 3栋(10) - 4栋(10) - 5栋(10) + + + {{item.building_name}}({{item.order_count}}) + - - + + - - 菜鸟驿站(丽晶公馆) + + {{pItem.station_name}} - 4件包裹: + {{pItem.pickup_codes.length}}件包裹: - + - 佳兆业丽晶公馆3栋2单元2702 - 冯先生:158****3822丨放在门口 + + {{item.address.community_name}} + {{item.address.building_name}} + {{item.address.address_detail}} + + + {{item.address.name}}{{genderKV[item.address.gender]}}:{{item.address.phone}}丨{{deliverStatusKV[item.delivery_method]}} + - + - - - - - 我要接单 - 接单中... - + - + + + + + - + - + 暂无跑腿订单 @@ -71,20 +79,91 @@ 当用户要求把包裹放在门口请拍照上传留证 拍摄时请把门牌号和包裹数量整体拍照 - + + + 点击拍照 - + - - + + + + + + - + + + + + + + {{summary.balance}} + + + + + + + + {{summary.today_income}} + + + + + + + 在线客服 + + + + 修改密码 + + + + 用户协议 + + + + + + + diff --git a/pages/index/index.wxss b/pages/index/index.wxss index 976808a..a3d9714 100644 --- a/pages/index/index.wxss +++ b/pages/index/index.wxss @@ -29,6 +29,12 @@ .head{ display: flex; background-color: #111111; + position: relative; +} +.head.loading::after{ + content: ''; + position: absolute; + left:0;right:0;top:0;bottom:0; } .head .item{ color: #BEBEBE; @@ -45,14 +51,29 @@ display: flex; overflow-x: auto; gap: 10rpx; - margin:20rpx 8rpx; + flex-wrap: nowrap; + margin:20rpx 16rpx; + position: relative; +} +.building.loading{ + overflow: hidden; +} +.building.loading::after{ + content: ''; + position: absolute; + width:100%;left:0;top:0;bottom:0; } .building .item{ font-size:28rpx; color: #666666; padding:15rpx 36rpx; - white-space: nowrap; background-color: #ffffff; + border-radius: 10rpx; + white-space: nowrap; +} +.building .item.current{ + background-color: var(--main-color); + color:var(--main-font-color); } @@ -78,6 +99,9 @@ left:38.5rpx;top:90rpx; bottom:250rpx; } +.package-list .item.no-btns::before{ + bottom:100rpx; +} .package-list .item .name{ font-size: 40rpx; font-weight: 600; @@ -112,11 +136,15 @@ } .package-list .item .package .value{ flex:1; + display: flex; + flex-wrap: wrap; + gap: 16rpx; } .package-list .item .address{ padding-left:64rpx; position: relative; + padding-bottom:20rpx; } .package-list .item .address::before{ content: '送'; @@ -143,7 +171,7 @@ .package-list .item .btns{ display: flex; gap:24rpx; - margin-top:50rpx; + margin-top:30rpx; } .package-list .item .btns .button{ @@ -156,40 +184,11 @@ padding:30rpx 40rpx; margin:0; } -.package-list .item .btns .move-area{ - background-color: var(--main-color); - border-radius: 12rpx; +.package-list .item .btns .swipe-button{ height:96rpx; flex:1; } -.package-list .item .btns .move-view{ - background-color: #fff; - /* 为了精确定位width 用 px 单位 包括下面的 border*/ - width: 88px;height:88rpx; - display: flex; - align-items: center; - justify-content:center; - border-radius: 12rpx; - border:2px solid var(--main-color); - z-index: 1; -} -.package-list .item .btns .move-view .icon{ - width:56rpx;height:56rpx; -} -.move-area .tips{ - position: absolute; - /* right:120rpx; */ - top:30rpx; - color: #000000; - font-size: 36rpx; - z-index: 0; - font-weight: 500; - transition-duration: .1s; -} -.move-area .tips.receiving{ - transition-duration: .4s; - left:110rpx; -} + .concat-user-btn{ display: flex; @@ -230,6 +229,21 @@ height:160rpx; border-radius: 12rpx; border: 1.2rpx solid rgba(124, 134, 149, 0.3); + position: relative; +} +.confirm-sending .photos .item .progress{ + position: absolute; + top:0;left:0; + width:100%; + z-index: 1; +} +.confirm-sending .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; } .confirm-sending .photos .item .image{ width:100%;height:100%; @@ -248,19 +262,121 @@ margin-top:114rpx; } +.left-move-view{ + width:1120rpx;height:100vh; + left: -560rpx;top:0; + position: fixed; +} .left-panel{ width:560rpx; background-color: #fff; height:100vh; - position: fixed; - left:0;top:0; - left:-560rpx; - transition-duration: .3s; + /* position: fixed; */ + /* left:0;top:0; */ + /* transition-duration: .3s; */ } .left-panel-mask{ position: fixed; - width:100vw; + width:calc(100vw + 560rpx); height:100vh; - left:0;top:0; + right:0;top:0; + transition-duration: .4s; background-color: rgba(0, 0, 0, 0.6); +} + + +.left-panel{ + background-color: var(--main-bgclolor); + box-sizing: border-box; +} +.left-panel .user-info{ + text-align: center; + padding-bottom:0; +} +.left-panel .user-info .avatar{ + width:120rpx;height:120rpx; + border-radius: 50%; + margin-top:40rpx; +} +.left-panel .user-info .name{ + margin-top:30rpx; + font-weight: 500; +} +.left-panel .user-info .phone{ + color: #888888; + margin-top:24rpx; +} +.left-panel .user-info .community-name{ + margin-top:24rpx; +} +.left-panel .user-info .spliter{ + margin-top:40rpx; +} +.left-panel .user-info .order-info{ + display: flex; + justify-content: space-between; +} +.left-panel .user-info .order-info .item{ + padding:30rpx 24rpx; +} +.left-panel .user-info .order-info .key{ + font-size:24rpx; +} +.left-panel .user-info .order-info .value{ + font-size: 36rpx; + font-weight: 500; + margin-top:22rpx; +} + +.left-panel .income{ + display: flex; + justify-content: space-between; + text-align: center; +} +.left-panel .income .item{ + padding:0 20rpx; +} +.left-panel .income .spliter{ + width:1.2rpx; + height:88rpx; + background-color: rgba(153, 153, 153, 0.3); +} +.left-panel .income .item .key{ + font-size: 24rpx; +} +.left-panel .income .item .value{ + font-size: 36rpx; + margin-top:28rpx; + font-weight: 500; +} +.left-panel .income .item .icon{ + width:16rpx;height:16rpx; + margin-left:6rpx; +} + +.left-panel .actions{ + text-align: center; + display: flex; + justify-content: space-between; + font-size: 24rpx; + color: #555555; +} +.left-panel .actions .item{ + padding:0 20rpx; +} +.left-panel .actions .item .icon{ + width:40rpx;height:40rpx; + margin-bottom:28rpx; +} + +.left-panel .logout-btn{ + position: absolute; + bottom:80rpx; + left:20rpx;right:20rpx; + background-color: #fff; + font-weight: normal; +} +.left-panel .logout-btn:hover{ + background-color: #fff!important; + color:#222!important; } \ No newline at end of file diff --git a/pages/login/index.js b/pages/login/index.js new file mode 100644 index 0000000..c5c0fb8 --- /dev/null +++ b/pages/login/index.js @@ -0,0 +1,93 @@ +import userApi from '../../api/user'; +const app = getApp(); + +Page({ + + /** + * 页面的初始数据 + */ + data: { + phone:'13438370499', + password:'6x9vw9s2', + isAgree:false + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + login(){ + if(this.data.isAgree){ + userApi.login(this.data.phone,this.data.password).then((data)=>{ + app.globalData.userInfo = data.user; + app.globalData.accessToken = data.access_token; + wx.setStorage({ + key:'accessToken', + data:data.access_token, + success:()=>{ + wx.reLaunch({ + url: '/pages/index/index', + }) + } + }) + }) + }else{ + + } + }, + handleAgreeChange(event){ + this.setData({ + isAgree:!!event.detail + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/login/index.json b/pages/login/index.json new file mode 100644 index 0000000..965b8e8 --- /dev/null +++ b/pages/login/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationStyle": "custom" +} \ No newline at end of file diff --git a/pages/login/index.wxml b/pages/login/index.wxml new file mode 100644 index 0000000..c513946 --- /dev/null +++ b/pages/login/index.wxml @@ -0,0 +1,20 @@ + \ No newline at end of file diff --git a/pages/login/index.wxss b/pages/login/index.wxss new file mode 100644 index 0000000..19f784f --- /dev/null +++ b/pages/login/index.wxss @@ -0,0 +1,51 @@ +.login{ + background-color: #fff; + height:100vh; +} +.login .head{ + background-color: var(--main-color); + position: relative; + height:554rpx; +} +.login .head .bg{ + width: 450rpx;height:486rpx; + position: absolute; + right:-40rpx;top:204rpx; +} +.login .head .title{ + font-size: 46rpx; + position: absolute; + left:40rpx; + bottom:144rpx; +} +.login .input-area{ + border-radius: 30rpx 30rpx 0px 0px; + margin-top:-80rpx; + background-color: #fff; + position: relative; + padding:40rpx 50rpx; +} +.login .input-area .input{ + background-color:#F7F7F7; + border-radius: 18rpx; + height: 100rpx; + padding:0 30rpx; + margin-bottom:24rpx; +} +.login .input-area .button{ + margin-top:50rpx; + border-radius: 20rpx; +} + +.agree{ + font-size: 26rpx; + margin-top:50rpx; +} +.agree .yellow{ + color:var(--main-color); + margin: 0; +} +.agree .policy{ + display: inline-flex; + align-items: center; +} \ No newline at end of file diff --git a/pages/order-detail/index.json b/pages/order-detail/index.json index 781f718..7790401 100644 --- a/pages/order-detail/index.json +++ b/pages/order-detail/index.json @@ -1,4 +1,12 @@ { "usingComponents": {}, - "navigationBarTitleText": "订单详情" + "navigationBarTitleText": "订单详情", + "window": { + "navigationBarBackgroundColor": "#ffffff", + "navigationBarTextStyle": "black", + "navigationBarTitleText": "title", + "backgroundColor": "#eeeeee", + "backgroundTextStyle": "light", + "enablePullDownRefresh": true + } } \ No newline at end of file diff --git a/pages/user/income/index.js b/pages/user/income/index.js new file mode 100644 index 0000000..666342e --- /dev/null +++ b/pages/user/income/index.js @@ -0,0 +1,68 @@ +import userApi from '../../../api/user'; + + +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + userApi.incomeList(); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/user/income/index.json b/pages/user/income/index.json new file mode 100644 index 0000000..42531bc --- /dev/null +++ b/pages/user/income/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "交易明细" +} \ No newline at end of file diff --git a/pages/user/income/index.wxml b/pages/user/income/index.wxml new file mode 100644 index 0000000..c764551 --- /dev/null +++ b/pages/user/income/index.wxml @@ -0,0 +1,9 @@ + + + + 订单编号6777跑腿收益 + 2024.10.10 12:15:51 + + 3.0 + + \ No newline at end of file diff --git a/pages/user/income/index.wxss b/pages/user/income/index.wxss new file mode 100644 index 0000000..f5ca93c --- /dev/null +++ b/pages/user/income/index.wxss @@ -0,0 +1,20 @@ +.income-list{ + background-color: #ffffff; + margin-top:20rpx; +} +.income-list .item{ + display: flex; + padding:40rpx 30rpx; + border-bottom: 1rpx solid rgba(153, 153, 153, 0.2); +} +.income-list .item .content{ + flex:1; + +} +.income-list .item .title{ + font-size: 32rpx; +} +.income-list .item .sub-title{ + margin-top:32rpx; + color: #888888; +} \ No newline at end of file diff --git a/pages/user/info/index.js b/pages/user/info/index.js new file mode 100644 index 0000000..a592206 --- /dev/null +++ b/pages/user/info/index.js @@ -0,0 +1,77 @@ +import userApi from '../../../api/user'; +const app = getApp(); + +Page({ + + /** + * 页面的初始数据 + */ + data: { + summary:{}, + refreshTrigger:false + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.refreshSummary(); + }, + + refreshSummary(){ + app.forceGetSummary().then((data)=>{ + this.setData({ + summary:data, + refreshTrigger:false + }) + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/user/info/index.json b/pages/user/info/index.json new file mode 100644 index 0000000..d24de84 --- /dev/null +++ b/pages/user/info/index.json @@ -0,0 +1,6 @@ +{ + "usingComponents": { + "nav-bar":"/components/navBar" + }, + "navigationStyle": "custom" +} \ No newline at end of file diff --git a/pages/user/info/index.wxml b/pages/user/info/index.wxml new file mode 100644 index 0000000..e3f7540 --- /dev/null +++ b/pages/user/info/index.wxml @@ -0,0 +1,42 @@ + + + + + + + + + + 交易明细 + + + + + + 提现记录 + + + + + + + 实名认证 + + + + + + 银行卡管理 + + + + + diff --git a/pages/user/info/index.wxss b/pages/user/info/index.wxss new file mode 100644 index 0000000..50a5d9c --- /dev/null +++ b/pages/user/info/index.wxss @@ -0,0 +1,28 @@ +.bg{ + background-color: var(--main-color); + border-radius: 0 0 20rpx 20rpx; + padding-bottom:240rpx; +} +.scroll-view{ + position: fixed; + top:15vh;left:0; + height:85vh; +} +.user-info{ + text-align: center; + padding-top:60rpx; +} +.user-info ._money{ + font-size: 80rpx; + margin-top:50rpx; + font-weight: 600; +} +.user-info .today{ + font-size: 28rpx; + color: #555555; + margin-top:50rpx; +} +.user-info .button{ + border-radius: 60rpx; + margin-top:70rpx; +} \ No newline at end of file diff --git a/pages/withdraw/index/index.js b/pages/withdraw/index/index.js new file mode 100644 index 0000000..bce20f1 --- /dev/null +++ b/pages/withdraw/index/index.js @@ -0,0 +1,70 @@ +// pages/withdraw/index.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + widthdraw(){ + wx.navigateTo({ + url: '/pages/withdraw/success/index', + }) + }, + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/withdraw/index/index.json b/pages/withdraw/index/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/withdraw/index/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/withdraw/index/index.wxml b/pages/withdraw/index/index.wxml new file mode 100644 index 0000000..1adf5c2 --- /dev/null +++ b/pages/withdraw/index/index.wxml @@ -0,0 +1,39 @@ + + + 提现金额 + 24小时到账 + + + + + + 账户余额:4500.0 + 全部提现 + + + + + 提现方式 + + + + + + + + + + 添加银行卡 + + + + + \ No newline at end of file diff --git a/pages/withdraw/index/index.wxss b/pages/withdraw/index/index.wxss new file mode 100644 index 0000000..107a56b --- /dev/null +++ b/pages/withdraw/index/index.wxss @@ -0,0 +1,83 @@ +.amount{ + padding-bottom:0; +} +.amount .head{ + display: flex; + align-items: center; + justify-content: space-between; +} + +.amount .head .key{ + font-size: 32rpx; +} +.amount .head .value{ + font-size: 26rpx; + color: #888888; +} + +.amount .input-area{ + display: flex; + align-items: center; + margin-top:60rpx; +} +.amount .input-area::before{ + content: '¥'; + font-size: 50rpx; + font-weight: 500; +} +.amount .input{ + flex: 1; + font-size: 56rpx; + font-weight: 500; + height:114rpx; + margin-left:24rpx; +} +.amount .bottom{ + display: flex; + align-items: center; + justify-content: space-between; + font-size: 26rpx; +} +.amount .bottom .value{ + padding:32rpx 0 32rpx 32rpx; + color:var(--main-color); +} + +.banks{ +} +.banks .spliter{ + margin-top:30rpx; +} +.banks .bank-list{ + margin-top:20rpx; +} +.banks .item{ + display: flex; + align-items: center; + padding:20rpx 0; + margin:0; +} +.banks .icon{ + width:44rpx;height:44rpx; +} +.banks .icon.plus{ + background-color: var(--main-color); + border-radius: 50%; + color:#fff; + display: flex; + align-items: center; + justify-content: center; +} +.banks .icon .plus{ + width:28rpx;height:28rpx; +} +.banks .name{ + font-size: 32rpx; + margin-left:30rpx; + flex:1; +} +.banks .checkbox{} + +.widthdraw-btn{ + margin:40rpx 20rpx 0 20rpx!important; +} \ No newline at end of file diff --git a/pages/withdraw/success/index.js b/pages/withdraw/success/index.js new file mode 100644 index 0000000..86f2a6f --- /dev/null +++ b/pages/withdraw/success/index.js @@ -0,0 +1,70 @@ +// pages/withdraw/success/index.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + done(){ + wx.navigateBack({ + delta:2 + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/withdraw/success/index.json b/pages/withdraw/success/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/withdraw/success/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/withdraw/success/index.wxml b/pages/withdraw/success/index.wxml new file mode 100644 index 0000000..1c74849 --- /dev/null +++ b/pages/withdraw/success/index.wxml @@ -0,0 +1,22 @@ + + + 提现申请成功 + 24小时到账 (周末节假日顺延),以实际到账时间为准! + + + + + 提现类型 + 账户提现 + + + 提现金额 + 8888.0 + + + 到账方式 + 中国工商银行(7726) + + + + \ No newline at end of file diff --git a/pages/withdraw/success/index.wxss b/pages/withdraw/success/index.wxss new file mode 100644 index 0000000..1e81843 --- /dev/null +++ b/pages/withdraw/success/index.wxss @@ -0,0 +1,27 @@ +.success-info{ + text-align: center; + padding-top:70rpx +} +.success-info .icon{ + width:90rpx;height:90rpx; +} +.success-info .title{ + font-size: 44rpx; + margin-top:40rpx; + font-weight: 500; +} +.success-info .sub-title{ + font-size: 24rpx; + color: #555555; + margin-top:40rpx; +} +.order-info .cell-hd{ + color:#555555; +} +.order-info .cell-bd{ + font-weight: 500; +} + +.done-btn{ + margin:40rpx 20rpx 0 20rpx!important; +}