mrr.sj.front/pages/shop/buyorder-detail.vue

851 lines
19 KiB
Vue
Raw Normal View History

2026-03-24 11:45:13 +08:00
<template>
<view class="detail-page">
<!-- 顶部导航栏 -->
<custom-navbar
title="订单详情"
:show-back="true"
title-color="#333333"
backgroundColor="transparent"
></custom-navbar>
<view class="content-part">
<!-- 订单状态 -->
<view class="status-section">
<text class="status-text">{{orderInfo.state == 1 ? '待支付' : orderInfo.state == 2 ? '待接单' : orderInfo.state == 3 ? '待服务' : orderInfo.state == 4 ? '待完成' : orderInfo.state == 5 ? '已完成' : orderInfo.state == 6 ? '待评价' : orderInfo.state == 7 ? '已取消' : ''}}</text>
</view>
<!-- 到家订单 客户以及手艺人信息 -->
<view class="service-card">
<view class="location-info">
<image src="/static/images/gohome_location.png" class="location-icon"></image>
<view class="address-info">
<view class="name-phone">
<text class="name">{{userInfo.name}}</text>
<text class="phone">{{userInfo.account}}</text>
</view>
<text class="address">{{userInfo.dependency}}{{userInfo.address}}</text>
</view>
</view>
<image src="/static/images/boder_icon.png"
mode="aspectFill"
class="divider"></image>
<view class="staff-info">
<image :src="user_syr.head_photo" mode="aspectFill" class="staff-avatar"></image>
<view class="staff-detail">
<text class="staff-name">{{user_syr.name}}</text>
<view class="rating">
<!-- <image
v-for="(star, index) in 5"
:key="index"
src="/static/images/star.png"
class="star-icon"
></image> -->
</view>
</view>
<!-- <image src="/static/images/order_phone.png" class="phone-btn" @click="contactService(user_syr.account)"></image> -->
</view>
</view>
<!-- 预约信息 -->
<view class="booking-card">
<view class="card-header" v-if="orderInfo.order_kind == 1">
<text class="card-title">预约信息</text>
<view>
<text class="update-time">{{orderInfo.reservation_time}}</text>
<!-- <text class="update-change">更改时间</text> -->
</view>
</view>
<view class="service-item">
<image
:src="orderInfo.server_photo[0]"
v-if="orderInfo.server_photo && orderInfo.server_photo.length != 0"
mode="aspectFill"
class="service-image"></image>
<view class="service-info">
<text class="service-name text-overflow">{{orderInfo.server_title}}</text>
<text class="service-price">¥{{orderInfo.order_money}}</text>
</view>
<text class="service-count">×1</text>
</view>
<view class="service-real">
<text class="real-lable">实际支付金额</text>
<text class="real-price">{{orderInfo.pay_money}}</text>
</view>
</view>
<!-- 订单信息 -->
<view class="order-card">
<text class="card-title">订单信息</text>
<view class="info-item">
<text class="label">服务码</text>
<text class="value">{{orderInfo.server_code}}</text>
</view>
<view class="info-item">
<text class="label">订单编号</text>
<text class="value">{{orderInfo.number}}</text>
</view>
<view class="info-item">
<text class="label">下单时间</text>
<text class="value">{{orderInfo.add_time}}</text>
</view>
<view class="info-item" v-if="orderInfo.state != 1 && orderInfo.state != 2 && orderInfo.state != 3">
<text class="label">开始服务时间</text>
<text class="value">{{orderInfo.server_start_time}}</text>
</view>
<view class="info-item" v-if="orderInfo.state != 1 && orderInfo.state != 2 && orderInfo.state != 3 && orderInfo.state != 4">
<text class="label">服务完成时间</text>
<text class="value">{{orderInfo.server_end_time}}</text>
</view>
</view>
</view>
<!-- 底部按钮 -->
<view class="bottom-buttons">
<view class="contact-button">
<!-- <image src="/static/images/tell_icon.png" class="tell-icon"></image>
<text class="contact-text">联系TA</text> -->
</view>
<view class="handel-button btn-border"
@click="cancelService"
v-if="orderInfo.state == 1">
<text class="button-text">取消订单</text>
</view>
<view class="handel-button btn-border"
@click="refoundService"
v-if="orderInfo.state == 2 || orderInfo.state == 3">
<text class="button-text">申请退款</text>
</view>
<view class="handel-button btn-bg"
@click="payOrder"
v-if="orderInfo.state == 1">
<text class="button-text">立即支付</text>
</view>
<view class="handel-button btn-bg"
@click="reviewOrder"
v-if="orderInfo.state == 6">
<text class="button-text">评价</text>
</view>
<view class="handel-button btn-bg"
@click="orderAgain"
v-if="orderInfo.state == 5 || orderInfo.state == 6">
<text class="button-text">再来一单</text>
</view>
</view>
<!-- 获取权限提示匡内容 -->
<view class="permission"
:class="{ transform: isShowPer }">
<view class="per-tit">美融融plus 对拨打电话权限申请说明</view>
<view class="per-cont">当您需要联系商家或平台客服的时候需要获取拨打电话权限</view>
</view>
</view>
</template>
<script>
import request from '../../utils/request'
import _public from '../../utils/public'
import locationService from '../../utils/locationService';
import permissionUtils from '../../utils/per'
export default {
data() {
return {
isShowPer: false,
id: '',
staffInfo: {
avatar: '/static/images/staff.jpg',
name: '中医理疗谢飞',
rating: 5
},
userInfo: {},
orderInfo: {},
user_syr: {}
}
},
async onLoad(options) {
this.id = options.id
if(this.id) {
const userInfo = await request.post('/user/getuser',{type: 3});
this.userInfo = userInfo.data;
// 请求订单详情
this.getOrderDetail()
}
},
methods: {
getOrderDetail() {
request.post('/sj/sjorderdetail',{id: this.id,sjid: this.userInfo.id}).then(res=>{
this.orderInfo = res.data;
this.user_syr = res.data.user_syr;
console.log(this.orderInfo)
})
},
// 显示权限说明弹窗
showPermissionDialog(title, content) {
return new Promise((resolve) => {
uni.showModal({
title,
content,
confirmText: '去开启',
success(res) {
resolve(res.confirm);
}
});
});
},
// 拨打电话
async makeCall() {
const systemInfo = uni.getSystemInfoSync()
if(systemInfo.platform === 'ios') {
uni.makePhoneCall({
phoneNumber: this.orderInfo.customer.phone //仅为示例
})
}else {
let permission = '';
if(systemInfo.platform === 'ios') {
permission = 'phone'
}else {
permission = 'android.permission.CALL_PHONE'
}
// const firstRequest = !plus.storage.getItem(`perm_${permission}`)
// if(firstRequest) {
// this.isShowPer = true;
// }
this.isShowPer = true;
// 1. 检查权限
const { granted } = await permissionUtils.checkPermission('phone', '需要拨打电话权限,方便您联系商家或平台');
if (granted) {
uni.makePhoneCall({
phoneNumber: this.orderInfo.customer.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: this.orderInfo.customer.phone //仅为示例
})
return;
} else {
locationService.openAppSettings();
return;
// uni.showToast({ title: '相机权限被拒绝', icon: 'none' });
}
}
// uni.makePhoneCall({
// phoneNumber: this.orderInfo.customer.phone
// })
},
// 联系客服
async contactService(phone) {
// TODO: 实现联系客服功能
// uni.navigateTo({
// url: '/pages/contact/contact?phone='+phone
// })
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) {
uni.makePhoneCall({
phoneNumber: phone //仅为示例
})
this.isShowPer = false;
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' });
}
}
},
// 取消订单
cancelService() {
uni.showModal({
title: '取消订单',
content: '确定要取消该订单吗?',
success: (res) => {
if (res.confirm) {
// TODO: 取消订单
let data = {
orderNo: this.orderInfo.number,
amount: this.orderInfo.pay_money,
sjid: this.userInfo.id
}
request.post('/sj/cancelorder',data).then(res=>{
if(res.state == 1) {
uni.showToast({
title: '取消成功!',
icon: 'none'
})
this.getOrderDetail();
}else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(err=>{
console.log(err)
})
}
}
})
},
// 申请退款
refoundService() {
uni.showModal({
title: '申请退款',
content: '确定申请退款?退款后则订单取消!',
success: (res) => {
if (res.confirm) {
// TODO: 申请退款
let data = {
orderNo: this.orderInfo.number,
amount: this.orderInfo.pay_money,
sjid: this.userInfo.id
}
let url = '';
if(this.orderInfo.pay_kind == 1) {
url = ''
}else if(this.orderInfo.pay_kind == 2) {
url = '/sj/selfwechatrefund'
}else if(this.orderInfo.pay_kind == 3) {
url = '/sj/selfalirefund'
}
request.post(url,data).then(res=>{
console.log('申请退款接口',res)
uni.showToast({
title: '申请退款成功!',
icon: 'none'
})
this.orderInfo = {};
this.getOrderDetail();
}).catch(err=>{
console.log(err)
})
}
}
})
},
// 支付订单
payOrder() {
// TODO: 实现支付功能
uni.navigateTo({
url: `/pages/shop/pay-order?id=${this.orderInfo.id}&money=${this.orderInfo.order_money}&title=${this.orderInfo.server_title}&number=${this.orderInfo.number}`
})
},
// 评价订单
reviewOrder() {
// uni.navigateTo({
// url: `/pages/order/pay?id=${this.orderInfo.id}`
// })
},
// 再次下单
orderAgain() {
// TODO: 实现再次下单功能
uni.navigateTo({
url: '/pages/shop/service-detail?id='+this.orderInfo.server_id
})
}
}
}
</script>
<style>
page {
position: relative;
background-color: #fff;
}
.detail-page::before {
content: '';
position: fixed;
top: 0;
left: 0;
right: 0;
height: 1200rpx !important;
background-image: url('/static/images/bg.png');
background-size: cover;
background-position: center top;
background-repeat: no-repeat;
z-index: 1;
}
.content-part {
position: relative;
left: 0;
right: 0;
z-index: 9;
}
/* 导航栏样式 */
.custom-nav {
position: fixed;
top: 0;
left: 0;
right: 0;
height: 88rpx;
background-color: transparent;
display: flex;
align-items: center;
padding: 0 32rpx;
z-index: 100;
/* #ifdef H5 */
padding-top: 0;
/* #endif */
/* #ifdef APP-PLUS || MP-WEIXIN */
padding-top: var(--status-bar-height);
/* #endif */
}
.nav-back {
width: 48rpx;
height: 48rpx;
display: flex;
align-items: center;
justify-content: center;
}
.back-icon {
width: 32rpx;
height: 32rpx;
}
.nav-title {
flex: 1;
text-align: center;
font-size: 36rpx;
font-weight: 500;
color: #FFFFFF;
}
/* 状态区域 */
.status-section {
/* background: linear-gradient(135deg, #FF6B9D 0%, #FF4D6B 100%); */
height: 160rpx;
display: flex;
align-items: center;
justify-content: center;
/* padding-top: 88rpx; */
/* #ifdef APP-PLUS || MP-WEIXIN */
/* padding-top: calc(88rpx + var(--status-bar-height)); */
/* #endif */
}
.status-text {
font-size: 40rpx;
color: #FFFFFF;
font-weight: 500;
}
/* 服务人员卡片 */
.service-card {
margin: 24rpx;
background-color: #FFFFFF;
border-radius: 16rpx;
padding: 24rpx 0;
box-shadow: 0 4rpx 16rpx 0 rgba(210, 213, 224, 0.50);
}
.location-info {
display: flex;
flex-flow: row nowrap;
justify-content: flex-start;
align-items: center;
padding: 0 24rpx;
}
.location-icon {
width: 60rpx;
height: 60rpx;
margin-right: 32rpx;
}
.address-info {
flex: 1;
}
.name-phone {
display: flex;
align-items: center;
margin-bottom: 8rpx;
}
.name {
font-size: 32rpx;
color: #333333;
font-weight: 500;
margin-right: 16rpx;
}
.phone {
font-size: 28rpx;
color: #666666;
}
.address {
font-size: 28rpx;
color: #666666;
}
.divider {
width: 702rpx;
height: 4rpx;
}
.staff-info {
display: flex;
align-items: center;
padding: 32rpx 24rpx 0;
}
.staff-avatar {
width: 80rpx;
height: 80rpx;
border-radius: 44rpx;
margin-right: 16rpx;
background-color: #333333;
}
.staff-detail {
flex: 1;
}
.staff-name {
font-size: 32rpx;
color: #3D3D3D;
font-weight: 500;
}
.rating {
display: flex;
align-items: center;
}
.star-icon {
width: 24rpx;
height: 24rpx;
margin-right: 4rpx;
}
.phone-btn {
width: 64rpx;
height: 64rpx;
background-color: #E8101E;
border-radius: 32rpx;
}
/* 门店信息 */
.service-shop {
margin: 24rpx;
background-color: #FFFFFF;
border-radius: 16rpx;
padding: 24rpx;
box-shadow: 0 4rpx 16rpx 0 rgba(210, 213, 224, 0.50);
display: flex;
flex-flow: row nowrap;
justify-content: flex-start;
align-items: center;
}
.shop-info {
flex: 1;
}
.shop-info1 {
display: flex;
flex-flow: row nowrap;
justify-content: flex-start;
align-items: center;
}
.shop-logo {
width: 96rpx;
height: 96rpx;
border-radius: 48rpx;
margin-right: 18rpx;
}
.shop-name {
font-size: 24rpx;
font-weight: 500;
color: #3D3D3D;
}
.shop-info2 {
display: flex;
flex-flow: column wrap;
justify-content: flex-start;
align-items: flex-start;
margin-top: 16rpx;
}
.shop-time {
margin-bottom: 8rpx;
}
.shop-time,.shop-address {
font-size: 24rpx;
color: #999999;
}
.shop-btns {
display: flex;
flex-flow: row nowrap;
justify-content: flex-end;
align-items: center;
}
.btn-map,.btn-phone {
width: 64rpx;
height: 64rpx;
}
.btn-map {
margin-right: 48rpx;
}
/* 预约信息卡片 */
.booking-card {
margin: 24rpx;
background-color: #FFFFFF;
border-radius: 16rpx;
padding: 24rpx;
box-shadow: 0 4rpx 16rpx 0 rgba(210, 213, 224, 0.50);
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24rpx;
}
.card-title {
font-size: 32rpx;
color: #333333;
font-weight: 500;
}
.update-time {
font-size: 28rpx;
color: #333333;
padding-right: 4rpx;
}
.update-change {
font-size: 28rpx;
color: #666666;
}
.service-item {
display: flex;
flex-flow: row nowrap;
justify-content: flex-start;
align-items: center;
margin-bottom: 24rpx;
}
.service-image {
width: 160rpx;
height: 160rpx;
border-radius: 16rpx;
margin-right: 24rpx;
background-color: #e2e2e2;
}
.service-info {
flex: 1;
height: 160rpx;
display: flex;
flex-flow: column nowrap;
justify-content: space-between;
align-items: flex-start;
margin-right: 24rpx;
}
.service-name {
font-size: 28rpx;
color: #333333;
margin-bottom: 8rpx;
}
.service-price {
font-size: 32rpx;
color: #FF4D6B;
font-weight: 500;
}
.service-count {
font-size: 28rpx;
color: #666666;
}
.service-real {
display: flex;
flex-flow: row nowrap;
justify-content: flex-end;
align-items: baseline;
padding-top: 24rpx;
border-top: 1rpx solid rgba(0, 0, 0, 0.05);
}
.real-lable {
font-size: 24rpx;
color: #333333;
}
.real-price {
font-size: 32rpx;
font-weight: 500;
color: #E8101E;
}
/* 订单信息卡片 */
.order-card {
margin: 24rpx;
background-color: #FFFFFF;
border-radius: 16rpx;
padding: 24rpx;
box-shadow: 0 4rpx 16rpx 0 rgba(210, 213, 224, 0.50);
}
.info-item {
display: flex;
justify-content: space-between;
margin-top: 16rpx;
}
.label {
font-size: 28rpx;
color: #999999;
}
.value {
font-size: 28rpx;
color: #333333;
}
/* 底部按钮 */
.bottom-buttons {
position: fixed;
left: 0;
right: 0;
bottom: 0;
height: 128rpx;
background-color: #FFFFFF;
display: flex;
flex-flow: row nowrap;
align-items: center;
justify-content: space-between;
box-shadow: 0 -2rpx 8rpx rgba(0, 0, 0, 0.05);
padding: 0 24rpx 0 78rpx;
/* #ifdef H5 */
padding-bottom: env(safe-area-inset-bottom);
/* #endif */
z-index: 999;
}
.contact-button {
display: flex;
flex-flow: column nowrap;
justify-content: center;
align-items: center;
}
.contact-text {
font-size: 24rpx;
color: #666666;
}
.tell-icon {
width: 36rpx;
height: 36rpx;
margin-right: 8rpx;
}
.handel-button {
width: 240rpx;
height: 64rpx;
display: flex;
flex-flow: row nowrap;
justify-content: center;
align-items: center;
border-radius: 32rpx;
}
.btn-border {
border: 1rpx solid #E8101E;
background-color: #fff;
box-sizing: border-box;
margin-left: 20rpx;
}
.btn-bg {
background-color: #E8101E;
}
.button-text {
font-size: 28rpx;
font-weight: 400;
color: #FFFFFF;
}
.btn-border .button-text {
font-size: 28rpx;
font-weight: 400;
color: #E8101E;
}
/* APP适配 */
/* #ifdef APP-PLUS */
.permission.transform {
top: calc(var(--status-bar-height) + 88rpx + 20rpx);
opacity: 1;
visibility: visible;
}
/* #endif */
/* 平台适配 */
/* #ifdef H5 */
.detail-page {
padding-bottom: calc(120rpx + env(safe-area-inset-bottom));
}
/* #endif */
/* #ifdef MP-WEIXIN */
.custom-nav {
padding-top: calc(var(--status-bar-height) + constant(safe-area-inset-top));
padding-top: calc(var(--status-bar-height) + env(safe-area-inset-top));
}
/* #endif */
</style>