Browse Source

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

yuanyuan 3 years ago
parent
commit
5e09e998ab

+ 1 - 1
src/views/Submit.vue

@@ -726,4 +726,4 @@ export default {
 :deep(.van-password-input__item) {
 :deep(.van-password-input__item) {
     background: @bg3;
     background: @bg3;
 }
 }
-</style>
+</style>

+ 147 - 8
src/views/activity/ChooseProduct.vue

@@ -33,9 +33,9 @@
                 <div
                 <div
                     class="product"
                     class="product"
                     :class="{ active: chooseIds.includes(item.id) }"
                     :class="{ active: chooseIds.includes(item.id) }"
-                    v-for="item in list"
+                    v-for="item in collections"
                     :key="item.id"
                     :key="item.id"
-                    @click="choose(item.id)"
+                    @click="choose(item.id, item)"
                 >
                 >
                     <img
                     <img
                         class="icon"
                         class="icon"
@@ -61,6 +61,17 @@
                             <div class="text2" v-if="item.number">编号:{{ item.number }}</div>
                             <div class="text2" v-if="item.number">编号:{{ item.number }}</div>
                         </div>
                         </div>
                     </div>
                     </div>
+                    <div class="num-right" @click.stop="" v-if="item.collections">
+                        <van-stepper
+                            v-model="item.num"
+                            :name="item.id"
+                            :min="0"
+                            :max="item.collections.length"
+                            @change="changeStepper"
+                            size="mini"
+                        />
+                        <div class="num-text">共{{ item.collections.length }}个</div>
+                    </div>
                 </div>
                 </div>
             </div>
             </div>
         </van-pull-refresh>
         </van-pull-refresh>
@@ -88,15 +99,80 @@ export default {
             search: '',
             search: '',
             activityId: 0,
             activityId: 0,
             info: {},
             info: {},
-            refreshing: false
+            refreshing: false,
+            nots: [],
+            collections: []
         };
         };
     },
     },
+    watch: {
+        showList() {
+            let list = [...this.showList];
+            this.collections = list.map(item => {
+                return {
+                    ...item,
+                    num: 0
+                };
+            });
+        }
+    },
     computed: {
     computed: {
         canNext() {
         canNext() {
             return this.needChoose === 0 || this.chooseIds.length === this.needChoose;
             return this.needChoose === 0 || this.chooseIds.length === this.needChoose;
         },
         },
+        needNum() {
+            if (this.needChoose > 0) {
+                return this.needChoose - this.chooseIds.length;
+            } else {
+                return 0;
+            }
+        },
         showTips() {
         showTips() {
             return this.list.length < this.needChoose && !this.empty;
             return this.list.length < this.needChoose && !this.empty;
+        },
+        showList() {
+            let list = [...this.list];
+            let nots = [...this.nots];
+            let _map = new Map();
+            console.log(list);
+            list.forEach(item => {
+                let flag = true;
+                nots.forEach(_not => {
+                    if (item.name.indexOf(_not) !== -1) {
+                        flag = false;
+                    }
+                });
+                if (flag) {
+                    _map.set(item.id, item);
+                } else {
+                    if (_map.has(item.prefixName)) {
+                        let info = _map.get(item.prefixName);
+                        info.collections.push(item.id);
+                        _map.set(item.prefixName, info);
+                    } else {
+                        _map.set(item.prefixName, {
+                            ...item,
+                            collections: [item.id]
+                        });
+                    }
+                }
+            });
+            console.log(_map);
+
+            return [..._map.values()];
+        },
+        numList() {
+            let chooseIds = [...this.chooseIds];
+            let collections = [...this.collections];
+            let nums = [];
+            chooseIds.forEach(item => {
+                let info = collections.find(coll => {
+                    return coll.id === item;
+                });
+                if (info) {
+                    nums.push(`${info.id}_${info.num || 1}`);
+                }
+            });
+            return nums;
         }
         }
     },
     },
     mounted() {
     mounted() {
@@ -110,6 +186,9 @@ export default {
 
 
         if (this.$route.query.activityId) {
         if (this.$route.query.activityId) {
             this.activityId = this.$route.query.activityId;
             this.activityId = this.$route.query.activityId;
+            this.$http.get('/sysConfig/get/xingtu_not').then(res => {
+                this.nots = res.value.split(',');
+            });
             this.$http.get('/mintActivity/get/' + this.$route.query.activityId).then(res => {
             this.$http.get('/mintActivity/get/' + this.$route.query.activityId).then(res => {
                 this.needChoose = res.num;
                 this.needChoose = res.num;
                 this.search = res.collectionName;
                 this.search = res.collectionName;
@@ -121,6 +200,46 @@ export default {
         }
         }
     },
     },
     methods: {
     methods: {
+        changeStepper(value, detail) {
+            console.log(value);
+            let collectIndex = [...this.collections].findIndex(item => {
+                return detail.name === item.id;
+            });
+            let collection = [...this.collections][collectIndex];
+            let collections = collection.collections;
+            let _collections = collections.filter(item => {
+                return [...this.chooseIds].includes(item);
+            });
+            let chooseIds = [...this.chooseIds];
+            let choose = chooseIds.filter(item => {
+                return collections.includes(item);
+            });
+            let index = chooseIds.indexOf(detail.name);
+            if (value > choose.length && this.chooseIds.length === this.needChoose && this.needChoose !== 0) {
+                this.$toast(`只能选择${this.needChoose}个藏品`);
+                this.$nextTick(() => {
+                    this.collections[collectIndex] = {
+                        ...collection,
+                        num: _collections.length
+                    };
+                });
+            } else if (value + (this.chooseIds.length - choose.length) > this.needChoose) {
+                this.$nextTick(() => {
+                    this.collections[collectIndex] = {
+                        ...collection,
+                        num: this.needChoose - this.chooseIds.length + choose.length
+                    };
+                });
+            } else {
+                // value = this.needChoose - this.chooseIds.length;
+                chooseIds.splice(index, _collections.length);
+                chooseIds = [...chooseIds, ...collections.slice(0, value)];
+            }
+            this.chooseIds = chooseIds;
+        },
+        getMax(max) {
+            return max;
+        },
         getList(refresh, done) {
         getList(refresh, done) {
             this.$http
             this.$http
                 .get('/asset/assetsForMint', {
                 .get('/asset/assetsForMint', {
@@ -139,13 +258,23 @@ export default {
                     done && done();
                     done && done();
                 });
                 });
         },
         },
-        choose(id) {
+        choose(id, info) {
             let chooseIds = [...this.chooseIds];
             let chooseIds = [...this.chooseIds];
             if (chooseIds.includes(id)) {
             if (chooseIds.includes(id)) {
                 let index = chooseIds.indexOf(id);
                 let index = chooseIds.indexOf(id);
-                chooseIds.splice(index, 1);
-            } else if (this.chooseIds.length < this.needChoose || this.needChoose === 0) {
-                chooseIds.push(id);
+                if (info.collections) {
+                    chooseIds.splice(index, info.num);
+                    info.num = 0;
+                } else {
+                    chooseIds.splice(index, 1);
+                }
+            } else if (this.needNum > 0 || this.needChoose === 0) {
+                if (info.collections) {
+                    info.num = this.needNum;
+                    chooseIds = [...chooseIds, ...info.collections.slice(0, info.num)];
+                } else {
+                    chooseIds.push(id);
+                }
             } else if (this.chooseIds.length == this.needChoose) {
             } else if (this.chooseIds.length == this.needChoose) {
                 this.$toast(`只能选择${this.needChoose}个藏品`);
                 this.$toast(`只能选择${this.needChoose}个藏品`);
             }
             }
@@ -182,7 +311,8 @@ export default {
                     path: '/activitySubmit',
                     path: '/activitySubmit',
                     query: {
                     query: {
                         assets: this.chooseIds.join(','),
                         assets: this.chooseIds.join(','),
-                        activityId: this.activityId
+                        activityId: this.activityId,
+                        numList: this.numList.join(',')
                     }
                     }
                 });
                 });
             });
             });
@@ -313,4 +443,13 @@ export default {
     font-size: 12px;
     font-size: 12px;
     padding: 10px;
     padding: 10px;
 }
 }
+.num-right {
+    .flex-col();
+    align-items: center;
+    .num-text {
+        font-size: 10px;
+        color: @text3;
+        margin-top: 6px;
+    }
+}
 </style>
 </style>

+ 24 - 3
src/views/activity/Submit.vue

@@ -30,6 +30,7 @@
                     <div class="text2" v-if="item.category">类型:{{ item.category }}</div>
                     <div class="text2" v-if="item.category">类型:{{ item.category }}</div>
                     <div class="text2" v-if="item.number">编号:{{ item.number }}</div>
                     <div class="text2" v-if="item.number">编号:{{ item.number }}</div>
                 </div>
                 </div>
+                <div class="assets-num" v-if="item.num > 1">x{{ item.num }}</div>
             </div>
             </div>
         </div>
         </div>
         <div style="padding: 0 16px">
         <div style="padding: 0 16px">
@@ -130,7 +131,8 @@ export default {
             info: {},
             info: {},
             showPwdDialog: false,
             showPwdDialog: false,
             showKeyboard: false,
             showKeyboard: false,
-            tradeCode: ''
+            tradeCode: '',
+            numList: []
         };
         };
     },
     },
     computed: {
     computed: {
@@ -157,7 +159,17 @@ export default {
         if (this.$route.query.assets) {
         if (this.$route.query.assets) {
             this.assets = this.$route.query.assets;
             this.assets = this.$route.query.assets;
             this.activityId = this.$route.query.activityId;
             this.activityId = this.$route.query.activityId;
-            this.getProduct(this.$route.query.assets.split(','));
+            if (this.$route.query.numList) {
+                this.numList = this.$route.query.numList.split(',');
+                this.getProduct(
+                    [...this.numList].map(item => {
+                        return item.split('_')[0];
+                    })
+                );
+            } else {
+                this.getProduct(this.$route.query.assets.split(','));
+            }
+
             this.$http.get('/mintActivity/get/' + this.activityId).then(res => {
             this.$http.get('/mintActivity/get/' + this.activityId).then(res => {
                 this.info = res;
                 this.info = res;
                 this.gas = res.gasPrice;
                 this.gas = res.gasPrice;
@@ -220,7 +232,10 @@ export default {
                 return;
                 return;
             }
             }
             this.$http.get('/asset/get/' + list[index]).then(res => {
             this.$http.get('/asset/get/' + list[index]).then(res => {
-                this.list.push(res);
+                let info = [...this.numList].find(item => {
+                    return item.split('_')[0] === res.id;
+                });
+                this.list.push({ ...res, num: Number(info.split('_')[1]) });
                 this.getProduct(list, index + 1);
                 this.getProduct(list, index + 1);
             });
             });
         },
         },
@@ -533,6 +548,12 @@ export default {
     &:last-child {
     &:last-child {
         margin-bottom: 0;
         margin-bottom: 0;
     }
     }
+
+    .assets-num {
+        font-size: 12px;
+        color: @text3;
+        .flex();
+    }
 }
 }
 
 
 .pay-item {
 .pay-item {

+ 3 - 0
src/views/star/Create.vue

@@ -367,6 +367,9 @@ export default {
             if (this.price) {
             if (this.price) {
                 form.destroyed = true;
                 form.destroyed = true;
                 form.price = this.price;
                 form.price = this.price;
+            } else {
+                form.destroyed = true;
+                form.price = 0;
             }
             }
             this.$toast.loading({
             this.$toast.loading({
                 message: '加载中...',
                 message: '加载中...',