Browse Source

商品搜索走DB 适应数据结构

郑杰 2 years ago
parent
commit
1baf7a1749
2 changed files with 16 additions and 15 deletions
  1. 3 3
      buyer/src/pages/GoodsDetail.vue
  2. 13 12
      buyer/src/pages/GoodsList.vue

+ 3 - 3
buyer/src/pages/GoodsDetail.vue

@@ -144,12 +144,12 @@ export default {
144 144
               }
145 145
             });
146 146
           } else {
147
-            this.$Message.error(res.message);
148
-            this.$router.push("/");
147
+            // this.$Message.error(res.message);
148
+            // this.$router.push("/");
149 149
           }
150 150
         })
151 151
         .catch(() => {
152
-          this.$router.push("/");
152
+          // this.$router.push("/");
153 153
         });
154 154
     },
155 155
     goGoodsList(currIndex) {

+ 13 - 12
buyer/src/pages/GoodsList.vue

@@ -49,29 +49,29 @@
49 49
               class="goods-show-info"
50 50
               v-for="(item, index) in goodsList"
51 51
               :key="index"
52
-              @click="goGoodsDetail(item.id, item.content.goodsId)"
52
+              @click="goGoodsDetail(item.id, item.goodsId)"
53 53
             >
54 54
               <div class="goods-show-img">
55
-                <img width="220" height="220" :src="item.content.thumbnail" />
55
+                <img width="220" height="220" :src="item.thumbnail" />
56 56
               </div>
57 57
               <div class="goods-show-price">
58 58
                 <span>
59 59
                   <span class="seckill-price text-danger">{{
60
-                    item.content.price | unitPrice("$")
60
+                    item.price | unitPrice("$")
61 61
                   }}</span>
62 62
                 </span>
63 63
               </div>
64 64
               <div class="goods-show-detail">
65
-                <span>{{ item.content.goodsName }}</span>
65
+                <span>{{ item.goodsName }}</span>
66 66
               </div>
67 67
               <div class="goods-show-num">
68
-                已有<span>{{ item.content.commentNum || 0 }}</span
68
+                已有<span>{{ item.commentNum || 0 }}</span
69 69
                 >人评价
70 70
               </div>
71 71
               <div class="goods-show-seller">
72 72
                 <Tag
73 73
                   class="goods-show-buyer"
74
-                  v-if="item.content.selfOperated"
74
+                  v-if="item.selfOperated"
75 75
                   size="default"
76 76
                   color="error"
77 77
                   >自营
@@ -79,19 +79,19 @@
79 79
                 <div class="goods-show-right">
80 80
                   <div
81 81
                     class="goods-show-middle"
82
-                    v-if="goodsListType.content.goodsType == 'VIRTUAL_GOODS'"
82
+                    v-if="goodsListType.goodsType == 'VIRTUAL_GOODS'"
83 83
                   >
84 84
                     虚拟
85 85
                   </div>
86 86
                   <div
87 87
                     class="goods-show-middle"
88
-                    v-else-if="goodsListType.content.goodsType == 'PHYSICAL_GOODS'"
88
+                    v-else-if="goodsListType.goodsType == 'PHYSICAL_GOODS'"
89 89
                   >
90 90
                     实物
91 91
                   </div>
92 92
                 </div>
93 93
                 <span class="text-bottom" style="color: #e4393c">{{
94
-                  item.content.storeName
94
+                  item.storeName
95 95
                 }}</span>
96 96
               </div>
97 97
             </div>
@@ -211,16 +211,17 @@ export default {
211 211
         .then((res) => {
212 212
           this.loading = false;
213 213
           if (res.success) {
214
-            this.goodsList = res.result.content;
215
-            this.total = res.result.totalElements;
214
+            this.goodsList = res.result.records;
215
+            this.total = res.result.total;
216 216
             for (var i = 0; i < this.goodsList.length; i++) {
217 217
               this.goodsListType = this.goodsList[i];
218 218
             }
219 219
           }
220 220
         })
221 221
         .catch(() => {
222
-          this.loading = false;
222
+
223 223
         });
224
+      this.loading = false;
224 225
     },
225 226
     getParams(val) {
226 227
       // 筛选条件回显