xiongzhu 4 лет назад
Родитель
Сommit
799b08fc93

+ 2 - 2
src/main/java/com/izouma/nineth/web/OrderPayController.java

@@ -31,7 +31,7 @@ public class OrderPayController {
     @RequestMapping(value = "/weixin_h5")
     public String payOrderWeixinH5(Long id, Model model, @RequestHeader(value = "User-Agent") String userAgent) throws EncoderException, WxPayException {
         detectUA(userAgent, model);
-        model.addAttribute("payUrl", orderService.payOrderWeixin(id, WxPayConstants.TradeType.JSAPI, null));
+        model.addAttribute("payUrl", orderService.payOrderWeixin(id, WxPayConstants.TradeType.MWEB, null));
         return "WeixinPayHtml";
     }
 
@@ -51,7 +51,7 @@ public class OrderPayController {
     @RequestMapping(value = "/gift/weixin_h5")
     public String payGiftOrderWeixinH5(Long id, Model model, @RequestHeader(value = "User-Agent") String userAgent) throws EncoderException, WxPayException {
         detectUA(userAgent, model);
-        model.addAttribute("payUrl", assetService.payOrderWeixin(id, WxPayConstants.TradeType.JSAPI, null));
+        model.addAttribute("payUrl", assetService.payOrderWeixin(id, WxPayConstants.TradeType.MWEB, null));
         return "WeixinPayHtml";
     }
 

+ 56 - 0
src/main/vue/src/components/CollectionSearch.vue

@@ -0,0 +1,56 @@
+<template>
+    <el-select v-model="collectionId" filterable :filter-method="filterCollection">
+        <el-option v-for="item in filterOptions" :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',
+                {
+                    size: 10000,
+                    sort: 'sort,desc;createdAt,desc',
+                    query: { del: false, source: 'OFFICIAL' }
+                },
+                { body: 'json' }
+            )
+            .then(res => {
+                this.filterOptions = this.options = res.content;
+            });
+    },
+    data() {
+        return {
+            options: [],
+            filterOptions: [],
+            collectionId: null,
+            selected: null
+        };
+    },
+    methods: {
+        filterCollection(val) {
+            this.filterOptions = this.options.filter(i => i.name.includes(val) || i.id == val);
+        }
+    },
+    watch: {
+        collectionId(val) {
+            this.$emit('input', val);
+            if (val) {
+                this.selected = this.options.find(i => i.id === val);
+            }
+            setTimeout(() => {
+                this.filterOptions = [...this.options];
+            }, 200);
+        },
+        value(val) {
+            this.collectionId = val;
+        }
+    }
+};
+</script>

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

@@ -17,6 +17,7 @@ import Formatters from '@/mixins/formatters';
 import PageTitle from '@/components/PageTitle';
 import MinterSelect from '@/components/MinterSelect';
 import ObjectUpload from '@/components/ObjectUpload';
+import CollectionSearch from '@/components/CollectionSearch';
 
 import 'normalize.css/normalize.css';
 import './styles/element_theme/index.css';
@@ -58,6 +59,7 @@ Vue.component('district-choose', DistrictChoose);
 Vue.component('page-title', PageTitle);
 Vue.component('minter-select', MinterSelect);
 Vue.component('object-upload', ObjectUpload);
+Vue.component('collection-search', CollectionSearch);
 Vue.mixin(Formatters);
 Vue.prototype.$theme = theme;
 console.log(theme);

+ 0 - 18
src/main/vue/src/router.js

@@ -317,24 +317,6 @@ const router = new Router({
                         title: '特权配置'
                     }
                 },
-                {
-                    path: '/privilegeOptionEdit',
-                    name: 'PrivilegeOptionEdit',
-                    component: () =>
-                        import(/* webpackChunkName: "privilegeOptionEdit" */ '@/views/PrivilegeOptionEdit.vue'),
-                    meta: {
-                        title: '特权配置编辑'
-                    }
-                },
-                {
-                    path: '/privilegeOptionList',
-                    name: 'PrivilegeOptionList',
-                    component: () =>
-                        import(/* webpackChunkName: "privilegeOptionList" */ '@/views/PrivilegeOptionList.vue'),
-                    meta: {
-                        title: '特权配置'
-                    }
-                },
                 {
                     path: '/airDropEdit',
                     name: 'AirDropEdit',

+ 5 - 33
src/main/vue/src/views/CouponEdit.vue

@@ -35,9 +35,9 @@
                             <el-table-column prop="name" label="名称"></el-table-column>
                             <el-table-column width="80" align="center">
                                 <template v-slot="{ row, $index }">
-                                    <el-button type="danger" plain @click="delCollection($index)" size="mini"
-                                        >删除</el-button
-                                    >
+                                    <el-button type="danger" plain @click="delCollection($index)" size="mini">
+                                        删除
+                                    </el-button>
                                 </template>
                             </el-table-column>
                         </el-table>
@@ -64,17 +64,7 @@
             <el-dialog title="添加藏品" :visible.sync="showCollectionDialog" width="500px">
                 <el-form :model="{ collectionId }" ref="collectionForm" inline>
                     <el-form-item prop="collectionId" :rules="{ required: true, message: '请选择藏品' }">
-                        <el-select v-model="collectionId" filterable :filter-method="filterCollection">
-                            <el-option
-                                v-for="item in collectionOptions"
-                                :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>
+                        <collection-search ref="collectionSearch" v-model="collectionId"> </collection-search>
                     </el-form-item>
                 </el-form>
                 <div slot="footer">
@@ -100,19 +90,6 @@ export default {
                     this.$message.error(e.error);
                 });
         }
-        this.$http
-            .post(
-                '/collection/all',
-                {
-                    size: 10000,
-                    sort: 'sort,desc;createdAt,desc',
-                    query: { del: false, source: 'OFFICIAL' }
-                },
-                { body: 'json' }
-            )
-            .then(res => {
-                this.collectionOptions = res.content;
-            });
     },
     data() {
         return {
@@ -163,7 +140,6 @@ export default {
                     }
                 ]
             },
-            collectionOptions: [],
             collections: [],
             showCollectionDialog: false,
             collectionId: null
@@ -229,17 +205,13 @@ export default {
                 .validate()
                 .then(() => {
                     if (!this.collections.find(i => i.id === this.collectionId)) {
-                        this.collections.push(this.collectionOptions.find(i => i.id === this.collectionId));
+                        this.collections.push(this.$refs.collectionSearch.selected);
                         this.showCollectionDialog = false;
                     } else {
                         this.$message.error('请勿重复添加');
                     }
                 })
                 .catch(() => {});
-        },
-        filterCollection(val) {
-            console.log(val);
-            return this.collectionOptions.filter(i => i.name.includes(val) || i.id == val);
         }
     }
 };