From 239f117fab7b05566914fb3f4f445203f08ded3d Mon Sep 17 00:00:00 2001
From: maven <2163098428@qq.com>
Date: 星期三, 27 八月 2025 13:19:06 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_JLMY' into dev_JLMY

---
 src/views/salesOutbound/index.vue |  306 ++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 254 insertions(+), 52 deletions(-)

diff --git a/src/views/salesOutbound/index.vue b/src/views/salesOutbound/index.vue
index ab8942c..8f06840 100644
--- a/src/views/salesOutbound/index.vue
+++ b/src/views/salesOutbound/index.vue
@@ -1,34 +1,21 @@
 <template>
   <div class="app-container">
     <el-form :inline="true" :model="queryParams" class="search-form">
-      <el-form-item label="鎼滅储">
-        <el-input
-            v-model="queryParams.searchText"
-            placeholder="璇疯緭鍏ュ叧閿瘝"
-            clearable
-            :style="{ width: '100%' }"
-        />
+      <el-form-item label="閿�鍞棩鏈�">
+				<el-date-picker
+					v-model="queryParams.saleDate"
+					type="date"
+					value-format="YYYY-MM-DD"
+					format="YYYY-MM-DD"
+					clearable
+					style="width: 100%"
+					placeholder="璇烽�夋嫨鏃ユ湡"
+				/>
       </el-form-item>
-      <el-form-item label="渚涘簲鍟嗗悕绉�">
+      <el-form-item label="鐓ょ">
         <el-input
-            v-model="queryParams.supplierName"
-            placeholder="璇疯緭鍏�"
-            clearable
-            :style="{ width: '100%' }"
-        />
-      </el-form-item>
-      <el-form-item label="缁熶竴浜鸿瘑鍒彿">
-        <el-input
-            v-model="queryParams.identifyNumber"
-            placeholder="璇疯緭鍏�"
-            clearable
-            :style="{ width: '100%' }"
-        />
-      </el-form-item>
-      <el-form-item label="缁忚惀鍦板潃">
-        <el-input
-            v-model="queryParams.address"
-            placeholder="璇疯緭鍏�"
+            v-model="queryParams.coal"
+            placeholder="璇疯緭鍏ョ叅绉�"
             clearable
             :style="{ width: '100%' }"
         />
@@ -50,7 +37,8 @@
       </el-tabs>
       <!-- 鎿嶄綔鎸夐挳鍖� -->
       <el-space>
-        <el-button type="primary" :icon="Plus" @click="openDia('add')">鏂板缓</el-button>
+        <el-button type="primary" @click="openForm('add')">鏂板搴旀敹</el-button>
+        <el-button type="primary" :icon="Plus" @click="openDia(undefined, 'add')">鏂板缓</el-button>
         <el-button type="danger" :icon="Delete" @click="handleDelete">鍒犻櫎</el-button>
         <el-button type="info" plain :icon="Download" @click="handleExport">瀵煎嚭</el-button>
       </el-space>
@@ -62,29 +50,152 @@
                 @selection-change="handleSelectionChange"
                 :show-selection="true"
                 :border="true"
-                :maxHeight="480"
-                @edit="openDia"></ETable>
+                :operations="operationsArr"
+                style="width: 100%;height: calc(100vh - 30em)"
+                @edit="(row) => openDia(row, 'edit')"
+                @viewRow="(row) => openDia(row, 'view')"
+        ></ETable>
       </div>
       <pagination
           v-if="total>0"
-          :page-num="pageNum"
-          :page-size="pageSize"
+          :page="pageNum"
+          :limit="pageSize"
           :total="total"
-          @pagination="handleQuery"
+          @pagination="handlePagination"
           :layout="'total, prev, pager, next, jumper'"
       />
     </el-card>
     <form-dia ref="formDia" @closeDia="handleQuery"></form-dia>
+    
+    <!-- 鏂板搴旀敹寮圭獥 -->
+    <el-dialog
+      v-model="dialogFormVisible"
+      title="鏂板搴旀敹"
+      width="70%"
+      @close="closeDia"
+    >
+      <el-form
+        :model="former"
+        label-width="140px"
+        label-position="top"
+        :rules="rules"
+        ref="formRef"
+      >
+        <el-row :gutter="30">
+          <el-col :span="12">
+            <el-form-item label="瀹㈡埛鍚嶇О锛�" prop="customer">
+              <el-input
+                v-model="former.customer"
+                placeholder="鑷姩濉厖"
+                disabled
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="鐓ょ锛�" prop="coal">
+              <el-input
+                v-model="former.coal"
+                placeholder="鑷姩濉厖"
+                disabled
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="30">
+          <el-col :span="12">
+            <el-form-item label="閿�鍞�婚噾棰�(鍏�)锛�" prop="totalAmount">
+              <el-input
+                type="number"
+                v-model="former.totalAmount"
+                placeholder="鑷姩濉厖"
+                :step="0.01"
+                disabled
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="鏈搴旀敹閲戦锛�" prop="receiptPaymentAmount">
+              <el-input-number :step="0.01" :min="0" style="width: 100%"
+															 :precision="2"
+                v-model="former.receiptPaymentAmount"
+                placeholder="璇疯緭鍏�"
+                clearable
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="30">
+          <el-col :span="12">
+            <el-form-item label="鍥炴褰㈠紡锛�" prop="receiptPaymentType">
+              <el-select
+                v-model="former.receiptPaymentType"
+                placeholder="璇烽�夋嫨"
+                clearable
+              >
+                <el-option
+                  v-for="item in receipt_payment_type"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value"
+                />
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="鐧昏浜猴細" prop="registrant">
+              <el-input
+                v-model="former.registrant"
+                placeholder="璇疯緭鍏�"
+                clearable
+                disabled
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="30">
+          <el-col :span="12">
+            <el-form-item label="鏉ユ鏃ユ湡锛�" prop="receiptPaymentDate">
+              <el-date-picker
+                style="width: 100%"
+                v-model="former.receiptPaymentDate"
+                value-format="YYYY-MM-DD"
+                format="YYYY-MM-DD"
+                type="date"
+                placeholder="璇烽�夋嫨"
+                clearable
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+      <template #footer>
+        <div class="dialog-footer">
+          <el-button type="primary" @click="submitForm">纭</el-button>
+          <el-button @click="closeDia">鍙栨秷</el-button>
+        </div>
+      </template>
+    </el-dialog>
   </div>
 </template>
 
 <script setup>
-import {ref, reactive} from "vue";
+import {ref, reactive, onMounted, nextTick} from "vue";
 const { proxy } = getCurrentInstance()
+const { receipt_payment_type } = proxy.useDict("receipt_payment_type");
 import {Delete, Download, Plus} from "@element-plus/icons-vue";
+import { ElMessage } from "element-plus";
 import ETable from "@/components/Table/ETable.vue";
 import Pagination from "@/components/Pagination/index.vue";
 import FormDia from "@/views/salesOutbound/components/formDia.vue";
+import {delSalesRecord, salesRecordList} from "@/api/salesOutbound/index.js";
+import {
+  receiptPaymentSaveOrUpdate,
+  bindInvoiceNoRegPage,
+  invoiceInfo,
+  receiptPaymentHistoryListNoPage,
+  receiptPaymentDel,
+} from "@/api/salesManagement/receiptPayment.js";
+
 
 const formDia = ref()
 const activeTab = ref("out");
@@ -93,38 +204,56 @@
   { name: "out", label: "閿�鍞嚭搴�" },
 ]);
 // 琛ㄦ牸鏁版嵁
+const operationsArr = ref(['edit', 'viewRow']);
 const tableLoading = ref(false);
+const dialogFormVisible = ref(false);
 const tableData = ref([]);
 const columns = ref([
-  { prop: "supplierName", label: "閿�鍞棩鏈�", minWidth: 160 },
-  { prop: "identifyNumber", label: "瀹㈡埛", minWidth: 120 },
-  { prop: "address", label: "鐓ょ", minWidth: 150 },
+  { prop: "saleDate", label: "閿�鍞棩鏈�", minWidth: 160 },
+  { prop: "customer", label: "瀹㈡埛", minWidth: 120 },
+  { prop: "coal", label: "鐓ょ", minWidth: 150 },
   { prop: "unit", label: "鍗曚綅", minWidth: 150 },
-  { prop: "bank", label: "搴撳瓨鏁伴噺", minWidth: 120 },
-  { prop: "bankAccount", label: "鍗曚环(鍚◣)", minWidth: 150 },
-  { prop: "contacts", label: "鎬讳环(鍚◣)", minWidth: 100 },
-  { prop: "contactAddress", label: "鐑��", minWidth: 150 },
-  { prop: "maintainer", label: "缁存姢浜�", minWidth: 100 },
-  { prop: "maintainDate", label: "缁存姢鏃ユ湡", minWidth: 100 },
+  { prop: "priceIncludingTax", label: "鍗曚环(鍚◣)", minWidth: 150 },
+  { prop: "inventoryQuantity", label: "搴撳瓨鏁伴噺", minWidth: 120 },
+  { prop: "saleQuantity", label: "閿�鍞暟閲�", minWidth: 120 },
+  { prop: "salePrice", label: "閿�鍞崟浠�(鍚◣)", minWidth: 150 },
+  { prop: "totalAmount", label: "閿�鍞�讳环(鍚◣)", minWidth: 120 },
+  { prop: "salesFreight", label: "閿�鍞繍璐�", minWidth: 90 },
+  { prop: "purchasingFreight", label: "閲囪喘杩愯垂", minWidth: 90 },
+  { prop: "taxCoal", label: "璐攢鐓ょ◣鐜�(%)", minWidth: 120 },
+  { prop: "taxTrans", label: "杩愯緭绋庣巼(%)", minWidth: 120 },
+  { prop: "grossProfit", label: "姣涘埄娑�", minWidth: 90 },
+  { prop: "netProfit", label: "鍑�鍒╂鼎", minWidth: 90 },
+  { prop: "registrant", label: "鐧昏浜�", minWidth: 100 },
+  { prop: "registrationDate", label: "鐧昏鏃ユ湡", minWidth: 100 },
 ]);
 const selectedRows = ref([]);
 const total = ref(0);
 const pageNum = ref(1);
 const pageSize = ref(10);
+const former = ref({})
+
 // 鏌ヨ鍙傛暟
 const queryParams = reactive({
-  searchText: "",
-  supplierName: "",
-  identifyNumber: "",
-  address: "",
+	saleDate: "",
+	coal: "",
 })
-
+onMounted(() => {
+  handleQuery()
+});
 // 鐐瑰嚮鏌ヨ
 const handleQuery = () => {
+  pageNum.value = 1
+  pageSize.value = 10
+  getList()
+}
+const getList = () => {
   tableLoading.value = true;
-  setTimeout(() => {
+  salesRecordList({...queryParams, current: pageNum.value, size: pageSize.value}).then(res => {
     tableLoading.value = false;
-  }, 500);
+    tableData.value = res.data.records;
+    total.value = res.data.total;
+  })
 }
 // 閲嶇疆鏌ヨ
 const resetQuery = () => {
@@ -135,24 +264,97 @@
   });
   handleQuery();
 };
+// 鍒嗛〉澶勭悊
+const handlePagination = (val) => {
+	pageNum.value = val.page;
+	pageSize.value = val.limit;
+	getList();
+};
 // 鏂板鍑哄簱
-const openDia = (type, row) => {
+const openDia = (row, type) => {
+  console.log(row)
   nextTick(() => {
     formDia.value?.openDialog(type, row)
   })
 };
 // 鍒犻櫎鍑哄簱
 const handleDelete = () => {
-
+  if (selectedRows.value.length === 0) {
+    proxy.$modal.msgWarning("璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁");
+    return;
+  }
+  const deleteIds = selectedRows.value.map(item => item.id);
+  proxy.$modal.confirm('鏄惁纭鍒犻櫎鎵�閫夋暟鎹」锛�').then(function() {
+    return delSalesRecord(deleteIds)
+  }).then(() => {
+    handleQuery()
+    proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛")
+  }).catch(() => {})
 };
 // 瀵煎嚭鍑哄簱
 const handleExport = () => {
-
+  const config = { api: "/salesRecord/export", name: "閿�鍞嚭搴�" };
+  proxy.$modal
+    .confirm(
+      "鏄惁瑕佸鍑�" +
+        (selectedRows.value.length > 0
+          ? `閫変腑鐨�${selectedRows.value.length}鏉
+          : "鍏ㄩ儴") +
+        "鏁版嵁锛�"
+    )
+    .then((res) => {
+      if (!res) return;
+        exportData(config.api, config.name);
+    })
+    .catch(() => {
+      ElMessage.error("瀵煎嚭澶辫触锛岃閲嶈瘯");
+    });
+};
+const exportData = (api, name) => {
+  proxy.download(
+    api,
+    { exportIds: selectedRows.value.map((row) => row.id) },
+    `${new Date().getTime()}${name}${new Date().toLocaleDateString("en-CA")}.xlsx`
+  );
+  ElMessage.success("瀵煎嚭鏁版嵁锛�" + name);
 };
 // 閫夋嫨琛�
 const handleSelectionChange = (selection) => {
   selectedRows.value = selection;
 };
+
+// 鎵撳紑寮规
+const openForm = () => {
+  if (selectedRows.value.length !== 1) {
+    proxy.$modal.msgError("璇烽�夋嫨涓�鏉℃暟鎹�");
+    return;
+  }
+  invoiceInfo({ id: selectedRows.value[0].id }).then((res) => {
+    console.log(res.data)
+    former.value = { ...res.data };
+    former.value.salesRecordId = former.value.id;
+    former.value.id = "";
+    // form.value.registrant = userStore.nickName;
+  });
+  dialogFormVisible.value = true;
+};
+// 鎻愪氦琛ㄥ崟
+const submitForm = () => {
+  proxy.$refs["formRef"].validate((valid) => {
+    if (valid) {
+      receiptPaymentSaveOrUpdate(former.value).then((res) => {
+        proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+        closeDia();
+        getList();
+      });
+    }
+  });
+};
+// 鍏抽棴寮规
+const closeDia = () => {
+  proxy.resetForm("formRef");
+  dialogFormVisible.value = false;
+};
 </script>
 
 <style scoped>

--
Gitblit v1.9.3