From b973bcee308e99b5fd8a69640f11069e810346f4 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期二, 27 一月 2026 16:37:55 +0800
Subject: [PATCH] 采购台账重构
---
src/pages/procurementManagement/procurementLedger/index.vue | 384 ++++----
src/api/procurementManagement/procurementLedger.js | 7
src/pages/procurementManagement/procurementLedger/detail.vue | 2237 +++++++++++++++++++++++++++++++------------------
3 files changed, 1,615 insertions(+), 1,013 deletions(-)
diff --git a/src/api/procurementManagement/procurementLedger.js b/src/api/procurementManagement/procurementLedger.js
index 9fb284e..0a05d2e 100644
--- a/src/api/procurementManagement/procurementLedger.js
+++ b/src/api/procurementManagement/procurementLedger.js
@@ -72,3 +72,10 @@
method: "get",
});
}
+export function approveProcessGetInfo(query) {
+ return request({
+ url: '/approveProcess/get',
+ method: 'get',
+ params: query,
+ })
+}
\ No newline at end of file
diff --git a/src/pages/procurementManagement/procurementLedger/detail.vue b/src/pages/procurementManagement/procurementLedger/detail.vue
index 995cf3d..de6f687 100644
--- a/src/pages/procurementManagement/procurementLedger/detail.vue
+++ b/src/pages/procurementManagement/procurementLedger/detail.vue
@@ -1,875 +1,1442 @@
<template>
<view class="account-detail">
<!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
- <PageHeader title="鍙拌处璇︽儏" @back="goBack" />
-
- <!-- 琛ㄥ崟鍖哄煙 -->
- <up-form @submit="onSubmit" label-width="110" ref="formRef" :rules="rules" :model="form">
- <up-form-item label="閲囪喘鍚堝悓鍙�" prop="purchaseContractNumber">
- <up-input v-model="form.purchaseContractNumber" placeholder="鑷姩鐢熸垚" disabled />
- </up-form-item>
- <up-form-item
- label="閿�鍞悎鍚屽彿"
- prop="salesContractNo"
- required
- @click="showPicker = true"
- >
- <up-input
- v-model="form.salesContractNo"
- readonly=""
- @click="showPicker = true"
- placeholder="鐐瑰嚮閫夋嫨閿�鍞悎鍚屽彿"
- />
- <template #right>
- <up-icon
- name="arrow-right"
- @click="showPicker = true"
- ></up-icon>
- </template>
- </up-form-item>
- <up-form-item
- label="渚涘簲鍟嗗悕绉�"
- prop="supplierName"
- required
- @click="showCustomerPicker = true"
- >
- <up-input
- v-model="form.supplierName"
- readonly=""
- @click="showCustomerPicker = true"
- placeholder="鐐瑰嚮閫夋嫨渚涘簲鍟�"
- />
- <template #right>
- <up-icon
- name="arrow-right"
- @click="showCustomerPicker = true"
- ></up-icon>
- </template>
- </up-form-item>
- <up-form-item label="椤圭洰鍚嶇О" prop="projectName" required >
- <up-input
- v-model="form.projectName"
- placeholder="璇疯緭鍏ラ」鐩悕绉�"
- />
- </up-form-item>
- <up-form-item label="浠樻鏂瑰紡" prop="paymentMethod" >
- <up-input v-model="form.paymentMethod" placeholder="璇疯緭鍏ヤ粯娆炬柟寮�" />
- </up-form-item>
- <up-form-item label="褰曞叆浜�" prop="recorderName" >
- <up-input v-model="form.recorderName" placeholder="璇疯緭鍏�" disabled />
- </up-form-item>
- <up-form-item label="褰曞叆鏃ユ湡" prop="entryDate" >
- <up-input v-model="form.entryDate" placeholder="璇疯緭鍏�" disabled />
- </up-form-item>
-
- <!-- 閿�鍞悎鍚屽彿閫夋嫨 -->
- <up-action-sheet
- :show="showPicker"
- :actions="salesContractActionList"
- title="閫夋嫨閿�鍞悎鍚屽彿"
- @select="onSalesmanSelect"
- @close="showPicker = false"
- />
-
- <!-- 渚涘簲鍟嗛�夋嫨 -->
- <up-action-sheet
- :show="showCustomerPicker"
- :actions="supplierActionList"
- title="閫夋嫨渚涘簲鍟�"
- @select="onCustomerSelect"
- @close="showCustomerPicker = false"
- />
-
- <!-- 浜у搧澶х被閫夋嫨鍣� -->
- <up-popup :show="showCategoryPicker" mode="bottom">
- <!-- 澶撮儴鎸夐挳鍖哄煙 -->
- <view class="popup-header">
- <view @click="showCategoryPicker = false" class="cancelButton">鍙栨秷</view>
- <view @click="confirmCategorySelection" class="confirmButton">纭畾</view>
- </view>
- <u-tree
- :data="productOptions"
- :props="defaultProps"
- show-checkbox
- default-expand-all
- check-strictly
- @check-change="onCategoryConfirm"
- />
- </up-popup>
-
- <!-- 瑙勬牸鍨嬪彿閫夋嫨鍣� -->
- <up-action-sheet
- :show="showSpecificationPicker"
- :actions="specificationActionList"
- title="閫夋嫨瑙勬牸鍨嬪彿"
- @select="onSpecificationSelect"
- @close="showSpecificationPicker = false"
- />
-
- <!-- 绋庣巼閫夋嫨鍣� -->
- <up-action-sheet
- :show="showTaxRatePicker"
- :actions="taxRateActionList"
- title="閫夋嫨绋庣巼"
- @select="onTaxRateSelect"
- @close="showTaxRatePicker = false"
- />
-
- <!-- 鍙戠エ绫诲瀷閫夋嫨鍣� -->
- <up-action-sheet
- :show="showInvoiceTypePicker"
- :actions="invoiceTypeActionList"
- title="閫夋嫨鍙戠エ绫诲瀷"
- @select="onInvoiceTypeSelect"
- @close="showInvoiceTypePicker = false"
- />
- <!-- 浜у搧淇℃伅 -->
- <view class="product-section">
- <view class="section-header">
- <view>
- <text class="section-title">浜у搧淇℃伅</text>
- </view>
- <view>
- <up-button type="primary" size="small" @click="addProduct" class="add-btn" v-if="operationType !== 'view'">
- 鏂板
- </up-button>
- </view>
- </view>
- <view class="product-card" v-for="(product, idx) in productData" :key="idx">
- <!-- 浜у搧绫� -->
- <view class="product-header">
- <view class="product-title">
- <up-icon name="file-text" size="16" color="#2979ff"></up-icon>
- <text class="product-productCategory">浜у搧 {{ idx + 1 }}</text>
- </view>
- <!-- 鎿嶄綔鎸夐挳 -->
- <view class="product-actions" v-if="operationType !== 'view'">
- <up-button type="error" size="mini" @click="removeProduct(idx)" class="del-btn">
- 鍒犻櫎
- </up-button>
- </view>
- </view>
-
- <!-- 浜у搧淇℃伅琛ㄥ崟 -->
- <view class="product-form">
- <!-- 浜у搧澶х被 -->
- <up-form-item
- label="浜у搧澶х被"
- prop="productCategory"
- required
- :rules="productRules"
- >
- <up-input
- v-model="product.productCategory"
- readonly
- placeholder="璇烽�夋嫨"
- @click="openCategoryPicker(idx)"
- />
- <template #right>
- <up-icon
- name="arrow-right"
- @click="showCategoryPicker = true"
- ></up-icon>
- </template>
- </up-form-item>
-
- <!-- 瑙勬牸鍨嬪彿 -->
- <up-form-item
- label="瑙勬牸鍨嬪彿"
- prop="specificationModel"
- required
- :rules="productRules"
- >
- <up-input
- v-model="product.specificationModel"
- readonly
- placeholder="璇烽�夋嫨"
- @click="openSpecificationPicker(idx)"
- />
- <template #right>
- <up-icon
- name="arrow-right"
- @click="showSpecificationPicker = true"
- ></up-icon>
- </template>
- </up-form-item>
-
- <!-- 鍗曚綅 -->
- <up-form-item
- label="鍗曚綅"
- prop="unit"
- required
- :rules="productRules"
- >
- <up-input
- v-model="product.unit"
- placeholder="璇疯緭鍏�"
- />
- </up-form-item>
-
- <!-- 绋庣巼 -->
- <up-form-item
- label="绋庣巼(%)"
- prop="taxRate"
- required
- :rules="productRules"
- >
- <up-input
- v-model="product.taxRate"
- readonly
- placeholder="璇烽�夋嫨"
- @click="openTaxRatePicker(idx)"
- />
- <template #right>
- <up-icon
- name="arrow-right"
- @click="showTaxRatePicker = true"
- ></up-icon>
- </template>
- </up-form-item>
-
- <!-- 鍚◣鍗曚环 -->
- <up-form-item
- label="鍚◣鍗曚环(鍏�)"
- prop="taxInclusiveUnitPrice"
- required
- :rules="productRules"
- >
- <up-input
- v-model="product.taxInclusiveUnitPrice"
- type="number"
- placeholder="璇疯緭鍏�"
- @blur="formatTaxPrice(idx)"
- />
- </up-form-item>
-
- <!-- 鏁伴噺 -->
- <up-form-item
- label="鏁伴噺"
- prop="quantity"
- required
- :rules="productRules"
- >
- <up-input
- v-model="product.quantity"
- type="number"
- placeholder="璇疯緭鍏�"
- @blur="formatAmount(idx)"
- />
- </up-form-item>
-
- <!-- 鍚◣鎬讳环 -->
- <up-form-item
- label="鍚◣鎬讳环(鍏�)"
- prop="taxInclusiveTotalPrice"
- required
- :rules="productRules"
- >
- <up-input
- v-model="product.taxInclusiveTotalPrice"
- type="number"
- placeholder="璇疯緭鍏�"
- @blur="formatTaxTotal(idx)"
- />
- </up-form-item>
-
- <!-- 涓嶅惈绋庢�讳环 -->
- <up-form-item
- label="涓嶅惈绋庢�讳环(鍏�)"
- prop="taxExclusiveTotalPrice"
- required
- :rules="productRules"
- >
- <up-input
- v-model="product.taxExclusiveTotalPrice"
- type="number"
- placeholder="璇疯緭鍏�"
- @blur="formatNoTaxTotal(idx)"
- />
- </up-form-item>
-
- <!-- 鍙戠エ绫诲瀷 -->
- <up-form-item
- label="鍙戠エ绫诲瀷"
- prop="invoiceType"
- required
- :rules="productRules"
- >
- <up-input
- v-model="product.invoiceType"
- readonly
- placeholder="璇烽�夋嫨"
- @click="openInvoiceTypePicker(idx)"
- />
- <template #right>
- <up-icon
- name="arrow-right"
- @click="showInvoiceTypePicker = true"
- ></up-icon>
- </template>
- </up-form-item>
- </view>
- </view>
- </view>
-
- <!-- 浣跨敤鍏叡搴曢儴鎸夐挳缁勪欢 -->
- <FooterButtons
- :show="operationType !== 'view'"
- cancelText="鍙栨秷"
- confirmText="淇濆瓨"
- @cancel="goBack"
- @confirm="onSubmit"
- />
- </up-form>
+ <PageHeader title="鍙拌处璇︽儏"
+ @back="goBack" />
+ <!-- 琛ㄥ崟鍖哄煙 -->
+ <up-form @submit="onSubmit"
+ label-width="110"
+ ref="formRef"
+ :rules="rules"
+ :model="form">
+ <up-form-item label="閲囪喘鍚堝悓鍙�"
+ prop="purchaseContractNumber">
+ <up-input v-model="form.purchaseContractNumber"
+ placeholder="鑷姩鐢熸垚"
+ disabled />
+ </up-form-item>
+ <up-form-item label="閿�鍞悎鍚屽彿"
+ prop="salesContractNo"
+ required
+ @click="showPicker = true">
+ <up-input v-model="form.salesContractNo"
+ readonly=""
+ @click="showPicker = true"
+ placeholder="鐐瑰嚮閫夋嫨閿�鍞悎鍚屽彿" />
+ <template #right>
+ <up-icon name="arrow-right"
+ @click="showPicker = true"></up-icon>
+ </template>
+ </up-form-item>
+ <up-form-item label="渚涘簲鍟嗗悕绉�"
+ prop="supplierName"
+ required
+ @click="showCustomerPicker = true">
+ <up-input v-model="form.supplierName"
+ readonly=""
+ @click="showCustomerPicker = true"
+ placeholder="鐐瑰嚮閫夋嫨渚涘簲鍟�" />
+ <template #right>
+ <up-icon name="arrow-right"
+ @click="showCustomerPicker = true"></up-icon>
+ </template>
+ </up-form-item>
+ <up-form-item label="椤圭洰鍚嶇О"
+ prop="projectName"
+ required>
+ <up-input v-model="form.projectName"
+ placeholder="璇疯緭鍏ラ」鐩悕绉�" />
+ </up-form-item>
+ <up-form-item label="浠樻鏂瑰紡"
+ prop="paymentMethod">
+ <up-input v-model="form.paymentMethod"
+ placeholder="璇疯緭鍏ヤ粯娆炬柟寮�" />
+ </up-form-item>
+ <up-form-item label="绛捐鏃ユ湡"
+ required
+ prop="executionDate">
+ <up-input v-model="form.executionDate"
+ placeholder="璇烽�夋嫨"
+ readonly="" />
+ <template #right>
+ <up-icon name="arrow-right"
+ @click="showTimePicker = true"></up-icon>
+ </template>
+ </up-form-item>
+ <up-form-item label="褰曞叆浜�"
+ prop="recorderName">
+ <up-input v-model="form.recorderName"
+ placeholder="璇疯緭鍏�"
+ disabled />
+ </up-form-item>
+ <up-form-item label="褰曞叆鏃ユ湡"
+ prop="entryDate">
+ <up-input v-model="form.entryDate"
+ placeholder="璇疯緭鍏�"
+ disabled />
+ </up-form-item>
+ <view class="approval-process">
+ <view class="approval-header">
+ <text class="approval-title">瀹℃牳娴佺▼</text>
+ <text class="approval-desc">姣忎釜姝ラ鍙兘閫夋嫨涓�涓鎵逛汉</text>
+ </view>
+ <view class="approval-steps">
+ <view v-for="(step, stepIndex) in approverNodes"
+ :key="stepIndex"
+ class="approval-step">
+ <view class="step-dot"></view>
+ <view class="step-title">
+ <text>瀹℃壒浜�</text>
+ </view>
+ <view class="approver-container">
+ <view v-if="step.nickName"
+ class="approver-item">
+ <view class="approver-avatar">
+ <text class="avatar-text">{{ step.nickName.charAt(0) }}</text>
+ <view class="status-dot"></view>
+ </view>
+ <view class="approver-info">
+ <text class="approver-name">{{ step.nickName }}</text>
+ </view>
+ <view class="delete-approver-btn"
+ @click="removeApprover(stepIndex)">脳</view>
+ </view>
+ <view v-else
+ class="add-approver-btn"
+ @click="addApprover(stepIndex)">
+ <view class="add-circle">+</view>
+ <text class="add-label">閫夋嫨瀹℃壒浜�</text>
+ </view>
+ </view>
+ <view class="step-line"
+ v-if="stepIndex < approverNodes.length - 1"></view>
+ <view class="delete-step-btn"
+ v-if="approverNodes.length > 1"
+ @click="removeApprovalStep(stepIndex)">鍒犻櫎鑺傜偣</view>
+ </view>
+ </view>
+ <view class="add-step-btn">
+ <u-button icon="plus"
+ plain
+ type="primary"
+ style="width: 100%"
+ @click="addApprovalStep">鏂板鑺傜偣</u-button>
+ </view>
+ </view>
+ <up-popup :show="showTimePicker"
+ mode="bottom"
+ @close="showTimePicker = false">
+ <up-datetime-picker :show="true"
+ v-model="currentDate"
+ @confirm="onDateConfirm"
+ @cancel="showTimePicker = false"
+ mode="date" />
+ </up-popup>
+ <!-- 閿�鍞悎鍚屽彿閫夋嫨 -->
+ <up-action-sheet :show="showPicker"
+ :actions="salesContractActionList"
+ title="閫夋嫨閿�鍞悎鍚屽彿"
+ @select="onSalesmanSelect"
+ @close="showPicker = false" />
+ <!-- 渚涘簲鍟嗛�夋嫨 -->
+ <up-action-sheet :show="showCustomerPicker"
+ :actions="supplierActionList"
+ title="閫夋嫨渚涘簲鍟�"
+ @select="onCustomerSelect"
+ @close="showCustomerPicker = false" />
+ <!-- 浜у搧澶х被閫夋嫨鍣� -->
+ <up-popup :show="showCategoryPicker"
+ mode="bottom">
+ <!-- 澶撮儴鎸夐挳鍖哄煙 -->
+ <view class="popup-header">
+ <view @click="showCategoryPicker = false"
+ class="cancelButton">鍙栨秷</view>
+ <view @click="confirmCategorySelection"
+ class="confirmButton">纭畾</view>
+ </view>
+ <u-tree :data="productOptions"
+ :props="defaultProps"
+ show-checkbox
+ default-expand-all
+ check-strictly
+ @check-change="onCategoryConfirm" />
+ </up-popup>
+ <!-- 瑙勬牸鍨嬪彿閫夋嫨鍣� -->
+ <up-action-sheet :show="showSpecificationPicker"
+ :actions="specificationActionList"
+ title="閫夋嫨瑙勬牸鍨嬪彿"
+ @select="onSpecificationSelect"
+ @close="showSpecificationPicker = false" />
+ <!-- 绋庣巼閫夋嫨鍣� -->
+ <up-action-sheet :show="showTaxRatePicker"
+ :actions="taxRateActionList"
+ title="閫夋嫨绋庣巼"
+ @select="onTaxRateSelect"
+ @close="showTaxRatePicker = false" />
+ <!-- 鍙戠エ绫诲瀷閫夋嫨鍣� -->
+ <up-action-sheet :show="showInvoiceTypePicker"
+ :actions="invoiceTypeActionList"
+ title="閫夋嫨鍙戠エ绫诲瀷"
+ @select="onInvoiceTypeSelect"
+ @close="showInvoiceTypePicker = false" />
+ <!-- 浜у搧淇℃伅 -->
+ <view class="product-section">
+ <view class="section-header">
+ <view>
+ <text class="section-title">浜у搧淇℃伅</text>
+ </view>
+ <view>
+ <up-button type="primary"
+ size="small"
+ @click="addProduct"
+ class="add-btn"
+ v-if="operationType !== 'view'">
+ 鏂板
+ </up-button>
+ </view>
+ </view>
+ <view class="product-card"
+ v-for="(product, idx) in productData"
+ :key="idx">
+ <!-- 浜у搧绫� -->
+ <view class="product-header">
+ <view class="product-title">
+ <up-icon name="file-text"
+ size="16"
+ color="#2979ff"></up-icon>
+ <text class="product-productCategory">浜у搧 {{ idx + 1 }}</text>
+ </view>
+ <!-- 鎿嶄綔鎸夐挳 -->
+ <view class="product-actions"
+ v-if="operationType !== 'view'">
+ <up-button type="error"
+ size="mini"
+ @click="removeProduct(idx)"
+ class="del-btn">
+ 鍒犻櫎
+ </up-button>
+ </view>
+ </view>
+ <!-- 浜у搧淇℃伅琛ㄥ崟 -->
+ <view class="product-form">
+ <!-- 浜у搧澶х被 -->
+ <up-form-item label="浜у搧澶х被"
+ prop="productCategory"
+ required
+ :rules="productRules">
+ <up-input v-model="product.productCategory"
+ readonly
+ placeholder="璇烽�夋嫨"
+ @click="openCategoryPicker(idx)" />
+ <template #right>
+ <up-icon name="arrow-right"
+ @click="showCategoryPicker = true"></up-icon>
+ </template>
+ </up-form-item>
+ <!-- 瑙勬牸鍨嬪彿 -->
+ <up-form-item label="瑙勬牸鍨嬪彿"
+ prop="specificationModel"
+ required
+ :rules="productRules">
+ <up-input v-model="product.specificationModel"
+ readonly
+ placeholder="璇烽�夋嫨"
+ @click="openSpecificationPicker(idx)" />
+ <template #right>
+ <up-icon name="arrow-right"
+ @click="showSpecificationPicker = true"></up-icon>
+ </template>
+ </up-form-item>
+ <!-- 鍗曚綅 -->
+ <up-form-item label="鍗曚綅"
+ prop="unit"
+ required
+ :rules="productRules">
+ <up-input v-model="product.unit"
+ placeholder="璇疯緭鍏�" />
+ </up-form-item>
+ <!-- 绋庣巼 -->
+ <up-form-item label="绋庣巼(%)"
+ prop="taxRate"
+ required
+ :rules="productRules">
+ <up-input v-model="product.taxRate"
+ readonly
+ placeholder="璇烽�夋嫨"
+ @click="openTaxRatePicker(idx)" />
+ <template #right>
+ <up-icon name="arrow-right"
+ @click="showTaxRatePicker = true"></up-icon>
+ </template>
+ </up-form-item>
+ <!-- 鍚◣鍗曚环 -->
+ <up-form-item label="鍚◣鍗曚环(鍏�)"
+ prop="taxInclusiveUnitPrice"
+ required
+ :rules="productRules">
+ <up-input v-model="product.taxInclusiveUnitPrice"
+ type="number"
+ placeholder="璇疯緭鍏�"
+ @blur="formatTaxPrice(idx)" />
+ </up-form-item>
+ <!-- 鏁伴噺 -->
+ <up-form-item label="鏁伴噺"
+ prop="quantity"
+ required
+ :rules="productRules">
+ <up-input v-model="product.quantity"
+ type="number"
+ placeholder="璇疯緭鍏�"
+ @blur="formatAmount(idx)" />
+ </up-form-item>
+ <!-- 鍚◣鎬讳环 -->
+ <up-form-item label="鍚◣鎬讳环(鍏�)"
+ prop="taxInclusiveTotalPrice"
+ required
+ :rules="productRules">
+ <up-input v-model="product.taxInclusiveTotalPrice"
+ type="number"
+ placeholder="璇疯緭鍏�"
+ @blur="formatTaxTotal(idx)" />
+ </up-form-item>
+ <!-- 涓嶅惈绋庢�讳环 -->
+ <up-form-item label="涓嶅惈绋庢�讳环(鍏�)"
+ prop="taxExclusiveTotalPrice"
+ required
+ :rules="productRules">
+ <up-input v-model="product.taxExclusiveTotalPrice"
+ type="number"
+ placeholder="璇疯緭鍏�"
+ @blur="formatNoTaxTotal(idx)" />
+ </up-form-item>
+ <!-- 鍙戠エ绫诲瀷 -->
+ <up-form-item label="鍙戠エ绫诲瀷"
+ prop="invoiceType"
+ required
+ :rules="productRules">
+ <up-input v-model="product.invoiceType"
+ readonly
+ placeholder="璇烽�夋嫨"
+ @click="openInvoiceTypePicker(idx)" />
+ <template #right>
+ <up-icon name="arrow-right"
+ @click="showInvoiceTypePicker = true"></up-icon>
+ </template>
+ </up-form-item>
+ <!-- 搴撳瓨棰勮鏁伴噺 -->
+ <up-form-item label="搴撳瓨棰勮鏁伴噺"
+ prop="warnNum"
+ required
+ :rules="productRules">
+ <up-input v-model="product.warnNum"
+ type="number"
+ placeholder="璇疯緭鍏�" />
+ </up-form-item>
+ <up-form-item label="鏄惁璐ㄦ"
+ prop="invoiceType"
+ required
+ :rules="productRules">
+ <u-radio-group v-model="product.isChecked"
+ placement="row"
+ @change="groupChange">
+ <u-radio :customStyle="{marginRight: '40rpx'}"
+ label="鏄�"
+ :name="true">
+ </u-radio>
+ <u-radio label="鍚�"
+ :name="false">
+ </u-radio>
+ </u-radio-group>
+ </up-form-item>
+ </view>
+ </view>
+ </view>
+ <!-- 浣跨敤鍏叡搴曢儴鎸夐挳缁勪欢 -->
+ <FooterButtons :show="operationType !== 'view'"
+ cancelText="鍙栨秷"
+ confirmText="淇濆瓨"
+ @cancel="goBack"
+ @confirm="onSubmit" />
+ </up-form>
</view>
</template>
<script setup>
-import {onMounted, ref, computed} from 'vue';
-import { modelList, productTreeList } from "@/api/basicData/product.js";
-import useUserStore from "@/store/modules/user";
-import {calculateTaxExclusiveTotalPrice} from "@/utils/summarizeTable";
-import {formatDateToYMD} from '@/utils/ruoyi'
-import {
- addOrEditPurchase, createPurchaseNo,
- getOptions,
- getPurchaseById,
- getSalesNo
-} from "@/api/procurementManagement/procurementLedger";
-import PageHeader from '@/components/PageHeader.vue';
-import FooterButtons from '@/components/FooterButtons.vue';
+ import { onMounted, ref, computed } from "vue";
+ import { modelList, productTreeList } from "@/api/basicData/product.js";
+ import useUserStore from "@/store/modules/user";
+ import { calculateTaxExclusiveTotalPrice } from "@/utils/summarizeTable";
+ import { formatDateToYMD } from "@/utils/ruoyi";
+ import {
+ addOrEditPurchase,
+ createPurchaseNo,
+ getOptions,
+ getPurchaseById,
+ getSalesNo,
+ approveProcessGetInfo,
+ } from "@/api/procurementManagement/procurementLedger";
+ import PageHeader from "@/components/PageHeader.vue";
+ import FooterButtons from "@/components/FooterButtons.vue";
+ import { userListNoPageByTenantId } from "@/api/system/user";
+ // 鑾峰彇椤甸潰鍙傛暟
+ const operationType = ref("");
+ const editData = ref(null);
+ const formRef = ref(null);
-// 鑾峰彇椤甸潰鍙傛暟
-const operationType = ref('');
-const editData = ref(null);
-const formRef = ref(null);
-
-const userStore = useUserStore()
-const form = ref({
- id: '',
- salesContractNo: '',
- purchaseContractNumber: '',
- supplierId: '',
- supplierName: '',
- projectName: '',
- paymentMethod: '',
- recorderId: '',
- recorderName: '',
- entryDate: '',
-});
-const showPicker = ref(false);
-const showCustomerPicker = ref(false);
-const salesContractList = ref([]);
-const supplierList = ref([]);
-const productData = ref([]);
-
-// 璁$畻閿�鍞悎鍚屽彿閫夋嫨鍒楄〃
-const salesContractActionList = computed(() => {
- return salesContractList.value.map(item => ({
- name: item.text,
- value: item.value
- }))
-})
-
-// 璁$畻渚涘簲鍟嗛�夋嫨鍒楄〃
-const supplierActionList = computed(() => {
- return supplierList.value.map(item => ({
- name: item.text,
- value: item.value
- }))
-})
-
-// 閫夋嫨鍣ㄧ浉鍏冲彉閲�
-const showCategoryPicker = ref(false);
-const showSpecificationPicker = ref(false);
-const showTaxRatePicker = ref(false);
-const showInvoiceTypePicker = ref(false);
-const currentProductIndex = ref(0);
-
-// 閫夐」鏁版嵁
-const productOptions = ref([]);
-const selectedCategoryNode = ref(null);
-const defaultProps = ref({
- children: 'children',
- label: 'label',
- nodeKey: 'id'
-});
-
-const modelOptions = ref([]);
-const taxRateOptions = ref([
- { text: '1', value: '1' },
- { text: '6', value: '6' },
- { text: '13', value: '13' },
-]);
-
-const invoiceTypeOptions = ref([
- { text: '澧炴櫘绁�', value: '澧炴櫘绁�' },
- { text: '澧炰笓绁�', value: '澧炰笓绁�' },
-]);
-
-// 璁$畻瑙勬牸鍨嬪彿閫夋嫨鍒楄〃
-const specificationActionList = computed(() => {
- return modelOptions.value.map(model => ({
- name: model.text,
- value: model.value,
- unit: model.unit
- }))
-})
-
-// 璁$畻绋庣巼閫夋嫨鍒楄〃
-const taxRateActionList = computed(() => {
- return taxRateOptions.value.map(rate => ({
- name: rate.text,
- value: rate.value
- }))
-})
-
-// 璁$畻鍙戠エ绫诲瀷閫夋嫨鍒楄〃
-const invoiceTypeActionList = computed(() => {
- return invoiceTypeOptions.value.map(type => ({
- name: type.text,
- value: type.value
- }))
-})
-
-// 琛ㄥ崟鏍¢獙瑙勫垯
-const rules = {
- salesContractNo: [
- { required: true, message: '璇烽�夋嫨閿�鍞悎鍚屽彿', trigger: 'blur' }
- ],
- supplierName: [
- { required: true, message: '璇烽�夋嫨渚涘簲鍟嗗悕绉�', trigger: 'blur' }
- ],
- projectName: [
- { required: true, message: '璇疯緭鍏ラ」鐩悕绉�', trigger: 'blur' }
- ]
-};
-
-// 浜у搧淇℃伅鏍¢獙瑙勫垯
-const productRules = {
- productCategory: [
- { required: true, message: '璇烽�夋嫨浜у搧澶х被', trigger: 'blur' }
- ],
- specificationModel: [
- { required: true, message: '璇烽�夋嫨瑙勬牸鍨嬪彿', trigger: 'blur' }
- ],
- unit: [
- { required: true, message: '璇疯緭鍏ュ崟浣�', trigger: 'blur' }
- ],
- taxRate: [
- { required: true, message: '璇烽�夋嫨绋庣巼', trigger: 'blur' }
- ],
- taxInclusiveUnitPrice: [
- { required: true, message: '璇疯緭鍏ュ惈绋庡崟浠�', trigger: 'blur' },
- { type: 'number', min: 0, message: '鍚◣鍗曚环蹇呴』澶т簬0', trigger: 'blur' }
- ],
- quantity: [
- { required: true, message: '璇疯緭鍏ユ暟閲�', trigger: 'blur' },
- { type: 'number', min: 0, message: '鏁伴噺蹇呴』澶т簬0', trigger: 'blur' }
- ],
- taxInclusiveTotalPrice: [
- { required: true, message: '璇疯緭鍏ュ惈绋庢�讳环', trigger: 'blur' },
- { type: 'number', min: 0, message: '鍚◣鎬讳环蹇呴』澶т簬0', trigger: 'blur' }
- ],
- taxExclusiveTotalPrice: [
- { required: true, message: '璇疯緭鍏ヤ笉鍚◣鎬讳环', trigger: 'blur' },
- { type: 'number', min: 0, message: '涓嶅惈绋庢�讳环蹇呴』澶т簬0', trigger: 'blur' }
- ],
- invoiceType: [
- { required: true, message: '璇烽�夋嫨鍙戠エ绫诲瀷', trigger: 'blur' }
- ]
-};
-
-const addProduct = () => {
- if (productData.value === null) {
- productData.value = []
- }
- productData.value.push({
- productCategory: '',
- specificationModel: '',
- productModelId: '',
- unit: '',
- taxRate: '',
- taxInclusiveUnitPrice: '',
- quantity: '',
- taxInclusiveTotalPrice: '',
- taxExclusiveTotalPrice: '',
- invoiceType: ''
+ const userStore = useUserStore();
+ const form = ref({
+ id: "",
+ salesContractNo: "",
+ purchaseContractNumber: "",
+ supplierId: "",
+ supplierName: "",
+ projectName: "",
+ paymentMethod: "",
+ recorderId: "",
+ recorderName: "",
+ entryDate: "",
+ approveUserIds: "",
+ executionDate: "",
});
-};
+ const showTimePicker = ref(false);
+ const showPicker = ref(false);
+ const showCustomerPicker = ref(false);
+ const salesContractList = ref([]);
+ const supplierList = ref([]);
+ const productData = ref([]);
+ const currentDate = ref(Date.now());
+ // 璁$畻閿�鍞悎鍚屽彿閫夋嫨鍒楄〃
+ const salesContractActionList = computed(() => {
+ return salesContractList.value.map(item => ({
+ name: item.text,
+ value: item.value,
+ }));
+ });
-// 閿�鍞悎鍚屽彿閫夋嫨浜嬩欢
-const onSalesmanSelect = (item) => {
- form.value.salesContractNo = item.name
- // 鏌ユ壘瀵瑰簲鐨刬d
- const selectedItem = salesContractList.value.find(contract => contract.text === item.name);
- if (selectedItem) {
- form.value.salesLedgerId = selectedItem.value;
- }
- showPicker.value = false;
-}
+ // 璁$畻渚涘簲鍟嗛�夋嫨鍒楄〃
+ const supplierActionList = computed(() => {
+ return supplierList.value.map(item => ({
+ name: item.text,
+ value: item.value,
+ }));
+ });
-// 渚涘簲鍟嗛�夋嫨浜嬩欢
-const onCustomerSelect = (item) => {
- form.value.supplierName = item.name
- // 鏌ユ壘瀵瑰簲鐨刬d
- const selectedItem = supplierList.value.find(supplier => supplier.text === item.name);
- if (selectedItem) {
- form.value.supplierId = selectedItem.value;
- }
- showCustomerPicker.value = false;
-}
+ // 閫夋嫨鍣ㄧ浉鍏冲彉閲�
+ const showCategoryPicker = ref(false);
+ const showSpecificationPicker = ref(false);
+ const showTaxRatePicker = ref(false);
+ const showInvoiceTypePicker = ref(false);
+ const currentProductIndex = ref(0);
-const removeProduct = (idx) => {
- productData.value.splice(idx, 1);
-};
+ // 閫夐」鏁版嵁
+ const productOptions = ref([]);
+ const selectedCategoryNode = ref(null);
+ const defaultProps = ref({
+ children: "children",
+ label: "label",
+ nodeKey: "id",
+ });
-// 鏄剧ず閫夋嫨鍣�
-const openCategoryPicker = (idx) => {
- currentProductIndex.value = idx;
- showCategoryPicker.value = true;
-};
+ const modelOptions = ref([]);
+ const taxRateOptions = ref([
+ { text: "1", value: "1" },
+ { text: "6", value: "6" },
+ { text: "13", value: "13" },
+ ]);
-const openSpecificationPicker = (idx) => {
- currentProductIndex.value = idx;
- showSpecificationPicker.value = true;
-};
+ const invoiceTypeOptions = ref([
+ { text: "澧炴櫘绁�", value: "澧炴櫘绁�" },
+ { text: "澧炰笓绁�", value: "澧炰笓绁�" },
+ ]);
-const openTaxRatePicker = (idx) => {
- currentProductIndex.value = idx;
- showTaxRatePicker.value = true;
-};
+ // 璁$畻瑙勬牸鍨嬪彿閫夋嫨鍒楄〃
+ const specificationActionList = computed(() => {
+ return modelOptions.value.map(model => ({
+ name: model.text,
+ value: model.value,
+ unit: model.unit,
+ }));
+ });
-const openInvoiceTypePicker = (idx) => {
- currentProductIndex.value = idx;
- showInvoiceTypePicker.value = true;
-};
+ // 璁$畻绋庣巼閫夋嫨鍒楄〃
+ const taxRateActionList = computed(() => {
+ return taxRateOptions.value.map(rate => ({
+ name: rate.text,
+ value: rate.value,
+ }));
+ });
-// 閫夋嫨鍣ㄧ‘璁や簨浠�
-const onCategoryConfirm = (node) => {
- // 鑾峰彇閫変腑鐨勮妭鐐逛俊鎭�
- console.log('selected node---', node);
- // 瀛樺偍閫変腑鐨勮妭鐐癸紝鐢ㄤ簬纭鏃惰幏鍙栨暟鎹�
- selectedCategoryNode.value = node;
-};
+ // 璁$畻鍙戠エ绫诲瀷閫夋嫨鍒楄〃
+ const invoiceTypeActionList = computed(() => {
+ return invoiceTypeOptions.value.map(type => ({
+ name: type.text,
+ value: type.value,
+ }));
+ });
-// 纭浜у搧澶х被閫夋嫨
-const confirmCategorySelection = () => {
- if (selectedCategoryNode.value) {
- // 璁剧疆閫変腑鐨勪骇鍝佸ぇ绫�
- productData.value[currentProductIndex.value].productCategory = selectedCategoryNode.value.label;
- const id = selectedCategoryNode.value.id
- // 閲嶇疆閫変腑鐨勮妭鐐�
- selectedCategoryNode.value = null;
- productData.value[currentProductIndex.value].specificationModel = ''
- productData.value[currentProductIndex.value].productModelId = ''
- getModels(id)
- }
- showCategoryPicker.value = false;
-};
+ // 琛ㄥ崟鏍¢獙瑙勫垯
+ const rules = {
+ salesContractNo: [
+ { required: true, message: "璇烽�夋嫨閿�鍞悎鍚屽彿", trigger: "blur" },
+ ],
+ supplierName: [
+ { required: true, message: "璇烽�夋嫨渚涘簲鍟嗗悕绉�", trigger: "blur" },
+ ],
+ projectName: [{ required: true, message: "璇疯緭鍏ラ」鐩悕绉�", trigger: "blur" }],
+ executionDate: [
+ { required: true, message: "璇烽�夋嫨绛捐鏃ユ湡", trigger: "blur" },
+ ],
+ };
-// 鑾峰彇瑙勬牸鍨嬪彿
-const getModels = (value) => {
- modelList({ id: value }).then((res) => {
- modelOptions.value = res.map(user => ({
- text: user.model,
- value: user.id,
- unit: user.unit,
- }));
- });
-};
+ // 浜у搧淇℃伅鏍¢獙瑙勫垯
+ const productRules = {
+ productCategory: [
+ { required: true, message: "璇烽�夋嫨浜у搧澶х被", trigger: "blur" },
+ ],
+ specificationModel: [
+ { required: true, message: "璇烽�夋嫨瑙勬牸鍨嬪彿", trigger: "blur" },
+ ],
+ unit: [{ required: true, message: "璇疯緭鍏ュ崟浣�", trigger: "blur" }],
+ taxRate: [{ required: true, message: "璇烽�夋嫨绋庣巼", trigger: "blur" }],
+ taxInclusiveUnitPrice: [
+ { required: true, message: "璇疯緭鍏ュ惈绋庡崟浠�", trigger: "blur" },
+ { type: "number", min: 0, message: "鍚◣鍗曚环蹇呴』澶т簬0", trigger: "blur" },
+ ],
+ quantity: [
+ { required: true, message: "璇疯緭鍏ユ暟閲�", trigger: "blur" },
+ { type: "number", min: 0, message: "鏁伴噺蹇呴』澶т簬0", trigger: "blur" },
+ ],
+ taxInclusiveTotalPrice: [
+ { required: true, message: "璇疯緭鍏ュ惈绋庢�讳环", trigger: "blur" },
+ { type: "number", min: 0, message: "鍚◣鎬讳环蹇呴』澶т簬0", trigger: "blur" },
+ ],
+ taxExclusiveTotalPrice: [
+ { required: true, message: "璇疯緭鍏ヤ笉鍚◣鎬讳环", trigger: "blur" },
+ { type: "number", min: 0, message: "涓嶅惈绋庢�讳环蹇呴』澶т簬0", trigger: "blur" },
+ ],
+ invoiceType: [{ required: true, message: "璇烽�夋嫨鍙戠エ绫诲瀷", trigger: "blur" }],
-// 瑙勬牸鍨嬪彿閫夋嫨浜嬩欢
-const onSpecificationSelect = (item) => {
- productData.value[currentProductIndex.value].specificationModel = item.name
- productData.value[currentProductIndex.value].productModelId = item.value
- productData.value[currentProductIndex.value].unit = item.unit
- showSpecificationPicker.value = false;
-};
+ warnNum: [
+ { required: true, message: "璇疯緭鍏ュ簱瀛橀璀︽暟閲�", trigger: "blur" },
+ {
+ type: "number",
+ min: 0,
+ message: "搴撳瓨棰勮鏁伴噺蹇呴』澶т簬0",
+ trigger: "blur",
+ },
+ ],
+ };
-// 绋庣巼閫夋嫨浜嬩欢
-const onTaxRateSelect = (item) => {
- productData.value[currentProductIndex.value].taxRate = item.value
- showTaxRatePicker.value = false;
- // 閲嶆柊璁$畻涓嶅惈绋庢�讳环
- const inclusiveTotalPrice = parseFloat(productData.value[currentProductIndex.value].taxInclusiveTotalPrice)
- const taxRate = parseFloat(item.value)
- if (inclusiveTotalPrice && taxRate) {
- productData.value[currentProductIndex.value].taxExclusiveTotalPrice =
- calculateTaxExclusiveTotalPrice(inclusiveTotalPrice, taxRate)
- }
-};
-
-// 鍙戠エ绫诲瀷閫夋嫨浜嬩欢
-const onInvoiceTypeSelect = (item) => {
- productData.value[currentProductIndex.value].invoiceType = item.name
- showInvoiceTypePicker.value = false;
-};
-
-// 鏍煎紡鍖栧嚱鏁� - 鍥哄畾涓や綅灏忔暟
-const formatTaxPrice = (idx) => {
- if (productData.value[idx].taxInclusiveUnitPrice) {
- const value = parseFloat(productData.value[idx].taxInclusiveUnitPrice);
- if (!isNaN(value)) {
- productData.value[idx].taxInclusiveUnitPrice = value.toFixed(2);
+ const addProduct = () => {
+ if (productData.value === null) {
+ productData.value = [];
}
- }
- if (!productData.value[currentProductIndex.value].taxRate) {
- uni.showToast({
- title: '璇峰厛閫夋嫨绋庣巼',
- icon: 'none'
- });
- return;
- }
- const quantity = parseFloat(productData.value[currentProductIndex.value].quantity);
- const unitPrice = parseFloat(productData.value[currentProductIndex.value].taxInclusiveUnitPrice);
-
- if (!quantity || quantity <= 0 || !unitPrice) {
- return;
- }
- // 璁$畻鍚◣鎬讳环
- productData.value[currentProductIndex.value].taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
-
- // 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
- if (productData.value[currentProductIndex.value].taxRate) {
- productData.value[currentProductIndex.value].taxExclusiveTotalPrice =
- calculateTaxExclusiveTotalPrice(
- productData.value[currentProductIndex.value].taxInclusiveTotalPrice,
- productData.value[currentProductIndex.value].taxRate
- );
- }
-};
+ productData.value.push({
+ productCategory: "",
+ specificationModel: "",
+ productModelId: "",
+ unit: "",
+ taxRate: "",
+ taxInclusiveUnitPrice: "",
+ quantity: "",
+ taxInclusiveTotalPrice: "",
+ taxExclusiveTotalPrice: "",
+ invoiceType: "",
+ isChecked: false,
+ warnNum: "",
+ });
+ };
-// 鏁伴噺杈撳叆妗嗗け鐒�
-const formatAmount = (idx) => {
- if (productData.value[idx].quantity) {
- const value = parseFloat(productData.value[idx].quantity);
- if (!isNaN(value)) {
- productData.value[idx].quantity = value.toFixed(2);
+ // 閿�鍞悎鍚屽彿閫夋嫨浜嬩欢
+ const onSalesmanSelect = item => {
+ form.value.salesContractNo = item.name;
+ // 鏌ユ壘瀵瑰簲鐨刬d
+ const selectedItem = salesContractList.value.find(
+ contract => contract.text === item.name
+ );
+ if (selectedItem) {
+ form.value.salesLedgerId = selectedItem.value;
}
- }
- if (!productData.value[currentProductIndex.value].taxRate) {
- uni.showToast({
- title: '璇峰厛閫夋嫨绋庣巼',
- icon: 'none'
- });
- return;
- }
- const quantity = parseFloat(productData.value[currentProductIndex.value].quantity);
- const unitPrice = parseFloat(productData.value[currentProductIndex.value].taxInclusiveUnitPrice);
-
- if (!quantity || quantity <= 0 || !unitPrice) {
- return;
- }
- // 璁$畻鍚◣鎬讳环
- productData.value[currentProductIndex.value].taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
- // 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
- if (productData.value[currentProductIndex.value].taxRate) {
- productData.value[currentProductIndex.value].taxExclusiveTotalPrice =
- calculateTaxExclusiveTotalPrice(
- productData.value[currentProductIndex.value].taxInclusiveTotalPrice,
- productData.value[currentProductIndex.value].taxRate
- );
- }
-};
+ showPicker.value = false;
+ };
-// 鍚◣鎬讳环澶辩劍锛屾牴鎹惈绋庢�讳环璁$畻鍚◣鍗曚环鍜屾暟閲�
-const formatTaxTotal = (idx) => {
- if (productData.value[idx].taxInclusiveTotalPrice) {
- const value = parseFloat(productData.value[idx].taxInclusiveTotalPrice);
- if (!isNaN(value)) {
- productData.value[idx].taxInclusiveTotalPrice = value.toFixed(2);
+ // 渚涘簲鍟嗛�夋嫨浜嬩欢
+ const onCustomerSelect = item => {
+ form.value.supplierName = item.name;
+ // 鏌ユ壘瀵瑰簲鐨刬d
+ const selectedItem = supplierList.value.find(
+ supplier => supplier.text === item.name
+ );
+ if (selectedItem) {
+ form.value.supplierId = selectedItem.value;
}
- }
- const totalPrice = parseFloat(productData.value[currentProductIndex.value].taxInclusiveTotalPrice);
- const quantity = parseFloat(productData.value[currentProductIndex.value].quantity);
-
- if (!totalPrice || !quantity || quantity <= 0) {
- return;
- }
- // 璁$畻鍚◣鍗曚环 = 鍚◣鎬讳环 / 鏁伴噺
- productData.value[currentProductIndex.value].taxInclusiveUnitPrice = (totalPrice / quantity).toFixed(2);
- // 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
- if (productData.value[currentProductIndex.value].taxRate) {
- productData.value[currentProductIndex.value].taxExclusiveTotalPrice =
- calculateTaxExclusiveTotalPrice(
- totalPrice,
- productData.value[currentProductIndex.value].taxRate
- );
- }
-};
+ showCustomerPicker.value = false;
+ };
-// 涓嶅惈绋庢�讳环澶辩劍, 鏍规嵁涓嶅惈绋庢�讳环璁$畻鍚◣鍗曚环鍜屾暟閲�
-const formatNoTaxTotal = (idx) => {
- if (productData.value[idx].taxExclusiveTotalPrice) {
- const value = parseFloat(productData.value[idx].taxExclusiveTotalPrice);
- if (!isNaN(value)) {
- productData.value[idx].taxExclusiveTotalPrice = value.toFixed(2);
+ const removeProduct = idx => {
+ productData.value.splice(idx, 1);
+ };
+
+ // 鏄剧ず閫夋嫨鍣�
+ const openCategoryPicker = idx => {
+ currentProductIndex.value = idx;
+ showCategoryPicker.value = true;
+ };
+
+ const openSpecificationPicker = idx => {
+ currentProductIndex.value = idx;
+ showSpecificationPicker.value = true;
+ };
+
+ const openTaxRatePicker = idx => {
+ currentProductIndex.value = idx;
+ showTaxRatePicker.value = true;
+ };
+
+ const openInvoiceTypePicker = idx => {
+ currentProductIndex.value = idx;
+ showInvoiceTypePicker.value = true;
+ };
+
+ // 閫夋嫨鍣ㄧ‘璁や簨浠�
+ const onCategoryConfirm = node => {
+ // 鑾峰彇閫変腑鐨勮妭鐐逛俊鎭�
+ console.log("selected node---", node);
+ // 瀛樺偍閫変腑鐨勮妭鐐癸紝鐢ㄤ簬纭鏃惰幏鍙栨暟鎹�
+ selectedCategoryNode.value = node;
+ };
+
+ // 纭浜у搧澶х被閫夋嫨
+ const confirmCategorySelection = () => {
+ if (selectedCategoryNode.value) {
+ // 璁剧疆閫変腑鐨勪骇鍝佸ぇ绫�
+ productData.value[currentProductIndex.value].productCategory =
+ selectedCategoryNode.value.label;
+ const id = selectedCategoryNode.value.id;
+ // 閲嶇疆閫変腑鐨勮妭鐐�
+ selectedCategoryNode.value = null;
+ productData.value[currentProductIndex.value].specificationModel = "";
+ productData.value[currentProductIndex.value].productModelId = "";
+ getModels(id);
}
- }
- if (!productData.value[currentProductIndex.value].taxRate) {
- uni.showToast({
- title: '璇峰厛閫夋嫨绋庣巼',
- icon: 'none'
- });
- return;
- }
- const exclusiveTotalPrice = parseFloat(productData.value[currentProductIndex.value].taxExclusiveTotalPrice);
- const quantity = parseFloat(productData.value[currentProductIndex.value].quantity);
- const taxRate = parseFloat(productData.value[currentProductIndex.value].taxRate);
- if (!exclusiveTotalPrice || !quantity || quantity <= 0 || !taxRate) {
- return;
- }
- // 鍏堣绠楀惈绋庢�讳环 = 涓嶅惈绋庢�讳环 / (1 - 绋庣巼/100)
- const taxRateDecimal = taxRate / 100;
- const inclusiveTotalPrice = exclusiveTotalPrice / (1 - taxRateDecimal);
- productData.value[currentProductIndex.value].taxInclusiveTotalPrice = inclusiveTotalPrice.toFixed(2);
- // 璁$畻鍚◣鍗曚环 = 鍚◣鎬讳环 / 鏁伴噺
- productData.value[currentProductIndex.value].taxInclusiveUnitPrice = (inclusiveTotalPrice / quantity).toFixed(2);
-};
+ showCategoryPicker.value = false;
+ };
-const goBack = () => {
- // 娓呯悊鏈湴瀛樺偍鐨勬暟鎹�
- uni.removeStorageSync('operationType');
- uni.removeStorageSync('editData');
- uni.navigateBack();
-};
+ // 鑾峰彇瑙勬牸鍨嬪彿
+ const getModels = value => {
+ modelList({ id: value }).then(res => {
+ modelOptions.value = res.map(user => ({
+ text: user.model,
+ value: user.id,
+ unit: user.unit,
+ }));
+ });
+ };
-const onSubmit = () => {
- if (productData.value !== null && productData.value.length > 0) {
- form.value.productData = JSON.parse(JSON.stringify(productData.value));
- } else {
- uni.showToast({
- title: '璇锋坊鍔犱骇鍝佷俊鎭�',
- icon: 'none'
- });
- return
- }
- form.value.type = 2;
- addOrEditPurchase(form.value).then((res) => {
- uni.showToast({
- title: '鎻愪氦鎴愬姛',
- icon: 'success',
- });
- goBack();
- });
-};
+ // 瑙勬牸鍨嬪彿閫夋嫨浜嬩欢
+ const onSpecificationSelect = item => {
+ productData.value[currentProductIndex.value].specificationModel = item.name;
+ productData.value[currentProductIndex.value].productModelId = item.value;
+ productData.value[currentProductIndex.value].unit = item.unit;
+ showSpecificationPicker.value = false;
+ };
-const setUserInfo = () => {
- form.value.recorderId = userStore.id;
- form.value.recorderName = userStore.nickName;
- // 璁剧疆褰撳ぉ鏃ユ湡
- const today = new Date()
- const year = today.getFullYear()
- const month = String(today.getMonth() + 1).padStart(2, '0')
- const day = String(today.getDate()).padStart(2, '0')
- form.value.entryDate = `${year}-${month}-${day}`
-};
+ // 绋庣巼閫夋嫨浜嬩欢
+ const onTaxRateSelect = item => {
+ productData.value[currentProductIndex.value].taxRate = item.value;
+ showTaxRatePicker.value = false;
+ // 閲嶆柊璁$畻涓嶅惈绋庢�讳环
+ const inclusiveTotalPrice = parseFloat(
+ productData.value[currentProductIndex.value].taxInclusiveTotalPrice
+ );
+ const taxRate = parseFloat(item.value);
+ if (inclusiveTotalPrice && taxRate) {
+ productData.value[currentProductIndex.value].taxExclusiveTotalPrice =
+ calculateTaxExclusiveTotalPrice(inclusiveTotalPrice, taxRate);
+ }
+ };
-// 濉厖琛ㄥ崟鏁版嵁锛堢紪杈戞ā寮忥級
-const fillFormData = () => {
- if (!editData.value) return;
- getPurchaseById({ id: editData.value.id, type: 2 }).then((res) => {
- productData.value = res.productData;
- });
- console.log(editData.value)
- // 濉厖鍩烘湰淇℃伅
- form.value.salesContractNo = editData.value.salesContractNo || '';
- form.value.supplierName = editData.value.supplierName || '';
- form.value.projectName = editData.value.projectName || '';
- form.value.paymentMethod = editData.value.paymentMethod || '';
- form.value.salesLedgerId = editData.value.salesLedgerId || '';
- form.value.recorderId = editData.value.recorderId || '';
- form.value.recorderName = editData.value.recorderName || '';
- form.value.entryDate = editData.value.entryDate || '';
- form.value.id = editData.value.id || '';
- form.value.supplierId = editData.value.supplierId || '';
-};
+ // 鍙戠エ绫诲瀷閫夋嫨浜嬩欢
+ const onInvoiceTypeSelect = item => {
+ productData.value[currentProductIndex.value].invoiceType = item.name;
+ showInvoiceTypePicker.value = false;
+ };
-const getSalesNoList = () => {
- getSalesNo().then((res) => {
- // 灏嗙敤鎴锋暟鎹粍瑁呮垚 picker 闇�瑕佺殑鏍煎紡
- salesContractList.value = res.map(user => ({
- text: user.salesContractNo,
- value: user.id
- }));
- })
-};
+ // 鏍煎紡鍖栧嚱鏁� - 鍥哄畾涓や綅灏忔暟
+ const formatTaxPrice = idx => {
+ if (productData.value[idx].taxInclusiveUnitPrice) {
+ const value = parseFloat(productData.value[idx].taxInclusiveUnitPrice);
+ if (!isNaN(value)) {
+ productData.value[idx].taxInclusiveUnitPrice = value.toFixed(2);
+ }
+ }
+ if (!productData.value[currentProductIndex.value].taxRate) {
+ uni.showToast({
+ title: "璇峰厛閫夋嫨绋庣巼",
+ icon: "none",
+ });
+ return;
+ }
+ const quantity = parseFloat(
+ productData.value[currentProductIndex.value].quantity
+ );
+ const unitPrice = parseFloat(
+ productData.value[currentProductIndex.value].taxInclusiveUnitPrice
+ );
-const getOptionsLIst = () => {
- getOptions().then((res) => {
- // 灏嗙敤鎴锋暟鎹粍瑁呮垚 picker 闇�瑕佺殑鏍煎紡
- supplierList.value = res.data.map(item => ({
- text: item.supplierName,
- value: item.id
- }));
- })
-};
+ if (!quantity || quantity <= 0 || !unitPrice) {
+ return;
+ }
+ // 璁$畻鍚◣鎬讳环
+ productData.value[currentProductIndex.value].taxInclusiveTotalPrice = (
+ unitPrice * quantity
+ ).toFixed(2);
-const convertIdToValue = (data) => {
- // 濡傛灉浼犲叆鐨勪笉鏄暟缁勶紝鍒欒繑鍥炵┖鏁扮粍
- if (!Array.isArray(data)) {
- return [];
- }
- // 閫掑綊鏄犲皠鍑芥暟
- return data.map(item => {
- // 鍒涘缓鏂板璞★紝鏄犲皠瀛楁
- const mappedItem = {
- label: item.label, // 鍏抽敭锛氬皢 label 鏄犲皠涓� text
- id: item.id, // 淇濈暀 id
- };
- // 濡傛灉瀛樺湪 children 鏁扮粍锛屽垯閫掑綊澶勭悊
- if (item.children && Array.isArray(item.children) && item.children.length > 0) {
- mappedItem.children = convertIdToValue(item.children);
- }
- return mappedItem;
- });
-};
+ // 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
+ if (productData.value[currentProductIndex.value].taxRate) {
+ productData.value[currentProductIndex.value].taxExclusiveTotalPrice =
+ calculateTaxExclusiveTotalPrice(
+ productData.value[currentProductIndex.value].taxInclusiveTotalPrice,
+ productData.value[currentProductIndex.value].taxRate
+ );
+ }
+ };
-// 鑾峰彇浜у搧澶х被tree鏁版嵁
-const getProductOptions = () => {
- productTreeList().then((res) => {
- productOptions.value = convertIdToValue(res);
- });
-};
+ // 鏁伴噺杈撳叆妗嗗け鐒�
+ const formatAmount = idx => {
+ if (productData.value[idx].quantity) {
+ const value = parseFloat(productData.value[idx].quantity);
+ if (!isNaN(value)) {
+ productData.value[idx].quantity = value.toFixed(2);
+ }
+ }
+ if (!productData.value[currentProductIndex.value].taxRate) {
+ uni.showToast({
+ title: "璇峰厛閫夋嫨绋庣巼",
+ icon: "none",
+ });
+ return;
+ }
+ const quantity = parseFloat(
+ productData.value[currentProductIndex.value].quantity
+ );
+ const unitPrice = parseFloat(
+ productData.value[currentProductIndex.value].taxInclusiveUnitPrice
+ );
-onMounted(() => {
- // 鑾峰彇椤甸潰鍙傛暟
- operationType.value = uni.getStorageSync('operationType') || '';
-
- // 鑾峰彇閿�鍞悎鍚屽彿鍒楄〃
- getSalesNoList()
- // 鑾峰彇渚涘簲鍟嗗垪琛�
- getOptionsLIst()
- // 鑾峰彇浜у搧澶х被tree鏁版嵁
- getProductOptions()
- // 璧嬪�奸粯璁や俊鎭�
- if (operationType.value === 'add') {
- setUserInfo()
- createPurchaseNo().then((res) => {
- form.value.purchaseContractNumber = res.data;
- });
- }
-
- // 鑾峰彇缂栬緫鏁版嵁骞跺~鍏呰〃鍗�
- const editDataStr = uni.getStorageSync('editData');
- if (editDataStr) {
- try {
- editData.value = JSON.parse(editDataStr);
- // 濡傛灉鏄紪杈戞ā寮忥紝绛夊緟鏁版嵁鍔犺浇瀹屾垚鍚庡~鍏呰〃鍗曟暟鎹�
- if (operationType.value !== 'add' && editData.value) {
- // 浣跨敤 nextTick 纭繚鏁版嵁鍔犺浇瀹屾垚鍚庡啀濉厖
- setTimeout(() => {
- fillFormData();
- }, 100);
- }
- } catch (error) {
- console.error('瑙f瀽缂栬緫鏁版嵁澶辫触:', error);
- }
- }
-});
+ if (!quantity || quantity <= 0 || !unitPrice) {
+ return;
+ }
+ // 璁$畻鍚◣鎬讳环
+ productData.value[currentProductIndex.value].taxInclusiveTotalPrice = (
+ unitPrice * quantity
+ ).toFixed(2);
+ // 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
+ if (productData.value[currentProductIndex.value].taxRate) {
+ productData.value[currentProductIndex.value].taxExclusiveTotalPrice =
+ calculateTaxExclusiveTotalPrice(
+ productData.value[currentProductIndex.value].taxInclusiveTotalPrice,
+ productData.value[currentProductIndex.value].taxRate
+ );
+ }
+ };
+
+ // 鍚◣鎬讳环澶辩劍锛屾牴鎹惈绋庢�讳环璁$畻鍚◣鍗曚环鍜屾暟閲�
+ const formatTaxTotal = idx => {
+ if (productData.value[idx].taxInclusiveTotalPrice) {
+ const value = parseFloat(productData.value[idx].taxInclusiveTotalPrice);
+ if (!isNaN(value)) {
+ productData.value[idx].taxInclusiveTotalPrice = value.toFixed(2);
+ }
+ }
+ const totalPrice = parseFloat(
+ productData.value[currentProductIndex.value].taxInclusiveTotalPrice
+ );
+ const quantity = parseFloat(
+ productData.value[currentProductIndex.value].quantity
+ );
+
+ if (!totalPrice || !quantity || quantity <= 0) {
+ return;
+ }
+ // 璁$畻鍚◣鍗曚环 = 鍚◣鎬讳环 / 鏁伴噺
+ productData.value[currentProductIndex.value].taxInclusiveUnitPrice = (
+ totalPrice / quantity
+ ).toFixed(2);
+ // 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
+ if (productData.value[currentProductIndex.value].taxRate) {
+ productData.value[currentProductIndex.value].taxExclusiveTotalPrice =
+ calculateTaxExclusiveTotalPrice(
+ totalPrice,
+ productData.value[currentProductIndex.value].taxRate
+ );
+ }
+ };
+
+ // 涓嶅惈绋庢�讳环澶辩劍, 鏍规嵁涓嶅惈绋庢�讳环璁$畻鍚◣鍗曚环鍜屾暟閲�
+ const formatNoTaxTotal = idx => {
+ if (productData.value[idx].taxExclusiveTotalPrice) {
+ const value = parseFloat(productData.value[idx].taxExclusiveTotalPrice);
+ if (!isNaN(value)) {
+ productData.value[idx].taxExclusiveTotalPrice = value.toFixed(2);
+ }
+ }
+ if (!productData.value[currentProductIndex.value].taxRate) {
+ uni.showToast({
+ title: "璇峰厛閫夋嫨绋庣巼",
+ icon: "none",
+ });
+ return;
+ }
+ const exclusiveTotalPrice = parseFloat(
+ productData.value[currentProductIndex.value].taxExclusiveTotalPrice
+ );
+ const quantity = parseFloat(
+ productData.value[currentProductIndex.value].quantity
+ );
+ const taxRate = parseFloat(
+ productData.value[currentProductIndex.value].taxRate
+ );
+ if (!exclusiveTotalPrice || !quantity || quantity <= 0 || !taxRate) {
+ return;
+ }
+ // 鍏堣绠楀惈绋庢�讳环 = 涓嶅惈绋庢�讳环 / (1 - 绋庣巼/100)
+ const taxRateDecimal = taxRate / 100;
+ const inclusiveTotalPrice = exclusiveTotalPrice / (1 - taxRateDecimal);
+ productData.value[currentProductIndex.value].taxInclusiveTotalPrice =
+ inclusiveTotalPrice.toFixed(2);
+ // 璁$畻鍚◣鍗曚环 = 鍚◣鎬讳环 / 鏁伴噺
+ productData.value[currentProductIndex.value].taxInclusiveUnitPrice = (
+ inclusiveTotalPrice / quantity
+ ).toFixed(2);
+ };
+
+ const goBack = () => {
+ // 娓呯悊鏈湴瀛樺偍鐨勬暟鎹�
+ uni.removeStorageSync("operationType");
+ uni.removeStorageSync("editData");
+ uni.navigateBack();
+ };
+
+ const onSubmit = () => {
+ const hasEmptyApprover = approverNodes.value.some(node => !node.userId);
+ if (hasEmptyApprover) {
+ uni.showToast({
+ title: "璇蜂负鎵�鏈夊鎵硅妭鐐归�夋嫨瀹℃壒浜猴紒",
+ icon: "none",
+ });
+ return;
+ }
+ const approveUserIds = approverNodes.value.map(node => node.userId).join(",");
+
+ if (productData.value !== null && productData.value.length > 0) {
+ form.value.productData = JSON.parse(JSON.stringify(productData.value));
+ } else {
+ uni.showToast({
+ title: "璇锋坊鍔犱骇鍝佷俊鎭�",
+ icon: "none",
+ });
+ return;
+ }
+ // 濡傛灉salesLedgerId涓虹┖锛屽垯涓嶄紶閫抯alesContractNo
+ if (!form.value.salesLedgerId) {
+ form.value.salesContractNo = "";
+ }
+ if (operationType.value == "add") {
+ delete form.value.id;
+ }
+ form.value.approveUserIds = approveUserIds;
+ form.value.type = 2;
+ addOrEditPurchase(form.value).then(res => {
+ uni.showToast({
+ title: "鎻愪氦鎴愬姛",
+ icon: "success",
+ });
+ goBack();
+ });
+ };
+
+ const setUserInfo = () => {
+ form.value.recorderId = userStore.id;
+ form.value.recorderName = userStore.nickName;
+ // 璁剧疆褰撳ぉ鏃ユ湡
+ const today = new Date();
+ const year = today.getFullYear();
+ const month = String(today.getMonth() + 1).padStart(2, "0");
+ const day = String(today.getDate()).padStart(2, "0");
+ form.value.entryDate = `${year}-${month}-${day}`;
+ };
+
+ // 纭鏃ユ湡閫夋嫨
+ const onDateConfirm = e => {
+ form.value.executionDate = formatDateToYMD(e.value);
+ currentDate.value = e.value;
+ showTimePicker.value = false;
+ };
+
+ // 濉厖琛ㄥ崟鏁版嵁锛堢紪杈戞ā寮忥級
+ const fillFormData = () => {
+ if (!editData.value) return;
+ getPurchaseById({ id: editData.value.id, type: 2 }).then(res => {
+ productData.value = res.productData;
+ if (res && res.approveUserIds) {
+ const userIds = res.approveUserIds.split(",");
+ approverNodes.value = userIds.map((userId, idx) => {
+ const userIdNum = parseInt(userId.trim());
+ // 浠巙serList涓壘鍒板搴旂殑鐢ㄦ埛淇℃伅
+ console.log(userList.value, "userList.value");
+ const userInfo = userList.value.find(user => user.userId === userIdNum);
+ return {
+ id: idx + 1,
+ userId: userIdNum,
+ nickName: userInfo ? userInfo.nickName : null,
+ };
+ });
+ nextApproverId = userIds.length + 1;
+ } else {
+ // 鏂板妯″紡锛屽垵濮嬪寲涓�涓┖鐨勫鎵硅妭鐐�
+ approverNodes.value = [{ id: 1, userId: null, nickName: null }];
+ nextApproverId = 2;
+ }
+ });
+ console.log(editData.value);
+ // 濉厖鍩烘湰淇℃伅
+ form.value.purchaseContractNumber =
+ editData.value.purchaseContractNumber || "";
+ form.value.salesContractNo = editData.value.salesContractNo || "";
+ form.value.supplierName = editData.value.supplierName || "";
+ form.value.projectName = editData.value.projectName || "";
+ form.value.paymentMethod = editData.value.paymentMethod || "";
+ form.value.salesLedgerId = editData.value.salesLedgerId || "";
+ form.value.recorderId = editData.value.recorderId || "";
+ form.value.recorderName = editData.value.recorderName || "";
+ form.value.entryDate = editData.value.entryDate || "";
+ form.value.id = editData.value.id || "";
+ form.value.supplierId = editData.value.supplierId || "";
+ form.value.executionDate = editData.value.executionDate || "";
+ };
+
+ const getSalesNoList = () => {
+ getSalesNo().then(res => {
+ // 灏嗙敤鎴锋暟鎹粍瑁呮垚 picker 闇�瑕佺殑鏍煎紡
+ salesContractList.value = res.map(user => ({
+ text: user.salesContractNo,
+ value: user.id,
+ }));
+ });
+ };
+
+ const getOptionsLIst = () => {
+ getOptions().then(res => {
+ // 灏嗙敤鎴锋暟鎹粍瑁呮垚 picker 闇�瑕佺殑鏍煎紡
+ supplierList.value = res.data.map(item => ({
+ text: item.supplierName,
+ value: item.id,
+ }));
+ });
+ };
+
+ const convertIdToValue = data => {
+ // 濡傛灉浼犲叆鐨勪笉鏄暟缁勶紝鍒欒繑鍥炵┖鏁扮粍
+ if (!Array.isArray(data)) {
+ return [];
+ }
+ // 閫掑綊鏄犲皠鍑芥暟
+ return data.map(item => {
+ // 鍒涘缓鏂板璞★紝鏄犲皠瀛楁
+ const mappedItem = {
+ label: item.label, // 鍏抽敭锛氬皢 label 鏄犲皠涓� text
+ id: item.id, // 淇濈暀 id
+ };
+ // 濡傛灉瀛樺湪 children 鏁扮粍锛屽垯閫掑綊澶勭悊
+ if (
+ item.children &&
+ Array.isArray(item.children) &&
+ item.children.length > 0
+ ) {
+ mappedItem.children = convertIdToValue(item.children);
+ }
+ return mappedItem;
+ });
+ };
+
+ // 鑾峰彇浜у搧澶х被tree鏁版嵁
+ const getProductOptions = () => {
+ productTreeList().then(res => {
+ productOptions.value = convertIdToValue(res);
+ });
+ };
+ const approverNodes = ref([]);
+ let nextApproverId = 2;
+ const userList = ref([]);
+ onMounted(() => {
+ // 鑾峰彇椤甸潰鍙傛暟
+ operationType.value = uni.getStorageSync("operationType") || "";
+ userListNoPageByTenantId().then(res => {
+ userList.value = res.data;
+ });
+ // 鑾峰彇閿�鍞悎鍚屽彿鍒楄〃
+ getSalesNoList();
+ // 鑾峰彇渚涘簲鍟嗗垪琛�
+ getOptionsLIst();
+ // 鑾峰彇浜у搧澶х被tree鏁版嵁
+ getProductOptions();
+ // 璧嬪�奸粯璁や俊鎭�
+ if (operationType.value === "add") {
+ setUserInfo();
+ createPurchaseNo().then(res => {
+ form.value.purchaseContractNumber = res.data;
+ });
+ }
+
+ // 鐩戝惉鑱旂郴浜洪�夋嫨浜嬩欢
+ uni.$on("selectContact", handleSelectContact);
+
+ // 鑾峰彇缂栬緫鏁版嵁骞跺~鍏呰〃鍗�
+ const editDataStr = uni.getStorageSync("editData");
+ if (editDataStr) {
+ try {
+ editData.value = JSON.parse(editDataStr);
+ // 濡傛灉鏄紪杈戞ā寮忥紝绛夊緟鏁版嵁鍔犺浇瀹屾垚鍚庡~鍏呰〃鍗曟暟鎹�
+ if (operationType.value !== "add" && editData.value) {
+ // 浣跨敤 nextTick 纭繚鏁版嵁鍔犺浇瀹屾垚鍚庡啀濉厖
+ setTimeout(() => {
+ fillFormData();
+ }, 100);
+ }
+ } catch (error) {
+ console.error("瑙f瀽缂栬緫鏁版嵁澶辫触:", error);
+ }
+ } else {
+ approverNodes.value = [{ id: 1, userId: null }];
+ }
+ });
+ // 澶勭悊鑱旂郴浜洪�夋嫨缁撴灉
+ const handleSelectContact = data => {
+ const { stepIndex, contact } = data;
+ // 灏嗛�変腑鐨勮仈绯讳汉璁剧疆涓哄搴斿鎵规楠ょ殑瀹℃壒浜�
+ console.log(contact);
+ console.log(stepIndex, "stepIndex");
+ console.log(approverNodes.value[stepIndex], "瀹℃壒浜�");
+ approverNodes.value[stepIndex].userId = contact.userId;
+ approverNodes.value[stepIndex].nickName = contact.nickName;
+ };
+
+ const addApprover = stepIndex => {
+ // 璺宠浆鍒拌仈绯讳汉閫夋嫨椤甸潰
+ uni.setStorageSync("stepIndex", stepIndex);
+ uni.navigateTo({
+ url: "/pages/cooperativeOffice/collaborativeApproval/contactSelect",
+ });
+ };
+
+ const addApprovalStep = () => {
+ // 娣诲姞鏂扮殑瀹℃壒姝ラ
+ approverNodes.value.push({ userId: null, nickName: null });
+ console.log(approverNodes.value, "approverNodes.value");
+ };
+
+ const removeApprover = stepIndex => {
+ // 绉婚櫎瀹℃壒浜�
+ approverNodes.value[stepIndex].userId = null;
+ approverNodes.value[stepIndex].nickName = null;
+ };
+
+ const removeApprovalStep = stepIndex => {
+ // 纭繚鑷冲皯淇濈暀涓�涓鎵规楠�
+ if (approverNodes.value.length > 1) {
+ approverNodes.value.splice(stepIndex, 1);
+ } else {
+ uni.showToast({
+ title: "鑷冲皯闇�瑕佷竴涓鎵规楠�",
+ icon: "none",
+ });
+ }
+ };
</script>
<style scoped lang="scss">
-@import '@/static/scss/form-common.scss';
-</style>
+ @import "@/static/scss/form-common.scss";
+
+ .approval-process {
+ background: #fff;
+ margin: 16px;
+ border-radius: 16px;
+ padding: 16px;
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
+ }
+
+ .approval-header {
+ margin-bottom: 16px;
+ }
+
+ .approval-title {
+ font-size: 16px;
+ font-weight: 600;
+ color: #333;
+ display: block;
+ margin-bottom: 4px;
+ }
+
+ .approval-desc {
+ font-size: 12px;
+ color: #999;
+ }
+
+ /* 鏍峰紡澧炲己涓衡�滅畝娲佸皬鍦嗗湀椋庢牸鈥� */
+ .approval-steps {
+ padding-left: 22px;
+ position: relative;
+
+ &::before {
+ content: "";
+ position: absolute;
+ left: 11px;
+ top: 40px;
+ bottom: 40px;
+ width: 2px;
+ background: linear-gradient(
+ to bottom,
+ #e6f7ff 0%,
+ #bae7ff 50%,
+ #91d5ff 100%
+ );
+ border-radius: 1px;
+ }
+ }
+
+ .approval-step {
+ position: relative;
+ margin-bottom: 24px;
+
+ &::before {
+ content: "";
+ position: absolute;
+ left: -18px;
+ top: 14px; // 浠� 8px 璋冩暣涓� 14px锛屼笌鏂囧瓧涓績瀵归綈
+ width: 12px;
+ height: 12px;
+ background: #fff;
+ border: 3px solid #006cfb;
+ border-radius: 50%;
+ z-index: 2;
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
+ }
+ }
+
+ .step-title {
+ top: 12px;
+ margin-bottom: 12px;
+ position: relative;
+ margin-left: 6px;
+ }
+
+ .step-title text {
+ font-size: 14px;
+ color: #666;
+ background: #f0f0f0;
+ padding: 4px 12px;
+ border-radius: 12px;
+ position: relative;
+ line-height: 1.4; // 纭繚鏂囧瓧琛岄珮涓�鑷�
+ }
+
+ .approver-item {
+ display: flex;
+ align-items: center;
+ background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
+ border-radius: 16px;
+ padding: 16px;
+ gap: 12px;
+ position: relative;
+ border: 1px solid #e6f7ff;
+ box-shadow: 0 4px 12px rgba(0, 108, 251, 0.08);
+ transition: all 0.3s ease;
+ }
+
+ .approver-avatar {
+ width: 48px;
+ height: 48px;
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ position: relative;
+ box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
+ }
+
+ .avatar-text {
+ color: #fff;
+ font-size: 18px;
+ font-weight: 600;
+ text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
+ }
+
+ .approver-info {
+ flex: 1;
+ position: relative;
+ }
+
+ .approver-name {
+ display: block;
+ font-size: 16px;
+ color: #333;
+ font-weight: 500;
+ position: relative;
+ }
+
+ .approver-dept {
+ font-size: 12px;
+ color: #999;
+ background: rgba(0, 108, 251, 0.05);
+ padding: 2px 8px;
+ border-radius: 8px;
+ display: inline-block;
+ position: relative;
+
+ &::before {
+ content: "";
+ position: absolute;
+ left: 4px;
+ top: 50%;
+ transform: translateY(-50%);
+ width: 2px;
+ height: 2px;
+ background: #006cfb;
+ border-radius: 50%;
+ }
+ }
+
+ .delete-approver-btn {
+ font-size: 16px;
+ color: #ff4d4f;
+ background: linear-gradient(
+ 135deg,
+ rgba(255, 77, 79, 0.1) 0%,
+ rgba(255, 77, 79, 0.05) 100%
+ );
+ width: 28px;
+ height: 28px;
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ transition: all 0.3s ease;
+ position: relative;
+ }
+
+ .add-approver-btn {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ background: linear-gradient(135deg, #f0f8ff 0%, #e6f7ff 100%);
+ border: 2px dashed #006cfb;
+ border-radius: 16px;
+ padding: 20px;
+ color: #006cfb;
+ font-size: 14px;
+ position: relative;
+ transition: all 0.3s ease;
+
+ &::before {
+ content: "";
+ position: absolute;
+ left: 50%;
+ top: 50%;
+ transform: translate(-50%, -50%);
+ width: 32px;
+ height: 32px;
+ border: 2px solid #006cfb;
+ border-radius: 50%;
+ opacity: 0;
+ transition: all 0.3s ease;
+ }
+ }
+
+ .delete-step-btn {
+ color: #ff4d4f;
+ font-size: 12px;
+ background: linear-gradient(
+ 135deg,
+ rgba(255, 77, 79, 0.1) 0%,
+ rgba(255, 77, 79, 0.05) 100%
+ );
+ padding: 6px 12px;
+ border-radius: 12px;
+ display: inline-block;
+ position: relative;
+ transition: all 0.3s ease;
+
+ &::before {
+ content: "";
+ position: absolute;
+ left: 6px;
+ top: 50%;
+ transform: translateY(-50%);
+ width: 4px;
+ height: 4px;
+ background: #ff4d4f;
+ border-radius: 50%;
+ }
+ }
+
+ .step-line {
+ display: none; // 闅愯棌鍘熸潵鐨勭嚎鏉★紝浣跨敤浼厓绱犱唬鏇�
+ }
+
+ .add-step-btn {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+ .footer-btns {
+ position: fixed;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: #fff;
+ display: flex;
+ justify-content: space-around;
+ align-items: center;
+ padding: 0.75rem 0;
+ box-shadow: 0 -0.125rem 0.5rem rgba(0, 0, 0, 0.05);
+ z-index: 1000;
+ }
+
+ .cancel-btn {
+ font-weight: 400;
+ font-size: 1rem;
+ color: #ffffff;
+ width: 6.375rem;
+ background: #c7c9cc;
+ box-shadow: 0 0.25rem 0.625rem 0 rgba(3, 88, 185, 0.2);
+ border-radius: 2.5rem 2.5rem 2.5rem 2.5rem;
+ }
+
+ .save-btn {
+ font-weight: 400;
+ font-size: 1rem;
+ color: #ffffff;
+ width: 14rem;
+ background: linear-gradient(140deg, #00baff 0%, #006cfb 100%);
+ box-shadow: 0 0.25rem 0.625rem 0 rgba(3, 88, 185, 0.2);
+ border-radius: 2.5rem 2.5rem 2.5rem 2.5rem;
+ }
+
+ // 鍔ㄧ敾瀹氫箟
+ @keyframes pulse {
+ 0% {
+ transform: scale(1);
+ opacity: 1;
+ }
+ 50% {
+ transform: scale(1.2);
+ opacity: 0.7;
+ }
+ 100% {
+ transform: scale(1);
+ opacity: 1;
+ }
+ }
+
+ @keyframes rotate {
+ 0% {
+ transform: rotate(0deg);
+ }
+ 100% {
+ transform: rotate(360deg);
+ }
+ }
+
+ @keyframes ripple {
+ 0% {
+ transform: translate(-50%, -50%) scale(0.8);
+ opacity: 1;
+ }
+ 100% {
+ transform: translate(-50%, -50%) scale(1.6);
+ opacity: 0;
+ }
+ }
+
+ /* 濡傛灉宸叉湁 .step-line锛岃繖閲屾洿绮惧噯瀹氫綅鍒板乏渚т笌灏忓渾鐐瑰榻� */
+ .step-line {
+ position: absolute;
+ left: 4px;
+ top: 48px;
+ width: 2px;
+ height: calc(100% - 48px);
+ background: #e5e7eb;
+ }
+
+ .approver-container {
+ display: flex;
+ align-items: center;
+ background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
+ border-radius: 16px;
+ gap: 12px;
+ padding: 10px 0;
+ background: transparent;
+ border: none;
+ box-shadow: none;
+ }
+
+ .approver-item {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ padding: 8px 10px;
+ background: transparent;
+ border: none;
+ box-shadow: none;
+ border-radius: 0;
+ }
+
+ .approver-avatar {
+ position: relative;
+ width: 40px;
+ height: 40px;
+ border-radius: 50%;
+ background: #f3f4f6;
+ border: 2px solid #e5e7eb;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ animation: none; /* 绂佺敤鏃嬭浆绛夊姩鐢伙紝鍥炲綊绠�娲� */
+ }
+
+ .avatar-text {
+ font-size: 14px;
+ color: #374151;
+ font-weight: 600;
+ }
+
+ .add-approver-btn {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ background: transparent;
+ border: none;
+ box-shadow: none;
+ padding: 0;
+ }
+
+ .add-approver-btn .add-circle {
+ width: 40px;
+ height: 40px;
+ border: 2px dashed #a0aec0;
+ border-radius: 50%;
+ color: #6b7280;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 22px;
+ line-height: 1;
+ }
+
+ .add-approver-btn .add-label {
+ color: #3b82f6;
+ font-size: 14px;
+ }
+</style>
\ No newline at end of file
diff --git a/src/pages/procurementManagement/procurementLedger/index.vue b/src/pages/procurementManagement/procurementLedger/index.vue
index 458eac2..ebcf07a 100644
--- a/src/pages/procurementManagement/procurementLedger/index.vue
+++ b/src/pages/procurementManagement/procurementLedger/index.vue
@@ -1,193 +1,221 @@
<template>
- <view class="sales-account">
- <!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
- <PageHeader title="閲囪喘鍙拌处" @back="goBack" />
-
- <!-- 鎼滅储鍜岀瓫閫夊尯鍩� -->
- <view class="search-section">
- <view class="search-bar">
- <view class="search-input">
- <up-input
- class="search-text"
- placeholder="璇疯緭鍏ラ噰璐悎鍚屽彿鎼滅储"
- v-model="purchaseContractNumber"
- @change="getList"
- clearable
- />
- </view>
- <view class="filter-button" @click="getList">
- <up-icon name="search" size="24" color="#999"></up-icon>
- </view>
- </view>
- </view>
-
- <!-- 閲囪喘鍙拌处鐎戝竷娴� -->
- <view class="ledger-list" v-if="ledgerList.length > 0">
- <view v-for="(item, index) in ledgerList" :key="index">
- <view class="ledger-item" @click="handleInfo('edit', item)">
- <view class="item-header">
- <view class="item-left">
- <view class="document-icon">
- <up-icon name="file-text" size="16" color="#ffffff"></up-icon>
- </view>
- <text class="item-id">{{ item.purchaseContractNumber }}</text>
- </view>
- <!-- <view class="item-tag">-->
- <!-- <text class="tag-text">{{ item.recorder }}</text>-->
- <!-- </view>-->
- </view>
- <up-divider></up-divider>
-
- <view class="item-details">
- <view class="detail-row">
- <text class="detail-label">閿�鍞悎鍚屽彿</text>
- <text class="detail-value">{{ item.salesContractNo }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">渚涘簲鍟嗗悕绉�</text>
- <text class="detail-value">{{ item.supplierName }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">椤圭洰鍚嶇О</text>
- <text class="detail-value">{{ item.projectName }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">浠樻鏂瑰紡</text>
- <text class="detail-value">{{ item.paymentMethod }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">鍚堝悓閲戦(鍏�)</text>
- <text class="detail-value highlight">{{ item.contractAmount }}</text>
- </view>
- <up-divider></up-divider>
- <view class="detail-info">
- <view class="detail-row">
- <text class="detail-label">褰曞叆浜�</text>
- <text class="detail-value">{{ item.recorderName }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">褰曞叆鏃ユ湡</text>
- <text class="detail-value">{{ item.entryDate }}</text>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view v-else class="no-data">
- <text>鏆傛棤閲囪喘鍙拌处鏁版嵁</text>
- </view>
-
- <!-- 娴姩鎿嶄綔鎸夐挳 -->
- <view class="fab-button" @click="handleInfo('add')">
- <up-icon name="plus" size="24" color="#ffffff"></up-icon>
- </view>
- </view>
+ <view class="sales-account">
+ <!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
+ <PageHeader title="閲囪喘鍙拌处"
+ @back="goBack" />
+ <!-- 鎼滅储鍜岀瓫閫夊尯鍩� -->
+ <view class="search-section">
+ <view class="search-bar">
+ <view class="search-input">
+ <up-input class="search-text"
+ placeholder="璇疯緭鍏ラ噰璐悎鍚屽彿鎼滅储"
+ v-model="purchaseContractNumber"
+ @change="getList"
+ clearable />
+ </view>
+ <view class="filter-button"
+ @click="getList">
+ <up-icon name="search"
+ size="24"
+ color="#999"></up-icon>
+ </view>
+ </view>
+ </view>
+ <!-- 閲囪喘鍙拌处鐎戝竷娴� -->
+ <view class="ledger-list"
+ v-if="ledgerList.length > 0">
+ <view v-for="(item, index) in ledgerList"
+ :key="index">
+ <view class="ledger-item"
+ @click="handleInfo('edit', item)">
+ <view class="item-header">
+ <view class="item-left">
+ <view class="document-icon">
+ <up-icon name="file-text"
+ size="16"
+ color="#ffffff"></up-icon>
+ </view>
+ <text class="item-id">{{ item.purchaseContractNumber }}</text>
+ </view>
+ <view class="item-tag">
+ <u-tag :type="getApprovalStatusType(item.approvalStatus)">
+ {{ approvalStatusText[item.approvalStatus] || '鏈煡鐘舵��' }}
+ </u-tag>
+ </view>
+ </view>
+ <up-divider></up-divider>
+ <view class="item-details">
+ <view class="detail-row">
+ <text class="detail-label">閿�鍞悎鍚屽彿</text>
+ <text class="detail-value">{{ item.salesContractNo }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">渚涘簲鍟嗗悕绉�</text>
+ <text class="detail-value">{{ item.supplierName }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">椤圭洰鍚嶇О</text>
+ <text class="detail-value">{{ item.projectName }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">浠樻鏂瑰紡</text>
+ <text class="detail-value">{{ item.paymentMethod }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鍚堝悓閲戦(鍏�)</text>
+ <text class="detail-value highlight">{{ item.contractAmount }}</text>
+ </view>
+ <up-divider></up-divider>
+ <view class="detail-info">
+ <view class="detail-row">
+ <text class="detail-label">褰曞叆浜�</text>
+ <text class="detail-value">{{ item.recorderName }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">褰曞叆鏃ユ湡</text>
+ <text class="detail-value">{{ item.entryDate }}</text>
+ </view>
+ </view>
+ </view>
+ </view>
+ </view>
+ </view>
+ <view v-else
+ class="no-data">
+ <text>鏆傛棤閲囪喘鍙拌处鏁版嵁</text>
+ </view>
+ <!-- 娴姩鎿嶄綔鎸夐挳 -->
+ <view class="fab-button"
+ @click="handleInfo('add')">
+ <up-icon name="plus"
+ size="24"
+ color="#ffffff"></up-icon>
+ </view>
+ </view>
</template>
<script setup>
-import { ref } from 'vue';
-import { onShow } from '@dcloudio/uni-app';
-import useUserStore from "@/store/modules/user";
-import PageHeader from "@/components/PageHeader.vue";
-import {purchaseListPage} from "@/api/procurementManagement/procurementLedger";
-const userStore = useUserStore()
+ import { ref } from "vue";
+ import { onShow } from "@dcloudio/uni-app";
+ import useUserStore from "@/store/modules/user";
+ import PageHeader from "@/components/PageHeader.vue";
+ import { purchaseListPage } from "@/api/procurementManagement/procurementLedger";
+ const userStore = useUserStore();
+ const approvalStatusText = {
+ 1: "寰呭鏍�",
+ 2: "瀹℃壒涓�",
+ 3: "瀹℃壒閫氳繃",
+ 4: "瀹℃壒澶辫触",
+ };
+ // 鑾峰彇瀹℃壒鐘舵�佹爣绛剧被鍨�
+ const getApprovalStatusType = status => {
+ const typeMap = {
+ 1: "info", // 寰呭鏍� - 鐏拌壊
+ 2: "warning", // 瀹℃壒涓� - 姗欒壊
+ 3: "success", // 瀹℃壒閫氳繃 - 缁胯壊
+ 4: "error", // 瀹℃壒澶辫触 - 绾㈣壊
+ };
+ return typeMap[status] || "";
+ };
+ // 鎼滅储鍏抽敭璇�
+ const purchaseContractNumber = ref("");
-// 鎼滅储鍏抽敭璇�
-const purchaseContractNumber = ref('');
+ // 閲囪喘鍙拌处鏁版嵁
+ const ledgerList = ref([]);
-// 閲囪喘鍙拌处鏁版嵁
-const ledgerList = ref([]);
-
-// 杩斿洖涓婁竴椤�
-const goBack = () => {
- uni.navigateBack();
-};
-// 鏌ヨ鍒楄〃
-const getList = () => {
- showLoadingToast('鍔犺浇涓�...')
- const page = {
- current: -1,
- size: -1
- }
- purchaseListPage({...page, purchaseContractNumber: purchaseContractNumber.value}).then((res) => {
- ledgerList.value = res.data.records;
- closeToast()
- }).catch(() => {
- closeToast()
- });
-};
-
-// 鏄剧ず鍔犺浇鎻愮ず
-const showLoadingToast = (message) => {
- uni.showLoading({
- title: message,
- mask: true
- });
-};
-
-// 鍏抽棴鎻愮ず
-const closeToast = () => {
- uni.hideLoading();
-};
-
-// 澶勭悊鍙拌处淇℃伅鎿嶄綔锛堟煡鐪�/缂栬緫/鏂板锛�
-const handleInfo = (type, row) => {
- try {
- // 璁剧疆鎿嶄綔绫诲瀷
- uni.setStorageSync('operationType', type);
-
- // 濡傛灉鏄煡鐪嬫垨缂栬緫鎿嶄綔
- if (type !== 'add') {
- // 楠岃瘉琛屾暟鎹槸鍚﹀瓨鍦�
- if (!row) {
- uni.showToast({
- title: '鏁版嵁涓嶅瓨鍦�',
- icon: 'error'
- });
- return;
- }
-
- // 妫�鏌ユ潈闄愶細鍙湁褰曞叆浜烘墠鑳界紪杈�
- if (row.recorderName != userStore.nickName) {
- // 闈炲綍鍏ヤ汉璺宠浆鍒板彧璇昏鎯呴〉闈�
- uni.setStorageSync('editData', JSON.stringify(row));
- uni.navigateTo({
- url: '/pages/procurementManagement/procurementLedger/view'
- });
- return;
- }
-
- // 褰曞叆浜虹紪杈戯細瀛樺偍鏁版嵁骞惰烦杞埌缂栬緫椤甸潰
- uni.setStorageSync('editData', JSON.stringify(row));
- uni.navigateTo({
- url: '/pages/procurementManagement/procurementLedger/detail'
+ // 杩斿洖涓婁竴椤�
+ const goBack = () => {
+ uni.navigateBack();
+ };
+ // 鏌ヨ鍒楄〃
+ const getList = () => {
+ showLoadingToast("鍔犺浇涓�...");
+ const page = {
+ current: -1,
+ size: -1,
+ };
+ purchaseListPage({
+ ...page,
+ purchaseContractNumber: purchaseContractNumber.value,
+ })
+ .then(res => {
+ ledgerList.value = res.data.records;
+ closeToast();
+ })
+ .catch(() => {
+ closeToast();
});
- return;
- }
-
- // 鏂板鎿嶄綔锛氱洿鎺ヨ烦杞埌缂栬緫椤甸潰
- uni.navigateTo({
- url: '/pages/procurementManagement/procurementLedger/detail'
- });
-
- } catch (error) {
- console.error('澶勭悊鍙拌处淇℃伅鎿嶄綔澶辫触:', error);
- uni.showToast({
- title: '鎿嶄綔澶辫触锛岃閲嶈瘯',
- icon: 'error'
- });
- }
-};
+ };
-onShow(() => {
+ // 鏄剧ず鍔犺浇鎻愮ず
+ const showLoadingToast = message => {
+ uni.showLoading({
+ title: message,
+ mask: true,
+ });
+ };
+
+ // 鍏抽棴鎻愮ず
+ const closeToast = () => {
+ uni.hideLoading();
+ };
+
+ // 澶勭悊鍙拌处淇℃伅鎿嶄綔锛堟煡鐪�/缂栬緫/鏂板锛�
+ const handleInfo = (type, row) => {
+ try {
+ // 璁剧疆鎿嶄綔绫诲瀷
+ uni.setStorageSync("operationType", type);
+
+ // 濡傛灉鏄煡鐪嬫垨缂栬緫鎿嶄綔
+ if (type !== "add") {
+ // 楠岃瘉琛屾暟鎹槸鍚﹀瓨鍦�
+ if (!row) {
+ uni.showToast({
+ title: "鏁版嵁涓嶅瓨鍦�",
+ icon: "error",
+ });
+ return;
+ }
+
+ // 妫�鏌ユ潈闄愶細鍙湁褰曞叆浜烘墠鑳界紪杈�
+ if (row.recorderName != userStore.nickName) {
+ // 闈炲綍鍏ヤ汉璺宠浆鍒板彧璇昏鎯呴〉闈�
+ uni.setStorageSync("editData", JSON.stringify(row));
+ uni.navigateTo({
+ url: "/pages/procurementManagement/procurementLedger/view",
+ });
+ return;
+ }
+
+ // 褰曞叆浜虹紪杈戯細瀛樺偍鏁版嵁骞惰烦杞埌缂栬緫椤甸潰
+ uni.setStorageSync("editData", JSON.stringify(row));
+ uni.navigateTo({
+ url: "/pages/procurementManagement/procurementLedger/detail",
+ });
+ return;
+ }
+
+ // 鏂板鎿嶄綔锛氱洿鎺ヨ烦杞埌缂栬緫椤甸潰
+ uni.navigateTo({
+ url: "/pages/procurementManagement/procurementLedger/detail",
+ });
+ } catch (error) {
+ console.error("澶勭悊鍙拌处淇℃伅鎿嶄綔澶辫触:", error);
+ uni.showToast({
+ title: "鎿嶄綔澶辫触锛岃閲嶈瘯",
+ icon: "error",
+ });
+ }
+ };
+
+ onShow(() => {
// 椤甸潰鏄剧ず鏃跺埛鏂板垪琛�
getList();
-});
+ });
</script>
<style scoped lang="scss">
-@import '@/styles/procurement-common.scss';
+ @import "@/styles/procurement-common.scss";
-// 閲囪喘鍙拌处鐗规湁鏍峰紡锛堝鏈夐渶瑕佸彲鍦ㄦ娣诲姞锛�
+ // 閲囪喘鍙拌处鐗规湁鏍峰紡锛堝鏈夐渶瑕佸彲鍦ㄦ娣诲姞锛�
</style>
--
Gitblit v1.9.3