wip: 4.0
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-05-16 14:27:57 +08:00
parent b09c1d9537
commit 8f3b158032
72 changed files with 3931 additions and 2161 deletions

View File

@@ -1,10 +1,10 @@
<script lang="ts" setup>
import { ref } from "vue";
import Taro from "@tarojs/taro";
import Pay from "@/components/Pay.vue";
import { getActiveOrderList, deleteActiveOrder } from "@/api/goods";
import { getOrderStatistics } from "@/api/order";
import { getUserPoint } from "@/api/admin";
import {ref} from 'vue';
import Taro from '@tarojs/taro';
import Pay from '@/components/Pay.vue';
import {getActiveOrderList, deleteActiveOrder} from '@/api/goods';
import {getOrderStatistics} from '@/api/order';
import {getUserPoint} from '@/api/admin';
const tabValue = ref(0);
@@ -12,27 +12,27 @@ const isShowPay = ref(false);
const tabsList = ref([
{
title: "全部",
title: '全部',
value: 0,
num: 0,
},
{
title: "待付款",
title: '待付款',
value: 1,
num: 0,
},
{
title: "待使用",
title: '待使用',
value: 2,
num: 0,
},
{
title: "已使用",
title: '已使用',
value: 3,
num: 0,
},
{
title: "已失效",
title: '已失效',
value: 4,
num: 0,
},
@@ -70,7 +70,7 @@ interface GoodsItem {
const orderList = ref<OrderList[]>([]);
Taro.useLoad((options) => {
Taro.useLoad(options => {
tabValue.value = Number(options.type);
});
@@ -78,6 +78,12 @@ Taro.useDidShow(() => {
getList();
});
// Taro.startPullDownRefresh({
// success: () => {
// getList();
// },
// });
const getList = async () => {
try {
const res = await getActiveOrderList({
@@ -87,10 +93,11 @@ const getList = async () => {
} catch (error) {
Taro.showToast({
title: error.msg,
icon: "none",
icon: 'none',
});
}
await getTj();
// await getTj();
// Taro.stopPullDownRefresh();
};
const tabChange = (index: number) => {
@@ -100,7 +107,7 @@ const tabChange = (index: number) => {
const openPay = async (item: OrderList) => {
isShowPay.value = true;
const user_info = Taro.getStorageSync("userInfo");
const user_info = Taro.getStorageSync('userInfo');
const data = await getUserPoint({
phone: user_info.data.phone,
bid: item.Store.bid,
@@ -114,8 +121,8 @@ const openPay = async (item: OrderList) => {
const errPay = () => {
isShowPay.value = false;
Taro.showToast({
title: "支付失败",
icon: "none",
title: '支付失败',
icon: 'none',
});
jfInfo.value = {};
getList();
@@ -123,8 +130,8 @@ const errPay = () => {
const closePay = () => {
isShowPay.value = false;
Taro.showToast({
title: "支付取消",
icon: "none",
title: '支付取消',
icon: 'none',
});
jfInfo.value = {};
getList();
@@ -137,19 +144,18 @@ const successPay = () => {
};
const toDetail = (item: any) => {
Taro.setStorageSync("item", item);
Taro.navigateTo({
url: `/pages/users/order_list_detail/index?orderId=${item.oid}`,
url: `/pages/users/order_list_detail/index?orderId=${item.joint_oid}`,
});
};
const delOrder = async (oid: string) => {
try {
await deleteActiveOrder({ oid });
await deleteActiveOrder({oid});
} catch (error) {
Taro.showToast({
title: error.msg,
icon: "none",
icon: 'none',
});
}
await getList();
@@ -179,7 +185,7 @@ const getTj = async () => {
} catch (error) {
Taro.showToast({
title: error.msg,
icon: "none",
icon: 'none',
});
}
};
@@ -187,7 +193,7 @@ const getTj = async () => {
<template>
<view>
<view class="topTips">
<!-- <view class="topTips">
<view>
<view style="font-weight: bold">订单信息</view>
<view style="font-size: 15px"
@@ -198,34 +204,50 @@ const getTj = async () => {
</view>
</view>
<image src="../static/user/order_list_top.png" />
</view>
</view> -->
<view class="tabs-box">
<view
v-for="item in tabsList"
:key="item.value"
@click="tabChange(item.value)"
>
<view class="text">{{ item.title }}</view>
<view>{{ item.num }}</view>
@click="tabChange(item.value)">
<view
class="line"
:class="{ lineColor: item.value === tabValue }"
></view>
class="text"
:style="{
color: tabValue === item.value ? '#000' : '#9C9C9C',
}"
>{{ item.title }}</view
>
<!-- <view>{{ item.num }}</view> -->
<view class="line" :class="{lineColor: item.value === tabValue}"></view>
</view>
</view>
<view v-if="orderList.length > 0">
<view class="order-card" v-for="(item, index) in orderList" :key="index">
<view
class="order-card"
v-for="(item, index) in orderList"
:key="index"
@click="toDetail(item)">
<view class="top">
<view>{{ item.add_time.slice(0, 19) }}</view>
<view style="color: red"
<view class="text-[#9C9C9C] text-[25px]">订单号{{ item.oid }}</view>
<view
:style="{
color:
item.status === 0
? '#FF850A'
: item.status === 1
? '#F83D3D'
: item.status === 2
? '#333333'
: '#9C9C9C',
}"
>{{
item.status === 0
? "待付款"
? '待付款'
: item.status === 1
? "待使用"
? '待使用'
: item.status === 2
? "已使用"
: "已失效"
? '已使用'
: '已失效'
}}
</view>
</view>
@@ -233,43 +255,50 @@ const getTj = async () => {
<view class="center" v-for="(itm, idx) in item.OrderGoods" :key="idx">
<view class="top">
<image :src="itm.Goods.cover" />
<view class="title">{{ itm.Goods?.name }}</view>
<view class="flex flex-col justify-between flex-1">
<view class="title">{{ itm.Goods?.name }}</view>
<view class="text-[#F83D3D] mt-5">
<view>{{ itm.pay_price }}</view>
<view>{{ itm.pay_integral }}积分</view>
</view>
</view>
<view class="right">
<view>{{ itm.pay_price }}</view>
<view>{{ itm.pay_integral }}积分</view>
<view>x{{ itm.number }}</view>
</view>
</view>
</view>
<view class="line"></view>
<view v-if="item.status !== 0" style="text-align: right">
<text>{{ item.count }}件商品</text>,
<!-- <view class="line"></view> -->
<view
class="flex justify-between items-center mt-2 mb-2 text-[25px]"
v-if="item.status !== 0"
style="text-align: right">
<text class="text-[#9C9C9C]">{{ item.count }}件商品</text>
<text
>实付款:{{ item.pay_type === 1 ? item.price : item.exchange }},{{
item.pay_type === 1 ? "微信支付" : "积分支付"
}}</text
>{{ item.status !== 0 ? '实' : '应' }}付款{{
item.pay_type === 1 ? '(元): ' : '(积分): '
}}{{ item.pay_type === 1 ? item.price : item.exchange }}</text
>
<view class="line"></view>
<!-- <view class="line"></view> -->
</view>
<view class="btn">
<nut-button
v-if="item.status === 0"
plain
size="small"
size="mini"
type="primary"
@click="delOrder(item.oid)"
>取消订单
</nut-button>
<nut-button
<!-- <nut-button
style="margin-left: 5px"
size="small"
size="mini"
type="primary"
@click="toDetail(item)"
>查看详情
</nut-button>
</nut-button> -->
<nut-button
style="margin-left: 5px"
size="small"
size="mini"
type="primary"
v-if="item.status === 0"
@click="openPay(item)"
@@ -286,8 +315,7 @@ const getTj = async () => {
:OrderType="2"
@errPay="errPay"
@successPay="successPay"
@closePay="closePay"
/>
@closePay="closePay" />
</view>
</template>
@@ -309,8 +337,8 @@ page {
align-items: center;
image {
width: 150px;
height: 150px;
width: 200px;
height: 200px;
}
}
@@ -319,20 +347,20 @@ page {
flex-direction: row;
justify-content: space-between;
align-items: center;
height: auto;
background-color: #fff;
padding: 0 20px;
padding: 20px 20px 0 20px;
text-align: center;
.text {
margin: 10px 20px;
// margin: 10px 20px;
align-items: center;
font-size: 25px;
}
.line {
margin: 0 auto;
margin: 10px auto;
width: 50px;
height: 5px;
height: 10px;
border-radius: 30px;
transition: all 0.3s ease-in-out;
}
@@ -370,20 +398,20 @@ page {
}
.center {
margin-bottom: 10px;
// margin-bottom: 10px;
.top {
display: flex;
justify-content: space-between;
// align-items: flex-start;
// justify-content: space-between;
align-items: flex-start;
image {
width: 150rpx;
height: 150rpx;
border-radius: 10rpx;
width: 150px;
height: 150px;
border-radius: 15px;
margin-right: 10px;
}
.title {
margin-left: 10px;
display: -webkit-box;
overflow: hidden;
-webkit-line-clamp: 2;
@@ -396,6 +424,7 @@ page {
margin-left: 10px;
font-size: 28px;
text-align: right;
color: #9c9c9c;
}
}
}