123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424 |
- <template>
- <!-- 商品列表模块 -->
- <view :style="viewColor">
- <view class='productList'>
- <view class='search acea-row row-between-wrapper'>
- <view class='input acea-row row-between-wrapper'><text class='iconfont icon-sousuo'></text>
- <input placeholder='搜索商品名称' placeholder-class='placeholder' confirm-type='search' name="search"
- :value='where.keyword' @confirm="searchSubmit"></input>
- </view>
- <view class='iconfont' :class='is_switch==true?"icon-pailie":"icon-tupianpailie"' @click.native='Changswitch'>
- </view>
- </view>
- <view class='nav acea-row row-middle'>
- <view class='item line1' :class="{'font-num': where.order==''}" @click.native='set_where(1)'>默认</view>
- <view class='item' :class="{'font-num': where.order=='ot_price_desc' || where.order=='ot_price_asc'}" @click='set_where(2)'>
- 积分
- <image v-if="price==1" :src="domain+'/static/diy/up'+keyColor+'.png'"></image>
- <image v-else-if="price==2" :src="domain+'/static/diy/down'+keyColor+'.png'"></image>
- <image v-else :src='`${domain}/static/images/horn.png`'></image>
- </view>
- <view class='item' :class="{'font-num': where.order=='sales'}" @click.native='set_where(3)'>
- 销量
- </view>
- </view>
- <view class='list acea-row row-between-wrapper' :class='is_switch==true?"":"on"'>
- <view class='item' :class='is_switch==true?"":"on"' hover-class='none'
- v-for="(item,index) in productList" :key="index" @click.native="godDetail(item)">
- <view class='pictrue' :class='is_switch==true?"":"on"'>
- <image :src='item.image' :class='is_switch==true?"":"on"'></image>
- <view v-if="item.stock == 0" class="sell_out" :class='is_switch==true?"":"on"'>已兑完</view>
- </view>
- <view class='text' :class='is_switch==true?"":"on"'>
- <view class='name' :class='is_switch==true?"line1":"line2"'>{{item.store_name}}</view>
- <view class='vip' :class='is_switch==true?"":"on"'>
- <view class="acea-row price-count">
- <image class="image" :src="`${domain}/static/images/jf-point.png`" mode="widthFix"></image>
- <view class="price-box">
- <text>{{ item.ot_price }}</text>积分
- </view>
- <view v-if="item.price!=0" class="sales">+{{parseFloat(Number(item.price).toFixed(2))}}元</view>
- </view>
- <view class="exchange">
- {{item.sales}}人兑换
- </view>
- </view>
- </view>
- </view>
- <view class='loadingicon acea-row row-center-wrapper' v-if='loading'>
- <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
- </view>
- </view>
- </view>
- <view class='noCommodity' v-if="productList.length==0 && !loading">
- <view class='emptyBox'>
- <image :src="`${domain}/static/images/noCart.png`"></image>
- <view class="tips">暂无商品,去看点别的吧</view>
- </view>
- <recommend :hostProduct="hostProduct"></recommend>
- </view>
- </view>
- </template>
- <script>
- // +----------------------------------------------------------------------
- // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
- // +----------------------------------------------------------------------
- // | Author: CRMEB Team <admin@crmeb.com>
- // +----------------------------------------------------------------------
- import { getProductHot } from '@/api/store.js';
- import {getIntegralGoodsList } from '@/api/points_mall.js';
- import recommend from '@/components/recommend';
- import { mapGetters } from "vuex";
- import { goShopDetail } from '@/libs/order.js'
- import {HTTP_REQUEST_URL} from '@/config/app';
- export default {
- computed: mapGetters(['uid','viewColor','keyColor']),
- components: {
- recommend,
- },
- data() {
- return {
- productList: [],
- is_switch: true,
- where: {
- order: '',
- keyword: '',
- page: 1,
- cate_id: '',
- limit: 20,
- },
- price: 0,
- stock: 0,
- nows: false,
- loadend: false,
- loading: false,
- loadTitle: '加载更多',
- title: '',
- hostProduct: [],
- hotPage: 1,
- hotLimit: 10,
- hotScroll: false,
- domain:HTTP_REQUEST_URL
- };
- },
- onLoad: function(option) {
- this.where.cid = option.cid || 0;
- this.$set(this.where, 'cate_id', option.cate_id || '');
- this.$set(this.where, 'keyword', option.searchValue || '');
- this.get_product_list();
- },
- onShow(){
- uni.removeStorageSync('form_type_cart');
- },
- methods: {
- // 去详情页
- godDetail(item) {
- uni.navigateTo({
- url: `/pages/points_mall/integral_goods_details?id=${item.product_id}`
- })
- },
- Changswitch: function() {
- let that = this;
- that.is_switch = !that.is_switch
- },
- searchSubmit: function(e) {
- let that = this;
- that.$set(that.where, 'keyword', e.detail.value);
- that.productList = [];
- that.loadend = false;
- that.loading = false;
- that.$set(that.where, 'page', 1);
- that.get_product_list();
- },
- //点击事件处理
- set_where: function(e) {
- switch (e) {
- case 1:
- this.price = 0
- this.where = {
- keyword: '',
- order: '',
- page: 1,
- limit: 20,
- }
- break
- case 2:
- if (this.price == 0 || this.price == 2) {
- this.price = 1;
- } else if (this.price == 1) {
- this.price = 2;
- }
- this.where.order = this.where.order == 'ot_price_asc' ? 'ot_price_desc' : 'ot_price_asc'
- break;
- case 3:
- this.price = 0;
- this.$set(this.where, 'order', 'sales')
- this.get_product_list(true);
- break;
- }
- this.loadend = false;
- this.loading = false
- this.productList = []
- this.$set(this.where, 'page', 1);
- this.get_product_list();
- },
- //查找产品
- get_product_list: function() {
- let that = this;
- if (that.loadend) return;
- if (that.loading) return;
- that.loading = true;
- that.loadTitle = '';
- getIntegralGoodsList(that.where).then(res => {
- let list = res.data.list;
- let productList = that.$util.SplitArray(list, that.productList);
- let loadend = list.length < that.where.limit;
- that.loadend = loadend;
- that.loading = false;
- that.loadTitle = loadend ? '没有更多内容啦~' : '加载更多';
- that.$set(that, 'productList', productList);
- that.$set(that.where, 'page', that.where.page + 1);
- }).catch(err => {
- that.loading = false;
- that.loadTitle = '加载更多';
- });
- },
- },
- onPullDownRefresh() {
- },
- onReachBottom() {
- this.get_product_list();
- }
- }
- </script>
- <style scoped lang="scss">
- .productList .search {
- width: 100%;
- height: 86rpx;
- padding-left: 23rpx;
- box-sizing: border-box;
- position: fixed;
- left: 0;
- top: 0;
- z-index: 9;
- background-color: var(--view-theme);
- }
- .productList .search .input {
- width: 640rpx;
- height: 60rpx;
- background-color: #fff;
- border-radius: 50rpx;
- padding: 0 20rpx;
- box-sizing: border-box;
- }
- .productList .search .input input {
- width: 548rpx;
- height: 100%;
- font-size: 26rpx;
- }
- .productList .search .input .placeholder {
- color: #999;
- }
- .productList .search .input .iconfont {
- font-size: 35rpx;
- color: #555;
- }
- .productList .search .icon-pailie,
- .productList .search .icon-tupianpailie {
- color: #fff;
- width: 62rpx;
- font-size: 40rpx;
- height: 86rpx;
- line-height: 86rpx;
- }
- .productList .nav {
- height: 86rpx;
- color: #454545;
- position: fixed;
- left: 0;
- width: 100%;
- font-size: 28rpx;
- background-color: #fff;
- margin-top: 86rpx;
- top: 0;
- z-index: 9;
- }
- .productList .nav .item {
- width: 33%;
- text-align: center;
- &.font-num{
- font-weight: bold;
- }
- }
- .productList .nav .item image {
- width: 15rpx;
- height: 19rpx;
- margin-left: 10rpx;
- }
- .productList .list {
- padding: 0 20rpx 20rpx;
- margin-top: 172rpx;
-
- }
- .productList .list.on {
- background-color: #fff;
- border-top: 1px solid #f6f6f6;
- }
- .productList .list .item {
- width: 345rpx;
- margin-top: 20rpx;
- background-color: #fff;
- border-radius: 20rpx;
- }
- .productList .list .item.on {
- width: 100%;
- display: flex;
- border-bottom: 1rpx solid #f6f6f6;
- padding: 30rpx 0;
- margin: 0;
- }
- .productList .list .item .pictrue {
- position: relative;
- width: 100%;
- height: 345rpx;
- .sell_out {
- display: flex;
- width: 150rpx;
- height: 150rpx;
- align-items: center;
- justify-content: center;
- border-radius: 100%;
- background: rgba(0,0,0,.6);
- color: #fff;
- font-size: 30rpx;
- position: absolute;
- top: 50%;
- left: 50%;
- margin: -75rpx 0 0 -75rpx;
- &::before{
- content: "";
- display: block;
- width: 140rpx;
- height: 140rpx;
- border-radius: 100%;
- border: 1px dashed #fff;
- position: absolute;
- top: 5rpx;
- left: 5rpx;
- }
- &.on{
- width: 110rpx;
- height: 110rpx;
- margin: -55rpx 0 0 -55rpx;
- &::before{
- width: 100rpx;
- height: 100rpx;
- }
- }
- }
- }
- .productList .list .item .pictrue.on {
- width: 180rpx;
- height: 180rpx;
- }
- .productList .list .item .pictrue image {
- width: 100%;
- height: 100%;
- border-radius: 20rpx 20rpx 0 0;
- }
- .productList .list .item .pictrue image.on {
- border-radius: 6rpx;
- }
- .productList .list .item .text {
- padding: 20rpx 17rpx 26rpx 17rpx;
- font-size: 30rpx;
- color: #222;
- }
- .productList .list .item .text.on {
- width: 508rpx;
- padding: 0 0 0 22rpx;
- .name{
- height: 74rpx;
- }
- }
- .productList .list .item .text .money {
- font-size: 22rpx;
- margin-top: 8rpx;
- }
- .productList .list .item .text .money.on {
- margin-top: 50rpx;
- }
- .productList .list .item .text .money .num {
- font-size: 34rpx;
- }
- .productList .list .item .text .vip {
- font-size: 22rpx;
- margin-top: 20rpx;
- .sales {
- font-size: 22rpx;
- color: var(--view-theme);
- }
- }
- .productList .list .item .price-count{
- display: flex;
- margin-top: 8rpx;
- align-items: baseline;
- .price-box {
- font-size: 22rpx;
- color: var(--view-theme);
- text{
- font-size: 34rpx;
- }
- }
- .image{
- width: 26rpx;
- height: 26rpx;
- margin-right: 10rpx;
- border-radius: 0;
- }
- }
- .productList .list .item .exchange {
- font-size: 24rpx;
- margin-top: 18rpx;
- color: #737373;
- }
- .productList .list .item .text .vip.on {
- margin-top: 50rpx;
- display: flex;
- justify-content: space-between;
- }
- .productList .list .item .text .vip .vip-money {
- font-size: 24rpx;
- color: #282828;
- font-weight: bold;
- }
- .productList .list .item .text .vip .vip-money image {
- width: 56rpx;
- height: 20rpx;
- margin-left: 4rpx;
- }
- .noCommodity {
- background-color: #fff;
- padding-bottom: 30rpx;
- .emptyBox{
- text-align: center;
- margin-top: 40rpx;
- .tips{
- color: #aaa;
- font-size: 26rpx;
- }
- image {
- width: 414rpx;
- height: 304rpx;
- }
- }
- }
- </style>
|