Browse Source

增加采购付款流程

cz 1 year ago
parent
commit
f6b86e0556

+ 16 - 3
src/lang/cnCZ.js

@@ -43,11 +43,24 @@ export function cnCZ() {
       goodsName: "物品名称",
       stockNumber: "库存数量",
       inventoryNumber: "盘点数量",
+      inventoryWarehouseCanNotBeEmpty: '盘点仓库不能为空',
+      goodsNameCanNotBeEmpty: "物品名称不能为空",
+      inventoryNumberCanNotBeEmpty: "盘点数量不能为空",
+    },
+    purchasePayment: {
+      name: "采购付款",
+      sendPayment: "发起付款",
+      supplyName: "供应商",
+      applicationsTime: "申请时间",
+      applicationsAmount: "申请金额",
+      approvalStatus: "审批状态",
+      paymentStatus: "付款状态",
+
+      stockNumber: "库存数量",
+      inventoryNumber: "盘点数量",
+      inventoryWarehouseCanNotBeEmpty: '盘点仓库不能为空',
       goodsNameCanNotBeEmpty: "物品名称不能为空",
       inventoryNumberCanNotBeEmpty: "盘点数量不能为空",
-      qualityUnQualifiedCanNotBeEmpty: "质检不合格不能为空",
-      qualityInspectionQuantityCannotBeZero: "质检数量不能为零",
-      qualityInspectionQuantityNotBeGreaterThanArrivalNumber: "质检数量加已质检数量不可大于到货数量",
     },
   };
 

+ 9 - 2
src/main.js

@@ -7,12 +7,15 @@ import i18n from '@/lang/'
 import {
   moneyFormat,
   getDictOne,
-  compareTime
+  compareTime,
+  dictValueLabel
 } from '@/utils/util'
 const app = createApp(App)
 app.use(router)
 app.use(i18n).mount('#app')
-import { uploadDdRightBtn } from '@/utils/ddAdapter'
+import {
+  uploadDdRightBtn
+} from '@/utils/ddAdapter'
 import {
   post,
   get
@@ -24,9 +27,13 @@ app.config.globalProperties.post = post
 app.config.globalProperties.moneyFormat = moneyFormat
 // 获取字典
 app.config.globalProperties.getDictOne = getDictOne
+// 字典回显
+app.config.globalProperties.dictValueLabel = dictValueLabel
 // 比较时间大小
 app.config.globalProperties.compareTime = compareTime
 app.config.globalProperties.uploadDdRightBtn = uploadDdRightBtn
+
+
 //中英文全局挂载
 app.config.globalProperties.t = i18n.global.t
 export default app

+ 6 - 0
src/router/jxskRouter.js

@@ -100,6 +100,12 @@ export function jxskRouter() {
       name: '库存盘点添加',
       component: () => import('../views/purchase-sales/inventory-management/Inventory/add.vue')
     },
+    {
+      path: 'purchasePayment',
+      name: '采购付款',
+      component: () => import('../views/procurementManagement/payment/index.vue')
+    },
+
   ];
   return jxskRouter;
 }

+ 12 - 0
src/utils/util.js

@@ -67,4 +67,16 @@ export function compareTime(date1, date2) {
   } else {
     return false; //第二个大
   }
+}
+
+//根据value值回显字典label值
+export function dictValueLabel(value, arr) {
+  if ((value || value === 0) && arr) {
+    const current = arr.filter((x) => x.value == value);
+    if (current && current.length > 0) {
+      return current[0].label;
+    }
+    return "";
+  }
+  return "";
 }

+ 9 - 0
src/views/processApproval/components/SendPurchasePayment.vue

@@ -0,0 +1,9 @@
+<template>
+  <div>a</div>
+</template>
+
+<script setup>
+</script>
+
+<style lang="scss" scoped>
+</style>

+ 7 - 0
src/views/processApproval/processDtl.vue

@@ -95,6 +95,8 @@ import { useRoute } from 'vue-router'
 import SendSubscribe from './components/SendSubscribe'
 import SendFunds from './components/SendFunds'
 import Contract from './components/Contract'
+import SendPurchasePayment from './components/SendPurchasePayment'
+
 import { showSuccessToast, showFailToast } from 'vant'
 const route = useRoute()
 const proxy = getCurrentInstance().proxy
@@ -141,6 +143,11 @@ let componentObj = ref({
 		component: Contract,
 		backUrl: '/main/contract',
 	},
+		pay_flow: {
+		title: '采购付款',
+		component: SendPurchasePayment,
+		backUrl: '/main/purchasePayment',
+	},
 })
 
 let dialogVisible = ref(false)

+ 149 - 0
src/views/procurementManagement/payment/index.vue

@@ -0,0 +1,149 @@
+<template>
+  <van-nav-bar
+    :title="$t('purchasePayment.name')"
+    left-text=""
+    left-arrow
+    @click-left="onClickLeft"
+    @click-right="onClickRight"
+  >
+    <template #right> {{ $t("purchasePayment.sendPayment") }} </template>
+  </van-nav-bar>
+  <van-search
+    v-model="req.keyword"
+    :placeholder="$t('common.pleaseEnterKeywords')"
+    @search="onRefresh"
+  />
+  <van-pull-refresh v-model="loading" @refresh="onRefresh">
+    <div class="list">
+      <van-list
+        v-model:loading="loading"
+        :finished="finished"
+        :finished-text="$t('common.noMore')"
+        @load="getList"
+        style="margin-bottom: 60px"
+      >
+        <commonList :data="listData" @onClick="toDtl" :config="listConfig">
+          <template #money="{ row }">
+            <div>{{ row.currency }} {{ moneyFormat(row.amount, 2) }}</div>
+          </template>
+          <template #approvalStatus="{ row }">
+            <div>{{ dictValueLabel(row.status, statusData) }}</div>
+          </template>
+          <template #paymentStatus="{ row }">
+            <div>{{ dictValueLabel(row.payStatus, payStatus) }}</div>
+          </template>
+        </commonList>
+      </van-list>
+    </div>
+  </van-pull-refresh>
+</template>
+<script setup>
+import { ref, getCurrentInstance } from "vue";
+import commonList from "@/components/common-list.vue";
+
+const proxy = getCurrentInstance().proxy;
+const onClickLeft = () => proxy.$router.push("/main/working");
+const req = ref({
+  pageNum: 1,
+  keyword: null,
+});
+const finished = ref(false);
+const onRefresh = () => {
+  req.value.pageNum = 1;
+  finished.value = false;
+  getList("refresh");
+};
+const loading = ref(false);
+const listData = ref([]);
+const statusData = ref([
+  {
+    label: "草稿",
+    value: 0,
+  },
+  {
+    label: "审批中",
+    value: 10,
+  },
+  {
+    label: "驳回",
+    value: 20,
+  },
+  {
+    label: "审批通过",
+    value: 30,
+  },
+  {
+    label: "终止",
+    value: 99,
+  },
+]);
+const payStatusData = ref([]);
+const getDict = () => {
+  proxy.getDictOne(["pay_status"]).then((res) => {
+    payStatusData.value = res["pay_status"].data.map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+  });
+};
+getDict();
+const getList = (type) => {
+  loading.value = true;
+  proxy
+    .post("/pay/page", req.value)
+    .then((res) => {
+      listData.value =
+        type === "refresh"
+          ? res.data.rows
+          : listData.value.concat(res.data.rows);
+      if (req.value.pageNum * 10 >= res.data.total) {
+        finished.value = true;
+      }
+      req.value.pageNum++;
+      loading.value = false;
+    })
+    .catch(() => {
+      loading.value = false;
+    });
+};
+const toDtl = (row) => {};
+const onClickRight = () => {
+  proxy.$router.push({
+    path: "/main/processDtl",
+    query: {
+      flowKey: "pay_flow",
+    },
+  });
+};
+const listConfig = ref([
+  {
+    label: proxy.t("purchasePayment.supplyName"),
+    prop: "supplyName",
+  },
+  {
+    label: proxy.t("purchasePayment.applicationsTime"),
+    prop: "createTime",
+  },
+  {
+    type: "slot",
+    label: proxy.t("purchasePayment.applicationsAmount"),
+    slotName: "money",
+  },
+  {
+    type: "slot",
+    label: proxy.t("purchasePayment.approvalStatus"),
+    slotName: "approvalStatus",
+  },
+  {
+    type: "slot",
+    label: proxy.t("purchasePayment.paymentStatus"),
+    slotName: "paymentStatus",
+  },
+]);
+</script>
+
+<style lang="scss" scoped>
+.list {
+  min-height: 70vh;
+}
+</style>

+ 57 - 46
src/views/purchase-sales/inventory-management/Inventory/add.vue

@@ -30,16 +30,22 @@ const formData = reactive({
   data: {},
 });
 const rules = {
-  qualifiedCount: [
+  warehouseId: [
     {
       required: true,
-      message: proxy.t("inventoryCount.qualityQualifiedCanNotBeEmpty"),
+      message: proxy.t("inventoryCount.inventoryWarehouseCanNotBeEmpty"),
     },
   ],
-  noQualifiedCount: [
+  productId: [
     {
       required: true,
-      message: proxy.t("inventoryCount.qualityUnQualifiedCanNotBeEmpty"),
+      message: proxy.t("inventoryCount.goodsNameCanNotBeEmpty"),
+    },
+  ],
+  checkQuantity: [
+    {
+      required: true,
+      message: proxy.t("inventoryCount.inventoryNumberCanNotBeEmpty"),
     },
   ],
 };
@@ -50,6 +56,7 @@ const formOption = reactive({
   scroll: true,
   labelWidth: "62pk",
   submitBtnText: proxy.t("common.submit"),
+  hiddenSubmitBtn: false,
   btnConfig: {
     isNeed: true,
     label: proxy.t("common.details"),
@@ -69,13 +76,13 @@ const formOption = reactive({
         },
         data: [],
         changeFn: function (option, item, index, currentSonIndex) {
-          console.log(option, item, index, currentSonIndex, "ww");
           formData.data.list[index][item.prop] = option.selectedOptions[0].id;
           formData.data.list[index][item.prop + "Name"] =
             option.selectedOptions[0].name;
           formDom.value.btnConfigCopy.listConfig[
             currentSonIndex
           ].showPicker = false;
+          getStokeQuantity();
         },
       },
       {
@@ -89,7 +96,7 @@ const formOption = reactive({
         type: "input",
         itemType: "number",
         label: proxy.t("inventoryCount.inventoryNumber"),
-        prop: "quantity",
+        prop: "checkQuantity",
         readonly: false,
       },
     ],
@@ -129,6 +136,7 @@ const formConfig = reactive([
       formData.data[item.prop] = option.selectedOptions[0].id;
       formData.data[item.prop + "Name"] = option.selectedOptions[0].name;
       formConfig[index].showPicker = false;
+      getStokeQuantity();
     },
   },
 ]);
@@ -145,56 +153,59 @@ const getDict = () => {
       productData.value = res.data.rows;
     });
 };
+const getStokeQuantity = () => {
+  if (
+    formData.data.warehouseId &&
+    formData.data.list &&
+    formData.data.list.length > 0
+  ) {
+    let arr = [];
+    arr = formData.data.list.map((x) => x.productId);
+    if (arr.length > 0) {
+      proxy
+        .post("/stock/pageByWarehouse", {
+          id: formData.data.warehouseId,
+          productIds: arr,
+        })
+        .then((res) => {
+          for (let i = 0; i < formData.data.list.length; i++) {
+            const e = formData.data.list[i];
+            const current = res.data.rows.find(
+              (x) => x.productId === e.productId
+            );
+            if (current) {
+              e.quantity = current.quantity;
+            } else {
+              e.quantity = "0";
+            }
+          }
+        });
+    }
+  }
+};
 onMounted(() => {
   getDict();
   if (route.query && route.query.id) {
+    formOption.hiddenSubmitBtn = true;
+    formOption.btnConfig.isNeed = false;
     proxy.post("/stockCheck/detail", { id: route.query.id }).then((res) => {
-      console.log(res, "aaa");
+      formData.data = res.data;
     });
   }
 });
 
 const onSubmit = () => {
-  let data = { ...formData.data };
-  if (Number(data.qualifiedCount) + Number(data.noQualifiedCount) > 0) {
-    if (
-      Number(data.qualifiedCount) +
-        Number(data.noQualifiedCount) +
-        Number(data.sumQualityCount) >
-      Number(data.count)
-    ) {
-      return showFailToast(
-        proxy.t(
-          "inventoryCount.qualityInspectionQuantityNotBeGreaterThanArrivalNumber"
-        )
-      );
-    } else {
-      let obj = {
-        arrivalDetailId: data.arrivalDetailId,
-        qualifiedCount: data.qualifiedCount,
-        noQualifiedCount: data.noQualifiedCount,
-      };
-      delete data.arrivalDetailId;
-      delete data.qualifiedCount;
-      delete data.noQualifiedCount;
-      data.qualityDetailList = [obj];
-      proxy.post("/quality/add", data).then(
-        () => {
-          showSuccessToast(proxy.t("common.operationSuccessful"));
-          setTimeout(() => {
-            onClickLeft();
-          }, 500);
-        },
-        (err) => {
-          return showFailToast(err.message);
-        }
-      );
+  proxy.post("/stockCheck/add", formData.data).then(
+    () => {
+      showSuccessToast(proxy.t("common.operationSuccessful"));
+      setTimeout(() => {
+        onClickLeft();
+      }, 500);
+    },
+    (err) => {
+      return showFailToast(err.message);
     }
-  } else {
-    return showFailToast(
-      proxy.t("inventoryCount.qualityInspectionQuantityCannotBeZero")
-    );
-  }
+  );
 };
 </script>
 <style lang="scss" scoped>