Procházet zdrojové kódy

其他应收单更改

chen před 3 roky
rodič
revize
9d935aaf44

+ 44 - 40
src/utils/request.js

@@ -1,86 +1,90 @@
-import axios from 'axios'
-import { MessageBox, Message } from 'element-ui'
-import store from '@/store'
-import { getToken } from '@/utils/auth'
+import axios from "axios";
+import { MessageBox, Message } from "element-ui";
+import store from "@/store";
+import { getToken } from "@/utils/auth";
 
 // create an axios instance
 const service = axios.create({
   baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
   // withCredentials: true, // send cookies when cross-domain requests
-  timeout: 300000 // request timeout
-})
-const whiteCodes = [200, 4444]
+  timeout: 300000, // request timeout
+});
+const whiteCodes = [200, 201, 4444];
 
 // request interceptor
 service.interceptors.request.use(
-  config => {
+  (config) => {
     // do something before request is sent
 
     if (store.getters.token) {
       // let each request carry token
       // ['X-Token'] is a custom headers key
       // please modify it according to the actual situation
-      config.headers['x-token'] = getToken()
+      config.headers["x-token"] = getToken();
     }
-    return config
+    return config;
   },
-  error => {
+  (error) => {
     // do something with request error
-    console.log(error) // for debug
-    return Promise.reject(error)
+    console.log(error); // for debug
+    return Promise.reject(error);
   }
-)
+);
 
 // response interceptor
 service.interceptors.response.use(
   /**
    * If you want to get http information such as headers or status
    * Please return  response => response
-  */
+   */
 
   /**
    * Determine the request status by custom code
    * Here is just an example
    * You can also judge the status by HTTP Status Code
    */
-  response => {
-    const res = response.data
+  (response) => {
+    const res = response.data;
 
     // if the custom code is not 20000, it is judged as an error.
     if (whiteCodes.indexOf(res.code) < 0) {
       Message({
-        message: res.message || 'Error',
-        type: 'error',
-        duration: 5 * 1000
-      })
+        message: res.message || "Error",
+        type: "error",
+        duration: 5 * 1000,
+      });
 
       // 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired;
       if (res.code === 1001) {
         // to re-login
-        MessageBox.confirm('登录失效,您可以取消停留在此页面,或重新登录', '登录失效', {
-          confirmButtonText: '重新登录',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
-          store.dispatch('user/resetToken').then(() => {
-            location.reload()
-          })
-        })
+        MessageBox.confirm(
+          "登录失效,您可以取消停留在此页面,或重新登录",
+          "登录失效",
+          {
+            confirmButtonText: "重新登录",
+            cancelButtonText: "取消",
+            type: "warning",
+          }
+        ).then(() => {
+          store.dispatch("user/resetToken").then(() => {
+            location.reload();
+          });
+        });
       }
-      return Promise.reject(new Error(res.message || 'Error'))
+      return Promise.reject(new Error(res.message || "Error"));
     } else {
-      return res
+      return res;
     }
   },
-  error => {
-    console.log('err' + error) // for debug
+  (error) => {
+    console.log("err" + error); // for debug
     Message({
       message: error.message,
-      type: 'error',
-      duration: 5 * 1000
-    })
-    return Promise.reject(error)
+      type: "error",
+      duration: 5 * 1000,
+    });
+    return Promise.reject(error);
   }
-)
+);
 
-export default service
+export default service;

+ 92 - 55
src/views/finance/components/receivable_list-add.vue

@@ -183,7 +183,7 @@
             <template slot-scope="scope">
               <el-select
                 filterable
-                v-model="scope.row.walletId"
+                v-model="scope.row.customerWalletId"
                 placeholder="请选择"
               >
                 <el-option
@@ -221,16 +221,13 @@
           </el-table-column>
           <el-table-column
             align="center"
-            label="*不含税金额"
+            label="不含税金额"
             prop="afterTaxAmount"
             min-width="160"
             show-overflow-tooltip
           >
             <template slot-scope="scope">
               <el-input
-                @input="
-                  changeAfterTaxAmount($event, scope.$index, scope.row.taxRate)
-                "
                 v-model="scope.row.afterTaxAmount"
                 type="number"
               ></el-input>
@@ -244,26 +241,19 @@
             show-overflow-tooltip
           >
             <template slot-scope="scope">
-              <el-input
-                disabled
-                :min="0"
-                oninput="if(value<0)value=0"
-                v-model="scope.row.tax"
-              ></el-input>
+              <el-input type="number" v-model="scope.row.tax"></el-input>
             </template>
           </el-table-column>
           <el-table-column
             align="center"
-            label="总金额"
+            label="*总金额"
             prop="tax"
             min-width="160"
             show-overflow-tooltip
           >
             <template slot-scope="scope">
               <el-input
-                disabled
-                :min="0"
-                oninput="if(value<0)value=0"
+                type="number"
                 v-model="scope.row.totalAmount"
               ></el-input>
             </template>
@@ -277,13 +267,6 @@
           >
             <template slot-scope="scope">
               <el-input
-                @input="
-                  changeAfterTaxAmount(
-                    scope.row.afterTaxAmount,
-                    scope.$index,
-                    scope.row.taxRate
-                  )
-                "
                 type="number"
                 :min="0"
                 oninput="if(value>100)value=100;if(value<0)value=0"
@@ -322,6 +305,17 @@
         >
       </div>
     </div>
+
+    <!-- 提示 -->
+    <el-dialog title="提示" :visible.sync="dialogVisible" width="30%">
+      <ul class="ulStyle" v-for="(v, i) in messageList" :key="i">
+        <li>{{ v }},现金钱包余额不足,请确认是否继续提交此单据</li>
+      </ul>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisibleCancel">取 消</el-button>
+        <el-button type="primary" @click="dialogVisibleOK">确 定</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
@@ -336,6 +330,8 @@ import {
 export default {
   data() {
     return {
+      messageList: [],
+      dialogVisible: false,
       searchForm: {
         source: "",
         billType: "其他应收单",
@@ -365,25 +361,44 @@ export default {
     this.getCustomerList();
   },
   methods: {
-    // 不含税金额改变事件
-    changeAfterTaxAmount(v, i, sl) {
-      // console.log(v, i);
-      // let rule = /(^-?[1-9](\d+)?(\.\d{1,2})?$)|(^-?0$)|(^-?\d\.\d{1,2}$)/;
-      // console.log();
-      // if (!rule.test(v)) {
-      //   this.$message.error("请输入正确的不含税金额");
-      //   return;
-      // }
-      //税额
-      let tax = (v * (sl / 100)).toFixed(2);
-      // console.log(tax, "税额");
-      //总金额
-      let totalAmount = (v * 1 + tax * 1).toFixed(2);
-      // console.log(totalAmount, "总金额");
-
-      this.$set(this.dataList[i], "tax", tax);
-      this.$set(this.dataList[i], "totalAmount", totalAmount);
+    //取消
+    async dialogVisibleCancel() {
+      this.dialogVisible = false;
     },
+    //确定
+    async dialogVisibleOK() {
+      this.dialogVisible = false;
+      await getFinanceOtherReceAdd({
+        items: this.dataList,
+        ...this.searchForm,
+        isContinue: true,
+      });
+      const res = await getFinanceOtherReceList({ pageSize: 1, pageNum: 1 });
+      await getFinanceOtherReceApply({ id: res.data.records[0].id });
+      this.$message.success("提审成功");
+      this.$emit("updateList");
+      this.$parent.showPage = 1;
+      this.resetFn();
+    },
+    // // 不含税金额改变事件
+    // changeAfterTaxAmount(v, i, sl) {
+    //   // console.log(v, i);
+    //   // let rule = /(^-?[1-9](\d+)?(\.\d{1,2})?$)|(^-?0$)|(^-?\d\.\d{1,2}$)/;
+    //   // console.log();
+    //   // if (!rule.test(v)) {
+    //   //   this.$message.error("请输入正确的不含税金额");
+    //   //   return;
+    //   // }
+    //   //税额
+    //   let tax = (v * (sl / 100)).toFixed(2);
+    //   // console.log(tax, "税额");
+    //   //总金额
+    //   let totalAmount = (v * 1 + tax * 1).toFixed(2);
+    //   // console.log(totalAmount, "总金额");
+
+    //   this.$set(this.dataList[i], "tax", tax);
+    //   this.$set(this.dataList[i], "totalAmount", totalAmount);
+    // },
     //重置
     resetFn() {
       this.searchForm = {};
@@ -416,12 +431,12 @@ export default {
           this.$message.error("请输入费用承担部门");
           return v;
         }
-        if (!v.walletId) {
+        if (!v.customerWalletId) {
           this.$message.error("请选择现金钱包");
           return v;
         }
-        if (v.afterTaxAmount == "") {
-          this.$message.error("请输入不含税金额");
+        if (v.totalAmount == "") {
+          this.$message.error("请输入金额");
           return v;
         }
       });
@@ -429,25 +444,37 @@ export default {
       if (aaa != undefined) {
         return;
       }
+      // console.log(this.dataList, 7777);
       this.dataList.forEach((v) => {
         let res = this.customerList.filter((i) => i.id == v.customerId);
         console.log(res);
         v.customerName = res[0].name;
         v.customerNumber = res[0].number;
-        let res2 = v.walletList.filter((j) => j.customerWalletId == v.walletId);
-        v.customerWalletId = res2[0].customerWalletId;
+        let res2 = v.walletList.filter(
+          (j) => j.customerWalletId == v.customerWalletId
+        );
+        // console.log(res2, "res2");
+        // v.customerWalletId = res2[0].customerWalletId;
         v.walletId = res2[0].walletRebateId;
       });
-      await getFinanceOtherReceAdd({
+      // console.log(this.dataList, 888888);
+
+      let res = await getFinanceOtherReceAdd({
         items: this.dataList,
         ...this.searchForm,
       });
-      const res = await getFinanceOtherReceList({ pageSize: 1, pageNum: 1 });
-      await getFinanceOtherReceApply({ id: res.data.records[0].id });
-      this.$message.success("提审成功");
-      this.$emit("updateList");
-      this.$parent.showPage = 1;
-      this.resetFn();
+      if (res.code == 201) {
+        this.dialogVisible = true;
+        this.messageList = res.data;
+      }
+      if (res.code == 200) {
+        const res = await getFinanceOtherReceList({ pageSize: 1, pageNum: 1 });
+        await getFinanceOtherReceApply({ id: res.data.records[0].id });
+        this.$message.success("提审成功");
+        this.$emit("updateList");
+        this.$parent.showPage = 1;
+        this.resetFn();
+      }
     },
     //选择经销商名称事件
     async changeCustomerFn(v, index) {
@@ -472,11 +499,11 @@ export default {
         projectCode: "CI004",
         projectName: "收差价",
         departmentId: "",
-        walletId: "",
+        customerWalletId: "",
         invoiceType: "",
         afterTaxAmount: "",
-        // tax: "",
-        // totalAmount: "",
+        tax: "",
+        totalAmount: "",
         taxRate: 13,
       });
     },
@@ -488,10 +515,20 @@ export default {
 </script>
 
 <style lang="scss" scoped>
+::v-deep .el-dialog__body {
+  padding: 0 20px;
+}
 .selectStyle {
   width: 100%;
 }
 .mar {
   margin-top: 20px;
 }
+.ulStyle {
+  list-style: simp-chinese-informal;
+  li {
+    height: 30px;
+    line-height: 30px;
+  }
+}
 </style>

+ 37 - 10
src/views/finance/rebate_list.vue

@@ -88,6 +88,8 @@
             fit
             highlight-current-row
             stripe
+            show-summary
+            :summary-method="$getSummaries"
           >
             <el-table-column
               align="center"
@@ -182,38 +184,49 @@
               show-overflow-tooltip
             ></el-table-column>
             <el-table-column
-              align="center"
+              align="right"
               label="总返利金额"
               prop="amount"
               min-width="160"
               show-overflow-tooltip
             >
+              <template slot-scope="scope">
+                {{ scope.row.amount | numToFixed }}
+              </template>
             </el-table-column>
             <el-table-column
-              align="center"
+              align="right"
               label="返利金额"
-              prop=""
+              prop="rebateAmount"
               min-width="160"
               show-overflow-tooltip
             >
               <template slot-scope="scope">
-                {{ scope.row.withholdAmount != 0 ? 0 : scope.row.rebateAmount }}
+                {{ scope.row.rebateAmount | numToFixed }}
               </template>
             </el-table-column>
             <el-table-column
-              align="center"
+              align="right"
               label="暂扣返利"
               prop="withholdAmount"
               min-width="160"
               show-overflow-tooltip
-            ></el-table-column>
+            >
+              <template slot-scope="scope">
+                {{ scope.row.withholdAmount | numToFixed }}
+              </template>
+            </el-table-column>
             <el-table-column
-              align="center"
+              align="right"
               label="折让金额"
               prop="allowanceAmount"
               min-width="160"
               show-overflow-tooltip
-            ></el-table-column>
+            >
+              <template slot-scope="scope">
+                {{ scope.row.allowanceAmount | numToFixed }}
+              </template>
+            </el-table-column>
             <el-table-column
               v-if="!isCustomer"
               align="center"
@@ -232,12 +245,16 @@
             ></el-table-column>
             <el-table-column
               v-if="!isCustomer"
-              align="center"
+              align="right"
               label="已办理折让金额"
               prop="handledAllowanceAmount"
               min-width="160"
               show-overflow-tooltip
-            ></el-table-column>
+            >
+              <template slot-scope="scope">
+                {{ scope.row.handledAllowanceAmount | numToFixed }}
+              </template>
+            </el-table-column>
             <el-table-column
               v-if="!isCustomer"
               align="center"
@@ -655,6 +672,16 @@ export default {
       const res = await getRebateOrderList(data);
       this.listTotal = res.data.total;
       let arr = res.data.records;
+      arr.forEach((value) => {
+        value.sums1 = [];
+        value.sums2 = [
+          "amount",
+          "rebateAmount",
+          "withholdAmount",
+          "allowanceAmount",
+          "handledAllowanceAmount",
+        ];
+      });
       if (this.isCustomer) {
         let arr2 = arr.filter((v) => {
           if (