002201 il y a 2 ans
Parent
commit
2e61da2c3f

+ 8 - 0
src/api/business/purchase/catalogue.js

@@ -40,6 +40,14 @@ export function ENABLE(data) {
   });
 }
 
+export function EXIST(data) {
+  return request({
+    url: "/pu/price/catalogue/priceIsExist",
+    method: "POST",
+    data: data,
+  });
+}
+
 export function EXPORT(data) {
   return request({
     url: "/pu/price/catalogue/export",

+ 13 - 3
src/views/purchase/apply/add/column.js

@@ -278,12 +278,18 @@ export const TabColumns = [
         title: "价格有效期(起)",
         inputType: "DatePicker",
         valueFormat: "yyyy-MM-dd",
+        value: new Date(),
       },
       {
         key: "periodEnd",
         title: "价格有效期(止)",
         inputType: "DatePicker",
         valueFormat: "yyyy-MM-dd",
+        pickerOptions: {
+          disabledDate(time) {
+            return time.getTime() < Date.now() + 3600 * 1000 * 24 * 365;
+          },
+        },
       },
       {
         title: "客户名称",
@@ -301,18 +307,22 @@ export const TabColumns = [
         key: "customer",
       },
       {
+        title: "最近价格",
+        key: "recentlyPrice",
+      },
+      {
         title: "首次报批",
         key: "isApprovalFirst",
         width: 200,
         inputType: "Select",
-        referName: "sys_yes_no",
+        referName: "is_effective",
       },
       {
         title: "价格调整",
         key: "isPriceAdjustment",
         width: 200,
         inputType: "Select",
-        referName: "sys_yes_no",
+        referName: "is_effective",
       },
       {
         key: "priceType",
@@ -325,7 +335,7 @@ export const TabColumns = [
         key: "isDistributionPrice",
         width: 200,
         inputType: "Select",
-        referName: "sys_yes_no",
+        referName: "is_effective",
       },
       {
         title: "创建人名称",

+ 7 - 1
src/views/purchase/apply/add/index.vue

@@ -16,7 +16,12 @@ export default {
     };
   },
   computed: {},
-  watch: {},
+  watch: {
+    "params.priceApplyItems": {
+      handler: function () {},
+      deep: true,
+    },
+  },
   methods: {
     //
     async fetchRefer(prop, type, source) {
@@ -245,6 +250,7 @@ export default {
                   <el-table-column fixed="right" label="操作" width="100">
                     <template slot="header" slot-scope="scope">
                       <el-button
+                        v-if="params.puOrg && params.supplier"
                         circle
                         icon="el-icon-plus"
                         :size="size"

+ 20 - 0
src/views/purchase/apply/hooks/function.js

@@ -1,4 +1,5 @@
 import { REFER } from "@/components/popover-select/api";
+import { EXIST } from "@/api/business/purchase/catalogue";
 import { SAVE, ITEM } from "@/api/business/purchase/apply";
 
 export default function useMethods() {
@@ -24,6 +25,7 @@ export default function useMethods() {
       try {
         // try
         _this.loading = true;
+        // task 1
         const { code, rows } = await REFER({
           search: rateCode,
           type: "TAX_RATE_PARAM",
@@ -32,6 +34,24 @@ export default function useMethods() {
           const [{ ntaxrate }] = rows;
           source.tax = ntaxrate === "0E-8" ? "0.00000000" : ntaxrate;
         }
+        // task 2
+        const { materialCode } = source;
+        const { puOrg, customer, supplier } = _this.params;
+        const {
+          code: code2,
+          data: { recentlyPrice, isApprovalFirst, isPriceAdjustment },
+        } = await EXIST({
+          puOrg,
+          customer,
+          supplier,
+          materialCode,
+        });
+        if (code2 === 200) {
+          source.recentlyPrice = recentlyPrice;
+          source.isApprovalFirst = isApprovalFirst;
+          source.isPriceAdjustment = isPriceAdjustment;
+// _this.$u
+        }
       } catch (err) {
         // catch
         console.error(err);