fix(custom):
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-05-27 17:48:20 +08:00
parent 0816707bdd
commit e6173319d9
11 changed files with 243 additions and 100 deletions

1
components.d.ts vendored
View File

@@ -33,6 +33,7 @@ declare module '@vue/runtime-core' {
NutOverlay: typeof import('@nutui/nutui-taro')['Overlay'] NutOverlay: typeof import('@nutui/nutui-taro')['Overlay']
NutPagination: typeof import('@nutui/nutui-taro')['Pagination'] NutPagination: typeof import('@nutui/nutui-taro')['Pagination']
NutPicker: typeof import('@nutui/nutui-taro')['Picker'] NutPicker: typeof import('@nutui/nutui-taro')['Picker']
NutPopover: typeof import('@nutui/nutui-taro')['Popover']
NutPopup: typeof import('@nutui/nutui-taro')['Popup'] NutPopup: typeof import('@nutui/nutui-taro')['Popup']
NutPrice: typeof import('@nutui/nutui-taro')['Price'] NutPrice: typeof import('@nutui/nutui-taro')['Price']
NutRadio: typeof import('@nutui/nutui-taro')['Radio'] NutRadio: typeof import('@nutui/nutui-taro')['Radio']

View File

@@ -159,7 +159,7 @@ const create_order = async () => {
}; };
// isShowPay.value = true; // isShowPay.value = true;
Taro.navigateTo({ Taro.navigateTo({
url: `/pages/goods/pay/index?oid=${res.data.oid}&bid=${mer_info.bid}`, url: `/pages/goods/pay/index?oid=${res.data.oid}&bid=${mer_info.bid}&OrderType=1`,
}); });
} }
} }

View File

@@ -1,13 +1,23 @@
<template> <template>
<view> <view>
<view class="footer" v-if="info.status !== 1"> <view class="footer" v-if="info.status !== 1">
<view <nut-popover
v-model:visible="popoverShow"
:list="popoverList"
location="bottom-start"
@choose="popoverChoose">
<template #reference>
<view class="text-[#9C9C9C] text-[30px]">更多</view>
</template>
</nut-popover>
<view class="flex">
<!-- <view
v-if="info.status !== 2" v-if="info.status !== 2"
class="btn" class="btn"
style="border: 1px #7f7f7f solid; color: #666666" style="border: 1px #7f7f7f solid; color: #666666"
@click="visible = true" @click="visible = true"
>挂帐</view >挂帐</view
> > -->
<view <view
v-if="info.status !== 2" v-if="info.status !== 2"
class="btn" class="btn"
@@ -16,16 +26,24 @@
>继续点单</view >继续点单</view
> >
<view <view
v-if="info.status !== 2"
class="btn"
style="background-color: none; color: black; border: 1px solid #000"
@click="to_menu_page"
>取消订单</view
>
<!-- <view
v-if="info.status !== 2" v-if="info.status !== 2"
class="btn" class="btn"
style="background-color: #ffa938" style="background-color: #ffa938"
@click="visible1 = true" @click="visible1 = true"
>修改</view >修改</view
> > -->
<view class="btn" style="background-color: #fd0100" @click="to_pay_page" <view class="btn" style="background-color: #fd0100" @click="to_pay_page"
>收款码</view >收款码</view
> >
</view> </view>
</view>
<nut-dialog v-model:visible="visible" @ok="onOk"> <nut-dialog v-model:visible="visible" @ok="onOk">
<template #header>挂帐</template> <template #header>挂帐</template>
<template #default <template #default
@@ -57,9 +75,9 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref } from "vue"; import {onMounted, ref} from 'vue';
import { confirmAfterOrder, editAfterOrder } from "@/api/admin"; import {confirmAfterOrder, editAfterOrder} from '@/api/admin';
import Taro from "@tarojs/taro"; import Taro from '@tarojs/taro';
const props = defineProps({ const props = defineProps({
info: { info: {
@@ -69,17 +87,31 @@ const props = defineProps({
}); });
onMounted(() => { onMounted(() => {
console.log(props.info); // console.log(props.info);
}) popoverList.value = [
{
name: '修改',
value: 1,
disabled: props.info.status === 2,
},
{
name: '挂帐',
value: 2,
disabled: props.info.status === 2,
},
];
const emits = defineEmits(["ok"]); console.log(popoverList.value);
});
const emits = defineEmits(['ok']);
const visible = ref(false); const visible = ref(false);
const visible1 = ref(false); const visible1 = ref(false);
const formVal = ref({ const formVal = ref({
seat: "", seat: '',
notes: "", notes: '',
}); });
const onCancel = () => { const onCancel = () => {
@@ -94,9 +126,9 @@ const onOk = async () => {
}); });
Taro.showToast({ Taro.showToast({
title: res.msg, title: res.msg,
icon: "none", icon: 'none',
}); });
emits("ok"); emits('ok');
}; };
const onOk1 = async () => { const onOk1 = async () => {
@@ -111,15 +143,15 @@ const onOk1 = async () => {
Taro.showToast({ Taro.showToast({
title: res.msg, title: res.msg,
icon: "none", icon: 'none',
}); });
formVal.value = { formVal.value = {
seat: "", seat: '',
notes: "", notes: '',
}; };
emits("ok"); emits('ok');
}; };
const to_pay_page = () => { const to_pay_page = () => {
@@ -133,13 +165,28 @@ const to_menu_page = () => {
url: `/pages/admin/add_order/add_menu/index?type=1&bid=${props.info.bid}&oid=${props.info.oid}&seat=${props.info.seat}&phone=${props.info.phone}&notes=${props.info.notes}`, url: `/pages/admin/add_order/add_menu/index?type=1&bid=${props.info.bid}&oid=${props.info.oid}&seat=${props.info.seat}&phone=${props.info.phone}&notes=${props.info.notes}`,
}); });
}; };
const popoverShow = ref(false);
const popoverList = ref<any>([]);
const popoverChoose = e => {
console.log(e);
switch (e.value) {
case 1:
visible1.value = true;
break;
case 2:
visible.value = true;
break;
}
};
</script> </script>
<style lang="scss"> <style lang="scss">
.footer { .footer {
display: flex; display: flex;
justify-content: flex-end; justify-content: space-between;
padding: 20px; padding: 20px;
align-items: center;
.btn { .btn {
width: 143px; width: 143px;
height: 56px; height: 56px;

View File

@@ -7,7 +7,8 @@ page {
.tabs { .tabs {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin: 20px 30px; padding: 20px 30px;
background-color: #ffffff;
.item { .item {
display: flex; display: flex;
@@ -61,11 +62,13 @@ page {
min-width: 195px; min-width: 195px;
height: 195px; height: 195px;
border-radius: 12px; border-radius: 12px;
margin-right: 20px;
} }
.center { .center {
margin-left: 20px; display: flex;
flex-direction: column;
justify-content: space-between;
.title { .title {
font-weight: bold; font-weight: bold;
text-align: left; text-align: left;

View File

@@ -5,25 +5,24 @@
class="item" class="item"
v-for="item in tabs" v-for="item in tabs"
:key="item.value" :key="item.value"
@click="changeTabs(item.value)" @click="changeTabs(item.value)">
>
<text>{{ item.text }}</text> <text>{{ item.text }}</text>
<view <view
class="line" class="line"
:class="tabsIndex == item.value ? 'active' : ''" :class="tabsIndex == item.value ? 'active' : ''"></view>
></view>
</view> </view>
</view> </view>
<view v-if="listData.length > 0"> <view v-if="listData.length > 0">
<view <view
class="card" class="card"
v-for="(item, index) in (listData as any[])" v-for="(item, index) in (listData as any[])"
:key="index" :key="index">
>
<view class="header"> <view class="header">
<view> <view>
<text>台号: {{ item.seat }}</text> <text class="text-[#9C9C9C] text-[28px]"
<text>点单人: {{ item.PlaceUser?.nickName }}</text> >台号: {{ item.seat }}</text
>
<!-- <text>点单人: {{ item.PlaceUser?.nickName }}</text> -->
</view> </view>
<view <view
:style="{ :style="{
@@ -38,8 +37,7 @@
<view <view
class="goods-list" class="goods-list"
v-for="(itm, idx) in item.OrderGoods" v-for="(itm, idx) in item.OrderGoods"
:key="idx" :key="idx">
>
<image :src="itm.Goods.cover"></image> <image :src="itm.Goods.cover"></image>
<view class="center"> <view class="center">
<nut-ellipsis <nut-ellipsis
@@ -47,22 +45,19 @@
:content="itm.Goods.name" :content="itm.Goods.name"
rows="3" rows="3"
expand-text="展开" expand-text="展开"
collapse-text="收起" collapse-text="收起"></nut-ellipsis>
></nut-ellipsis> <view class="text-[#9C9C9C]">
<!-- <view class="title">{{ itm.Goods.name }}</view> --> <view>订单时间: {{ item.add_time.slice(0, 10) }}</view>
<view>备注: {{ item.notes }}</view>
</view>
</view> </view>
<view class="num"> <view class="num">
<view>x{{ itm.pay_price }}</view> <view>{{ itm.pay_price }}</view>
<view>x{{ itm.number }}</view> <view>x{{ itm.number }}</view>
</view> </view>
</view> </view>
</view> </view>
<view class="desc"> <!-- <view class="line"></view> -->
<view>订单时间: {{ item.add_time }}</view>
<view>备注: {{ item.notes }}</view>
</view>
<view class="line"></view>
<Footer :info="item" @ok="get_list" /> <Footer :info="item" @ok="get_list" />
</view> </view>
</view> </view>
@@ -71,32 +66,32 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import {ref} from 'vue';
import Taro from "@tarojs/taro"; import Taro from '@tarojs/taro';
import Footer from "./components/Footer.vue"; import Footer from './components/Footer.vue';
import { getAfterOrderList } from "@/api/admin"; import {getAfterOrderList} from '@/api/admin';
const tabsIndex = ref(1); const tabsIndex = ref(0);
const listData = ref([]); const listData = ref([]);
const tabs = ref([ const tabs = ref([
{ {
text: "未收款", text: '全部',
value: 0,
},
{
text: '未收款',
value: 1, value: 1,
}, },
{ {
text: "挂帐中", text: '挂帐中',
value: 3, value: 3,
}, },
{ {
text: "已收款", text: '已收款',
value: 2, value: 2,
}, },
{
text: "全部",
value: 0,
},
]); ]);
Taro.useDidShow(() => { Taro.useDidShow(() => {
@@ -110,10 +105,10 @@ const changeTabs = (index: number) => {
const get_list = async () => { const get_list = async () => {
Taro.showLoading({ Taro.showLoading({
title: "加载中", title: '加载中',
}); });
const user_info = await Taro.getStorageSync("userInfo"); const user_info = await Taro.getStorageSync('userInfo');
const { data: res } = await getAfterOrderList({ const {data: res} = await getAfterOrderList({
bid: user_info.data.bid, bid: user_info.data.bid,
status: tabsIndex.value, status: tabsIndex.value,
}); });
@@ -124,26 +119,26 @@ const get_list = async () => {
const get_color = (status: number) => { const get_color = (status: number) => {
switch (status) { switch (status) {
case 0: case 0:
return "#FD0100"; return '#FD0100';
case 1: case 1:
return "#03A113"; return '#03A113';
case 2: case 2:
return "#FFA938"; return '#FFA938';
} }
}; };
const get_status_text = (status: number) => { const get_status_text = (status: number) => {
switch (status) { switch (status) {
case 0: case 0:
return "未付款"; return '未付款';
case 1: case 1:
return "已付款"; return '已付款';
case 2: case 2:
return "挂帐中"; return '挂帐中';
} }
}; };
const to_page = (item) => { const to_page = item => {
Taro.navigateTo({ Taro.navigateTo({
url: `/pages/admin/add_order/pending_order/pending_order_detail/index?bid=${item.bid}&oid=${item.oid}`, url: `/pages/admin/add_order/pending_order/pending_order_detail/index?bid=${item.bid}&oid=${item.oid}`,
}); });
@@ -151,5 +146,5 @@ const to_page = (item) => {
</script> </script>
<style lang="scss"> <style lang="scss">
@import "./index.scss"; @import './index.scss';
</style> </style>

View File

@@ -33,11 +33,13 @@
height: 195px; height: 195px;
border-radius: 12px; border-radius: 12px;
min-width: 195px; min-width: 195px;
margin-right: 20px;
} }
.center { .center {
margin-left: 20px; display: flex;
flex-direction: column;
justify-content: space-between;
.title { .title {
font-weight: bold; font-weight: bold;
text-align: left; text-align: left;
@@ -54,7 +56,7 @@
} }
.desc { .desc {
padding: 10px 20px; // padding: 10px 0px;
color: #666666; color: #666666;
} }
} }

View File

@@ -4,8 +4,8 @@
<view class="card" style="margin-top: 15px"> <view class="card" style="margin-top: 15px">
<view class="header"> <view class="header">
<view> <view>
<text>台号: {{ data.seat }}</text> <text class="text-[#9C9C9C]">台号: {{ data.seat }}</text>
<text>点单人: {{ data.PlaceUser?.nickName }}</text> <!-- <text>点单人: {{ data.PlaceUser?.nickName }}</text> -->
</view> </view>
<view <view
:style="{ :style="{
@@ -29,11 +29,11 @@
<!-- <view class="title">{{ itm.Goods.name }}</view> --> <!-- <view class="title">{{ itm.Goods.name }}</view> -->
</view> </view>
<view class="num"> <view class="num">
<view>x{{ itm.pay_price }}</view> <view>{{ itm.pay_price }}</view>
<view>x{{ itm.number }}</view> <view>x{{ itm.number }}</view>
</view> </view>
</view> </view>
<view class="line"></view> <!-- <view class="line"></view> -->
<Footer :info="data" @ok="get_data" /> <Footer :info="data" @ok="get_data" />
</view> </view>
<nut-cell-group> <nut-cell-group>

View File

@@ -207,7 +207,7 @@ const sub = async () => {
// isShowPay.value = true; // isShowPay.value = true;
// console.log(arr) // console.log(arr)
Taro.navigateTo({ Taro.navigateTo({
url: `/pages/goods/pay/index?oid=${res.oid}&bid=${arr[0].StoreBid}`, url: `/pages/goods/pay/index?oid=${res.oid}&bid=${arr[0].StoreBid}&OrderType=1`,
}); });
} }
} catch (e) { } catch (e) {

View File

@@ -4,13 +4,9 @@
>交易剩余时间{{ tStr }} >交易剩余时间{{ tStr }}
</view> </view>
<view class="flex items-center mt-5 mb-5"> <view class="flex items-center mt-5 mb-5">
<nut-price :price="orderData.price" size="large" /> <nut-price :price="a" size="large" />
<view class="line"></view> <view class="line"></view>
<nut-price <nut-price position="after" symbol="积分" :price="b" size="large" />
position="after"
symbol="积分"
:price="orderData.exchange"
size="large" />
</view> </view>
<nut-radio-group class="w-[95%]" v-model="payVal"> <nut-radio-group class="w-[95%]" v-model="payVal">
<nut-cell-group class="w-full"> <nut-cell-group class="w-full">
@@ -132,12 +128,15 @@ const visible2 = ref(false);
const opt = ref<any>({}); const opt = ref<any>({});
Taro.useLoad(e => { Taro.useLoad(e => {
const {oid, bid} = e; const {oid, bid, OrderType} = e;
opt.value = e; opt.value = e;
getData(oid, bid); getData(oid, bid, OrderType);
}); });
const getData = async (oid: string, bid: string) => { const a = ref(0);
const b = ref(0);
const getData = async (oid: string, bid: string, OrderType: number) => {
const user_info = Taro.getStorageSync('userInfo'); const user_info = Taro.getStorageSync('userInfo');
const data = await getUserPoint({ const data = await getUserPoint({
phone: user_info.data.phone, phone: user_info.data.phone,
@@ -145,12 +144,26 @@ const getData = async (oid: string, bid: string) => {
}); });
const res = await getActiveOrderDetail({ const res = await getActiveOrderDetail({
oid, oid,
OrderType: Number(OrderType),
}); });
// let a = 0;
// let b = 0;
orderData.value = { orderData.value = {
...res.data.data, ...res.data.data[0],
...data.data, ...data.data,
}; };
a.value = 0;
b.value = 0;
res.data.data.forEach(item => {
a.value += item.price;
b.value += item.exchange;
});
console.log(orderData.value);
if (!orderData.value.oid) if (!orderData.value.oid)
return Taro.showToast({ return Taro.showToast({
title: '未获取到订单信息~', title: '未获取到订单信息~',
@@ -201,8 +214,9 @@ const shortComplete = async value => {
const confirmPay = async () => { const confirmPay = async () => {
try { try {
const res = await payOrder({ const res = await payOrder({
// oid: opt.value.oid.map(item => item.oid),
oid: opt.value.oid, oid: opt.value.oid,
OrderType: orderData.value.pay_type, OrderType: payVal.value,
PayType: payVal.value, PayType: payVal.value,
}); });
switch (payVal.value) { switch (payVal.value) {
@@ -227,8 +241,11 @@ const confirmPay = async () => {
}); });
}, },
complete: function () { complete: function () {
// Taro.redirectTo({
// url: `/pages/users/order_list_detail/index?orderId=${opt.value.oid}&OrderType=1`,
// });
Taro.redirectTo({ Taro.redirectTo({
url: `/pages/users/order_list_detail/index?orderId=${opt.value.oid}`, url: `/pages/users/order_list/index?type=0`,
}); });
}, },
}); });
@@ -245,8 +262,11 @@ const confirmPay = async () => {
icon: 'none', icon: 'none',
}); });
setTimeout(() => { setTimeout(() => {
// Taro.redirectTo({
// url: `/pages/users/order_list_detail/index?orderId=${opt.value.oid}&OrderType=1`,
// });
Taro.redirectTo({ Taro.redirectTo({
url: `/pages/users/order_list_detail/index?orderId=${opt.value.oid}`, url: `/pages/users/order_list/index?type=0`,
}); });
}, 2000); }, 2000);
break; break;

View File

@@ -9,6 +9,8 @@ import {getUserPoint} from '@/api/admin';
const tabValue = ref(0); const tabValue = ref(0);
const isShowPay = ref(false); const isShowPay = ref(false);
const isShowCode = ref(false);
const url = ref('');
const tabsList = ref([ const tabsList = ref([
{ {
@@ -150,7 +152,7 @@ const successPay = () => {
const toDetail = (item: any) => { const toDetail = (item: any) => {
Taro.navigateTo({ Taro.navigateTo({
url: `/pages/users/order_list_detail/index?orderId=${item.joint_oid}`, url: `/pages/users/order_list_detail/index?orderId=${item.oid}&OrderType=2`,
}); });
}; };
@@ -194,6 +196,41 @@ const getTj = async () => {
}); });
} }
}; };
const t_id = ref();
const openCode = item => {
if (item.status === 2) return;
url.value = `https://api.pwmqr.com/qrcode/create?url=${item.oid}`;
isShowCode.value = true;
t_id.value = setInterval(() => {
checkStatus(item);
}, 1000);
};
const checkStatus = async itm => {
await getList();
orderList.value.forEach(item => {
if (item.oid === itm.oid) {
console.log(item);
if (item.status === 2) {
clearInterval(t_id.value);
isShowCode.value = false;
url.value = '';
Taro.showToast({
title: '核销成功',
icon: 'none',
});
}
}
});
};
const closed = () => {
isShowCode.value = false;
url.value = '';
clearInterval(t_id.value);
};
</script> </script>
<template> <template>
@@ -311,10 +348,32 @@ const getTj = async () => {
@click.stop="openPay(item)" @click.stop="openPay(item)"
>立即付款 >立即付款
</nut-button> </nut-button>
<nut-button
style="margin-left: 5px"
size="mini"
type="primary"
v-if="item.status === 1"
@click.stop="openCode(item)"
>出示核销码
</nut-button>
</view> </view>
</view> </view>
</view> </view>
<nut-empty v-else description="暂无订单"></nut-empty> <nut-empty v-else description="暂无订单"></nut-empty>
<!-- 核销码弹窗 -->
<nut-popup
v-model:visible="isShowCode"
position="center"
style="padding: 20px; border-radius: 15px"
:maskClosable="true"
safe-area-inset-bottom
@click-overlay="closed"
@closed="closed">
<view class="code-box">
<view>核销码</view>
<image class="qrcode" :src="url"></image>
</view>
</nut-popup>
<pay <pay
:isShowPay="isShowPay" :isShowPay="isShowPay"
:interval="false" :interval="false"
@@ -433,4 +492,16 @@ page {
} }
} }
} }
.code-box {
padding: 20px;
box-sizing: border-box;
text-align: center;
font-size: large;
}
.qrcode {
width: 300px;
height: 300px;
}
</style> </style>

View File

@@ -248,9 +248,12 @@ const url = ref('');
const oid = ref(''); const oid = ref('');
const tId = ref();
Taro.useLoad(options => { Taro.useLoad(options => {
type.value = options.type; type.value = options.type;
oid.value = options.orderId; oid.value = options.orderId;
tId.value = Number(options.OrderType);
Taro.getLocation({ Taro.getLocation({
type: 'wgs84', type: 'wgs84',
success: res => { success: res => {
@@ -265,8 +268,9 @@ Taro.useLoad(options => {
const getOrderDetail = async () => { const getOrderDetail = async () => {
const res = await getActiveOrderDetail({ const res = await getActiveOrderDetail({
oid: oid.value, oid: oid.value,
OrderType: tId.value,
}); });
goodInfo.value = res.data.data; goodInfo.value = res.data.data[0];
if (goodInfo.value.status === 1) { if (goodInfo.value.status === 1) {
startTime(); startTime();
} }