diff --git a/pages/index/index.vue b/pages/index/index.vue index ced6101..45efda2 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -760,4 +760,7 @@ border-top: 1px solid #eee; color: #fff; } + .order55{ + font-size: 28rpx; + } \ No newline at end of file diff --git a/pages/login/login.vue b/pages/login/login.vue index 1143dc1..f99e46e 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -39,18 +39,18 @@ - + {{peisongyuan?'切换商家登录':'切换配送员登录'}} - + @@ -126,12 +126,7 @@ this.getCaptchaImg(); }, computed: { - enabled: function() { - if (this.mobile.length == 11 && this.codes.length == 6) { - return false; - } - return true; - }, + i18n() { return this.$t('index') }, @@ -375,21 +370,21 @@ this.$refs.popup.open(type) }, submit() { - if (this.enabled) { + if (this.enabled && this.loginType) { uni.showToast({ title: '请输入手机号和验证码后登录', icon: 'none' }); return; } - // if (this.code == uni.getStorageSync('yanzhengma')) { - // uni.showToast({ - // title: '验证码输入有误', - // icon: 'none' - // }); - // return; - // } - // uni.setStorageSync('yanzhengma', this.code) + if (this.code == uni.getStorageSync('yanzhengma') && !this.loginType) { + uni.showToast({ + title: '验证码输入有误', + icon: 'none' + }); + return; + } + uni.setStorageSync('yanzhengma', this.code) let url; let data; diff --git a/pages/shop/selfDeliveryOrderList.vue b/pages/shop/selfDeliveryOrderList.vue index b612da4..bdbb3a9 100644 --- a/pages/shop/selfDeliveryOrderList.vue +++ b/pages/shop/selfDeliveryOrderList.vue @@ -9,13 +9,17 @@ 待取货 - 待送达 + 待送达 + 已送达 - + - 商家自配送 + + 商家自配送 + 预约配送 + {{item.mustFinishTime | formatTime}}前送达 #{{item.numberCode}} @@ -39,14 +43,14 @@ - + 商品详情 共{{goodsCount(item)}}件,点击查看规格和数量 备注:{{item.remark}} 配送费 ¥{{item.deliveryFee || 0}} - + {{buttonText(item)}} @@ -102,9 +106,14 @@ }, menuButtonInfo: {}, navHeight: 120, - backTop: 88, - listTop: 210, - productData: [] + backTop: 80, + listTop: 150, + productData: [], + worker: { + workerId: '', + workerName: '', + workerPhone: '' + } } }, filters: { @@ -121,13 +130,11 @@ }, methods: { initNavMetrics() { - const rect = uni.getMenuButtonBoundingClientRect(); - this.menuButtonInfo = rect || {}; - const top = rect && rect.top ? rect.top : 32; - const height = rect && rect.height ? rect.height : 32; - this.backTop = top + 6; + this.menuButtonInfo = {}; + const top = 32; + const height = 32; this.navHeight = top + height + 52; - this.listTop = this.navHeight + 76; + this.listTop = this.navHeight + 30; }, back() { uni.navigateBack(); @@ -135,13 +142,14 @@ initWorkerFromShop() { const shop = this.getCurrentShop(); this.searchForm.shopId = uni.getStorageSync('shopId'); - this.searchForm.regionId = JSON.parse(uni.getStorageSync('area')).id; - this.searchForm.workerId = shop.workerId || ''; + this.searchForm.regionId = JSON.parse(uni.getStorageSync('area')).regionId; + this.worker = { - workerId: shop.workerId || '', - workerName: shop.workerName || '', - workerPhone: shop.workerPhone || '' + workerId: uni.getStorageSync('worker') ? uni.getStorageSync('worker').workerId :'', + workerName: uni.getStorageSync('worker') ? uni.getStorageSync('worker').workerName : '', + workerPhone: uni.getStorageSync('worker') ? uni.getStorageSync('worker').mobile : '' }; + this.searchForm.workerId = this.worker.workerId || ''; }, getCurrentShop() { const shopList = uni.getStorageSync('schoolShop') || []; @@ -152,6 +160,7 @@ return {}; }, switchTab(tab) { + if (this.tab === tab) return; this.tab = tab; this.resetList(); }, @@ -160,7 +169,12 @@ this.searchForm.pageNum = 1; this.totalPages = 1; this.loadStatus = 'more'; - this.searchForm.status = this.tab === 'pickup' ? 1 : 2; + const statusMap = { + pickup: 1, + wait: 2, + done: 3 + }; + this.searchForm.status = statusMap[this.tab]; this.getList(); }, loadMore() { @@ -177,7 +191,7 @@ }) return; } - this.NB.sendRequest('/mall/delivery/pageShopDelivery', this.searchForm, false, 'POST', 'application/json').then((res) => { + this.NB.sendRequest("/mall/delivery/pageShopDelivery", this.searchForm, false, 'post', 'application/json').then((res) => { if (res.code == 200) { const records = res.result.records || []; this.list = this.searchForm.pageNum == 1 ? records : this.list.concat(records); @@ -189,18 +203,20 @@ icon: 'none' }) } - }).catch((res) => {}) + }) }, handleOrder(index, item) { - if (this.tab === 'pickup' && !item.arriveTime) { - this.changeStatus(index, item, 1); + if (this.tab === 'pickup') { + this.changeStatus(index, item, item.arriveTime == null ? 1 : 2); return; } - this.changeStatus(index, item, this.tab === 'pickup' ? 2 : 3); + if (this.tab === 'wait') { + this.changeStatus(index, item, 3); + } }, buttonText(item) { if (this.tab === 'pickup') { - return item.arriveTime ? '确认取货' : '已到店'; + return item.arriveTime == null ? '已到店' : '已取货'; } return '确认送达'; }, @@ -210,24 +226,20 @@ regionId: this.searchForm.regionId, deliveryId: item.id, workerId: this.worker.workerId - }, false, 'POST', 'application/x-www-form-urlencoded').then((res) => { + }, false, 'post', 'application/x-www-form-urlencoded').then((res) => { if (res.code == 200) { - if (status === 1) { - this.$set(this.list[index], 'arriveTime', new Date()); - } else { - this.list.splice(index, 1); - } uni.showToast({ title: res.message || '操作成功', icon: 'none' }) + this.resetList(); } else { uni.showToast({ title: res.message, icon: 'none' }) } - }).catch((res) => {}) + }) }, productDetail(item) { this.productData = item.goodsList || []; @@ -304,6 +316,7 @@ border-radius: 24rpx; padding: 10rpx; margin-bottom: 0; + margin-top:20rpx; } .tab{ flex: 1; @@ -324,6 +337,7 @@ box-sizing: border-box; padding-top: 20rpx; padding-bottom: 36rpx; + width:94%; } .card{ background: #fff; @@ -337,6 +351,10 @@ align-items: center; justify-content: space-between; } + .tag-row{ + display: flex; + align-items: center; + } .tag{ background: rgba(255, 111, 44, 0.1); color: #ff6f2c; @@ -344,6 +362,16 @@ border-radius: 18rpx; font-weight: 700; } + .appointment-delivery-tag{ + margin-left: 12rpx; + padding: 8rpx 16rpx; + border-radius: 18rpx; + background: linear-gradient(135deg, #ff8f1f 0%, #ff6a3d 100%); + color: #fff; + font-size: 22rpx; + font-weight: 800; + box-shadow: 0 8rpx 18rpx rgba(255, 106, 61, 0.16); + } .time{ color: #666; } diff --git a/pages/shop/transferDeliveryOrderList.vue b/pages/shop/transferDeliveryOrderList.vue index 16a0af3..498987f 100644 --- a/pages/shop/transferDeliveryOrderList.vue +++ b/pages/shop/transferDeliveryOrderList.vue @@ -1,15 +1,42 @@ @@ -42,34 +103,67 @@ export default { data() { return { + tab: 'wait', list: [], + productData: [], loadStatus: 'more', totalPages: 1, searchForm: { pageNum: 1, pageSize: 10, - status: 1, deliveryType: 1, transferDelivery: 1, transferArriveEmpty: true, shopId: '', regionId: '' - } + }, + navHeight: 120, + backTop: 50, + titleTop: 50, + capsuleHeight: 32, + listTop: 210 } }, onShow() { + this.initNavMetrics() this.resetList() }, + filters: { + delNode(data) { + let str + if (typeof data === 'object' && data !== null) { + str = JSON.stringify(data) + } else if (typeof data === 'string') { + str = data + } else { + str = String(data || '') + } + return str.replace(/[{}"]/g, '') + } + }, methods: { + initNavMetrics() { + const top = 32 + const height = 32 + this.capsuleHeight = height + this.navHeight = top + height + 30 + this.listTop = this.navHeight + 48 + }, back() { uni.navigateBack() }, + switchTab(tab) { + if (this.tab === tab) return + this.tab = tab + this.resetList() + }, resetList() { this.searchForm.pageNum = 1 this.totalPages = 1 this.list = [] this.loadStatus = 'more' - this.searchForm.shopId = JSON.parse(uni.getStorageSync('area')).regionId + this.searchForm.transferArriveEmpty = this.tab === 'wait' + this.searchForm.shopId = uni.getStorageSync('shopId') const area = uni.getStorageSync('area') this.searchForm.regionId = area ? JSON.parse(area).regionId : '' this.getList() @@ -80,7 +174,7 @@ this.getList() }, getList() { - this.NB.sendRequest("/mall/delivery/pageTransferDelivery",this.searchForm, false, 'post', 'application/json').then((res) => { + this.NB.sendRequest("/mall/delivery/pageTransferDelivery", this.searchForm, false, 'post', 'application/json').then((res) => { if (res.code == 200) { const records = res.result.records || [] this.list = this.searchForm.pageNum == 1 ? records : this.list.concat(records) @@ -92,8 +186,7 @@ icon: 'none' }) } - uni.hideLoading() - }).catch((res) => {}) + }) }, chooseImage(index) { uni.chooseMedia({ @@ -108,7 +201,7 @@ }, uploadImage(index, filePath) { uni.uploadFile({ - url: getApp().globalData.mainurl + '/upload/file', + url: this.tui.interfaceUrl() + '/upload/file', filePath, name: 'file', header: { @@ -122,24 +215,45 @@ }) }, transferArrive(index, item) { - this.NB.sendRequest("/mall/delivery/transferArrive",{ + this.NB.sendRequest("/mall/delivery/transferArrive", { deliveryId: item.id, transferArriveImage: item.transferArriveImage || '' }, false, 'post', 'application/x-www-form-urlencoded').then((res) => { if (res.code == 200) { - this.list.splice(index, 1) uni.showToast({ title: '操作成功', icon: 'none' }) + this.resetList() } else { uni.showToast({ title: res.message, icon: 'none' }) } - uni.hideLoading() - }).catch((res) => {}) + }) + }, + productDetail(item) { + const goodsList = item.goodsList || item.mallOrderGoodsList || item.orderGoodsList || [] + this.productData = goodsList + this.$refs.productPopup.open() + }, + getTransferArriveText(item) { + const address = item && item.shopAddress ? String(item.shopAddress) : '' + const match = address.match(/商家预计(.+?)配送到-/) + return match && match[1] ? match[1] : '' + }, + formatTime(value) { + if (!value) return ''; + const date = new Date(value) + if (isNaN(date.getTime())) return '' + const year = date.getFullYear() + const month = String(date.getMonth() + 1).padStart(2, '0') + const day = String(date.getDate()).padStart(2, '0') + const hour = String(date.getHours()).padStart(2, '0') + const minute = String(date.getMinutes()).padStart(2, '0') + const second = String(date.getSeconds()).padStart(2, '0') + return `${year}-${month}-${day} ${hour}:${minute}:${second}` }, makeCall(phone) { if (!phone) { @@ -158,25 +272,152 @@