snow 2 роки тому
батько
коміт
99ed422ac1

+ 19 - 2
src/views/InvoiceSales/invoiceApply/components/add-edit-form/add-edit-form.vue

@@ -34,6 +34,9 @@ const responseHandle = useResponseHandle();
 const loading = ref(false);
 const orderList = ref([]);
 
+//最大开票金额
+const denomination = ref(0);
+
 const max = 150;
 
 const initform = {
@@ -103,6 +106,7 @@ function generatorOrderArr() {
 function handleSave() {
   formRef.value.validate(async isValid => {
     if (!isValid) return;
+
     if (ruleForm.value.remark.length > 184) {
       return ElMessage.error("发票备注不能超过184个字符");
     }
@@ -111,6 +115,16 @@ function handleSave() {
       return ElMessage.error(`订单数量不能超过${max}个`);
     }
 
+    const { orderArr } = generatorOrderArr();
+    const total = orderArr.reduce(
+      (prev, { inv_fee }) => prev + Number(inv_fee),
+      0
+    );
+
+    if (total > denomination.value) {
+      return ElMessage.error(`订单总金额超过最大开票面额`);
+    }
+
     const { code, message } = await httpAdd({
       ...ruleForm.value,
       ...generatorOrderArr()
@@ -161,14 +175,17 @@ function handleInvoiceTitle(
   invoiceTitle: Record<string, string>
 ) {
   if (!invoiceTitle) {
-    if (_isSeller) return (sellerInvoiceTitle.value = {});
+    if (_isSeller) {
+      return (sellerInvoiceTitle.value = {});
+    }
 
     return (purchaserInvoiceTitle.value = {});
   }
 
   if (_isSeller) {
     //支持的开票方式
-    const { invoiceType } = invoiceTitle;
+    const { invoiceType, denomination: _denomination } = invoiceTitle;
+    denomination.value = Number(_denomination) * 10000;
     const chunks = invoiceType.split(",");
     ruleForm.value.invtype = "";
     invoiceTypes.value = mapInvoiceType.filter(({ map_value }) =>

+ 23 - 14
src/views/InvoiceSales/invoiceApply/components/add-edit-form/edit-order.vue

@@ -46,21 +46,30 @@ defineExpose({
       :columns="order_detail_columns"
     >
       <template #custom>
-        <el-descriptions-item label="开票数量">
-          <el-input-number
-            size="small"
-            :min="1"
-            :max="totalNum"
-            v-model="total"
-        /></el-descriptions-item>
+        <el-row>
+          <div class="col-item">
+            <p class="col-label">开票数量</p>
+            <p class="col-value">
+              <el-input-number
+                size="small"
+                :min="1"
+                :max="totalNum"
+                v-model="total"
+              />
+            </p>
+          </div>
 
-        <el-descriptions-item label="开票金额">
-          <el-input-number
-            placeholder="请输入开票金额"
-            size="small"
-            v-model="inv_fee"
-          />
-        </el-descriptions-item>
+          <div class="col-item">
+            <p class="col-label">开票金额</p>
+            <p class="col-value">
+              <el-input-number
+                placeholder="请输入开票金额"
+                size="small"
+                v-model="inv_fee"
+              />
+            </p>
+          </div>
+        </el-row>
       </template>
     </BasicDescriptions>
 

+ 11 - 0
src/views/InvoiceSales/invoiceApply/detail.vue

@@ -9,6 +9,7 @@ import InvoiceDetailVue from "./components/invoice-detail/index.vue";
 import AddEditForm from "./components/add-edit-form/add-edit-form.vue";
 import { useUserInfo } from "/@/hooks/core/useUser";
 import { usePermission } from "/@/hooks/core/usePermission";
+import { httpSupplierall } from "/@/api/user";
 
 import {
   httpSetPost,
@@ -40,8 +41,15 @@ const {
   run: invoiceDetailRun
 } = useAsync<Record<string, string>>({
   initalData: {}
+  // success: ({ inv_out: companyNo }) =>
+  //   runCompany(httpSupplierall({ companyNo }))
 });
 
+// const { run: runCompany, data: company } = useAsync({
+//   isList: true
+// success: () => console.log(company.value[0])
+// });
+
 const { data: list, run: listRun } = useAsync<Array<Record<string, string>>>({
   isList: true,
   initalData: []
@@ -53,6 +61,9 @@ const showApproval = computed(() => {
   );
 });
 
+//最大开票金额
+// const maxOpen = computed(() => {});
+
 //是否电子票
 const isElectronic = computed(() => {
   const { inv_type } = invoiceDetail.value;