更新密码找回uniapp

This commit is contained in:
hero920103 committed 2026-11-16 17:22:50 +08:00
1 parent 7f9a66da0f
commit 3fdda89833
1304 files changed
+3503 -26132

No files matched your search

@@ -107,11 +107,6 @@
</template>
<script setup>
/**
* 商品详情(只读):资料 / 价格 / 库存管控 / 分仓结存。
* 建档与改价一律回 Web 端,这里把「这个货现在有多少、成本多少、卖多少」讲清楚,
* 现场接单或盘库时一眼能判断能不能发。
*/
import { computed, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import {
-6
View File
@@ -79,11 +79,6 @@
</template>
<script setup>
/**
* 商品档案(移动端只读)。
* 建档、改价、启停都在 Web 后台做,手机端只负责「查得到、看得清、点得进」,
* 库存与价格取的正是 Web 端同一批接口字段,两端不会出现两套数。
*/
import { computed, ref } from 'vue'
import { onReachBottom, onShow } from '@dcloudio/uni-app'
import FaIcon from '@/components/FaIcon.vue'
@@ -150,7 +145,6 @@ async function loadCategories() {
product_count: c.product_count || 0
}))
} catch (e) {
// 分类拉不到不影响商品列表,只是筛选栏少一项
}
}
-3
View File
@@ -60,9 +60,6 @@
</template>
<script setup>
/**
* 仓库档案(移动端只读):一屏看清每个仓压了多少货,点进去直接查该仓库存。
*/
import { computed, ref } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import FaIcon from '@/components/FaIcon.vue'
-5
View File
@@ -5,7 +5,6 @@
</view>
<block v-else-if="dash">
<!-- 本月经营 -->
<view class="hero-card">
<view class="hero-main">
<text class="hero-label">本月销售金额</text>
@@ -30,7 +29,6 @@
</view>
</view>
<!-- 指标格子 -->
<view class="kpi-grid">
<view class="kpi-cell" @tap="go('/pages/erp/document/index?doc_type=sales_out')">
<text class="kpi-value">{{ moneyText(today.sales_amount) }}</text>
@@ -58,7 +56,6 @@
</view>
</view>
<!-- 库存预警 -->
<view class="card warn-card">
<view class="block-head">
<text class="block-title">库存预警</text>
@@ -87,7 +84,6 @@
</view>
</view>
<!-- 近 6 个月购销趋势 -->
<view class="card trend-card">
<view class="block-head">
<text class="block-title">近 6 个月购销趋势</text>
@@ -116,7 +112,6 @@
</view>
</view>
<!-- 常用入口 -->
<view class="card entry-card">
<view class="block-head">
<text class="block-title">常用功能</text>
-8
View File
@@ -5,7 +5,6 @@
</view>
<block v-else-if="doc">
<!-- 概要 -->
<view class="head-card">
<view class="head-top">
<text class="head-type">{{ doc.doc_type_label || doc.doc_type }}</text>
@@ -29,7 +28,6 @@
</view>
</view>
<!-- 往来与仓储 -->
<view class="card">
<view class="line">
<text class="line-label">{{ partnerLabel }}</text>
@@ -63,7 +61,6 @@
</view>
</view>
<!-- 明细 -->
<view class="card">
<view class="block-head">
<text class="block-title">商品明细({{ items.length }} 行)</text>
@@ -86,7 +83,6 @@
</view>
</view>
<!-- 审批实例 -->
<view v-if="instance" class="card">
<view class="block-head">
<text class="block-title">审批进度</text>
@@ -116,7 +112,6 @@
</view>
</block>
<!-- 操作栏 -->
<view v-if="doc" class="actions">
<block v-if="isDraft">
<view class="act ghost" @tap="goEdit">编辑</view>
@@ -164,7 +159,6 @@ import {
submitDoc
} from '@/api/erp.js'
/** 已生效单据可继续生成的下游单据(与后端来源单类型白名单一致) */
const NEXT_MAP = {
purchase_order: ['purchase_in'],
sales_order: ['sales_out'],
@@ -257,7 +251,6 @@ async function onApprove() {
uni.showToast({ title: '已审核生效', icon: 'success' })
await load()
} catch (e) {
// 错误提示已由请求层统一弹出
} finally {
busy.value = false
}
@@ -271,7 +264,6 @@ async function onSubmit() {
uni.showToast({ title: instanceId ? '已提交审批' : '已提交', icon: 'success' })
await load()
} catch (e) {
// 未绑定审批流等业务失败已在请求层提示,可退回用「审核生效」
} finally {
busy.value = false
}
-36
View File
@@ -8,7 +8,6 @@
</view>
<block v-else>
<!-- 表头 -->
<view class="card">
<view class="card-head">
<text class="card-title">{{ typeLabel }}</text>
@@ -51,7 +50,6 @@
</view>
</view>
<!-- 明细 -->
<view class="card">
<view class="card-head">
<text class="card-title">商品明细({{ items.length }} 行)</text>
@@ -99,7 +97,6 @@
</view>
</view>
<!-- 金额 -->
<view class="card">
<view class="line">
<text class="line-label">数量合计</text>
@@ -150,7 +147,6 @@
</view>
</block>
<!-- 明细编辑抽屉 -->
<view v-if="itemVisible" class="item-mask" @tap="closeItem">
<view class="item-sheet" @tap.stop>
<view class="sheet-head">
@@ -237,16 +233,6 @@
</template>
<script setup>
/**
* 单据开单 / 草稿编辑页(十类单据共用)。
*
* 表头字段按单据类型动态出现:采购类选供应商、销售类选客户、调拨多一个调入仓库、
* 盘点只需要仓库不需要客商 —— 这些规则全部取自 /api/erp/meta 的 doc_types,
* 与 Web 端 DocEditor、Go 端 erpValidateDocHead 同一份口径,避免端上自己判型判错。
*
* 明细只传可编辑字段:单价留空由后端按价格体系取价,金额由后端重算,
* 保证手机端提交的单与 Web 端算出来的一分不差。
*/
import { computed, reactive, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import FaIcon from '@/components/FaIcon.vue'
@@ -298,7 +284,6 @@ const form = reactive({
const typeDict = ref([])
const meta = ref({ default_warehouse_id: 0, sales_price_type: '', negative_stock: false })
const warehouses = ref([])
/** 商品选择器当前页的原始行,选中后要拿 enable_batch / shelf_life_days / 价格字段 */
const productRows = ref([])
const blocked = ref('')
const saving = ref(false)
@@ -339,7 +324,6 @@ onLoad(async (query = {}) => {
uni.setNavigationBarTitle({ title: typeLabel.value || '开单' })
})
/** 该类型有没有配审批流:有则第二个按钮是「提交审批」,没有就是「直接审核生效」 */
async function loadFlowable() {
if (!form.docType) return
const flows = await fetchDocFlows(form.docType).catch(() => ({ list: [] }))
@@ -389,7 +373,6 @@ async function loadDoc(id) {
syncTypeFields()
}
/** 列表/详情的明细行 → 端上行模型(保留 id 与来源行引用,价格与库存档案快照单独存) */
function toRow(it) {
return {
id: it.id || 0,
@@ -410,8 +393,6 @@ function toRow(it) {
}
}
// ------------------------------------------------------------ 类型派生的表单形态
const typeInfo = computed(() => typeDict.value.find((t) => t.value === form.docType) || {})
const typeLabel = computed(() => typeInfo.value.label || '')
const needWarehouse = computed(() => !!typeInfo.value.affects_stock || isStockTake.value)
@@ -419,7 +400,6 @@ const isTransfer = computed(() => form.docType === 'transfer')
const isStockTake = computed(() => form.docType === 'stock_take')
const partnerRequired = computed(() => !!typeInfo.value.partner_type)
/** 需要往来单位时才出现客商行;调拨多一行调入仓库 */
const headRows = computed(() => {
const rows = []
if (needWarehouse.value) {
@@ -461,7 +441,6 @@ const headRows = computed(() => {
return rows
})
/** 允许的来源单据类型(与 Go 端 docTypeSources 一致) */
const sourceTypes = computed(() => {
switch (form.docType) {
case 'purchase_in':
@@ -506,8 +485,6 @@ function applyDefaultWarehouse() {
}
}
// ------------------------------------------------------------ 选择器
function openPicker(key) {
picker.key = key
picker.loading = false
@@ -645,8 +622,6 @@ function docTypeText(type) {
return (typeDict.value.find((t) => t.value === type) || {}).label || type
}
// ------------------------------------------------------------ 明细
const showBatch = computed(() => !!draft.enable_batch || !!draft.batch_no || isStockTake.value)
const batchRequired = computed(() => Number(draft.enable_batch) === 1 && form.docType === 'purchase_in')
const showProductDate = computed(
@@ -697,7 +672,6 @@ function fillDraftProduct(p) {
loadStockHint(p.id)
}
/** 预警/补货页带商品过来开单:直接铺好一行,用户只补供应商和数量 */
async function prefillProduct(id, quantity) {
try {
const p = await getProduct(id)
@@ -716,11 +690,9 @@ async function prefillProduct(id, quantity) {
}
]
} catch (e) {
// 商品拉不到就让用户手动加行,不拦开单入口
}
}
/** 与 Go 端 erpPickPrice 同规则:采购价/销售价按租户价格体系回落 */
function pickPrice(p) {
const type = form.docType
if (['purchase_order', 'purchase_in', 'purchase_return', 'other_in'].includes(type)) {
@@ -739,7 +711,6 @@ function pickPrice(p) {
async function loadStockHint(productId) {
stockText.value = ''
if (!typeInfo.value.affects_stock || !form.warehouseId || !productId) return
// 同一商品可能有多批次行,按商品聚合才是这一仓真正可发的量
const { list } = await fetchStocks({ warehouseId: form.warehouseId, productId, groupBy: 'product', pageSize: 1 })
const row = list[0]
if (!row) {
@@ -800,7 +771,6 @@ const actualAmount = computed(() => {
return Math.max(0, totalAmount.value - minus)
})
/** 盘点:按仓库账面库存铺行,盘点员只改实盘数 */
async function loadTakeSheet() {
const rows = await fetchTakeSheet(form.warehouseId)
if (!rows.length) {
@@ -821,7 +791,6 @@ async function loadTakeSheet() {
uni.showToast({ title: `已载入 ${rows.length} 行`, icon: 'none' })
}
/** 订单转入库/出库:按「下单量 - 已执行量」带出,行 ID 作为 ref_item_id 供后端做超收校验 */
async function pullFromSource() {
if (!form.sourceDocId) return
const data = await fetchExecutableDocs(form.sourceDocId)
@@ -861,7 +830,6 @@ async function pullFromSource() {
})
}
/** 从详情页「生成下游单」进入:带出来源单号、客商、仓库与可执行明细 */
async function attachSource(id) {
form.sourceDocId = Number(id)
const doc = await getDoc(id)
@@ -878,8 +846,6 @@ async function attachSource(id) {
await pullFromSource()
}
// ------------------------------------------------------------ 保存
function headCheck() {
if (!form.docType) return '缺少单据类型'
if (!form.bizDate) return '请选择业务日期'
@@ -935,13 +901,11 @@ async function onSave(thenGo) {
if (thenGo) await advance(id)
else uni.showToast({ title: '草稿已保存', icon: 'success' })
} catch (e) {
// 具体原因由请求层 toast,这里只负责不吞掉「已保存但提交失败」这种半成功状态
} finally {
saving.value = false
}
}
/** 提交审批:未配置审批流时直接审核生效,与 Web 端按钮语义一致 */
async function advance(id) {
if (flowable.value) {
await submitDoc(id, 0)
-1
View File
@@ -220,7 +220,6 @@ async function loadDictionaries() {
docTypes.value = types
warehouses.value = houses
} catch (e) {
// 字典失败不影响列表,筛选降级为「全部」
}
}
-4
View File
@@ -115,10 +115,6 @@
</template>
<script setup>
/**
* 往来账单详情:核销进度、逐笔核销来源、关联的收付款单与原始单据明细。
* funds 是后端按核销记录聚合出来的收付款单字典,核销行靠 fund_bill_id 反查单号与方式。
*/
import { computed, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import FaIcon from '@/components/FaIcon.vue'
-5
View File
@@ -105,10 +105,6 @@
</template>
<script setup>
/**
* 应收应付账单列表。
* 「未收/未付合计」用的是接口随列表返回的全量汇总,不是本页累加,翻页也不会跳数。
*/
import { computed, ref } from 'vue'
import { onLoad, onReachBottom, onShow } from '@dcloudio/uni-app'
import FaIcon from '@/components/FaIcon.vue'
@@ -195,7 +191,6 @@ async function loadPage() {
function switchType(value) {
if (billType.value === value) return
billType.value = value
// 应收只看客户、应付只看供应商,跨类型带的客商筛选必须一起清掉
partnerId.value = ''
partnerName.value = ''
refresh()
-10
View File
@@ -5,7 +5,6 @@
<u-tag :text="fundStatusLabel(status)" :type="fundStatusType(status)" size="mini" />
</view>
<!-- 单据信息 -->
<view class="form-card">
<view class="field">
<text class="field-label">款项类型 <text class="required">*</text></text>
@@ -102,7 +101,6 @@
</view>
</view>
<!-- 核销:收款/付款 + 已选往来单位时才出现 -->
<view v-if="showSettle" class="settle-card">
<view class="settle-head">
<text class="settle-title">核销往来账</text>
@@ -204,11 +202,6 @@
</template>
<script setup>
/**
* 收付款开单 / 查看。
* 草稿只是登记,确认那一刻后端才写核销明细并回写往来账余额;
* 已确认的单不可改,只能作废(余额同步回滚),所以 view 模式复用同一张表单只读渲染。
*/
import { computed, reactive, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import FaIcon from '@/components/FaIcon.vue'
@@ -281,7 +274,6 @@ onLoad(async (query = {}) => {
if (query.id) {
await loadFund(Number(query.id))
} else if (needPartner.value && form.partnerId) {
// 从账单详情跳过来时把这张账单预勾选,金额默认取未结额
await loadBills(Number(query.bill_id || 0))
}
})
@@ -312,7 +304,6 @@ async function loadFund(id) {
async function onType(value) {
if (Number(form.fundType) === Number(value)) return
form.fundType = Number(value)
// 收款只核客户应收、付款只核供应商应付,切换后原往来单位与勾选一并作废
form.partnerId = 0
form.partnerName = ''
clearPicks()
@@ -463,7 +454,6 @@ async function onDelete() {
})
}
/** 列表页跳来的栈可能是账单详情,优先回到它的来源列表 */
function back() {
const pages = getCurrentPages()
if (pages.length > 1) uni.navigateBack()
-5
View File
@@ -107,10 +107,6 @@
</template>
<script setup>
/**
* 收付款单列表。四类单据共用一页,靠 fund_type 分流。
* 草稿只登记不核销,确认后后端才写核销明细并回写往来账余额。
*/
import { computed, ref } from 'vue'
import { onLoad, onReachBottom, onShow } from '@dcloudio/uni-app'
import FaIcon from '@/components/FaIcon.vue'
@@ -131,7 +127,6 @@ const status = ref('')
const keyword = ref('')
const dateFrom = ref('')
const dateTo = ref('')
/** 从客商页带过来时只看这一家的收付款 */
const partnerScope = ref('')
const sumText = computed(() => {
-5
View File
@@ -3,10 +3,5 @@
</template>
<script setup>
/**
* erp 子系统 · functions 页。
* 页面逻辑全部收敛在 components/sub/SubXxx.vue,这里只做 slug 绑定,
* 便于统一维护;该子系统拥有独立的页面目录与独立 tabbar。
*/
import SubFunctions from '@/components/sub/SubFunctions.vue'
</script>
-5
View File
@@ -3,10 +3,5 @@
</template>
<script setup>
/**
* erp 子系统 · home 页。
* 页面逻辑全部收敛在 components/sub/SubXxx.vue,这里只做 slug 绑定,
* 便于统一维护;该子系统拥有独立的页面目录与独立 tabbar。
*/
import SubHome from '@/components/sub/SubHome.vue'
</script>
-5
View File
@@ -3,10 +3,5 @@
</template>
<script setup>
/**
* erp 子系统 · 我的页。
* 页面逻辑全部收敛在 components/sub/SubMine.vue,这里只做 slug 绑定,
* 便于统一维护;该子系统拥有独立的页面目录与独立 tabbar。
*/
import SubMine from '@/components/sub/SubMine.vue'
</script>
-6
View File
@@ -96,11 +96,6 @@
</template>
<script setup>
/**
* 客商详情:档案 + 未结账单 + 一键收付款。
* 余额口径直接取往来账(bill)与对账汇总,和 Web 端「应收应付」页一致,
* 端上不另算一套,避免业务在手机上看到的欠款跟财务对不上。
*/
import { computed, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import {
@@ -155,7 +150,6 @@ async function load() {
profile.value = p
bills.value = b.list || []
billTotal.value = b.total || 0
// 对账汇总按 partner_type:id 归并,这里只取当前这一家
summary.value = rows.find((r) => Number(r.partner_id) === partnerId.value) || {}
} catch (e) {
uni.showToast({ title: '客商信息加载失败', icon: 'none' })
-4
View File
@@ -64,10 +64,6 @@
</template>
<script setup>
/**
* 客商列表(供应商 / 客户同一个页,靠 partner_type 分流)。
* 与后端 partner/list 一致:只列正式启用、有归属的对象,公海客户不参与开单也不在这里出现。
*/
import { computed, ref } from 'vue'
import { onLoad, onReachBottom, onShow } from '@dcloudio/uni-app'
import FaIcon from '@/components/FaIcon.vue'
-15
View File
@@ -34,7 +34,6 @@
<text class="quick" @tap="useQuick">近30天</text>
</view>
<!-- 购销汇总:方向 + 维度 -->
<view v-if="tab === 'summary'" class="chip-row">
<view
v-for="s in SIDES"
@@ -51,7 +50,6 @@
</view>
</view>
<!-- 排行:榜单方向 + 条数 -->
<view v-else-if="tab === 'rank'" class="chip-row">
<view class="chip" :class="{ active: order === 'desc' }" @tap="onOrder('desc')">
<text>热销榜</text>
@@ -65,7 +63,6 @@
</view>
</view>
<!-- 收发存:仓库 + 关键字 -->
<template v-else-if="tab === 'move'">
<view class="chip-row">
<view class="chip" :class="{ active: !!warehouseId }" @tap="openWarehouse">
@@ -89,7 +86,6 @@
<text class="state-text">统计中...</text>
</view>
<!-- 购销汇总 -->
<template v-else-if="tab === 'summary'">
<view class="kpi-row">
<view class="kpi">
@@ -113,7 +109,6 @@
</view>
</template>
<!-- 热销 / 滞销排行 -->
<template v-else-if="tab === 'rank'">
<view v-if="!rank.list.length" class="state-box">
<u-empty mode="search" text="暂无排行数据" />
@@ -128,7 +123,6 @@
</view>
</template>
<!-- 收发存汇总 -->
<template v-else-if="tab === 'move'">
<view class="kpi-row">
<view class="kpi">
@@ -181,7 +175,6 @@
</view>
</template>
<!-- 毛利分析 -->
<template v-else-if="tab === 'profit'">
<view class="hero-card">
<view class="hero-line">
@@ -218,7 +211,6 @@
</view>
</template>
<!-- 账龄分析 -->
<template v-else-if="tab === 'aging'">
<view v-for="side in AGING_SIDES" :key="side.key" class="ag-block">
<view class="ag-head">
@@ -253,7 +245,6 @@
</view>
</template>
<!-- 资金流水 -->
<template v-else>
<view class="kpi-row">
<view class="kpi">
@@ -298,10 +289,6 @@
</template>
<script setup>
/**
* 报表中心。所有口径都直接取后端结果,端上不再二次汇总:
* 购销汇总的退货冲减、毛利的实际出库成本、收发存的期初倒推,与 Web 端同一份 core。
*/
import { computed, ref } from 'vue'
import { onLoad, onReachBottom } from '@dcloudio/uni-app'
import FaIcon from '@/components/FaIcon.vue'
@@ -400,7 +387,6 @@ function onDate(key, e) {
run()
}
/** 报表默认看最近一个周转周期,空区间会把「没数据」误读成「没配好」 */
function useQuick() {
const to = new Date()
const from = new Date(to.getTime() - 29 * 86400000)
@@ -433,7 +419,6 @@ async function run() {
else if (tab.value === 'aging') await loadAging()
else await loadCash()
} catch (e) {
// 单个报表失败只清当前视图,不影响切到其他 tab 再看
} finally {
loading.value = false
}
-5
View File
@@ -102,10 +102,6 @@
</template>
<script setup>
/**
* 批次与效期台账。批次只从入库流水回溯到期日,未登记效期的批次到期列留空不算异常。
* 点行跳到该商品+该批次的收发流水,做效期倒查不用再手动筛。
*/
import { computed, ref } from 'vue'
import { onLoad, onReachBottom, onShow } from '@dcloudio/uni-app'
import FaIcon from '@/components/FaIcon.vue'
@@ -159,7 +155,6 @@ async function loadWarehouses() {
try {
warehouses.value = await fetchWarehouses({ onlyEnabled: true })
} catch (e) {
// 仓库字典拉不到只是不能按仓筛
}
}
-8
View File
@@ -102,11 +102,6 @@
</template>
<script setup>
/**
* 库存结存查询。
* 默认「分仓分批次」逐行看,切到「按商品汇总」看总量;
* 货值 = 数量 × 移动加权成本,与报表中心收发存汇总同源。
*/
import { computed, ref } from 'vue'
import { onLoad, onReachBottom, onShow } from '@dcloudio/uni-app'
import FaIcon from '@/components/FaIcon.vue'
@@ -135,7 +130,6 @@ const safetyState = ref('')
const groupByProduct = ref(false)
const onlyStock = ref(true)
const warehouses = ref([])
/** 从商品详情跳过来时锁定单个商品,端上把 id 存下来随查询一起下发 */
const productId = ref('')
const picker = ref({ show: false })
@@ -174,7 +168,6 @@ async function loadWarehouses() {
try {
warehouses.value = await fetchWarehouses({ onlyEnabled: true })
} catch (e) {
// 仓库列表拉不到不影响查询,只是不能按仓筛
}
}
@@ -321,7 +314,6 @@ function openProduct(row) {
.state-scroll {
margin-top: 16rpx;
white-space: nowrap;
/* scroll-view 不设 border-box,左右内边距会把最后几个标签顶出屏幕 */
box-sizing: border-box;
}
-6
View File
@@ -110,10 +110,6 @@
</template>
<script setup>
/**
* 收发存流水台账。每行是「某商品某仓库某批次」的一次变动,前滚后结存直接可核对。
* 商品维度可能上千,筛商品走服务端搜索;单据号点行可回到来源单据详情。
*/
import { computed, ref } from 'vue'
import { onLoad, onReachBottom, onShow } from '@dcloudio/uni-app'
import FaIcon from '@/components/FaIcon.vue'
@@ -155,7 +151,6 @@ const pickerTitle = computed(() =>
({ warehouse: '选择仓库', product: '选择商品', docType: '选择单据类型' })[picker.value.key] || '请选择'
)
/** 从商品/批次页带条件跳进来时,把锁定条件显式画出来,免得用户对着半屏数据找原因 */
const filterText = computed(() =>
[productName.value, batchNo.value ? `批次 ${batchNo.value}` : ''].filter(Boolean).join(' · ')
)
@@ -189,7 +184,6 @@ async function loadDicts() {
try {
warehouses.value = await fetchWarehouses({ onlyEnabled: true })
} catch (e) {
// 字典拉不到只是不能筛,流水本身仍可查看
}
}
if (!docTypes.value.length) {
-5
View File
@@ -113,11 +113,6 @@
</template>
<script setup>
/**
* 库存预警与智能补货。
* 四类预警一次取回(同源同一份结存快照),切 tab 只换视图不重复打接口;
* 补货建议口径更重(含近30天销量与在途),单独按需拉。
*/
import { computed, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import FaIcon from '@/components/FaIcon.vue'
-5
View File
@@ -3,10 +3,5 @@
</template>
<script setup>
/**
* erp 子系统 · todo 页。
* 页面逻辑全部收敛在 components/sub/SubXxx.vue,这里只做 slug 绑定,
* 便于统一维护;该子系统拥有独立的页面目录与独立 tabbar。
*/
import SubTodo from '@/components/sub/SubTodo.vue'
</script>