123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239 |
- <template>
- <view class="container">
- <view class="goodsList-box">
- <view class="goodsList-item flex" :key="ind" v-for="(ls, ind) in list" @click="navTo(ls)">
- <image :src="ls.image" mode=" scaleToFill"></image>
- <view class="goodsList-content">
- <view class="title clamp2">
- <text>{{ ls.store_name }}</text>
- </view>
- <view class="goods-money flex">
- <view class="money-box">
- <view class="old-price" v-if="ls.ot_price * 1 > ls.price * 1">
- <text class="old-left">¥{{ ls.ot_price }}</text>
- <image src="../../static/icon/down.png" mode="widthFix"></image>
- <text class="old-right">直降{{ ls.ot_price * 1 - ls.price * 1 }}元</text>
- </view>
- <view class="otMoney-box flex">
- <view class="otMoney">¥{{ ls.price }}</view>
- <view class="goodsList-btn">
- 立即购买
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- getProducts
- } from '@/api/product.js';
- export default {
- data() {
- return {
- list: [],
- type: ''
- };
- },
- onLoad(option) {
- // 获取查询对象
- this.type = option.type;
- if (this.type == 3) {
- uni.setNavigationBarTitle({
- title: '爆款商品'
- });
- } else {
- uni.setNavigationBarTitle({
- title: '进货区'
- });
- }
- // 加载基础数据
- this.loadData();
- },
- methods: {
- navTo: function(ls) {
- uni.navigateTo({
- url: '/pages/product/product?id=' + ls.id + '&isvip=1'
- });
- },
- // 请求载入数据
- async loadData() {
- getProducts({
- pages: 1,
- limit: 1000,
- store_region: this.type
- })
- .then(({
- data
- }) => {
- // 保存商品信息
- this.list = data;
- })
- .catch(e => {
- console.log(e);
- });
- },
- // 轮播图跳转
- bannerNavToUrl(item) {
- // #ifdef H5
- if (item.wap_link.indexOf('http') > 0) {
- window.location.href = item.wap_link;
- }
- // #endif
- if (item.wap_link) {
- uni.navigateTo({
- url: item.wap_link
- });
- }
- }
- }
- };
- </script>
- <style lang="scss">
- page {
- background: $page-color-base;
- }
- .carousel-section {
- padding: 0;
- .titleNview-placing {
- padding-top: 0;
- height: 0;
- }
- .swiper-dots {
- left: 45rpx;
- bottom: 40rpx;
- }
- .carousel {
- width: 100%;
- height: 360rpx;
- .carousel-item {
- width: 100%;
- height: 100%;
- overflow: hidden;
- }
- image {
- width: 100%;
- height: 100%;
- }
- }
- }
- // 中间标题样式
- .type-title-box {
- padding: 40rpx;
- .title-content {
- height: 100%;
- width: 200rpx;
- text-align: center;
- font-size: $font-lg;
- font-weight: 500;
- color: $font-color-dark;
- }
- .title-border {
- width: 250rpx;
- height: 2rpx;
- background-color: #e9e9e9;
- }
- }
- // 商品列表
- .goodsList-box {
- .goodsList-item {
- margin-bottom: 40rpx;
- background-color: #ffffff;
- padding: 30rpx;
- image {
- flex-shrink: 0;
- border-radius: $border-radius-sm;
- height: 180rpx;
- width: 180rpx;
- }
- .goodsList-content {
- margin-left: 20rpx;
- flex-grow: 1;
- height: 180rpx;
- position: relative;
- .title {
- font-size: $font-base;
- color: $font-color-dark;
- font-weight: 500;
- }
- .goods-money {
- position: absolute;
- left: 0;
- bottom: 0;
- width: 100%;
- .money-box {
- image {
- width: 14rpx;
- margin: 0 6rpx 0 10rpx;
- }
- .old-price {
- .old-left {
- font-size: 26rpx;
- font-weight: 500;
- text-decoration: line-through;
- color: #999999;
- }
- .old-right {
- font-size: 24rpx;
- font-weight: bold;
- color: #b59467;
- }
- }
- .otMoney-box {
- display: flex;
- align-items: center;
- .otMoney {
- font-size: 36rpx;
- color: $color-red;
- padding-right: 20rpx;
- }
- }
- }
- .goodsList-btn {
- position: absolute;
- bottom: 0;
- right: 0;
- width: 137rpx;
- height: 52rpx;
- background: #9c0b18;
- border-radius: 26rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- font-size: 26rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #FFFFFF;
- }
- }
- }
- }
- }
- </style>
|