订单详情页面优化。分类页面优化。订单详情下单成功页面优化。

This commit is contained in:
77 2024-10-25 18:00:36 +08:00
parent 954275129d
commit df5dddb424
5 changed files with 917 additions and 859 deletions

View File

@ -80,7 +80,8 @@
await OrderApi.createOrderItemComment(comment);
}
//
sheep.$router.back();
// sheep.$router.back();
sheep.$router.redirect('/pages/order/list');
}
onLoad(async (options) => {

View File

@ -150,7 +150,7 @@
.side-menu-wrap {
width: 200rpx;
height: 100%;
padding-left: 12rpx;
// padding-left: 12rpx;
background-color: #f6f6f6;
.menu-item {
@ -161,7 +161,7 @@
.menu-title {
line-height: 32rpx;
font-size: 30rpx;
font-size: 23rpx;
font-weight: 400;
color: #333;
margin-left: 28rpx;
@ -187,16 +187,16 @@
&.menu-item-active {
background-color: #fff;
border-radius: 20rpx 0 0 20rpx;
// border-radius: 20rpx 0 0 20rpx;
&::before {
content: '';
position: absolute;
right: 0;
bottom: -20rpx;
width: 20rpx;
height: 20rpx;
background: radial-gradient(circle at 0 100%, transparent 20rpx, #fff 0);
left: 0;
bottom: 0;
width: 2px;
height: 100%;
// background: radial-gradient(circle at 0 100%, transparent 20rpx, #fff 0);
background: rgba(236,72,29);
}
&::after {
@ -211,10 +211,10 @@
.menu-title {
font-weight: 600;
&::before {
left: 0;
}
color:rgba(236,72,29);
// &::before {
// left: 0;
// }
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,287 +1,287 @@
<!-- 支付结果页面 -->
<template>
<s-layout title="支付结果" :bgStyle="{ color: '#FFF' }">
<view class="pay-result-box ss-flex-col ss-row-center ss-col-center">
<!-- 信息展示 -->
<view class="pay-waiting ss-m-b-30" v-if="payResult === 'waiting'" />
<image
class="pay-img ss-m-b-30"
v-if="payResult === 'success'"
:src="sheep.$url.static('/static/img/shop/order/order_pay_success.gif')"
/>
<image
class="pay-img ss-m-b-30"
v-if="['failed', 'closed'].includes(payResult)"
:src="sheep.$url.static('/static/img/shop/order/order_paty_fail.gif')"
/>
<view class="tip-text ss-m-b-30" v-if="payResult === 'success'">支付成功</view>
<view class="tip-text ss-m-b-30" v-if="payResult === 'failed'">支付失败</view>
<view class="tip-text ss-m-b-30" v-if="payResult === 'closed'">该订单已关闭</view>
<view class="tip-text ss-m-b-30" v-if="payResult === 'waiting'">检测支付结果...</view>
<view class="pay-total-num ss-flex" v-if="payResult === 'success'">
<view>{{ fen2yuan(state.orderInfo.price) }}</view>
</view>
<!-- 操作区 -->
<view class="btn-box ss-flex ss-row-center ss-m-t-50">
<button class="back-btn ss-reset-button" @tap="sheep.$router.go('/pages/index/index')">
返回首页
</button>
<button
class="check-btn ss-reset-button"
v-if="payResult === 'failed'"
@tap="
sheep.$router.redirect('/pages/pay/index', { id: state.id, orderType: state.orderType })
"
>
重新支付
</button>
<button class="check-btn ss-reset-button" v-if="payResult === 'success'" @tap="onOrder">
查看订单
</button>
<!-- TODO 芋艿拼团接入 -->
<button
class="check-btn ss-reset-button"
v-if="payResult === 'success' && state.tradeOrder.type === 3"
@tap="sheep.$router.redirect('/pages/activity/groupon/order')"
>
我的拼团
</button>
</view>
<!-- TODO 芋艿订阅 -->
<!-- #ifdef MP -->
<view class="subscribe-box ss-flex ss-m-t-44">
<image class="subscribe-img" :src="sheep.$url.static('/static/img/shop/order/cargo.png')" />
<view class="subscribe-title ss-m-r-48 ss-m-l-16">获取实时发货信息与订单状态</view>
<view class="subscribe-start" @tap="subscribeMessage">立即订阅</view>
</view>
<!-- #endif -->
</view>
</s-layout>
<s-layout title="支付结果" :bgStyle="{ color: '#FFF' }">
<view class="main">
<image
src="https://zysc.fjptzykj.com:3000/shangcheng/7bab925772a5b878b75dcc35e5ebd1d6e6c2e776752554526a71ecd1371c24db.png"
class="img" mode=""></image>
<view class="title" v-if="payResult === 'success'">订单支付成功</view>
<view class="title" v-if="payResult === 'failed'">支付失败</view>
<view class="title" v-if="payResult === 'closed'">该订单已关闭</view>
<view class="title" v-if="payResult === 'waiting'">检测支付结果...</view>
<!-- <view class="title">订单支付成功</view> -->
<view class="fgx"></view>
<view class="ddxx">
<view class="l">
订单号
</view>
<view class="r">
{{ state.orderInfo.no }}
</view>
</view>
<view class="ddxx">
<view class="l">
下单时间
</view>
<view class="r">
{{ sheep.$helper.timeFormat(state.orderInfo.createTime, 'yyyy-mm-dd hh:MM:ss') }}
</view>
</view>
<view class="ddxx">
<view class="l">
支付方式
</view>
<view class="r">
支付余额
</view>
</view>
<view class="ddxx">
<view class="l">
支付余额
</view>
<view class="r">
{{ fen2yuan(state.orderInfo.price) }}
</view>
</view>
<view class="fgx"></view>
<view class="ck-detail" v-if="payResult === 'failed'" @tap="sheep.$router.redirect('/pages/pay/index', { id: state.id, orderType: state.orderType })">
重新支付
</view>
<view class="ck-detail" v-if="payResult === 'success' && state.tradeOrder.type === 3" @tap="sheep.$router.redirect('/pages/activity/groupon/order')">
我的拼团
</view>
<view class="ck-detail" v-if="payResult === 'success'" @tap="onOrder">
查看订单
</view>
<view class="bk-home" @click="sheep.$router.go('/pages/index/index');">
返回首页
</view>
<!-- TODO 芋艿订阅 -->
<!-- #ifdef MP -->
<view class="subscribe-box ss-flex ss-m-t-44">
<image class="subscribe-img" :src="sheep.$url.static('/static/img/shop/order/cargo.png')" />
<view class="subscribe-title ss-m-r-48 ss-m-l-16">获取实时发货信息与订单状态</view>
<view class="subscribe-start" @tap="subscribeMessage">立即订阅</view>
</view>
<!-- #endif -->
</view>
</s-layout>
</template>
<script setup>
import { onLoad, onHide, onShow } from '@dcloudio/uni-app';
import { reactive, computed } from 'vue';
import { isEmpty } from 'lodash';
import sheep from '@/sheep';
import PayOrderApi from '@/sheep/api/pay/order';
import { fen2yuan } from '../../sheep/hooks/useGoods';
import OrderApi from '@/sheep/api/trade/order';
import {
onLoad,
onHide,
onShow
} from '@dcloudio/uni-app';
import {
reactive,
computed
} from 'vue';
import {
isEmpty
} from 'lodash';
import sheep from '@/sheep';
import PayOrderApi from '@/sheep/api/pay/order';
import {
fen2yuan
} from '../../sheep/hooks/useGoods';
import OrderApi from '@/sheep/api/trade/order';
const state = reactive({
id: 0, //
orderType: 'goods', //
result: 'unpaid', //
orderInfo: {}, //
tradeOrder: {}, // orderType goods
counter: 0, //
});
const state = reactive({
id: 0, //
orderType: 'goods', //
result: 'unpaid', //
orderInfo: {}, //
tradeOrder: {}, // orderType goods
counter: 0, //
});
// result => payResult
const payResult = computed(() => {
if (state.result === 'unpaid') {
return 'waiting';
}
if (state.result === 'paid') {
return 'success';
}
if (state.result === 'failed') {
return 'failed';
}
if (state.result === 'closed') {
return 'closed';
}
});
// result => payResult
const payResult = computed(() => {
if (state.result === 'unpaid') {
return 'waiting';
}
if (state.result === 'paid') {
return 'success';
}
if (state.result === 'failed') {
return 'failed';
}
if (state.result === 'closed') {
return 'closed';
}
});
//
async function getOrderInfo(id) {
state.counter++;
// 1.
const { data, code } = await PayOrderApi.getOrder(id);
if (code === 0) {
state.orderInfo = data;
if (!state.orderInfo || state.orderInfo.status === 30) {
//
state.result = 'closed';
return;
}
if (state.orderInfo.status !== 0) {
// 退
state.result = 'paid';
// #ifdef MP
subscribeMessage();
// #endif
//
if (state.orderType === 'goods') {
const { data, code } = await OrderApi.getOrder(state.orderInfo.merchantOrderId);
if (code === 0) {
state.tradeOrder = data;
}
}
return;
}
}
// 2.1
if (state.counter < 3 && state.result === 'unpaid') {
setTimeout(() => {
getOrderInfo(id);
}, 1500);
}
// 2.2
if (state.counter >= 3) {
state.result = 'failed';
}
}
//
async function getOrderInfo(id) {
state.counter++;
// 1.
const {
data,
code
} = await PayOrderApi.getOrder(id);
if (code === 0) {
state.orderInfo = data;
if (!state.orderInfo || state.orderInfo.status === 30) {
//
state.result = 'closed';
return;
}
if (state.orderInfo.status !== 0) {
// 退
state.result = 'paid';
// #ifdef MP
subscribeMessage();
// #endif
//
if (state.orderType === 'goods') {
const {
data,
code
} = await OrderApi.getOrder(state.orderInfo.merchantOrderId);
if (code === 0) {
state.tradeOrder = data;
}
}
return;
}
}
// 2.1
if (state.counter < 3 && state.result === 'unpaid') {
setTimeout(() => {
getOrderInfo(id);
}, 1500);
}
// 2.2
if (state.counter >= 3) {
state.result = 'failed';
}
}
function onOrder() {
// TODO
if (state.orderType === 'recharge') {
sheep.$router.redirect('/pages/pay/recharge-log');
} else {
sheep.$router.redirect('/pages/order/list');
}
}
function onOrder() {
// TODO
if (state.orderType === 'recharge') {
sheep.$router.redirect('/pages/pay/recharge-log');
} else {
sheep.$router.redirect('/pages/order/list');
}
}
// TODO
// #ifdef MP
function subscribeMessage() {
let event = ['order_dispatched'];
if (state.tradeOrder.type === 3) {
event.push('groupon_finish');
event.push('groupon_fail');
}
sheep.$platform.useProvider('wechat').subscribeMessage(event);
}
// #endif
// TODO
// #ifdef MP
function subscribeMessage() {
let event = ['order_dispatched'];
if (state.tradeOrder.type === 3) {
event.push('groupon_finish');
event.push('groupon_fail');
}
sheep.$platform.useProvider('wechat').subscribeMessage(event);
}
// #endif
onLoad(async (options) => {
//
if (options.id) {
state.id = options.id;
}
//
if (options.orderType) {
state.orderType = options.orderType;
}
onLoad(async (options) => {
//
if (options.id) {
state.id = options.id;
}
//
if (options.orderType) {
state.orderType = options.orderType;
}
//
if (options.payState === 'fail') {
state.result = 'failed';
} else {
//
await getOrderInfo(state.id);
}
});
//
if (options.payState === 'fail') {
state.result = 'failed';
} else {
//
await getOrderInfo(state.id);
}
});
onShow(() => {
if (isEmpty(state.orderInfo)) {
return;
}
getOrderInfo(state.id);
});
onShow(() => {
if (isEmpty(state.orderInfo)) {
return;
}
getOrderInfo(state.id);
});
onHide(() => {
state.result = 'unpaid';
state.counter = 0;
});
onHide(() => {
state.result = 'unpaid';
state.counter = 0;
});
</script>
<style lang="scss" scope>
.main {
background: white;
width: 85%;
padding: 15px;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
border-radius: 12px;
<style lang="scss" scoped>
@keyframes rotation {
0% {
transform: rotate(0deg);
}
.img {
width: 80px;
height: 80px;
display: block;
margin: 0 auto;
margin-top: -52px;
}
100% {
transform: rotate(360deg);
}
}
.title {
text-align: center;
font-size: 18px;
margin: 15px 0;
font-weight: 700;
}
.score-img {
width: 36rpx;
height: 36rpx;
margin: 0 4rpx;
}
.ddxx {
display: flex;
justify-content: space-between;
margin: 10px 0;
.pay-result-box {
padding: 60rpx 0;
.l {
font-size: 17px;
}
.pay-waiting {
margin-top: 20rpx;
width: 60rpx;
height: 60rpx;
border: 10rpx solid rgb(233, 231, 231);
border-bottom-color: rgb(204, 204, 204);
border-radius: 50%;
display: inline-block;
// -webkit-animation: rotation 1s linear infinite;
animation: rotation 1s linear infinite;
}
.r {
font-size: 16px;
color: rbga(102, 102, 102);
}
}
.pay-img {
width: 130rpx;
height: 130rpx;
}
.fgx {
margin: 20px 0;
height: 1px;
width: 100%;
background: rgba(239, 239, 239);
}
.tip-text {
font-size: 30rpx;
font-weight: bold;
color: #333333;
}
.ck-detail {
// background: rgba(254,92,45);
background: rgba(230, 50, 34);
padding: 10px 0;
color: white;
font-size: 19px;
text-align: center;
width: 100%;
margin-bottom: 15px;
border-radius: 31px;
}
.pay-total-num {
font-size: 36rpx;
font-weight: 500;
color: #333333;
font-family: OPPOSANS;
}
.bk-home {
border: 1px solid rgba(230, 50, 34);
padding: 10px 0;
color: rgba(230, 50, 34);
font-size: 19px;
text-align: center;
width: 100%;
border-radius: 31px;
}
.btn-box {
width: 100%;
.back-btn {
width: 190rpx;
height: 70rpx;
font-size: 28rpx;
border: 2rpx solid #dfdfdf;
border-radius: 35rpx;
font-weight: 400;
color: #595959;
}
.check-btn {
width: 190rpx;
height: 70rpx;
font-size: 28rpx;
border: 2rpx solid #dfdfdf;
border-radius: 35rpx;
font-weight: 400;
color: #595959;
margin-left: 32rpx;
}
}
.subscribe-box {
.subscribe-img {
width: 44rpx;
height: 44rpx;
}
.subscribe-title {
font-weight: 500;
font-size: 32rpx;
line-height: 36rpx;
color: #434343;
}
.subscribe-start {
color: var(--ui-BG-Main);
font-weight: 700;
font-size: 32rpx;
line-height: 36rpx;
}
}
}
}
</style>

View File

@ -33,12 +33,12 @@
<view class="new-point">
<view class="l">
<view class="b">1000</view>
<view class="c">累计积分带对接接口</view>
<view class="b">{{state.pointData.addUp}}</view>
<view class="c">累计积分</view>
</view>
<view class="l">
<view class="b">1000</view>
<view class="c">累计消费带对接接口</view>
<view class="b">{{state.pointData.reduce}}</view>
<view class="c">累计消费</view>
</view>
<view class="l">
<view class="b">0</view>
@ -115,6 +115,11 @@
</template>
<script setup>
import request from '@/sheep/request';
import {
baseUrl,
apiPath
} from '@/sheep/config';
import sheep from '@/sheep';
import {
onLoad,
@ -146,7 +151,8 @@
loadStatus: '',
date: [],
today: '',
isShow: 1
isShow: 1,
pointData:[]
});
const tabMaps = [{
@ -170,6 +176,18 @@
return state.date.join('~');
}
});
//
//
function brandlists3() {
request({
url: `${baseUrl}${apiPath}/member/point/record/getPointInfo`,
method: 'GET',
}).then((res) => {
console.log(res, "------brandList3---------");
state.pointData = res.data;
});
}
async function getLogList() {
state.loadStatus = 'loading';
@ -195,6 +213,7 @@
state.today = dayjs().format('YYYY-MM-DD');
state.date = [state.today, state.today];
getLogList();
brandlists3();
});
function onChange(e) {