feat(custom): build

This commit is contained in:
2023-11-28 17:59:45 +08:00
parent 22868fdf2c
commit d5c4651665
39 changed files with 5779 additions and 10624 deletions

View File

@@ -1,16 +1,8 @@
<script lang="ts" setup>
import { ref } from "vue";
import {
useLoad,
useReachBottom,
showToast,
navigateTo,
setStorageSync,
useDidShow,
} from "@tarojs/taro";
import Taro from "@tarojs/taro";
import Pay from "@/components/Pay.vue";
import { getIntegralOrderList } from "@/api/user";
import { deleteJfOrder } from "@/api/goods";
import { getActiveOrderList, deleteActiveOrder } from "@/api/goods";
import { getOrderStatistics } from "@/api/order";
const tabValue = ref(0);
@@ -51,40 +43,50 @@ interface OrderList {
oid: string;
add_time: string;
status: number;
BindGoods: {
cover: string;
name: string;
number: number;
};
OrderGoods: GoodsItem[];
count: number;
number: number;
pay_type: number;
exchange: number;
price: number;
}
interface GoodsItem {
Goods: {
name: string;
cover: string;
};
ID: number;
gid: string;
number: number;
oid: string;
pay_integral: number;
pay_price: number;
}
const orderList = ref<OrderList[]>([]);
useLoad((options) => {
Taro.useLoad((options) => {
tabValue.value = Number(options.type);
});
useDidShow(() => {
Taro.useDidShow(() => {
getList();
});
const getList = async () => {
try {
const res = await getIntegralOrderList({
const res = await getActiveOrderList({
status: tabValue.value,
});
console.log(res);
orderList.value = res.data.data;
} catch (error) {
showToast({
Taro.showToast({
title: error.msg,
icon: "none",
});
}
getTj();
await getTj();
};
const tabChange = (index: number) => {
@@ -92,18 +94,18 @@ const tabChange = (index: number) => {
getList();
};
useReachBottom(() => {
Taro.useReachBottom(() => {
console.log("useReachBottom");
});
const openPay = (item: OrderList) => {
isShowPay.value = true;
jfInfo.value = [item];
jfInfo.value = item.oid;
};
const errPay = () => {
isShowPay.value = false;
showToast({
Taro.showToast({
title: "支付失败",
icon: "none",
});
@@ -112,7 +114,7 @@ const errPay = () => {
};
const closePay = () => {
isShowPay.value = false;
showToast({
Taro.showToast({
title: "支付取消",
icon: "none",
});
@@ -121,26 +123,32 @@ const closePay = () => {
};
const toDetail = (item: any) => {
setStorageSync("item", item);
navigateTo({
Taro.setStorageSync("item", item);
Taro.navigateTo({
url: `/pages/users/order_list_detail/index?orderId=${item.oid}`,
});
};
const delOrder = async (oid: string) => {
try {
const res = await deleteJfOrder({ oid });
console.log(res);
await deleteActiveOrder({ oid });
} catch (error) {
showToast({
Taro.showToast({
title: error.msg,
icon: "none",
});
}
getList();
await getList();
};
const countInfo = ref<any>({});
const countInfo = ref<{
A?: number;
B?: number;
C?: number;
D?: number;
F?: number;
Total?: number;
}>({});
const getTj = async () => {
try {
@@ -154,7 +162,7 @@ const getTj = async () => {
tabsList.value[3].num = countInfo.value.D || 0;
tabsList.value[4].num = countInfo.value.F || 0;
} catch (error) {
showToast({
Taro.showToast({
title: error.msg,
icon: "none",
});
@@ -191,35 +199,40 @@ const getTj = async () => {
<view class="order-card" v-for="(item, index) in orderList" :key="index">
<view class="top">
<view>{{ item.add_time.slice(0, 19) }}</view>
<view style="color: red">{{
item.status === 0
? "待付款"
: item.status === 1
? "待使用"
: item.status === 2
? "已使用"
: "已失效"
}}</view>
<view style="color: red"
>{{
item.status === 0
? "待付款"
: item.status === 1
? "待使用"
: item.status === 2
? "已使用"
: "已失效"
}}
</view>
</view>
<view class="line"></view>
<view class="center">
<view class="center" v-for="(itm, idx) in item.OrderGoods" :key="idx">
<view class="top">
<image :src="item.BindGoods.cover" />
<view class="title">{{ item.BindGoods?.name }} </view>
<image :src="itm.Goods.cover" />
<view class="title">{{ itm.Goods?.name }}</view>
<view class="right">
<view>{{ item.BindGoods?.number }}</view>
<view>x{{ item?.count }}</view>
<view>{{ itm.pay_price }}</view>
<view>{{ itm.pay_integral }}积分</view>
<view>x{{ itm.number }}</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 class="line"></view>
<view v-if="item.status !== 0" style="text-align: right">
<text>{{ item.count }}件商品</text>,
<text
>实付款:{{ item.pay_type === 1 ? item.price : item.exchange }},{{
item.pay_type === 1 ? "微信支付" : "积分支付"
}}</text
>
<view class="line"></view>
</view>
<view class="btn">
<nut-button
v-if="item.status === 0"
@@ -250,15 +263,22 @@ const getTj = async () => {
<nut-empty v-else description="暂无订单"></nut-empty>
<pay
:isShowPay="isShowPay"
payType="jf"
:interval="false"
:jfInfo="jfInfo"
:OrderType="2"
@errPay="errPay"
@closePay="closePay"
:jfInfo="jfInfo"
/>
</view>
</template>
<style lang="scss">
page {
// IOS安全区域
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
.topTips {
box-sizing: border-box;
width: 100%;
@@ -331,14 +351,16 @@ const getTj = async () => {
}
.center {
margin-bottom: 10px;
.top {
display: flex;
justify-content: space-between;
// align-items: flex-start;
image {
width: 150px;
height: 150px;
width: 150rpx;
height: 150rpx;
border-radius: 10rpx;
}
.title {