snow 7 months ago
parent
commit
2d126ae96c

+ 16 - 12
src/views/InvoiceSales/invoiceApply/components/currentcy-form/order-dialog.vue

@@ -1,7 +1,9 @@
 <script setup lang="ts">
 import { shallowRef, shallowReactive } from "vue";
 import SearchCheck from "./search-check.vue";
-import SeaechBatch from "./search-batch.vue";
+import SearchBatch from "./search-batch.vue";
+import SearchBatchMain from "./search-batch-main.vue";
+
 
 enum SearchMode {
   check,
@@ -9,7 +11,7 @@ enum SearchMode {
 }
 
 const showModel = shallowRef(false);
-const currentSearchMode = shallowRef(SearchMode.check);
+const currentSearchMode = shallowRef(1);
 const emit = defineEmits(["reload", "save-btn-click"]);
 
 const payload = shallowReactive({
@@ -46,20 +48,22 @@ defineExpose({
     title="添加通用订单"
     :width="'1040px'"
   >
-    <el-switch
-      v-model="currentSearchMode"
-      active-text="批量查找"
-      inactive-text="勾选查找"
-      :active-value="SearchMode.batch"
-      :inactive-value="SearchMode.check"
-    />
+    <ElRadioGroup v-model="currentSearchMode">
+      <ElRadio :label="1">勾选查找</ElRadio>
+      <ElRadio :label="2">批量查找(销售订单编号)</ElRadio>
+      <ElRadio :label="3">批量查找(销售订单主编号)</ElRadio>
+    </ElRadioGroup>
 
-    <template v-if="currentSearchMode === SearchMode.check">
+    <template v-if="currentSearchMode === 1">
       <SearchCheck :payload="payload" @confirm="handleConfirm" />
     </template>
 
-    <template v-else>
-      <SeaechBatch :payload="payload" @confirm="handleConfirm" />
+    <template v-if="currentSearchMode === 2">
+      <SearchBatch :payload="payload" @confirm="handleConfirm" />
+    </template>
+
+    <template v-if="currentSearchMode === 3">
+      <SearchBatchMain :payload="payload" @confirm="handleConfirm" />
     </template>
   </el-dialog>
 </template>

+ 162 - 0
src/views/InvoiceSales/invoiceApply/components/currentcy-form/search-batch-main.vue

@@ -0,0 +1,162 @@
+<script setup lang="ts">
+import { reactive, ref, shallowRef, unref } from "vue";
+import { httpBatchOrderList } from "/@/api/InvoiceSales/invoiceApply";
+import { responseHandle } from "/@/utils/responseHandle";
+import { useNav } from "/@/layout/hooks/nav";
+import { ElMessage } from "element-plus";
+import { useColumns } from "./columns";
+import { useTypeOptions } from "/@/utils/status";
+
+const emit = defineEmits(["reload", "confirm"]);
+
+const { columns } = useColumns();
+
+columns.value = columns.value.slice(1);
+
+const { logout } = useNav();
+const loading = ref(false);
+const selected = ref([]);
+const tableRef = ref();
+
+const pagination = reactive({
+  total: 0,
+  pageSize: 15,
+  currentPage: 1,
+  background: true,
+  pageSizes: [15, 50, 100]
+});
+
+const props = defineProps<{
+  payload: object;
+}>();
+
+const sourceText = shallowRef("");
+//列表展示
+async function onSearch(sequenceNo = []) {
+  loading.value = true;
+  const { currentPage: page, pageSize: size } = pagination;
+  const { code, data, message } = await httpBatchOrderList({
+    ...props.payload,
+    cxCode: sequenceNo.join(","),
+    customerNo: 'GS2404151642335170',
+    is_comon: "1",
+    inv_is: "1",
+    cat_status: "2",
+    inv_status: "0",
+    page,
+    size
+  });
+
+  responseHandle({
+    code,
+    message,
+    logout,
+    handler: () => {
+      // const { li } = data ?? {};
+      selected.value = data ?? [];
+      // pagination.total = count ?? 0;
+      sourceText.value = "";
+    }
+  });
+  loading.value = false;
+}
+
+const $space = " ";
+const $wrap = "\n";
+const replaceTextWrapAndSpace = function (text = "") {
+  if (!text) return "";
+  let _text = text;
+  const hasSpace = _text.includes($space);
+  const hasWrap = _text.includes($wrap);
+  if (hasSpace) _text = _text.split($space).join("");
+  if (hasWrap) _text = _text.split($wrap).join("");
+  return _text;
+};
+
+function handleEnter() {
+  const text = replaceTextWrapAndSpace(sourceText.value);
+  /* 去掉回车和空格 **/
+  if (text.length === 0) {
+    ElMessage.warning("不能解析空文本");
+    sourceText.value = text;
+    return;
+  }
+
+  /* 统一替换字符 **/
+  const parserText = text.replace(/[,。;、; .]/g, ",");
+  const sequenceNo = parserText.split(",");
+  onSearch(sequenceNo);
+}
+
+function handleConfirm() {
+  if (selected.value.length === 0) {
+    return ElMessage.error("至少添加一个销售订单!");
+  }
+
+  //商品数量或开票金额为空
+  const noConfirm = selected.value.filter(o => o.winv_fee === "0.00");
+  const noInvNum = selected.value.filter(o => String(o.winv_num) === "0");
+
+  if (noConfirm.length !== 0) {
+    return ElMessage.error(`销售订单 ${noConfirm[0].sequenceNo} 开票金额为零`);
+  }
+
+  if (noInvNum.length !== 0) {
+    return ElMessage.error(`销售订单 ${noInvNum[0].sequenceNo} 开票数量为零`);
+  }
+
+  emit("confirm", unref(selected));
+}
+</script>
+
+<template>
+  <div relative>
+    <ElInput
+      :rows="4"
+      v-model="sourceText"
+      style="margin-bottom: 10px"
+      placeholder="输入销售订单主编号(小于100条),系统支持的分割符为逗号(,)、句号(.)、分号(;)、顿号(、),回车后开始解析。"
+      type="textarea"
+      @keydown.enter="handleEnter"
+    />
+
+    <div v-loading="loading">
+      <PureTable
+        ref="tableRef"
+        border
+        align="left"
+        row-key="id"
+        table-layout="auto"
+        :size="'small'"
+        :data="selected"
+        :columns="columns"
+        max-height="560px"
+        :header-cell-style="{ background: '#fafafa', color: '#606266' }"
+      >
+        <template #platform_type="scope">
+          <el-tag>{{
+            useTypeOptions.find(
+              ({ value }) => value === scope.row.platform_type
+            )?.label || "--"
+          }}</el-tag>
+        </template>
+      </PureTable>
+    </div>
+
+    <div class="flex justify-end mt-10px">
+      <el-button type="primary" @click="handleConfirm" size="small"
+        >保存</el-button
+      >
+    </div>
+  </div>
+</template>
+
+<style lang="scss" scoped>
+:deep(.el-pagination) {
+  justify-content: flex-start !important;
+}
+
+.search {
+  padding: 0px !important;
+}
+</style>

+ 3 - 1
src/views/InvoiceSales/invoiceApply/components/currentcy-form/search-check.vue

@@ -67,13 +67,15 @@ function selectedChange(val) {
 async function onSearch() {
   loading.value = true;
   const { currentPage: page, pageSize: size } = pagination;
+  const { cxCode, ...restParameter } = (otherParams || {})
   const { code, data, message } = await httpOrderList({
     ...props.payload,
     customerNo: 'GS2404151642335170',
     inv_is: "1",
     cat_status: "2",
     inv_status: "0",
-    ...otherParams,
+    cxCode: cxCode? [cxCode] : cxCode,
+    ...restParameter,
     page,
     size,
     is_comon: '1',

+ 10 - 10
src/views/InvoiceSales/sheetOrderPool/config/search.config.ts

@@ -241,17 +241,17 @@ const searchFormConfig: FormConfig = {
       placeholder: "标签类型",
       options: tag_type,
       span: 4
-    },
-    {
-      field: 'apay_is',
-      type: 'select',
-      placeholder: '是否已回款',
-      span: 4,
-      options: [
-        { value: '1',  label: '是' },
-        { value: '0',  label: '否' }
-      ]
     }
+    // {
+    //   field: 'apay_is',
+    //   type: 'select',
+    //   placeholder: '是否已回款',
+    //   span: 4,
+    //   options: [
+    //     { value: '1',  label: '是' },
+    //     { value: '0',  label: '否' }
+    //   ]
+    // }
   ]
 };