This commit is contained in:
2025-09-20 18:03:22 +08:00
parent d857eca39f
commit d343a1389a
35 changed files with 330 additions and 141 deletions

View File

@@ -126,7 +126,7 @@ export default {
} finally { this.loading = false }
},
formatDate(s) { if (!s) return ''; try { const d = new Date(s); const pad = n => String(n).padStart(2, '0'); return `${d.getFullYear()}-${pad(d.getMonth()+1)}-${pad(d.getDate())}` } catch (_) { return String(s).slice(0,10) } },
onCreate() { if (this.biz === 'sale') { uni.navigateTo({ url: '/pages/order/create' }); return } uni.showToast({ title: '该类型创建页待实现', icon: 'none' }) },
onCreate() { if (this.biz === 'sale') { uni.switchTab({ url: '/pages/order/create' }); return } uni.showToast({ title: '该类型创建页待实现', icon: 'none' }) },
openDetail(it) { uni.showToast({ title: '详情开发中', icon: 'none' }) }
}
}

View File

@@ -50,7 +50,7 @@
<text class="section-text">常用功能</text>
</view>
<!-- 功能九宫格玻璃容器 + 圆角方形图标 -->
<!-- 功能九宫格玻璃容器 + 圆角方形图标 -->
<view class="grid-wrap">
<view class="grid">
<view class="grid-item" v-for="item in features" :key="item.key" @click="onFeatureTap(item)">
@@ -64,32 +64,13 @@
</view>
</view>
<!-- 底部操作条 -->
<view class="bottom-bar">
<view class="tab" :class="{ active: activeTab==='home' }" @click="activeTab='home'">
<text>首页</text>
</view>
<view class="tab" :class="{ active: activeTab==='product' }" @click="goProduct">
<text>货品</text>
</view>
<view class="tab primary" @click="onCreateOrder">
<text>开单</text>
</view>
<view class="tab" :class="{ active: activeTab==='detail' }" @click="goDetail">
<text>明细</text>
</view>
<view class="tab" :class="{ active: activeTab==='report' }" @click="goReport">
<text>报表</text>
</view>
<view class="tab" :class="{ active: activeTab==='me' }" @click="goMe">
<text>我的</text>
</view>
</view>
<!-- 底部操作条改为原生 tabBar移除自定义栏 -->
</view>
</template>
<script>
import { get } from '../../common/http.js'
import { ROUTES } from '../../common/constants.js'
export default {
data() {
return {
@@ -147,14 +128,15 @@
this.loadingNotices = false
}
},
onFeatureTap(item) {
onFeatureTap(item) {
if (item.key === 'product') {
uni.navigateTo({ url: '/pages/product/list' })
uni.switchTab({ url: '/pages/product/list' })
return
}
if (item.key === 'sale') {
// 进入开单页并预选“销售-出货”
uni.navigateTo({ url: '/pages/order/create?biz=sale&type=out' })
// 进入开单页并预选“销售-出货”
try { uni.setStorageSync('ORDER_DEFAULT_PARAMS', { biz: 'sale', type: 'out' }) } catch(e) {}
uni.switchTab({ url: '/pages/order/create' })
return
}
if (item.key === 'customer') {
@@ -171,42 +153,31 @@
return
}
if (item.key === 'purchase') {
// 进入开单页并预选“进货-进货”
uni.navigateTo({ url: '/pages/order/create?biz=purchase&type=in' })
return
}
if (item.key === 'report') {
// 直接进入报表页
uni.navigateTo({ url: '/pages/report/index' })
// 进入开单页并预选“进货-进货”
try { uni.setStorageSync('ORDER_DEFAULT_PARAMS', { biz: 'purchase', type: 'in' }) } catch(e) {}
uni.switchTab({ url: '/pages/order/create' })
return
}
if (item.key === 'report') {
// 报表非 tab 页,使用 navigateTo 进入
uni.navigateTo({ url: ROUTES.report })
return
}
if (item.key === 'otherPay') {
// 进入开单页并预选“其他支出”
uni.navigateTo({ url: '/pages/order/create?biz=expense' })
// 进入开单页并预选“其他支出”
try { uni.setStorageSync('ORDER_DEFAULT_PARAMS', { biz: 'expense' }) } catch(e) {}
uni.switchTab({ url: '/pages/order/create' })
return
}
uni.showToast({ title: item.title + '(开发中)', icon: 'none' })
},
goProduct() {
this.activeTab = 'product'
uni.navigateTo({ url: '/pages/product/list' })
},
onCreateOrder() {
uni.navigateTo({ url: '/pages/order/create' })
},
goDetail() {
this.activeTab = 'detail'
try { console.log('[index] goDetail → /pages/detail/index') } catch(e){}
uni.navigateTo({ url: '/pages/detail/index' })
},
goReport() {
this.activeTab = 'report'
uni.navigateTo({ url: '/pages/report/index' })
},
goMe() {
this.activeTab = 'me'
uni.navigateTo({ url: '/pages/my/index' })
},
goProduct() { uni.switchTab({ url: '/pages/product/list' }) },
onCreateOrder() { uni.switchTab({ url: '/pages/order/create' }) },
goDetail() {
try { console.log('[index] goDetail → /pages/detail/index') } catch(e){}
uni.switchTab({ url: '/pages/detail/index' })
},
goMe() { uni.switchTab({ url: '/pages/my/index' }) },
onNoticeTap(n) {
uni.showModal({
title: '广告',

View File

@@ -106,7 +106,7 @@ export default {
this.avatarUrl = '/static/logo.png'
},
goVip() { uni.showToast({ title: 'VIP会员开发中', icon: 'none' }) },
goMyOrders() { uni.navigateTo({ url: '/pages/detail/index' }) },
goMyOrders() { uni.switchTab({ url: '/pages/detail/index' }) },
goSupplier() { uni.navigateTo({ url: '/pages/supplier/select' }) },
goCustomer() { uni.navigateTo({ url: '/pages/customer/select' }) },
goCustomerQuote() { uni.showToast({ title: '客户报价(开发中)', icon: 'none' }) },

View File

@@ -203,8 +203,11 @@
},
onLoad(query) {
try {
const biz = query && query.biz
const type = query && query.type
// 1) 优先读取本地预设参数(来自首页九宫格)
const preset = uni.getStorageSync('ORDER_DEFAULT_PARAMS') || {}
// 2) 再读取路由 query 作为兜底(兼容历史调用)
const biz = (query && query.biz) || preset.biz
const type = (query && query.type) || preset.type
if (biz === 'sale' || biz === 'purchase' || biz === 'income' || biz === 'expense') {
this.biz = biz
}
@@ -214,6 +217,8 @@
if (this.biz === 'purchase' && (type === 'in' || type === 'return' || type === 'pay')) {
this.purchaseType = type
}
// 一次性参数,读取后清空
try { uni.removeStorageSync('ORDER_DEFAULT_PARAMS') } catch(_) {}
} catch(e) {}
this.fetchCategories()
},

View File