许静 5 years ago
parent
commit
30628ad48b
2 changed files with 33 additions and 25 deletions
  1. 1
    2
      src/app.js
  2. 32
    23
      src/pages/shop/index.js

+ 1
- 2
src/app.js View File

@@ -40,12 +40,11 @@ class App extends Component {
40 40
       }
41 41
     },
42 42
     pages: [
43
+      'pages/shop/index',
43 44
       'pages/activity/activity',
44 45
       'pages/activity/myActivity',
45
-      'pages/shop/index',
46 46
       'pages/project/index',
47 47
       'pages/person/index',
48
-
49 48
       'pages/person/profile/index',
50 49
       'pages/project/detail/index',
51 50
       'pages/activity/assemblePage',

+ 32
- 23
src/pages/shop/index.js View File

@@ -134,19 +134,23 @@ export default class Shop extends Component {
134 134
 
135 135
   handleClick(value) {
136 136
 
137
+    this.setState({
138
+      current: value
139
+    })
140
+
137 141
     const payload = {
138 142
       pageNum: '1',
139 143
       pageSize: '9999',
140 144
       buildingId: this.state.goodsBuilding[value].buildingId
141 145
     }
142 146
     getGoodsList(payload).then(res => {
147
+      console.log(res.records, "22222222222222222222222222222222")
143 148
       this.setState({
144 149
         goodsList: res.records || []
145 150
       })
151
+      console.log(this.state.goodsList, "goodsList")
146 152
     })
147
-    this.setState({
148
-      current: value
149
-    })
153
+
150 154
   }
151 155
 
152 156
   onViewDetail(item) {
@@ -236,30 +240,35 @@ export default class Shop extends Component {
236 240
           </View>
237 241
         }
238 242
         {
239
-          goodsBuilding && goodsBuilding.length > 2 &&
243
+          goodsBuilding && goodsBuilding.length >= 2 &&
240 244
           <AtTabs scroll tabDirection='horizontal' current={current} tabList={goodsBuilding} onClick={this.handleClick.bind(this)}>
241
-            <AtTabsPane current={current}  >
242
-              <View>
243
-                {
244
-                  goodsList.map(item => (
245
-                    <View className="item" key={item.goodsId} onClick={this.onViewDetail.bind(this, item)}>
246
-                      <Image className="item__img" src={item.imgUrl} />
247
-                      <View className="item__title">{item.goodsName}</View>
248
-                      <View className="item__des">
249
-                        <View>
250
-                          剩余数量{item.inventory}
251
-                        </View>
252
-                        <View >
253
-                          <Text className="item__jifen">{item.pointPrice}</Text>积分
245
+
246
+            {goodsBuilding.map((l_item, index) => (
247
+
248
+              <AtTabsPane current={current} index={index} >
249
+                <View>
250
+                  {
251
+                    goodsList.map(item => (
252
+                      <View className="item" key={item.goodsId} onClick={this.onViewDetail.bind(this, item)}>
253
+                        <Image className="item__img" src={item.imgUrl} />
254
+                        <View className="item__title">{item.goodsName}</View>
255
+                        <View className="item__des">
256
+                          <View>
257
+                            剩余数量{item.inventory}
258
+                          </View>
259
+                          <View >
260
+                            <Text className="item__jifen">{item.pointPrice}</Text>积分
254 261
                 </View>
255
-                      </View>
262
+                        </View>
256 263
 
257
-                    </View>
258
-                  ))
259
-                }
264
+                      </View>
265
+                    ))
266
+                  }
260 267
 
261
-              </View>
262
-            </AtTabsPane>
268
+                </View>
269
+              </AtTabsPane>
270
+            ))
271
+            }
263 272
           </AtTabs>
264 273
         }
265 274
       </View>