version/0412
wangdong 9 months ago
parent 3371b2b3d8
commit 1437dcbe4d
  1. 1
      pages/goods/list.vue
  2. 11
      pages/search/index.vue
  3. 8
      pages/shopList/index.vue
  4. 138
      pages/shopList/shopPage.vue
  5. 43
      pages/squareDynamic/index.vue

@ -411,6 +411,7 @@
sortPrice: Number(app.sortPrice),
categoryId: (app.options.categoryId || app.options.categoryId != undefined) ? app.options
.categoryId : 0,
merchantId: app.options.merchantId,
// goodsName: app.options.search || '',
page: pageNo,
keywords: keywords.length > 0 ? keywords.join(',') : '',

@ -85,6 +85,7 @@
page: 1,
goodsList: [],
category_id:0,
merchantId: '',
isHot: true,
}
},
@ -98,7 +99,8 @@
},
onLoad(op) {
this.category_id=op.category_id
this.category_id=op.category_id
this.merchantId = op.merchantId
this.getHot()
this.chartsGoodsJingHandle()
},
@ -150,7 +152,7 @@
},
searchGoods(item) {
uni.navigateTo({
url: '/pages/goods/list?search=' + item
url: `/pages/goods/list?search=${item}&merchantId=${this.merchantId}`
})
},
getSearchInfo() {
@ -159,9 +161,10 @@
this.searchList.push(this.searchValue)
this.searchList = Array.from(new Set(this.searchList));
uni.setStorageSync('searchList', this.searchList)
}
}
console.log(this.merchantId);
uni.redirectTo({
url: '/pages/goods/list?search=' + this.searchValue+'&categoryId=' + this.category_id
url: `/pages/goods/list?search=${this.searchValue}&categoryId=${this.category_id}&merchantId=${this.merchantId}`
})
},
chartsGoodsJingHandle() {

@ -31,7 +31,7 @@
<view class="toShop" @click="toShop(item)">进店</view>
</view>
<view v-if="item.goodsInfo && item.goodsInfo.data && item.goodsInfo.data.length > 0" class="shop-goods-list">
<view v-for="(good, k) in item.goodsInfo.data" :key="k" class="good-item">
<view v-for="(good, k) in item.goodsInfo.data" :key="k" class="good-item" @click="onGoodDetail(good.goods_id)">
<image :src="good.goods_image" mode="aspectFill" class="good-pic"></image>
<view class="price">{{ good.goods_price_min }}</view>
</view>
@ -163,6 +163,12 @@
url: `/pages/shopList/shopPage?id=${item.merchant_id}`,
})
},
//
onGoodDetail(goodsId) {
this.$navTo('pages/goods/detail', {
goodsId
})
},
},
};
</script>

@ -57,19 +57,19 @@
</view>
<view class="content">
<view class="filter-box">
<view v-for="(item, index) in filterList" :key="index" class="filter-item" :class="{ active: activeFilter === item}" @click="changeFilter(item)">
{{ item }}
<text v-if="item === '价格'" class="down" :class="{ on: activeFilter === '价格' && filterDirection === 'DESC'}" style="top: 22rpx;"></text>
<text v-if="item === '价格'" class="up" :class="{ on: activeFilter === '价格' && filterDirection === 'ASC'}"></text>
<view v-for="(item, index) in filterList" :key="index" class="filter-item" :class="{ active: activeFilter === item.value}" @click="changeFilter(item.value)">
{{ item.name }}
<text v-if="item.value === 'price'" class="down" :class="{ on: activeFilter === 'price' && filterDirection === 'DESC'}" style="top: 22rpx;"></text>
<text v-if="item.value === 'price'" class="up" :class="{ on: activeFilter === 'price' && filterDirection === 'ASC'}"></text>
</view>
</view>
<view class="goods-list">
<view v-for="(item, index) in goods" :key="index" class="good">
<image :src="item.pic" mode="aspectFill"></image>
<view class="name">{{ item.name }}</view>
<view v-for="(item, index) in goods" :key="index" class="good" @click="onGoodDetail(item.goods_id)">
<image :src="item.goods_image" mode="aspectFill"></image>
<view class="name">{{ item.goods_name }}</view>
<view class="price">
<text class="now-price">{{ item.price }}</text>
<text class="origin-price">{{ item.originPrice }}</text>
<text class="now-price">¥{{ item.goods_price_min>0?Number(item.goods_price_min):0.00 }}</text>
<text v-if="item.line_price_min > 0" class="origin-price">¥{{ item.line_price_min>0?Number(item.line_price_min):'' }}</text>
</view>
</view>
</view>
@ -96,6 +96,7 @@
import * as Api from '@/api/shop/index';
import * as cstegory from '@/api/category'
import * as GoodsApi from '@/api/goods'
import { debounce } from 'lodash';
export default {
data() {
@ -106,91 +107,24 @@
},
id: '',
scrollTop: 0,
shopDetail: {
logo: '',
name: '小米旗舰店',
label: '商家直营 正品保障'
},
goodsCate: [
{ id: 1, name: '热门分类', children: [{ id: 1, name: '二级分类1'}, { id: 1, name: '二级分类2'}, { id: 1, name: '二级分类3'}, { id: 1, name: '二级分类4'}, { id: 1, name: '二级分类5'}]},
{ id: 1, name: '手机', children: [{ id: 1, name: '二级分类1'}, { id: 1, name: '二级分类2'}, { id: 1, name: '二级分类3'}, { id: 1, name: '二级分类4'}, { id: 1, name: '二级分类5'}]},
{ id: 1, name: '平板', children: [{ id: 1, name: '二级分类1'}, { id: 1, name: '二级分类2'}, { id: 1, name: '二级分类3'}, { id: 1, name: '二级分类4'}, { id: 1, name: '二级分类5'}]},
{ id: 1, name: '电脑', children: [{ id: 1, name: '二级分类1'}, { id: 1, name: '二级分类2'}, { id: 1, name: '二级分类3'}, { id: 1, name: '二级分类4'}, { id: 1, name: '二级分类5'}]},
{ id: 1, name: '冰箱', children: [{ id: 1, name: '二级分类1'}, { id: 1, name: '二级分类2'}, { id: 1, name: '二级分类3'}, { id: 1, name: '二级分类4'}, { id: 1, name: '二级分类5'}]},
],
shopDetail: {},
goodsCate: [],
firstCate: '',
secondCate: '',
activeFilter: '综合',
activeFilter: 'all',
filterDirection: 'ASC',
filterList: ['综合', '价格', '折扣', '销量'],
filterList: [
{ name: '综合', value: 'all' },
{ name: '价格', value: 'price' },
{ name: '折扣', value: 'discount' },
{ name: '销量', value: 'sales' }],
isTop: false,
page: 1,
limit: 10,
loadTitle: '',
loading: false,
finished: true,
goods: [
// {
// pic: '',
// name: '',
// price: 208.00,
// originPrice: 809,
// },
// {
// pic: '',
// name: '',
// price: 208.00,
// originPrice: 809,
// },
// {
// pic: '',
// name: '',
// price: 208.00,
// originPrice: 809,
// },
// {
// pic: '',
// name: '',
// price: 208.00,
// originPrice: 809
// },
// {
// pic: '',
// name: '',
// price: 208.00,
// originPrice: 809,
// },
// {
// pic: '',
// name: '',
// price: 208.00,
// originPrice: 809,
// },
// {
// pic: '',
// name: '',
// price: 208.00,
// originPrice: 809,
// },
// {
// pic: '',
// name: '',
// price: 208.00,
// originPrice: 809,
// },
// {
// pic: '',
// name: '',
// price: 208.00,
// originPrice: 809,
// },
// {
// pic: '',
// name: '',
// price: 208.00,
// originPrice: 809,
// },
]
goods: []
};
},
// computed: {
@ -203,8 +137,14 @@
// }
// },
watch: {
firstCate() {
this.goods = [];
this.page = 1;
this.loading = false;
this.finished = false;
this.getGoodsList();
},
secondCate() {
console.log(this.secondCate);
this.goods = [];
this.page = 1;
this.loading = false;
@ -234,16 +174,21 @@
search() {
//
uni.navigateTo({
url: '/pages/search/index'
url: `/pages/search/index?merchantId=${this.id}`
})
},
changeFilter(item) {
if (item !== this.activeFilter) {
this.activeFilter = item;
this.filterDirection = 'ASC';
} else if (item === '价格') {
} else if (item === 'price') {
this.filterDirection = this.filterDirection === 'ASC' ? 'DESC' : 'ASC';
}
this.goods = [];
this.page = 1;
this.loading = false;
this.finished = false;
this.getGoodsList();
},
openScrollTo() {
uni.pageScrollTo({
@ -284,18 +229,17 @@
* 获取商品列表
* @param {number} pageNo 页码
*/
getGoodsList() {
getGoodsList: debounce(function() {
if (this.loading || this.finished) {
return;
}
this.loadTitle = "";
const param = {
sortType: this.activeFilter,
sortPrice: this.filterDirection === 'ASC' ? 1 : 0,
categoryId: this.secondCate,
// goodsName: app.options.search || '',
sortPrice: this.filterDirection === 'DESC' ? 1 : 0,
categoryId: this.secondCate || this.firstCate,
merchantId: this.id,
page: this.page++,
pageSize: 10
}
GoodsApi.list(param)
.then(result => {
@ -306,12 +250,18 @@
this.finished = data.length < 10;
this.loadTitle = this.finished ? "已全部加载完" : "上拉加载更多";
})
},
}, 500),
toCart() {
uni.switchTab({
url: '/pages/cart/index'
})
},
//
onGoodDetail(goodsId) {
this.$navTo('pages/goods/detail', {
goodsId
})
},
}
};
</script>

@ -22,7 +22,7 @@
<view v-if="!showFullCont.includes(index) && calcContentWidth(item.content).isSplit" class="show-more" @click="showFullCont.push(index)">全文</view>
</view>
<view v-if="item.imgs && item.imgs.length > 0" class="pic-list">
<image v-for="(pic, k) in item.imgs" :key="k" :src="pic.external_url" mode="aspectFill"></image>
<image v-for="(pic, k) in item.imgs" :key="k" :src="pic.external_url" mode="aspectFill" @click="previewImage(k, item.imgs)"></image>
</view>
<view class="btns">
<view class="btn" v-if="item.content" @click="clipCont(item.content)">
@ -72,26 +72,7 @@
return {
tabList: ['推荐', '精选', '晒单', '日常', '文章'],
activeTab: '推荐',
dynamicList: [
// {
// avatar: '',
// name: '',
// time: '11:23',
// content: '绿 ',
// pic: ['', '', '', '', ''],
// likeNum: 1000,
// isLike: true,
// },
// {
// avatar: '',
// name: '',
// time: '412 11:21',
// content: '绿 ',
// pic: ['', '', '', '', ''],
// likeNum: 1000,
// isLike: false,
// },
],
dynamicList: [],
page: 1,
limit: 10,
loadTitle: '',
@ -124,7 +105,6 @@
frontColor: '#000000',
backgroundColor: '#E7F1FC',
});
this.getDynamicList();
const sys = uni.getSystemInfoSync();
this.windowWidth = sys.windowWidth;
this.windowHeight = sys.windowHeight;
@ -139,6 +119,13 @@
this.offsetHeight = data.height / 2;
}).exec();
},
onShow() {
this.loading = false;
this.finished = false;
this.page = 1;
this.dynamicList = [];
this.getDynamicList();
},
methods: {
async getDynamicList() {
if (this.loading || this.finished) {
@ -298,6 +285,18 @@
this.isMove = false;
},
previewImage(idx, images) {
console.log(idx, images);
const arr = [];
images.forEach(v => {
arr.push(v.external_url);
})
uni.previewImage({
current: idx,
urls: arr,
})
},
},
};
</script>

Loading…
Cancel
Save