MrShi
7 小时以前 ef46d13d5fa70d1c94f25de294f5ed177b751234
mini-program/pages/details/details.vue
@@ -1,5 +1,6 @@
<template>
   <view class="details" v-if="info">
      <template v-if="info.isdeleted === 0">
      <u-swiper :list="info.banner" height="375" @click="preview"></u-swiper>
      <view class="info">
         <view class="info-title">
@@ -11,7 +12,7 @@
               <text>.{{info.minPrice[1]}}</text>
            </view>
            <view class="commodity-item-box-price-b">
               原价¥{{info.price}}
                  原价¥{{info.linePrice}}
            </view>
         </view>
         <view class="info-num">
@@ -46,12 +47,24 @@
               </view>
            </view>
            <view class="edit-btn">
                  <template v-if="info.status === 0">
               <view class="edit-btn-a" @click="addCard(info)">加入购物车</view>
               <view class="edit-btn-b" @click="submit">立即购买</view>
                  </template>
                  <template v-else>
                     <view style="width: 250rpx; height: 88rpx;"></view>
                     <view class="edit-btn-c">商品已下架</view>
                  </template>
            </view>
         </view>
         <view style="width: 100%; height: env(safe-area-inset-bottom);"></view>
      </view>
      </template>
      <template v-else>
         <view class="wuImg">
            <image src="/static/images/default_empty.png" mode="widthFix"></image>
         </view>
      </template>
      <Login ref="login" />
   </view>
</template>
@@ -126,12 +139,12 @@
            }
            this.$u.api.addCart({
               goodsId: e.id,
               goodsSkuId: e.skuResponsesList[0].id,
               goodsSkuId: e.goodsSkuResponseList[0].id,
               num: 1
            }).then(res => {
               if (res.code === 200) {
                  this.cardNum()
                  uni.showToast({ title: '添加成功', icon: 'none' })
                  uni.showToast({ title: '添加成功', icon: 'success', mask: true })
               }
            })
         },
@@ -160,6 +173,7 @@
            })
         },
         getDetails() {
            try {
            this.$u.api.goodsInfo({
               goodsId: this.id,
               memberId: this.userInfo ? this.userInfo.id : null,
@@ -172,6 +186,9 @@
                  this.info = res.data
               }
            })
            } catch (err) {
               console.log(err)
            }
         }
      }
   }
@@ -185,6 +202,18 @@
<style lang="scss" scoped>
   .details {
      width: 100%;
      .wuImg {
         width: 100%;
         display: flex;
         align-items: center;
         justify-content: center;
         padding-top: 400rpx;
         box-sizing: border-box;
         image {
            width: 320rpx;
            height: 320rpx;
         }
      }
      .footer {
         width: 100%;
         position: fixed;
@@ -276,6 +305,17 @@
                  font-size: 30rpx;
                  color: #FFFFFF;
               }
               .edit-btn-c {
                  width: 200rpx;
                  height: 88rpx;
                  line-height: 88rpx;
                  text-align: center;
                  background: #999999;
                  border-radius: 44rpx;
                  font-weight: 500;
                  font-size: 30rpx;
                  color: #FFFFFF;
               }
            }
         }
      }