Browse Source

新需求

cz 1 year ago
parent
commit
ce0885a6e4

+ 193 - 295
src/views/WDLY/outInBound/abnormal/index.vue

@@ -2,76 +2,35 @@
   <div class="tenant">
     <!-- <Banner /> -->
     <div class="content">
-      <byTable
-        ref="table"
-        :source="sourceList.data"
-        :pagination="sourceList.pagination"
-        :config="config"
-        :loading="loading"
-        highlight-current-row
-        :selectConfig="selectConfig"
-        :table-events="{
+      <byTable ref="table" :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"
-      >
+        }" :action-list="[]" @get-list="getList">
         <template #linkCode="{ item }">
-          <div
-            style="cursor: pointer; color: #409eff"
-            @click="handleClickLinkCode(item)"
-          >
+          <div style="cursor: pointer; color: #409eff" @click="handleClickLinkCode(item)">
             {{ item.linkCode }}
           </div>
         </template>
       </byTable>
     </div>
-    <el-dialog
-      title="异常跟进"
-      v-model="dialogVisible"
-      width="800"
-      v-loading="loading"
-      destroy-on-close
-    >
-      <byForm
-        :formConfig="formConfig"
-        :formOption="formOption"
-        v-model="formData.data"
-        :rules="rules"
-        ref="byform"
-      >
+    <el-dialog title="异常跟进" v-model="dialogVisible" width="800" v-loading="loading" destroy-on-close>
+      <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="byform">
       </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 type="primary" @click="submitForm('byform')" size="large" :loading="submitLoading">
           确 定
         </el-button>
       </template>
     </el-dialog>
 
     <el-dialog title="跟进记录" v-model="dialogVisibleOne" width="500">
-      <byForm
-        :formConfig="formConfig"
-        :formOption="formOption"
-        v-model="formData.data"
-        :rules="rules"
-        ref="byform"
-      >
+      <byForm :formConfig="formConfigTwo" :formOption="formOption" v-model="formData.data" :rules="rules" ref="byform">
         <template #records>
           <div style="width: 100%">
             <el-timeline :reverse="false">
-              <el-timeline-item
-                placement="top"
-                v-for="(activity, index) in activities"
-                :key="index"
-                :timestamp="activity.handleTime"
-              >
+              <el-timeline-item placement="top" v-for="(activity, index) in activities" :key="index" :timestamp="activity.handleTime">
                 <div>
                   跟进人:{{ activity.handleUserName }}
                   <span>({{ activity.status ? "已完成" : "处理中" }})</span>
@@ -80,10 +39,11 @@
                   处理方式:
                   {{ dictValueLabel(activity.processing, handleMethon) }}
                 </div>
-                <div
-                  style="margin-top: 5px"
-                  v-if="!rolesList.includes('storekeeper')"
-                >
+                <div style="margin-top: 5px" v-if="['tkth', 'jtk' ].includes(activity.processing)">
+                  退款金额:
+                  {{ activity.refundAmount }}
+                </div>
+                <div style="margin-top: 5px" v-if="!rolesList.includes('storekeeper')">
                   跟进记录: {{ activity.explain }}
                 </div>
               </el-timeline-item>
@@ -93,26 +53,11 @@
       </byForm>
     </el-dialog>
 
-    <el-dialog
-      :title="'到货详情'"
-      v-model="dialogVisibleTwo"
-      width="80%"
-      destroy-on-close
-    >
-      <byForm
-        :formConfig="formConfigOne"
-        :formOption="formOption"
-        v-model="formData.dataOne"
-        :rules="rules"
-        ref="byformOne"
-      >
+    <el-dialog :title="'到货详情'" v-model="dialogVisibleTwo" width="80%" destroy-on-close>
+      <byForm :formConfig="formConfigOne" :formOption="formOption" v-model="formData.dataOne" :rules="rules" ref="byformOne">
         <template #detailSlot>
           <div style="width: 100%">
-            <el-table
-              :data="formData.dataOne.purchaseDetailVoList"
-              show-summary
-              :summary-method="getSummaries"
-            >
+            <el-table :data="formData.dataOne.purchaseDetailVoList" show-summary :summary-method="getSummaries">
               <el-table-column prop="productCustomCode" label="物品编码" />
               <el-table-column prop="productName" label="物品名称" />
               <el-table-column prop="productSpec" label="规格" />
@@ -120,28 +65,12 @@
               <el-table-column prop="deliverGoodsQuantity" label="已发货">
                 <template #default="{ row }">
                   <div>
-                    <el-popover
-                      placement="bottom-start"
-                      title="发货详情"
-                      :width="500"
-                      trigger="hover"
-                    >
+                    <el-popover placement="bottom-start" title="发货详情" :width="500" trigger="hover">
                       <div default>
                         <el-table :data="row.deliverGoodsDetailList">
-                          <el-table-column
-                            label="发货时间"
-                            prop="createTime"
-                            width="155"
-                          />
-                          <el-table-column
-                            label="物流单号"
-                            prop="logisticsCode"
-                          />
-                          <el-table-column
-                            label="数量"
-                            prop="deliverGoodsQuantity"
-                            width="100"
-                          />
+                          <el-table-column label="发货时间" prop="createTime" width="155" />
+                          <el-table-column label="物流单号" prop="logisticsCode" />
+                          <el-table-column label="数量" prop="deliverGoodsQuantity" width="100" />
                         </el-table>
                       </div>
                       <template #reference>
@@ -156,34 +85,13 @@
               <el-table-column prop="receiptQuantity" label="已入库">
                 <template #default="{ row }">
                   <div>
-                    <el-popover
-                      placement="bottom-start"
-                      title="入库详情"
-                      :width="500"
-                      trigger="hover"
-                    >
+                    <el-popover placement="bottom-start" title="入库详情" :width="500" trigger="hover">
                       <div default>
                         <el-table :data="row.receiptList">
-                          <el-table-column
-                            label="入库时间"
-                            prop="createTime"
-                            width="155"
-                          />
-                          <el-table-column
-                            label="入库单号"
-                            prop="logisticsCode"
-                          />
-                          <el-table-column
-                            label="数量"
-                            prop="quantity"
-                            width="100"
-                          />
-                          <el-table-column
-                            label="是否有次品"
-                            prop="isReject"
-                            width="100"
-                            :formatter="(row) => (row.isReject ? '是' : '否')"
-                          />
+                          <el-table-column label="入库时间" prop="createTime" width="155" />
+                          <el-table-column label="入库单号" prop="logisticsCode" />
+                          <el-table-column label="数量" prop="quantity" width="100" />
+                          <el-table-column label="是否有次品" prop="isReject" width="100" :formatter="(row) => (row.isReject ? '是' : '否')" />
                         </el-table>
                       </div>
                       <template #reference>
@@ -199,20 +107,12 @@
               <el-table-column prop="purchaseBackQuantity" label="退货">
                 <template #default="{ row }">
                   <div>
-                    <el-popover
-                      placement="bottom-start"
-                      title="退货详情"
-                      :width="500"
-                      trigger="hover"
-                    >
+                    <el-popover placement="bottom-start" title="退货详情" :width="500" trigger="hover">
                       <div default>
                         <el-table :data="row.purchaseBackDetailsList">
                           <el-table-column label="申请时间" prop="createTime" />
                           <el-table-column label="申请数量" prop="quantity" />
-                          <el-table-column
-                            label="已退数量"
-                            prop="returnedQuantity"
-                          />
+                          <el-table-column label="已退数量" prop="returnedQuantity" />
                         </el-table>
                       </div>
                       <template #reference>
@@ -227,32 +127,13 @@
               <el-table-column prop="qualityQuantity" label="已质检数量">
                 <template #default="{ row }">
                   <div>
-                    <el-popover
-                      placement="bottom-start"
-                      title="质检记录"
-                      :width="500"
-                      trigger="hover"
-                    >
+                    <el-popover placement="bottom-start" title="质检记录" :width="500" trigger="hover">
                       <div default>
                         <el-table :data="row.qualityDetailsList">
-                          <el-table-column
-                            prop="createTime"
-                            label="质检时间"
-                            width="155"
-                          />
-                          <el-table-column
-                            prop="qualifiedCount"
-                            label="合格数量"
-                          />
-                          <el-table-column
-                            prop="noQualifiedCount"
-                            label="不合格数量"
-                          />
-                          <el-table-column
-                            prop="createUserName"
-                            label="质检人"
-                            width="120"
-                          />
+                          <el-table-column prop="createTime" label="质检时间" width="155" />
+                          <el-table-column prop="qualifiedCount" label="合格数量" />
+                          <el-table-column prop="noQualifiedCount" label="不合格数量" />
+                          <el-table-column prop="createUserName" label="质检人" width="120" />
                         </el-table>
                       </div>
                       <template #reference>
@@ -270,9 +151,7 @@
         </template>
       </byForm>
       <template #footer>
-        <el-button @click="dialogVisibleTwo = false" size="large"
-          >取 消</el-button
-        >
+        <el-button @click="dialogVisibleTwo = false" size="large">取 消</el-button>
       </template>
     </el-dialog>
   </div>
@@ -316,10 +195,13 @@ let rules = ref({
   processing: [
     { required: true, message: "请选择处理方式", trigger: "change" },
   ],
+  refundAmount: [
+    { required: true, message: "请输入退款金额", trigger: "blur" },
+  ],
   explain: [{ required: true, message: "请输入跟进记录", trigger: "blur" }],
 });
 const { proxy } = getCurrentInstance();
-const typeData = [
+const typeData = ref([
   {
     label: "到货质检",
     value: "10",
@@ -340,7 +222,7 @@ const typeData = [
     label: "待入库",
     value: "50",
   },
-];
+]);
 const statusData = [
   {
     label: "未处理",
@@ -360,7 +242,7 @@ const selectConfig = computed(() => [
     isShowAll: false,
     label: "异常来源",
     prop: "type",
-    data: typeData,
+    data: typeData.value,
   },
   {
     label: "处理状态",
@@ -383,7 +265,7 @@ const config = computed(() => {
         width: 140,
       },
       render(status) {
-        const current = typeData.find((x) => x.value == status);
+        const current = typeData.value.find((x) => x.value == status);
         if (current) return current.label;
       },
     },
@@ -454,12 +336,12 @@ const config = computed(() => {
         width: 160,
       },
     },
-
     {
       attrs: {
         label: "操作",
         width: "160",
-        align: "right",
+        align: "center",
+        fixed: "right",
       },
       // 渲染 el-button,一般用在最后一列。
       renderHTML(row) {
@@ -492,7 +374,7 @@ const config = computed(() => {
             },
             el: "button",
             click() {
-              formConfig.value = formConfigData[1];
+              // formConfig.value = formConfigData.value[1];
               formData.data = {
                 type: row.type + "",
                 linkCode: row.linkCode,
@@ -562,138 +444,133 @@ let formConfigOne = computed(() => [
 ]);
 const byform = ref(null);
 const treeData = ref([]);
-const formConfigData = [
-  [
-    {
-      type: "title",
-      title: "异常信息",
-    },
-    {
-      type: "select",
-      prop: "type",
-      label: "异常来源",
-      data: typeData,
-      itemWidth: 30,
-      disabled: true,
-    },
-    {
-      type: "input",
-      prop: "linkCode",
-      label: "关联单号",
-      itemWidth: 70,
-      disabled: true,
-    },
-    {
-      type: "input",
-      prop: "title",
-      label: "异常说明",
-      itemWidth: 100,
-      disabled: true,
-    },
-    {
-      type: "title",
-      title: "跟进信息",
-    },
-    {
-      type: "radio",
-      prop: "status",
-      label: "跟进记录",
-      required: true,
-      border: true,
-      data: [
-        { label: "完成", value: "1" },
-        { label: "跟进中", value: "0" },
-      ],
-    },
-    {
-      type: "select",
-      prop: "handleUser",
-      label: "跟进人",
-      itemWidth: 50,
-      isLoad: {
-        url: `/tenantUser/list?pageNum=1&pageSize=9999&tenantId=${
-          useUserStore().user.tenantId
-        }`,
-        labelKey: "nickName",
-        labelVal: "userId",
-        method: "get",
-        resUrl: "rows",
-      },
-    },
-    {
-      type: "select",
-      prop: "nextHandleUser",
-      label: "下一跟进人",
-      itemWidth: 50,
+const formConfigTwo = computed(() => [
+  {
+    type: "title",
+    title: "异常信息",
+  },
+  {
+    type: "select",
+    prop: "type",
+    label: "异常来源",
+    data: typeData.value,
+    itemWidth: 30,
+    disabled: true,
+  },
+  {
+    type: "input",
+    prop: "linkCode",
+    label: "关联单号",
+    itemWidth: 70,
+    disabled: true,
+  },
+  {
+    type: "input",
+    prop: "title",
+    label: "异常说明",
+    itemWidth: 100,
+    disabled: true,
+  },
+  {
+    type: "title",
+    title: "跟进信息",
+  },
+  {
+    type: "slot",
+    slotName: "records",
+    label: "",
+  },
+]);
+const formConfig = computed(() => [
+  {
+    type: "title",
+    title: "异常信息",
+  },
+  {
+    type: "select",
+    prop: "type",
+    label: "异常来源",
+    data: typeData.value,
+    itemWidth: 30,
+    disabled: true,
+  },
+  {
+    type: "input",
+    prop: "linkCode",
+    label: "关联单号",
+    itemWidth: 70,
+    disabled: true,
+  },
+  {
+    type: "input",
+    prop: "title",
+    label: "异常说明",
+    itemWidth: 100,
+    disabled: true,
+  },
+  {
+    type: "title",
+    title: "跟进信息",
+  },
+  {
+    type: "radio",
+    prop: "status",
+    label: "跟进记录",
+    required: true,
+    border: true,
+    data: [
+      { label: "完成", value: "1" },
+      { label: "跟进中", value: "0" },
+    ],
+  },
+  {
+    type: "select",
+    prop: "handleUser",
+    label: "跟进人",
+    itemWidth: 50,
+    data: userList.value,
+  },
+  {
+    type: "select",
+    prop: "nextHandleUser",
+    label: "下一跟进人",
+    itemWidth: 50,
+    data: userList.value,
+  },
+  {
+    type: "date",
+    itemType: "datetime",
+    prop: "handleTime",
+    label: "跟进时间",
+  },
+  {
+    type: "select",
+    prop: "processing",
+    label: "处理方式",
+    itemWidth: 50,
+    data: handleMethon.value,
+  },
+  {
+    type: "number",
+    label: "退款金额",
+    prop: "refundAmount",
+    itemWidth: 50,
+    precision: 4,
+    min: 0,
+    controls: false,
+    isShow: ["tkth", "jtk"].includes(formData.data.processing),
+    // style: {
+    //   width: "100%",
+    // },
+  },
 
-      isLoad: {
-        url: `/tenantUser/list?pageNum=1&pageSize=9999&tenantId=${
-          useUserStore().user.tenantId
-        }`,
-        labelKey: "nickName",
-        labelVal: "userId",
-        method: "get",
-        resUrl: "rows",
-      },
-    },
-    {
-      type: "date",
-      itemType: "datetime",
-      prop: "handleTime",
-      label: "跟进时间",
-    },
-    {
-      type: "select",
-      prop: "processing",
-      label: "处理方式",
-      data: [],
-    },
-    {
-      type: "input",
-      itemType: "textarea",
-      prop: "explain",
-      label: "跟进记录",
-    },
-  ],
-  [
-    {
-      type: "title",
-      title: "异常信息",
-    },
-    {
-      type: "select",
-      prop: "type",
-      label: "异常来源",
-      data: typeData,
-      itemWidth: 30,
-      disabled: true,
-    },
-    {
-      type: "input",
-      prop: "linkCode",
-      label: "关联单号",
-      itemWidth: 70,
-      disabled: true,
-    },
-    {
-      type: "input",
-      prop: "title",
-      label: "异常说明",
-      itemWidth: 100,
-      disabled: true,
-    },
-    {
-      type: "title",
-      title: "跟进信息",
-    },
-    {
-      type: "slot",
-      slotName: "records",
-      label: "",
-    },
-  ],
-];
-const formConfig = ref([]);
+  {
+    type: "input",
+    itemType: "textarea",
+    prop: "explain",
+    label: "跟进记录",
+  },
+]);
 const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   loading.value = true;
@@ -717,6 +594,12 @@ const activities = ref([]);
 const submitForm = () => {
   console.log(byform.value);
   byform.value.handleSubmit((valid) => {
+    if (Number(formData.data.refundAmount) == 0) {
+      return ElMessage({
+        message: "退款金额不能为0",
+        type: "info",
+      });
+    }
     submitLoading.value = true;
     proxy.post("/abnormalDetails/" + modalType.value, formData.data).then(
       (res) => {
@@ -735,7 +618,6 @@ const submitForm = () => {
 
 const getDtl = (row) => {
   modalType.value = "add";
-  formConfig.value = formConfigData[0];
   formData.data = {
     status: "0",
     abnormalInfoId: row.id,
@@ -749,7 +631,20 @@ const getDtl = (row) => {
 };
 const handleMethon = ref([]);
 const alreadyPurchase = ref([]);
+const userList = ref([]);
 const getDict = () => {
+  proxy
+    .get(
+      `/tenantUser/list?pageNum=1&pageSize=9999&tenantId=${
+        useUserStore().user.tenantId
+      }`
+    )
+    .then((res) => {
+      userList.value = res.rows.map((x) => ({
+        label: x.nickName,
+        value: x.userId,
+      }));
+    });
   proxy.get("/purchase/getPurchaseUserList").then((res) => {
     alreadyPurchase.value = res.data.map((x) => ({
       label: x.nickName,
@@ -761,7 +656,6 @@ const getDict = () => {
       label: x.dictValue,
       value: x.dictKey,
     }));
-    formConfigData[0][9].data = handleMethon.value;
   });
 };
 
@@ -831,6 +725,10 @@ const getSummaries = (param) => {
 </script>
   
 <style lang="scss" scoped>
+::v-deep(.el-input-number .el-input__inner) {
+  text-align: left;
+}
+
 .tenant {
   padding: 20px;
 }

+ 44 - 33
src/views/WDLY/outInBound/record/index.vue

@@ -1,20 +1,12 @@
 <template>
   <div class="tenant">
     <div class="content">
-      <byTable
-        :source="sourceList.data"
-        :pagination="sourceList.pagination"
-        :config="config"
-        :loading="loading"
-        :selectConfig="selectConfig"
-        highlight-current-row
-        :action-list="[]"
-        @get-list="getList"
-      >
-        <!-- {
+      <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" :selectConfig="selectConfig"
+               highlight-current-row :action-list="[   {
             text: '导出Excel',
             action: () => deriveExcel(),
-          }, -->
+          },]" @get-list="getList">
+
         <template #warehouseName="{ item }">
           <div>
             <!-- <span v-if="item.opType == 1">{{ item.toWarehouseName }}</span>
@@ -25,29 +17,12 @@
       </byTable>
     </div>
 
-    <el-dialog
-      :title="'修正数量'"
-      v-model="dialogVisible"
-      width="500"
-      destroy-on-close
-    >
-      <byForm
-        v-loading="submitLoading"
-        :formConfig="formConfig"
-        :formOption="formOption"
-        v-model="formData.data"
-        :rules="rules"
-        ref="byform"
-      >
+    <el-dialog :title="'修正数量'" v-model="dialogVisible" width="500" destroy-on-close>
+      <byForm v-loading="submitLoading" :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="byform">
       </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 type="primary" @click="submitForm('byform')" size="large" :loading="submitLoading">
           确 定
         </el-button>
       </template>
@@ -343,8 +318,44 @@ onMounted(() => {
   }
   getList();
 });
+
 const deriveExcel = () => {
-  console.log("deriveExcel");
+  ElMessage({
+    message: "请稍后",
+    type: "success",
+  });
+  proxy
+    .postTwo("/stockJournalDetails/exportExcel", sourceList.value.pagination)
+    .then(
+      (res) => {
+        exportData(res, "出入库流水.xlsx");
+      },
+      (err) => {
+        return ElMessage({
+          message: "请重试",
+          type: "info",
+        });
+      }
+    );
+};
+
+const exportData = (res, name) => {
+  const content = res;
+  const blob = new Blob([content], { type: "application/ms-excel" });
+  const fileName = name;
+  if ("download" in document.createElement("a")) {
+    // 非IE下载
+    const elink = document.createElement("a");
+    elink.download = fileName;
+    elink.style.display = "none";
+    elink.href = URL.createObjectURL(blob);
+    document.body.appendChild(elink);
+    elink.click();
+    URL.revokeObjectURL(elink.href); // 释放URL 对象
+    document.body.removeChild(elink);
+  } else {
+    navigator.msSaveBlob(blob, fileName);
+  }
 };
 const dialogVisible = ref(false);
 const submitLoading = ref(false);

+ 125 - 191
src/views/WDLY/purchaseManage/payment/index.vue

@@ -2,156 +2,82 @@
   <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="{
+      <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" highlight-current-row
+               :selectConfig="selectConfig" :table-events="{
           //element talbe事件都能传
           select: selectRow,
-        }"
-        :action-list="[
+        }" :action-list="[
+        {
+            text: '导出Excel',
+            disabled: false,
+            action: () => deriveExcel(),
+          },
           {
             text: '合并付款',
             disabled: selectData.length === 0,
             action: () => handlePayment(20),
           },
-        ]"
-        @get-list="getList"
-      >
-        <!-- {
-            text: '导出Excel',
-            disabled: false,
-            action: () => deriveExcel(),
-          }, -->
+            
+        ]" @get-list="getList" @moreSearch="() => (dialogVisibleFour = true)">
+
         <template #contractCode="{ item }">
-          <div
-            style="cursor: pointer; color: #409eff"
-            @click="handleClickContractCode(item)"
-          >
+          <div style="cursor: pointer; color: #409eff" @click="handleClickContractCode(item)">
             {{ item.contractCode }}
           </div>
         </template>
+        <template #waitRefundAmount="{ item }">
+          <div style="cursor: pointer; color: #409eff" @click="handleRefund(item,'1')">
+            {{ item.waitRefundAmount }}
+          </div>
+        </template>
 
         <template #arrivalStatus="{ item }">
-          <div
-            style="cursor: pointer; color: #409eff"
-            @click="handleClickArrivalStatus(item)"
-          >
+          <div style="cursor: pointer; color: #409eff" @click="handleClickArrivalStatus(item)">
             {{ dictValueLabel(item.arrivalStatus, arrivalStatus) }}
           </div>
         </template>
 
         <template #payStatus="{ item }">
-          <div
-            style="cursor: pointer; color: #409eff"
-            @click="handleClickPayStatus(item)"
-          >
+          <div style="cursor: pointer; color: #409eff" @click="handleClickPayStatus(item)">
             {{ dictValueLabel(item.payStatus, paymentStatus) }}
           </div>
         </template>
 
         <template #btn="{ item }">
           <div>
-            <el-button
-              type="primary"
-              v-if="item.payStatus != 0"
-              link
-              @click="handleRefund(item)"
-              >退款</el-button
-            >
-            <el-button
-              type="primary"
-              link
-              v-if="item.payStatus != 30"
-              @click="handlePayment(10, item)"
-              >付款</el-button
-            >
-            <el-button
-              type="primary"
-              link
-              v-if="item.payStatus != 30"
-              @click="handleEnd(item)"
-              >结束</el-button
-            >
-            <el-button type="primary" link @click="handleClear(item)"
-              >清空</el-button
-            >
+            <el-button type="primary" v-if="item.payStatus != 0" link @click="handleRefund(item,'')">退款</el-button>
+            <el-button type="primary" link v-if="item.payStatus != 30" @click="handlePayment(10, item)">付款</el-button>
+            <el-button type="primary" link v-if="item.payStatus != 30" @click="handleEnd(item)">结束</el-button>
+            <el-button type="primary" link @click="handleClear(item)">清空</el-button>
           </div>
         </template>
       </byTable>
     </div>
-    <el-dialog
-      :title="'付款'"
-      v-model="dialogVisible"
-      width="80%"
-      v-loading="submitLoading"
-      destroy-on-close
-      :before-close="handleClose"
-    >
-      <byForm
-        :formConfig="formConfig"
-        :formOption="formOption"
-        v-model="formData.data"
-        :rules="rules"
-        ref="byform"
-      >
+    <el-dialog :title="'付款'" v-model="dialogVisible" width="80%" v-loading="submitLoading" destroy-on-close :before-close="handleClose">
+      <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="byform">
         <template #details>
           <div style="width: 100%">
-            <el-table
-              :data="formData.data.purchasePayRecordDetailList"
-              show-summary
-              :summary-method="getSummaries"
-            >
+            <el-table :data="formData.data.purchasePayRecordDetailList" show-summary :summary-method="getSummaries">
               <el-table-column prop="code" label="采购单号" />
-              <el-table-column
-                prop="isAgreement"
-                label="是否合同"
-                :formatter="(row) => (row.isAgreement == 1 ? '是' : '否')"
-              />
-              <el-table-column
-                prop="paymentMethod"
-                label="付款方式"
-                :formatter="
+              <el-table-column prop="isAgreement" label="是否合同" :formatter="(row) => (row.isAgreement == 1 ? '是' : '否')" />
+              <el-table-column prop="paymentMethod" label="付款方式" :formatter="
                   (row) => dictValueLabel(row.paymentMethod, fundsPaymentMethod)
-                "
-              />
+                " />
               <el-table-column prop="remark" label="采购备注" />
               <el-table-column prop="waitAmount" label="采购金额" />
               <el-table-column prop="alreadyAmount" label="已付款金额" />
               <el-table-column prop="amount" label="付款金额" min-width="150">
                 <template #default="{ row, $index }">
-                  <el-form-item
-                    :prop="'purchasePayRecordDetailList.' + $index + '.amount'"
-                    :rules="rules.amount"
-                    :inline-message="true"
-                  >
-                    <el-input-number
-                      v-model="row.amount"
-                      :precision="4"
-                      :controls="false"
-                      :min="0"
-                      onmousewheel="return false;"
-                      @change="handleChangeAmount"
-                    />
+                  <el-form-item :prop="'purchasePayRecordDetailList.' + $index + '.amount'" :rules="rules.amount" :inline-message="true">
+                    <el-input-number v-model="row.amount" :precision="4" :controls="false" :min="0" onmousewheel="return false;"
+                                     @change="handleChangeAmount" />
                   </el-form-item>
                 </template>
               </el-table-column>
               <el-table-column prop="remark" label="备注" min-width="150">
                 <template #default="{ row, $index }">
-                  <el-form-item
-                    :prop="'purchasePayRecordDetailList.' + $index + '.remark'"
-                    :rules="rules.remark"
-                    :inline-message="true"
-                  >
-                    <el-input
-                      v-model="row.remark"
-                      placeholder="请输入"
-                      type="textarea"
-                    />
+                  <el-form-item :prop="'purchasePayRecordDetailList.' + $index + '.remark'" :rules="rules.remark" :inline-message="true">
+                    <el-input v-model="row.remark" placeholder="请输入" type="textarea" />
                   </el-form-item>
                 </template>
               </el-table-column>
@@ -160,15 +86,8 @@
         </template>
         <template #file>
           <div style="width: 100%">
-            <el-upload
-              v-model:fileList="formData.data.fileList"
-              action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
-              :data="uploadData"
-              multiple
-              :before-upload="uploadFile"
-              :on-success="handleSuccess"
-              :on-preview="onPreviewFile"
-            >
+            <el-upload v-model:fileList="formData.data.fileList" action="https://winfaster.obs.cn-south-1.myhuaweicloud.com" :data="uploadData"
+                       multiple :before-upload="uploadFile" :on-success="handleSuccess" :on-preview="onPreviewFile">
               <el-button type="primary" plain>选择</el-button>
             </el-upload>
           </div>
@@ -176,75 +95,35 @@
       </byForm>
       <template #footer>
         <el-button @click="handleClose" size="large">取 消</el-button>
-        <el-button
-          v-if="modalType == 'add'"
-          type="primary"
-          @click="submitForm('byform')"
-          size="large"
-          :loading="submitLoading"
-        >
+        <el-button v-if="modalType == 'add'" type="primary" @click="submitForm('byform')" size="large" :loading="submitLoading">
           确 定
         </el-button>
       </template>
     </el-dialog>
-    <el-dialog
-      :title="'退款'"
-      v-model="dialogVisibleTwo"
-      width="800"
-      v-loading="submitLoading"
-      destroy-on-close
-    >
-      <byForm
-        :formConfig="formConfigOne"
-        :formOption="formOption"
-        v-model="formData.dataOne"
-        :rules="rulesOne"
-        ref="byformOne"
-      >
+    <el-dialog :title="'退款'" v-model="dialogVisibleTwo" width="800" v-loading="submitLoading" destroy-on-close>
+      <byForm :formConfig="formConfigOne" :formOption="formOption" v-model="formData.dataOne" :rules="rulesOne" ref="byformOne">
       </byForm>
       <template #footer>
-        <el-button @click="dialogVisibleTwo = false" size="large"
-          >取 消</el-button
-        >
-        <el-button
-          v-if="modalType == 'add'"
-          type="primary"
-          @click="submitFormOne()"
-          size="large"
-          :loading="submitLoading"
-        >
+        <el-button @click="dialogVisibleTwo = false" size="large">取 消</el-button>
+        <el-button v-if="modalType == 'add'" type="primary" @click="submitFormOne()" size="large" :loading="submitLoading">
           确 定
         </el-button>
       </template>
     </el-dialog>
 
-    <el-dialog
-      v-model="dialogVisibleOne"
-      title="交易记录"
-      width="500"
-      append-to-body
-      destroy-on-close
-    >
+    <el-dialog v-model="dialogVisibleOne" title="交易记录" width="500" append-to-body destroy-on-close>
       <div>
         <el-timeline :reverse="false">
-          <el-timeline-item
-            placement="top"
-            v-for="(activity, index) in activities"
-            :key="index"
-          >
-            <div
-              style="
+          <el-timeline-item placement="top" v-for="(activity, index) in activities" :key="index">
+            <div style="
                 display: flex;
                 justify-content: space-between;
                 align-items: center;
-              "
-            >
+              ">
               <div style="color: #909399">
                 {{ activity.payUserName }}
               </div>
-              <el-button type="primary" plain @click="handleGetDtl(activity)"
-                >查看详情</el-button
-              >
+              <el-button type="primary" plain @click="handleGetDtl(activity)">查看详情</el-button>
             </div>
             <div v-if="activity.type == '1'">
               <div style="margin-top: 5px">
@@ -282,15 +161,9 @@
                 退款备注: {{ activity.remark }}
               </div>
             </div>
-            <div
-              style="width: 100%; margin-top: 5px"
-              v-if="activity.fileList && activity.fileList.length > 0"
-            >
+            <div style="width: 100%; margin-top: 5px" v-if="activity.fileList && activity.fileList.length > 0">
               <div v-for="(item, index) in activity.fileList" :key="index">
-                <div
-                  style="cursor: pointer; color: #409eff"
-                  @click="openFile(item)"
-                >
+                <div style="cursor: pointer; color: #409eff" @click="openFile(item)">
                   {{ item.fileName }}
                 </div>
               </div>
@@ -302,21 +175,23 @@
         <el-button @click="dialogVisibleOne = false">关闭</el-button>
       </template>
     </el-dialog>
+    <el-dialog :title="'高级检索'" v-model="dialogVisibleFour" width="500px" destroy-on-close>
+      <el-form :model="sourceList.pagination" label-width="100px" label-position="top">
+        <el-form-item label="采购时间">
+          <el-date-picker v-model="sourceList.pagination.arr" type="daterange" range-separator="到" start-placeholder="请选择" end-placeholder="请选择"
+                          value-format="YYYY-MM-DD HH:mm:ss" />
+        </el-form-item>
+      </el-form>
+      <template #footer>
+        <el-button @click="handleReset" size="large">重置</el-button>
+        <el-button @click="handleQuery" type="primary" size="large">搜索</el-button>
+      </template>
+    </el-dialog>
 
-    <el-dialog
-      :title="'到货详情'"
-      v-model="dialogVisibleThree"
-      width="80%"
-      destroy-on-close
-    >
-      <ArrivalDetails
-        :purchaseRow="currnetPurchaseRow"
-        @handleClickStatus="handleClickStatus"
-      ></ArrivalDetails>
+    <el-dialog :title="'到货详情'" v-model="dialogVisibleThree" width="80%" destroy-on-close>
+      <ArrivalDetails :purchaseRow="currnetPurchaseRow" @handleClickStatus="handleClickStatus"></ArrivalDetails>
       <template #footer>
-        <el-button @click="dialogVisibleThree = false" size="large"
-          >取 消</el-button
-        >
+        <el-button @click="dialogVisibleThree = false" size="large">取 消</el-button>
       </template>
     </el-dialog>
   </div>
@@ -340,6 +215,7 @@ const sourceList = ref({
     type: "",
     keyword: "",
     purchaseStatus: "30,99",
+    arr: [],
   },
 });
 let dialogVisible = ref(false);
@@ -485,6 +361,16 @@ const config = computed(() => {
     },
     {
       attrs: {
+        label: "待退款金额",
+        slot: "waitRefundAmount",
+        width: 100,
+      },
+      // render(refundAmount) {
+      //   return proxy.moneyFormat(refundAmount, 2);
+      // },
+    },
+    {
+      attrs: {
         label: "采购人",
         prop: "purchaseName",
         width: 150,
@@ -629,6 +515,16 @@ let formConfigOne = computed(() => [
   },
   {
     type: "number",
+    prop: "waitRefundAmount",
+    label: "待退款金额",
+    precision: 4,
+    min: 0,
+    controls: false,
+    isShow: refundType.value == "1",
+    disabled: true,
+  },
+  {
+    type: "number",
     prop: "amount",
     label: "退款金额",
     precision: 4,
@@ -715,6 +611,14 @@ const submitFormOne = () => {
         type: "info",
       });
     }
+    if (refundType.value == "1") {
+      if (formData.dataOne.amount > formData.dataOne.waitRefundAmount) {
+        return ElMessage({
+          message: "退款金额不能大于待退款金额",
+          type: "info",
+        });
+      }
+    }
     submitLoading.value = true;
     proxy.post("/purchaseRefundRecord/add", formData.dataOne).then(
       (res) => {
@@ -798,10 +702,13 @@ const handlePayment = (type, data) => {
   };
   dialogVisible.value = true;
 };
-
-const handleRefund = (row) => {
+const refundType = ref("");
+const handleRefund = (row, type) => {
   formOption.disabled = false;
+  modalType.value = "add";
+  refundType.value = type;
   formData.dataOne = {
+    refundType: type,
     type: "2",
     purchaseId: row.id,
     supplyName: row.supplyName,
@@ -810,6 +717,9 @@ const handleRefund = (row) => {
     refundDate: "",
     remark: "",
   };
+  if (type == "1") {
+    formData.dataOne.waitRefundAmount = row.waitRefundAmount;
+  }
   dialogVisibleTwo.value = true;
 };
 const currentRow = ref({});
@@ -970,6 +880,7 @@ const openFile = (item) => {
 };
 
 const handleGetDtl = (row) => {
+  refundType.value = "";
   if (row.type == "1") {
     modalType.value = "edit";
     formOption.disabled = true;
@@ -1084,11 +995,34 @@ const getSummaries = (param) => {
   });
   return sums;
 };
+const dialogVisibleFour = ref(false);
 
 const currnetPurchaseRow = ref({});
 const handleClickArrivalStatus = (row) => {
   currnetPurchaseRow.value = { ...row };
-  dialogVisibleThree.value = true;
+  dialogVisibleFour.value = true;
+};
+
+const handleQuery = () => {
+  if (
+    sourceList.value.pagination.arr &&
+    sourceList.value.pagination.arr.length > 1
+  ) {
+    sourceList.value.pagination.purchaseStartTime =
+      sourceList.value.pagination.arr[0];
+    sourceList.value.pagination.purchaseEndTime =
+      sourceList.value.pagination.arr[1];
+  }
+  dialogVisibleFour.value = false;
+  getList();
+};
+const handleReset = () => {
+  sourceList.value.pagination = {
+    pageNum: sourceList.value.pagination.pageNum,
+    pageSize: sourceList.value.pagination.pageSize,
+    arr: [],
+  };
+  handleQuery();
 };
 </script>