瀏覽代碼

认领记录

lxf 1 年之前
父節點
當前提交
b1578c3b08
共有 1 個文件被更改,包括 165 次插入167 次删除
  1. 165 167
      src/views/salesMange/saleContract/claim/index.vue

+ 165 - 167
src/views/salesMange/saleContract/claim/index.vue

@@ -1,76 +1,46 @@
 <template>
   <div class="tenant">
-    <!-- <Banner /> -->
-    <div class="content">
-      <byTable
-        :source="sourceList.data"
-        :pagination="sourceList.pagination"
-        :config="config"
-        :loading="loading"
-        highlight-current-row
-        :selectConfig="selectConfig"
-        :table-events="{
-          //element talbe事件都能传
-          select: select,
-        }"
-        :action-list="[]"
-        @get-list="getList"
-      >
-        <template #money="{ item }">
-          {{ item.currency }} {{ moneyFormat(item.amount) }}
-        </template>
-      </byTable>
-    </div>
-    <el-dialog
-      title="认领"
-      v-model="dialogVisible"
-      width="500"
-      v-loading="loading"
-    >
-      <byForm
-        :formConfig="formConfig"
-        :formOption="formOption"
-        v-model="formData.data"
-        :rules="rules"
-        ref="byform"
-      >
+    <byTable
+      :source="sourceList.data"
+      :pagination="sourceList.pagination"
+      :config="config"
+      :loading="loading"
+      highlight-current-row
+      :selectConfig="selectConfig"
+      :action-list="[]"
+      @get-list="getList">
+      <template #money="{ item }"> {{ item.currency }} {{ moneyFormat(item.amount) }} </template>
+      <template #isClaim="{ item }">
+        <div style="width: 100%">
+          <span v-if="item.isClaim == 0">未认领</span>
+          <a style="color: #409eff; cursor: pointer" @click="clickRecord(item)" v-else-if="item.isClaim == 1">已认领</a>
+          <a style="color: #409eff; cursor: pointer" @click="clickRecord(item)" v-else>部分认领</a>
+        </div>
+      </template>
+    </byTable>
+
+    <el-dialog title="认领" v-if="dialogVisible" v-model="dialogVisible" width="500" v-loading="loading">
+      <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="byform">
         <template #detail>
           <div style="width: 100%">
-            <el-button
-              type="primary"
-              style="margin-bottom: 10px"
-              @click="dialogVisibleOne = true"
-              >选择合同</el-button
-            >
+            <el-button type="primary" style="margin-bottom: 10px" @click="dialogVisibleOne = true">选择合同</el-button>
             <el-table :data="formData.data.claimContractList">
               <el-table-column prop="contractCode" label="合同编码" />
               <el-table-column prop="money" label="关联金额" min-width="150">
                 <template #default="{ row, $index }">
-                  <el-form-item
-                    :prop="'claimContractList.' + $index + '.money'"
-                    :rules="rules.money"
-                    :inline-message="true"
-                  >
-                    <el-input-number
-                      v-model="row.money"
-                      :precision="4"
-                      :controls="false"
-                      :min="0"
-                    />
+                  <el-form-item :prop="'claimContractList.' + $index + '.money'" :rules="rules.money" :inline-message="true">
+                    <el-input-number v-model="row.money" :precision="4" :controls="false" :min="0" onmousewheel="return false;" />
                   </el-form-item>
                 </template>
               </el-table-column>
               <el-table-column prop="zip" label="操作" width="100">
                 <template #default="{ $index }">
-                  <el-button type="primary" link @click="handleRemove($index)"
-                    >删除</el-button
-                  >
+                  <el-button type="primary" link @click="handleRemove($index)">删除</el-button>
                 </template>
               </el-table-column>
             </el-table>
           </div>
         </template>
-
         <template #fileSlot>
           <div>
             <el-upload
@@ -82,8 +52,7 @@
               :on-preview="handlePreview"
               :on-remove="handleRemove"
               :on-success="handleSuccess"
-              :before-upload="handleBeforeUpload"
-            >
+              :before-upload="handleBeforeUpload">
               <el-button type="primary">选择</el-button>
             </el-upload>
             <div>
@@ -95,9 +64,9 @@
                   v-for="(item, index) in fileListCopy"
                   :key="index"
                   closable
-                  @close="handleClose(index)"
-                  >{{ item.fileName }}</el-tag
-                >
+                  @close="handleClose(index)">
+                  {{ item.fileName }}
+                </el-tag>
               </div>
             </div>
           </div>
@@ -105,43 +74,44 @@
       </byForm>
       <template #footer>
         <el-button @click="dialogVisible = false" size="large">取 消</el-button>
-        <el-button
-          type="primary"
-          @click="submitForm('byform')"
-          size="large"
-          :loading="submitLoading"
-        >
-          确 定
-        </el-button>
+        <el-button type="primary" @click="submitForm('byform')" size="large" :loading="submitLoading"> 确 定 </el-button>
       </template>
     </el-dialog>
 
-    <el-dialog
-      title="合同选择"
-      v-model="dialogVisibleOne"
-      width="80%"
-      v-loading="loading"
-      destroy-on-close
-    >
-      <ContractSelect
-        @handleSelectContrct="handleSelectContrct"
-      ></ContractSelect>
+    <el-dialog title="合同选择" v-if="dialogVisibleOne" v-model="dialogVisibleOne" width="80%" v-loading="loading" destroy-on-close>
+      <ContractSelect @handleSelectContrct="handleSelectContrct"></ContractSelect>
+    </el-dialog>
+
+    <el-dialog title="认领记录" v-if="openRecord" v-model="openRecord" width="500">
+      <byForm :formConfig="formRecordConfig" :formOption="formOption" v-model="rowData.data">
+        <template #recordList>
+          <div style="width: 100%" v-if="rowData.data.recordList && rowData.data.recordList.length > 0">
+            <div v-for="(item, index) in rowData.data.recordList" :key="index">
+              <div style="color: #ccc">{{ item.createTime }}</div>
+              <div>认领人: {{ item.claimUserName }}</div>
+              <div>合同编号: {{ item.contractCode }}</div>
+              <div>认领金额: {{ item.currency }}{{ item.money }}</div>
+              <br />
+            </div>
+          </div>
+        </template>
+      </byForm>
+      <template #footer>
+        <el-button @click="openRecord = false" size="large">取 消</el-button>
+      </template>
     </el-dialog>
   </div>
 </template>
-  
+
 <script setup>
-/* eslint-disable vue/no-unused-components */
 import { ElMessage, ElMessageBox } from "element-plus";
 import byTable from "@/components/byTable/index";
 import byForm from "@/components/byForm/index";
-import { computed, defineComponent, ref } from "vue";
+import { computed, ref } from "vue";
 import useUserStore from "@/store/modules/user";
-import { getToken } from "@/utils/auth";
-
 import ContractSelect from "@/views/salesMange/saleContract/contractSelect/index";
 
-const headers = ref({ Authorization: "Bearer " + getToken() });
+const { proxy } = getCurrentInstance();
 const uploadData = ref({});
 let fileList = ref([]);
 let fileListCopy = ref([]);
@@ -163,37 +133,27 @@ let modalType = ref("add");
 let rules = ref({
   money: [{ required: true, message: "请输入关联金额", trigger: "blur" }],
 });
-const { proxy } = getCurrentInstance();
-const selectConfig = reactive([
+const claim = ref([
   {
-    label: "认领状态",
-    prop: "isClaim",
-    data: [
-      {
-        label: "未认领",
-        value: "0",
-      },
-      {
-        label: "已认领",
-        value: "1",
-      },
-    ],
-  },
-]);
-const inboundType = ref([
-  {
-    label: "未入库",
+    label: "未认领",
     value: "0",
   },
   {
-    label: "部分入库",
+    label: "已认领",
     value: "1",
   },
   {
-    label: "入库完成",
+    label: "部分认领",
     value: "2",
   },
 ]);
+const selectConfig = reactive([
+  {
+    label: "认领状态",
+    prop: "isClaim",
+    data: claim.value,
+  },
+]);
 const config = computed(() => {
   return [
     {
@@ -201,9 +161,6 @@ const config = computed(() => {
         label: "账户名称",
         prop: "accountManagementName",
       },
-      // render(type) {
-      //   return proxy.dictDataEcho(type, warehouseType.value);
-      // },
     },
     {
       attrs: {
@@ -243,13 +200,20 @@ const config = computed(() => {
         prop: "remarks",
       },
     },
+    // {
+    //   attrs: {
+    //     label: "认领状态",
+    //     prop: "isClaim",
+    //   },
+    //   render(type) {
+    //     return proxy.dictValueLabel(type, claim.value);
+    //   },
+    // },
     {
       attrs: {
         label: "认领状态",
-        prop: "isClaim",
-      },
-      render(isClaim) {
-        return isClaim == 1 ? "已认领" : isClaim == 0 ? "未认领" : "";
+        slot: "isClaim",
+        width: 120,
       },
     },
     {
@@ -258,7 +222,6 @@ const config = computed(() => {
         width: "100",
         align: "right",
       },
-      // 渲染 el-button,一般用在最后一列。
       renderHTML(row) {
         return [
           row.isClaim == 0
@@ -275,9 +238,7 @@ const config = computed(() => {
                   getDtl(row);
                 },
               }
-            : {},
-          row.isClaim == 1
-            ? {
+            : {
                 attrs: {
                   label: "取消认领",
                   text: true,
@@ -309,8 +270,7 @@ const config = computed(() => {
                       });
                   });
                 },
-              }
-            : {},
+              },
         ];
       },
     },
@@ -319,7 +279,6 @@ const config = computed(() => {
 
 let formData = reactive({
   data: {},
-  treeData: [],
 });
 const formOption = reactive({
   inline: true,
@@ -328,7 +287,6 @@ const formOption = reactive({
   rules: [],
 });
 const byform = ref(null);
-const treeData = ref([]);
 const formConfig = reactive([
   {
     type: "title",
@@ -377,24 +335,6 @@ const formConfig = reactive([
     itemWidth: 70,
     disabled: true,
   },
-
-  // {
-  //   type: "select",
-  //   prop: "warehouseId",
-  //   label: "仓库名称",
-  //   itemWidth: 33,
-  //   isLoad: {
-  //     url: "/warehouse/page",
-  //     req: {
-  //       pageNum: 1,
-  //       pageSize: 9999,
-  //     },
-  //     labelKey: "name",
-  //     labelVal: "id",
-  //     method: "post",
-  //     resUrl: "rows",
-  //   },
-  // },
   {
     type: "title",
     title: "认领信息",
@@ -413,23 +353,14 @@ const formConfig = reactive([
 const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   loading.value = true;
-  proxy
-    .post("/accountRunningWater/page", sourceList.value.pagination)
-    .then((message) => {
-      console.log(message);
-      sourceList.value.data = message.rows;
-      sourceList.value.pagination.total = message.total;
-      setTimeout(() => {
-        loading.value = false;
-      }, 200);
-    });
-};
-const openModal = () => {
-  dialogVisible.value = true;
-  modalType.value = "add";
-  formData.data = {};
+  proxy.post("/accountRunningWater/page", sourceList.value.pagination).then((message) => {
+    sourceList.value.data = message.rows;
+    sourceList.value.pagination.total = message.total;
+    setTimeout(() => {
+      loading.value = false;
+    }, 200);
+  });
 };
-
 const submitForm = () => {
   byform.value.handleSubmit((valid) => {
     const list = formData.data.claimContractList;
@@ -449,7 +380,7 @@ const submitForm = () => {
       }
     }
     const total = list.reduce((total, x) => (total += Number(x.money)), 0);
-    if (Number(formData.data.waitAmount) < total) {
+    if (total > Number(formData.data.waitAmount)) {
       return ElMessage({
         message: "认领金额总合不能大于交易金额!",
         type: "info",
@@ -490,7 +421,6 @@ const getDtl = (row) => {
       accountManagementId: row.accountManagementId,
       accountManagementName: row.accountManagementName,
       claimTime: row.transactionTime,
-      // claimTime: proxy.parseTime(new Date()),
       claimContractList: [],
     };
     dialogVisible.value = true;
@@ -499,7 +429,6 @@ const getDtl = (row) => {
 
 const warehouseType = ref([]);
 const getDict = () => {
-  // // 币种数据
   proxy
     .post("/dictTenantData/page", {
       pageNum: 1,
@@ -515,7 +444,6 @@ const getDict = () => {
       }));
     });
 };
-
 const handleBeforeUpload = async (file) => {
   const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
   uploadData.value = res.uploadBody;
@@ -527,7 +455,6 @@ const handleBeforeUpload = async (file) => {
     uid: file.uid,
   });
 };
-
 const handleClose = (index) => {
   // if (fileListCopy.value.length === 1) {
   //   return ElMessage({
@@ -538,7 +465,6 @@ const handleClose = (index) => {
   fileList.value.splice(index, 1);
   fileListCopy.value.splice(index, 1);
 };
-
 const handleRemove = (index) => {
   formData.data.claimContractList.splice(index, 1);
   return ElMessage({
@@ -546,11 +472,8 @@ const handleRemove = (index) => {
     type: "success",
   });
 };
-
 const handleSelectContrct = (row) => {
-  const flag = formData.data.claimContractList.some(
-    (x) => x.contractId === row.id
-  );
+  const flag = formData.data.claimContractList.some((x) => x.contractId === row.id);
   if (flag)
     return ElMessage({
       message: "该合同已选择",
@@ -567,14 +490,89 @@ const handleSelectContrct = (row) => {
     type: "success",
   });
 };
-
 getList();
 getDict();
 onMounted(() => {});
+const openRecord = ref(false);
+const rowData = reactive({
+  data: {},
+});
+const formRecordConfig = reactive([
+  {
+    type: "title",
+    title: "账户信息",
+    label: "",
+  },
+  {
+    type: "select",
+    prop: "accountManagementName",
+    label: "选择账户",
+    required: true,
+    disabled: true,
+  },
+  {
+    type: "title",
+    title: "交易信息",
+    label: "",
+  },
+  {
+    type: "date",
+    itemType: "datetime",
+    prop: "claimTime",
+    label: "交易时间",
+    disabled: true,
+  },
+  {
+    type: "select",
+    prop: "status",
+    label: "交易金额",
+    itemWidth: 30,
+    disabled: true,
+    data: [
+      {
+        label: "收入",
+        value: "10",
+      },
+      {
+        label: "支出",
+        value: "20",
+      },
+    ],
+  },
+  {
+    type: "selectInput",
+    prop: "waitAmount",
+    selectProp: "currency",
+    label: " ",
+    itemWidth: 70,
+    disabled: true,
+  },
+  {
+    type: "slot",
+    slotName: "recordList",
+    label: "认领记录",
+  },
+]);
+const clickRecord = (row) => {
+  rowData.data = {
+    businessId: row.id,
+    status: row.status + "",
+    currency: row.currency,
+    waitAmount: Number(row.amount),
+    accountManagementId: row.accountManagementId,
+    accountManagementName: row.accountManagementName,
+    claimTime: row.transactionTime,
+    recordList: [],
+  };
+  openRecord.value = true;
+  proxy.post("/claim/claimRecord", { businessId: row.id }).then((res) => {
+    rowData.data.recordList = res;
+  });
+};
 </script>
-  
+
 <style lang="scss" scoped>
 .tenant {
   padding: 20px;
 }
-</style>
+</style>