食堂预订和智能柜上架商品预览和清除缓存
This commit is contained in:
1 parent
8086811c4f
commit
b888c3496a
9 files changed
+77
-28
No files matched your search
@@ -203,6 +203,7 @@ export default {
|
||||
uni.hideTabBar()
|
||||
uni.removeStorageSync("userRole")
|
||||
uni.showToast({ title: "用户身份未确认", icon: "none" })
|
||||
uni.reLaunch({ url: "/pages/user/userRole" })
|
||||
break
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
<view class="absolute top-[-10rpx] right-[-10rpx] z-200" @click="doUnPutaway(v)">
|
||||
<image class="w-36rpx h-36rpx" src="@/static/page/关闭.svg" />
|
||||
</view>
|
||||
<image class="w-full h-150 rounded-2" :src="v.spuDetail.pic" />
|
||||
<image class="w-full h-150 rounded-2" :src="v.spuDetail.pic" @click.stop="hooks.usePreviewImage(v.spuDetail.pic)" />
|
||||
<view class="sub-text-22">
|
||||
{{ v.spuDetail.name?.length > 4 ? v.spuDetail.name.substring(0, 4) + "..." : v.spuDetail.name }}
|
||||
</view>
|
||||
|
||||
@@ -25,6 +25,9 @@ const state = reactive<any>({
|
||||
|
||||
showCartDialog: false,
|
||||
showBookingDialog: false,
|
||||
|
||||
bookingTimeList: [],
|
||||
selectedBookingTime: "",
|
||||
})
|
||||
|
||||
onLoad((options: any) => {
|
||||
@@ -155,12 +158,14 @@ const updateFoodCart = async () => {
|
||||
// 打开购物车
|
||||
const doVisibleCart = async () => (state.showCartDialog = true)
|
||||
|
||||
// 购买
|
||||
// 购买 打开预订时间段选择对话框
|
||||
const doBuy = async () => {
|
||||
state.selectedBookingTime = ""
|
||||
try {
|
||||
uni.showLoading({ title: "加载中...", mask: true })
|
||||
const res: any = await orderApi.apptList()
|
||||
if (res.code == 0) {
|
||||
state.bookingTimeList = res.data
|
||||
// 打开预约时间段选择对话框
|
||||
state.showBookingDialog = true
|
||||
} else {
|
||||
@@ -175,6 +180,7 @@ const doBuy = async () => {
|
||||
|
||||
// 预约时间段对话框确认
|
||||
const bookingDialogConfirm = () => {
|
||||
if (!state.selectedBookingTime) return uni.showToast({ title: "请选择预订时间段", icon: "none" })
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
content: "是否确定购买",
|
||||
@@ -194,10 +200,12 @@ const submitBuy = async () => {
|
||||
const _createtPa = {
|
||||
carParentId: state.cartList[0].parentCarId,
|
||||
hardType: "CANTEEN",
|
||||
apptId: state.selectedBookingTime,
|
||||
}
|
||||
const { data: createData, code: createCode }: any = await payApi.createHardwareOrder(_createtPa)
|
||||
if (createCode != 0) throw new Error()
|
||||
uni.showToast({ title: "支付成功", icon: "none" })
|
||||
state.showBookingDialog = false
|
||||
router.jump("/pages/tabbar/order")
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
@@ -366,10 +374,27 @@ const doFood = () => {
|
||||
cancelText="取消"
|
||||
confirmText="确认"
|
||||
position="bottom"
|
||||
@confirm="bookingDialogConfirm"
|
||||
@cancel="state.showBookingDialog = false"
|
||||
height="520rpx"
|
||||
zIndex="800"
|
||||
>
|
||||
<tm-text color="#999999">预订时间段</tm-text>
|
||||
<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">
|
||||
<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>
|
||||
</template>
|
||||
</tm-radio>
|
||||
</view>
|
||||
</tm-radio-group>
|
||||
|
||||
<template #footer>
|
||||
<view class="flex px-4 w-full">
|
||||
<tm-button @click="state.showBookingDialog = false" :block="true" skin="thin">取消</tm-button>
|
||||
|
||||
<tm-button @click="bookingDialogConfirm" :block="true">确认</tm-button>
|
||||
</view>
|
||||
</template>
|
||||
</tm-modal>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -71,7 +71,12 @@ const doCancelRefund = async () => {
|
||||
<crud-layout title="订单详情" mainIsScroll bg="/static/page/blue-bg.png">
|
||||
<view class="flex-row-center m-t-30rpx" v-if="state.detail.orderStatus == 5 && state.detail.orderType == 2">
|
||||
<view class="flex-row-center bg-white w-550rpx rounded-16rpx">
|
||||
<image class="w-500rpx" :src="filePath(state.detail.reserveCode)" mode="widthFix" />
|
||||
<image
|
||||
class="w-500rpx"
|
||||
:src="filePath(state.detail.reserveCode)"
|
||||
mode="widthFix"
|
||||
@click.stop="hooks.usePreviewImage(filePath(state.detail.reserveCode))"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="h-30rpx" />
|
||||
@@ -115,7 +120,7 @@ const doCancelRefund = async () => {
|
||||
class="flex-row items-start justify-between"
|
||||
v-for="(v, i) in state.shopCarList"
|
||||
:key="i"
|
||||
@tap.stop="router.jump('/pages/canteen/product-detail', { id: v.productId })"
|
||||
@tap.stop="router.jump('/pages/merchant/product-detail', { id: v.productId })"
|
||||
>
|
||||
<view class="flex-row items-center">
|
||||
<image class="w-160rpx h-160rpx rounded-8rpx" :src="filePath(v.productPic)" mode="aspectFill" />
|
||||
|
||||
+31
-9
@@ -83,6 +83,7 @@ const state = reactive<{
|
||||
// { text: "外来人员就餐", icon: "/static/icon/service_1.png", router: "/pages/apply/foreign-list" },
|
||||
// { text: "跨单位就餐", icon: "/static/icon/service_1.png", router: "/pages/apply/stride-list" },
|
||||
{ text: "人脸管理", icon: "/static/icon/service_5.png", router: "/pages/human-face/list" },
|
||||
{ text: "清除缓存", icon: "/static/icon/clear-storage.png", router: "" },
|
||||
// { text: "意见反馈", icon: "/static/icon/service_5.png", router: "/pages/integrated/feedback/index" },
|
||||
],
|
||||
appInfo: "",
|
||||
@@ -124,6 +125,22 @@ const storage = {
|
||||
uni.removeStorageSync(STORAGE_KEYS.USER_INFO)
|
||||
state.userInfo = {}
|
||||
},
|
||||
|
||||
// 清除缓存
|
||||
clearCache: () => {
|
||||
uni.showModal({
|
||||
title: "确定清除缓存吗?",
|
||||
content: "清除缓存将自动刷新页面",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.clearStorageSync()
|
||||
uni.removeStorageSync("userRole")
|
||||
state.userInfo = {}
|
||||
uni.reLaunch({ url: "/pages/tabbar/my" })
|
||||
}
|
||||
},
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
const login = {
|
||||
@@ -334,17 +351,17 @@ const scanCode = {
|
||||
const onTabLogin = () => (isDevEnv() ? router.jump("/pages/test/login") : login.checkAppInfo())
|
||||
|
||||
const onTabMenu = async (item: any, index: number) => {
|
||||
if (index == state.menuList.length - 1) {
|
||||
router.jump(item.router)
|
||||
return
|
||||
}
|
||||
|
||||
const isLogin = await hooks.useCheckLogin()
|
||||
if (isLogin) {
|
||||
if (item.text === "扫一扫") {
|
||||
await scanCode.scan()
|
||||
} else {
|
||||
router.jump(item.router)
|
||||
switch (item.text) {
|
||||
case "扫一扫":
|
||||
await scanCode.scan()
|
||||
break
|
||||
case "清除缓存":
|
||||
storage.clearCache()
|
||||
break
|
||||
default:
|
||||
router.jump(item.router)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -384,6 +401,11 @@ onLoad(async () => {
|
||||
|
||||
// 获取应用信息
|
||||
state.appInfo = await getAppInfo()
|
||||
|
||||
await userApi.userRole()
|
||||
|
||||
// 获取存储中的用户信息
|
||||
storage.getUserInfo()
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
|
||||
@@ -65,7 +65,7 @@ const query = (page: number, pagesize: number) => {
|
||||
|
||||
// 查看订单和核销码
|
||||
const doToDetail = (v: any) => {
|
||||
// router.jump("/pages/order/detail", { id: v.id })
|
||||
router.jump("/pages/order/detail", { id: v.id })
|
||||
}
|
||||
|
||||
const doAppraise = () => {}
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
import { filePath } from "../utils/file";
|
||||
|
||||
export const usePreviewImage = (str: string | undefined) => {
|
||||
console.log(str, "str");
|
||||
|
||||
if (str == undefined) return;
|
||||
let urlList = str.split(",").map((v) => filePath(v));
|
||||
console.log(urlList);
|
||||
uni.previewImage({
|
||||
urls: urlList,
|
||||
});
|
||||
};
|
||||
if (str == undefined) return
|
||||
let urlList = str.split(",")
|
||||
console.log(urlList)
|
||||
uni.previewImage({
|
||||
urls: urlList,
|
||||
})
|
||||
}
|
||||
Whitespace-only changes.
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
Reference in new issue
Block a user