This commit is contained in:
zjf committed 2025-03-26 11:10:52 +08:00
commit f916b38033
11 files changed
+231 -132

No files matched your search

+14 -6
View File
@@ -13,12 +13,20 @@ const tabbar = [
selectedIconPath: "/static/tabbar/canteen-select.png",
auth: ["zhezhengding", "shihua"],
},
// {
// "pagePath": "pages/tabbar/shop",
// "text": "超市",
// "iconPath": "/static/tabbar/shop.png",
// "selectedIconPath": "/static/tabbar/shop-select.png"
// },
{
pagePath: "pages/tabbar/shop",
text: "超市",
iconPath: "/static/tabbar/shop.png",
selectedIconPath: "/static/tabbar/shop-select.png",
auth: ["zhezhengding", "shihua"],
},
{
pagePath: "pages/tabbar/coopShop",
text: "合作商家",
iconPath: "/static/tabbar/coopShop.png",
selectedIconPath: "/static/tabbar/coopShop-select.png",
auth: ["zhezhengding"],
},
{
pagePath: "pages/tabbar/order",
text: "订单",
+33 -14
View File
@@ -16,13 +16,20 @@
"disableScroll": true
}
},
// {
// "path": "pages/tabbar/shop",
// "style": {
// "navigationBarTitleText": "超市",
// "disableScroll": true
// }
// },
{
"path": "pages/tabbar/shop",
"style": {
"navigationBarTitleText": "超市",
"disableScroll": true
}
},
{
"path": "pages/tabbar/coopShop",
"style": {
"navigationBarTitleText": "合作商家",
"disableScroll": true
}
},
{
"path": "pages/tabbar/order",
"style": {
@@ -277,7 +284,7 @@
{
"path": "scanPay",
"style": {
"navigationBarTitleText": "",
"navigationBarTitleText": "支付",
"disableScroll": true
}
}
@@ -299,12 +306,18 @@
"iconPath": "",
"selectedIconPath": ""
},
// {
// "pagePath": "pages/tabbar/shop",
// "text": "",
// "iconPath": "",
// "selectedIconPath": ""
// },
{
"pagePath": "pages/tabbar/shop",
"text": "",
"iconPath": "",
"selectedIconPath": ""
},
{
"pagePath": "pages/tabbar/coopShop",
"text": "",
"iconPath": "",
"selectedIconPath": ""
},
{
"pagePath": "pages/tabbar/order",
"text": "",
@@ -343,6 +356,12 @@
// "selectedIconPath": "static/tabbar/shop-select.png"
// },
// {
// pagePath: "pages/tabbar/coopShop",
// text: "合作商家",
// iconPath: "static/tabbar/coopShop.png",
// selectedIconPath: "static/tabbar/coopShop-select.png",
// },
// {
// "pagePath": "pages/tabbar/order",
// "text": "订单",
// "iconPath": "static/tabbar/order.png",
+10 -10
View File
@@ -150,17 +150,17 @@ const doProduct = (v: any) => {
<template #default="{ item, url, index }">
<div class="card">
<LazyImg class="rounded-2" :url="item.picUrl" />
<view class="p-x-15rpx p-y-25rpx">
<view class="p-x-15rpx p-y-25rpx flex items-center justify-between">
<view class="sub-text-28 show-line">{{ item.name }}</view>
<view class="m-t-10rpx flex-row items-center">
<view class="second-text-32 color-#f63a36!"> ¥{{ hooks.useMoney(item.price) }} </view>
<view class="m-l-20rpx mt-1 second-text-24 line-through">¥{{ hooks.useMoney(item.marketPrice) }}</view>
</view>
<view class="flex-col items-start">
<view class="second-text-24">{{ hooks.useFormatNum("库存", "", item.stock) }}</view>
<!-- <view class="w-1px h-20rpx m-x-5rpx bg-#999" /> -->
<view class="second-text-24">{{ hooks.useFormatNum("销量", "", item.salesCount) }}</view>
</view>
<!-- <view class="m-t-10rpx flex-row items-center"> -->
<view class="second-text-32 color-#f63a36!"> ¥{{ hooks.useMoney(item.price) }} </view>
<!-- <view class="m-l-20rpx mt-1 second-text-24 line-through">¥{{ hooks.useMoney(item.marketPrice) }}</view> -->
<!-- </view> -->
<!-- <view class="flex-col items-start"> -->
<!-- <view class="second-text-24">{{ hooks.useFormatNum("库存", "", item.stock) }}</view> -->
<!-- <view class="w-1px h-20rpx m-x-5rpx bg-#999" /> -->
<!-- <view class="second-text-24">{{ hooks.useFormatNum("销量", "", item.salesCount) }}</view> -->
<!-- </view> -->
</view>
</div>
</template>
+1 -1
View File
@@ -1,7 +1,7 @@
<template>
<crud-layout bg="/static/page/blue-bg.png">
<view class="h-screen flex flex-col position-relative">
<view class="mx-auto text-34 py-2">支付</view>
<view class="mx-auto text-34 py-2">{{ scanData.name }}</view>
<tm-sheet class="flex flex-row">
<span class="text-2xl text-[#333] mr-1 line-height-normal">¥</span>
+79
View File
@@ -0,0 +1,79 @@
<script setup lang="ts">
import { ref, reactive } from "vue"
import { onLoad, onShow } from "@dcloudio/uni-app"
import { merchantApi } from "@@/api"
import { hooks, router } from "@@/index"
import { filePath } from "@@/utils/file"
const pageRef = ref<any>(null)
const state = reactive<any>({
pa: {
pagesize: 10,
type: "2",
},
})
const pageHook = hooks.usePage(pageRef, merchantApi.page, null, "data.records")
const query = (page: number, pagesize: number) => {
pageHook.startPage(page, pagesize, false, state.pa)
}
onLoad(() => {
const app = getApp()
app._initTabbar()
})
onShow(() => {
pageRef.value && pageRef.value.reload(false)
})
const toDetail = async (v: any) => {
return
const isLogin = await hooks.useCheckLogin()
if (isLogin) {
router.jump("/pages/shop/detail", { id: v.id })
}
}
</script>
<template>
<crud-layout bg="/static/page/blue-bg.png">
<z-paging
ref="pageRef"
height="100%"
:fixed="false"
v-model="pageHook.list"
:default-page-size="10"
safe-area-inset-bottom
:loading-more-enabled="true"
:show-scrollbar="false"
@query="query"
:auto-clean-list-when-reload="false"
:auto-scroll-to-top-when-reload="false"
@scroll="pageHook.scroll"
>
<view class="h-20rpx" />
<view class="flex-col card p-20rpx m-b-20rpx" v-for="(v, i) in pageHook.list" :key="i" @tap="toDetail(v)">
<view class="flex-row-center">
<image class="w-180rpx h-180rpx rounded-12rpx" :src="filePath(v.logoPic)" mode="aspectFill" />
<view class="flex-1 flex-col m-l-20rpx">
<view class="flex-row items-center justify-between">
<view class="flex-row-center sub-text-34">{{ v.name }}</view>
<tm-tag size="s">{{ v.deptName }}</tm-tag>
</view>
<view class="second-text-24">{{ v.phone }}</view>
<view class="second-text-24">
<view v-if="v.jobTime != ',,'" class="second-text-28">营业时间:</view>
<view>{{ v.jobTime?.split(",")[0] ? "早:" + v.jobTime?.split(",")[0] : "" }}</view>
<view>{{ v.jobTime?.split(",")[1] ? "中:" + v.jobTime?.split(",")[1] : "" }}</view>
<view>{{ v.jobTime?.split(",")[2] ? "晚:" + v.jobTime?.split(",")[2] : "" }}</view>
</view>
<view v-if="v.addressDes" class="m-t-10rpx second-text-28">
<text>地址</text>
<text class="m-l-10rpx">{{ v.addressDes }}</text>
</view>
</view>
</view>
</view>
</z-paging>
</crud-layout>
</template>
+3 -3
View File
@@ -128,9 +128,9 @@
<view class="flex flex-col items-end justify-center m-t-5rpx">
<view class="second-text-22">{{ hooks.useEnum("hardwareRefundStatusEnum", state.curOrder.refundStatus) }}</view>
<view class="flex">
<view v-if="state.curOrder.carList?.length" class="m-t-4rpx m-r-10rpx second-text-26"
>共 {{ state.curOrder.carList.length }} 件</view
>
<view v-if="state.curOrder.carList?.length" class="m-t-4rpx m-r-10rpx second-text-26">
共 {{ state.curOrder.carList.length }} 件
</view>
<view class="main-text-30 color-red!">¥ {{ hooks.useMoney(state.curOrder.totalPrice) }}</view>
</view>
</view>
+1 -1
View File
@@ -141,7 +141,7 @@ const doRefund = (v: any) => {
</scroll-view>
</view> -->
<!-- <view class="absolute top-0 right-0 bottom-0 z-10 flex-col items-end w-160rpx p-x-20rpx bg-white bg-opacity-95"> -->
<view class="m-t-2rpx m-r-20rpx second-text-26">共 {{ v.carList.length }} 件</view>
<view v-if="v.carList?.length" class="m-t-2rpx m-r-20rpx second-text-26">共 {{ v.carList.length }} 件</view>
<view class="main-text-30 color-red!">¥ {{ hooks.useMoney(v.totalPrice) }}</view>
<!-- </view> -->
</view>
+8 -7
View File
@@ -9,13 +9,13 @@ const pageRef = ref<any>(null)
const state = reactive<any>({
pa: {
pagesize: 10,
type: "2",
type: "3",
},
})
const { startPage, list, scroll } = hooks.usePage(pageRef, merchantApi.page, null, "data.records")
const pageHook = hooks.usePage(pageRef, merchantApi.page, null, "data.records")
const query = (page: number, pagesize: number) => {
startPage(page, pagesize, false, state.pa)
pageHook.startPage(page, pagesize, false, state.pa)
}
onLoad(() => {
@@ -27,6 +27,7 @@ onShow(() => {
})
const toDetail = async (v: any) => {
return
const isLogin = await hooks.useCheckLogin()
if (isLogin) {
router.jump("/pages/shop/detail", { id: v.id })
@@ -40,7 +41,7 @@ const toDetail = async (v: any) => {
ref="pageRef"
height="100%"
:fixed="false"
v-model="list"
v-model="pageHook.list"
:default-page-size="10"
safe-area-inset-bottom
:loading-more-enabled="true"
@@ -48,10 +49,10 @@ const toDetail = async (v: any) => {
@query="query"
:auto-clean-list-when-reload="false"
:auto-scroll-to-top-when-reload="false"
@scroll="scroll"
@scroll="pageHook.scroll"
>
<view class="h-20rpx" />
<view class="flex-col card p-20rpx m-b-20rpx" v-for="(v, i) in list" :key="i" @tap="toDetail(v)">
<view class="flex-col card p-20rpx m-b-20rpx" v-for="(v, i) in pageHook.list" :key="i" @tap="toDetail(v)">
<view class="flex-row-center">
<image class="w-180rpx h-180rpx rounded-12rpx" :src="filePath(v.logoPic)" mode="aspectFill" />
<view class="flex-1 flex-col m-l-20rpx">
@@ -61,7 +62,7 @@ const toDetail = async (v: any) => {
</view>
<view class="second-text-24">{{ v.phone }}</view>
<view class="second-text-24">
<view class="second-text-28">营业时间:</view>
<view v-if="v.jobTime != ',,'" class="second-text-28">营业时间:</view>
<view>{{ v.jobTime?.split(",")[0] ? "早:" + v.jobTime?.split(",")[0] : "" }}</view>
<view>{{ v.jobTime?.split(",")[1] ? "中:" + v.jobTime?.split(",")[1] : "" }}</view>
<view>{{ v.jobTime?.split(",")[2] ? "晚:" + v.jobTime?.split(",")[2] : "" }}</view>
+82 -90
View File
@@ -1,99 +1,91 @@
import fs from "fs";
import stripJsonComments from "./strip-json-comments";
import fs from "fs"
import stripJsonComments from "./strip-json-comments"
class TransformPages {
routes: any = [];
tabbar: any = [];
includes = [];
uniPagesJSON: any = "";
routes: any = []
tabbar: any = []
includes = []
uniPagesJSON: any = ""
constructor({ includes, pagesJsonDir }: any) {
this.includes = includes;
this.uniPagesJSON = JSON.parse(
stripJsonComments(fs.readFileSync(pagesJsonDir, "utf-8"))
);
this.routes = this.getPagesRoutes().concat(this.getSubPackagesRoutes());
this.tabbar = this.getTabbarRoutes();
}
constructor({ includes, pagesJsonDir }: any) {
this.includes = includes
this.uniPagesJSON = JSON.parse(stripJsonComments(fs.readFileSync(pagesJsonDir, "utf-8")))
this.routes = this.getPagesRoutes().concat(this.getSubPackagesRoutes())
this.tabbar = this.getTabbarRoutes()
}
getPagesRoutes(pages = this.uniPagesJSON.pages, rootPath = null) {
let routes = [];
for (let i = 0; i < pages.length; i++) {
const item = pages[i];
let route: any = {};
for (let j = 0; j < this.includes.length; j++) {
const key = this.includes[j];
let value = item[key];
if (key === "path") {
value = rootPath ? `/${rootPath}/${value}` : `/${value}`;
}
if (key === "aliasPath" && i == 0 && rootPath == null) {
route[key] = route[key] || "/";
} else if (value !== undefined) {
route[key] = value;
}
}
routes.push(route);
}
return routes;
}
getPagesRoutes(pages = this.uniPagesJSON.pages, rootPath = null) {
let routes = []
for (let i = 0; i < pages.length; i++) {
const item = pages[i]
let route: any = {}
for (let j = 0; j < this.includes.length; j++) {
const key = this.includes[j]
let value = item[key]
if (key === "path") {
value = rootPath ? `/${rootPath}/${value}` : `/${value}`
}
if (key === "aliasPath" && i == 0 && rootPath == null) {
route[key] = route[key] || "/"
} else if (value !== undefined) {
route[key] = value
}
}
routes.push(route)
}
return routes
}
getSubPackagesRoutes() {
if (!(this.uniPagesJSON && this.uniPagesJSON.subPackages)) {
return [];
}
const subPackages = this.uniPagesJSON.subPackages;
let routes: any = [];
for (let i = 0; i < subPackages.length; i++) {
const subPages = subPackages[i].pages;
const root = subPackages[i].root;
const subRoutes = this.getPagesRoutes(subPages, root);
routes = routes.concat(subRoutes);
}
return routes;
}
getSubPackagesRoutes() {
if (!(this.uniPagesJSON && this.uniPagesJSON.subPackages)) {
return []
}
const subPackages = this.uniPagesJSON.subPackages
let routes: any = []
for (let i = 0; i < subPackages.length; i++) {
const subPages = subPackages[i].pages
const root = subPackages[i].root
const subRoutes = this.getPagesRoutes(subPages, root)
routes = routes.concat(subRoutes)
}
return routes
}
getTabbarRoutes() {
if (
!(
this.uniPagesJSON &&
this.uniPagesJSON.tabBar &&
this.uniPagesJSON.tabBar.list
)
) {
return [];
}
const tabbar = this.uniPagesJSON.tabBar.list;
let tabbarMap: any = [];
tabbar.forEach((bar: { pagePath: string }) => {
tabbarMap.push("/" + bar.pagePath);
});
return tabbarMap;
}
getTabbarRoutes() {
if (!(this.uniPagesJSON && this.uniPagesJSON.tabBar && this.uniPagesJSON.tabBar.list)) {
return []
}
const tabbar = this.uniPagesJSON.tabBar.list
let tabbarMap: any = []
tabbar.forEach((bar: { pagePath: string }) => {
tabbarMap.push("/" + bar.pagePath)
})
return tabbarMap
}
}
export const useRouter = ({ pagesJsonDir, includes = [] }: any) => {
let defaultIncludes = ["path", "aliasPath", "name"];
includes = [...defaultIncludes, ...includes];
let pages = new TransformPages({
pagesJsonDir,
includes,
});
if (pages.tabbar && pages.tabbar.length) {
console.table(pages.tabbar);
}
if (pages.routes && pages.routes.length) {
console.table(pages.routes);
}
return {
name: "use-router",
config() {
return {
define: {
__ROUTES__: JSON.stringify(pages.routes),
__TABBAR__: JSON.stringify(pages.tabbar),
},
};
},
};
};
let defaultIncludes = ["path", "aliasPath", "name"]
includes = [...defaultIncludes, ...includes]
let pages = new TransformPages({
pagesJsonDir,
includes,
})
if (pages.tabbar && pages.tabbar.length) {
console.table(pages.tabbar)
}
if (pages.routes && pages.routes.length) {
console.table(pages.routes)
}
return {
name: "use-router",
config() {
return {
define: {
__ROUTES__: JSON.stringify(pages.routes),
__TABBAR__: JSON.stringify(pages.tabbar),
},
}
},
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 498 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 493 B