Initial Commit
This commit is contained in:
259
pages/integral/integral.js
Normal file
259
pages/integral/integral.js
Normal file
@ -0,0 +1,259 @@
|
||||
// pages/integral/integral.js
|
||||
const app = getApp()
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
bgImg: app.globalData.bgImg,
|
||||
statusBarHeight: app.globalData.statusBarHeight,
|
||||
goods: [],
|
||||
title: '三品慧采',
|
||||
topImg: '', //头部图片
|
||||
page: 1,
|
||||
num: 10,
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
if (options.title) {
|
||||
this.setData({
|
||||
title: options.title
|
||||
})
|
||||
if (options.title == '积分专区') {
|
||||
this.topImg({
|
||||
type: 3
|
||||
})
|
||||
this.goodsList()
|
||||
}
|
||||
if (options.title == '热卖专区') {
|
||||
this.topImg({
|
||||
type: 4
|
||||
})
|
||||
this.goodsList2({
|
||||
type: 1
|
||||
})
|
||||
}
|
||||
if (options.title == '节令甄选') {
|
||||
this.topImg({
|
||||
type: 5
|
||||
})
|
||||
this.goodsList2({
|
||||
type: 2
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
//头部图片 积分3 热卖4 节令5
|
||||
topImg(options) {
|
||||
console.log(options)
|
||||
wx.showLoading({
|
||||
title: '加载中',
|
||||
})
|
||||
wx.request({
|
||||
url: app.globalData.ip + '/wisdommining/api/banner/getBanner',
|
||||
method: 'GET',
|
||||
header: {
|
||||
"content-type": "application/x-www-form-urlencoded",
|
||||
},
|
||||
data: {
|
||||
type: options.type
|
||||
},
|
||||
success: res => {
|
||||
console.log(res)
|
||||
wx.hideLoading()
|
||||
if (res.data.code == 1) {
|
||||
let topImg = res.data.value;
|
||||
this.setData({
|
||||
topImg: topImg
|
||||
})
|
||||
} else {
|
||||
wx.showModal({
|
||||
title: '获取数据失败!',
|
||||
content: res.data.message,
|
||||
showCancel: false,
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
//商品列表 积分
|
||||
goodsList: function (e) {
|
||||
wx.showLoading({
|
||||
title: '加载中',
|
||||
})
|
||||
wx.request({
|
||||
url: app.globalData.ip + '/wisdommining/api/goods/getIntegralGoods',
|
||||
method: 'GET',
|
||||
header: {
|
||||
"content-type": "application/x-www-form-urlencoded",
|
||||
},
|
||||
data: {
|
||||
page: this.data.page,
|
||||
num: this.data.num,
|
||||
},
|
||||
success: res => {
|
||||
console.log(res)
|
||||
wx.hideLoading()
|
||||
if (res.data.code == 1) {
|
||||
if (res.data.value.records.length > 0) {
|
||||
let goods = this.data.goods;
|
||||
for (let i = 0; i < res.data.value.records.length; i++) {
|
||||
goods.push(res.data.value.records[i])
|
||||
}
|
||||
this.setData({
|
||||
page: this.data.page + 1,
|
||||
goods: goods
|
||||
})
|
||||
} else {
|
||||
if (this.data.page != 1) {
|
||||
wx.showToast({
|
||||
title: '暂无更多~',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
} else {
|
||||
wx.showModal({
|
||||
title: '获取数据失败!',
|
||||
content: res.data.message,
|
||||
showCancel: false,
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
//商品列表 热卖 节令
|
||||
goodsList2(options) {
|
||||
wx.showLoading({
|
||||
title: '加载中',
|
||||
})
|
||||
wx.request({
|
||||
url: app.globalData.ip + '/wisdommining/api/goods/gethotGoods',
|
||||
method: 'GET',
|
||||
header: {
|
||||
"content-type": "application/x-www-form-urlencoded",
|
||||
},
|
||||
data: {
|
||||
type: options.type,
|
||||
userId: app.globalData.userId,
|
||||
page: this.data.page,
|
||||
num: this.data.num,
|
||||
},
|
||||
success: res => {
|
||||
console.log(res)
|
||||
wx.hideLoading()
|
||||
if (res.data.code == 1) {
|
||||
if (res.data.value.records.length > 0) {
|
||||
let goods = this.data.goods;
|
||||
for (let i = 0; i < res.data.value.records.length; i++) {
|
||||
goods.push(res.data.value.records[i])
|
||||
}
|
||||
this.setData({
|
||||
page: this.data.page + 1,
|
||||
goods: goods
|
||||
})
|
||||
} else {
|
||||
if (this.data.page != 1) {
|
||||
wx.showToast({
|
||||
title: '暂无更多~',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
} else {
|
||||
wx.showModal({
|
||||
title: '获取数据失败!',
|
||||
content: res.data.message,
|
||||
showCancel: false,
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
//返回
|
||||
back() {
|
||||
wx.navigateBack()
|
||||
},
|
||||
//积分类型选择
|
||||
type(e) {
|
||||
let index = e.currentTarget.dataset.index;
|
||||
this.setData({
|
||||
typeIndex: index
|
||||
})
|
||||
},
|
||||
//商品详情
|
||||
goodsDetails(e) {
|
||||
let id = e.currentTarget.dataset.id;
|
||||
if (this.data.title == '积分专区') {
|
||||
wx.navigateTo({
|
||||
url: '/pages/goodsDetails/goodsDetails?integral=1' + '&goodsId=' + id,
|
||||
})
|
||||
} else {
|
||||
wx.navigateTo({
|
||||
url: '/pages/goodsDetails/goodsDetails?goodsId=' + id,
|
||||
})
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
let title = this.data.title
|
||||
if (title == '积分专区') {
|
||||
this.goodsList()
|
||||
}
|
||||
if (title == '热卖专区') {
|
||||
this.goodsList2({
|
||||
type: 1
|
||||
})
|
||||
}
|
||||
if (title == '节令甄选') {
|
||||
this.goodsList2({
|
||||
type: 2
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
4
pages/integral/integral.json
Normal file
4
pages/integral/integral.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"navigationStyle":"custom"
|
||||
}
|
36
pages/integral/integral.wxml
Normal file
36
pages/integral/integral.wxml
Normal file
@ -0,0 +1,36 @@
|
||||
<!--pages/index/index.wxml-->
|
||||
<view class="top-all">
|
||||
<view class="top" style="background: url({{bgImg}}integral-top.png) no-repeat;background-size: 100%;padding-top:{{statusBarHeight}}px;">
|
||||
<view class="back-top">
|
||||
<view class="back display_A_C" catchtap="back">
|
||||
<image src="/icon/back-w.png"></image>
|
||||
</view>
|
||||
<view class="title">{{title}}</view>
|
||||
</view>
|
||||
<view class="bannner">
|
||||
<image src='{{topImg[0].bannerImage}}'></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="shop">
|
||||
<image src="/icon/goods_2.png"></image>
|
||||
</view>
|
||||
<view class="cont-all">
|
||||
<view class="cont" catchtap="goodsDetails" wx:for='{{goods}}' data-id='{{item.id}}' wx:key='index'>
|
||||
<image class="goods-img" src="{{item.goodsPhoto}}"></image>
|
||||
<view class="goods-name GStitleTwo">{{item.goodsName}}</view>
|
||||
<view class="goods-price">
|
||||
<view class="price" wx:if='{{title=="积分专区"}}'>{{item.wisdGoodsSpecList[0].specPrice}}积分</view>
|
||||
<view class="price" wx:if='{{title!="积分专区"}}'>
|
||||
¥{{item.wisdGoodsSpecList[0].specBulyPrice==null?item.wisdGoodsSpecList[0].specPrice:item.wisdGoodsSpecList[0].specBulyPrice}}
|
||||
<text class="price-text2">¥{{item.wisdGoodsSpecList[0].originalPrice}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="goods-sales">
|
||||
已出售{{item.goodsSales}}件
|
||||
<view class="exchange" wx:if='{{title=="积分专区"}}'>兑换</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="empty" wx:if='{{goods.length==0}}'>暂无商品~</view>
|
||||
</view>
|
153
pages/integral/integral.wxss
Normal file
153
pages/integral/integral.wxss
Normal file
@ -0,0 +1,153 @@
|
||||
/* pages/index/index.wxss */
|
||||
page {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
.top-all{
|
||||
border-radius: 0px 0px 40rpx 40rpx;
|
||||
}
|
||||
.top {
|
||||
width: 690rpx;
|
||||
padding: 40rpx 30rpx 0;
|
||||
}
|
||||
.back-top{
|
||||
position: relative;
|
||||
}
|
||||
.back{
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
height: 90rpx;
|
||||
}
|
||||
.back image{
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
margin-right: 50rpx;
|
||||
}
|
||||
.title {
|
||||
font-size: 36rpx;
|
||||
color: #ffffff;
|
||||
line-height: 90rpx;
|
||||
height: 90rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.bannner {
|
||||
width: 690rpx;
|
||||
height: 280rpx;
|
||||
border-radius: 20rpx;
|
||||
margin:30rpx auto;
|
||||
}
|
||||
|
||||
.bannner image {
|
||||
width: 690rpx;
|
||||
height: 280rpx;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
.shop{
|
||||
width: 750rpx;
|
||||
height: 400rpx;
|
||||
background-image: linear-gradient(180deg,
|
||||
rgba(255,255,255,1) 0%,
|
||||
rgba(255,255,255,0) 100%);
|
||||
border-radius: 20rpx 20rpx 0px 0px;
|
||||
}
|
||||
.shop image{
|
||||
width: 750rpx;
|
||||
height: 100rpx;
|
||||
border-radius: 20rpx 20rpx 0px 0px;
|
||||
}
|
||||
.goods{
|
||||
width: 690rpx;
|
||||
background-image: linear-gradient(180deg,
|
||||
#ffffff 0%,
|
||||
#f5f5f5 44%,
|
||||
#f5f5f5 100%);
|
||||
border-radius: 40rpx 40rpx 0px 0px;
|
||||
margin-top: 30rpx;
|
||||
padding: 30rpx;
|
||||
}
|
||||
|
||||
.cont-all{
|
||||
width: 690rpx;
|
||||
margin:0 auto 30rpx;
|
||||
position: relative;
|
||||
top: -300rpx;
|
||||
z-index: 2;
|
||||
}
|
||||
.cont-all::after{
|
||||
display: block;
|
||||
content: '';
|
||||
clear: both;
|
||||
}
|
||||
.cont{
|
||||
float: left;
|
||||
width: 330rpx;
|
||||
background-color: #ffffff;
|
||||
border-radius: 10rpx;
|
||||
margin:30rpx 30rpx 0 0;
|
||||
}
|
||||
.cont:nth-child(2n){
|
||||
margin-right: 0;
|
||||
}
|
||||
.goods-img{
|
||||
width: 330rpx;
|
||||
height: 330rpx;
|
||||
}
|
||||
.goods-name{
|
||||
width: 280rpx;
|
||||
padding:0 25rpx;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
margin-top: 25rpx;
|
||||
}
|
||||
.goods-price{
|
||||
margin:0 20rpx;
|
||||
padding: 18rpx 0;
|
||||
width:290rpx;
|
||||
border-bottom: 1rpx solid #e5e5e5;
|
||||
}
|
||||
.price{
|
||||
font-size: 36rpx;
|
||||
color: #ee7b1e;
|
||||
}
|
||||
.price text{
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.original-price{
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
text-decoration: line-through;
|
||||
}
|
||||
.goods-sales{
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
line-height:72rpx;
|
||||
padding:0 25rpx;
|
||||
position: relative;
|
||||
}
|
||||
.exchange{
|
||||
position: absolute;
|
||||
top: 20rpx;
|
||||
right:16rpx;
|
||||
width: 100rpx;
|
||||
height: 36rpx;
|
||||
line-height: 36rpx;
|
||||
background-color: #ee7b1e;
|
||||
border-radius: 18rpx;
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
color: #ffffff;
|
||||
}
|
||||
.empty{
|
||||
text-align: center;
|
||||
margin: 250rpx auto;
|
||||
font-size: 28rpx;
|
||||
letter-spacing: 3rpx;
|
||||
color: #bababa;
|
||||
}
|
||||
|
||||
.price-text2{
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
text-decoration: line-through;
|
||||
}
|
Reference in New Issue
Block a user