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']
NutPagination: typeof import('@nutui/nutui-taro')['Pagination']
NutPicker: typeof import('@nutui/nutui-taro')['Picker']
NutPopover: typeof import('@nutui/nutui-taro')['Popover']
NutPopup: typeof import('@nutui/nutui-taro')['Popup']
NutPrice: typeof import('@nutui/nutui-taro')['Price']
NutRadio: typeof import('@nutui/nutui-taro')['Radio']

View File

@@ -159,7 +159,7 @@ const create_order = async () => {
};
// isShowPay.value = true;
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,30 +1,48 @@
<template>
<view>
<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"
class="btn"
style="border: 1px #7f7f7f solid; color: #666666"
@click="visible = true"
>挂帐</view
>
<view
v-if="info.status !== 2"
class="btn"
style="background-color: #009ee0"
@click="to_menu_page"
>继续点单</view
>
<view
> -->
<view
v-if="info.status !== 2"
class="btn"
style="background-color: #009ee0"
@click="to_menu_page"
>继续点单</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"
class="btn"
style="background-color: #ffa938"
@click="visible1 = true"
>修改</view
>
<view class="btn" style="background-color: #fd0100" @click="to_pay_page"
>收款码</view
>
> -->
<view class="btn" style="background-color: #fd0100" @click="to_pay_page"
>收款码</view
>
</view>
</view>
<nut-dialog v-model:visible="visible" @ok="onOk">
<template #header>挂帐</template>
@@ -57,9 +75,9 @@
</template>
<script setup lang="ts">
import { onMounted, ref } from "vue";
import { confirmAfterOrder, editAfterOrder } from "@/api/admin";
import Taro from "@tarojs/taro";
import {onMounted, ref} from 'vue';
import {confirmAfterOrder, editAfterOrder} from '@/api/admin';
import Taro from '@tarojs/taro';
const props = defineProps({
info: {
@@ -69,17 +87,31 @@ const props = defineProps({
});
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 visible1 = ref(false);
const formVal = ref({
seat: "",
notes: "",
seat: '',
notes: '',
});
const onCancel = () => {
@@ -94,9 +126,9 @@ const onOk = async () => {
});
Taro.showToast({
title: res.msg,
icon: "none",
icon: 'none',
});
emits("ok");
emits('ok');
};
const onOk1 = async () => {
@@ -111,15 +143,15 @@ const onOk1 = async () => {
Taro.showToast({
title: res.msg,
icon: "none",
icon: 'none',
});
formVal.value = {
seat: "",
notes: "",
seat: '',
notes: '',
};
emits("ok");
emits('ok');
};
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}`,
});
};
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>
<style lang="scss">
.footer {
display: flex;
justify-content: flex-end;
justify-content: space-between;
padding: 20px;
align-items: center;
.btn {
width: 143px;
height: 56px;

View File

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

View File

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

View File

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

View File

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

View File

@@ -207,7 +207,7 @@ const sub = async () => {
// isShowPay.value = true;
// console.log(arr)
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) {

View File

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

View File

@@ -9,6 +9,8 @@ import {getUserPoint} from '@/api/admin';
const tabValue = ref(0);
const isShowPay = ref(false);
const isShowCode = ref(false);
const url = ref('');
const tabsList = ref([
{
@@ -150,7 +152,7 @@ const successPay = () => {
const toDetail = (item: any) => {
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>
<template>
@@ -311,10 +348,32 @@ const getTj = async () => {
@click.stop="openPay(item)"
>立即付款
</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>
<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
:isShowPay="isShowPay"
: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>

View File

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