获取食堂预约时间段和目录调整
This commit is contained in:
1 parent
1a74921af9
commit
8086811c4f
11 files changed
+53
-11
No files matched your search
+1
-1
@@ -174,7 +174,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"root": "pages/merchant",
|
||||
"root": "pages/canteen",
|
||||
"pages": [
|
||||
{
|
||||
"path": "detail",
|
||||
|
||||
+10
-1
@@ -36,7 +36,16 @@ const remove = (v) => emit("remove", v)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<tm-drawer z-index="100" v-model:show="props.modelValue" showFooter title="购物车" position="bottom" size="60%" @close="doClose">
|
||||
<tm-drawer
|
||||
z-index="100"
|
||||
v-model:show="props.modelValue"
|
||||
showFooter
|
||||
title="购物车"
|
||||
position="bottom"
|
||||
size="60%"
|
||||
bgColor="#ECF4F9"
|
||||
@close="doClose"
|
||||
>
|
||||
<view v-for="(v, i) in props.cartList" :key="v.id">
|
||||
<product-row
|
||||
v-model="v.productCount"
|
||||
+2
-2
@@ -46,14 +46,14 @@ const remove = () => {
|
||||
<template>
|
||||
<view
|
||||
class="flex-row items-start card p-x-15rpx p-y-25rpx m-b-20rpx"
|
||||
@tap="props.productId && router.jump('/pages/merchant/product-detail', { id: props.productId })"
|
||||
@tap="props.productId && router.jump('/pages/canteen/product-detail', { id: props.productId })"
|
||||
>
|
||||
<image v-if="props.mode == 'default'" class="size-180rpx rounded-12rpx" :src="props.pic" mode="aspectFill" />
|
||||
<image v-if="props.mode == 'cart'" class="size-120rpx rounded-12rpx" :src="props.pic" mode="aspectFill" />
|
||||
<view class="flex-1 m-l-20rpx">
|
||||
<view class="sub-text-28 show-line">{{ props.name }}</view>
|
||||
<view class="m-t-10rpx flex-row items-center">
|
||||
<view class="w-100rpx second-text-32 color-red!"> ¥{{ hooks.useMoney(props.price) }} </view>
|
||||
<view class="w-110rpx second-text-32 color-red!"> ¥{{ hooks.useMoney(props.price) }} </view>
|
||||
<view v-if="props.mode == 'default'" class="m-l-20rpx second-text-24 line-through">¥{{ hooks.useMoney(props.marketPrice) }}</view>
|
||||
<view v-if="props.mode == 'cart'" class="m-l-40rpx second-text-24">x{{ props.count }}</view>
|
||||
</view>
|
||||
File renamed without changes.
@@ -3,7 +3,7 @@ import { reactive, nextTick } from "vue"
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
import { isEmpty } from "radash"
|
||||
import { hooks, router } from "@@/index"
|
||||
import { merchantApi, foodApi, payApi } from "@@/api"
|
||||
import { merchantApi, foodApi, payApi, orderApi } from "@@/api"
|
||||
import { filePath } from "@@/utils/file"
|
||||
|
||||
import ProductRow from "./components/product-row.vue"
|
||||
@@ -24,6 +24,7 @@ const state = reactive<any>({
|
||||
currentClassifyIndex: 0,
|
||||
|
||||
showCartDialog: false,
|
||||
showBookingDialog: false,
|
||||
})
|
||||
|
||||
onLoad((options: any) => {
|
||||
@@ -156,6 +157,24 @@ const doVisibleCart = async () => (state.showCartDialog = true)
|
||||
|
||||
// 购买
|
||||
const doBuy = async () => {
|
||||
try {
|
||||
uni.showLoading({ title: "加载中...", mask: true })
|
||||
const res: any = await orderApi.apptList()
|
||||
if (res.code == 0) {
|
||||
// 打开预约时间段选择对话框
|
||||
state.showBookingDialog = true
|
||||
} else {
|
||||
uni.showToast({ title: res.msg, icon: "none" })
|
||||
}
|
||||
} catch (error: any) {
|
||||
uni.showToast({ title: error.msg, icon: "none" })
|
||||
} finally {
|
||||
uni.hideLoading()
|
||||
}
|
||||
}
|
||||
|
||||
// 预约时间段对话框确认
|
||||
const bookingDialogConfirm = () => {
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
content: "是否确定购买",
|
||||
@@ -196,7 +215,7 @@ const doPhone = () => {
|
||||
}
|
||||
|
||||
const doFood = () => {
|
||||
router.jump("/pages/merchant/food", { merchantId: state.detailId })
|
||||
router.jump("/pages/canteen/food", { merchantId: state.detailId })
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -338,6 +357,20 @@ const doFood = () => {
|
||||
@remove="(v) => chentProductCartCount(v)"
|
||||
@submit="doBuy"
|
||||
/>
|
||||
|
||||
<tm-modal
|
||||
v-model:show="state.showBookingDialog"
|
||||
:overlayClick="false"
|
||||
:showCancel="true"
|
||||
title="请选择预订时间段"
|
||||
cancelText="取消"
|
||||
confirmText="确认"
|
||||
position="bottom"
|
||||
@confirm="bookingDialogConfirm"
|
||||
@cancel="state.showBookingDialog = false"
|
||||
>
|
||||
<tm-text color="#999999">预订时间段</tm-text>
|
||||
</tm-modal>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@@ -88,7 +88,7 @@ const doTab = (e: any) => {
|
||||
}
|
||||
|
||||
const doProduct = (v: any) => {
|
||||
// router.jump("/pages/merchant/product-detail", { spuId: v.spuId })
|
||||
// router.jump("/pages/canteen/product-detail", { spuId: v.spuId })
|
||||
}
|
||||
</script>
|
||||
|
||||
File renamed without changes.
@@ -115,7 +115,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/merchant/product-detail', { id: v.productId })"
|
||||
@tap.stop="router.jump('/pages/canteen/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" />
|
||||
|
||||
@@ -124,7 +124,7 @@ const doSubmit = async () => {
|
||||
class="flex-row items-start justify-between"
|
||||
v-for="(v, i) in state.shopCarList"
|
||||
:key="i"
|
||||
@tap.stop="router.jump('/pages/merchant/product-detail', { id: v.productId })"
|
||||
@tap.stop="router.jump('/pages/canteen/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,7 +31,7 @@ const query = (page: number, pagesize: number) => {
|
||||
const toDetail = async (v: any) => {
|
||||
const isLogin = await hooks.useCheckLogin()
|
||||
if (isLogin) {
|
||||
router.jump("/pages/merchant/detail", { id: v.id })
|
||||
router.jump("/pages/canteen/detail", { id: v.id })
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -42,7 +42,7 @@ export default {
|
||||
*/
|
||||
apptList: () =>
|
||||
request({
|
||||
url: `/hard/hard-appt/app/list"`,
|
||||
url: "/hard/hard-appt/app/list",
|
||||
method: "GET",
|
||||
custom: {
|
||||
showLoading: false,
|
||||
|
||||
Reference in new issue
Block a user