Parcourir la source

利润结算表增加查询年月,调整汇率后直接进行结算

lxf il y a 2 mois
Parent
commit
bcbd33fb31
1 fichiers modifiés avec 248 ajouts et 243 suppressions
  1. 248 243
      src/views/salesMange/salesMange/profitSettlement/index.vue

+ 248 - 243
src/views/salesMange/salesMange/profitSettlement/index.vue

@@ -8,31 +8,21 @@
       :config="config"
       :loading="loading"
       :selectConfig="selectConfig"
-      :statConfig='statConfig'
+      :statConfig="statConfig"
       highlight-current-row
-      :action-list="[
-        
-      ]"
-      @get-list="getList"
-    >
+      :action-list="[]"
+      @get-list="getList">
       <template #amount="{ item }">
         <div></div>
       </template>
     </byTable>
-    <div
-      style="padding: 0 20px 20px 20px; background-color: white"
-      v-if="rateStatus"
-    >
+    <div style="padding: 0 20px 20px 20px; background-color: white" v-if="rateStatus">
       <el-table v-loading="loading" :data="sourceList.data">
         <el-table-column label="合同编号">
           <el-table-column label="" prop="contractCode" width="160">
             <template #default="{ row }">
               <div style="width: 100%">
-                <a
-                  style="color: #409eff; cursor: pointer; word-break: break-all"
-                  @click="openDetails(row)"
-                  >{{ row.contractCode }}</a
-                >
+                <a style="color: #409eff; cursor: pointer; word-break: break-all" @click="openDetails(row)">{{ row.contractCode }}</a>
               </div>
             </template>
           </el-table-column>
@@ -46,9 +36,7 @@
         <el-table-column label="销售合同金额">
           <el-table-column label="" width="120">
             <template #default="{ row }">
-              <div>
-                {{ row.currency }} {{ moneyFormat(row.contractAmount, 2) }}
-              </div>
+              <div>{{ row.currency }} {{ moneyFormat(row.contractAmount, 2) }}</div>
             </template>
           </el-table-column>
         </el-table-column>
@@ -59,11 +47,11 @@
                 <template #reference>
                   <span class="table-btn">{{ moneyFormat(row.contractArrival, 2) }}</span>
                 </template>
-                <div style="max-height: 300px;overflow-y: auto;">
+                <div style="max-height: 300px; overflow-y: auto">
                   <el-table :data="row.claimList">
                     <el-table-column width="150" property="date" label="认领金额">
                       <template #default="{ row }">
-                        <div>{{row.currency}} {{ moneyFormat(row.money, 2) }}</div>
+                        <div>{{ row.currency }} {{ moneyFormat(row.money, 2) }}</div>
                       </template>
                     </el-table-column>
                     <el-table-column width="60" property="rate" label="汇率" />
@@ -71,22 +59,20 @@
                     <el-table-column width="190" property="createTime" label="操作时间" />
                   </el-table>
                 </div>
-                
               </el-popover>
-              
             </template>
           </el-table-column>
           <el-table-column label="退税" width="120">
             <template #default="{ row }">
               <el-popover placement="top" :width="580" trigger="click">
                 <template #reference>
-                  <span class="table-btn">{{moneyFormat(row.taxReturnMoney, 2) }}</span>
+                  <span class="table-btn">{{ moneyFormat(row.taxReturnMoney, 2) }}</span>
                 </template>
-                <div style="max-height: 300px;overflow-y: auto;">
+                <div style="max-height: 300px; overflow-y: auto">
                   <el-table :data="row.taxReturnList">
                     <el-table-column width="150" property="date" label="交易金额">
                       <template #default="{ row }">
-                        <div>{{row.currency}} {{ moneyFormat(row.amount, 2) }}</div>
+                        <div>{{ row.currency }} {{ moneyFormat(row.amount, 2) }}</div>
                       </template>
                     </el-table-column>
                     <el-table-column width="60" property="rate" label="汇率" />
@@ -101,9 +87,8 @@
             <template #default="{ row }">
               <el-popover placement="top" :width="580" trigger="click">
                 <template #reference>
-                  <span class="table-btn">{{moneyFormat(row.otherIncome, 2) }}</span>
+                  <span class="table-btn">{{ moneyFormat(row.otherIncome, 2) }}</span>
                 </template>
-                
               </el-popover>
             </template>
           </el-table-column>
@@ -115,11 +100,11 @@
                 <template #reference>
                   <span class="table-btn">CNY {{ moneyFormat(row.purchaseAmount, 2) }}</span>
                 </template>
-                <div style="max-height: 300px;overflow-y: auto;">
+                <div style="max-height: 300px; overflow-y: auto">
                   <el-table :data="row.purchaseList">
                     <el-table-column width="140" property="date" label="交易金额">
                       <template #default="{ row }">
-                        <div>{{row.currency}} {{ moneyFormat(row.amount, 2) }}</div>
+                        <div>{{ row.currency }} {{ moneyFormat(row.amount, 2) }}</div>
                       </template>
                     </el-table-column>
                     <el-table-column width="120" property="rate" label="汇率" />
@@ -138,11 +123,11 @@
                 <template #reference>
                   <span class="table-btn">{{ moneyFormat(row.payForGoods, 2) }}</span>
                 </template>
-                <div style="max-height: 300px;overflow-y: auto;">
+                <div style="max-height: 300px; overflow-y: auto">
                   <el-table :data="row.payList">
                     <el-table-column width="150" property="date" label="交易金额">
                       <template #default="{ row }">
-                        <div>{{row.currency}} {{ moneyFormat(row.amount, 2) }}</div>
+                        <div>{{ row.currency }} {{ moneyFormat(row.amount, 2) }}</div>
                       </template>
                     </el-table-column>
                     <el-table-column width="60" property="rate" label="汇率" />
@@ -157,13 +142,13 @@
             <template #default="{ row }">
               <el-popover placement="top" :width="580" trigger="click">
                 <template #reference>
-                  <span class="table-btn">{{moneyFormat(row.otherExpenses, 2) }}</span>
+                  <span class="table-btn">{{ moneyFormat(row.otherExpenses, 2) }}</span>
                 </template>
-                <div style="max-height: 300px;overflow-y: auto;">
+                <div style="max-height: 300px; overflow-y: auto">
                   <el-table :data="row.accountRequestFundsDetailList">
                     <el-table-column width="150" property="date" label="交易金额">
                       <template #default="{ row }">
-                        <div>{{row.currency}} {{ moneyFormat(row.amount, 2) }}</div>
+                        <div>{{ row.currency }} {{ moneyFormat(row.amount, 2) }}</div>
                       </template>
                     </el-table-column>
                     <el-table-column width="60" property="rate" label="汇率" />
@@ -186,8 +171,8 @@
               <div>{{ moneyFormat(row.totalExpenses, 2) }}</div>
             </template>
           </el-table-column>
-          
-          <el-table-column label="毛利" width="120"> 
+
+          <el-table-column label="毛利" width="120">
             <template #default="{ row }">
               <div>{{ moneyFormat(row.grossProfit, 2) }}</div>
             </template>
@@ -201,23 +186,9 @@
         <el-table-column label="操作" align="center" width="170" fixed="right">
           <template #default="{ row }">
             <div>
-              <el-button type="primary" @click="changeExchangeRate(row)" link
-                >调整汇率</el-button
-              >
-              <el-button
-                type="primary"
-                @click="clickSettlement(row)"
-                v-if="row.settlementStatus === 0"
-                link
-                >结算</el-button
-              >
-              <el-button
-                type="primary"
-                @click="clickCancelSettlement(row)"
-                v-else
-                link
-                >取消结算</el-button
-              >
+              <el-button type="primary" @click="changeExchangeRate(row)" v-if="row.settlementStatus === 0" link>调整汇率</el-button>
+              <el-button type="primary" @click="clickSettlement(row)" v-if="row.settlementStatus === 0" link>结算</el-button>
+              <el-button type="primary" @click="clickCancelSettlement(row)" v-else link>取消结算</el-button>
             </div>
           </template>
         </el-table-column>
@@ -230,30 +201,14 @@
           :page-size="sourceList.pagination.pageSize"
           :total="sourceList.pagination.total"
           @size-change="handleSizeChange"
-          @current-change="handlePageChange"
-        />
+          @current-change="handlePageChange" />
       </el-row>
     </div>
 
-    <el-dialog
-      title="默认汇率"
-      v-if="dialogVisible"
-      v-model="dialogVisible"
-      width="600"
-    >
-      <byForm
-        :formConfig="formConfig"
-        :formOption="formOption"
-        v-model="formData.data"
-        :rules="rules"
-        ref="submit"
-      >
+    <el-dialog title="默认汇率" v-if="dialogVisible" v-model="dialogVisible" width="600">
+      <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
         <template #currencyList>
-          <el-table
-            :data="formData.data.list"
-            style="width: 100%"
-            v-loading="loadingDialog"
-          >
+          <el-table :data="formData.data.list" style="width: 100%" v-loading="loadingDialog">
             <el-table-column label="币种">
               <template #default="{ row }">
                 <div>{{ dictValueLabel(row.type, accountCurrency) }}</div>
@@ -261,19 +216,8 @@
             </el-table-column>
             <el-table-column label="兑 CHY 汇率">
               <template #default="{ row, $index }">
-                <el-form-item
-                  :prop="'list.' + $index + '.rate'"
-                  :rules="rules.rate"
-                  :inline-message="true"
-                >
-                  <el-input-number
-                    v-model="row.rate"
-                    placeholder="请输入兑 CHY 汇率"
-                    style="width: 100%"
-                    :precision="6"
-                    :controls="false"
-                    :min="0"
-                  />
+                <el-form-item :prop="'list.' + $index + '.rate'" :rules="rules.rate" :inline-message="true">
+                  <el-input-number v-model="row.rate" placeholder="请输入兑 CHY 汇率" style="width: 100%" :precision="6" :controls="false" :min="0" />
                 </el-form-item>
               </template>
             </el-table-column>
@@ -282,31 +226,14 @@
       </byForm>
       <template #footer>
         <el-button @click="dialogVisible = false" size="large">取 消</el-button>
-        <el-button type="primary" @click="submitForm()" size="large"
-          >确 定</el-button
-        >
+        <el-button type="primary" @click="submitForm()" size="large">确 定</el-button>
       </template>
     </el-dialog>
 
-    <el-dialog
-      title="调整汇率"
-      v-if="openChange"
-      v-model="openChange"
-      width="600"
-    >
-      <byForm
-        :formConfig="formChangeConfig"
-        :formOption="formOption"
-        v-model="formChangeData.data"
-        :rules="rules"
-        ref="change"
-      >
+    <el-dialog title="调整汇率" v-if="openChange" v-model="openChange" width="600">
+      <byForm :formConfig="formChangeConfig" :formOption="formOption" v-model="formChangeData.data" :rules="rules" ref="change">
         <template #currencyList>
-          <el-table
-            :data="formChangeData.data.list"
-            style="width: 100%"
-            v-loading="loadingDialog"
-          >
+          <el-table :data="formChangeData.data.list" style="width: 100%" v-loading="loadingDialog">
             <el-table-column label="币种">
               <template #default="{ row }">
                 <div>{{ dictValueLabel(row.type, accountCurrency) }}</div>
@@ -314,19 +241,8 @@
             </el-table-column>
             <el-table-column label="兑 CHY 汇率">
               <template #default="{ row, $index }">
-                <el-form-item
-                  :prop="'list.' + $index + '.rate'"
-                  :rules="rules.rate"
-                  :inline-message="true"
-                >
-                  <el-input-number
-                    v-model="row.rate"
-                    placeholder="请输入兑 CHY 汇率"
-                    style="width: 100%"
-                    :precision="4"
-                    :controls="false"
-                    :min="0"
-                  />
+                <el-form-item :prop="'list.' + $index + '.rate'" :rules="rules.rate" :inline-message="true">
+                  <el-input-number v-model="row.rate" placeholder="请输入兑 CHY 汇率" style="width: 100%" :precision="4" :controls="false" :min="0" />
                 </el-form-item>
               </template>
             </el-table-column>
@@ -335,17 +251,10 @@
       </byForm>
       <template #footer>
         <el-button @click="openChange = false" size="large">取 消</el-button>
-        <el-button type="primary" @click="submitChangeForm()" size="large"
-          >确 定</el-button
-        >
+        <el-button type="primary" @click="submitChangeForm()" size="large">确 定</el-button>
       </template>
     </el-dialog>
-    <el-dialog
-      title="合同详情"
-      v-if="openDetailsDialog"
-      v-model="openDetailsDialog"
-      width="1100"
-    >
+    <el-dialog title="合同详情" v-if="openDetailsDialog" v-model="openDetailsDialog" width="1100">
       <ContractDetails :contractId="currentContractId"></ContractDetails>
     </el-dialog>
   </div>
@@ -382,12 +291,79 @@ const sourceList = ref({
     settlementStatus: "",
     userId: "",
     isArrival: "1",
+    beginTime: "",
+    endTime: "",
+    year: "",
+    month: "",
   },
 });
 const loading = ref(false);
 
-let statConfig = ref([])
+let statConfig = ref([]);
 
+const year = ref([]);
+const getYear = () => {
+  // 获取当前年份
+  const currentYear = new Date().getFullYear();
+  // 初始化年份数组,从2023年开始
+  for (let yyyy = currentYear; yyyy >= 2023; yyyy--) {
+    year.value.push({
+      label: yyyy,
+      value: yyyy,
+    });
+  }
+};
+getYear();
+const month = ref([
+  {
+    label: "1月",
+    value: "01",
+  },
+  {
+    label: "2月",
+    value: "02",
+  },
+  {
+    label: "3月",
+    value: "03",
+  },
+  {
+    label: "4月",
+    value: "04",
+  },
+  {
+    label: "5月",
+    value: "05",
+  },
+  {
+    label: "6月",
+    value: "06",
+  },
+  {
+    label: "7月",
+    value: "07",
+  },
+  {
+    label: "8月",
+    value: "08",
+  },
+  {
+    label: "9月",
+    value: "09",
+  },
+  {
+    label: "10月",
+    value: "10",
+  },
+  {
+    label: "11月",
+    value: "11",
+  },
+  {
+    label: "12月",
+    value: "12",
+  },
+]);
 const selectConfig = computed(() => {
   return [
     {
@@ -414,6 +390,16 @@ const selectConfig = computed(() => {
         },
       ],
     },
+    {
+      label: "年份",
+      prop: "year",
+      data: year.value,
+    },
+    {
+      label: "月份",
+      prop: "month",
+      data: month.value,
+    },
   ];
 });
 const config = computed(() => {
@@ -457,119 +443,128 @@ const getDict = () => {
 };
 const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  if (sourceList.value.pagination.year) {
+    if (sourceList.value.pagination.month) {
+      sourceList.value.pagination.beginTime = sourceList.value.pagination.year + "-" + sourceList.value.pagination.month + "-01 00:00:00";
+      sourceList.value.pagination.endTime = sourceList.value.pagination.year + "-" + sourceList.value.pagination.month + "-31 23:59:59";
+    } else {
+      sourceList.value.pagination.beginTime = sourceList.value.pagination.year + "-01-01 00:00:00";
+      sourceList.value.pagination.endTime = sourceList.value.pagination.year + "-12-31 23:59:59";
+    }
+  } else {
+    sourceList.value.pagination.beginTime = "";
+    sourceList.value.pagination.endTime = "";
+  }
   loading.value = true;
-  getTotal()
-  proxy
-    .post("/saleStatement/getProfitSettlement", sourceList.value.pagination)
-    .then((res) => {
-      sourceList.value.data = res.rows;
-      sourceList.value.pagination.total = res.total;
-      setTimeout(() => {
-        loading.value = false;
-      }, 200);
-    });
+  getTotal();
+  proxy.post("/saleStatement/getProfitSettlement", sourceList.value.pagination).then((res) => {
+    sourceList.value.data = res.rows;
+    sourceList.value.pagination.total = res.total;
+    setTimeout(() => {
+      loading.value = false;
+    }, 200);
+  });
 };
 //获取统计数据
 const getTotal = () => {
   proxy.post("/saleStatement/getProfitSettlementHead", sourceList.value.pagination).then(
     (res) => {
-      
-      statConfig.value = [{
-        label: '统计',
-        data:[
-          //一个卡牌多数据配置
-          {
-            label:'订单统计(CNY)',
-            type:2,
-            data:[
-              {
-                label:'订单数',
-                num:res.contractCount,
-                color:'#9E64ED',
-              },
-              {
-                label:'销售总金额',
-                num:res.contractSumAmount,
-                color:'#9E64ED',
-              },
-              {
-                label:'采购总金额',
-                num:res.purchaseSumAmount,
-                color:'#9E64ED',
-              },
-            ]
-          },
-          {
-            label:'收入统计(CNY)',
-            type:3,
-            data:[
-              {
-                label:'合同到账',
-                num:res.contractArrivalSumAmount,
-                color:'#FF9315',
-              },
-              {
-                label:'退税',
-                num:res.taxReturnMoneySumAmount,
-                color:'#FF9315',
-              },
-              {
-                label:'其他收入',
-                num:res.otherIncomeSumAmount,
-                color:'#FF9315',
-              },
-            ]
-          },
-          {
-            label:'支出统计(CNY)',
-            type:5,
-            data:[
-              {
-                label:'支付货款',
-                num:res.payForGoodsSumAmount,
-                color:'#F94539',
-              },
-              {
-                label:'其他支出',
-                num:res.otherExpensesSumAmount,
-                color:'#F94539',
-              },
-            ]
-          },
-          {
-            label:'收支统计(CNY)',
-            type:1,
-            data:[
-              {
-                label:'总收入',
-                num:res.totalIncomeSumAmount,
-                color:'#0084FF',
-              },
-              {
-                label:'总支出',
-                num:res.totalExpensesSumAmount,
-                color:'#0084FF',
-              },
-              {
-                label:'总毛利',
-                num:res.grossProfitSum,
-                color:'#0084FF',
-              },
-              {
-                label:'毛利率',
-                num:res.GrossProfitMargin + '%',
-                color:'#0084FF',
-              },
-            ]
-          },
-        ],
-      }]
+      statConfig.value = [
+        {
+          label: "统计",
+          data: [
+            //一个卡牌多数据配置
+            {
+              label: "订单统计(CNY)",
+              type: 2,
+              data: [
+                {
+                  label: "订单数",
+                  num: res.contractCount,
+                  color: "#9E64ED",
+                },
+                {
+                  label: "销售总金额",
+                  num: res.contractSumAmount,
+                  color: "#9E64ED",
+                },
+                {
+                  label: "采购总金额",
+                  num: res.purchaseSumAmount,
+                  color: "#9E64ED",
+                },
+              ],
+            },
+            {
+              label: "收入统计(CNY)",
+              type: 3,
+              data: [
+                {
+                  label: "合同到账",
+                  num: res.contractArrivalSumAmount,
+                  color: "#FF9315",
+                },
+                {
+                  label: "退税",
+                  num: res.taxReturnMoneySumAmount,
+                  color: "#FF9315",
+                },
+                {
+                  label: "其他收入",
+                  num: res.otherIncomeSumAmount,
+                  color: "#FF9315",
+                },
+              ],
+            },
+            {
+              label: "支出统计(CNY)",
+              type: 5,
+              data: [
+                {
+                  label: "支付货款",
+                  num: res.payForGoodsSumAmount,
+                  color: "#F94539",
+                },
+                {
+                  label: "其他支出",
+                  num: res.otherExpensesSumAmount,
+                  color: "#F94539",
+                },
+              ],
+            },
+            {
+              label: "收支统计(CNY)",
+              type: 1,
+              data: [
+                {
+                  label: "总收入",
+                  num: res.totalIncomeSumAmount,
+                  color: "#0084FF",
+                },
+                {
+                  label: "总支出",
+                  num: res.totalExpensesSumAmount,
+                  color: "#0084FF",
+                },
+                {
+                  label: "总毛利",
+                  num: res.grossProfitSum,
+                  color: "#0084FF",
+                },
+                {
+                  label: "毛利率",
+                  num: res.GrossProfitMargin + "%",
+                  color: "#0084FF",
+                },
+              ],
+            },
+          ],
+        },
+      ];
     },
-    (err) => {
-      
-    }
+    (err) => {}
   );
-}
+};
 
 const rateStatus = ref(false);
 const judgeRate = () => {
@@ -738,14 +733,14 @@ const changeExchangeRate = (row) => {
       const element = row.currencyList[i];
       for (let j = 0; j < currencyRateJson.length; j++) {
         const jelement = currencyRateJson[j];
-        if(element.id == jelement.id){
+        if (element.id == jelement.id) {
           element.rate = jelement.rate;
           break;
         }
       }
     }
-    
-    formChangeData.data.list = row.currencyList
+
+    formChangeData.data.list = row.currencyList;
     // formChangeData.data.list = formChangeData.data.list.map((item) => {
     //   for (let i = 0; i < currencyRateJson.length; i++) {
     //     if (item.type === currencyRateJson[i].type) {
@@ -755,9 +750,8 @@ const changeExchangeRate = (row) => {
     //   }
     //   return {
     //     ...item,
-    //   }; 
+    //   };
     // });
-    console.log(row.currencyList)
     loadingDialog.value = false;
   } else {
     formChangeData.data = {
@@ -765,7 +759,7 @@ const changeExchangeRate = (row) => {
       list: row.currencyList,
     };
   }
-  loadingDialog.value = false
+  loadingDialog.value = false;
 };
 const submitChangeForm = () => {
   change.value.handleSubmit(() => {
@@ -780,6 +774,17 @@ const submitChangeForm = () => {
           type: "success",
         });
         openChange.value = false;
+        proxy
+          .post("/saleStatement/getProfitSettlement", {
+            pageNum: 1,
+            pageSize: 10,
+            id: formChangeData.data.id,
+          })
+          .then((resRow) => {
+            if (resRow.rows && resRow.rows.length > 0) {
+              this.clickSettlement(resRow.rows[0]);
+            }
+          });
         getList();
       },
       (err) => {
@@ -840,8 +845,8 @@ const openDetails = (row) => {
 ::v-deep(.el-input-number .el-input__inner) {
   text-align: left;
 }
-.table-btn{
+.table-btn {
   cursor: pointer;
-  color: #409EFF;
+  color: #409eff;
 }
 </style>