feat: 增加现金支付

This commit is contained in:
HongRun Liu
2026-08-05 10:51:29 +08:00
parent 1daec0121b
commit 25da673443
16 changed files with 1535 additions and 1230 deletions
+203 -207
View File
@@ -1,222 +1,218 @@
<template>
<view class="flex-center" :class="{
<view
class="flex-center"
:class="{
'ju-flex-end': props.type == 2,
'ju-between': props.type != 2,
}">
<view class="more size24" v-if="props.type != 2"></view>
<view class="flex-center ju-flex-end">
<view v-for="(item, index) in btns" :key="index">
<view
v-if="
}"
>
<view class="more size24" v-if="props.type != 2"></view>
<view class="flex-center ju-flex-end">
<view v-for="(item, index) in btns" :key="index">
<view
v-if="
item.value.split(',').indexOf(String(props?.data?.status)) !== -1 &&
!(item.id === 3 && Number(props?.data?.type) === 5)
!(item.id === 3 && Number(props?.data?.type) === 5) &&
!(item.id === 3 && props?.data?.payChannelCode === 'cash_payment')
"
class="btn size28 f500"
@click.stop="btnClick(item.id)"
:style="{ color: item.color, background: item.background, border: item.border }"
:class="{btn1: props.type == 2}">
{{ item.name }}
</view>
</view>
</view>
</view>
class="btn size28 f500"
@click.stop="btnClick(item.id)"
:style="{ color: item.color, background: item.background, border: item.border }"
:class="{ btn1: props.type == 2 }"
>
{{ item.name }}
</view>
</view>
</view>
</view>
</template>
<script setup>
import {
ref,
getCurrentInstance,
defineProps,
defineEmits
} from 'vue';
import sheep from '@/sheep';
import OrderApi from '@/sheep/api/trade/order';
const {
proxy
} = getCurrentInstance();
import { ref, getCurrentInstance, defineProps, defineEmits } from 'vue';
import sheep from '@/sheep';
import OrderApi from '@/sheep/api/trade/order';
const { proxy } = getCurrentInstance();
let emit = defineEmits(['downData']);
const props = defineProps({
data: {
type: Object,
default () {
return {};
},
},
type: {
type: String,
default: '0', //0列表2订单详情
},
});
let btns = ref([{
id: 1,
name: '取消订单',
value: '0',
},
{
id: 2,
name: '去付款',
value: '0',
color: '#EE0A24',
background: 'rgba(238,10,36,0.2)',
border: 'none'
},
{ //在订单详情退货
id: 3,
name: '申请售后',
value: '10,20',
},
{
id: 4,
name: '确认收货',
value: '20,60',
color: '#EE0A24',
background: 'rgba(238,10,36,0.2)',
border: 'none'
},
{
id: 5,
name: '再次购买',
value: '30,50,40',
color: '#FA9C31',
},
{
id: 6,
name: '取消售后',
value: '60',
},
]);
const btnClick = (index) => {
let timestamp = new Date().getTime();
let payExpireTime = props.data.payExpireTime
if (timestamp > payExpireTime && props.data.status == 0 && index == 2) {
uni.showToast({
title: '订单已过期',
icon: 'none'
});
return;
}
if (index === 3 && Number(props?.data?.type) === 5) {
return;
}
let id = props.data?.id;
switch (index) {
case 1:
cancelOrder();
break;
case 2:
payOrder(id);
break;
case 3:
applyAfterSale();
break;
case 4:
confirmReceive();
break;
case 5:
buyAgain();
break;
case 6:
cancelAfterSale();
break;
}
};
// 取消订单
const cancelOrder = () => {
let orderId = props.data?.id;
uni.showModal({
title: '提示',
content: '确定要取消订单吗?',
confirmColor: '#FA7E31',
success: async function(res) {
if (!res.confirm) {
return;
}
let emit = defineEmits(['downData']);
const props = defineProps({
data: {
type: Object,
default() {
return {};
},
},
type: {
type: String,
default: '0', //0列表2订单详情
},
});
let btns = ref([
{
id: 1,
name: '取消订单',
value: '0,70',
},
{
id: 2,
name: '去付款',
value: '0',
color: '#EE0A24',
background: 'rgba(238,10,36,0.2)',
border: 'none',
},
{
//在订单详情退货
id: 3,
name: '申请售后',
value: '10,20',
},
{
id: 4,
name: '确认收货',
value: '20,60',
color: '#EE0A24',
background: 'rgba(238,10,36,0.2)',
border: 'none',
},
{
id: 5,
name: '再次购买',
value: '30,50,40',
color: '#FA9C31',
},
{
id: 6,
name: '取消售后',
value: '60',
},
]);
const btnClick = (index) => {
let timestamp = new Date().getTime();
let payExpireTime = props.data.payExpireTime;
if (timestamp > payExpireTime && props.data.status == 0 && index == 2) {
uni.showToast({
title: '订单已过期',
icon: 'none',
});
return;
}
if (index === 3 && Number(props?.data?.type) === 5) {
return;
}
let id = props.data?.id;
switch (index) {
case 1:
cancelOrder();
break;
case 2:
payOrder(id);
break;
case 3:
applyAfterSale();
break;
case 4:
confirmReceive();
break;
case 5:
buyAgain();
break;
case 6:
cancelAfterSale();
break;
}
};
// 取消订单
const cancelOrder = () => {
let orderId = props.data?.id;
uni.showModal({
title: '提示',
content: '确定要取消订单吗?',
confirmColor: '#FA7E31',
success: async function (res) {
if (!res.confirm) {
return;
}
upData();
const {
code
} = await OrderApi.cancelOrder(orderId);
if (code === 0) {
uni.showToast({
title: '订单已取消',
icon: 'none'
});
upData();
}
},
});
};
// 去付款
const payOrder = (id) => {
sheep.$router.go('/pages/pay/index', {
id: props.data.payOrderId,
});
};
// 申请售后
const applyAfterSale = () => {
sheep.$router.go('/pages/order/aftersale/apply', props.data);
};
// 确认收货
const confirmReceive = () => {
let change = false
if (props.data?.items.length) {
props.data.items.forEach(item => {
if (item.afterSaleStatus == 10) {
change = true
return
}
})
}
if (change) {
uni.showToast({
title: '有售后中的商品,请先处理完售后',
icon: 'none'
})
return
}
uni.showModal({
title: '提示',
content: '确认收货吗?',
confirmColor: '#FA7E31',
success: async function(res) {
if (!res.confirm) {
return;
}
// 正常的确认收货流程
const {
code
} = await OrderApi.receiveOrder(props.data?.id);
if (code === 0) {
upData();
}
},
});
};
// 再次购买
const buyAgain = () => {};
// 取消售后
const cancelAfterSale = () => {};
const upData = () => {
emit('downData');
};
upData();
const { code } = await OrderApi.cancelOrder(orderId);
if (code === 0) {
uni.showToast({
title: '订单已取消',
icon: 'none',
});
upData();
}
},
});
};
// 去付款
const payOrder = (id) => {
sheep.$router.go('/pages/pay/index', {
id: props.data.payOrderId,
});
};
// 申请售后
const applyAfterSale = () => {
sheep.$router.go('/pages/order/aftersale/apply', props.data);
};
// 确认收货
const confirmReceive = () => {
let change = false;
if (props.data?.items.length) {
props.data.items.forEach((item) => {
if (item.afterSaleStatus == 10) {
change = true;
return;
}
});
}
if (change) {
uni.showToast({
title: '有售后中的商品,请先处理完售后',
icon: 'none',
});
return;
}
uni.showModal({
title: '提示',
content: '确认收货吗?',
confirmColor: '#FA7E31',
success: async function (res) {
if (!res.confirm) {
return;
}
// 正常的确认收货流程
const { code } = await OrderApi.receiveOrder(props.data?.id);
if (code === 0) {
upData();
}
},
});
};
// 再次购买
const buyAgain = () => {};
// 取消售后
const cancelAfterSale = () => {};
const upData = () => {
emit('downData');
};
</script>
<style scoped lang="scss">
.more {}
.more {
}
.btn {
line-height: 24rpx;
padding: 10rpx 24rpx;
box-sizing: border-box;
border: 2rpx solid #999999;
border-radius: 10rpx;
margin-left: 12rpx;
color: #999999;
}
.btn {
line-height: 24rpx;
padding: 10rpx 24rpx;
box-sizing: border-box;
border: 2rpx solid #999999;
border-radius: 10rpx;
margin-left: 12rpx;
color: #999999;
}
.btn1 {
// line-height: 74rpx;
// padding: 0 30rpx;
}
.btn1 {
// line-height: 74rpx;
// padding: 0 30rpx;
}
</style>
+12 -2
View File
@@ -14,7 +14,11 @@
>
立即发货
</view>
<view class="ai-button3 w_144" v-if="props.showView" @tap.stop="emit('view')">
<view
class="ai-button3 w_144"
v-if="props.showView && props.status !== 70"
@tap.stop="emit('view')"
>
{{ props.viewText }}
</view>
<view class="ai-button1 w_144 m-l-16" v-if="props.status === 20" @tap.stop="emit('confirm')">
@@ -23,6 +27,12 @@
<view class="ai-button1 w_144 m-l-16" v-if="props.status === 0" @tap.stop="emit('pay')">
去支付
</view>
<view class="ai-button1 w_144 m-l-16" v-if="props.status === 70" @tap.stop="emit('cancel')">
取消订单
</view>
<view class="ai-button1 w_144 m-l-16" v-if="props.status === 70" @tap.stop="emit('pay')">
切换支付
</view>
</view>
</template>
@@ -46,5 +56,5 @@
},
});
const emit = defineEmits(['delay', 'now', 'view', 'confirm', 'pay']);
const emit = defineEmits(['delay', 'now', 'view', 'confirm', 'pay', 'cancel']);
</script>
+175 -147
View File
@@ -1,168 +1,196 @@
<template>
<view class="order_con" :class="{ bg24: props.theme == 2 }">
<view class="order_con" :class="{ bg24: props.theme == 2 }">
<view
class="flex-center ju-between m-b-28"
v-if="(props.type == 2 || props.type == 4) && props.data.logisticsNo"
>
<view>{{ props.data.logisticsName }} {{ props.data.logisticsNo }}</view>
<view class="flex-center">
<view @click.stop="onCopy(props.data.logisticsNo)">复制</view>
<truckLine
:data="props.data"
:code="2"
v-if="props.data.deliveryTime && props.data.logisticsNo"
></truckLine>
</view>
</view>
<view class="flex-center ju-between m-b-28"
v-if="(props.type == 2 || props.type == 4) && props.data.logisticsNo">
<view>{{ props.data.logisticsName }} {{ props.data.logisticsNo }}</view>
<view class="flex-center">
<view @click.stop="onCopy(props.data.logisticsNo)">复制</view>
<truckLine :data="props.data" :code="2" v-if="props.data.deliveryTime && props.data.logisticsNo"></truckLine>
</view>
</view>
<view class="con_item flex-center ju-between" v-for="(v, i) in props.data.items" :key="i"
:class="{ 'al-flex-start': props.type == 3 || props.type == 4 }">
<view class="order_img shrink" :class="{ 'm-r-16': props.type == 3 }">
<image :src="`${v.picUrl}`" mode="aspectFill" />
</view>
<view class="flex1">
<view class="flex-row ju-between m-b-6">
<view class="size28 spuName lineTwo" :class="{ 'p-r-10': props.type == 3, c0: props.theme == 2 }">
{{ v.spuName }}
</view>
<view class="shrink price" v-if="props.type != 4"><span class="size24">¥</span><span class="size36"
style="font-weight: 600">{{ fen2yuan(v.price) }}</span></view>
</view>
<view v-if="props.type == 4">
<view class="m-b-12 size24 h_52" v-for="(item, i) in v.items" :key="i">
<view class="flex1 flex-center ju-between h_52 bg18 radius8 p-l-8 p-r-16">
<view class="lineOne c19">
{{ formatSkuProperties(item?.properties) }}
</view>
<view class="flex-center">
<view class="c19">x{{ item.count }}</view>
<view class=" size28 m-l-12 weight900">¥<span class="">{{ fen2yuan(item.price) }}</span>
</view>
</view>
</view>
<view class="c13 size28 weight900">
¥<span class="size40">{{ fen2yuan(item.payPrice) }}</span>
</view>
</view>
</view>
<view class="flex-row ju-between" :class="{ 'm-t-8': props.type == 3 }" v-else>
<view class="valueName size28" :class="{ c19: props.theme == 2 }">{{ formatSkuProperties(v.properties) }}</view>
<view class="shrink size28 c_333" :class="{ c0: props.theme == 2 }">{{
<view
class="con_item flex-center ju-between"
v-for="(v, i) in props.data.items"
:key="i"
:class="{ 'al-flex-start': props.type == 3 || props.type == 4 }"
>
<view class="order_img shrink" :class="{ 'm-r-16': props.type == 3 }">
<image :src="`${v.picUrl}`" mode="aspectFill" />
</view>
<view class="flex1">
<view class="flex-row ju-between m-b-6">
<view
class="size28 spuName lineTwo"
:class="{ 'p-r-10': props.type == 3, c0: props.theme == 2 }"
>
{{ v.spuName }}
</view>
<view class="shrink price" v-if="props.type != 4"
><span class="size24">¥</span
><span class="size36" style="font-weight: 600">{{ fen2yuan(v.price) }}</span></view
>
</view>
<view v-if="props.type == 4">
<view class="m-b-12 size24 h_52" v-for="(item, i) in v.items" :key="i">
<view class="flex1 flex-center ju-between h_52 bg18 radius8 p-l-8 p-r-16">
<view class="lineOne c19">
{{ formatSkuProperties(item?.properties) }}
</view>
<view class="flex-center">
<view class="c19">x{{ item.count }}</view>
<view class="size28 m-l-12 weight900"
>¥<span class="">{{ fen2yuan(item.price) }}</span>
</view>
</view>
</view>
<view class="c13 size28 weight900">
¥<span class="size40">{{ fen2yuan(item.payPrice) }}</span>
</view>
</view>
</view>
<view class="flex-row ju-between" :class="{ 'm-t-8': props.type == 3 }" v-else>
<view class="valueName size28" :class="{ c19: props.theme == 2 }">{{
formatSkuProperties(v.properties)
}}</view>
<view class="shrink size28 c_333" :class="{ c0: props.theme == 2 }">{{
`x${v.count}`
}}</view>
</view>
<view class="btn flex-row ju-flex-end" v-if="props.type == 2">
<button class="ss-reset-button btnItem btnItem1"
v-if="[10, 20].includes(props.data.status) && v.afterSaleStatus === 0" @tap.stop="
</view>
<view class="btn flex-row ju-flex-end" v-if="props.type == 2">
<button
class="ss-reset-button btnItem btnItem1"
v-if="
[10, 20].includes(props.data.status) &&
v.afterSaleStatus === 0 &&
props.data.payChannelCode !== 'cash_payment'
"
@tap.stop="
sheep.$router.go('/pages/order/aftersale/apply', {
orderId: props.data.id,
itemId: v.id,
})
">
申请售后
</button>
<view class="btnItem btnItem1" v-if="v.afterSaleStatus === 10" @click="cancelAfterSale(v)">
取消售后
</view>
<view class="btnItem" v-if="v.afterSaleStatus === 20"> 售后成功 </view>
</view>
</view>
</view>
</view>
"
>
申请售后
</button>
<view
class="btnItem btnItem1"
v-if="v.afterSaleStatus === 10"
@click="cancelAfterSale(v)"
>
取消售后
</view>
<view class="btnItem" v-if="v.afterSaleStatus === 20"> 售后成功 </view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { ref, reactive, getCurrentInstance, defineProps } from 'vue';
import { fen2yuan } from '@/sheep/hooks/useGoods';
import AfterSaleApi from '@/sheep/api/trade/afterSale';
import sheep from '@/sheep';
const { proxy } = getCurrentInstance() as any;
let emit = defineEmits(['getOrderDetail']);
const formatSkuProperties = (properties: any) => {
const list = Array.isArray(properties) ? properties : [];
return list
.map((property) => property?.valueName)
.filter(Boolean)
.join(' ');
};
const props = defineProps({
data: {
type: Object,
default() {
return {};
},
},
type: {
type: String,
default: '0', //0列表2订单详情 3订单列表 4ai订单详情
},
theme: {
type: String,
default: '2', //1浅色 2深色
},
});
const cancelAfterSale = (v) => {
uni.showModal({
title: '提示',
content: '确定要取消此申请吗?',
confirmColor: '#FA7E31',
success: async function (res) {
if (!res.confirm) {
return;
}
const { code } = await AfterSaleApi.cancelAfterSale(v.afterSaleId);
if (code === 0) {
getOrderDetail();
}
},
});
};
const getOrderDetail = () => {
emit('getOrderDetail');
};
const onCopy = (text) => {
sheep.$helper.copyText(text);
};
import { ref, reactive, getCurrentInstance, defineProps } from 'vue';
import { fen2yuan } from '@/sheep/hooks/useGoods';
import AfterSaleApi from '@/sheep/api/trade/afterSale';
import sheep from '@/sheep';
const { proxy } = getCurrentInstance() as any;
let emit = defineEmits(['getOrderDetail']);
const formatSkuProperties = (properties: any) => {
const list = Array.isArray(properties) ? properties : [];
return list
.map((property) => property?.valueName)
.filter(Boolean)
.join(' ');
};
const props = defineProps({
data: {
type: Object,
default() {
return {};
},
},
type: {
type: String,
default: '0', //0列表2订单详情 3订单列表 4ai订单详情
},
theme: {
type: String,
default: '2', //1浅色 2深色
},
});
const cancelAfterSale = (v) => {
uni.showModal({
title: '提示',
content: '确定要取消此申请吗?',
confirmColor: '#FA7E31',
success: async function (res) {
if (!res.confirm) {
return;
}
const { code } = await AfterSaleApi.cancelAfterSale(v.afterSaleId);
if (code === 0) {
getOrderDetail();
}
},
});
};
const getOrderDetail = () => {
emit('getOrderDetail');
};
const onCopy = (text) => {
sheep.$helper.copyText(text);
};
</script>
<style scoped lang="scss">
.order_con {
.con_item {
margin-bottom: 24rpx;
.order_con {
.con_item {
margin-bottom: 24rpx;
.order_img {
width: 160rpx;
height: 160rpx;
border-radius: 8rpx;
overflow: hidden;
margin-right: 12rpx;
.order_img {
width: 160rpx;
height: 160rpx;
border-radius: 8rpx;
overflow: hidden;
margin-right: 12rpx;
image {
width: 100%;
height: 100%;
}
}
image {
width: 100%;
height: 100%;
}
}
.spuName {
color: #333333;
}
.spuName {
color: #333333;
}
.valueName {
color: #777777;
}
}
}
.valueName {
color: #777777;
}
}
}
.price {
color: #ee0a24;
font-size: 24rpx;
}
.price {
color: #ee0a24;
font-size: 24rpx;
}
.btnItem {
line-height: 50rpx;
padding: 0 20rpx;
box-sizing: border-box;
border-radius: 94px 94px 94px 94px;
margin-top: 12rpx;
font-size: 24rpx;
border: none;
}
.btnItem {
line-height: 50rpx;
padding: 0 20rpx;
box-sizing: border-box;
border-radius: 94px 94px 94px 94px;
margin-top: 12rpx;
font-size: 24rpx;
border: none;
}
.btnItem1 {
background: #F2F2F2;
}
.btnItem1 {
background: #f2f2f2;
}
</style>
+399 -359
View File
@@ -1,393 +1,433 @@
<template>
<view class="card_order bg24 size34" @click="
utils.go('/pages/order/detail', { id: props.index != 5 ? props.data.id : props.data.orderId, type: props.data.type, source: props.data.__source })
">
<view class="flex-center ju-between createTime">
<view class="flex-center shrink">
<view class="size28">订单编号: {{ props.data.no }}</view>
<view class="copy flex-center" @tap.stop="onCopy(props.data.no)" style="margin-left: 10px">
<image :src="`${$url}goods/copy2.svg`" mode="scaleToFill" />
</view>
</view>
<view class="stateText size28" style="margin-left: 10px" :class="formatOrderColor(props.data)"
v-if="props.index != 5">
{{ formatOrderStatus(props.data) }}
</view>
<view class="stateText size28" v-else>
{{ formatAfterSaleStatus(props.data) }}
</view>
</view>
<card_order :data="props.data" v-if="props.index != 5" type="3"></card_order>
<view v-else class="con_item flex-center ju-between al-flex-start">
<view class="order_img shrink">
<image :src="`${props.data.picUrl}`" mode="aspectFill" />
</view>
<view class="flex1 flex-column ju-between">
<view class="flex-row ju-between">
<view class="size28 spuName lineTwo c0">{{ props.data.spuName }}</view>
<view class="shrink price">
<span class="size24">¥</span><span class="size36"
style="font-weight: 600">{{ fen2yuan(props.data.refundPrice) }}</span>
</view>
</view>
<view class="flex-row ju-between m-t-10">
<view class="valueName size24">{{
<view
class="card_order bg24 size34"
@click="
utils.go('/pages/order/detail', {
id: !props.isAfterSale ? props.data.id : props.data.orderId,
type: props.data.type,
source: props.data.__source,
})
"
>
<view class="flex-center ju-between createTime">
<view class="flex-center shrink">
<view class="size28">订单编号: {{ props.data.no }}</view>
<view class="copy flex-center" @tap.stop="onCopy(props.data.no)" style="margin-left: 10px">
<image :src="`${$url}goods/copy2.svg`" mode="scaleToFill" />
</view>
</view>
<view
class="stateText size28"
style="margin-left: 10px"
:class="formatOrderColor(props.data)"
v-if="!props.isAfterSale"
>
{{ formatOrderStatus(props.data) }}
</view>
<view class="stateText size28" v-else>
{{ formatAfterSaleStatus(props.data) }}
</view>
</view>
<card_order :data="props.data" v-if="!props.isAfterSale" type="3"></card_order>
<view v-else class="con_item flex-center ju-between al-flex-start">
<view class="order_img shrink">
<image :src="`${props.data.picUrl}`" mode="aspectFill" />
</view>
<view class="flex1 flex-column ju-between">
<view class="flex-row ju-between">
<view class="size28 spuName lineTwo c0">{{ props.data.spuName }}</view>
<view class="shrink price">
<span class="size24">¥</span
><span class="size36" style="font-weight: 600">{{
fen2yuan(props.data.refundPrice)
}}</span>
</view>
</view>
<view class="flex-row ju-between m-t-10">
<view class="valueName size24">{{
props.data.properties.map((property) => property.valueName).join(' ')
}}</view>
<view class="shrink size24 c0">{{ `x${props.data.count}` }}</view>
</view>
<view class="btn flex-row ju-flex-end">
<button class="ss-reset-button btnItem btnItem1" @tap.stop="onApply"
v-if="statusChange(['10', '20', '30', '62', '63'], String(props.data.status))">取消售后</button>
<button class="ss-reset-button btnItem btnItem1" style="margin-left: 20rpx"
v-if="statusChange(['20'], String(props.data.status))" @tap.stop="
<view class="shrink size24 c0">{{ `x${props.data.count}` }}</view>
</view>
<view class="btn flex-row ju-flex-end">
<button
class="ss-reset-button btnItem btnItem1"
@tap.stop="onApply"
v-if="statusChange(['10', '20', '30', '62', '63'], String(props.data.status))"
>取消售后</button
>
<button
class="ss-reset-button btnItem btnItem1"
style="margin-left: 20rpx"
v-if="statusChange(['20'], String(props.data.status))"
@tap.stop="
sheep.$router.go('/pages/order/aftersale/return-delivery', { id: props.data.id })
">
填写物流信息
</button>
</view>
</view>
</view>
<view class="discount-row flex-between" v-if="props.index != 5">
<view v-if="isDelayedShipmentOrder()" class="delay-notice flex-center">
<view class="delay-notice__icon">!</view>
<view class="delay-notice__text">
延迟发货中,商品已为您锁定,配送需您手动恢复或点击立即发货。
</view>
</view>
<view class="size24 c_999">{{ formatCreateTime(props.data.createTime) }}</view>
<view class="size24 c32">已优惠¥{{ fen2yuan(props.data.randomDiscountPrice) }}</view>
</view>
<view class="flex-row ju-flex-end" v-if="props.index != 5">
<view class="flex-center size24">{{ `共${props.data.productCount}件商品 合计: `
}}
<!-- <view class="price">¥{{ fen2yuan(props.data.payPrice) }}</view> -->
<view class="shrink price"><span class="size24">¥</span><span class="size36"
style="font-weight: 600;">{{ fen2yuan(props.data.payPrice) }}</span></view>
</view>
</view>
<view class="flex-center ju-flex-end m-t-12" v-if="props.index != 5 && isAiActionOrder">
<AiOrderActionBar
:status="currentStatus"
:disableDelayShipment="isPickUpOrder"
:showView="true"
@delay="onDelayShipment"
@now="onNowShipment"
@view="goAiOrderInfo"
@confirm="confirmReceiveOrder"
@pay="goPay"
/>
</view>
<view class="" style="margin-top: 32rpx" v-else-if="props.index != 5">
<card_orderBan :data="props.data" @downData="downData"></card_orderBan>
</view>
</view>
"
>
填写物流信息
</button>
</view>
</view>
</view>
<view class="discount-row flex-between" v-if="!props.isAfterSale">
<view v-if="isDelayedShipmentOrder()" class="delay-notice flex-center">
<view class="delay-notice__icon">!</view>
<view class="delay-notice__text">
延迟发货中,商品已为您锁定,配送需您手动恢复或点击立即发货。
</view>
</view>
<view class="size24 c_999">{{ formatCreateTime(props.data.createTime) }}</view>
<view class="size24 c32">已优惠¥{{ fen2yuan(props.data.randomDiscountPrice) }}</view>
</view>
<view class="flex-row ju-flex-end" v-if="!props.isAfterSale">
<view class="flex-center size24"
>{{ `共${props.data.productCount}件商品 合计: ` }}
<!-- <view class="price">¥{{ fen2yuan(props.data.payPrice) }}</view> -->
<view class="shrink price"
><span class="size24">¥</span
><span class="size36" style="font-weight: 600">{{
fen2yuan(props.data.payPrice)
}}</span></view
>
</view>
</view>
<view class="flex-center ju-flex-end m-t-12" v-if="!props.isAfterSale && isAiActionOrder">
<AiOrderActionBar
:status="currentStatus"
:disableDelayShipment="isPickUpOrder"
:showView="true"
@delay="onDelayShipment"
@now="onNowShipment"
@view="goAiOrderInfo"
@confirm="confirmReceiveOrder"
@pay="goPay"
@cancel="cancelAiOrder"
/>
</view>
<view class="" style="margin-top: 32rpx" v-else-if="!props.isAfterSale">
<card_orderBan :data="props.data" @downData="downData"></card_orderBan>
</view>
</view>
</template>
<script setup>
import {
getCurrentInstance,
defineProps,
defineEmits,
computed,
ref,
watch,
} from 'vue';
import {
fen2yuan,
formatOrderColor,
formatOrderStatus,
formatAfterSaleStatus,
} from '@/sheep/hooks/useGoods';
import card_order from './card_order.vue';
import card_orderBan from '@/components/card_orderBan/card_orderBan.vue';
import AiOrderActionBar from '@/components/orderItem/AiOrderActionBar.vue';
import AfterSaleApi from '@/sheep/api/trade/afterSale';
import sheep from '@/sheep';
import {
aiDelayedShipment,
aiPendingShipment,
confirmReceive as aiConfirmReceive,
giftConfirmReceive,
} from '@/sheep/api/ai';
let emit = defineEmits(['downData']);
let { proxy } = getCurrentInstance();
let props = defineProps({
data: {
type: Object,
default() {
return {};
},
},
index: {
type: Number,
default: 0,
},
});
const downData = () => {
emit('downData');
};
// 复制
const onCopy = (no) => {
proxy.$sheep.$helper.copyText(no);
};
const formatCreateTime = (value) => {
if (!value) return '';
const s = sheep?.$helper?.timeFormat
? sheep.$helper.timeFormat(value, 'yyyy-mm-dd hh:MM:ss')
: String(value);
return s || '';
};
const onApply = () => {
uni.showModal({
title: '提示',
content: '确定要取消此申请吗?',
confirmColor: '#FA7E31',
success: async function (res) {
if (!res.confirm) {
return;
}
const { code } = await AfterSaleApi.cancelAfterSale(props.data.id);
if (code === 0) {
emit('downData');
}
},
});
};
const statusChange = (arr, status) => {
return arr.indexOf(status) != -1;
};
import { getCurrentInstance, defineProps, defineEmits, computed, ref, watch } from 'vue';
import {
fen2yuan,
formatOrderColor,
formatOrderStatus,
formatAfterSaleStatus,
} from '@/sheep/hooks/useGoods';
import card_order from './card_order.vue';
import card_orderBan from '@/components/card_orderBan/card_orderBan.vue';
import AiOrderActionBar from '@/components/orderItem/AiOrderActionBar.vue';
import AfterSaleApi from '@/sheep/api/trade/afterSale';
import sheep from '@/sheep';
import {
aiDelayedShipment,
aiPendingShipment,
confirmReceive as aiConfirmReceive,
giftConfirmReceive,
cancelOrder as cancelAiOrderRequest,
cancelOpenOrder,
} from '@/sheep/api/ai';
let emit = defineEmits(['downData']);
let { proxy } = getCurrentInstance();
let props = defineProps({
data: {
type: Object,
default() {
return {};
},
},
index: {
type: Number,
default: 0,
},
isAfterSale: {
type: Boolean,
default: false,
},
});
const downData = () => {
emit('downData');
};
// 复制
const onCopy = (no) => {
proxy.$sheep.$helper.copyText(no);
};
const formatCreateTime = (value) => {
if (!value) return '';
const s = sheep?.$helper?.timeFormat
? sheep.$helper.timeFormat(value, 'yyyy-mm-dd hh:MM:ss')
: String(value);
return s || '';
};
const onApply = () => {
uni.showModal({
title: '提示',
content: '确定要取消此申请吗?',
confirmColor: '#FA7E31',
success: async function (res) {
if (!res.confirm) {
return;
}
const { code } = await AfterSaleApi.cancelAfterSale(props.data.id);
if (code === 0) {
emit('downData');
}
},
});
};
const statusChange = (arr, status) => {
return arr.indexOf(status) != -1;
};
const isAiActionOrder =
String(props.data?.__source) === 'aishop' || Number(props.data?.type) === 5;
const isPickUpOrder = computed(() => {
if (Number(props.data?.deliveryType) === 2) return true;
return Boolean(
props.data?.pickUpStoreId ||
props.data?.pickUpStore ||
props.data?.pickUpStoreVO ||
props.data?.pickUpVerifyCode,
);
});
const currentStatus = ref(Number(props.data?.status));
watch(
() => props.data?.status,
(value) => {
currentStatus.value = Number(value);
},
{ immediate: true },
);
const isDelayedShipmentOrder = () =>
currentStatus.value === 50 && !isPickUpOrder.value;
const isAiActionOrder =
String(props.data?.__source) === 'aishop' || Number(props.data?.type) === 5;
const isPickUpOrder = computed(() => {
if (Number(props.data?.deliveryType) === 2) return true;
return Boolean(
props.data?.pickUpStoreId ||
props.data?.pickUpStore ||
props.data?.pickUpStoreVO ||
props.data?.pickUpVerifyCode,
);
});
const currentStatus = ref(Number(props.data?.status));
watch(
() => props.data?.status,
(value) => {
currentStatus.value = Number(value);
},
{ immediate: true },
);
const isDelayedShipmentOrder = () => currentStatus.value === 50 && !isPickUpOrder.value;
const resolveAiOrderId = (data) => {
return data?.id || data?.orderId;
};
const resolveAiOrderId = (data) => {
return data?.id || data?.orderId;
};
const onDelayShipment = () => {
delayShipment(props.data);
};
const onDelayShipment = () => {
delayShipment(props.data);
};
const onNowShipment = () => {
nowShipment(props.data);
};
const onNowShipment = () => {
nowShipment(props.data);
};
function delayShipment(data) {
if (isPickUpOrder.value) return;
const id = resolveAiOrderId(data);
if (!id) {
uni.showToast({
title: '订单信息异常',
icon: 'none',
});
return;
}
uni.showModal({
title: '延迟发货',
content: '请您确认是否暂时不需要发货,确认后该产品将为您安排延迟发货',
confirmColor: '#FA7E31',
success: async function (res) {
if (!res.confirm) return;
const { code } = await aiDelayedShipment({
id,
status: 50,
});
if (code === 0) {
currentStatus.value = 50;
emit('downData');
}
},
});
}
function delayShipment(data) {
if (isPickUpOrder.value) return;
const id = resolveAiOrderId(data);
if (!id) {
uni.showToast({
title: '订单信息异常',
icon: 'none',
});
return;
}
uni.showModal({
title: '延迟发货',
content: '请您确认是否暂时不需要发货,确认后该产品将为您安排延迟发货',
confirmColor: '#FA7E31',
success: async function (res) {
if (!res.confirm) return;
const { code } = await aiDelayedShipment({
id,
status: 50,
});
if (code === 0) {
currentStatus.value = 50;
emit('downData');
}
},
});
}
function nowShipment(data) {
if (isPickUpOrder.value) return;
const id = resolveAiOrderId(data);
if (!id) {
uni.showToast({
title: '订单信息异常',
icon: 'none',
});
return;
}
uni.showModal({
title: '立即发货',
content: '请您确认是否需要立即发货,确认后将尽快为您安排发货',
confirmColor: '#FA7E31',
success: async function (res) {
if (!res.confirm) return;
const { code } = await aiPendingShipment({
id,
status: 10,
});
if (code === 0) {
currentStatus.value = 10;
emit('downData');
}
},
});
}
function nowShipment(data) {
if (isPickUpOrder.value) return;
const id = resolveAiOrderId(data);
if (!id) {
uni.showToast({
title: '订单信息异常',
icon: 'none',
});
return;
}
uni.showModal({
title: '立即发货',
content: '请您确认是否需要立即发货,确认后将尽快为您安排发货',
confirmColor: '#FA7E31',
success: async function (res) {
if (!res.confirm) return;
const { code } = await aiPendingShipment({
id,
status: 10,
});
if (code === 0) {
currentStatus.value = 10;
emit('downData');
}
},
});
}
const goAiOrderInfo = () => {
if (Number(props.data?.type) === 5) {
const id = props.data?.id;
if (!id) return;
proxy.utils.go('/pages/order/detail', { id, type: props.data?.type });
return;
}
const id = resolveAiOrderId(props.data);
if (!id) return;
proxy.utils.go('/pages/AI/orderInfo', { id });
};
const goAiOrderInfo = () => {
if (Number(props.data?.type) === 5) {
const id = props.data?.id;
if (!id) return;
proxy.utils.go('/pages/order/detail', { id, type: props.data?.type });
return;
}
const id = resolveAiOrderId(props.data);
if (!id) return;
proxy.utils.go('/pages/AI/orderInfo', { id });
};
const confirmReceiveOrder = async () => {
const id = resolveAiOrderId(props.data);
if (!id) return;
const req = Number(props.data?.type) === 5 ? giftConfirmReceive : aiConfirmReceive;
const { code } = await req({ id });
if (code === 0) {
emit('downData');
}
};
const confirmReceiveOrder = async () => {
const id = resolveAiOrderId(props.data);
if (!id) return;
const req = Number(props.data?.type) === 5 ? giftConfirmReceive : aiConfirmReceive;
const { code } = await req({ id });
if (code === 0) {
emit('downData');
}
};
const goPay = () => {
const id = resolveAiOrderId(props.data);
const payOrderId = props.data?.payOrderId;
if (!id || !payOrderId) {
uni.showToast({
title: '支付信息异常',
icon: 'none',
});
return;
}
proxy.utils.go('/pages/AI/cashierDesk', {
id,
payOrderId,
});
};
const goPay = () => {
const id = resolveAiOrderId(props.data);
const payOrderId = props.data?.payOrderId;
if (!id || !payOrderId) {
uni.showToast({
title: '支付信息异常',
icon: 'none',
});
return;
}
proxy.utils.go('/pages/AI/cashierDesk', {
id,
payOrderId,
});
};
const cancelAiOrder = () => {
const id = resolveAiOrderId(props.data);
if (!id) return;
uni.showModal({
title: '提示',
content: '确定要取消订单吗?',
confirmColor: '#FA7E31',
success: async (res) => {
if (!res.confirm) return;
const request = Number(props.data?.type) === 5 ? cancelOpenOrder : cancelAiOrderRequest;
const result = await request({ id });
if (result.code === 0) emit('downData');
},
});
};
</script>
<style lang="scss" scoped>
.card_order {
padding: 24rpx;
box-sizing: border-box;
border-radius: 8rpx;
}
.card_order {
padding: 24rpx;
box-sizing: border-box;
border-radius: 8rpx;
}
.createTime {
margin-bottom: 32rpx;
}
.createTime {
margin-bottom: 32rpx;
}
.discount-row {
margin-top: 8rpx;
flex-wrap: wrap;
row-gap: 12rpx;
}
.discount-row {
margin-top: 8rpx;
flex-wrap: wrap;
row-gap: 12rpx;
}
.delay-notice {
width: 100%;
padding: 18rpx 20rpx;
box-sizing: border-box;
border-radius: 12rpx;
background: #fff4ea;
align-items: flex-start;
}
.delay-notice {
width: 100%;
padding: 18rpx 20rpx;
box-sizing: border-box;
border-radius: 12rpx;
background: #fff4ea;
align-items: flex-start;
}
.delay-notice__icon {
width: 28rpx;
height: 28rpx;
line-height: 28rpx;
text-align: center;
border-radius: 50%;
border: 2rpx solid #fa7e31;
color: #fa7e31;
font-size: 20rpx;
flex-shrink: 0;
margin-right: 12rpx;
margin-top: 2rpx;
}
.delay-notice__icon {
width: 28rpx;
height: 28rpx;
line-height: 28rpx;
text-align: center;
border-radius: 50%;
border: 2rpx solid #fa7e31;
color: #fa7e31;
font-size: 20rpx;
flex-shrink: 0;
margin-right: 12rpx;
margin-top: 2rpx;
}
.delay-notice__text {
color: #fa7e31;
font-size: 24rpx;
line-height: 36rpx;
}
.delay-notice__text {
color: #fa7e31;
font-size: 24rpx;
line-height: 36rpx;
}
.price {
color: #ee0a24;
font-size: 24rpx;
}
.price {
color: #ee0a24;
font-size: 24rpx;
}
.copy {
width: 24rpx;
height: 24rpx;
margin-left: 14rpx;
.copy {
width: 24rpx;
height: 24rpx;
margin-left: 14rpx;
image {
width: 100%;
height: 100%;
}
}
image {
width: 100%;
height: 100%;
}
}
.con_item {
margin-bottom: 24rpx;
.con_item {
margin-bottom: 24rpx;
.order_img {
width: 160rpx;
height: 160rpx;
border-radius: 8rpx;
overflow: hidden;
margin-right: 12rpx;
.order_img {
width: 160rpx;
height: 160rpx;
border-radius: 8rpx;
overflow: hidden;
margin-right: 12rpx;
image {
width: 100%;
height: 100%;
}
}
image {
width: 100%;
height: 100%;
}
}
.spuName {
color: #323232;
}
.spuName {
color: #323232;
}
.valueName {
color: #777777;
}
}
.valueName {
color: #777777;
}
}
.price {
color: #ee0a24;
font-size: 24rpx;
}
.price {
color: #ee0a24;
font-size: 24rpx;
}
.btnItem {
line-height: 50rpx;
padding: 0 20rpx;
box-sizing: border-box;
border-radius: 94px 94px 94px 94px;
margin-top: 12rpx;
font-size: 24rpx;
border: none;
}
.btnItem {
line-height: 50rpx;
padding: 0 20rpx;
box-sizing: border-box;
border-radius: 94px 94px 94px 94px;
margin-top: 12rpx;
font-size: 24rpx;
border: none;
}
.btnItem1 {
background: #F2F2F2;
}
.btnItem1 {
background: #f2f2f2;
}
</style>