|
26 | 26 | @scrolltolower="goodsGoBottom"> |
27 | 27 | <u-empty v-if="!goodsList" mode="list" text="暂无商品" marginTop="200rpx" /> |
28 | 28 | <view v-for="(item, index) in goodsList" :key="index" class="goodsList"> |
29 | | - <u--image showLoading lazyLoad :src="item.pic" radius="16rpx" width="240rpx" height="240rpx" |
30 | | - @click="goDetail(item)"></u--image> |
| 29 | + <u-image showLoading lazyLoad :src="item.pic" radius="16rpx" width="240rpx" height="240rpx" |
| 30 | + @click="goDetail(item)"></u-image> |
31 | 31 | <view class="goods-info"> |
32 | | - <view class="goods-title u-line-3 pt16" @click="goDetail(item)"> |
33 | | - <u-tag v-if="item.supplyType == 'vop_jd' || item.supplyType == 'jdJoycityPoints'" text="京东自营" bgColor="#e64340" borderColor="#e64340" size="mini" class="goods-title-tag"></u-tag> |
34 | | - <text class="goods-title">{{ item.name }}</text> |
| 32 | + <view class="goods-title u-line-3 pt16" @click="goDetail(item)"> |
| 33 | + <u-tag v-if="item.supplyType == 'vop_jd' || item.supplyType == 'jdJoycityPoints'" text="京东自营" bgColor="#e64340" borderColor="#e64340" size="mini" class="goods-title-tag"></u-tag> |
| 34 | + <text class="goods-title">{{ item.name }}</text> |
35 | 35 | </view> |
36 | 36 | <view v-if="item.numberSells" class="t2">已售:{{ item.numberSells }}</view> |
37 | | - <view class="price-score"> |
38 | | - <view v-if="item.minPrice" class="item"><text>¥</text>{{item.minPrice}}</view> |
39 | | - <view v-if="item.minScore" class="item"><text><image class="score-icon" src="/static/images/score.png"></image></text>{{item.minScore}}</view> |
| 37 | + <view class="price-score"> |
| 38 | + <view v-if="item.minPrice" class="item"><text>¥</text>{{item.minPrice}}</view> |
| 39 | + <view v-if="item.minScore" class="item"><text><image class="score-icon" src="/static/images/score.png"></image></text>{{item.minScore}}</view> |
40 | 40 | </view> |
41 | 41 | <view v-if="item.supplyType != 'jdJoycityPoints'" class="addCar"> |
42 | 42 | <u-icon v-if="item.propertyIds || item.hasAddition" name="plus-circle" color="#e64340" |
|
192 | 192 | } |
193 | 193 | }, |
194 | 194 | // 弹出商品购买弹窗 |
195 | | - async _showGoodsPop(item) { |
196 | | - if(!await getApp().checkHasLoginedH5()) { |
197 | | - uni.navigateTo({ |
198 | | - url: "/pages/login/login" |
199 | | - }) |
200 | | - return |
| 195 | + async _showGoodsPop(item) { |
| 196 | + if(!await getApp().checkHasLoginedH5()) { |
| 197 | + uni.navigateTo({ |
| 198 | + url: "/pages/login/login" |
| 199 | + }) |
| 200 | + return |
201 | 201 | } |
202 | 202 | // https://www.yuque.com/apifm/nu0f75/vuml8a |
203 | 203 | const res = await this.$wxapi.goodsDetail(item.id, this.token) |
|
211 | 211 | this.goodsDetail = res.data |
212 | 212 | this.showGoodsPop = true |
213 | 213 | }, |
214 | | - async addCart(item) { |
215 | | - if(!await getApp().checkHasLoginedH5()) { |
216 | | - uni.navigateTo({ |
217 | | - url: "/pages/login/login" |
218 | | - }) |
219 | | - return |
220 | | - } |
221 | | - let res |
222 | | - if(item.supplyType == 'vop_jd') { |
223 | | - // https://www.yuque.com/apifm/nu0f75/yum741 |
224 | | - res = await this.$wxapi.jdvopCartAdd({ |
225 | | - token: this.token, |
226 | | - goodsId: item.yyId, |
227 | | - number: 1 |
228 | | - }) |
229 | | - } else { |
230 | | - // https://www.yuque.com/apifm/nu0f75/et6m6m |
231 | | - res = await this.$wxapi.shippingCarInfoAddItem(this.token, item.id, 1, [], []) |
| 214 | + async addCart(item) { |
| 215 | + if(!await getApp().checkHasLoginedH5()) { |
| 216 | + uni.navigateTo({ |
| 217 | + url: "/pages/login/login" |
| 218 | + }) |
| 219 | + return |
| 220 | + } |
| 221 | + let res |
| 222 | + if(item.supplyType == 'vop_jd') { |
| 223 | + // https://www.yuque.com/apifm/nu0f75/yum741 |
| 224 | + res = await this.$wxapi.jdvopCartAdd({ |
| 225 | + token: this.token, |
| 226 | + goodsId: item.yyId, |
| 227 | + number: 1 |
| 228 | + }) |
| 229 | + } else { |
| 230 | + // https://www.yuque.com/apifm/nu0f75/et6m6m |
| 231 | + res = await this.$wxapi.shippingCarInfoAddItem(this.token, item.id, 1, [], []) |
232 | 232 | } |
233 | 233 | if (res.code != 0) { |
234 | 234 | uni.showToast({ |
|
257 | 257 | }) |
258 | 258 | } |
259 | 259 | }) |
260 | | - }, |
261 | | - goDetail(item) { |
262 | | - uni.navigateTo({ |
263 | | - url: '/pages/goods/detail?id=' + item.id |
264 | | - }) |
| 260 | + }, |
| 261 | + goDetail(item) { |
| 262 | + uni.navigateTo({ |
| 263 | + url: '/pages/goods/detail?id=' + item.id |
| 264 | + }) |
265 | 265 | } |
266 | 266 | } |
267 | 267 | } |
|
371 | 371 | } |
372 | 372 |
|
373 | 373 | } |
374 | | -</style> |
| 374 | +</style> |
0 commit comments