Browse Source

feat:销售回款 资金认领

snow 2 years ago
parent
commit
54370bb43f

+ 15 - 0
src/api/InvoiceSales/capitalClaim/index.ts

@@ -27,3 +27,18 @@ export const httpInfo = (data: object): ResponseType => {
 export const httpUpload = (data: any): any => {
   return http.request("post", `${yewuApi}importTrade`, { data });
 };
+
+//资金认领订单列表明细
+export const httpOrderList = (data: any): any => {
+  return http.request("post", `${yewuApi}tradeQuery`, { data });
+};
+
+//资金认领付款新建
+export const httpPayAdd = (data: any): any => {
+  return http.request("post", `${yewuApi}orderpayadd`, { data });
+};
+
+//销售单列表
+export const httpSaleList = (data: any): any => {
+  return http.request("post", `${yewuApi}orderlist`, { data });
+};

+ 14 - 0
src/views/InvoiceSales/capitalClaim/components/approval-process/Initiate-audit.vue

@@ -0,0 +1,14 @@
+<script setup lang="ts">
+const emit = defineEmits(["changeStatus"]);
+
+//发起审核流程 状态改为1
+const handleChangeStatus = () => emit("changeStatus", { status: "1" });
+</script>
+
+<template>
+  <div flex justify-end w-full>
+    <el-button type="primary" @click="handleChangeStatus"
+      >发起审核流程</el-button
+    >
+  </div>
+</template>

+ 14 - 5
src/views/InvoiceSales/capitalClaim/components/receipt-payment.vue

@@ -1,23 +1,32 @@
 <script setup lang="ts">
-import { description_columns } from "../config/columns";
+import {
+  description_columns_in,
+  description_columns_out
+} from "../config/configs";
+
+defineProps<{
+  tradeInfo: Record<string, string>;
+}>();
 </script>
 
 <template>
   <div flex gap-10>
     <el-descriptions title="付款方" :column="1" border flex-1 size="small">
       <el-descriptions-item
-        v-for="(item, index) in description_columns"
+        v-for="(item, index) in description_columns_in"
         :key="index"
         :label="item.label"
-      />
+        >{{ tradeInfo[item.field] }}</el-descriptions-item
+      >
     </el-descriptions>
 
     <el-descriptions title="收款方" :column="1" border flex-1 size="small">
       <el-descriptions-item
-        v-for="(item, index) in description_columns"
+        v-for="(item, index) in description_columns_out"
         :key="index"
         :label="item.label"
-      />
+        >{{ tradeInfo[item.field] }}</el-descriptions-item
+      >
     </el-descriptions>
   </div>
 </template>

+ 64 - 34
src/views/InvoiceSales/capitalClaim/components/related-order.vue

@@ -1,41 +1,71 @@
 <script setup lang="ts">
 import { ref } from "vue";
-import { order_columns } from "../config/columns";
-
-const currentWriteOff = ref(0);
-
-const mock_data = [
-  {
-    payNo: "0",
-    gmfgs: "xxxx",
-    xsfgs: "xxx",
-    productName: "ccc",
-    total: "10000",
-    status: "0",
-    yhx: "0",
-    whx: "1",
-    cchx: "xxx",
-    createTime: "xxxx"
-  }
-];
+import { order_columns, order_status } from "../config/configs";
+import SalesModal from "./sales-modal.vue";
+
+const emit = defineEmits(["create-btn-click"]);
+const saleOrderList = ref<Array<Record<string, string>>>([]);
+const tradFeeMap = ref<Record<string, string>>({});
+
+const saleModalRef = ref<InstanceType<typeof SalesModal>>(null);
+
+function addSaleOrder(sales) {
+  saleOrderList.value = sales;
+  //根据sequenceNo建立映射
+  sales.forEach(({ sequenceNo }) => (tradFeeMap.value[sequenceNo] = "0"));
+}
+
+function handleCreate() {
+  const orderArr: any = [];
+  const keys = Object.keys(tradFeeMap.value);
+
+  keys.forEach(sequenceNo =>
+    orderArr.push({
+      sequenceNo,
+      trad_fee: tradFeeMap.value[sequenceNo]
+    })
+  );
+
+  console.log(orderArr);
+
+  emit("create-btn-click", orderArr);
+}
 </script>
 
 <template>
-  <h1 my-4>关联账单:</h1>
-
-  <el-table :data="mock_data">
-    <template v-for="(col, index) in order_columns" :key="index">
-      <el-table-column
-        v-if="col.label !== '此次核销'"
-        :label="col.label"
-        :prop="col.prop"
-      />
-
-      <el-table-column v-else :label="col.label">
-        <template #default>
-          <el-input v-model="currentWriteOff" />
-        </template>
-      </el-table-column>
-    </template>
+  <div flex justify-between items-center>
+    <h1 my-4>关联订单:</h1>
+    <el-button type="primary" @click="() => saleModalRef.onDisplay()"
+      >添加</el-button
+    >
+  </div>
+
+  <el-table :data="saleOrderList" size="small">
+    <el-table-column
+      v-for="(col, index) in order_columns"
+      :key="index"
+      :label="col.label"
+      :prop="col.prop"
+      show-overflow-tooltip
+    >
+      <template #default="{ row }">
+        <el-input
+          size="small"
+          placeholder="此次核销金额"
+          v-if="col.label === '此次核销'"
+          v-model="tradFeeMap[row.sequenceNo]"
+        />
+
+        <el-tag v-else-if="col.prop === 'status'">
+          {{ order_status.find(p => row.status === p.value)?.label }}
+        </el-tag>
+      </template>
+    </el-table-column>
   </el-table>
+
+  <div flex justify-end mt-3>
+    <el-button type="primary" @click="handleCreate">保存</el-button>
+  </div>
+
+  <SalesModal ref="saleModalRef" @save-click-button="addSaleOrder" />
 </template>

+ 94 - 0
src/views/InvoiceSales/capitalClaim/components/sales-modal.vue

@@ -0,0 +1,94 @@
+<script setup lang="ts">
+import { onMounted, reactive, ref, unref } from "vue";
+import { httpSaleList } from "/@/api/InvoiceSales/capitalClaim";
+import { useResponseHandle } from "/@/hooks";
+import { sale_columns } from "../config/configs";
+
+const emit = defineEmits(["save-click-button"]);
+
+const visible = ref(false);
+const loading = ref(false);
+const saleOrderList = ref<Array<Record<string, string>>>([]);
+const selectSaleOrder = ref<Array<Record<string, string>>>([]);
+const responseHandle = useResponseHandle();
+
+const pagination = reactive({
+  pageSize: 10,
+  currentPage: 1,
+  total: 0
+});
+
+async function requesetTradeOrderList() {
+  loading.value = true;
+  const { pageSize: size, currentPage: page } = pagination;
+
+  const { code, message, data } = await httpSaleList({
+    page,
+    size
+  });
+
+  responseHandle({
+    code,
+    message,
+    handler: () => {
+      saleOrderList.value = data.list;
+      pagination.total = data.count;
+    }
+  });
+  loading.value = false;
+}
+
+function handleSelection(values) {
+  selectSaleOrder.value = values;
+}
+
+function handleSave() {
+  emit("save-click-button", unref(selectSaleOrder));
+  visible.value = false;
+}
+
+defineExpose({
+  onDisplay: () => (visible.value = true)
+});
+
+//初始化订单列表
+onMounted(() => requesetTradeOrderList());
+</script>
+
+<template>
+  <el-dialog v-model="visible" title="销售单列表">
+    <el-table
+      :data="saleOrderList"
+      v-loading="loading"
+      size="small"
+      row-key="sequenceNo"
+      @selection-change="handleSelection"
+    >
+      <el-table-column
+        v-for="(col, index) in sale_columns"
+        :prop="col.field"
+        :label="col.label"
+        :key="index"
+        :type="col.type"
+        show-overflow-tooltip
+        reserve-selection
+      />
+    </el-table>
+
+    <div flex justify-between mt-2>
+      <el-pagination
+        v-model:current-page="pagination.currentPage"
+        v-model:page-size="pagination.pageSize"
+        :total="pagination.total"
+        :page-sizes="[10, 15, 20]"
+        @current-change="requesetTradeOrderList"
+        size="small"
+      />
+
+      <div>
+        <el-button type="primary" @click="handleSave">保存</el-button>
+        <el-button>取消</el-button>
+      </div>
+    </div>
+  </el-dialog>
+</template>

+ 0 - 74
src/views/InvoiceSales/capitalClaim/config/columns.ts

@@ -1,74 +0,0 @@
-export const order_columns = [
-  {
-    label: "订单编号",
-    prop: "payNo",
-    minWidth: 180,
-    align: "left"
-  },
-  {
-    label: "购买方公司",
-    prop: "gmfgs",
-    minWidth: 180,
-    align: "left"
-  },
-  {
-    label: "销售方公司",
-    prop: "xsfgs",
-    minWidth: 180,
-    align: "left"
-  },
-  {
-    label: "商品名称",
-    prop: "productName",
-    minWidth: 180,
-    align: "left"
-  },
-  {
-    label: "订单总金额",
-    prop: "total",
-    minWidth: 180,
-    align: "left"
-  },
-  {
-    label: "资金状态",
-    prop: "status",
-    minWidth: 180,
-    align: "left"
-  },
-  {
-    label: "已核销",
-    prop: "yhx",
-    minWidth: 180,
-    align: "left"
-  },
-  {
-    label: "未核销",
-    prop: "whx",
-    minWidth: 180,
-    align: "left"
-  },
-  {
-    label: "此次核销",
-    prop: "cchx",
-    minWidth: 180,
-    align: "left"
-  },
-  {
-    label: "交易时间",
-    prop: "createTime",
-    minWidth: 180,
-    align: "left"
-  }
-];
-
-export const description_columns = [
-  {
-    label: "单位名称"
-  },
-  {
-    label: "银行账号"
-  },
-  {
-    label: "银行名称"
-  }
-];

+ 192 - 0
src/views/InvoiceSales/capitalClaim/config/configs.ts

@@ -0,0 +1,192 @@
+export const order_columns = [
+  {
+    label: "订单编号",
+    prop: "sequenceNo",
+    minWidth: 180,
+    align: "left"
+  },
+  {
+    label: "购买方公司",
+    prop: "customerName",
+    minWidth: 180,
+    align: "left"
+  },
+  {
+    label: "销售方公司",
+    prop: "companyName",
+    minWidth: 180,
+    align: "left"
+  },
+  {
+    label: "商品名称",
+    prop: "goodName",
+    minWidth: 180,
+    align: "left"
+  },
+  {
+    label: "订单总金额",
+    prop: "totalPrice",
+    minWidth: 180,
+    align: "left"
+  },
+  {
+    label: "资金状态",
+    prop: "status",
+    minWidth: 180,
+    align: "left"
+  },
+  {
+    label: "已核销",
+    prop: "ainv_fee",
+    minWidth: 180,
+    align: "left"
+  },
+  {
+    label: "未核销",
+    prop: "winv_fee",
+    minWidth: 180,
+    align: "left"
+  },
+  {
+    label: "此次核销",
+    prop: "cchx",
+    minWidth: 180,
+    align: "left"
+  },
+  {
+    label: "交易时间",
+    prop: "addtime",
+    minWidth: 180,
+    align: "left"
+  }
+];
+
+export const description_columns_in = [
+  {
+    label: "单位名称",
+    field: "trade_in"
+  },
+  {
+    label: "银行账号"
+  },
+  {
+    label: "银行名称"
+  }
+];
+
+export const order_status = [
+  {
+    value: "0",
+    label: "未对账"
+  },
+  {
+    value: "1",
+    label: "参与对账"
+  },
+  {
+    value: "2",
+    label: "不参与核销对账"
+  },
+  {
+    value: "3",
+    label: "参与核销对账"
+  }
+];
+
+export const description_columns_out = [
+  {
+    label: "单位名称",
+    field: "trade_out"
+  },
+  {
+    label: "银行账号"
+  },
+  {
+    label: "银行名称"
+  }
+];
+
+export const status_options = [
+  {
+    label: "待审核",
+    value: "0"
+  },
+  {
+    label: "财务审核",
+    value: "1"
+  },
+  {
+    label: "财务驳回",
+    value: "2"
+  }
+];
+
+export const sale_columns = [
+  {
+    type: "selection"
+  },
+  {
+    field: "sequenceNo",
+    label: "确认单编号"
+  },
+  {
+    field: "ownerName",
+    label: "销售员"
+  },
+  {
+    field: "department",
+    label: "平台名称"
+  },
+  {
+    field: "status",
+    label: "订单状态"
+  },
+  {
+    field: "qrdType",
+    label: "订单类型"
+  },
+  {
+    field: "qrdSource",
+    label: "订单来源"
+  },
+  {
+    field: "companyNo",
+    label: "业务公司编号"
+  },
+  {
+    field: "companyName",
+    label: "业务公司名称"
+  },
+  {
+    field: "customerName",
+    label: "客户名称"
+  },
+  {
+    field: "platName",
+    label: "平台名称"
+  },
+  {
+    field: "goodNo",
+    label: "商品编号"
+  },
+  {
+    field: "goodName",
+    label: "商品名称"
+  },
+  {
+    field: "goodBrand",
+    label: "商品品牌"
+  },
+  {
+    field: "firstCat",
+    label: "一级分类"
+  },
+  {
+    field: "secCat",
+    label: "二级分类"
+  },
+  {
+    field: "thirdCat",
+    label: "三级分类"
+  }
+];

+ 0 - 14
src/views/InvoiceSales/capitalClaim/config/options.ts

@@ -1,14 +0,0 @@
-export const status_options = [
-  {
-    label: "待审核",
-    value: "0"
-  },
-  {
-    label: "财务审核",
-    value: "1"
-  },
-  {
-    label: "财务驳回",
-    value: "2"
-  }
-];

+ 1 - 1
src/views/InvoiceSales/capitalClaim/config/search.config.ts

@@ -1,4 +1,4 @@
-import { status_options } from "./options";
+import { status_options } from "./configs";
 import { FormConfig } from "/@/components/PageSearch";
 
 const searchFormConfig: FormConfig = {

+ 49 - 10
src/views/InvoiceSales/capitalClaim/detail.vue

@@ -3,15 +3,21 @@ import { computed, onMounted, ref } from "vue";
 import { useRoute } from "vue-router";
 import PaymentReceipt from "./components/receipt-payment.vue";
 import RelatedOrder from "./components/related-order.vue";
-import { httpInfo } from "/@/api/InvoiceSales/capitalClaim";
+import {
+  httpInfo,
+  httpOrderList,
+  httpPayAdd
+} from "/@/api/InvoiceSales/capitalClaim";
 import { useResponseHandle } from "/@/hooks";
 
 const { query } = useRoute();
-const responseHandle = useResponseHandle();
 const tradNo = computed(() => query.id as string);
+const responseHandle = useResponseHandle();
 
-const treadeDetail = ref<any>({});
+const treadeDetail = ref<Record<string, string>>({});
+const treadOrderList = ref<Array<Record<string, string>>>([]);
 
+//初始化认领详情
 async function requesetTradeDetail() {
   const { code, message, data } = await httpInfo({
     tradNo: tradNo.value
@@ -24,18 +30,51 @@ async function requesetTradeDetail() {
   });
 }
 
+async function requesetTradeOrderList() {
+  const { code, message, data } = await httpOrderList({
+    tradNo: tradNo.value
+  });
+
+  responseHandle({
+    code,
+    message,
+    handler: () => (treadOrderList.value = data)
+  });
+}
+
+function initalData() {
+  if (!tradNo.value) return;
+  requesetTradeDetail();
+  requesetTradeOrderList();
+}
+
+//新增销售单付款
+async function requesetCreateSalePay(orderArr: any = []) {
+  const { code, message } = await httpPayAdd({
+    tradNo: tradNo.value,
+    orderArr
+  });
+
+  responseHandle({
+    code,
+    message,
+    handler: () => {
+      /* 回列表页 */
+    }
+  });
+}
+
 //传入id初始化详情
-onMounted(() => tradNo.value && requesetTradeDetail());
+onMounted(() => initalData());
 </script>
 
 <template>
   <div class="invoice__content" bg-white>
-    <PaymentReceipt />
-    <RelatedOrder />
-
-    <div flex justify-end mt-3>
-      <el-button type="primary">保存</el-button>
-    </div>
+    <PaymentReceipt :trade-info="treadeDetail" />
+    <RelatedOrder
+      :trade-order-list="treadOrderList"
+      @create-btn-click="requesetCreateSalePay"
+    />
   </div>
 </template>
 

+ 2 - 2
src/views/purchase/purchPay/component/create-payment/order-table.vue

@@ -38,8 +38,8 @@ watchEffect(
       show-overflow-tooltip
     />
 
-    <el-table-column label="金额" fixed="right">
+    <!-- <el-table-column label="金额" fixed="right">
       <el-input size="small" placeholder="" />
-    </el-table-column>
+    </el-table-column> -->
   </el-table>
 </template>