diff --git a/pages/home/components/filters.vue b/pages/home/components/filters.vue index 0c62060..15f5381 100644 --- a/pages/home/components/filters.vue +++ b/pages/home/components/filters.vue @@ -209,7 +209,7 @@ secondTabs() { if (this.activeFirstId == 1 || this.activeFirstId == 2) { return [{ - title: `待服务(${this.numInfo.noservernum})`, + title: `待开始(${this.numInfo.noservernum})`, id: 3 }, { diff --git a/pages/shop/buy-order.vue b/pages/shop/buy-order.vue index d42af13..951610c 100644 --- a/pages/shop/buy-order.vue +++ b/pages/shop/buy-order.vue @@ -13,32 +13,40 @@ - - - - {{order.order_kind == 1 ? '到家' : order.order_kind == 2 ? '到店' : ''}} - + + 订单编号:{{order.number}} - {{order.state == 1 ? '待支付' : order.state == 2 ? '待接单' : order.state == 3 ? '待服务' : order.state == 4 ? '待完成' : order.state == 5 ? '已完成' : order.state == 6 ? '待评价' : order.state == 7 ? '已取消' : ''}} + + {{ getStatusText(order.state) }} + - + + - {{order.server_title}} - - - {{order.reservation_time}} + {{order.server_title}} + + + 下单时间: + {{ getDisplayTime(order) }} - + + - {{Object.assign({},order.reservation_address_arr).dependency}}{{Object.assign({},order.reservation_address_arr).address}} - + {{ getFullAddress(order) }} + + + + ¥ + {{ getDisplayPrice(order) }} + {{ getOriginalPrice(order) }} @@ -50,26 +58,31 @@ v-if="order.state == 5 || order.state == 6 || order.state == 7"> - 取消订单 - 申请退款 - 联系客服 - 立即支付 - 评价 - 再来一单 - - 查看投诉 + + 取消订单 + + + 申请退款 + + + + 立即支付 + + + 评价 + + + 再来一单 + + + 查看投诉 + @@ -86,14 +99,13 @@ + - - @@ -104,6 +116,7 @@ import { debounce } from '@/utils/debounce.js' + export default { data() { return { @@ -131,7 +144,6 @@ id: 7, title: '已取消' }], - // ,{id: 6,title: '待评价'} currentTab: 0, isRefreshing: false, hasMore: true, @@ -145,7 +157,6 @@ }, onLoad() { // this.loadOrders(); - }, async onShow() { this.isLogin = uni.getStorageSync('accessToken') ? true : false; @@ -165,7 +176,6 @@ this.currentTab = index; this.orderList = []; this.formData.page = 1; - // TODO: 根据当前标签加载对应订单数据 if (this.currentTab != 0) { this.formData.state = this.currentTab; } else { @@ -193,13 +203,13 @@ this.isRefreshing = true this.formData.page = 1; this.orderList = []; + this.hasMore = true; this.loadOrders() }, // 加载更多 loadMore() { if (!this.hasMore) return - // TODO: 加载更多订单数据 this.loadOrders(); }, @@ -211,6 +221,44 @@ }) }, + getStatusText(state) { + const map = { + 1: '待支付', + 2: '待接单', + 3: '待服务', + 4: '服务中', + 5: '已完成', + 6: '待评价', + 7: '已取消' + } + return map[state] || '' + }, + + getDisplayTime(order) { + return order.create_time || order.createtime || order.add_time || order.reservation_time || '' + }, + + getDisplayPrice(order) { + const price = order.pay_money || order.order_money || 0 + return Number(price).toFixed(2) + }, + + getOriginalPrice(order) { + const orderMoney = Number(order.order_money || 0) + const payMoney = Number(order.pay_money || 0) + if (orderMoney > 0 && payMoney > 0 && orderMoney !== payMoney) { + return orderMoney.toFixed(2) + } + return '' + }, + + getFullAddress(order) { + const arr = order.reservation_address_arr || {} + const dependency = arr.dependency || '' + const address = arr.address || '' + return `${dependency}${address}` + }, + // 删除订单 deleteOrder: debounce(async function(order) { uni.showModal({ @@ -218,7 +266,6 @@ content: '确定要删除该订单吗?', success: (res) => { if (res.confirm) { - // TODO: 删除订单 request.post('/sj/deleteorder', { id: order.id, sjid: this.sjid @@ -229,6 +276,7 @@ }) this.formData.page = 1; this.orderList = []; + this.hasMore = true; this.loadOrders(); }) } @@ -249,63 +297,14 @@ }); }); }, + // 联系客服 async contactService(phone) { - // TODO: 实现联系客服功能 uni.navigateTo({ url: '/pages/contact/contact' }) - // const systemInfo = uni.getSystemInfoSync() - // if(systemInfo.platform === 'ios') { - // uni.makePhoneCall({ - // phoneNumber: phone //仅为示例 - // }) - // }else { - // let permission = ''; - // if(systemInfo.platform === 'ios') { - // permission = 'phone' - // }else { - // permission = 'android.permission.CALL_PHONE' - // } - // this.isShowPer = true; - // const firstRequest = !plus.storage.getItem(`perm_${permission}`) - // if(firstRequest) { - // this.isShowPer = true; - // } - // // 1. 检查权限 - // const { granted } = await permissionUtils.checkPermission('phone', '需要拨打电话权限,方便您联系商家或平台'); - // if (granted) { - // this.isShowPer = false; - // uni.makePhoneCall({ - // phoneNumber: phone //仅为示例 - // }) - // return; - // } - // this.isShowPer = false; - // // 2. 显示权限说明弹窗 - // const confirm = await this.showPermissionDialog( - // '拨打电话权限申请', - // '我们需要拨打电话权限,方便您联系商家或平台' - // ); - - // if (!confirm) return; - - // // 3. 请求权限 - // const result = await permissionUtils.requestPermission('phone', '需要拨打电话权限,方便您联系商家或平台'); - // console.log('result',result) - // if (result) { - // uni.makePhoneCall({ - // phoneNumber: phone //仅为示例 - // }) - // return; - // } else { - // locationService.openAppSettings(); - // return; - // // uni.showToast({ title: '相机权限被拒绝', icon: 'none' }); - // } - // } - }, + // 取消订单 async cancelService(order) { console.log(order) @@ -314,7 +313,6 @@ content: '确定要取消该订单吗?', success: (res) => { if (res.confirm) { - // TODO: 取消订单 let data = { orderNo: order.number, amount: order.pay_money, @@ -327,6 +325,7 @@ }) this.formData.page = 1; this.orderList = []; + this.hasMore = true; this.loadOrders(); }).catch(err => { console.log(err) @@ -335,6 +334,7 @@ } }) }, + // 申请退款 async refoundService(order) { uni.showModal({ @@ -342,7 +342,6 @@ content: '确定申请退款?退款后则订单取消!', success: (res) => { if (res.confirm) { - // TODO: 申请退款 let data = { orderNo: order.number, amount: order.pay_money, @@ -365,6 +364,7 @@ }) this.formData.page = 1; this.orderList = []; + this.hasMore = true; this.loadOrders(); }).catch(err => { console.log(err) @@ -376,7 +376,6 @@ // 支付订单 payOrder(order) { - // TODO: 实现支付功能 uni.navigateTo({ url: `/pages/shop/pay-order?id=${order.id}&money=${order.order_money}&title=${order.server_title}&number=${order.number}` }) @@ -391,25 +390,26 @@ // 再次下单 orderAgain(order) { - // TODO: 实现再次下单功能 uni.navigateTo({ url: '/pages/shop/service-detail?id=' + order.server_id }) }, + // 投诉 addComplaint(order) { uni.navigateTo({ url: '/pages/complaint/add-complaint?number=' + order.number }) }, + // 查看投诉 lookComplaint(order) { uni.navigateTo({ url: '/pages/complaint/detail?number=' + order.number }) }, + goLogin() { - // uni.oprPresentLogin() uni.navigateTo({ url: '/pages/blogPopup/blogPopup' }); @@ -471,113 +471,155 @@ .order-item { background-color: #FFFFFF; - border-radius: 16rpx; + border-radius: 20rpx; margin-bottom: 24rpx; padding: 24rpx; box-sizing: border-box; + position: relative; } - .order-header { - display: flex; - align-items: center; - margin-bottom: 34rpx; - } - - .order-tag { - width: 74rpx; - height: 38rpx; - display: flex; - flex-flow: row nowrap; - justify-content: center; - align-items: center; - border-radius: 19rpx; - margin-right: 8rpx; - background-color: rgba(232, 16, 30, 0.2); - } - - .order-tag-text { - color: #E8101E; - font-size: 24rpx; + .order-top { + position: relative; + padding-right: 120rpx; + min-height: 40rpx; } .order-number { - flex: 1; - font-size: 24rpx; - color: #666666; - } - - .order-status { + display: block; font-size: 28rpx; - font-weight: 500; - background-image: url('https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/5349af61-d67a-4ecf-91ce-6e4f05ad5edb.png'); + color: #333333; + line-height: 40rpx; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + + .order-status-badge { + font-weight: 400; + font-size: 26rpx; + color: #E8101E; + text-align: left; + font-style: normal; + position: absolute; + right: -24rpx; + top: -24rpx; + background-image: url("/static/images/icons/tabBj.png"); + background-size: 100% auto; + background-position: center top; background-repeat: no-repeat; - background-size: 100%; - height: 49rpx; width: 128rpx; - padding-left: 30rpx; + height: 49rpx; + display: flex; + align-items: center; + justify-content: center; + box-sizing: border-box; } - .status-pending { - color: #E8101E; + .order-status-badge2 { + background-image: url("/static/images/icons/tabBj2.png"); + color: #333333; } - .status-cancelled { - color: #E8101E; - } - - .status-completed { - color: #E8101E; + .order-status-badge3 { + background-image: url("/static/images/icons/tabBj2.png"); + color: #999999 !important; } .order-content { display: flex; - margin-bottom: 24rpx; + align-items: flex-start; + margin-top: 20rpx; } .service-image { - width: 182rpx; - height: 182rpx; - border-radius: 16rpx; - margin-right: 24rpx; - background-color: #000000; + width: 162rpx; + height: 162rpx; + border-radius: 24rpx; + margin-right: 20rpx; + background-color: #F5F5F5; + flex-shrink: 0; } .service-info { flex: 1; + min-width: 0; + display: flex; + flex-direction: column; + justify-content: flex-start; } .service-name { - font-size: 24rpx; + font-size: 30rpx; color: #333333; - font-weight: 500; + line-height: 42rpx; + margin-bottom: 12rpx; + word-break: break-all; } - .service-time, - .service-address { + .service-time { display: flex; align-items: center; font-size: 24rpx; + line-height: 34rpx; + margin-bottom: 8rpx; + } + + .label-text { + color: #666666; + } + + .value-text { color: #999999; - font-weight: 500; - margin-top: 8rpx; + margin-left: 8rpx; + } + + .service-address { + display: flex; align-items: flex-start; + margin-bottom: 10rpx; } - .text-overflow-1 { - white-space: normal !important; - word-break: break-word !important; - overflow: visible !important; - text-overflow: clip !important; - flex: 1; - } - - .time-icon, .location-icon { width: 24rpx; height: 24rpx; - margin-right: 4rpx; - flex-shrink: 0; + margin-right: 6rpx; margin-top: 4rpx; + flex-shrink: 0; + } + + .address-text { + font-size: 24rpx; + color: #999999; + line-height: 34rpx; + word-break: break-all; + } + + .price-row { + display: flex; + align-items: baseline; + margin-top: 6rpx; + } + + .price-symbol { + font-size: 24rpx; + color: #FF0037; + line-height: 1; + } + + .price-now { + font-size: 36rpx; + font-weight: 500; + color: #FF0037; + line-height: 1; + margin-left: 2rpx; + } + + .price-old { + font-size: 22rpx; + color: #999999; + text-decoration: line-through; + margin-left: 10rpx; + line-height: 1; } .order-actions { @@ -586,6 +628,12 @@ align-items: center; border-top: 1rpx solid #EEEEEE; padding-top: 24rpx; + margin-top: 24rpx; + } + + .action-left { + display: flex; + align-items: center; } .delete-icon { @@ -596,41 +644,33 @@ .action-right { display: flex; align-items: center; + flex-wrap: wrap; + justify-content: flex-end; } .action-btn { - display: inline-block; - width: 128rpx; - height: 48rpx; - line-height: 48rpx; + display: inline-flex; + align-items: center; + justify-content: center; + min-width: 128rpx; + height: 60rpx; + padding: 0 28rpx; margin-left: 16rpx; - text-align: center; - font-size: 28rpx; - border-radius: 24rpx; + border-radius: 30rpx; font-size: 24rpx; + box-sizing: border-box; } - .action-btn.contact { + .gray-btn { background-color: #FFFFFF; border: 1rpx solid #999999; color: #333333; } - .action-btn.primary { - background-color: #E8101E; - color: #FFFFFF; - } - - .action-btn.review { - background-color: rgba(252, 67, 124, 0.40); - border: 1rpx solid #E8101E; - color: #FFFFFF; - } - - .action-btn.again { + .red-btn { background-color: #FFFFFF; - border: 1rpx solid #999999; - color: #666666; + border: 1rpx solid #E8101E; + color: #E8101E; } .nologin_part { @@ -686,12 +726,12 @@ opacity: 1; visibility: visible; } - /* #endif */ + /* 平台适配 */ /* #ifdef H5 */ /* .order-list { - padding-bottom: env(safe-area-inset-bottom); -} */ + padding-bottom: env(safe-area-inset-bottom); + } */ /* #endif */ \ No newline at end of file diff --git a/pages/shop/buyorder-detail.vue b/pages/shop/buyorder-detail.vue index 3e9439d..01786d2 100644 --- a/pages/shop/buyorder-detail.vue +++ b/pages/shop/buyorder-detail.vue @@ -88,6 +88,30 @@ 下单时间 {{orderInfo.add_time}} + + 服务时长 + {{ orderInfo.server_time }}分钟 + + + 支付方式 + {{ + orderInfo.pay_kind == 1 + ? "账户余额" + : orderInfo.pay_kind == 2 + ? "微信支付" + : orderInfo.pay_kind == 3 + ? "支付宝支付" + : "" + }} + + + 支付时间 + {{ orderInfo.pay_time }} + + + 接单时间 + {{ orderInfo.get_time }} + 开始服务时间 {{orderInfo.server_start_time}} diff --git a/pages/shop/userorder-detail.vue b/pages/shop/userorder-detail.vue index db1c3df..9af1db2 100644 --- a/pages/shop/userorder-detail.vue +++ b/pages/shop/userorder-detail.vue @@ -251,20 +251,20 @@ {{orderInfo.team_buy_order_number}} - + 优惠券信息 - - 优惠券 - {{orderInfo.coupon_info.title}} - - - 券码 - {{orderInfo.coupon_info.code_num}} - - - 优惠金额 - {{orderInfo.coupon_info.reduce_money}}元 + + 优惠券 + {{orderInfo.coupon_info.title}} + + + 券码 + {{orderInfo.coupon_info.code_num}} + + + 优惠金额 + {{orderInfo.coupon_info.reduce_money}}元 @@ -285,7 +285,7 @@ 开始服务 - + 服务完成 @@ -530,21 +530,19 @@ }; }, getOrderDetail() { - request.post(this.urls[this.serviceType].detail, { + return request.post(this.urls[this.serviceType].detail, { id: this.id, sjid: this.userInfo.id }).then(res => { - this.orderInfo = res.data; - this.reservation_address_arr = res.data.reservation_address_arr; - - // 添加店铺信息(如果有的话) - if (res.data.user_sj) { - this.user_sj = res.data.user_sj; - this.calculateDistance(); // 计算距离 + const newOrderInfo = res.data; + // 保留当前前端已经更新的状态 + if (this.orderInfo && this.orderInfo.state > newOrderInfo.state) { + newOrderInfo.state = this.orderInfo.state; } - - console.log(this.orderInfo) - }) + this.orderInfo = newOrderInfo; + this.orderInfo.coupon_info = this.orderInfo.coupon_info || {}; + this.reservation_address_arr = this.orderInfo.reservation_address_arr || {}; + }); }, // 打开店铺地图 @@ -663,40 +661,41 @@ }, // 输入完成 onConfirm(code) { - this.showInput = false - if (this.clickType) { - return - } - this.clickType = true + this.showInput = false; + if (this.clickType) return; + this.clickType = true; + uni.showLoading({ title: '服务开始中...' }); + request.post(this.urls[this.serviceType].startOrder, { id: this.orderInfo.id, server_code: code, sjid: this.userInfo.id }).then(res => { - console.log(res) if (res.state == 1) { - uni.showToast({ - title: res.msg, - icon: 'none' - }) - this.getOrderDetail(); - // 修改上一页页面信息 + uni.showToast({ title: res.msg, icon: 'success' }); + // 直接修改状态为 4(待完成) + this.orderInfo.state = 4; + // 强制刷新视图,按钮立即变化 + this.$forceUpdate(); + // 后台静默获取真实数据,确保后续操作数据准确 + this.getOrderDetail().catch(e => console.warn('静默同步失败', e)); + // 刷新上一页订单列表 const pages = getCurrentPages(); const prevPage = pages[pages.length - 2]; - if (prevPage) { - prevPage.$vm.getOrderNumber(); - prevPage.$vm.getOrderList(); + if (prevPage && prevPage.$vm) { + prevPage.$vm.getOrderNumber?.(); + prevPage.$vm.getOrderList?.(); } } else if (res.state == 2) { - uni.showToast({ - title: res.msg, - icon: 'none' - }) + uni.showToast({ title: res.msg, icon: 'none' }); } - this.handelOrder = {}; + }).catch(err => { + console.error('开始服务失败', err); + uni.showToast({ title: '操作失败', icon: 'none' }); }).finally(() => { - this.clickType = false - }) + this.clickType = false; + uni.hideLoading(); + }); }, // 完成服务 endOrder(e, order) { @@ -1696,16 +1695,16 @@ text-align: left; font-style: normal; } - .coupon-title{ - width: 160rpx; - height: 40rpx; - font-family: PingFangSC, PingFang SC; - font-weight: 500; - font-size: 32rpx; - color: #3D3D3D; - line-height: 39rpx; - text-align: left; - font-style: normal; + .coupon-title{ + width: 160rpx; + height: 40rpx; + font-family: PingFangSC, PingFang SC; + font-weight: 500; + font-size: 32rpx; + color: #3D3D3D; + line-height: 39rpx; + text-align: left; + font-style: normal; } .coupon-item {} \ No newline at end of file