From a76c5c86ac9af71da45bf78c825a2c7aa843b4c8 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期五, 26 一月 2024 15:35:54 +0800
Subject: [PATCH] Revert "Mr.Shi"

---
 platform/src/components/business/selectProductItem.vue |  183 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 183 insertions(+), 0 deletions(-)

diff --git a/platform/src/components/business/selectProductItem.vue b/platform/src/components/business/selectProductItem.vue
new file mode 100644
index 0000000..50edba6
--- /dev/null
+++ b/platform/src/components/business/selectProductItem.vue
@@ -0,0 +1,183 @@
+<template>
+    <GlobalWindow :title="title" width="70%" :visible.sync="visible" :confirm-working="isWorking" @confirm="confirm">
+        <div class="head">
+            <el-form :inline="true" :model="form" class="demo-form-inline">
+                <el-form-item label="鍟嗗搧鍚嶇О" prop="name">
+                    <el-input v-model="form.name" placeholder="璇疯緭鍏ュ晢鍝佸悕绉�"></el-input>
+                </el-form-item>
+                <el-form-item label="绫诲埆" prop="categoryId">
+                    <el-select v-model="form.categoryId" disabled placeholder="璇烽�夋嫨">
+                        <el-option
+                            v-for="item in categoryList"
+                            :key="item.id"
+                            :label="item.name"
+                            :value="item.id">
+                        </el-option>
+                    </el-select>
+                </el-form-item>
+                <el-form-item>
+                    <el-button type="primary" @click="getList">鏌ヨ</el-button>
+                </el-form-item>
+            </el-form>
+        </div>
+        <div class="tab">
+            <el-table
+            :data="tableData"
+            stripe
+            border
+            @selection-change="handleSelectionChange">
+                <el-table-column type="selection" width="55"></el-table-column>
+                <el-table-column prop="id" label="鍟嗗搧ID" min-width="100px"></el-table-column>
+                <el-table-column prop="name" label="鍟嗗搧鍚嶇О/鍨嬪彿" show-overflow-tooltip min-width="200px">
+                    <template slot-scope="{row}">
+                    <div style="display: flex; align-items: center;">
+                        <div style="width: 70px; height: 70px; flex-shrink: 0;">
+                        <el-image
+                            v-if="row.imgurl"
+                            style="width: 70px; height: 70px"
+                            :src="row.fullImgUrl"
+                            fit="cover"></el-image>
+                        </div>
+                        {{ row.name }}
+                    </div>
+                    </template>
+                </el-table-column>
+                <el-table-column prop="brandName" label="鍝佺墝" show-overflow-tooltip min-width="100px"></el-table-column>
+                <el-table-column prop="categoryName" label="绫诲埆" show-overflow-tooltip min-width="100px"></el-table-column>
+                <el-table-column prop="zdPrice" label="鎸囧浠凤紙鍏冿級" show-overflow-tooltip min-width="100px"></el-table-column>
+                <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>
+                    </template>
+                </el-table-column>
+            </el-table>
+            <el-pagination
+                @size-change="handleSizeChange"
+                @current-change="handleCurrentChange"
+                :current-page="page"
+                :page-sizes="[10, 20, 30]"
+                :page-size="pageSize"
+                layout="total, sizes, prev, pager, next, jumper"
+                :total="total">
+            </el-pagination>
+        </div>
+    </GlobalWindow>
+</template>
+    
+<script>
+import BaseOpera from '@/components/base/BaseOpera'
+import GlobalWindow from '@/components/common/GlobalWindow'
+import { baseCategoryList } from '@/api/business/category.js'
+import { pageT } from '@/api/business/goods'
+import { createPlat } from '@/api/business/goods'
+
+export default {
+    name: 'OperaBrandWindow',
+    extends: BaseOpera,
+    components: { GlobalWindow },
+    data() {
+        return {
+            // 琛ㄥ崟鏁版嵁
+            form: {
+                categoryId: '',
+                type: 0,
+                rate: '',
+                name: '',
+                goodsParamList: []
+            },
+            pageSize: 10,
+            page: 1,
+            total: 0,
+            tableData: [],
+            categoryList: []
+        }
+    },
+    created() {
+        this.config({
+            api: '/business/anchor',
+            'field.id': 'id'
+        })
+    },
+    methods: {
+        getList() {
+            pageT({
+                capacity: this.pageSize,
+                model: {
+                    categoryId: this.form.categoryId,
+                    name: this.form.name
+                },
+                page: this.page
+            }).then(res => {
+                res.records.forEach(item => {
+                    item.purchasePrice = item.price * this.form.rate
+                })
+                this.tableData = res.records
+                this.total = res.total
+            })
+        },
+        handleCurrentChange(e) {
+            this.page = e
+            this.getList()
+        },
+        handleSizeChange(e) {
+            this.pageSize = e
+            this.getList()
+        },
+        handleSelectionChange(e) {
+            let arr = []
+            e.forEach(item => {
+                arr.push({ goodsId: item.id, price: item.purchasePrice })
+            })
+            this.form.goodsParamList = arr
+            console.log(arr)
+        },
+        confirm() {
+            // 璋冪敤鏂板缓鎺ュ彛
+            this.isWorking = true
+            createPlat({
+                categoryId: this.form.categoryId,
+                goodsParamList: this.form.goodsParamList,
+                rate: this.form.rate,
+                type: this.form.type
+            }).then(res => {
+                this.visible = false
+                this.$tip.apiSuccess('鎿嶄綔鎴愬姛')
+                // this.$emit('success')
+                this.$emit('result')
+            })
+            .catch(e => {
+                this.$tip.apiFailed(e)
+            })
+            .finally(() => {
+                this.isWorking = false
+            })
+        },
+        /**
+         * 鎵撳紑绐楀彛
+         * @title 绐楀彛鏍囬
+         * @target 缂栬緫鐨勫璞�
+         */
+        open(title, target) {
+            this.title = title
+            this.visible = true
+            this.form.categoryId = target.categoryId
+            this.form.rate = Number(target.rate)
+            this.form.type = target.type
+            // 鑾峰彇鍒嗙被鍒楄〃
+            baseCategoryList({})
+                .then(res => {
+                    this.categoryList = res
+                })
+            this.getList()
+        }
+    }
+}
+</script>
+
+<style lang="scss" scoped>
+    .head {
+        width: 100%;
+
+    }
+</style>
\ No newline at end of file

--
Gitblit v1.9.3