商城商品列表

This commit is contained in:
itgaojian163 2023-02-12 19:42:12 +08:00
parent 0d6c323a5a
commit 339fada3e1
22 changed files with 490 additions and 14 deletions

2
app.js
View File

@ -16,7 +16,9 @@ App({
liveUrl: restAjax.baseUrl,
liveRecordUrl: restAjax.baseUrl,
socialUrl: restAjax.baseUrl,
shopUrl: restAjax.url + "xzshop",
restAjax: restAjax,
shopImgUrl: restAjax.url + "xzshop/route/file/download/true/",
dialog: dialog,
onLaunch: function () {
// 展示本地存储能力

View File

@ -37,8 +37,15 @@
"pages/myActivity/myActivity",
"pages/myVolunteerTeam/myVolunteerTeam",
"pages/myVolunteerActivity/myVolunteerActivity",
"pages/serviceActivityDetail/serviceActivityDetail"
"pages/serviceActivityDetail/serviceActivityDetail",
"pages/shop/shopcategory"
],
"subPackages": [{
"root": "subpages/goodslist",
"pages": [
"goodslist"
]
}],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#9F1512",
@ -68,9 +75,9 @@
"selectedIconPath": "images/venue-on.png"
},
{
"pagePath": "pages/heritage/heritage",
"pagePath": "pages/shop/shopcategory",
"iconPath": "images/culture.png",
"text": "文化",
"text": "商城",
"selectedIconPath": "images/culture-on.png"
},
{
@ -81,6 +88,9 @@
}
]
},
"usingComponents": {
"page-loading": "/components/loading/pageloading"
},
"permission": {
"scope.userLocation": {
"desc": "你的位置信息将用于您当前所在位置"

View File

@ -0,0 +1,23 @@
// components/loading/pageloading.js
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})

View File

@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@ -0,0 +1,5 @@
<!--components/loading/pageloading.wxml-->
<view class="page-loading-box">
<image src="/images/loading-small.gif" mode="scaleToFill"></image>
<view class="text">加载中...</view>
</view>

View File

@ -0,0 +1,23 @@
/* components/loading/pageloading.wxss */
.page-loading-box {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(255, 255, 255, 1);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.page-loading-box image {
width: 128rpx;
height: 128rpx;
}
.page-loading-box .text {
margin-top: 20rpx;
font-size: 28rpx;
}

BIN
images/ic_empty_data.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 944 B

BIN
images/loading-small.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

View File

@ -85,7 +85,7 @@
</view>
<view class="news-box transverse-news" bindtap="goNewsDetail" data-template-record-url="{{item.templateRecordUrl}}" wx:if="{{item.typesettingCode == 'key_2'}}">
<view class="news-row-img">
<image src="{{news.newsUrl}}/route/file/download/true/{{coverItem.contentCoverId}}" wx:for="{{item.newsContentCoverList}}" wx:for-item="coverItem" wx:key="coverItem"></image>
<image src="{{news.newsUrl}}/route/file/download/true/{{item.newsContentCoverList[0].contentCoverId}}"></image>
</view>
<view class="news-row-info">
<view class="news-title">{{item.newsContentTitle}}</view>
@ -104,13 +104,13 @@
</view>
</view>
<view class="news-row-img">
<image src="{{news.newsUrl}}/route/file/download/true/{{coverItem.contentCoverId}}" wx:for="{{item.newsContentCoverList}}" wx:for-item="coverItem" wx:key="coverItem"></image>
<image src="{{news.newsUrl}}/route/file/download/true/{{item.newsContentCoverList[0].contentCoverId}}" ></image>
</view>
</view>
<view class="news-box" bindtap="goNewsDetail" data-template-record-url="{{item.templateRecordUrl}}" wx:if="{{item.typesettingCode == 'key_4'}}">
<view class="news-title">{{item.newsContentTitle}}</view>
<view class="news-big-pic">
<image src="{{news.newsUrl}}/route/file/download/true/{{coverItem.contentCoverId}}" wx:for="{{item.newsContentCoverList}}" wx:for-item="coverItem" wx:key="coverItem"></image>
<image src="{{news.newsUrl}}/route/file/download/true/{{item.newsContentCoverList[0].contentCoverId}}" ></image>
</view>
<view class="news-info">
<text>来源:{{item.newsContentResource}}</text>

View File

@ -94,6 +94,7 @@
}
.news-big-pic image{
width: 100%;
height: 380rpx;
}
.news-small-pic image{
width: 30%;

View File

@ -38,7 +38,7 @@
</view>
<view class="news-box transverse-news" bindtap="goNewsDetail" data-template-record-url="{{item.templateRecordUrl}}" wx:if="{{item.typesettingCode == 'key_2'}}">
<view class="news-row-img">
<image src="{{news.newsUrl}}/route/file/download/true/{{coverItem.contentCoverId}}" wx:for="{{item.newsContentCoverList}}" wx:for-item="coverItem" wx:key="coverItem"></image>
<image src="{{news.newsUrl}}/route/file/download/true/{{item.newsContentCoverList[0].contentCoverId}}"></image>
</view>
<view class="news-row-info">
<view class="news-title">{{item.newsContentTitle}}</view>
@ -57,13 +57,13 @@
</view>
</view>
<view class="news-row-img">
<image src="{{news.newsUrl}}/route/file/download/true/{{coverItem.contentCoverId}}" wx:for="{{item.newsContentCoverList}}" wx:for-item="coverItem" wx:key="coverItem"></image>
<image src="{{news.newsUrl}}/route/file/download/true/{{item.newsContentCoverList[0].contentCoverId}}"></image>
</view>
</view>
<view class="news-box" bindtap="goNewsDetail" data-template-record-url="{{item.templateRecordUrl}}" wx:if="{{item.typesettingCode == 'key_4'}}">
<view class="news-title">{{item.newsContentTitle}}</view>
<view class="news-big-pic">
<image src="{{news.newsUrl}}/route/file/download/true/{{coverItem.contentCoverId}}" wx:for="{{item.newsContentCoverList}}" wx:for-item="coverItem" wx:key="coverItem"></image>
<image src="{{news.newsUrl}}/route/file/download/true/{{item.newsContentCoverList[0].contentCoverId}}"></image>
</view>
<view class="news-info">
<text>来源:{{item.newsContentResource}}</text>

View File

@ -131,6 +131,7 @@
}
.news-big-pic image{
width: 100%;
height: 380rpx;
}
.news-big-pic image.play-btn{
position: absolute;

View File

@ -0,0 +1,57 @@
// pages/shop/shopcat.js
var app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
categoryOneList: [],
categorySeconList: [],
currentIndex: 0,
isHidePageLoading: false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getCategroyList();
},
getCategroyList() {
var _self = this
app.restAjax.get(app.restAjax.path('{shopUrl}/app/category/listztreerelease', [app.shopUrl]), null, null, function (code, data) {
if (data.length == 0) {
app.dialog.msg('暂无数据');
return;
}
console.log(data)
_self.setData({
categoryOneList: data,
categorySeconList: data[0].subList,
isHidePageLoading: true
})
}, function (code, data) {
app.dialog.msg(data.msg);
_self.setData({
isHidePageLoading: true
})
}, function () {
wx.hideLoading();
})
},
chooseOne(event) {
var index = event.currentTarget.dataset.index
var _self = this;
this.setData({
currentIndex: index,
categorySeconList: _self.data.categoryOneList[index].subList
})
},
goList(e) {
var id = e.currentTarget.dataset.id
wx.navigateTo({
url: '/subpages/goodslist/goodslist?id=' + id,
})
}
})

View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@ -0,0 +1,27 @@
<view class="container-box" wx:if="{{isHidePageLoading}}">
<view class="left">
<view bindtap="chooseOne" data-index="{{index}}" class="{{currentIndex==index ? 'category-item-active':'category-item-default'}}" wx:for="{{categoryOneList}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view wx:if="{{currentIndex==index}}" class="line"></view>
<view class="category-one-name">{{item.name}}</view>
</view>
</view>
<view class="right">
<view class="category-card" wx:for="{{categorySeconList}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="category-two-name" bindtap="goList" data-id="{{item.id}}">
<view>{{item.name}}</view>
<view>></view>
</view>
<view class="category-thrid-box" wx:if="{{item.subList.length > 0}}">
<view class="category-thrid-item" wx:for="{{item.subList}}" wx:for-index="i" wx:for-item="it" wx:key="i" bindtap="goList" data-id="{{it.id}}">
<image src="../../images/avatar.png"></image>
<view>{{it.name}}</view>
</view>
</view>
<view class="category-empty" wx:else>
<image src="../../images/ic_empty_data.png" mode="scaleToFill"></image>
<text>暂无数据</text>
</view>
</view>
</view>
</view>
<page-loading wx:else></page-loading>

View File

@ -0,0 +1,112 @@
/* pages/shop/shopcat.wxss */
page {
height: 100%;
background: #f6f6f6;
}
.container-box {
display: flex;
flex-direction: row;
width: 100%;
height: 100%;
}
.container-box .left {
display: flex;
flex-direction: column;
width: 35%;
height: 100%;
margin-top: 10rpx;
}
.category-item-default {
display: flex;
flex-direction: row;
padding: 10rpx 0rpx 5rpx 2rpx;
width: 100%;
}
.category-item-active {
display: flex;
flex-direction: row;
padding: 10rpx 0rpx 5rpx 2rpx;
background: white;
width: 100%;
}
.category-one-name {
margin-left: 20rpx;
padding: 10rpx 0rpx;
flex: 1;
}
.line {
background: #e70101;
width: 10rpx;
height: 100%;
}
.container-box .right {
display: flex;
flex-direction: column;
width: 65%;
}
.category-card {
margin: 10rpx 10rpx 10rpx 0rpx;
border-radius: 20rpx;
min-height: 300rpx;
background-color: white;
box-shadow: 5rpx 5rpx 5rpx 5rpx rgba(0, 0, 0, 0, 1);
padding: 10rpx;
}
.category-two-name {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 10rpx;
}
.category-thrid-box {
display: flex;
flex-direction: row;
margin-top: 20rpx;
justify-content: flex-start;
align-items: center;
}
.category-thrid-item {
width: 33%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: 30rpx;
}
.category-thrid-item image {
width: 96rpx;
height: 96rpx;
}
.category-empty {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
align-self: center;
font-size: 30rpx;
}
.category-empty image {
width: 96rpx;
height: 66rpx;
}

View File

@ -0,0 +1,4 @@
{
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"libVersion": "2.30.0"
}

View File

@ -0,0 +1,73 @@
// pages/goodslist/goodslist.js
var app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
id: ""
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
id: options.id,
page: 1,
rows: 10,
keywords: "",
goodsList: [],
imgUrl: app.shopImgUrl,
hidePageLoading: false
})
this.getGoodsList();
},
getGoodsList() {
var _self = this
var info = {
'page': _self.data.page,
'rows': _self.data.rows,
'categoryId': _self.data.id,
'keywords': _self.data.keywords
};
app.restAjax.get(app.restAjax.path('{shopUrl}/app/shopgoods/solrrelease', [app.shopUrl]), info, null, function (code, data) {
if (data.rows.length == 0) {
app.dialog.msg('暂无数据');
return;
}
_self.setData({
goodsList: _self.data.goodsList.concat(data.rows),
hidePageLoading: true
})
console.log(_self.data.goodsList)
wx.stopPullDownRefresh()
}, function (code, data) {
app.dialog.msg(data.msg);
wx.stopPullDownRefresh()
_self.setData({
hidePageLoading: true
})
}, function () {
wx.hideLoading();
wx.stopPullDownRefresh()
})
},
//下拉刷新
onPullDownRefresh() {
this.setData({
page: 1,
goodsList: []
})
this.getGoodsList()
},
//加载更多
onReachBottom() {
var _self = this;
_self.setData({
page: _self.data.page += 1
})
_self.getGoodsList()
}
})

View File

@ -0,0 +1,8 @@
{
"usingComponents": {},
"navigationBarTitleText": "商品",
"enablePullDownRefresh": true,
"backgroundColor": "#efefef",
"backgroundTextStyle": "dark",
"onReachBottomDistance": 150
}

View File

@ -0,0 +1,26 @@
<!--pages/goodslist/goodslist.wxml-->
<view wx:if="{{hidePageLoading}}">
<view class="search-box">
<input placeholder="请输入要查询的关键字" />
<view class="btn">搜索</view>
</view>
<view class="container-box">
<view class="goods-item" wx:for="{{goodsList}}" wx:for-item="item" wx:for-index="index" wx:key="index">
<image src="{{imgUrl+item.goodsIcon}}"></image>
<view class="goods-content">
<view class="goods-name">{{item.goodsName}}</view>
<view class="goods-price">¥ {{item.goodsPrice}}</view>
<view class="goods-type">
<view class="type-item">销量:{{item.goodsSalesVolume}}</view>
<view class="type-item">评分:{{item.goodStar}}</view>
<view class="type-item">{{item.goodsNotFreight ==1 ? '不包邮':'包邮'}}</view>
</view>
<view class="shop-name">
<view>{{item.shopName}}</view>
<image class="shop-icon" src="/images/address.png" mode="scaleToFill"></image>
</view>
</view>
</view>
</view>
</view>
<page-loading wx:else></page-loading>

View File

@ -0,0 +1,96 @@
/* pages/goodslist/goodslist.wxss */
.search-box {
position: fixed;
top: 0;
left: 0;
width: 100%;
padding: 20rpx 15rpx;
display: flex;
flex-direction: row;
background: #ffffff;
}
.search-box input {
padding: 10rpx;
background: #f2f2f2;
border-radius: 20rpx;
width: 80%;
font-size: 28rpx;
}
.search-box .btn {
padding: 10rpx;
color: black;
}
.container-box {
margin-top: 110rpx;
}
.goods-item {
display: flex;
flex-direction: row;
margin: 20rpx;
}
.goods-content {
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-start;
padding: 0rpx 10rpx;
}
.goods-name {
font-size: 28rpx;
color: #000000;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
.goods-price {
font-size: 40rpx;
color: #e70606;
margin-top: 20rpx;
}
.goods-type {
display: flex;
flex-direction: row;
margin-top: 10rpx;
}
.type-item {
background: #f2f2f2;
color: #e70606;
padding: 10rpx;
font-size: 20rpx;
}
.type-item:nth-of-type(n+2) {
margin-left: 20rpx;
}
.shop-name {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
font-size: 28rpx;
color: #5a5a5a;
margin-top: 20rpx;
}
.shop-name .shop-icon {
width: 30rpx;
height: 30rpx;
}
.goods-item image {
width: 240rpx;
height: 200rpx;
}

View File

@ -225,4 +225,5 @@ module.exports.params = getParamsArg;
module.exports.path = buildPath;
module.exports.escape = escape;
module.exports.file = postFile;
module.exports.baseUrl='http://49.233.36.36:58099/xzszwhy';
module.exports.baseUrl='http://v3.xzszwhy.cn/xzszwhy';
module.exports.url="http://v3.xzszwhy.cn/"