Compare commits
14 Commits
9ae7f9e088
...
81298faedc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
81298faedc | ||
|
|
a64939a86a | ||
|
|
07ffe842bd | ||
|
|
db78fe36b0 | ||
|
|
849d6149bb | ||
|
|
9e664e1a21 | ||
|
|
1b552b84d2 | ||
|
|
42a5f23564 | ||
|
|
ca4f9cd388 | ||
|
|
6e40c84b89 | ||
|
|
058d2d4a60 | ||
|
|
c3ad7f9a37 | ||
|
|
1f0de01c5b | ||
|
|
f767c7109b |
@ -121,6 +121,7 @@ page {
|
||||
-webkit-line-clamp: 1;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.enter-btn {
|
||||
|
||||
@ -3,11 +3,11 @@
|
||||
<view class="community-list">
|
||||
<view class="community-item-box" v-for="(item, index) in communityList" :key="index">
|
||||
<view class="community-item">
|
||||
<view class="community-image">
|
||||
<view class="community-image" @tap="enterCommunity(item)">
|
||||
<image :src="item.pic" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="community-info">
|
||||
<view class="community-name">{{ item.name }}</view>
|
||||
<view class="community-name" @tap="enterCommunity(item)">{{ item.name }}</view>
|
||||
<view class="community-property">物业公司:{{ item.property || '-' }}</view>
|
||||
<view class="community-distance">距我当前:{{ item.distance || '未知' }}</view>
|
||||
<view class="community-buttons">
|
||||
|
||||
@ -254,21 +254,21 @@ export default {
|
||||
methods: {
|
||||
// 选择位置
|
||||
chooseLocation() {
|
||||
uni.navigateTo({
|
||||
url: "/packages/areaPopup/index",
|
||||
});
|
||||
// uni.navigateTo({
|
||||
// url: "/packages/areaPopup/index",
|
||||
// });
|
||||
},
|
||||
// 搜索服务
|
||||
searchService() {
|
||||
uni.navigateTo({
|
||||
url: "/packages/homeServer/search/index",
|
||||
});
|
||||
// uni.navigateTo({
|
||||
// url: "/packages/homeServer/search/index",
|
||||
// });
|
||||
},
|
||||
// 导航到服务详情
|
||||
navigateToService(item) {
|
||||
uni.navigateTo({
|
||||
url: "/packages/homeServer/classify/index",
|
||||
});
|
||||
// uni.navigateTo({
|
||||
// url: "/packages/homeServer/classify/index",
|
||||
// });
|
||||
// uni.navigateTo({
|
||||
// url: `/packages/homeServer/serverInfo/index?service=${encodeURIComponent(
|
||||
// JSON.stringify(item)
|
||||
@ -280,7 +280,7 @@ export default {
|
||||
// uni.navigateTo({
|
||||
// url: `/packages/homeServer/reservation/index?id=${service.id}&name=${service.name}`,
|
||||
// });
|
||||
NavgateTo("/packages/homeServer/searchInfo/index");
|
||||
// NavgateTo("/packages/homeServer/searchInfo/index");
|
||||
},
|
||||
// 联系客服
|
||||
contactService() {
|
||||
@ -304,7 +304,7 @@ export default {
|
||||
|
||||
// 查看公告
|
||||
lookNotice() {
|
||||
NavgateTo("/packages/homeServer/noticeManage/index");
|
||||
// NavgateTo("/packages/homeServer/noticeManage/index");
|
||||
},
|
||||
},
|
||||
onLoad() {
|
||||
|
||||
@ -59,9 +59,25 @@ page {
|
||||
border-bottom: 1rpx solid #eee;
|
||||
}
|
||||
|
||||
.orderTitle {
|
||||
width: 100%;
|
||||
font-size: 24rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.orderTitleSupplier {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
font-weight: bold;
|
||||
margin-bottom: 10rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.status {
|
||||
color: #ff5252;
|
||||
font-weight: bold;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.status2 {
|
||||
@ -71,6 +87,7 @@ page {
|
||||
display: flex;
|
||||
padding: 10rpx;
|
||||
border-radius: 10rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.status2 img {
|
||||
@ -82,6 +99,13 @@ page {
|
||||
.status3 {
|
||||
color: #949494;
|
||||
font-weight: bold;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.order_status{
|
||||
color: #333;
|
||||
font-weight: bold;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.goods-list {
|
||||
|
||||
@ -23,16 +23,20 @@
|
||||
<view class="contentList">
|
||||
<!-- 订单头部信息 -->
|
||||
<view class="order-header" @click="toDetails(item)">
|
||||
<text>提交订单:{{ item.order_time }}</text>
|
||||
<view v-if="item.order_status == 6 || item.order_status == 5" class="status3">{{
|
||||
getOrderStatus(item.order_status) }}</view>
|
||||
<view v-else-if="item.order_status == 7" class="status2">
|
||||
<img src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/myOrder/refund.png" />
|
||||
{{ getOrderStatus(item.order_status) }}
|
||||
<view class="orderTitle">
|
||||
<view class="orderTitleSupplier">{{ item.supplier_name }}
|
||||
<view v-if="item.order_status == 6 || item.order_status == 5" class="status3">{{
|
||||
getOrderStatus(item.order_status) }}</view>
|
||||
<view v-else-if="item.order_status == 7" class="status2">
|
||||
<img src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/myOrder/refund.png" />
|
||||
{{ getOrderStatus(item.order_status) }}
|
||||
</view>
|
||||
<view v-else class="order_status">{{
|
||||
getOrderStatus(item.order_status)
|
||||
}}</view>
|
||||
</view>
|
||||
<text>提交订单:{{ item.order_time }}</text>
|
||||
</view>
|
||||
<view v-else class="order_status">{{
|
||||
getOrderStatus(item.order_status)
|
||||
}}</view>
|
||||
</view>
|
||||
|
||||
<!-- 商品列表 -->
|
||||
@ -65,7 +69,7 @@
|
||||
<view class="btn-group" v-if="item.order_status === 5">
|
||||
<text class="afterSaleNum">{{ item.commodity_order_item_list.length }}笔售后</text>
|
||||
<button class="cancel-btn" @click="afterSale(item)">退换/售后</button>
|
||||
<button class="pay-btn" @click="cancelOrder">评价</button>
|
||||
<button class="pay-btn">评价</button>
|
||||
</view>
|
||||
<view class="btn-group" v-if="item.order_status === 6">
|
||||
<!-- <button class="cancel-btn" @click="orderEvaluate">
|
||||
|
||||
@ -39,9 +39,9 @@
|
||||
<!-- 订单金额 -->
|
||||
<view class="amount-section">
|
||||
<view v-if="status !== '退款中'">
|
||||
<view class="total-amount">¥{{ orderInfo.payment_amount }}</view>
|
||||
<view class="total-amount">¥{{ orderInfo.total_amount }}</view>
|
||||
<view class="original-price">商品下单应付
|
||||
<text> ¥{{ orderInfo.payment_amount }}</text>
|
||||
<text> ¥{{ orderInfo.total_amount }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="goods-item" v-for="(item, index) in orderInfo.commodity_order_item_list" :key="index">
|
||||
@ -62,7 +62,7 @@
|
||||
</view>
|
||||
<view class="hr"></view>
|
||||
<view class="info-item">
|
||||
<view class="info-label1">下单总金额( ¥{{ orderInfo.orderAmount }} )</view>
|
||||
<view class="info-label1">下单总金额( ¥{{ orderInfo.total_amount }} )</view>
|
||||
<view class="info-action">明细</view>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
@ -134,7 +134,7 @@
|
||||
</view>
|
||||
<view class="bottom-buttons" v-if="status === '3'">
|
||||
<!-- <button class="yfd-btn" @click="cancelOrder">运费单</button> -->
|
||||
<button class="cancel-btn" @click="cancelOrder">取消订单</button>
|
||||
<button class="cancel-btn" @click="applyRefund">申请退款</button>
|
||||
<!-- <button class="pay-btn" @click="gotoPayment">立即支付</button> -->
|
||||
</view>
|
||||
<view class="bottom-buttons" v-if="status === '4'">
|
||||
@ -143,14 +143,14 @@
|
||||
<button class="pay-btn" @click="gotoPayment">立即支付</button>
|
||||
</view>
|
||||
<view class="bottom-buttons" v-if="status === '5'">
|
||||
<button class="cancel-btn" @click="orderEvaluate">服务评价</button>
|
||||
<!-- <button class="cancel-btn" @click="orderEvaluate">服务评价</button> -->
|
||||
<!-- <button class="yfd-btn" @click="cancelOrder">运费单</button> -->
|
||||
<button class="pay-btn" @click="gotoPayment">立即支付</button>
|
||||
</view>
|
||||
<view class="bottom-buttons" v-if="status === '6'">
|
||||
<!-- <button class="yfd-btn" @click="cancelOrder">运费单</button> -->
|
||||
<!-- <button class="cancel-btn" @click="cancelOrder">服务评价</button> -->
|
||||
<button class="pay-btn" @click="gotoPayment">再来一单</button>
|
||||
<!-- <button class="pay-btn" @click="gotoPayment">再来一单</button> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -158,7 +158,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { picUrl, NavgateTo } from "../../../utils";
|
||||
import { picUrl, NavgateTo, request } from "../../../utils";
|
||||
import { apiArr as afterSaleApi } from "../../../api/afterSale";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@ -170,7 +171,6 @@ export default {
|
||||
},
|
||||
onLoad(options) {
|
||||
const item = JSON.parse(options?.item);
|
||||
console.log("🚀 ~ onLoad ~ item:", item)
|
||||
// 启动倒计时
|
||||
item.order_status == "1" ? this.startCountdown() : "";
|
||||
this.status = JSON.stringify(item.order_status);
|
||||
@ -202,15 +202,71 @@ export default {
|
||||
content: "确定要取消订单吗?",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
// 调用取消订单API
|
||||
uni.showToast({ title: "订单已取消", icon: "none" });
|
||||
setTimeout(() => uni.navigateBack(), 1500);
|
||||
const params = {
|
||||
order_id: this.orderInfo.id,
|
||||
method: 1,
|
||||
cancel_reason: '用户主动取消',
|
||||
}
|
||||
request(afterSaleApi.cancelOrConfirm, "POST", params).then((res) => {
|
||||
uni.showToast({ title: "订单已取消", icon: "none" });
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 1500);
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// 申请退款
|
||||
applyRefund() {
|
||||
uni.showModal({
|
||||
title: "申请退款",
|
||||
content: "确定要申请退款吗?",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
const params = {
|
||||
nick_name: uni.getStorageSync("nickName"),
|
||||
order_id: this.orderInfo.id,
|
||||
goods_ids: this.orderInfo.commodity_order_item_list.map(item => item.goods_id),
|
||||
after_sales_type: 1,
|
||||
after_sales_reason: '用户申请退款',
|
||||
refund_amount: this.orderInfo.total_amount,
|
||||
order_status: 3
|
||||
}
|
||||
request(afterSaleApi.afterSaleCreate, "POST", params).then((res) => {
|
||||
uni.showToast({ title: "退款申请已提交", icon: "none" });
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 1500);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 确认收货
|
||||
confirmReceiving() {
|
||||
uni.showModal({
|
||||
title: "确认收货",
|
||||
content: "确认收货后订单状态将变为【已完成】,如有售后需求可正常申请退款/售后,确定要确认收货吗?",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
const params = {
|
||||
order_id: this.orderInfo.id,
|
||||
method: 2,
|
||||
}
|
||||
request(afterSaleApi.cancelOrConfirm, "POST", params).then((res) => {
|
||||
uni.showToast({ title: "已确认收货", icon: "none" });
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 1500);
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
gotoPayment() {
|
||||
console.log("🚀 ~ gotoPayment ~ 去支付:");
|
||||
// 跳转到支付页面
|
||||
// uni.navigateTo({
|
||||
// url: "/kitchen/pay/index",
|
||||
|
||||
@ -62,6 +62,11 @@ page{
|
||||
background: linear-gradient(to right, #ffe7e7, #ffffff);
|
||||
}
|
||||
|
||||
.copy-icon {
|
||||
width: 30rpx;
|
||||
height: 30rpx;
|
||||
}
|
||||
|
||||
.order-number {
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
|
||||
@ -12,6 +12,8 @@
|
||||
<view v-for="(order, index) in orders" :key="index" class="order-card">
|
||||
<view class="order-header">
|
||||
<text class="order-number">订单编号:{{ order.order_sn }}</text>
|
||||
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/myOrder/copy.png" class="copy-icon"
|
||||
@click="copyOrderNo(order.order_sn)" />
|
||||
<text class="order-status" :class="{
|
||||
'pending': order.status == 1,
|
||||
'using': order.status == 2,
|
||||
@ -59,7 +61,7 @@
|
||||
</view>
|
||||
|
||||
<!-- 待支付订单显示操作按钮 -->
|
||||
<view v-if="order.status === 'pending'" class="order-footer">
|
||||
<view v-if="order.status == 1" class="order-footer">
|
||||
<view class="cancel-button" @tap="cancelOrder(order)">取消订单</view>
|
||||
<view class="pay-button" @tap="goToPayment(order)">去支付</view>
|
||||
</view>
|
||||
@ -104,6 +106,24 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
//订单编号复制
|
||||
copyOrderNo(order_sn) {
|
||||
uni.setClipboardData({
|
||||
data: order_sn,
|
||||
success: () => {
|
||||
uni.showToast({
|
||||
title: '复制成功',
|
||||
icon: 'success'
|
||||
});
|
||||
},
|
||||
fail: () => {
|
||||
uni.showToast({
|
||||
title: '复制失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
selectTab(index, item) {
|
||||
this.selectedTab = index;
|
||||
this.getOrderList()
|
||||
@ -114,7 +134,7 @@ export default {
|
||||
},
|
||||
// 去支付
|
||||
goToPayment(order) {
|
||||
NavgateTo('../parkOrderDetail/index');
|
||||
NavgateTo('../parkOrderDetail/index?item=' + JSON.stringify(order));
|
||||
},
|
||||
// 获取订单列表
|
||||
getOrderList() {
|
||||
|
||||
@ -7,8 +7,9 @@
|
||||
<text class="park-name">{{ orderDetail.parking.parking_name }}</text>
|
||||
</view>
|
||||
<view class="status-right">
|
||||
<image class="success-icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/park/park_orderOk.png"
|
||||
mode="aspectFit"></image>
|
||||
<image class="success-icon"
|
||||
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/park/park_orderOk.png" mode="aspectFit">
|
||||
</image>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@ -30,7 +31,7 @@
|
||||
|
||||
<!-- 电商服务区域 -->
|
||||
<view class="service-section">
|
||||
<text class="section-title">电商服务</text>
|
||||
<text class="section-title">订单信息</text>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="info-label">车牌号码</text>
|
||||
@ -71,11 +72,11 @@
|
||||
|
||||
<script>
|
||||
import {
|
||||
isPhone,
|
||||
picUrl,
|
||||
request,
|
||||
upload,
|
||||
NavgateTo
|
||||
isPhone,
|
||||
picUrl,
|
||||
request,
|
||||
upload,
|
||||
NavgateTo
|
||||
} from '../../../utils';
|
||||
import { apiArr } from '@/api/park.js'
|
||||
|
||||
@ -115,22 +116,22 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
// 计算停车时长
|
||||
calculateParkingDuration() {
|
||||
if (!this.orderDetail || !this.orderDetail.parking_record) {
|
||||
return '0分钟';
|
||||
}
|
||||
|
||||
|
||||
const inTime = new Date(this.orderDetail.parking_record.in_time);
|
||||
const outTime = new Date(this.orderDetail.parking_record.out_time);
|
||||
|
||||
|
||||
// 计算时间差(毫秒)
|
||||
const diffMs = outTime - inTime;
|
||||
|
||||
|
||||
// 转换为分钟
|
||||
const diffMinutes = Math.floor(diffMs / (1000 * 60));
|
||||
|
||||
|
||||
if (diffMinutes < 60) {
|
||||
return `${diffMinutes}分钟`;
|
||||
} else {
|
||||
@ -145,9 +146,17 @@ export default {
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
const order = options.order;
|
||||
if (order) {
|
||||
this.orderDetail = JSON.parse(order);
|
||||
console.log("接收的原始参数:", options);
|
||||
if (options && options.order) {
|
||||
try {
|
||||
// 先解码,再解析
|
||||
const decodedOrder = decodeURIComponent(options.order);
|
||||
this.orderDetail = JSON.parse(decodedOrder);
|
||||
console.log("解析成功:", this.orderDetail);
|
||||
} catch (err) {
|
||||
console.error("解析失败:", err);
|
||||
// 容错处理(如提示加载失败)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,33 +8,36 @@
|
||||
</view>
|
||||
|
||||
<!-- 订单列表 -->
|
||||
<view class="order-item" v-for="order in monthGroup.orders" :key="order.id" @tap="viewOrderDetail(order)">
|
||||
<view class="order-left">
|
||||
<view class="order-type">
|
||||
<view class="order-type1">
|
||||
<image class="order-icon"
|
||||
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/park/park_p.png"
|
||||
mode="aspectFit"></image>
|
||||
<text class="order-type-text">停车</text>
|
||||
<view v-if="orderData.length > 0">
|
||||
<view class="order-item" v-for="order in monthGroup.orders" :key="order.id"
|
||||
@tap="viewOrderDetail(order)">
|
||||
<view class="order-left">
|
||||
<view class="order-type">
|
||||
<view class="order-type1">
|
||||
<image class="order-icon"
|
||||
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/park/park_p.png"
|
||||
mode="aspectFit"></image>
|
||||
<text class="order-type-text">停车</text>
|
||||
</view>
|
||||
<text class="order-status">{{ order.status == 1 ? '待支付' : '已支付' }}</text>
|
||||
</view>
|
||||
<text class="order-status">{{ order.status == 1 ? '待支付' : '已支付' }}</text>
|
||||
</view>
|
||||
|
||||
<view class="order-park-info">
|
||||
<text class="order-park-name">{{ order.record_info.parking_info.parking_name }}</text>
|
||||
<text class="order-amount">¥{{ order.amount.toFixed(2) }}</text>
|
||||
</view>
|
||||
<view class="order-park-info">
|
||||
<text class="order-park-name">{{ order.record_info.parking_info.parking_name }}</text>
|
||||
<text class="order-amount">¥{{ order.amount.toFixed(2) }}</text>
|
||||
</view>
|
||||
|
||||
<view class="order-car-info">
|
||||
<text class="order-car-number">{{ order.record_info.car_number }}</text>
|
||||
<text class="order-car-type">{{ order.record_info.car_billing_type == 1 ? '月租车' :
|
||||
(order.record_info.car_billing_type == 2) ? '临时车' : '贵宾车' }}</text>
|
||||
</view>
|
||||
<view class="order-car-info">
|
||||
<text class="order-car-number">{{ order.record_info.car_number }}</text>
|
||||
<text class="order-car-type">{{ order.record_info.car_billing_type == 1 ? '月租车' :
|
||||
(order.record_info.car_billing_type == 2) ? '临时车' : '贵宾车' }}</text>
|
||||
</view>
|
||||
|
||||
<text class="order-time">{{ order.pay_time }}</text>
|
||||
</view>
|
||||
<view class="delete-button" @tap.stop="deleteOrder(order)">
|
||||
<u-icon name="trash" size="45rpx"></u-icon>
|
||||
<text class="order-time">{{ order.pay_time }}</text>
|
||||
</view>
|
||||
<view class="delete-button" @tap.stop="deleteOrder(order)">
|
||||
<u-icon name="trash" size="45rpx"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -69,7 +72,10 @@ export default {
|
||||
methods: {
|
||||
// 查看订单详情
|
||||
viewOrderDetail(order) {
|
||||
NavgateTo('../orderDetail/index?order=' + JSON.stringify(order))
|
||||
const orderStr = JSON.stringify(order);
|
||||
// 编码特殊字符(如&、?等)
|
||||
const encodedOrder = encodeURIComponent(orderStr);
|
||||
NavgateTo(`../orderDetail/index?order=${encodedOrder}`);
|
||||
},
|
||||
|
||||
// 删除订单方法
|
||||
@ -89,9 +95,7 @@ export default {
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(() => {
|
||||
that.getOrderData();
|
||||
}, 1000);
|
||||
that.getOrderData();
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -159,7 +163,7 @@ export default {
|
||||
// 页面加载时获取订单数据
|
||||
this.getOrderData();
|
||||
},
|
||||
|
||||
|
||||
// 页面滑动到底部时触发
|
||||
onReachBottom() {
|
||||
this.page_size += 10;
|
||||
|
||||
@ -136,7 +136,49 @@ export default {
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
this.itemObj = JSON.parse(decodeURIComponent(options.item));
|
||||
const rawData = JSON.parse(decodeURIComponent(options.item));
|
||||
|
||||
// 检查数据格式是否为month_card_order_list
|
||||
if (rawData.carInfo) {
|
||||
// 根据平台设置不同的trans_type值
|
||||
// 小程序: 71, App: 51
|
||||
const systemInfo = uni.getSystemInfoSync();
|
||||
let trans_type = 51; // 默认App环境
|
||||
|
||||
// 运行时判断是否为小程序环境
|
||||
if (systemInfo.platform === 'devtools' || systemInfo.platform === 'unknown') {
|
||||
trans_type = 71; // 开发工具或未知环境默认为小程序
|
||||
}
|
||||
|
||||
// 条件编译:针对不同平台设置不同值
|
||||
// #ifdef MP
|
||||
trans_type = 71; // 所有小程序平台
|
||||
// #endif
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
trans_type = 51; // App平台
|
||||
// #endif
|
||||
|
||||
this.itemObj = {
|
||||
endTime: rawData.carInfo.deadline_time || '',
|
||||
headerTitle: rawData.parkingInfo.parking_name || '',
|
||||
monthCount: rawData.month_num || 0,
|
||||
monthPrice: rawData.monthly_rental_fee || 0,
|
||||
order_id: rawData.id || 0,
|
||||
paymentAmount: rawData.amount || 0,
|
||||
selectedBillingRule: rawData.billing_rule_id || '',
|
||||
selectedCarPlate: rawData.carInfo.car_no || '',
|
||||
selectedCarPlateId: rawData.carInfo.id || 0,
|
||||
selectedParkId: rawData.parking_id || 0,
|
||||
selectedParkType: rawData.parkingInfo.space_type || 0,
|
||||
startTime: rawData.carInfo.enable_time || '',
|
||||
trans_type: trans_type,
|
||||
user_id: rawData.user_id || 0
|
||||
};
|
||||
} else {
|
||||
// 使用原始数据格式
|
||||
this.itemObj = rawData;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -410,6 +410,12 @@ page {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.notice-text2 {
|
||||
font-size: 28rpx;
|
||||
color: #999999;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.payment-methods {
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
@ -67,49 +67,61 @@
|
||||
</view>
|
||||
|
||||
<!-- 停车费展示部分 -->
|
||||
<view v-if="showCost1" class="cost-container">
|
||||
<view>
|
||||
<image class="cost-image"
|
||||
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/park/park_orderLoading.png"
|
||||
mode="aspectFit" />
|
||||
</view>
|
||||
<view class="cost-header">
|
||||
<text class="cost-title">{{ parkingLotName }} <text class="cost-title2">待支付</text></text>
|
||||
</view>
|
||||
<view class="cost-amount">
|
||||
<text class="amount-symbol">¥</text>
|
||||
<text class="amount-number">{{ costAmount }}</text>
|
||||
</view>
|
||||
<view class="cost-info">
|
||||
<view class="info-item">
|
||||
<text class="info-label">车牌号:</text>
|
||||
<text class="info-value">{{ currentCarNumber }}</text>
|
||||
<view v-if="showCost1">
|
||||
<view v-if="payStatus === 2" class="cost-container">
|
||||
<view>
|
||||
<image class="cost-image"
|
||||
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/park/park_orderLoading.png"
|
||||
mode="aspectFit" />
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">进场时间:</text>
|
||||
<text class="info-value">{{ entryTime }}</text>
|
||||
<view class="cost-header">
|
||||
<text class="cost-title">{{ parkingLotName }} <text class="cost-title2">待支付</text></text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">计费时间:</text>
|
||||
<text class="info-value">{{ billingTime }}</text>
|
||||
<view class="cost-amount">
|
||||
<text class="amount-symbol">¥</text>
|
||||
<text class="amount-number">{{ costAmount }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="notice">
|
||||
<text class="notice-text">⚠️ 请于付款后15分钟内离场否则将加收停车费</text>
|
||||
</view>
|
||||
<view class="payment-methods">
|
||||
<view class="payment-item" :class="{ 'selected': paymentMethod === 'wechat' }"
|
||||
@tap="selectPayment('wechat')">
|
||||
<view class="payment-item-content">
|
||||
<image
|
||||
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_wechat.png"
|
||||
mode="aspectFit" class="payment-icon"></image>
|
||||
<text class="payment-name">微信支付</text>
|
||||
<view class="cost-info">
|
||||
<view class="info-item">
|
||||
<text class="info-label">车牌号:</text>
|
||||
<text class="info-value">{{ currentCarNumber }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">进场时间:</text>
|
||||
<text class="info-value">{{ entryTime }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">计费时间:</text>
|
||||
<text class="info-value">{{ billingTime }}</text>
|
||||
</view>
|
||||
<view v-if="paymentMethod === 'wechat'" class="payment-selected"></view>
|
||||
</view>
|
||||
<view class="notice">
|
||||
<!-- 未支付状态显示 -->
|
||||
<text class="notice-text">⚠️ 请于付款后{{ feeOutTime }}分钟内离场否则将加收停车费</text>
|
||||
</view>
|
||||
<view class="payment-methods">
|
||||
<view class="payment-item" :class="{ 'selected': paymentMethod === 'wechat' }"
|
||||
@tap="selectPayment('wechat')">
|
||||
<view class="payment-item-content">
|
||||
<image
|
||||
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_wechat.png"
|
||||
mode="aspectFit" class="payment-icon"></image>
|
||||
<text class="payment-name">微信支付</text>
|
||||
</view>
|
||||
<view v-if="paymentMethod === 'wechat'" class="payment-selected"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="pay-button" @tap="confirmPayment">立即付款</view>
|
||||
</view>
|
||||
<view v-else class="cost-container notice-text2">
|
||||
<view>
|
||||
<image class="cost-image"
|
||||
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/park/park_orderLoading.png"
|
||||
mode="aspectFit" />
|
||||
</view>
|
||||
<span v-if="!isTimeout">⚠️ 支付成功,请于{{ countdownTime }}内离场否则将加收停车费</span>
|
||||
<span v-else>⚠️ 您已超时未离场,已重新计费</span>
|
||||
</view>
|
||||
<view class="pay-button" @tap="confirmPayment">立即付款</view>
|
||||
</view>
|
||||
<view v-if="showCost2" class="cost-container not-found">
|
||||
未找到停车记录
|
||||
@ -173,11 +185,18 @@ export default {
|
||||
parkingLotName: '',
|
||||
costAmount: '',
|
||||
currentCarNumber: '',
|
||||
feeOutTime: '',//免费出场时间
|
||||
entryTime: '',
|
||||
billingTime: '',
|
||||
paymentMethod: 'wechat',
|
||||
// 定时器ID,用于清除定时器
|
||||
timerId: null
|
||||
timerId: null,
|
||||
|
||||
// 支付状态相关数据
|
||||
payStatus: 0,
|
||||
payTime: '',
|
||||
countdownTime: '',
|
||||
isTimeout: false
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
@ -214,6 +233,10 @@ export default {
|
||||
numberInputResult(e) {
|
||||
this.defaultNum = e;
|
||||
|
||||
// 当车牌数据改变时,隐藏停车费显示
|
||||
this.showCost1 = false;
|
||||
this.showCost2 = false;
|
||||
|
||||
// 使用$nextTick确保DOM更新完成后再尝试操作组件
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.carNumberInput) {
|
||||
@ -265,6 +288,31 @@ export default {
|
||||
this.billingTime = timeStr;
|
||||
},
|
||||
|
||||
// 更新倒计时
|
||||
updateCountdown() {
|
||||
const payDateTime = new Date(this.payTime);
|
||||
const currentDateTime = new Date();
|
||||
// 计算支付时间加上免费出场时间后的过期时间
|
||||
const expireDateTime = new Date(payDateTime.getTime() + parseInt(this.feeOutTime) * 60 * 1000);
|
||||
|
||||
// 判断是否已超时
|
||||
if (currentDateTime > expireDateTime) {
|
||||
this.isTimeout = true;
|
||||
// 清除定时器,不再更新倒计时
|
||||
if (this.timerId) {
|
||||
clearInterval(this.timerId);
|
||||
this.timerId = null;
|
||||
}
|
||||
} else {
|
||||
// 计算剩余时间(秒)
|
||||
const remainingSeconds = Math.floor((expireDateTime - currentDateTime) / 1000);
|
||||
// 格式化剩余时间为分:秒
|
||||
const minutes = Math.floor(remainingSeconds / 60);
|
||||
const seconds = remainingSeconds % 60;
|
||||
this.countdownTime = `${minutes}分${seconds}秒`;
|
||||
}
|
||||
},
|
||||
|
||||
// 选择颜色
|
||||
selectColor(index) {
|
||||
this.selectedColorIndex = index;
|
||||
@ -319,23 +367,40 @@ export default {
|
||||
this.costAmount = res.fee_amount;
|
||||
this.currentCarNumber = res.car_number;
|
||||
this.entryTime = res.in_time;
|
||||
this.feeOutTime = res.parking.free_out_time
|
||||
// 清除之前可能存在的定时器
|
||||
if (this.timerId) {
|
||||
clearInterval(this.timerId);
|
||||
this.timerId = null;
|
||||
}
|
||||
|
||||
if (res.car_billing_type == 1) {
|
||||
this.billingTime = '月租车';
|
||||
} else if (res.car_billing_type == 2) {
|
||||
this.billingTime = '临时车';
|
||||
} else {
|
||||
// 计算并实时更新进场时间到现在的时长
|
||||
this.updateBillingTime();
|
||||
// 设置定时器,每秒更新一次
|
||||
// 重置支付状态相关数据
|
||||
this.payStatus = res.pay_status || 0;
|
||||
this.payTime = res.pay_time || '';
|
||||
this.countdownTime = '';
|
||||
this.isTimeout = false;
|
||||
|
||||
// 如果是已支付状态(pay_status=1)
|
||||
if (this.payStatus === 1 && this.payTime) {
|
||||
// 计算并显示倒计时
|
||||
this.updateCountdown();
|
||||
// 设置定时器,每秒更新一次倒计时
|
||||
this.timerId = setInterval(() => {
|
||||
this.updateBillingTime();
|
||||
this.updateCountdown();
|
||||
}, 1000);
|
||||
} else {
|
||||
if (res.car_billing_type == 1) {
|
||||
this.billingTime = '月租车';
|
||||
} else if (res.car_billing_type == 2) {
|
||||
this.billingTime = '临时车';
|
||||
} else {
|
||||
// 计算并实时更新进场时间到现在的时长
|
||||
this.updateBillingTime();
|
||||
// 设置定时器,每秒更新一次
|
||||
this.timerId = setInterval(() => {
|
||||
this.updateBillingTime();
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
this.showCost1 = true;
|
||||
@ -393,23 +458,51 @@ export default {
|
||||
signType: res.signType,
|
||||
paySign: res.paySign,
|
||||
success: (payRes) => {
|
||||
// 重置页面状态为加载时的默认状态
|
||||
// 清除定时器
|
||||
if (this.timerId) {
|
||||
clearInterval(this.timerId);
|
||||
this.timerId = null;
|
||||
}
|
||||
|
||||
// 重置停车费相关状态
|
||||
this.showCost1 = false;
|
||||
this.showCost2 = false;
|
||||
this.parkingLotName = '';
|
||||
this.costAmount = '';
|
||||
this.currentCarNumber = '';
|
||||
this.entryTime = '';
|
||||
this.billingTime = '';
|
||||
this.feeOutTime = '';
|
||||
|
||||
// 重置支付相关状态
|
||||
this.paymentMethod = 'wechat';
|
||||
|
||||
const params = {
|
||||
order_id: resVal.order_id,
|
||||
}
|
||||
request(apiArr.tempParkingOrderQuery, "POST", params).then(res => {
|
||||
this.selectCost()
|
||||
})
|
||||
|
||||
},
|
||||
fail: (payErr) => {
|
||||
const params = {
|
||||
order_id: resVal.order_id
|
||||
}
|
||||
request(apiArr.tempParkingOrderDelete, "POST", params).then((res) => {
|
||||
})
|
||||
uni.showToast({
|
||||
title: payErr.errMsg == 'requestPayment:fail cancel' ? '用户取消支付' : '支付失败',
|
||||
icon: 'none'
|
||||
})
|
||||
// 支付完成后的回调,无论成功失败都会执行
|
||||
}
|
||||
})
|
||||
} else {
|
||||
const params = {
|
||||
order_id: resVal.order_id
|
||||
}
|
||||
request(apiArr.tempParkingOrderDelete, "POST", params).then((res) => {
|
||||
})
|
||||
console.error("获取支付参数失败,缺少必要参数")
|
||||
uni.showToast({
|
||||
title: '获取支付信息失败',
|
||||
@ -417,6 +510,13 @@ export default {
|
||||
})
|
||||
}
|
||||
})
|
||||
}).catch(error => {
|
||||
console.log("111"); // 请求创建订单失败时输出111
|
||||
console.error("创建临时停车订单失败", error);
|
||||
uni.showToast({
|
||||
title: '创建订单失败',
|
||||
icon: 'none'
|
||||
})
|
||||
})
|
||||
},
|
||||
// 获取车辆列表
|
||||
|
||||
@ -228,11 +228,11 @@ export default {
|
||||
name: "临停缴费",
|
||||
url: "/packages/park/temporaryOrder/index",
|
||||
},
|
||||
{
|
||||
image: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/park/parkIndex_icon2.png",
|
||||
name: "月卡充值",
|
||||
url: "/packages/park/monthlyPayment/index",
|
||||
},
|
||||
// {
|
||||
// image: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/park/parkIndex_icon2.png",
|
||||
// name: "月卡充值",
|
||||
// url: "/packages/park/monthlyPayment/index",
|
||||
// },
|
||||
{
|
||||
image: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/park/parkIndex_icon3.png",
|
||||
name: "停车订单",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user