This commit is contained in:
2023-08-18 17:22:11 +08:00
parent 1263c372cb
commit 61f840059b
36 changed files with 2371 additions and 1109 deletions

View File

@@ -1,7 +1,14 @@
<script lang="ts" setup>
import {ref} from "vue";
import Taro from "@tarojs/taro";
import Pay from "../../../components/Pay.vue";
import { ref } from "vue";
import {
useLoad,
useReachBottom,
showToast,
navigateTo,
setStorageSync,
} from "@tarojs/taro";
import Pay from "@/components/Pay.vue";
import { getIntegralOrderList } from "@/api/user";
const tabValue = ref(0);
@@ -35,38 +42,79 @@ const tabsList = ref([
},
]);
const orderList = ref([{}]);
const jfInfo = ref({});
Taro.useLoad((options) => {
interface OrderList {
add_time: string;
status: number;
BindGoods: {
cover: string;
name: string;
number: number;
};
count: number;
number: number;
}
const orderList = ref<OrderList[]>([]);
useLoad((options) => {
tabValue.value = Number(options.type);
getList();
});
const getList = async () => {
try {
const res = await getIntegralOrderList({
status: tabValue.value,
});
console.log(res);
orderList.value = res.data.data;
} catch (error) {
showToast({
title: error.msg,
icon: "none",
});
}
};
const tabChange = (index: number) => {
tabValue.value = index;
getList();
};
Taro.useReachBottom(() => {
useReachBottom(() => {
console.log("useReachBottom");
});
const openPay = () => {
console.log("openPay");
const openPay = (item: OrderList) => {
console.log("openPay", item);
isShowPay.value = true;
jfInfo.value = item;
};
const errPay = () => {
isShowPay.value = false;
Taro.showToast({
showToast({
title: "支付失败",
icon: "none",
});
jfInfo.value = {};
};
const closePay = () => {
isShowPay.value = false;
Taro.showToast({
showToast({
title: "支付取消",
icon: "none",
});
jfInfo.value = {};
};
const toDetail = (item: any) => {
setStorageSync("item", item);
navigateTo({
url: `/pages/users/order_list_detail/index?orderId=${item.oid}`,
});
};
</script>
@@ -76,11 +124,10 @@ const closePay = () => {
<view>
<view style="font-weight: bold">订单信息</view>
<view style="font-size: 15px"
>消费订单{{ 10 || 0 }} 总消费积分{{ 12312 || 0 }}
</view
>
>消费订单{{ 10 || 0 }} 总消费积分{{ 12312 || 0 }}
</view>
</view>
<image src="../static/user/order_list_top.png"/>
<image src="../static/user/order_list_top.png" />
</view>
<view class="tabs-box">
<view
@@ -97,80 +144,80 @@ const closePay = () => {
</view>
</view>
<view v-if="orderList.length > 0">
<view class="order-card" v-for="item in 10" :key="item">
<view
class="order-card"
v-for="(item, index) in orderList"
:key="index"
>
<view class="top">
<view>2023-08-14 14:24:23</view>
<view style="color: red">待付款</view>
<view>{{ item.add_time.slice(0, 19) }}</view>
<view style="color: red">{{
item.status === 1
? "待付款"
: item.status === 2
? "待使用"
: item.status === 3
? "已使用"
: "已失效"
}}</view>
</view>
<view class="line"></view>
<view class="center">
<view class="top">
<image src="../static/user/order_list_top.png"/>
<view class="title"
>商品名称商品名称商品名称商品名称商品名称商品名称商品名称商品名称
</view
>
<image :src="item.BindGoods.cover" />
<view class="title">{{ item.BindGoods.name }} </view>
<view class="right">
<view>123.00</view>
<view>x1</view>
<view>{{ item.BindGoods.number }}</view>
<view>x{{ item.count }}</view>
</view>
</view>
<view
class="bom"
style="text-align: right; font-size: 13px"
>
10件商品,实付积分:
<text style="color: red"
>123.00
</text
>
{{ item.count }}件商品,实付积分:
<text style="color: red">{{ item.number }}</text>
</view>
</view>
<view class="line"></view>
<view class="btn">
<nut-button plain size="small" type="primary"
>取消订单
</nut-button
>
<nut-button
v-if="item.status === 0"
plain
size="small"
type="primary"
>取消订单
</nut-button>
<nut-button
style="margin-left: 5px"
size="small"
type="primary"
>查看详情
</nut-button
>
@click="toDetail(item)"
>查看详情
</nut-button>
<nut-button
style="margin-left: 5px"
size="small"
type="primary"
@click="openPay()"
>立即付款
</nut-button
>
v-if="item.status === 0"
@click="openPay(item)"
>立即付款
</nut-button>
</view>
</view>
</view>
<nut-empty v-else description="暂无订单"></nut-empty>
<pay
:isShowPay="isShowPay"
payType="wx"
payType="jf"
@errPay="errPay"
@closePay="closePay"
:jfInfo="jfInfo"
/>
</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%;
@@ -246,7 +293,7 @@ scroll-view {
.top {
display: flex;
justify-content: space-between;
align-items: center;
// align-items: flex-start;
image {
width: 150px;