This commit is contained in:
dzc committed 2025-05-29 10:17:44 +08:00
commit b02f0d0a8d
12 files changed
+334 -21120

No files matched your search

-20954
View File
File diff suppressed because it is too large. Load diff
+14 -7
View File
@@ -340,6 +340,13 @@
"pages": [
{
"path": "buy",
"style": {
"navigationBarTitleText": "购买",
"disableScroll": true
}
},
{
"path": "openDoor",
"style": {
"navigationBarTitleText": "选择支付方式",
"disableScroll": true
@@ -524,13 +531,13 @@
"iconPath": "",
"selectedIconPath": ""
}
// ,
// {
// "pagePath": "pages/integrated/index",
// "text": "综合服务",
// "iconPath": "static/tabbar/integrated.png",
// "selectedIconPath": "static/tabbar/integrated-select.png"
// }
// ,
// {
// "pagePath": "pages/integrated/index",
// "text": "综合服务",
// "iconPath": "static/tabbar/integrated.png",
// "selectedIconPath": "static/tabbar/integrated-select.png"
// }
]
}
}
+1 -1
View File
@@ -69,7 +69,7 @@ const doSubmit = () => {
</view>
<template #main-bottom>
<view class="bg-#0094ff p-y-20rpx text-center rounded-40rpx m-x-60rpx m-y-30rpx sub-text-30 color-white!" @tap="doSubmit">
预定
预订
</view>
</template>
</crud-layout>
+111 -139
View File
@@ -1,93 +1,47 @@
<template>
<crud-layout bg="/static/page/blue-bg.png">
<view class="bg-white rounded-20rpx my-20rpx font-bold">
<z-tabs
:list="[
{ name: '浙政钉支付', value: 1 },
{ name: '支付宝支付', value: 2, disabled: true },
]"
bar-width="150"
:active-style="{
fontSize: '30rpx',
}"
:inactive-style="{
fontSize: '30rpx',
}"
@change="payMethodTabChange"
/>
<crud-layout mainIsScroll bg="/static/page/blue-bg.png">
<view class="w-full flex flex-wrap p-2">
<view class="w-1/3 h-340rpx text-center p-1" v-for="(item, index) in state.cabinetList" :key="index">
<view class="bg-transparent rounded-lg overflow-hidden">
<image
class="w-180rpx h-180rpx rounded-md object-cover"
:src="item.spuDetail.pic"
@click.stop="hooks.usePreviewImage(item.spuDetail.pic)"
/>
<view class="text-sm">{{ item.spuDetail.name }}</view>
<view class="text-red-500 text-sm">¥{{ displayPrice(item.spuDetail.price) }}</view>
</view>
</view>
</view>
<tm-sheet v-if="!state.isUseDoor && state.isUseDoorTip" borderWidth="2" :margin="[0, 20]" padding="10" color="#0094FF22">
<view class="flex items-center justify-between pl-4">
<tm-text font-size="30 " color="#0779FD">{{ state.isUseDoorTip }}</tm-text>
<tm-button size="s" @click="goRecharge">去充值</tm-button>
<view class="open-door-btn-wrapper fixed bottom-40 left-0 right-0 flex justify-center items-center">
<view class="ripple-container">
<view class="ripple"></view>
<view class="ripple"></view>
<view class="ripple"></view>
</view>
</tm-sheet>
<tm-sheet margin="0">
<tm-text font-size="30">购买须知:</tm-text>
<view class="flex items-center p-10rpx">
<image class="w-50rpx h-50rpx mr-3" src="@/static/page/印章.svg" />
<view>
<view class="second-text-26">第一步</view>
<tm-text font-size="28">购买需消费钱包余额大于100元</tm-text>
</view>
<view
class="open-door-btn w-200rpx h-200rpx rounded-full bg-#0779FD77 overflow-hidden flex flex-col justify-center items-center shadow-lg"
@click="goOpenDoor"
>
<image class="w-80rpx h-80rpx" src="@/static/page/开门.svg" />
<text class="font-bold">开 门</text>
</view>
<view class="flex items-center p-10rpx">
<image class="w-50rpx h-50rpx mr-3" src="@/static/page/开门.svg" />
<view>
<view class="second-text-26">第二步</view>
<tm-text font-size="28">开门之后选取商品并关门</tm-text>
</view>
</view>
<view class="flex items-center p-10rpx">
<image class="w-50rpx h-50rpx mr-3" src="@/static/page/支付.svg" />
<view>
<view class="second-text-26">第三步</view>
<tm-text font-size="28">关门后自动结算</tm-text>
</view>
</view>
</tm-sheet>
<template #main-bottom>
<view class="m-30rpx">
<tm-button block @click="openDoor" :disabled="!state.isUseDoor">开 门</tm-button>
</view>
</template>
<tm-modal
v-model:show="state.show"
:overlayClick="false"
title="你是否同意授权"
position="bottom"
:showCancel="true"
height="800rpx"
cancelText="拒绝"
confirmText="同意"
@confirm="appAuthHardDoor(1)"
@cancel="appAuthHardDoor(0)"
>
<tm-text color="#999999">{{ state.authDesc }}</tm-text>
</tm-modal>
</view>
</crud-layout>
</template>
<script setup lang="ts">
import { reactive } from "vue"
import { onLoad, onShow } from "@dcloudio/uni-app"
import zTabs from "@@/components/other/z-tabs/z-tabs.vue"
import { router } from "@/sheep"
import walletApi from "@/sheep/api/wallet"
import hardApi from "@/sheep/api/hard"
import { doorApi } from "@/sheep/api"
import { hooks } from "@/sheep"
import { displayPrice } from "@/sheep/utils/formatMoney"
const state = reactive({
isUseDoor: false,
isUseDoorTip: "",
show: false,
const state = reactive<any>({
hardDoorId: "",
cabinetNo: "",
authDesc: "",
authId: "",
cabinetList: [],
})
onLoad((options: any) => {
@@ -99,72 +53,90 @@ onLoad((options: any) => {
})
onShow(async () => {
// 检查钱包余额
try {
uni.showLoading({ title: "加载中", mask: true })
const res = await walletApi.isUseDoor()
if (res.code == 0) {
if (res.data) {
state.isUseDoor = false
state.isUseDoorTip = res.data
} else {
state.isUseDoor = true
}
return
}
state.isUseDoor = false
} catch (error: any) {
uni.showToast({ title: error, icon: "none" })
state.isUseDoor = false
} finally {
let detail = { hardId: "" }
// 获取柜门详情
uni.showLoading({ title: "加载中...", mask: true })
const doorDetailRes = await doorApi.hardDoorDetail({ hardDoorId: state.hardDoorId })
if (doorDetailRes.code == 0) {
detail = doorDetailRes.data
uni.hideLoading()
} else {
return uni.hideLoading()
}
let cabinetList = []
// 获取柜子商品列表
uni.showLoading({ title: "加载中", mask: true })
const cabinetListRes = await doorApi.cabinetList({ hardId: detail.hardId, cabinetNo: state.cabinetNo })
if (cabinetListRes.code == 0) {
cabinetList = cabinetListRes.data
uni.hideLoading()
} else {
return uni.hideLoading()
}
const arr: any = []
cabinetList.map((item: any, index: number) => {
item[index + 1].map((v: any) => {
if (v.spuDetail) arr.push(v)
})
})
state.cabinetList = arr
})
// 去充值
const goRecharge = () => {
router.jump("/pages/wallet/list", {}, 1)
}
// 开门
const openDoor = async () => {
if (!state.isUseDoor) return
// 获取协议内容
try {
uni.showLoading({ title: "加载中", mask: true })
const res = await hardApi.appGetAuthHardDoor({ doorHardId: state.hardDoorId, cabinetNo: state.cabinetNo })
if (res.code == 0) {
state.show = true
state.authDesc = res.data.authDesc
state.authId = res.data.authId
}
} catch (error: any) {
uni.showToast({ title: error, icon: "none" })
} finally {
uni.hideLoading()
}
}
// 支付方式tab改变
const payMethodTabChange = (e: number) => {}
// 确认或拒绝协议
const appAuthHardDoor = async (type: 1 | 0) => {
try {
uni.showLoading({ title: type ? "授权中" : "加载中", mask: true })
const res = await hardApi.appAuthHardDoor({
authId: state.authId,
authStatus: type ? 1 : 0,
})
if (res.code == 0) {
if (type) uni.showToast({ title: "授权成功", icon: "none" })
state.show = false
}
} catch (error: any) {
uni.showToast({ title: error, icon: "none" })
} finally {
uni.hideLoading()
}
// 去开门
const goOpenDoor = () => {
router.jump("/pages/cabinet/openDoor", { hardDoorId: state.hardDoorId, cabinetNo: state.cabinetNo })
}
</script>
<style lang="scss" scoped>
.open-door-btn-wrapper {
.open-door-btn {
position: relative;
z-index: 2;
transition: transform 0.2s;
&:active {
transform: scale(0.95);
}
}
.ripple-container {
position: absolute;
width: 200rpx;
height: 200rpx;
z-index: 1;
}
.ripple {
position: absolute;
width: 200rpx;
height: 200rpx;
border-radius: 50%;
border: 2px solid rgba(7, 121, 253);
animation: ripple 1s linear infinite;
opacity: 0;
&:nth-child(2) {
animation-delay: 0.6s;
}
&:nth-child(3) {
animation-delay: 1.2s;
}
}
}
@keyframes ripple {
0% {
transform: scale(1);
opacity: 0.5;
}
100% {
transform: scale(1.5);
opacity: 0;
}
}
</style>
+170
View File
@@ -0,0 +1,170 @@
<template>
<crud-layout bg="/static/page/blue-bg.png">
<view class="bg-white rounded-20rpx my-20rpx font-bold">
<z-tabs
:list="[
{ name: '浙政钉支付', value: 1 },
{ name: '支付宝支付', value: 2, disabled: true },
]"
bar-width="150"
:active-style="{
fontSize: '30rpx',
}"
:inactive-style="{
fontSize: '30rpx',
}"
@change="payMethodTabChange"
/>
</view>
<tm-sheet v-if="!state.isUseDoor && state.isUseDoorTip" borderWidth="2" :margin="[0, 20]" padding="10" color="#0094FF22">
<view class="flex items-center justify-between pl-4">
<tm-text font-size="30 " color="#0779FD">{{ state.isUseDoorTip }}</tm-text>
<tm-button size="s" @click="goRecharge">去充值</tm-button>
</view>
</tm-sheet>
<tm-sheet margin="0">
<tm-text font-size="30">购买须知:</tm-text>
<view class="flex items-center p-10rpx">
<image class="w-50rpx h-50rpx mr-3" src="@/static/page/印章.svg" />
<view>
<view class="second-text-26">第一步</view>
<tm-text font-size="28">购买需消费钱包余额大于100元</tm-text>
</view>
</view>
<view class="flex items-center p-10rpx">
<image class="w-50rpx h-50rpx mr-3" src="@/static/page/开门.svg" />
<view>
<view class="second-text-26">第二步</view>
<tm-text font-size="28">开门之后选取商品并关门</tm-text>
</view>
</view>
<view class="flex items-center p-10rpx">
<image class="w-50rpx h-50rpx mr-3" src="@/static/page/支付.svg" />
<view>
<view class="second-text-26">第三步</view>
<tm-text font-size="28">关门后自动结算</tm-text>
</view>
</view>
</tm-sheet>
<template #main-bottom>
<view class="m-30rpx">
<tm-button block @click="openDoor" :disabled="!state.isUseDoor">开 门</tm-button>
</view>
</template>
<tm-modal
v-model:show="state.show"
:overlayClick="false"
title="你是否同意授权"
position="bottom"
:showCancel="true"
height="800rpx"
cancelText="拒绝"
confirmText="同意"
@confirm="appAuthHardDoor(1)"
@cancel="appAuthHardDoor(0)"
>
<tm-text color="#999999">{{ state.authDesc }}</tm-text>
</tm-modal>
</crud-layout>
</template>
<script setup lang="ts">
import { reactive } from "vue"
import { onLoad, onShow } from "@dcloudio/uni-app"
import zTabs from "@@/components/other/z-tabs/z-tabs.vue"
import { router } from "@/sheep"
import walletApi from "@/sheep/api/wallet"
import hardApi from "@/sheep/api/hard"
const state = reactive({
isUseDoor: false,
isUseDoorTip: "",
show: false,
hardDoorId: "",
cabinetNo: "",
authDesc: "",
authId: "",
})
onLoad((options: any) => {
if (!options) return
const { hardDoorId, cabinetNo } = options
if (!hardDoorId || !cabinetNo) return
state.hardDoorId = hardDoorId
state.cabinetNo = cabinetNo
})
onShow(async () => {
// 检查钱包余额
try {
uni.showLoading({ title: "加载中", mask: true })
const res = await walletApi.isUseDoor()
if (res.code == 0) {
if (res.data) {
state.isUseDoor = false
state.isUseDoorTip = res.data
} else {
state.isUseDoor = true
}
return
}
state.isUseDoor = false
} catch (error: any) {
uni.showToast({ title: error, icon: "none" })
state.isUseDoor = false
} finally {
uni.hideLoading()
}
})
// 去充值
const goRecharge = () => {
router.jump("/pages/wallet/list", {}, 1)
}
// 开门
const openDoor = async () => {
if (!state.isUseDoor) return
// 获取协议内容
try {
uni.showLoading({ title: "加载中", mask: true })
const res = await hardApi.appGetAuthHardDoor({ doorHardId: state.hardDoorId, cabinetNo: state.cabinetNo })
if (res.code == 0) {
state.show = true
state.authDesc = res.data.authDesc
state.authId = res.data.authId
}
} catch (error: any) {
uni.showToast({ title: error, icon: "none" })
} finally {
uni.hideLoading()
}
}
// 支付方式tab改变
const payMethodTabChange = (e: number) => {}
// 确认或拒绝协议
const appAuthHardDoor = async (type: 1 | 0) => {
try {
uni.showLoading({ title: type ? "授权中" : "加载中", mask: true })
const res = await hardApi.appAuthHardDoor({
authId: state.authId,
authStatus: type ? 1 : 0,
})
if (res.code == 0) {
if (type) uni.showToast({ title: "授权成功", icon: "none" })
state.show = false
}
} catch (error: any) {
uni.showToast({ title: error, icon: "none" })
} finally {
uni.hideLoading()
}
}
</script>
+14 -5
View File
@@ -292,7 +292,7 @@ const doFood = () => {
<view class="flex-row-center w-50rpx h-50rpx bg-#167aff rounded-full">
<text class="font-size-28rpx! color-white iconfont icon-yuding" />
</view>
<text class="m-l-20rpx sub-text-28">包厢预定</text>
<text class="m-l-20rpx sub-text-28">包厢预订</text>
</view>
<view class="w-1px h-30rpx bg-#c4c4c4" />
<view class="flex-row-center" @tap="doFood">
@@ -371,7 +371,7 @@ const doFood = () => {
v-model:show="state.showBookingDialog"
:overlayClick="false"
:showCancel="true"
title="请选择预订时间段"
title="请选择预订餐段"
cancelText="取消"
confirmText="确认"
position="bottom"
@@ -379,11 +379,20 @@ const doFood = () => {
zIndex="800"
>
<tm-radio-group v-model="state.selectedBookingTime" direction="column">
<view v-for="(item, index) in state.bookingTimeList" :key="index" class="w-full flex items-center p-2 mx-2">
<view v-for="(item, index) in state.bookingTimeList" :key="index" class="w-full flex items-center">
<tm-radio class="w-full h-full px-2" :value="item.id">
<template v-slot:label="checked">
<view>{{ item.title }}</view>
<view>{{ item.startTime }} ~ {{ item.endTime }}</view>
<view class="text-30">{{ item.title }}</view>
<view class="second-text-28 flex">
<text class="w-1/2">可预订时间段:</text>
<text class="w-1/2">{{ item.startTime.slice(0, -3) }}-{{ item.endTime.slice(0, -3) }}</text>
</view>
<view class="second-text-28 flex">
<text class="w-1/2">用餐时间段:</text>
<text class="w-1/2">
{{ state.canteenDetail.jobTime?.split(",")[index + 1] ? state.canteenDetail.jobTime?.split(",")[index + 1] : "" }}
</text>
</view>
</template>
</tm-radio>
</view>
+8 -3
View File
@@ -40,14 +40,19 @@
import { ref } from "vue"
import { hooks, router } from "@/sheep"
import { doorApi } from "@/sheep/api"
import { onLoad } from "@dcloudio/uni-app"
import { onLoad, onShow } from "@dcloudio/uni-app"
const pageRef = ref<any>(null)
onLoad(() => {
const app = getApp()
app._initTabbar()
})
const pageRef = ref<any>(null)
onShow(() => {
if (pageRef.value) {
pageRef.value.reload(false)
}
})
const pageHook = hooks.usePage(pageRef, doorApi.hardDoorPage, null, "data.records")
+1 -1
View File
@@ -37,7 +37,7 @@ onLoad(async () => {
}
})
onShow(() => {
// pageRef.value && pageRef.value.reload(false)
pageRef.value && pageRef.value.reload(false)
})
const doTab = (e: any) => {
+8 -3
View File
@@ -47,14 +47,19 @@
import { ref } from "vue"
import { hooks, router } from "@/sheep"
import { doorApi } from "@/sheep/api"
import { onLoad } from "@dcloudio/uni-app"
import { onLoad, onShow } from "@dcloudio/uni-app"
const pageRef = ref<any>(null)
onLoad(() => {
const app = getApp()
app._initTabbar()
})
const pageRef = ref<any>(null)
onShow(() => {
if (pageRef.value) {
pageRef.value.reload(false)
}
})
const pageHook = hooks.usePage(pageRef, doorApi.hardDoorPage, null, "data.records")
+4 -4
View File
@@ -46,7 +46,7 @@
</view>
</view>
<view class="h-30rpx" />
<view class="h-100rpx" />
<view class="second-text-26 text-center">
<text>联系热线:</text>
@@ -297,9 +297,9 @@ const scanCode = {
// 开发环境模拟扫码
// const testQrCode = "eyJpZCI6IjE4OTYxNTcyMDc2NDQwNTM1MDYiLCJuYW1lIjoi5rWL6K+V5ZWG5oi3In0=" // 线上-测试超市-收款二维码
// const testQrCode = "eyJpZCI6IjE5MDU4MTY3NTEwNDM0NTI5MzAiLCJuYW1lIjoi5paw5Y6/5bqc6LaF5biCIn0=" // 邓本地-测试环境-新县府超市收款二维码
// const testQrCode = "eyJoYXJkRG9vcklkIjoiMTkxNDI0MjgzMDkyOTk4OTYzNCIsImNhYmluZXRObyI6IjEifQ==" // 测试智能柜柜门二维码
const testQrCode = "http://192.168.101.45:8889/h5/#/pages/pay/scanPay?id=1905816751043452930&name=测试新县府超市" // 邓本地-测试环境-新县府超市收款二维码
// const testQrCode = "http://192.168.101.45:8889/h5/#/pages/pay/scanPay?hardDoorId=1914242830929989634&cabinetNo=1" // 测试智能柜柜门二维码
// const testQrCode = "eyJoYXJkRG9vcklkIjoiMTkxMzE1NzA4MDQxODI5NTgwOSIsImNhYmluZXRObyI6IjEifQ==" // 邓本地-测试单门智能柜柜门二维码
// const testQrCode = "http://192.168.101.45:8889/h5/#/pages/pay/scanPay?id=1905816751043452930&name=测试新县府超市" // 邓本地-测试环境-新县府超市收款二维码
const testQrCode = "http://192.168.101.45:8889/h5/#/pages/pay/scanPay?hardDoorId=1913157080418295809&cabinetNo=1" // 测试智能柜柜门二维码
uni.showModal({ content: "开发环境不是浙政钉和诗画环境,扫码仅供测试,收款商家为测试商户超市" })
return testQrCode
+2 -2
View File
@@ -221,7 +221,7 @@ const doTransferMoney = (v: any) => {
</tm-form-item>
</tm-form>
<view class="h-50rpx" />
<!-- <view class="bg-#0094ff p-y-20rpx text-center rounded-40rpx sub-text-30 color-white!" @tap="doBind">绑定</view> -->
<view class="bg-#0094ff p-y-20rpx text-center rounded-40rpx sub-text-30 color-white!" @tap="doBind">绑定</view>
</tm-drawer>
<tm-drawer
z-index="100"
@@ -239,7 +239,7 @@ const doTransferMoney = (v: any) => {
</tm-form-item>
</tm-form>
<view class="h-50rpx" />
<!-- <view class="bg-#0094ff p-y-20rpx text-center rounded-40rpx sub-text-30 color-white!" @tap="doFreeze">冻结</view> -->
<view class="bg-#0094ff p-y-20rpx text-center rounded-40rpx sub-text-30 color-white!" @tap="doFreeze">冻结</view>
</tm-drawer>
<tm-drawer
z-index="100"
+1 -1
View File
@@ -15,7 +15,7 @@ export default {
}),
apply: (data: any) =>
request({
url: "canteen/boxesInfo/create",
url: "canteen/boxesBooking/create",
method: "POST",
data,
}),