更新密码找回uniapp
This commit is contained in:
1 parent
7f9a66da0f
commit
3fdda89833
1304 files changed
+3503
-26132
No files matched your search
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user