123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343 |
- <template>
- <view class="">
- <empty v-if="loaded && goodList.length == 0"></empty>
- <view class="hot-list">
- <view class="hotgoods-item" v-for="jfitem in goodList" :key="jfitem.id"
- @click="navto('/pages/product/product?id=' + jfitem.id)" style="height: 490rpx;">
- <view class="image-wrapper">
- <image class="image" :src="jfitem.image" mode="scaleToFill"></image>
- </view>
- <view class="flex"
- style="flex-direction: column;justify-content: space-between;align-items: flex-start;height: 120rpx;">
- <view class="title clamp">{{jfitem.store_name}}</view>
- <view class="hot-price">
- <view class="price">
- <text>¥{{ jfitem.price * 1 }}</text>
- <text class="ot-pirce" v-if="jfitem.ot_price*1 >jfitem.price * 1 ">¥{{jfitem.ot_price}}</text>
- </view>
- </view>
- </view>
- </view>
- </view>
- <uni-load-more :status="loadingType" v-if="!(loaded && goodList.length == 0)"></uni-load-more>
- </view>
- </template>
- <script>
- //
- import {
- weixindata,
- shareLoad
- } from '@/utils/wxAuthorized';
- //
- import empty from '@/components/empty.vue'
- import {
- getBargainList,
- getProducts,
- goodsDetail,
- poster,
- getBd,
- getGp,
- groomList
- } from '@/api/product.js';
- export default {
- components: {
- empty
- },
- data() {
- return {
- goodList: [], //商品列表
- loadingType: 'more',
- page: 1,
- limit: 10,
- type: 0,
- loaded: false,
- cid: 0
- }
- },
- onLoad(opt) {
- if (opt.id) {
- this.cid = opt.id
- uni.setNavigationBarTitle({
- title: opt.tit
- })
- }
- this.getGoodList()
- //
- this.shareDate()
- //
- },
- onShow() {
- },
- onReachBottom() {
- this.getGoodList()
- },
- onPullDownRefresh() {
- this.getGoodList('down')
- },
- methods: {
- //
- // 加载微信html5页面分享方法
- shareDate() {
- // let obj = this;
- // 保存分享人id链接
- // let url = window.location.href + '&spread=' + this.userInfo.uid;
- // 判断是否微信浏览器
- // let bool = uni.getStorageSync('weichatBrowser') || '';
- // if (bool) {
- // // 过滤微信强制添加的链接地址
- // url = url.replace(/[\?,&]from=singlemessage/g, '');
- // }
- shareLoad();
- },
- //
- navto(url) {
- uni.navigateTo({
- url,
- fail() {
- uni.switchTab({
- url
- })
- }
- })
- },
- getGoodList(type) {
- let obj = this
- if (type == 'down') {
- obj.loadingType = 'more'
- obj.page = 1
- }
- if (obj.loadingType == 'loading' || obj.loadingType == 'noMore') {
- return
- }
- obj.loadingType = 'loading'
- getProducts({
- page: obj.page,
- limit: obj.limit,
- cid: obj.cid
- }).then(res => {
- if (type == 'down') {
- obj.goodList = []
- uni.stopPullDownRefresh();
- }
- obj.goodList = obj.goodList.concat(res.data)
- if (obj.limit == res.data.length) {
- obj.loadingType = 'more'
- obj.page++
- } else {
- obj.loadingType = 'noMore'
- }
- obj.loaded = true
- }).catch(err => {
- obj.loadingType = 'more'
- uni.stopPullDownRefresh();
- })
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .hot-list {
- // margin-top: 38rpx;
- width: 100%;
- display: flex;
- flex-wrap: wrap;
- padding: 20rpx 20rpx 30rpx;
- justify-content: space-between;
- .hotgoods-item {
- width: 345rpx;
- background-color:
- border-radius: 12rpx;
- box-shadow: 0 0 15rpx rgba(0, 0, 0, 0.2);
- margin-bottom: 15rpx;
- .image-wrapper {
- width: 345rpx;
- height: 345rpx;
- border-radius: 3px;
- overflow: hidden;
- position: relative;
- .image-bg {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- width: 100%;
- height: 100%;
- opacity: 1;
- border-radius: 12rpx 12rpx 0 0;
- z-index: 2;
- }
- .image {
- width: 100%;
- height: 100%;
- opacity: 1;
- border-radius: 12rpx 12rpx 0 0;
- }
- }
- .title {
- margin-top: 24rpx;
- padding: 0 20rpx;
- font-size: 32rpx;
- font-weight: 500;
- color:
- }
- .hot-price {
- display: flex;
- justify-content: flex-start;
- align-items: center;
- width: 100%;
- padding: 0 10rpx;
- // padding: 14rpx 0 30rpx;
- .hotPrice-box {
- padding: 2rpx 6rpx;
- background: linear-gradient(90deg,
- border-radius: 5rpx;
- text-align: center;
- line-height: 28rpx;
- font-size: 20rpx;
- font-family: Source Han Sans CN;
- font-weight: 400;
- color:
- }
- .price {
- margin-left: 10rpx;
- font-size: 36rpx;
- color:
- font-weight: 500;
- display: flex;
- width: 100%;
- justify-content: flex-start;
- align-items: center;
- .jf {
- font-size: 20rpx;
- }
- .give-jf {
- display: inline-block;
- padding: 8rpx;
- background: linear-gradient(90deg,
- border-radius: 12rpx 0px 12rpx 0px;
- font-size: 22rpx;
- font-weight: 500;
- color:
- margin-left: 22rpx;
- }
- .ot-pirce {
- margin-left: 7rpx;
- font-size: 26rpx;
- font-weight: 500;
- text-decoration: line-through;
- color:
- align-self: flex-end;
- }
- }
- .yuanPrice {
- margin-left: 10rpx;
- font-size: 20rpx;
- font-family: PingFang SC;
- font-weight: 500;
- text-decoration: line-through;
- color:
- }
- .cart-icon {
- image {
- width: 44rpx;
- height: 44rpx;
- }
- }
- }
- }
- }
- .goodss {
- border-radius: 0rpx 0rpx 20rpx 20rpx;
- box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(50, 50, 52, 0.06);
- margin-bottom: 20rpx;
- padding-bottom: 20rpx;
- &:last-of-type {
- margin-bottom: 0;
- }
- .goods-img {
- position: relative;
- width: 702rpx;
- height: 303rpx;
- image {
- width: 702rpx;
- height: 303rpx;
- }
- .img-bg {
- position: absolute;
- top: 0;
- left: 0;
- }
- }
- .goods-tit {
- font-weight: 500;
- font-size: 32rpx;
- color:
- padding: 15rpx 20rpx;
- }
- .goods-price {
- display: flex;
- padding: 0 20rpx;
- .new-price {
- font-weight: bold;
- font-size: 32rpx;
- color:
- }
- .tc {
- flex-grow: 1;
- }
- .ot-pirce {
- font-weight: 500;
- font-size: 26rpx;
- color:
- text-decoration-line: line-through;
- }
- .gobuy {
- display: inline-block;
- width: 170rpx;
- line-height: 53rpx;
- background: linear-gradient(30deg,
- border-radius: 27rpx;
- text-align: center;
- font-weight: bold;
- font-size: 28rpx;
- color:
- }
- }
- }
- </style>
|