From 2be17adffb5e055ed563ba73c928a5842c45a81e Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期四, 21 九月 2023 14:04:37 +0800
Subject: [PATCH] 属性对比

---
 company_admin/src/components/business/selectProductItem.vue |   36 ++++++++++++++++++++++++++++++------
 1 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/company_admin/src/components/business/selectProductItem.vue b/company_admin/src/components/business/selectProductItem.vue
index 50edba6..39acc7d 100644
--- a/company_admin/src/components/business/selectProductItem.vue
+++ b/company_admin/src/components/business/selectProductItem.vue
@@ -48,7 +48,7 @@
                 <el-table-column prop="price" label="閲囪喘浠凤紙鍏冿級" show-overflow-tooltip min-width="100px"></el-table-column>
                 <el-table-column label="鍏ユ墜浠凤紙鍏冿級" show-overflow-tooltip min-width="100px">
                     <template slot-scope="{row}">
-                        <el-input v-model="row.purchasePrice" placeholder="璇疯緭鍏�"></el-input>
+                        <el-input v-model="row.purchasePrice" @input="changeVal(row)" placeholder="璇疯緭鍏�"></el-input>
                     </template>
                 </el-table-column>
             </el-table>
@@ -81,6 +81,7 @@
             // 琛ㄥ崟鏁版嵁
             form: {
                 categoryId: '',
+                categoryId1: '',
                 type: 0,
                 rate: '',
                 name: '',
@@ -100,6 +101,13 @@
         })
     },
     methods: {
+        changeVal(row) {
+            var zz2 = new RegExp("^[0-9]*[1-9][0-9]*$");
+            if (!zz2.test(row.purchasePrice)) {
+                row.purchasePrice = ''
+                this.$message.warning({ message: '鍙兘杈撳叆鏁存暟' })
+            }
+        },
         getList() {
             pageT({
                 capacity: this.pageSize,
@@ -110,7 +118,7 @@
                 page: this.page
             }).then(res => {
                 res.records.forEach(item => {
-                    item.purchasePrice = item.price * this.form.rate
+                    item.purchasePrice = Math.ceil(item.price * this.form.rate)
                 })
                 this.tableData = res.records
                 this.total = res.total
@@ -127,17 +135,32 @@
         handleSelectionChange(e) {
             let arr = []
             e.forEach(item => {
-                arr.push({ goodsId: item.id, price: item.purchasePrice })
+                arr.push({ id: item.id })
             })
+            // e.forEach(item => {
+            //     arr.push({ goodsId: item.id, price: item.purchasePrice })
+            // })
             this.form.goodsParamList = arr
             console.log(arr)
         },
         confirm() {
+            if (this.form.goodsParamList.length === 0) {
+                this.$message.warning({ message: '璇峰厛鍕鹃�夊晢鍝�' })
+                return
+            }
+            let goodsParamList = []
+            this.form.goodsParamList.forEach(item => {
+                this.tableData.forEach(child => {
+                    if (item.id === child.id) {
+                        goodsParamList.push({ goodsId: child.id, price: child.purchasePrice })
+                    }
+                })
+            })
             // 璋冪敤鏂板缓鎺ュ彛
             this.isWorking = true
             createPlat({
-                categoryId: this.form.categoryId,
-                goodsParamList: this.form.goodsParamList,
+                categoryId: this.form.categoryId1,
+                goodsParamList,
                 rate: this.form.rate,
                 type: this.form.type
             }).then(res => {
@@ -161,7 +184,8 @@
         open(title, target) {
             this.title = title
             this.visible = true
-            this.form.categoryId = target.categoryId
+            this.form.categoryId = Number(target.categoryId.split(',')[0])
+            this.form.categoryId1 = Number(target.categoryId.split(',')[1])
             this.form.rate = Number(target.rate)
             this.form.type = target.type
             // 鑾峰彇鍒嗙被鍒楄〃

--
Gitblit v1.9.3