This commit is contained in:
2023-09-06 03:49:21 +08:00
parent 8b5de95140
commit b6ca53f70e
39 changed files with 2146 additions and 679 deletions

View File

@@ -9,6 +9,8 @@ import {
} from "@tarojs/taro";
import Pay from "@/components/Pay.vue";
import { getIntegralOrderList } from "@/api/user";
import { deleteJfOrder } from "@/api/goods";
import { getOrderStatistics } from "@/api/order";
const tabValue = ref(0);
@@ -18,7 +20,7 @@ const tabsList = ref([
{
title: "全部",
value: 0,
num: 3,
num: 0,
},
{
title: "待付款",
@@ -28,23 +30,24 @@ const tabsList = ref([
{
title: "待使用",
value: 2,
num: 1,
num: 0,
},
{
title: "已使用",
value: 3,
num: 1,
num: 0,
},
{
title: "已失效",
value: 4,
num: 1,
num: 0,
},
]);
const jfInfo = ref({});
interface OrderList {
oid: string;
add_time: string;
status: number;
BindGoods: {
@@ -68,6 +71,7 @@ const getList = async () => {
const res = await getIntegralOrderList({
status: tabValue.value,
});
console.log(res);
orderList.value = res.data.data;
} catch (error) {
@@ -76,6 +80,7 @@ const getList = async () => {
icon: "none",
});
}
getTj();
};
const tabChange = (index: number) => {
@@ -88,9 +93,8 @@ useReachBottom(() => {
});
const openPay = (item: OrderList) => {
console.log("openPay", item);
isShowPay.value = true;
jfInfo.value = item;
jfInfo.value = [item];
};
const errPay = () => {
@@ -100,6 +104,7 @@ const errPay = () => {
icon: "none",
});
jfInfo.value = {};
getList();
};
const closePay = () => {
isShowPay.value = false;
@@ -108,6 +113,7 @@ const closePay = () => {
icon: "none",
});
jfInfo.value = {};
getList();
};
const toDetail = (item: any) => {
@@ -116,6 +122,40 @@ const toDetail = (item: any) => {
url: `/pages/users/order_list_detail/index?orderId=${item.oid}`,
});
};
const delOrder = async (oid: string) => {
try {
const res = await deleteJfOrder({ oid });
console.log(res);
} catch (error) {
showToast({
title: error.msg,
icon: "none",
});
}
getList();
};
const countInfo = ref<any>({});
const getTj = async () => {
try {
const res = await getOrderStatistics({
type: 2,
});
countInfo.value = res.data.data;
tabsList.value[0].num = countInfo.value.A || 0;
tabsList.value[1].num = countInfo.value.B || 0;
tabsList.value[2].num = countInfo.value.C || 0;
tabsList.value[3].num = countInfo.value.D || 0;
tabsList.value[4].num = countInfo.value.F || 0;
} catch (error) {
showToast({
title: error.msg,
icon: "none",
});
}
};
</script>
<template>
@@ -124,7 +164,7 @@ const toDetail = (item: any) => {
<view>
<view style="font-weight: bold">订单信息</view>
<view style="font-size: 15px"
>消费订单{{ 10 || 0 }} 总消费积分{{ 12312 || 0 }}
>消费积分{{ countInfo.Total || 0 }}
</view>
</view>
<image src="../static/user/order_list_top.png" />
@@ -167,17 +207,17 @@ const toDetail = (item: any) => {
<image :src="item.BindGoods.cover" />
<view class="title">{{ item.BindGoods.name }} </view>
<view class="right">
<view>{{ item.BindGoods.number }}</view>
<view>{{ item.number }}</view>
<view>x{{ item.count }}</view>
</view>
</view>
<view
<!-- <view
class="bom"
style="text-align: right; font-size: 13px"
>
{{ item.count }}件商品,实付积分:
<text style="color: red">{{ item.number }}</text>
</view>
</view> -->
</view>
<view class="line"></view>
<view class="btn">
@@ -186,6 +226,7 @@ const toDetail = (item: any) => {
plain
size="small"
type="primary"
@click="delOrder(item.oid)"
>取消订单
</nut-button>
<nut-button