123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- <template>
- <view class="container">
- <view class="jx-box-content" v-for="(item, index) in list">
- <view class="content-left"><image :src="item.image" mode=""></image></view>
- <view class="content-right">
- <view class="shop-name">{{ item.store_name }}</view>
- <view class="shop-content">
- <view class="shop-content-left">
- <view class="price-box">
- <view class="yuan-price">¥{{ item.ot_price * 1 }}</view>
- <image src="../../static/sy/sy06.png" mode=""></image>
- <view class="j-price">直降{{ (item.ot_price - item.price).toFixed(2) * 1 }}元</view>
- </view>
- <view class="price-x">¥{{ item.price * 1 }}</view>
- </view>
- <view class="shop-content-right" @click="navToDetailPage(item)">购买</view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import { groomList } from '@/api/product.js';
- export default {
- data() {
- return {
- list: [],
- bannerImg: []
- };
- },
- onLoad(option) {
- // 获取查询对象
- this.type = option.type;
- // 加载基础数据
- this.loadData();
- },
- methods: {
- navTo: function(ls) {
- uni.navigateTo({
- url: '/pages/product/product?id=' + ls.id
- });
- },
- // 请求载入数据
- async loadData() {
- groomList(
- {
- page: 1,
- limit: 1000
- },
- 1
- )
- .then(({ data }) => {
- // 保存轮播图
- this.bannerImg = data.banner;
- // 保存商品信息
- this.list = data.list;
- })
- .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: #fff;
- }
- .jx-box-content {
- margin: 20rpx auto 0;
- display: flex;
- width: 710rpx;
- background: #ffffff;
- box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
- border-radius: 10rpx;
- padding: 20rpx 30rpx 20rpx 14rpx;
- .content-left {
- flex-shrink: 0;
- width: 236rpx;
- height: 236rpx;
- background: #e2e2e2;
- border-radius: 10rpx;
- image {
- width: 100%;
- height: 100%;
- }
- }
- .content-right {
- width: 100%;
- margin-left: 20rpx;
- display: flex;
- flex-direction: column;
- justify-content: space-around;
- .shop-name {
- width: 382rpx;
- font-size: 32rpx;
- font-weight: bold;
- color: #333333;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- }
- .shop-content {
- display: flex;
- justify-content: space-between;
- .shop-content-left {
- display: flex;
- flex-direction: column;
- .price-box {
- display: flex;
- align-items: center;
- .yuan-price {
- font-size: 26rpx;
- font-weight: 500;
- text-decoration: line-through;
- color: #999999;
- }
- image {
- margin-left: 8rpx;
- width: 16rpx;
- height: 18rpx;
- }
- .j-price {
- margin-left: 8rpx;
- font-size: 24rpx;
- font-weight: bold;
- color: #b59467;
- }
- }
- .price-x {
- font-size: 36rpx;
- font-weight: bold;
- color: #ff4c4c;
- }
- }
- .shop-content-right {
- margin-top: 20rpx;
- align-items: center;
- text-align: center;
- width: 137rpx;
- height: 52rpx;
- font-size: 26rpx;
- font-weight: 500;
- color: #ffffff;
- background: linear-gradient(90deg, #bb9159, #e6c79d);
- border-radius: 26rpx;
- line-height: 52rpx;
- }
- }
- }
- }
- </style>
|