header

parent 7b560fb4
<template> <template>
<view class="container"> <view class="container">
<Header title="商品详情页"></Header> <!-- <Header title="商品详情页"></Header> -->
<Search title="商品详情页" backgroundBox="white" :showTitle="true"></Search>
<web-view <web-view
style="height: 600rpx" style="height: 600rpx"
:src="logisticsDetail.trailUrl" :src="logisticsDetail.trailUrl"
v-if="logisticsDetail" v-if="logisticsDetail"
></web-view> ></web-view>
<!-- <view style="height: 600rpx; background-color: aquamarine"></view> --> <!-- <view style="height: 600rpx; background-color: aquamarine"></view> -->
<view class="content" v-if="orderDetail"> <view class="content1" v-if="orderDetail">
<view class="info"> <view class="info">
<view class="top" v-if="logisticsDetail"> <view class="top" v-if="logisticsDetail">
<view class="left"> <view class="left">
...@@ -26,7 +27,7 @@ ...@@ -26,7 +27,7 @@
<text @tap="callShopPhone(shopDetail.phone)">打电话</text> <text @tap="callShopPhone(shopDetail.phone)">打电话</text>
</view> </view>
</view> </view>
<view class="steps" :style="{ 'padding-top': logisticsDetail ? '0' : '80rpx' }"> <view class="steps">
<view class="step-box"> <view class="step-box">
<view class="header"> <view class="header">
<view class="dot"></view> <view class="dot"></view>
...@@ -52,6 +53,12 @@ ...@@ -52,6 +53,12 @@
<text class="title"> <text class="title">
{{ orderStatusList[orderDetail.orderLogistics.status] }} {{ orderStatusList[orderDetail.orderLogistics.status] }}
</text> </text>
<wd-count-down
:time="orderDetail.countDown"
:format="format"
@finish="onFinish(orderNumber)"
v-if="orderDetail.orderLogistics.status === '1'"
/>
<text class="text" v-if="orderDetail.orderLogistics.status === '2'"> <text class="text" v-if="orderDetail.orderLogistics.status === '2'">
{{ orderDetail.orderLogistics.createTime.slice(5, 16) }} {{ orderDetail.orderLogistics.createTime.slice(5, 16) }}
</text> </text>
...@@ -192,10 +199,34 @@ ...@@ -192,10 +199,34 @@
<view style="height: 170rpx"></view> <view style="height: 170rpx"></view>
</view> </view>
<view class="footer" v-if="orderDetail"> <view class="footer" v-if="orderDetail">
<view
class="btn"
v-if="orderDetail.orderLogistics.status === '1'"
@tap="handleCancel(orderNumber)"
>
取消订单
</view>
<view class="btn" v-if="orderDetail.orderLogistics.status === '3'" @tap="openPop()"> <view class="btn" v-if="orderDetail.orderLogistics.status === '3'" @tap="openPop()">
查看物流 查看物流
</view> </view>
<view class="btn" v-if="orderDetail.orderLogistics.status === '5'" @tap="anotherOrder()">
再来一单
</view>
<view class="btn" @tap="callShopPhone(shopDetail.phone)">联系商家</view> <view class="btn" @tap="callShopPhone(shopDetail.phone)">联系商家</view>
<view class="btn err" v-if="orderDetail.orderLogistics.status === '1'" @tap="openPayment()">
立即支付
</view>
<view
class="btn"
@tap="handleRefund()"
v-if="
orderDetail.orderLogistics.status === '2' ||
orderDetail.orderLogistics.status === '3' ||
orderDetail.orderLogistics.status === '4'
"
>
申请退款
</view>
<view class="btn err" v-if="orderDetail.orderLogistics.status === '3'" @click="receipt()"> <view class="btn err" v-if="orderDetail.orderLogistics.status === '3'" @click="receipt()">
确认收货 确认收货
</view> </view>
...@@ -206,6 +237,20 @@ ...@@ -206,6 +237,20 @@
> >
评价订单 评价订单
</view> </view>
<view
class="btn err"
v-if="orderDetail.orderLogistics.status === '6'"
@click="handleDelete(orderNumber)"
>
删除订单
</view>
<view
class="btn err"
v-if="orderDetail.orderLogistics.status === '7'"
@tap="handleAfterSales()"
>
售后详情
</view>
</view> </view>
</view> </view>
<stepBar <stepBar
...@@ -214,12 +259,22 @@ ...@@ -214,12 +259,22 @@
:orderInfo="orderDetail" :orderInfo="orderDetail"
:phone="shopDetail.phone" :phone="shopDetail.phone"
></stepBar> ></stepBar>
<Payment ref="PaymentRef" @payment="payNow"></Payment>
</template> </template>
<script setup> <script setup>
import Header from '@/pages/order/components/Header/index.vue'; import Header from '@/pages/order/components/Header/index.vue';
import stepBar from '@/pages/assistingAgriculture/order/components/stepBar/index.vue'; import stepBar from '@/pages/assistingAgriculture/order/components/stepBar/index.vue';
import { getOrderDetail, getShopDetail, getLogisticsMap, confirmReceipt } from '@/api/order'; import Payment from '@/pages/order/components/Payment/index.vue';
import {
getOrderDetail,
getShopDetail,
getLogisticsMap,
confirmReceipt,
cancelOrderApi,
deleteOrderApi,
repaymentApi,
} from '@/api/order';
const fileDomain = import.meta.env.VITE_APP_IMG_URL; const fileDomain = import.meta.env.VITE_APP_IMG_URL;
const iconUrl = ref('https://cdn.kuaidi100.com/images/all/56/'); const iconUrl = ref('https://cdn.kuaidi100.com/images/all/56/');
...@@ -245,6 +300,38 @@ const payWayList = ref({ ...@@ -245,6 +300,38 @@ const payWayList = ref({
2: '微信', 2: '微信',
}); });
onShow(() => {
if (pendingPaymentOrder.value) {
// 查询订单状态决定是否支付
getOrderDetail({ orderNumber: pendingPaymentOrder.value }).then((res) => {
console.log(res.data.baseOrder.subStatus);
switch (res.data.baseOrder.subStatus) {
case '1':
xma.showToast({
title: '支付失败',
icon: 'error',
duration: 2000,
});
break;
case '2':
pendingPaymentOrder.value = '';
setTimeout(() => {
xma.showToast({
title: '付款成功',
icon: 'success',
});
xma.redirectTo({
url: '/pages/order/order?status=not_use',
});
}, 1000);
break;
default:
break;
}
});
}
});
/** /**
* 获取订单详情 0-翼支付,1-支付宝,2-微信 * 获取订单详情 0-翼支付,1-支付宝,2-微信
*/ */
...@@ -266,6 +353,10 @@ const getDetail = async () => { ...@@ -266,6 +353,10 @@ const getDetail = async () => {
count += item.prodCount; count += item.prodCount;
}); });
orderDetail.value.prodCount = count; orderDetail.value.prodCount = count;
// 待付款倒计时计算
if (orderDetail.value.orderLogistics.status === '1') {
orderDetail.value.countDown = calculateCountdown(orderDetail.value.baseOrder.createTime);
}
xma.hideLoading(); xma.hideLoading();
}; };
...@@ -379,6 +470,157 @@ const handleRemark = () => { ...@@ -379,6 +470,157 @@ const handleRemark = () => {
url: `/pages/order/remark?orderNumber=${orderNumber.value}&shopName=${shopDetail.value.shopName}`, url: `/pages/order/remark?orderNumber=${orderNumber.value}&shopName=${shopDetail.value.shopName}`,
}); });
}; };
/**
* 取消订单
* @param {*} orderNumber
*/
const handleCancel = (orderNumber) => {
xma.showModal({
title: '提示',
content: '确定要取消订单吗?',
success: async (res) => {
if (res.confirm) {
xma.showLoading({
title: '取消中...',
mask: true,
});
await cancelOrderApi({ orderNumber });
xma.hideLoading();
setTimeout(() => {
xma.showToast({
title: '取消成功',
icon: 'success',
});
xma.redirectTo({
url: '/pages/order/order',
});
}, 1000);
}
},
});
};
/**
* 删除订单
* @param {*} orderNumber
*/
const handleDelete = (orderNumber) => {
xma.showModal({
title: '提示',
content: '确定要删除订单吗?',
success: async (res) => {
if (res.confirm) {
xma.showLoading({
title: '删除中...',
mask: true,
});
await deleteOrderApi(orderNumber);
xma.hideLoading();
setTimeout(() => {
xma.showToast({
title: '删除成功',
icon: 'success',
});
xma.redirectTo({
url: '/pages/order/order',
});
}, 1000);
}
},
});
};
/**
* 再来一单 商品类型,0-普通商品,5-团购,6-套餐,7-预售,8-售券
*/
const anotherOrder = () => {
xma.redirectTo({
url: `/pages/assistingAgriculture/detail/detail?prodId=${orderDetail.value.orderItems[0].prodId}`,
});
};
/**
* 申请退款
*/
const handleRefund = () => {
xma.navigateTo({
url: `/pages/order/refund?orderNumber=${orderNumber.value}`,
});
};
/**
* 售后详情
*/
const handleAfterSales = () => {
xma.navigateTo({
url: `/pages/order/afterSales?orderNumber=${orderNumber.value}`,
});
};
/**
* 唤起支付组件
* @param {*} orderNumber
*/
const PaymentRef = ref(null);
const openPayment = () => {
PaymentRef.value.open(orderNumber.value);
};
/**
* 立即支付
* @param {*} orderNumber
*/
const pendingPaymentOrder = ref(null); // 待支付订单
const payNow = async (data) => {
const param = {
orderNumber: data.orderNumber,
tradeType: data.selectType,
};
const res = await repaymentApi(param);
const { paymentUrl, outTradeNo } = res.data.result;
// 修改列表待付款订单号
orderNumber.value = outTradeNo;
pendingPaymentOrder.value = outTradeNo;
window.location.href = paymentUrl;
// 设置一个延时器
const start = Date.now();
setTimeout(() => {
const end = Date.now();
if (end - start < 1200) {
// 如果 iframe 加载时间小于 1.2 秒,说明应用没有安装
xma.showToast({
title: '未安装App',
icon: 'error',
});
// 这里可以跳转到应用下载页面
}
}, 1000);
};
/**
* 计算倒计时
*/
const format = ref('mm:ss');
const calculateCountdown = (item) => {
const now = new Date().getTime();
const orderTime = new Date(item).getTime();
const countdown = orderTime + 30 * 60 * 1000 - now;
if (countdown <= 0) {
return 0;
}
return countdown;
};
/**
* 倒计时结束触发
*/
const onFinish = async (orderNumber) => {
await cancelOrderApi({ orderNumber });
xma.redirectTo({
url: '/pages/order/order',
});
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
...@@ -394,7 +636,7 @@ page { ...@@ -394,7 +636,7 @@ page {
width: 375 * 2rpx; width: 375 * 2rpx;
margin: 0 auto; margin: 0 auto;
.content { .content1 {
position: relative; position: relative;
top: -20rpx; top: -20rpx;
border-radius: 20rpx 20rpx 0 0; border-radius: 20rpx 20rpx 0 0;
...@@ -450,7 +692,7 @@ page { ...@@ -450,7 +692,7 @@ page {
.steps { .steps {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
margin-top: 40rpx; // margin-top: 40rpx;
.step-box { .step-box {
display: flex; display: flex;
...@@ -469,7 +711,8 @@ page { ...@@ -469,7 +711,8 @@ page {
background: #f12a2a; background: #f12a2a;
border-radius: 50%; border-radius: 50%;
position: absolute; position: absolute;
top: -12rpx; top: 6rpx;
z-index: 1;
} }
.past-dot { .past-dot {
...@@ -478,13 +721,16 @@ page { ...@@ -478,13 +721,16 @@ page {
background: #ffd5d5; background: #ffd5d5;
border-radius: 50%; border-radius: 50%;
position: absolute; position: absolute;
top: -12rpx; top: 6rpx;
z-index: 1;
} }
.line { .line {
height: 100%; height: 100%;
width: 2rpx; width: 2rpx;
background-color: #ffd5d5; background-color: #ffd5d5;
position: absolute;
top: 6rpx;
} }
} }
...@@ -494,6 +740,10 @@ page { ...@@ -494,6 +740,10 @@ page {
gap: 22rpx; gap: 22rpx;
width: 100%; width: 100%;
.wd-count-down {
color: #ff0909;
}
.title { .title {
font-family: font-family:
PingFang SC, PingFang SC,
...@@ -835,7 +1085,7 @@ page { ...@@ -835,7 +1085,7 @@ page {
color: #333333; color: #333333;
border-radius: 32rpx; border-radius: 32rpx;
border: 1rpx solid #cccccc; border: 1rpx solid #cccccc;
padding: 12rpx 24rpx; padding: 12rpx 20rpx;
} }
.err { .err {
......
<template> <template>
<view class="container"> <view class="container">
<Header title="订单详情"></Header> <!-- <Header title="订单详情"></Header> -->
<Search title="订单详情" backgroundBox="white" :showTitle="true"></Search>
<view class="content" v-if="orderDetail"> <view class="content" v-if="orderDetail">
<!-- 使用状态 --> <!-- 使用状态 -->
<view class="status"> <view class="status">
...@@ -405,7 +406,6 @@ page { ...@@ -405,7 +406,6 @@ page {
margin: 0 auto; margin: 0 auto;
.content { .content {
padding-top: 44px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 20rpx; gap: 20rpx;
......
<template> <template>
<view class="container"> <view class="container">
<!-- 顶部搜索框--> <!-- 顶部搜索框-->
<view class="top"> <Search backgroundBox="#f3f3f3">
<wd-icon
class="icon"
name="thin-arrow-left"
color="#000"
size="32rpx"
@click="handleBack"
></wd-icon>
<view class="searchBox"> <view class="searchBox">
<view class="search"> <view class="search">
<wd-icon name="search" size="30rpx" color="#999"></wd-icon> <wd-icon name="search" size="30rpx" color="#999"></wd-icon>
...@@ -31,7 +24,8 @@ ...@@ -31,7 +24,8 @@
@tap="handleClear" @tap="handleClear"
></wd-icon> ></wd-icon>
</view> </view>
</view> </Search>
<view class="tabs" v-if="orderDic"> <view class="tabs" v-if="orderDic">
<wd-tabs v-model="tab" animated :lineWidth="38" :lineHeight="3" @change="handleChange" sticky> <wd-tabs v-model="tab" animated :lineWidth="38" :lineHeight="3" @change="handleChange" sticky>
<block v-for="item in tabs" :key="item.value"> <block v-for="item in tabs" :key="item.value">
...@@ -549,14 +543,31 @@ function callShopPhone(phoneNumber) { ...@@ -549,14 +543,31 @@ function callShopPhone(phoneNumber) {
} }
/** /**
* 再来一单 * 再来一单 商品类型,0-普通商品,5-团购,6-套餐,7-预售,8-售券
*/ */
const anotherOrder = (item) => { const anotherOrder = (item) => {
// 清空查询待付款状态 // 清空查询待付款状态
pendingPaymentOrder.value = null; pendingPaymentOrder.value = null;
xma.navigateTo({
url: `/pages/shop/confirmOrder?prodId=${item.orderItems[0].prodId}&skuId=${item.orderItems[0].skuId}`, switch (item.prodType) {
}); case 5:
xma.navigateTo({
url: `/pages/packageDetails/packageDetails?prodId=${item.orderItems[0].prodId}`,
});
break;
case 7:
xma.redirectTo({
url: `/pages/assistingAgriculture/detail/detail?prodId=${item.orderItems[0].prodId}`,
});
break;
case 10:
xma.redirectTo({
url: `/pages/assistingAgriculture/RouteDetails/RouteDetails?prodId=${item.orderItems[0].prodId}&shopId=${item.shopId}`,
});
break;
default:
break;
}
}; };
/** /**
...@@ -566,7 +577,7 @@ const handleQrcode = (item) => { ...@@ -566,7 +577,7 @@ const handleQrcode = (item) => {
// 清空查询待付款状态 // 清空查询待付款状态
pendingPaymentOrder.value = null; pendingPaymentOrder.value = null;
xma.navigateTo({ xma.navigateTo({
url: `/pages/order/ticketCode?orderNumber=${item.orderNumber}`, url: `/pages/order/ticketCode?orderNumber=${item.orderNumber}&shopName=${item.shopName}`,
}); });
}; };
...@@ -579,6 +590,9 @@ const handleRemark = (item) => { ...@@ -579,6 +590,9 @@ const handleRemark = (item) => {
}); });
}; };
/**
* 售后详情
*/
const handleAfterSales = (item) => { const handleAfterSales = (item) => {
xma.navigateTo({ xma.navigateTo({
url: `/pages/order/afterSales?orderNumber=${item.orderNumber}`, url: `/pages/order/afterSales?orderNumber=${item.orderNumber}`,
...@@ -665,7 +679,7 @@ page { ...@@ -665,7 +679,7 @@ page {
margin: 0 auto; margin: 0 auto;
.tabs { .tabs {
padding-top: 108rpx; // padding-top: 20rpx;
&:deep(.wd-tabs) { &:deep(.wd-tabs) {
background-color: #f5f5f5; background-color: #f5f5f5;
...@@ -693,32 +707,32 @@ page { ...@@ -693,32 +707,32 @@ page {
align-items: center; align-items: center;
padding: 0 30rpx; padding: 0 30rpx;
gap: 14rpx; gap: 14rpx;
}
.searchBox {
width: 492rpx;
height: 66rpx;
background: #f3f3f3;
border-radius: 33rpx;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0rpx 28rpx;
margin-left: 40rpx;
.searchBox { background-color: #fff;
width: 492rpx;
height: 66rpx; .search {
background: #f3f3f3; gap: 10rpx;
border-radius: 33rpx;
display: flex; display: flex;
justify-content: space-between;
align-items: center; align-items: center;
padding: 0rpx 28rpx;
background-color: #fff;
.search { .text {
gap: 10rpx; margin-left: 10rpx;
display: flex; font-family:
align-items: center; PingFang SC,
PingFang SC;
.text { font-weight: 500;
margin-left: 10rpx; font-size: 28rpx;
font-family:
PingFang SC,
PingFang SC;
font-weight: 500;
font-size: 28rpx;
}
} }
} }
} }
......
<template> <template>
<view class="container"> <view class="container">
<Header title="售后/退款"></Header> <!-- <Header title="售后/退款"></Header> -->
<Search title="售后/退款" backgroundBox="white" :type="2"></Search>
<view class="content" v-if="orderDetail"> <view class="content" v-if="orderDetail">
<view class="content-box"> <view class="content-box">
<view class="content-item"> <view class="content-item">
...@@ -243,7 +244,7 @@ page { ...@@ -243,7 +244,7 @@ page {
margin: 0 auto; margin: 0 auto;
.content { .content {
padding: 108rpx 10rpx 0; padding: 20rpx 10rpx 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 60rpx; gap: 60rpx;
......
<template> <template>
<view class="container"> <view class="container">
<Header title="查看券码"></Header> <!-- <Header title="查看券码"></Header> -->
<Search title="查看券码" backgroundBox="white" :showTitle="true"></Search>
<view class="content" v-if="orderDetail"> <view class="content" v-if="orderDetail">
<!-- 使用状态 --> <!-- 使用状态 -->
<view class="status"> <view class="status">
<view class="status-text">{{ orderDetail.orderItems[0].prodName }}</view> <view class="status-text">{{ shopName }}</view>
<view class="detail">有效期:{{ orderDetail.orderStore.receiverTime }}</view> <view class="detail">有效期:{{ orderDetail.orderStore.writeOffEnd }}</view>
</view> </view>
<!-- 券码信息 --> <!-- 券码信息 -->
...@@ -32,8 +33,9 @@ import Header from './components/Header/index.vue'; ...@@ -32,8 +33,9 @@ import Header from './components/Header/index.vue';
import { getOrderDetail } from '@/api/order'; import { getOrderDetail } from '@/api/order';
import QRCode from 'qrcode'; import QRCode from 'qrcode';
const shopName = ref('商家名称');
onLoad((options) => { onLoad((options) => {
console.log(options); shopName.value = options.shopName;
getOrderDetailFn(options.orderNumber); getOrderDetailFn(options.orderNumber);
}); });
...@@ -76,7 +78,6 @@ page { ...@@ -76,7 +78,6 @@ page {
margin: 0 auto; margin: 0 auto;
.content { .content {
padding-top: 44px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 20rpx; gap: 20rpx;
......
<template> <template>
<view class="container"> <view class="container">
<Header :title="shopDetail.shopName"></Header> <!-- <Header :title="shopDetail.shopName"></Header> -->
<Search :title="shopDetail.shopName" backgroundBox="white" :showTitle="true"></Search>
<view class="content"> <view class="content">
<view class="shop"> <view class="shop">
<image :src="fileDomain + shopDetail.shopLogo" class="logo" mode="aspectFill"></image> <image :src="fileDomain + shopDetail.shopLogo" class="logo" mode="aspectFill"></image>
...@@ -342,7 +342,7 @@ page { ...@@ -342,7 +342,7 @@ page {
.content { .content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
padding: 100rpx 26rpx 26rpx; padding: 20rpx 26rpx 26rpx;
gap: 26rpx; gap: 26rpx;
.shop { .shop {
......
<template> <template>
<view class="container"> <view class="container">
<Header title="我的券"></Header> <!-- <Header title="我的券"></Header> -->
<Search title="我的券" backgroundBox="white" :showTitle="true"></Search>
<view class="tab"> <view class="tab">
<view <view
:class="currentTab == index ? 'tab-select' : 'tab-item'" :class="currentTab == index ? 'tab-select' : 'tab-item'"
...@@ -308,7 +309,7 @@ page { ...@@ -308,7 +309,7 @@ page {
.content { .content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
padding: 202rpx 26rpx 26rpx; padding: 100rpx 26rpx 26rpx;
gap: 36rpx; gap: 36rpx;
.card { .card {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment