linwenxin 4 ヶ月 前
コミット
46af9ffffc

+ 12 - 1
src/views/mallManagement/purchaseScheduleManagement/mixins/storage_goods.js

@@ -3,7 +3,7 @@ import { getBrandList } from '@/api/miniapp'
 import { getClassifyList } from '@/api/goods'
 import { goodsMaterialList } from '@/api/commercialMaterial.js'
 import { goodsPurchaseItemImportCode, goodsPurchaseDetail } from '@/api/goodsPurchasedStored.js'
-
+import { goodsMaterialDetail } from '@/api/commercialMaterial.js'
 export default {
   data() {
     return {
@@ -473,6 +473,17 @@ export default {
     }
   },
   methods: {
+    // 获取商品详情
+    getGoodsDetl(row, cb, key = 'id') {
+      if (!row?.details?.id) {
+        goodsMaterialDetail({ id: row[key] }).then(res => {
+          Object.assign(row.details, res.data || {})
+          cb(row.details)
+        })
+      } else {
+        cb(row.details)
+      }
+    },
     getBaseList() {
       getBrandList({
         status: true

+ 14 - 0
src/views/mallManagement/purchaseScheduleManagement/purchaseSchedule/index.vue

@@ -131,6 +131,20 @@ export default {
       return []
     }
   },
+  watch: {
+    'formData.items': {
+      handler(newVal, oldVal) {
+        this.formData.totalAmount = newVal
+          .filter(item => item.qty && item.price)
+          .map(item => item.qty * item.price)
+          .reduce((prev, cur, index, arr) => {
+            return prev + cur
+          }, 0)
+          .toFixed(2)
+      },
+      deep: true
+    }
+  },
   methods: {
     tishicuowu: new delayPerform(500).refactor(function (/**可接收参数**/) {
       if (this.logs) {