feat: 个人菜品喜好排行
This commit is contained in:
1 parent
c53b654b1d
commit
479d48f013
3 files changed
+103
-34
No files matched your search
@@ -17,17 +17,17 @@ VITE_PWD_ENC_KEY='pigxpigxpigxpigx'
|
||||
VITE_OAUTH2_APP_CLIENT='mini:mini'
|
||||
|
||||
# --------------------------- 开发环境 api地址 ----------------------------------
|
||||
VITE_APP_DEV_SERVICE = https://stgl.pj.gov.cn/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.150:9999 # 邓-本地
|
||||
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.150:9999 # 邓-43本地
|
||||
VITE_IMAGE_DEV_PATH = http://127.0.0.1:9999
|
||||
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地址 ----------------------------------
|
||||
|
||||
@@ -15,18 +15,75 @@
|
||||
</view>
|
||||
</tm-sheet>
|
||||
|
||||
<tm-sheet :margin="[0, 20]">
|
||||
<view class="prefix_title mb-15rpx">个人菜品喜好排行</view>
|
||||
<view v-if="productLikeTopList.length > 0" class="bg-white rounded-16rpx overflow-hidden shadow-sm">
|
||||
<view class="bg-gradient-to-r from-blue-50 to-blue-100 px-20rpx py-16rpx flex items-center border-b border-gray-100">
|
||||
<view class="w-80rpx text-center text-24rpx font-bold text-gray-600">排名</view>
|
||||
<view class="flex-1 px-16rpx text-24rpx font-bold text-gray-600">菜品名称</view>
|
||||
<view class="w-120rpx text-center text-24rpx font-bold text-gray-600">分类</view>
|
||||
<view class="w-100rpx text-center text-24rpx font-bold text-gray-600">购买次数</view>
|
||||
</view>
|
||||
|
||||
<view
|
||||
v-for="(item, index) in productLikeTopList"
|
||||
:key="item.productId"
|
||||
class="flex items-center px-20rpx py-16rpx border-b border-gray-50 hover:bg-gray-50 transition-colors"
|
||||
:class="{
|
||||
'bg-gradient-to-r from-yellow-50 to-orange-50': index === 0,
|
||||
'bg-gradient-to-r from-gray-50 to-gray-100': index === 1,
|
||||
'bg-gradient-to-r from-orange-50 to-red-50': index === 2,
|
||||
}"
|
||||
>
|
||||
<view class="w-80rpx flex justify-center items-center">
|
||||
<view
|
||||
v-if="index < 3"
|
||||
class="w-40rpx h-40rpx rounded-full flex items-center justify-center text-20rpx font-bold text-white"
|
||||
:class="{
|
||||
'bg-gradient-to-r from-yellow-400 to-yellow-500': index === 0,
|
||||
'bg-gradient-to-r from-gray-400 to-gray-500': index === 1,
|
||||
'bg-gradient-to-r from-orange-400 to-orange-500': index === 2,
|
||||
}"
|
||||
>
|
||||
{{ index + 1 }}
|
||||
</view>
|
||||
<view v-else class="text-24rpx font-medium text-gray-500">{{ index + 1 }}</view>
|
||||
</view>
|
||||
|
||||
<view class="flex-1 px-16rpx">
|
||||
<view class="text-26rpx font-medium text-gray-800 truncate">{{ item.productName || "未知菜品" }}</view>
|
||||
</view>
|
||||
|
||||
<view class="w-120rpx text-center">
|
||||
<view class="text-22rpx text-gray-600 truncate">{{ item.classifyName || "未分类" }}</view>
|
||||
</view>
|
||||
|
||||
<view class="w-100rpx text-center">
|
||||
<view class="inline-block px-12rpx py-6rpx bg-blue-100 text-blue-600 text-22rpx font-medium rounded-full">
|
||||
{{ item.payCount }}次
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-else class="bg-white rounded-16rpx p-60rpx flex flex-col items-center justify-center">
|
||||
<view class="text-28rpx text-gray-500">暂无菜品喜好数据</view>
|
||||
</view>
|
||||
</tm-sheet>
|
||||
|
||||
<view class="h-80rpx" />
|
||||
</crud-layout>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onLoad } from "@dcloudio/uni-app"
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
import { ref } from "vue"
|
||||
import qiunDataCharts from "@/components/qiun-data-charts/qiun-data-charts.vue"
|
||||
import { totalApi } from "@/sheep/api"
|
||||
|
||||
const pieChartData = ref({})
|
||||
const areaChartData = ref({})
|
||||
const productLikeTopList = ref<any>([])
|
||||
const COLORLIST = ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4", "#ea7ccc"]
|
||||
|
||||
const pieChartOpts = {
|
||||
@@ -83,6 +140,12 @@ onLoad(() => {
|
||||
|
||||
getPieChartData()
|
||||
getAreaChartData()
|
||||
getProductLikeTop()
|
||||
})
|
||||
onShow(() => {
|
||||
getPieChartData()
|
||||
getAreaChartData()
|
||||
getProductLikeTop()
|
||||
})
|
||||
|
||||
const getPieChartData = async () => {
|
||||
@@ -114,7 +177,7 @@ const getAreaChartData = async () => {
|
||||
|
||||
const series = data.map((item: any) => {
|
||||
const name = Object.keys(item)[0]
|
||||
const data = item[name].map((item: any) => Number(item.payUserCount) + Number((Math.random() * 100).toFixed(0)))
|
||||
const data = item[name].map((item: any) => Number(item.payUserCount))
|
||||
return {
|
||||
name,
|
||||
data,
|
||||
@@ -126,4 +189,10 @@ const getAreaChartData = async () => {
|
||||
series,
|
||||
}
|
||||
}
|
||||
|
||||
const getProductLikeTop = async () => {
|
||||
const { code, data, msg } = await totalApi.productLikeTop({})
|
||||
if (code !== 0) return uni.showToast({ title: msg || "数据获取失败", icon: "none" })
|
||||
productLikeTopList.value = data
|
||||
}
|
||||
</script>
|
||||
+28
-28
@@ -1,31 +1,31 @@
|
||||
import request from "@/sheep/utils/request"
|
||||
|
||||
export default {
|
||||
/**
|
||||
* 菜品销量按照分类查询
|
||||
*/
|
||||
productByClassify: (data: any) =>
|
||||
request({
|
||||
url: `/hard/hard-canteen-total-log/app/product-by-classify`,
|
||||
method: "POST",
|
||||
data,
|
||||
}),
|
||||
/**
|
||||
* 近一周各个食堂菜品购买统计
|
||||
*/
|
||||
productByCanteen: (data: any) =>
|
||||
request({
|
||||
url: `/hard/hard-canteen-total-log/app/product-by-canteen`,
|
||||
method: "POST",
|
||||
data,
|
||||
}),
|
||||
/**
|
||||
* 个人菜品喜好排行
|
||||
*/
|
||||
productLikeTop: (data: any) =>
|
||||
request({
|
||||
url: `/hard/hard-canteen-total-log/app/product-like-top`,
|
||||
method: "POST",
|
||||
data,
|
||||
}),
|
||||
}
|
||||
/**
|
||||
* 菜品销量按照分类查询
|
||||
*/
|
||||
productByClassify: (data: any): any =>
|
||||
request({
|
||||
url: `/hard/hard-canteen-total-log/app/product-by-classify`,
|
||||
method: "POST",
|
||||
data,
|
||||
}),
|
||||
/**
|
||||
* 近一周各个食堂菜品购买统计
|
||||
*/
|
||||
productByCanteen: (data: any): any =>
|
||||
request({
|
||||
url: `/hard/hard-canteen-total-log/app/product-by-canteen`,
|
||||
method: "POST",
|
||||
data,
|
||||
}),
|
||||
/**
|
||||
* 个人菜品喜好排行
|
||||
*/
|
||||
productLikeTop: (data: any): any =>
|
||||
request({
|
||||
url: `/hard/hard-canteen-total-log/app/product-like-top`,
|
||||
method: "POST",
|
||||
data,
|
||||
}),
|
||||
}
|
||||
Reference in new issue
Block a user