|
@@ -108,6 +108,8 @@ import { onLoad } from "@dcloudio/uni-app";
|
|
|
import { ref } from "vue";
|
|
import { ref } from "vue";
|
|
|
import OrderCouponDetail from "@/components/order-coupon-detail/order-coupon-detail.vue";
|
|
import OrderCouponDetail from "@/components/order-coupon-detail/order-coupon-detail.vue";
|
|
|
import { to } from "@/utils/navigate";
|
|
import { to } from "@/utils/navigate";
|
|
|
|
|
+import { formatDuration, parseDate } from "@/utils/date";
|
|
|
|
|
+import { formatMoney, fenToYuan } from "@/utils/money";
|
|
|
|
|
|
|
|
const list = ref<any[]>();
|
|
const list = ref<any[]>();
|
|
|
const price = ref();
|
|
const price = ref();
|
|
@@ -115,7 +117,6 @@ const orderDetail = ref();
|
|
|
const order_coupon_detail_ref = ref();
|
|
const order_coupon_detail_ref = ref();
|
|
|
|
|
|
|
|
const handleClickDesc = () => {
|
|
const handleClickDesc = () => {
|
|
|
- console.log("handleClickDesc")
|
|
|
|
|
let {startChargeSeq,discountType} = orderDetail.value;
|
|
let {startChargeSeq,discountType} = orderDetail.value;
|
|
|
order_coupon_detail_ref.value?.open(startChargeSeq,discountType);
|
|
order_coupon_detail_ref.value?.open(startChargeSeq,discountType);
|
|
|
}
|
|
}
|
|
@@ -140,28 +141,12 @@ onLoad((options: any) => {
|
|
|
fetchOrder(options.id)
|
|
fetchOrder(options.id)
|
|
|
.then((res) => {
|
|
.then((res) => {
|
|
|
orderDetail.value = res;
|
|
orderDetail.value = res;
|
|
|
- const totalMoney = (res.totalMoney / 100).toFixed(2);
|
|
|
|
|
- const elecMoney = res.elecMoney ? (res.elecMoney / 100).toFixed(2) : '0.00';
|
|
|
|
|
- const serviceMoney = res.serviceMoney ? (res.serviceMoney / 100).toFixed(2) : '0.00';
|
|
|
|
|
- const discountAmount = (res.discountAmount / 100).toFixed(2);
|
|
|
|
|
|
|
+ const discountAmount = fenToYuan(res.discountAmount);
|
|
|
const discountAmountText = res.rightsDesc;
|
|
const discountAmountText = res.rightsDesc;
|
|
|
const startChargeSeq = res.startChargeSeq;
|
|
const startChargeSeq = res.startChargeSeq;
|
|
|
- const reg = new RegExp("\B(?=(\d{3})+(?!\d))", "g");
|
|
|
|
|
- const start = new Date(res.startTime.replace(/-/g, "/"));
|
|
|
|
|
- const end = res.endTime
|
|
|
|
|
- ? new Date(res.endTime.replace(/-/g, "/"))
|
|
|
|
|
- : new Date();
|
|
|
|
|
- let diff = parseInt(`${(end.getTime() - start.getTime()) / 1000}`);
|
|
|
|
|
- if (diff <= 0) {
|
|
|
|
|
- diff = 60;
|
|
|
|
|
- }
|
|
|
|
|
- const min = parseInt(`${diff / 60}`);
|
|
|
|
|
- const time =
|
|
|
|
|
- min >= 60
|
|
|
|
|
- ? `${parseInt(`${min / 60}`)}小时${parseInt(
|
|
|
|
|
- `${min - parseInt(`${min / 60}`) * 60}`
|
|
|
|
|
- )}分钟`
|
|
|
|
|
- : `${parseInt(`${diff / 60}`)}分钟`;
|
|
|
|
|
|
|
+ const start = parseDate(res.startTime);
|
|
|
|
|
+ const end = res.endTime ? parseDate(res.endTime) : new Date();
|
|
|
|
|
+ const time = formatDuration(start, end, 1);
|
|
|
const _list = [
|
|
const _list = [
|
|
|
{
|
|
{
|
|
|
label: "充电站点",
|
|
label: "充电站点",
|
|
@@ -173,21 +158,16 @@ onLoad((options: any) => {
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
label: "电费",
|
|
label: "电费",
|
|
|
- value: `${elecMoney.replace(reg, ",")}元`,
|
|
|
|
|
|
|
+ value: `${formatMoney(res.elecMoney)}元`,
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
label: "服务费",
|
|
label: "服务费",
|
|
|
- value: `${serviceMoney.replace(reg, ",")}元`,
|
|
|
|
|
|
|
+ value: `${formatMoney(res.serviceMoney)}元`,
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
label: "订单金额",
|
|
label: "订单金额",
|
|
|
- value: `${totalMoney.replace(reg, ",")}元`,
|
|
|
|
|
|
|
+ value: `${formatMoney(res.totalMoney)}元`,
|
|
|
},
|
|
},
|
|
|
- /* {
|
|
|
|
|
- label: "折扣金额",
|
|
|
|
|
- value: `${discountAmount.replace(reg, ",")}元`,
|
|
|
|
|
- discount:true
|
|
|
|
|
- },*/
|
|
|
|
|
{
|
|
{
|
|
|
label: "开始时间",
|
|
label: "开始时间",
|
|
|
value: res.startTime,
|
|
value: res.startTime,
|
|
@@ -217,7 +197,7 @@ onLoad((options: any) => {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
list.value = _list;
|
|
list.value = _list;
|
|
|
- price.value = (res.payAmount / 100).toFixed(2);
|
|
|
|
|
|
|
+ price.value = fenToYuan(res.payAmount);
|
|
|
})
|
|
})
|
|
|
.catch(() => {
|
|
.catch(() => {
|
|
|
uni.showModal({
|
|
uni.showModal({
|