Explorar el Código

Merge branch 'dev' of http://git.izouma.com/xiongzhu/raex_back into dev

wangqifan hace 3 años
padre
commit
28dbb639ff
Se han modificado 1 ficheros con 113 adiciones y 1 borrados
  1. 113 1
      src/main/vue/src/views/SysConfigList.vue

+ 113 - 1
src/main/vue/src/views/SysConfigList.vue

@@ -145,6 +145,46 @@
                 <el-button @click="savePayConfig" size="mini" type="primary" :loading="saving">保存</el-button>
                 <el-button @click="savePayConfig" size="mini" type="primary" :loading="saving">保存</el-button>
             </div>
             </div>
         </el-dialog>
         </el-dialog>
+
+        <el-dialog title="藏品选项" :visible.sync="showPriceConfigDialog" width="550px">
+            <div class="pay-config-item-list">
+                <div class="pay-config-item head">
+                    <div class="key">KEY</div>
+                    <div class="minPrice">最小值</div>
+                    <div class="maxPrice">最大值</div>
+                    <div class="del"></div>
+                </div>
+                <div class="pay-config-item" v-for="(item, index) in collectConfig" :key="index">
+                    <div class="key">
+                        <el-input v-model="item.key" size="mini"></el-input>
+                    </div>
+                    <div class="minPrice">
+                        <el-input-number
+                            v-model="item.minPrice"
+                            size="mini"
+                            :min="0"
+                            :max="item.maxPrice"
+                        ></el-input-number>
+                    </div>
+                    <div class="maxPrice">
+                        <el-input-number v-model="item.maxPrice" size="mini" :min="item.minPrice"></el-input-number>
+                    </div>
+                    <div class="del">
+                        <el-button
+                            type="danger"
+                            icon="el-icon-delete"
+                            circle
+                            @click="delCollectConfig(index)"
+                        ></el-button>
+                    </div>
+                </div>
+            </div>
+            <el-button @click="addCollectConfig" size="mini">添加 </el-button>
+            <div slot="footer">
+                <el-button @click="showPriceConfigDialog = false" size="mini">取消</el-button>
+                <el-button @click="saveCollectConfig" size="mini" type="primary" :loading="saving">保存</el-button>
+            </div>
+        </el-dialog>
     </div>
     </div>
 </template>
 </template>
 <script>
 <script>
@@ -212,7 +252,9 @@ export default {
             ],
             ],
             htmlContents: [''],
             htmlContents: [''],
             showPayConfigDialog: false,
             showPayConfigDialog: false,
-            payConfig: []
+            showPriceConfigDialog: false,
+            payConfig: [],
+            collectConfig: []
         };
         };
     },
     },
     computed: {
     computed: {
@@ -256,6 +298,21 @@ export default {
                 this.showPayConfigDialog = true;
                 this.showPayConfigDialog = true;
                 return;
                 return;
             }
             }
+            if (row && row.name === 'collection_price') {
+                if (row.value) {
+                    let info = JSON.parse(row.value);
+                    this.collectConfig = Object.keys(info).map(item => {
+                        console.log(info[item]);
+                        return {
+                            key: item,
+                            ...info[item]
+                        };
+                    });
+                }
+                this.formData = { ...row };
+                this.showPriceConfigDialog = true;
+                return;
+            }
             this.edit = edit;
             this.edit = edit;
             if (!row) {
             if (!row) {
                 row = {
                 row = {
@@ -348,6 +405,50 @@ export default {
                     this.$message.error(e.error);
                     this.$message.error(e.error);
                 });
                 });
         },
         },
+        addCollectConfig() {
+            this.collectConfig.push({
+                key: '',
+                minPrice: '',
+                maxPrice: ''
+            });
+        },
+        delCollectConfig(index) {
+            this.$confirm('确认要删除这个藏品吗?', '提示', {
+                confirmButtonText: '确定',
+                cancelButtonText: '取消'
+            }).then(() => {
+                let collectConfig = [...this.collectConfig];
+                collectConfig.splice(index, 1);
+                this.collectConfig = collectConfig;
+            });
+        },
+        saveCollectConfig() {
+            let info = {};
+            [...this.collectConfig].forEach(item => {
+                if (item.key) {
+                    info[item.key] = {
+                        minPrice: item.minPrice,
+                        maxPrice: item.maxPrice
+                    };
+                }
+            });
+            let data = { ...this.formData, value: JSON.stringify(info) };
+            this.saving = true;
+            this.$http
+                .post('/sysConfig/save', data, { body: 'json' })
+                .then(res => {
+                    this.saving = false;
+                    this.$message.success('成功');
+                    this.showPriceConfigDialog = false;
+                    this.getData();
+                })
+                .catch(e => {
+                    console.log(e);
+                    this.saving = false;
+                    this.showPriceConfigDialog = false;
+                    this.$message.error(e.error);
+                });
+        },
         addIcon(item) {
         addIcon(item) {
             const input = document.createElement('input');
             const input = document.createElement('input');
             input.type = 'file';
             input.type = 'file';
@@ -389,6 +490,14 @@ export default {
             margin-left: 10px;
             margin-left: 10px;
             text-align: center;
             text-align: center;
         }
         }
+        .minPrice {
+            width: 130px;
+            margin-left: 20px;
+        }
+        .maxPrice {
+            width: 130px;
+            margin-left: 20px;
+        }
         .enabled {
         .enabled {
             width: 50px;
             width: 50px;
             margin-left: 10px;
             margin-left: 10px;
@@ -402,6 +511,9 @@ export default {
                 width: 60px;
                 width: 60px;
             }
             }
         }
         }
+        .del {
+            margin-left: 20px;
+        }
         &.head {
         &.head {
             .icon {
             .icon {
                 font-size: 14px;
                 font-size: 14px;