瀏覽代碼

选择兑换券

licailing 3 年之前
父節點
當前提交
be8d16137e

+ 65 - 0
src/main/vue/src/components/CollectionCoupon.vue

@@ -0,0 +1,65 @@
+<template>
+    <el-select v-model="collectionId" filterable remote :remote-method="search" :loading="loading">
+        <el-option v-for="item in options" :label="item.name" :value="item.id" :key="item.id">
+            <span style="float: left">{{ item.name }}</span>
+            <span style="float: right; color: #8492a6; font-size: 13px">#{{ item.id }}</span>
+        </el-option>
+    </el-select>
+</template>
+<script>
+export default {
+    props: ['value'],
+    created() {
+        this.collectionId = this.value;
+        this.$http
+            .post(
+                '/collection/all',
+                {
+                    sort: 'sort,desc;createdAt,desc',
+                    query: { del: false, source: 'OFFICIAL', type: 'all', couponPayment: true }
+                },
+                { body: 'json' }
+            )
+            .then(res => {
+                this.options = res.content;
+            });
+    },
+    data() {
+        return {
+            options: [],
+            collectionId: null,
+            selected: null,
+            loading: false
+        };
+    },
+    methods: {
+        search(query) {
+            this.$http
+                .post(
+                    '/collection/all',
+                    {
+                        sort: 'sort,desc;createdAt,desc',
+                        search: query,
+                        query: { del: false, source: 'OFFICIAL', type: 'all', couponPayment: true }
+                    },
+                    { body: 'json' }
+                )
+                .then(res => {
+                    this.options = res.content;
+                });
+        }
+    },
+    watch: {
+        collectionId(val) {
+            this.$emit('input', val);
+            if (val) {
+                this.selected = this.options.find(i => i.id === val);
+                this.$emit('select', this.selected);
+            }
+        },
+        value(val) {
+            this.collectionId = val;
+        }
+    }
+};
+</script>

+ 2 - 0
src/main/vue/src/main.js

@@ -19,6 +19,7 @@ import MinterSelect from '@/components/MinterSelect';
 import MinterFilter from '@/components/MinterFilter';
 import ObjectUpload from '@/components/ObjectUpload';
 import CollectionSearch from '@/components/CollectionSearch';
+import CollectionCoupon from '@/components/CollectionCoupon';
 import CreatedAtPicker from '@/components/CreatedAtPicker';
 
 import 'normalize.css/normalize.css';
@@ -63,6 +64,7 @@ Vue.component('minter-select', MinterSelect);
 Vue.component('minter-filter', MinterFilter);
 Vue.component('object-upload', ObjectUpload);
 Vue.component('collection-search', CollectionSearch);
+Vue.component('collection-coupon', CollectionCoupon);
 Vue.component('created-at-picker', CreatedAtPicker);
 Vue.mixin(Formatters);
 Vue.prototype.$theme = theme;

+ 1 - 1
src/main/vue/src/views/BlindBoxEdit.vue

@@ -199,7 +199,7 @@
                     </el-form-item>
                     <el-form-item prop="couponPayment" label="支付方式">
                         <el-radio-group v-model="formData.couponPayment">
-                            <el-radio :label="true">优惠券</el-radio>
+                            <el-radio :label="true">兑换券</el-radio>
                             <el-radio :label="false">支付宝/微信</el-radio>
                         </el-radio-group>
                     </el-form-item>

+ 1 - 1
src/main/vue/src/views/CollectionEdit.vue

@@ -224,7 +224,7 @@
                     </el-form-item> -->
                     <el-form-item prop="couponPayment" label="支付方式">
                         <el-radio-group v-model="formData.couponPayment">
-                            <el-radio :label="true">优惠券</el-radio>
+                            <el-radio :label="true">兑换券</el-radio>
                             <el-radio :label="false">支付宝/微信</el-radio>
                         </el-radio-group>
                     </el-form-item>

+ 3 - 2
src/main/vue/src/views/CouponEdit.vue

@@ -61,10 +61,11 @@
                     </el-form-item>
                 </el-form>
             </div>
-            <el-dialog title="添加藏品" :visible.sync="showCollectionDialog" width="500px">
+            <el-dialog title="添加藏品(盲盒)" :visible.sync="showCollectionDialog" width="500px">
+                <div style="margin-bottom: 10px">如果找到没有藏品(盲盒),请先查看藏品(盲盒)支付方式是否为“兑换券”</div>
                 <el-form :model="{ collectionId }" ref="collectionForm" inline>
                     <el-form-item prop="collectionId" :rules="{ required: true, message: '请选择藏品' }">
-                        <collection-search ref="collectionSearch" v-model="collectionId" style="width: 300px"> </collection-search>
+                        <collection-coupon ref="collectionSearch" v-model="collectionId" style="width: 350px"> </collection-coupon>
                     </el-form-item>
                 </el-form>
                 <div slot="footer">