Browse Source

Merge branch 'dev' of xiongzhu/raex_front into master

panhui 3 years ago
parent
commit
bae6e3c747

+ 51 - 1
src/components/product/SaleInfo.vue

@@ -1,5 +1,5 @@
 <template>
-    <div class="sale-box">
+    <div class="sale-box" v-if="totalElements > 0">
         <div class="sale-info">
             <div class="text1">当前寄售最低价格</div>
             <div class="text2">
@@ -110,6 +110,56 @@ export default {
             } else {
                 return '';
             }
+        },
+        getData(isFirst = false, scrollTop = 0) {
+            if (isFirst) {
+                this.page = 0;
+                this.list = [];
+                this.$root.$el.scrollTop = scrollTop;
+            }
+
+            this.loading = true;
+            this.finished = false;
+            this.empty = false;
+            let data = { page: this.page, size: 20, sort: 'createdAt,desc' };
+            if (this.beforeData) {
+                data = {
+                    ...data,
+                    ...this.beforeData()
+                };
+            }
+
+            if (this.httpType === 'get') {
+                return this.$http.get(this.url, data, { body: 'json' }).then(res => {
+                    if (res.first) {
+                        this.list = [];
+                    }
+                    this.list = [...this.list, ...res.content];
+                    this.empty = res.empty;
+                    this.loading = false;
+                    this.finished = res.last;
+                    if (!this.finished) {
+                        this.page = this.page + 1;
+                    }
+                    this.totalElements = Number(res.totalElements);
+                    return Promise.resolve(Number(res.totalElements));
+                });
+            } else {
+                return this.$http.post(this.url, data, { body: 'json' }).then(res => {
+                    if (res.first) {
+                        this.list = [];
+                    }
+                    this.list = [...this.list, ...res.content];
+                    this.empty = res.empty;
+                    this.loading = false;
+                    this.finished = res.last;
+                    if (!this.finished) {
+                        this.page = this.page + 1;
+                    }
+                    this.totalElements = Number(res.totalElements);
+                    return Promise.resolve(Number(res.totalElements));
+                });
+            }
         }
     }
 };

+ 19 - 3
src/views/account/Login.vue

@@ -44,9 +44,7 @@
             </div>
 
             <div class="button">
-                <!-- <van-button plain class="forget" @click="$router.replace('/forget')">
-          忘记密码?
-        </van-button> -->
+                <!-- <van-button plain class="forget" v-if="$store.state.review" @click="getSim"> 获取手机号码 </van-button> -->
 
                 <van-button block native-type="submit" color="#26F50D" class="sure">现在出发!</van-button>
                 <van-button class="del" block plain @click="$router.replace('/register')"
@@ -201,6 +199,24 @@ export default {
                         return this.$store.dispatch('getUserInfo');
                     });
             }
+        },
+        getSim() {
+            // window.plugins.sim.requestReadPermission(
+            //     function (res) {
+            //         console.log(res);
+            //     },
+            //     function () {
+            //         alert('error');
+            //     }
+            // );
+            window.plugins.sim.getSimInfo(
+                function (res) {
+                    console.log(res);
+                },
+                function () {
+                    alert('error');
+                }
+            );
         }
     },
     watch: {

+ 31 - 27
src/views/creator/Detail.vue

@@ -50,6 +50,10 @@
                             <img @click="copy" src="@assets/svgs/copy_icon.svg" alt="" /> 
                         </div>-->
                     </div>
+                    <div class="collect">
+                        <div class="text1">{{ info.followers }}</div>
+                        <div class="text2">粉丝</div>
+                    </div>
                 </div>
 
                 <div class="sub" :class="{ 'van-multi-ellipsis--l2': !showMore }">
@@ -64,11 +68,7 @@
                         <div class="text1">{{ info.follows }}</div>
                         <div class="text2">关注</div>
                     </div> -->
-                    <div class="collect">
-                        <div class="text1">{{ info.followers }}</div>
-                        <div class="text2">粉丝</div>
-                    </div>
-                    <div class="flex1"></div>
+
                     <van-button
                         class="follow"
                         @click="follow"
@@ -435,13 +435,15 @@ export default {
     .sub {
         font-size: 12px;
         color: @text3;
-        line-height: 22px;
+        line-height: 17px;
         padding: 6px 0 0;
+        text-align: center;
     }
 
     .sub-right {
         .flex();
-        justify-content: flex-end;
+        justify-content: center;
+        margin-top: 3px;
     }
 
     .sub-right > div {
@@ -457,25 +459,7 @@ export default {
         align-items: center;
         // transform: translateY(14px);
         padding: 10px 0 17px;
-        .collect {
-            width: 20%;
-            display: flex;
-            flex-direction: row-reverse;
-            align-items: center;
-            justify-content: flex-end;
-            .text1 {
-                font-size: @font2;
-                color: @text0;
-                line-height: 24px;
-                margin-left: 6px;
-            }
-            .text2 {
-                font-size: @font2;
-                color: @text3;
-                line-height: 24px;
-                white-space: nowrap;
-            }
-        }
+        justify-content: center;
 
         /deep/.van-button {
             width: 70px;
@@ -563,12 +547,32 @@ export default {
             }
         }
     }
+
+    .collect {
+        display: flex;
+        flex-direction: row-reverse;
+        align-items: center;
+        justify-content: flex-end;
+        margin-top: 4px;
+        .text1 {
+            font-size: @font2;
+            color: @text0;
+            line-height: 24px;
+            margin-left: 6px;
+        }
+        .text2 {
+            font-size: @font2;
+            color: @text0;
+            line-height: 24px;
+            white-space: nowrap;
+        }
+    }
 }
 .menu {
     display: flex;
     height: 50px;
     align-items: center;
-    padding: 0 16px;
+    padding: 12px 16px 0;
     // border-bottom: 1px solid #202122;
     background-color: @bg;
     .menu-item {

+ 8 - 4
src/views/product/Detail.vue

@@ -251,7 +251,7 @@
             </div>
         </div>
 
-        <div class="btn van-safe-area-bottom" ref="btn" v-if="canSale">
+        <div class="btn van-safe-area-bottom" ref="btn" v-if="canSale && totalSales > 0">
             <div class="btn-list btn-only">
                 <van-button type="primary" @click="showSale" block round>我想要</van-button>
             </div>
@@ -416,7 +416,8 @@ export default {
             noPay: false,
             collectionId: 0,
             createrId: 0,
-            type: ''
+            type: '',
+            totalSales: 0
         };
     },
     computed: {
@@ -437,7 +438,7 @@ export default {
             });
         },
         canSale() {
-            return (this.isSolded || !this.info.onShelf || !this.info.salable) && this.type === 'creator';
+            return this.isSolded;
         }
     },
     mounted() {
@@ -602,7 +603,10 @@ export default {
                     }
                     this.$nextTick(() => {
                         if (this.canSale) {
-                            this.$refs.sale.getData(true);
+                            this.$refs.sale.getData(true).then(num => {
+                                this.totalSales = num;
+                                console.log(num);
+                            });
                         }
                     });
                 })