feat(custom): 新增后结订单
This commit is contained in:
3
src/pages/users/pending_order/index.config.ts
Normal file
3
src/pages/users/pending_order/index.config.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: "后结订单",
|
||||
});
|
||||
87
src/pages/users/pending_order/index.scss
Normal file
87
src/pages/users/pending_order/index.scss
Normal file
@@ -0,0 +1,87 @@
|
||||
page {
|
||||
// IOS安全区域
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
|
||||
.tabs {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin: 20px 30px;
|
||||
|
||||
.item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
text-align: center;
|
||||
align-items: center;
|
||||
font-size: 32px;
|
||||
|
||||
.active {
|
||||
margin-top: 5px;
|
||||
width: 62px;
|
||||
height: 10px;
|
||||
background: #fa2d1c;
|
||||
border-radius: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.card {
|
||||
width: 710px;
|
||||
background: #ffffff;
|
||||
border-radius: 12px;
|
||||
margin: 20px auto;
|
||||
box-sizing: border-box;
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 20px;
|
||||
|
||||
text {
|
||||
margin-right: 10px;
|
||||
color: #333333;
|
||||
font-size: 28px;
|
||||
}
|
||||
}
|
||||
|
||||
.line {
|
||||
width: inherit;
|
||||
height: 1px;
|
||||
background-color: #e9e9e9;
|
||||
}
|
||||
|
||||
.goods-list {
|
||||
display: flex;
|
||||
margin: 20px;
|
||||
|
||||
image {
|
||||
width: 195px;
|
||||
height: 195px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.center {
|
||||
margin-left: 20px;
|
||||
|
||||
.title {
|
||||
font-weight: bold;
|
||||
text-align: left;
|
||||
font-size: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
.num {
|
||||
flex: 1;
|
||||
text-align: right;
|
||||
color: #666666;
|
||||
font-size: 26px;
|
||||
}
|
||||
}
|
||||
|
||||
.desc {
|
||||
padding: 10px 20px;
|
||||
color: #666666;
|
||||
}
|
||||
}
|
||||
147
src/pages/users/pending_order/index.vue
Normal file
147
src/pages/users/pending_order/index.vue
Normal file
@@ -0,0 +1,147 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="tabs">
|
||||
<view
|
||||
class="item"
|
||||
v-for="item in tabs"
|
||||
:key="item.value"
|
||||
@click="changeTabs(item.value)"
|
||||
>
|
||||
<text>{{ item.text }}</text>
|
||||
<view
|
||||
class="line"
|
||||
:class="tabsIndex == item.value ? 'active' : ''"
|
||||
></view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="listData.length > 0">
|
||||
<view
|
||||
class="card"
|
||||
v-for="(item, index) in (listData as any[])"
|
||||
:key="index"
|
||||
>
|
||||
<view class="header">
|
||||
<view>
|
||||
<text>台号: {{ item.seat }}</text>
|
||||
<text>点单人: {{ item.PlaceUser?.nickName }}</text>
|
||||
</view>
|
||||
<view
|
||||
:style="{
|
||||
color: get_color(item.status),
|
||||
fontWeight: 'bold',
|
||||
}"
|
||||
>{{ get_status_text(item.status) }}</view
|
||||
>
|
||||
</view>
|
||||
<view class="line"></view>
|
||||
<view @click="to_page(item)">
|
||||
<view
|
||||
class="goods-list"
|
||||
v-for="(itm, idx) in item.OrderGoods"
|
||||
:key="idx"
|
||||
>
|
||||
<image :src="itm.Goods.cover"></image>
|
||||
<view class="center">
|
||||
<nut-ellipsis direction="end" :content="itm.Goods.name"></nut-ellipsis>
|
||||
<!-- <view class="title">{{ itm.Goods.name }}</view> -->
|
||||
</view>
|
||||
<view class="num">
|
||||
<view>x{{ itm.pay_price }}</view>
|
||||
<view>x{{ itm.number }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="desc">
|
||||
<view>订单时间: {{ item.add_time }}</view>
|
||||
<view>备注: {{ item.notes }}</view>
|
||||
</view>
|
||||
|
||||
<view class="line"></view>
|
||||
</view>
|
||||
</view>
|
||||
<nut-empty v-else description="暂无订单"></nut-empty>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import Taro from "@tarojs/taro";
|
||||
import { getUserAfterOrderList } from "../../../api/user";
|
||||
|
||||
const tabsIndex = ref(0);
|
||||
|
||||
const listData = ref([]);
|
||||
|
||||
const tabs = ref([
|
||||
{
|
||||
text: "全部",
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
text: "未付款",
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
text: "挂帐中",
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
text: "已收款",
|
||||
value: 2,
|
||||
},
|
||||
]);
|
||||
|
||||
Taro.useDidShow(() => {
|
||||
get_list();
|
||||
});
|
||||
|
||||
const changeTabs = (index: number) => {
|
||||
tabsIndex.value = index;
|
||||
get_list();
|
||||
};
|
||||
|
||||
const get_list = async () => {
|
||||
Taro.showLoading({
|
||||
title: "加载中",
|
||||
});
|
||||
const user_info = await Taro.getStorageSync("userInfo");
|
||||
const { data: res } = await getUserAfterOrderList({
|
||||
phone: user_info.data.phone,
|
||||
status: tabsIndex.value,
|
||||
});
|
||||
listData.value = res.data || [];
|
||||
Taro.hideLoading();
|
||||
};
|
||||
|
||||
const get_color = (status: number) => {
|
||||
switch (status) {
|
||||
case 0:
|
||||
return "#FD0100";
|
||||
case 1:
|
||||
return "#03A113";
|
||||
case 2:
|
||||
return "#FFA938";
|
||||
}
|
||||
};
|
||||
|
||||
const get_status_text = (status: number) => {
|
||||
switch (status) {
|
||||
case 0:
|
||||
return "未付款";
|
||||
case 1:
|
||||
return "已付款";
|
||||
case 2:
|
||||
return "挂帐中";
|
||||
}
|
||||
};
|
||||
|
||||
const to_page = (item) => {
|
||||
Taro.navigateTo({
|
||||
url: `/pages/users/pending_order/pending_order_detail/index?bid=${item.bid}&oid=${item.oid}`,
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import "./index.scss";
|
||||
</style>
|
||||
@@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: "订单详情",
|
||||
});
|
||||
@@ -0,0 +1,77 @@
|
||||
.card {
|
||||
width: 710px;
|
||||
background: #ffffff;
|
||||
border-radius: 12px;
|
||||
margin: 20px auto;
|
||||
box-sizing: border-box;
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 20px;
|
||||
|
||||
text {
|
||||
margin-right: 10px;
|
||||
color: #333333;
|
||||
font-size: 28px;
|
||||
}
|
||||
}
|
||||
|
||||
.line {
|
||||
width: inherit;
|
||||
height: 1px;
|
||||
background-color: #e9e9e9;
|
||||
}
|
||||
|
||||
.goods-list {
|
||||
display: flex;
|
||||
margin: 20px;
|
||||
|
||||
image {
|
||||
width: 195px;
|
||||
height: 195px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.center {
|
||||
margin-left: 20px;
|
||||
|
||||
.title {
|
||||
font-weight: bold;
|
||||
text-align: left;
|
||||
font-size: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
.num {
|
||||
flex: 1;
|
||||
text-align: right;
|
||||
color: #666666;
|
||||
font-size: 26px;
|
||||
}
|
||||
}
|
||||
|
||||
.desc {
|
||||
padding: 10px 20px;
|
||||
color: #666666;
|
||||
}
|
||||
}
|
||||
|
||||
.nut-cell-group {
|
||||
margin: 20px;
|
||||
font-size: 26px;
|
||||
|
||||
.nut-cell__title {
|
||||
color: #181818;
|
||||
}
|
||||
|
||||
.nut-cell__value {
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.nut-cell__title:nth-last-child(1) {
|
||||
color: #333333;
|
||||
font-size: 32px;
|
||||
}
|
||||
}
|
||||
113
src/pages/users/pending_order/pending_order_detail/index.vue
Normal file
113
src/pages/users/pending_order/pending_order_detail/index.vue
Normal file
@@ -0,0 +1,113 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="card">
|
||||
<view class="header">
|
||||
<view>
|
||||
<text>台号: {{ data.seat }}</text>
|
||||
<text>点单人: {{ data.PlaceUser?.nickName }}</text>
|
||||
</view>
|
||||
<view
|
||||
:style="{
|
||||
color: get_color(data.status),
|
||||
fontWeight: 'bold',
|
||||
}"
|
||||
>{{ get_status_text(data.status) }}</view
|
||||
>
|
||||
</view>
|
||||
<view class="line"></view>
|
||||
<view class="goods-list" v-for="(itm, idx) in data.OrderGoods" :key="idx">
|
||||
<image :src="itm.Goods.cover"></image>
|
||||
<view class="center">
|
||||
<nut-ellipsis
|
||||
direction="end"
|
||||
:content="itm.Goods.name"
|
||||
></nut-ellipsis>
|
||||
<!-- <view class="title">{{ itm.Goods.name }}</view> -->
|
||||
</view>
|
||||
<view class="num">
|
||||
<view>x{{ itm.pay_price }}</view>
|
||||
<view>x{{ itm.number }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="line"></view>
|
||||
</view>
|
||||
<nut-cell-group>
|
||||
<nut-cell>
|
||||
<template #title>
|
||||
<text>订单信息</text>
|
||||
</template>
|
||||
</nut-cell>
|
||||
<nut-cell title="台号" :desc="data.seat"></nut-cell>
|
||||
<nut-cell title="客人手机号" :desc="data.phone"></nut-cell>
|
||||
<nut-cell title="订单号" :desc="data.oid"></nut-cell>
|
||||
<nut-cell title="点单人" :desc="data.PlaceUser?.nickName"></nut-cell>
|
||||
<nut-cell title="下单时间" :desc="data.add_time"></nut-cell>
|
||||
<nut-cell title="收款时间" :desc="data.payment_time"></nut-cell>
|
||||
<nut-cell title="挂帐时间" :desc="data.payment_time"></nut-cell>
|
||||
<nut-cell
|
||||
title="订单状态"
|
||||
:desc="get_status_text(data.status)"
|
||||
></nut-cell>
|
||||
<nut-cell title="下单数量" :desc="String(data.count)"></nut-cell>
|
||||
<nut-cell title="订单金额" :desc="String(data.payments)"></nut-cell>
|
||||
<nut-cell title="应收金额" :desc="String(data.payments)"></nut-cell>
|
||||
<nut-cell title="实收金额" :desc="String(data.pay_amount)"></nut-cell>
|
||||
<nut-cell title="抹零" :desc="String(data.zero)"></nut-cell>
|
||||
<nut-cell title="收款方式" desc="微信"></nut-cell>
|
||||
<nut-cell title="备注" :desc="data.notes"></nut-cell>
|
||||
</nut-cell-group>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import Taro from "@tarojs/taro";
|
||||
import { getUserAfterOrderDetail } from "../../../../api/user";
|
||||
|
||||
const data = ref<any>({});
|
||||
|
||||
const params = ref<any>({});
|
||||
|
||||
Taro.useLoad((e: any) => {
|
||||
params.value = e;
|
||||
get_data();
|
||||
});
|
||||
|
||||
const get_data = async () => {
|
||||
Taro.showLoading({
|
||||
title: "加载中",
|
||||
});
|
||||
const res = await getUserAfterOrderDetail({
|
||||
bid: params.value.bid,
|
||||
oid: params.value.oid,
|
||||
});
|
||||
data.value = res.data.data;
|
||||
Taro.hideLoading();
|
||||
};
|
||||
|
||||
const get_color = (status: number) => {
|
||||
switch (status) {
|
||||
case 0:
|
||||
return "#FD0100";
|
||||
case 1:
|
||||
return "#03A113";
|
||||
case 2:
|
||||
return "#FFA938";
|
||||
}
|
||||
};
|
||||
|
||||
const get_status_text = (status: number) => {
|
||||
switch (status) {
|
||||
case 0:
|
||||
return "未付款";
|
||||
case 1:
|
||||
return "已付款";
|
||||
case 2:
|
||||
return "挂帐中";
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import "./index.scss";
|
||||
</style>
|
||||
Reference in New Issue
Block a user