cz 1 éve
szülő
commit
808c21c00b

+ 20 - 13
src/views/EHSD/productLibrary/companyProduct/index.vue

@@ -60,12 +60,14 @@
         </template>
         <template #price="{ item }">
           <div>
-            <span v-if="item.price">${{ item.price }}</span>
+            <span v-if="item.price">{{ item.currency }} {{ item.price }}</span>
           </div>
         </template>
         <template #costPrice="{ item }">
           <div>
-            <span v-if="item.costPrice">¥{{ item.costPrice }}</span>
+            <span v-if="item.costPrice"
+              >{{ item.costCurrency }} {{ item.costPrice }}</span
+            >
           </div>
         </template>
       </byTable>
@@ -232,6 +234,7 @@ const config = computed(() => {
       attrs: {
         label: "单位",
         prop: "unit",
+        width: 80,
       },
       render(unit) {
         return proxy.dictValueLabel(unit, productUnit.value);
@@ -411,7 +414,7 @@ const formConfig = computed(() => {
     {
       type: "selectInput",
       prop: "costPrice",
-      selectProp: "currencyOne",
+      selectProp: "costCurrency",
       label: "成本价",
       itemWidth: 50,
       style: {
@@ -567,11 +570,11 @@ const openModal = () => {
     fileList: [],
     fileListCopy: [],
     currency: "",
-    currencyOne: "",
+    costCurrency: "",
   };
   if (accountCurrency.value && accountCurrency.value.length > 0) {
-    formData.data.currency = accountCurrency.value[0].label;
-    formData.data.currencyOne = accountCurrency.value[0].label;
+    formData.data.currency = accountCurrency.value[0].value;
+    formData.data.costCurrency = accountCurrency.value[0].value;
   }
   fileList.value = [];
   fileListCopy.value = [];
@@ -591,7 +594,6 @@ const needAtt = [
   "unit",
   "definition",
 ];
-let jsonObj = {};
 const submitForm = () => {
   byform.value.handleSubmit((valid) => {
     // if (!fileListCopy.value.length > 0) {
@@ -600,6 +602,7 @@ const submitForm = () => {
     //     type: "info",
     //   });
     // }
+    let jsonObj = {};
     formData.data.fileList = fileListCopy.value.map((x) => ({
       id: x.id,
       fileName: x.fileName,
@@ -650,11 +653,16 @@ const getDtl = (row) => {
   modalType.value = "edit";
   proxy.post("/productInfo/detailByEhsd", { id: row.id }).then((res) => {
     res.definition = "1"; //产品
+    let jsonObj = JSON.parse(res.ehsdJson);
     res = {
       ...res,
-      currency: "$",
-      currencyOne: "¥",
-      ...JSON.parse(res.ehsdJson),
+      currency: jsonObj.currency
+        ? jsonObj.currency
+        : accountCurrency.value[0].value,
+      costCurrency: jsonObj.costCurrency
+        ? jsonObj.costCurrency
+        : accountCurrency.value[0].value,
+      ...jsonObj,
     };
     if (res.innerPackMethod) {
       res.innerPackMethod = res.innerPackMethod.split(",");
@@ -724,7 +732,6 @@ const handleProgress = () => {
   excelLoading.value = true;
 };
 const handleError = (err) => {
-  console.log(res);
   ElMessage({
     message: `${err},请重试!`,
     type: "info",
@@ -770,8 +777,8 @@ const getDict = () => {
         value: x.dictKey,
       }));
       accountCurrency.value = res["account_currency"].map((x) => ({
-        label: x.dictKey,
-        value: x.dictValue,
+        label: x.dictValue,
+        value: x.dictKey,
       }));
     });
 };

+ 38 - 24
src/views/EHSD/productLibrary/customerProduct/index.vue

@@ -60,12 +60,14 @@
         </template>
         <template #price="{ item }">
           <div>
-            <span v-if="item.price">${{ item.price }}</span>
+            <span v-if="item.price">{{ item.currency }} {{ item.price }}</span>
           </div>
         </template>
         <template #costPrice="{ item }">
           <div>
-            <span v-if="item.costPrice">¥{{ item.costPrice }}</span>
+            <span v-if="item.costPrice"
+              >{{ item.costCurrency }} {{ item.costPrice }}</span
+            >
           </div>
         </template>
       </byTable>
@@ -212,6 +214,14 @@ const config = computed(() => {
   return [
     {
       attrs: {
+        label: "客户名称",
+        prop: "customerName",
+        align: "left",
+        width: 180,
+      },
+    },
+    {
+      attrs: {
         label: "图片",
         slot: "pic",
         align: "center",
@@ -234,6 +244,7 @@ const config = computed(() => {
       attrs: {
         label: "单位",
         prop: "unit",
+        width: 80,
       },
       render(unit) {
         return proxy.dictValueLabel(unit, productUnit.value);
@@ -430,7 +441,7 @@ const formConfig = computed(() => {
     {
       type: "selectInput",
       prop: "costPrice",
-      selectProp: "currencyOne",
+      selectProp: "costCurrency",
       label: "成本价",
       itemWidth: 50,
       style: {
@@ -545,7 +556,6 @@ const getList = async (req) => {
           fileList: [],
           ...JSON.parse(x.ehsdJson),
         }));
-        console.log(message.rows);
         sourceList.value.data = message.rows;
         sourceList.value.pagination.total = message.total;
         setTimeout(() => {
@@ -592,11 +602,11 @@ const openModal = () => {
     fileList: [],
     fileListCopy: [],
     currency: "",
-    currencyOne: "",
+    costCurrency: "",
   };
   if (accountCurrency.value && accountCurrency.value.length > 0) {
-    formData.data.currency = accountCurrency.value[0].label;
-    formData.data.currencyOne = accountCurrency.value[0].label;
+    formData.data.currency = accountCurrency.value[0].value;
+    formData.data.costCurrency = accountCurrency.value[0].value;
   }
   fileList.value = [];
   fileListCopy.value = [];
@@ -680,11 +690,16 @@ const getDtl = (row) => {
   modalType.value = "edit";
   proxy.post("/productInfo/detailByEhsd", { id: row.id }).then((res) => {
     res.definition = "1"; //产品
+    let jsonObj = JSON.parse(res.ehsdJson);
     res = {
       ...res,
-      currency: "$",
-      currencyOne: "¥",
-      ...JSON.parse(res.ehsdJson),
+      currency: jsonObj.currency
+        ? jsonObj.currency
+        : accountCurrency.value[0].value,
+      costCurrency: jsonObj.costCurrency
+        ? jsonObj.costCurrency
+        : accountCurrency.value[0].value,
+      ...jsonObj,
     };
     if (res.innerPackMethod) {
       res.innerPackMethod = res.innerPackMethod.split(",");
@@ -759,7 +774,6 @@ const handleProgress = () => {
 };
 
 const handleError = (err) => {
-  console.log(res);
   ElMessage({
     message: `${err},请重试!`,
     type: "info",
@@ -785,6 +799,17 @@ const handleSuccess = (res) => {
   }
 };
 const getDict = () => {
+  proxy.post("/customer/page", { pageNum: 1, pageSize: 9999 }).then(
+    (res) => {
+      customerData.value = res.rows.map((x) => ({
+        label: x.name,
+        value: x.id,
+      }));
+    },
+    (err) => {
+      console.log(err);
+    }
+  );
   proxy
     .getDictOne([
       "inner_packaging_method_ehsd",
@@ -806,21 +831,10 @@ const getDict = () => {
         value: x.dictKey,
       }));
       accountCurrency.value = res["account_currency"].map((x) => ({
-        label: x.dictKey,
-        value: x.dictValue,
+        label: x.dictValue,
+        value: x.dictKey,
       }));
     });
-  proxy.post("/customer/page", { pageNum: 1, pageSize: 9999 }).then(
-    (res) => {
-      customerData.value = res.rows.map((x) => ({
-        label: x.name,
-        value: x.id,
-      }));
-    },
-    (err) => {
-      console.log(err);
-    }
-  );
 };
 getDict();
 getTreeList();