This commit is contained in:
2023-08-15 13:29:52 +08:00
parent 433a4d8f3d
commit c081f0fc29
25 changed files with 1328 additions and 448 deletions

View File

@@ -0,0 +1,274 @@
<script lang="ts" setup>
import {ref} from "vue";
import Taro from "@tarojs/taro";
import Pay from "../../../components/Pay.vue";
const tabValue = ref(0);
const isShowPay = ref(false);
const tabsList = ref([
{
title: "全部",
value: 0,
num: 3,
},
{
title: "待付款",
value: 1,
num: 0,
},
{
title: "待使用",
value: 2,
num: 1,
},
{
title: "已使用",
value: 3,
num: 1,
},
{
title: "已失效",
value: 4,
num: 1,
},
]);
const orderList = ref([{}]);
Taro.useLoad((options) => {
tabValue.value = Number(options.type);
});
const tabChange = (index: number) => {
tabValue.value = index;
};
Taro.useReachBottom(() => {
console.log("useReachBottom");
});
const openPay = () => {
console.log("openPay");
isShowPay.value = true;
};
const errPay = () => {
isShowPay.value = false;
Taro.showToast({
title: "支付失败",
icon: "none",
});
};
const closePay = () => {
isShowPay.value = false;
Taro.showToast({
title: "支付取消",
icon: "none",
});
};
</script>
<template>
<view>
<view class="topTips">
<view>
<view style="font-weight: bold">订单信息</view>
<view style="font-size: 15px"
>消费订单{{ 10 || 0 }} 总消费积分{{ 12312 || 0 }}
</view
>
</view>
<image src="../static/user/order_list_top.png"/>
</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>
<view
class="line"
:class="{ lineColor: item.value === tabValue }"
></view>
</view>
</view>
<view v-if="orderList.length > 0">
<view class="order-card" v-for="item in 10" :key="item">
<view class="top">
<view>2023-08-14 14:24:23</view>
<view style="color: red">待付款</view>
</view>
<view class="line"></view>
<view class="center">
<view class="top">
<image src="../static/user/order_list_top.png"/>
<view class="title"
>商品名称商品名称商品名称商品名称商品名称商品名称商品名称商品名称
</view
>
<view class="right">
<view>123.00</view>
<view>x1</view>
</view>
</view>
<view
class="bom"
style="text-align: right; font-size: 13px"
>
共10件商品,实付积分:
<text style="color: red"
>123.00
</text
>
</view>
</view>
<view class="line"></view>
<view class="btn">
<nut-button plain size="small" type="primary"
>取消订单
</nut-button
>
<nut-button
style="margin-left: 5px"
size="small"
type="primary"
>查看详情
</nut-button
>
<nut-button
style="margin-left: 5px"
size="small"
type="primary"
@click="openPay()"
>立即付款
</nut-button
>
</view>
</view>
</view>
<nut-empty v-else description="暂无订单"></nut-empty>
<pay
:isShowPay="isShowPay"
payType="wx"
@errPay="errPay"
@closePay="closePay"
/>
</view>
</template>
<style lang="scss">
page {
background-color: #f5f5f5;
}
scroll-view {
// IOS安全区域
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
.topTips {
box-sizing: border-box;
width: 100%;
background-color: #ff0000;
color: #ffffff;
padding: 20px;
display: flex;
justify-content: space-between;
align-items: center;
image {
width: 150px;
height: 150px;
}
}
.tabs-box {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
height: auto;
background-color: #fff;
padding: 0 20px;
text-align: center;
.text {
margin: 10px 20px;
align-items: center;
}
.line {
margin: 0 auto;
width: 50px;
height: 5px;
border-radius: 30px;
transition: all 0.3s ease-in-out;
}
.lineColor {
background-color: #ff0000;
}
}
.order-card {
width: 95%;
box-sizing: border-box;
margin: 15px auto;
background-color: #fff;
border-radius: 10px;
padding: 20px;
.line {
width: 100%;
height: 1px;
background-color: #f5f5f5;
margin: 10px;
}
.top {
display: flex;
justify-content: space-between;
align-items: center;
}
.btn {
display: flex;
justify-content: flex-end;
align-items: center;
}
.center {
.top {
display: flex;
justify-content: space-between;
align-items: center;
image {
width: 150px;
height: 150px;
}
.title {
margin-left: 10px;
display: -webkit-box;
overflow: hidden;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
text-overflow: ellipsis;
width: 350px;
}
.right {
margin-left: 10px;
font-size: 28px;
text-align: right;
}
}
}
}
</style>