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/selectProduct.vue |  119 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 119 insertions(+), 0 deletions(-)

diff --git a/platform/src/components/business/selectProduct.vue b/platform/src/components/business/selectProduct.vue
new file mode 100644
index 0000000..d3702aa
--- /dev/null
+++ b/platform/src/components/business/selectProduct.vue
@@ -0,0 +1,119 @@
+<template>
+    <GlobalWindow :title="title" :visible.sync="visible" :confirm-working="isWorking" @confirm="confirm">
+      <el-form :model="form" ref="form" :rules="rules">
+        <el-form-item label="鍟嗗搧绫诲埆" prop="categoryId">
+            <el-select v-model="form.categoryId" 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 label="鍟嗗搧鑼冨洿" prop="type">
+            <el-radio-group v-model="form.type">
+                <el-radio :label="0">鍏ㄩ儴</el-radio>
+                <el-radio :label="1">閮ㄥ垎</el-radio>
+            </el-radio-group>
+        </el-form-item>
+        <el-form-item label="鍔犱环绯绘暟" prop="rate">
+          <el-input v-model="form.rate" placeholder="骞冲彴閲囪喘浠�*鍔犱环绯绘暟锛屼綔涓哄弬鑰冨嚭鎵嬩环锛屽缓璁緭鍏ュぇ浜�1鐨勬暟瀛�" v-trim />
+        </el-form-item>
+      </el-form>
+      <!-- 閫夋嫨骞冲彴鍟嗗搧 -->
+      <selectProductItem ref="selectProductItem" @result="result" />
+    </GlobalWindow>
+  </template>
+    
+  <script>
+  import BaseOpera from '@/components/base/BaseOpera'
+  import GlobalWindow from '@/components/common/GlobalWindow'
+  import selectProductItem from '@/components/business/selectProductItem'
+  import { baseCategoryList } from '@/api/business/category.js'
+  import { createPlat } from '@/api/business/goods'
+
+  export default {
+    name: 'OperaBrandWindow',
+    extends: BaseOpera,
+    components: { GlobalWindow, selectProductItem },
+    data() {
+      return {
+        categoryList: [],
+        // 琛ㄥ崟鏁版嵁
+        form: {
+          categoryId: '',
+          type: 0,
+          rate: ''
+        },
+        // 楠岃瘉瑙勫垯
+        rules: {
+            categoryId: [
+            { required: true, message: '鍟嗗搧绫诲埆涓嶈兘涓虹┖', trigger: 'blur' }
+          ],
+          type: [
+            { required: true, message: '鍟嗗搧鑼冨洿涓嶈兘涓虹┖', trigger: 'blur' }
+          ],
+          rate: [
+            { required: true, message: '鍔犱环绯绘暟涓嶈兘涓虹┖', trigger: 'blur' }
+          ]
+        }
+      }
+    },
+    created() {
+      this.config({
+        api: '/business/goods',
+        'field.id': 'id'
+      })
+    },
+    methods: {
+        result() {
+          // this.$emit('success')
+          this.$emit('result')
+          this.visible = false
+        },
+        confirm() {
+            this.$refs.form.validate((valid) => {
+                if (!valid) return
+                // 鏂板缓
+                if (this.form.type == 0) {
+                    this.isWorking = true
+                    createPlat({
+                        categoryId: this.form.categoryId,
+                        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
+                    })
+                } else {
+                    this.$refs.selectProductItem.open('閫夋嫨骞冲彴鍟嗗搧', this.form)
+                }
+            })
+        },
+        /**
+         * 鎵撳紑绐楀彛
+         * @title 绐楀彛鏍囬
+         * @target 缂栬緫鐨勫璞�
+         */
+        open (title, target) {
+            this.title = title
+            this.visible = true
+            // 鑾峰彇鍒嗙被鍒楄〃
+            baseCategoryList({ type: 1 })
+              .then(res => {
+                this.categoryList = res
+              })
+        }
+    }
+  }
+  </script>
+    
\ No newline at end of file

--
Gitblit v1.9.3