Merge branch 'master' of https://gitea.zianxin.com/zax/biz-mobile-react-cloud
# Conflicts: # .env
This commit is contained in:
commit
a37ce883b3
5 files changed
+183
-167
No files matched your search
@@ -19,16 +19,16 @@ VITE_OAUTH2_APP_CLIENT='mini:mini'
|
||||
# --------------------------- 开发环境 api地址 ----------------------------------
|
||||
# VITE_APP_DEV_SERVICE = https://stgl.pj.gov.cn/api # 域名线上
|
||||
#VITE_APP_DEV_SERVICE = http://59.202.170.152:81/api # 信创线上
|
||||
#VITE_APP_DEV_SERVICE = http://192.168.101.174:9999 # 邓-本地
|
||||
VITE_APP_DEV_SERVICE = http://127.0.0.1:9999 # 邓-本地
|
||||
# VITE_APP_DEV_SERVICE = http://123.157.250.162:8089/api # 测试线上
|
||||
# VITE_APP_DEV_SERVICE = http://192.168.101.174:9999 # 邓-本地
|
||||
# VITE_APP_DEV_SERVICE = http://127.0.0.1:9999 # 邓-本地
|
||||
VITE_APP_DEV_SERVICE = http://123.157.250.162:8089/api # 测试线上
|
||||
|
||||
# --------------------------- 开发环境 图片访问基础地址 ---------------------------
|
||||
# VITE_IMAGE_DEV_PATH = https://stgl.pj.gov.cn/api # 域名线上
|
||||
#VITE_IMAGE_DEV_PATH = http://59.202.170.152:81/api # 信创线上
|
||||
#VITE_IMAGE_DEV_PATH = http://192.168.101.174:9999 # 邓-本地
|
||||
VITE_IMAGE_DEV_PATH = http://127.0.0.1:9999
|
||||
# VITE_IMAGE_DEV_PATH = http://123.157.250.162:8089/api # 测试线上
|
||||
# VITE_IMAGE_DEV_PATH = http://192.168.101.174:9999 # 邓-本地
|
||||
# VITE_IMAGE_DEV_PATH = http://127.0.0.1:9999
|
||||
VITE_IMAGE_DEV_PATH = http://123.157.250.162:8089/api # 测试线上
|
||||
|
||||
# --------------------------- 生产环境 api地址 ----------------------------------
|
||||
VITE_APP_PROD_SERVICE = https://stgl.pj.gov.cn/api # 域名线上
|
||||
|
||||
@@ -30,7 +30,9 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
|
||||
// 点击加
|
||||
const add = () => {
|
||||
// if (props.modelValue + 1 >= props.stock) return uni.showToast({ title: "库存不足", icon: "none" })
|
||||
if (props.mode !== "cart") {
|
||||
if (props.modelValue + 1 > props.stock) return uni.showToast({ title: "库存不足", icon: "none" })
|
||||
}
|
||||
emit("update:modelValue", props.modelValue + 1)
|
||||
emit("add")
|
||||
}
|
||||
@@ -58,7 +60,8 @@ const remove = () => {
|
||||
<view v-if="props.mode == 'cart'" class="m-l-40rpx second-text-24">x{{ props.count }}</view>
|
||||
</view>
|
||||
<view v-if="props.mode == 'default'" class="flex-row items-center MT 10rpx">
|
||||
<view class="second-text-24">{{ hooks.useFormatNum("库存", "", props.stock) }}</view>
|
||||
<!-- <view class="second-text-24">{{ hooks.useFormatNum("库存", "", props.stock) }}</view> -->
|
||||
<view class="second-text-24">库存:{{ props.stock }}</view>
|
||||
<view class="w-1px h-20rpx m-x-5rpx bg-#999 mx-2" />
|
||||
<view class="second-text-24">{{ hooks.useFormatNum("销量", "", props.salesCount) }}</view>
|
||||
</view>
|
||||
|
||||
@@ -5,7 +5,6 @@ import { isEmpty } from "radash"
|
||||
import { hooks, router } from "@@/index"
|
||||
import { merchantApi, foodApi, payApi, orderApi } from "@@/api"
|
||||
import { filePath } from "@@/utils/file"
|
||||
|
||||
import ProductRow from "./components/product-row.vue"
|
||||
import ProductCart from "./components/product-cart.vue"
|
||||
import ProductTotal from "./components/product-total.vue"
|
||||
@@ -99,6 +98,7 @@ const getFoodList = async () => {
|
||||
const _pa = {
|
||||
merchantId: state.detailId,
|
||||
categoryId: target.id,
|
||||
time: hooks.useTime(new Date(), "{y}-{m}-{d}"),
|
||||
}
|
||||
const { data } = await foodApi.product(_pa)
|
||||
data.forEach((i: any) => {
|
||||
@@ -111,7 +111,7 @@ const getFoodList = async () => {
|
||||
// 切换选中的分类
|
||||
const doClassify = (i: any) => {
|
||||
state.currentClassifyIndex = i
|
||||
getClassify()
|
||||
getFoodList()
|
||||
}
|
||||
|
||||
// 设置购物车商品的数量
|
||||
@@ -119,8 +119,11 @@ const chentProductCartCount = async (item: any) => {
|
||||
try {
|
||||
uni.showLoading({ title: "加载中", mask: true })
|
||||
// 检查商品库存
|
||||
const { code }: any = await foodApi.checkSpuStock({ spuId: item.productId, incrCount: item.productCount })
|
||||
if (code != 0) throw new Error()
|
||||
const { code, msg }: any = await foodApi.checkSpuStock({ spuId: item.productId, incrCount: item.productCount })
|
||||
if (code != 0) {
|
||||
item.productCount--
|
||||
return uni.showToast({ title: msg, icon: "none" })
|
||||
}
|
||||
|
||||
const targetIndex = state.cartList.findIndex((v) => v.productId == item.productId)
|
||||
if (targetIndex !== -1) {
|
||||
@@ -292,7 +295,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">
|
||||
|
||||
@@ -32,7 +32,7 @@ const getDetail = async () => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<crud-layout title="订单详情" tabBarType="just-flot-back" bg="/static/page/blue-bg.png">
|
||||
<crud-layout title="菜品详情" tabBarType="just-flot-back" bg="/static/page/blue-bg.png">
|
||||
<view v-if="state.detail">
|
||||
<image class="w-100vw" :src="filePath(state.detail.picUrl)" mode="widthFix" />
|
||||
<view class="p-x-15rpx">
|
||||
|
||||
@@ -1,220 +1,230 @@
|
||||
<template>
|
||||
<view class="notice-header">
|
||||
<view class="back-btn" @click="goBack">
|
||||
<text class="iconfont icon-fanhui"></text> 返回
|
||||
</view>
|
||||
</view>
|
||||
<view class="notice-container">
|
||||
<view class="notice-list">
|
||||
<view v-if="noticeList.length === 0" class="empty-tip">
|
||||
暂无公告
|
||||
</view>
|
||||
<view v-else>
|
||||
<view
|
||||
v-for="item in noticeList"
|
||||
:key="item.id"
|
||||
class="notice-item"
|
||||
>
|
||||
<view class="item-main">
|
||||
<view class="icon-area">
|
||||
<view class="icon-bell">
|
||||
<view class="red-dot"></view>
|
||||
<text class="iconfont icon-lingdang"></text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="content-area">
|
||||
<view class="title">{{ item.title }}</view>
|
||||
<view class="summary">{{ item.summary || item.content }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item-footer">
|
||||
<view class="detail-btn" @click="viewDetail(item)">查看详情 ></view>
|
||||
<view class="date">{{ formatDate(item.createTime) }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="hasMore" class="load-more" @click="loadMore">
|
||||
<text>加载更多</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="notice-header">
|
||||
<view class="back-btn" @click="goBack"> <text class="iconfont icon-fanhui"></text> 返回 </view>
|
||||
</view>
|
||||
<view class="notice-container">
|
||||
<view class="notice-list">
|
||||
<view v-if="noticeList.length === 0" class="empty-tip"> 暂无公告 </view>
|
||||
<view v-else>
|
||||
<view v-for="item in noticeList" :key="item.id" class="notice-item">
|
||||
<view class="item-main">
|
||||
<view class="icon-area">
|
||||
<view class="icon-bell">
|
||||
<view class="red-dot"></view>
|
||||
<text class="iconfont">
|
||||
<svg
|
||||
t="1755142010765"
|
||||
class="icon"
|
||||
viewBox="0 0 1024 1024"
|
||||
version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
p-id="12392"
|
||||
width="24"
|
||||
height="24"
|
||||
>
|
||||
<path
|
||||
d="M512 960c49.6 0 88-38.4 88-88H424c0 49.6 38.4 88 88 88z m288.8-286.4V444.8c0-137.6-97.6-252.8-224.8-283.2v-28.8c0-32-17.6-60.8-48-67.2-44-10.4-80 23.2-80 66.4v30.4C320.8 192 223.2 307.2 223.2 444.8v228.8L136 763.2v44.8h752v-44.8l-87.2-89.6z"
|
||||
p-id="12393"
|
||||
data-spm-anchor-id="a313x.search_index.0.i6.61dc3a812gyLD2"
|
||||
class="selected"
|
||||
fill="#3976DA"
|
||||
></path>
|
||||
</svg>
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="content-area">
|
||||
<view class="title">{{ item.title }}</view>
|
||||
<view class="summary">{{ item.summary || item.content }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item-footer">
|
||||
<view class="detail-btn" @click="viewDetail(item)">查看详情 ></view>
|
||||
<view class="date">{{ formatDate(item.createTime) }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="hasMore" class="load-more" @click="loadMore">
|
||||
<text>加载更多</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { noticeApi } from '@/sheep/api'
|
||||
import { ref, onMounted } from "vue"
|
||||
import { noticeApi } from "@/sheep/api"
|
||||
|
||||
const noticeList = ref<any[]>([])
|
||||
const currentPage = ref(1)
|
||||
const hasMore = ref(true)
|
||||
|
||||
function formatDate(time: string) {
|
||||
if (!time) return ''
|
||||
const d = new Date(time)
|
||||
const y = d.getFullYear()
|
||||
const m = (d.getMonth() + 1).toString().padStart(2, '0')
|
||||
const day = d.getDate().toString().padStart(2, '0')
|
||||
return `${y}.${m}.${day}`
|
||||
if (!time) return ""
|
||||
const d = new Date(time)
|
||||
const y = d.getFullYear()
|
||||
const m = (d.getMonth() + 1).toString().padStart(2, "0")
|
||||
const day = d.getDate().toString().padStart(2, "0")
|
||||
return `${y}.${m}.${day}`
|
||||
}
|
||||
|
||||
function viewDetail(item: any) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/integrated/notice/detail?id=${item.id}`
|
||||
})
|
||||
uni.navigateTo({
|
||||
url: `/pages/integrated/notice/detail?id=${item.id}`,
|
||||
})
|
||||
}
|
||||
|
||||
async function loadNoticeList(reset = false) {
|
||||
try {
|
||||
const params = {
|
||||
current: currentPage.value,
|
||||
size: 10
|
||||
}
|
||||
const response: any = await noticeApi.getNoticePage(params)
|
||||
if (response.code === 0 && response.data) {
|
||||
const records = response.data.records || []
|
||||
if (reset) {
|
||||
noticeList.value = records
|
||||
} else {
|
||||
noticeList.value = [...noticeList.value, ...records]
|
||||
}
|
||||
hasMore.value = records.length === 10
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载公告列表失败:', error)
|
||||
}
|
||||
try {
|
||||
const params = {
|
||||
current: currentPage.value,
|
||||
size: 10,
|
||||
}
|
||||
const response: any = await noticeApi.getNoticePage(params)
|
||||
if (response.code === 0 && response.data) {
|
||||
const records = response.data.records || []
|
||||
if (reset) {
|
||||
noticeList.value = records
|
||||
} else {
|
||||
noticeList.value = [...noticeList.value, ...records]
|
||||
}
|
||||
hasMore.value = records.length === 10
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("加载公告列表失败:", error)
|
||||
}
|
||||
}
|
||||
|
||||
function loadMore() {
|
||||
if (!hasMore.value) return
|
||||
currentPage.value++
|
||||
loadNoticeList()
|
||||
if (!hasMore.value) return
|
||||
currentPage.value++
|
||||
loadNoticeList()
|
||||
}
|
||||
|
||||
function goBack() {
|
||||
uni.navigateBack()
|
||||
uni.navigateBack()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
loadNoticeList(true)
|
||||
loadNoticeList(true)
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import url('//at.alicdn.com/t/font_1234567_lingdang.css'); /* 替换为你的iconfont地址 */
|
||||
.notice-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 88rpx;
|
||||
background: #fff;
|
||||
padding-left: 24rpx;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04);
|
||||
margin-bottom: 16rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 88rpx;
|
||||
background: #fff;
|
||||
padding-left: 24rpx;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
.back-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 30rpx;
|
||||
color: #1976d2;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 30rpx;
|
||||
color: #1976d2;
|
||||
cursor: pointer;
|
||||
}
|
||||
.back-btn .iconfont {
|
||||
font-size: 36rpx;
|
||||
margin-right: 8rpx;
|
||||
font-size: 36rpx;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
.notice-container {
|
||||
background: #f5f5f5;
|
||||
min-height: 100vh;
|
||||
background: #f5f5f5;
|
||||
min-height: 100vh;
|
||||
}
|
||||
.notice-list {
|
||||
padding: 24rpx;
|
||||
padding: 24rpx;
|
||||
}
|
||||
.notice-item {
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
margin-bottom: 32rpx;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04);
|
||||
padding: 32rpx 32rpx 24rpx 32rpx;
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
margin-bottom: 32rpx;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
|
||||
padding: 32rpx 32rpx 24rpx 32rpx;
|
||||
}
|
||||
.item-main {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
}
|
||||
.icon-area {
|
||||
margin-right: 24rpx;
|
||||
position: relative;
|
||||
margin-right: 24rpx;
|
||||
position: relative;
|
||||
}
|
||||
.icon-bell {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
background: #e3f2fd;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
background: #e3f2fd;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
}
|
||||
.icon-bell .iconfont {
|
||||
font-size: 32rpx;
|
||||
color: #1976d2;
|
||||
font-size: 32rpx;
|
||||
color: #1976d2;
|
||||
}
|
||||
.red-dot {
|
||||
width: 14rpx;
|
||||
height: 14rpx;
|
||||
background: #f44336;
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
top: 4rpx;
|
||||
right: 4rpx;
|
||||
border: 2rpx solid #fff;
|
||||
width: 14rpx;
|
||||
height: 14rpx;
|
||||
background: #f44336;
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
top: 4rpx;
|
||||
right: 4rpx;
|
||||
border: 2rpx solid #fff;
|
||||
}
|
||||
.content-area {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.title {
|
||||
font-size: 30rpx;
|
||||
font-weight: bold;
|
||||
color: #222;
|
||||
margin-bottom: 8rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-size: 30rpx;
|
||||
font-weight: bold;
|
||||
color: #222;
|
||||
margin-bottom: 8rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.summary {
|
||||
font-size: 26rpx;
|
||||
color: #888;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-size: 26rpx;
|
||||
color: #888;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.item-footer {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
border-top: 1rpx solid #f0f0f0;
|
||||
margin-top: 18rpx;
|
||||
padding-top: 12rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
border-top: 1rpx solid #f0f0f0;
|
||||
margin-top: 18rpx;
|
||||
padding-top: 12rpx;
|
||||
}
|
||||
.detail-btn {
|
||||
color: #1976d2;
|
||||
font-size: 26rpx;
|
||||
cursor: pointer;
|
||||
color: #1976d2;
|
||||
font-size: 26rpx;
|
||||
cursor: pointer;
|
||||
}
|
||||
.date {
|
||||
color: #999;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.empty-tip {
|
||||
text-align: center;
|
||||
color: #999;
|
||||
font-size: 28rpx;
|
||||
padding: 60rpx 0;
|
||||
text-align: center;
|
||||
color: #999;
|
||||
font-size: 28rpx;
|
||||
padding: 60rpx 0;
|
||||
}
|
||||
.load-more {
|
||||
text-align: center;
|
||||
color: #007aff;
|
||||
font-size: 28rpx;
|
||||
padding: 32rpx 0;
|
||||
cursor: pointer;
|
||||
text-align: center;
|
||||
color: #007aff;
|
||||
font-size: 28rpx;
|
||||
padding: 32rpx 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
Reference in new issue
Block a user