修改个人中心栏目展示方式,添加引导,添加二级栏目列表
This commit is contained in:
parent
8c2b0fa929
commit
48b987e5b7
50
app.json
50
app.json
@ -28,23 +28,35 @@
|
||||
"pages/mine/product/productmanage/searchproduct",
|
||||
"pages/mine/order/ordersuccess",
|
||||
"pages/mine/order/orderlist",
|
||||
"pages/mine/order/orderdetail"
|
||||
"pages/mine/order/orderdetail",
|
||||
"pages/mine/columnlist/columnlist"
|
||||
],
|
||||
"subPackages": [
|
||||
{
|
||||
"root": "packagecard",
|
||||
"pages": [
|
||||
"cardList/cardList",
|
||||
"cardDetail/cardDetail",
|
||||
"moments/publish/momentpublish",
|
||||
"moments/edit/momentedit",
|
||||
"moments/list/momentslist",
|
||||
"moments/publish/momentpublishline",
|
||||
"sharePage/sharePage",
|
||||
"moments/list/momentsshowlist",
|
||||
"moments/momentsdetail/momentsdetail",
|
||||
"moments/showlist/showlist",
|
||||
"shop/catalog/bannerlist/bannerlist",
|
||||
"shop/catalog/column/column",
|
||||
"shop/catalog/list/list",
|
||||
"shop/shopingcart/cart",
|
||||
"shop/product/product",
|
||||
"shop/bespeak/bespeak",
|
||||
"shop/product/goodsdetail",
|
||||
"shop/product/affirmorder",
|
||||
"shop/catalog/bannerlist/goodscataloglist"
|
||||
]
|
||||
}
|
||||
],
|
||||
"subPackages": [{
|
||||
"root": "packagecard",
|
||||
"pages": [
|
||||
"cardList/cardList",
|
||||
"cardDetail/cardDetail",
|
||||
"moments/publish/momentpublish",
|
||||
"moments/edit/momentedit",
|
||||
"moments/list/momentslist",
|
||||
"moments/publish/momentpublishline",
|
||||
"sharePage/sharePage",
|
||||
"moments/list/momentsshowlist",
|
||||
"moments/momentsdetail/momentsdetail",
|
||||
"moments/showlist/showlist"
|
||||
]
|
||||
}],
|
||||
"window": {
|
||||
"backgroundTextStyle": "dark",
|
||||
"navigationBarBackgroundColor": "#fff",
|
||||
@ -56,12 +68,14 @@
|
||||
"color": "#8F8F8F",
|
||||
"selectedColor": "#1296db",
|
||||
"borderStyle": "black",
|
||||
"list": [{
|
||||
"list": [
|
||||
{
|
||||
"text": "首页",
|
||||
"pagePath": "pages/index/index",
|
||||
"iconPath": "images/ic_card_normal.png",
|
||||
"selectedIconPath": "images/ic_card_sel.png"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"text": "服务",
|
||||
"pagePath": "pages/serve/index/index",
|
||||
"iconPath": "images/ic_serve_normal.png",
|
||||
|
35
components/loadmore/index.js
Normal file
35
components/loadmore/index.js
Normal file
@ -0,0 +1,35 @@
|
||||
Component({
|
||||
properties: {
|
||||
mtype:{
|
||||
type:Number,
|
||||
value:1,
|
||||
observer: function (newVal, oldVal) {
|
||||
this.setData({
|
||||
mtype: newVal
|
||||
})
|
||||
}
|
||||
},
|
||||
nodata_str:{
|
||||
type:String,
|
||||
value:'暂无数据',
|
||||
observer: function (newVal, oldVal) {
|
||||
this.setData({
|
||||
nodata_str: newVal
|
||||
})
|
||||
}
|
||||
},
|
||||
hidden:{
|
||||
type:Boolean,
|
||||
value:true,
|
||||
observer: function (newVal, oldVal) {
|
||||
this.setData({
|
||||
hidden: newVal
|
||||
})
|
||||
}
|
||||
},
|
||||
tipcolor:{
|
||||
type:String,
|
||||
value:"#f9f9f9"
|
||||
}
|
||||
}
|
||||
})
|
3
components/loadmore/index.json
Normal file
3
components/loadmore/index.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"component": true
|
||||
}
|
21
components/loadmore/index.wxml
Normal file
21
components/loadmore/index.wxml
Normal file
@ -0,0 +1,21 @@
|
||||
<block wx:if="{{mtype==2}}">
|
||||
<view class="zan-loadmore zan-loadmore--nomore" hidden="{{hidden}}">
|
||||
<view class="zan-loadmore__tips" style="background-color:{{tipcolor}}">
|
||||
<view class="zan-loadmore__dot"></view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<block wx:elif="{{mtype==3}}">
|
||||
<view class="zan-loadmore zan-loadmore--nodata" hidden="{{hidden}}">
|
||||
<view class="zan-loadmore__tips" style="background-color:{{tipcolor}}">{{ nodata_str}}</view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<block wx:elif="{{mtype==1}}" >
|
||||
<view class="zan-loadmore" hidden="{{hidden}}">
|
||||
<image class="zan-loading" src="../../assets/imgs/loadmore.png"></image>
|
||||
<view class="zan-loadmore__tips" style="background-color:{{tipcolor}}">加载中...</view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
|
57
components/loadmore/index.wxss
Normal file
57
components/loadmore/index.wxss
Normal file
@ -0,0 +1,57 @@
|
||||
.zan-loadmore{
|
||||
position:relative;
|
||||
width:65%;
|
||||
margin:0 auto;
|
||||
line-height:20px;
|
||||
font-size:14px;
|
||||
text-align:center;
|
||||
display: block;
|
||||
vertical-align: middle
|
||||
}
|
||||
.zan-loading{
|
||||
width:20px;
|
||||
height:20px;
|
||||
display:inline-block;
|
||||
vertical-align:middle;
|
||||
animation:weuiLoading 1s steps(12,end) infinite;
|
||||
}
|
||||
.zan-loadmore .zan-loading{
|
||||
margin-right:4px
|
||||
}
|
||||
.zan-loadmore__tips{
|
||||
display:inline-block;
|
||||
vertical-align:middle;
|
||||
height:20px;
|
||||
line-height:20px;
|
||||
color:#999
|
||||
}
|
||||
.zan-loadmore--nodata,.zan-loadmore--nomore{
|
||||
border-top:1rpx solid #e5e5e5;
|
||||
}
|
||||
.zan-loadmore--nodata{
|
||||
margin-top:20rpx
|
||||
}
|
||||
.zan-loadmore--nodata .zan-loadmore__tips{
|
||||
position:relative;
|
||||
top:-11px;
|
||||
padding:0 6px
|
||||
}
|
||||
.zan-loadmore--nomore .zan-loadmore__tips{
|
||||
position:relative;
|
||||
top:-11px;
|
||||
padding:0 6px
|
||||
}
|
||||
.zan-loadmore__dot{
|
||||
position:absolute;
|
||||
left:50%;
|
||||
top:10px;
|
||||
margin-left:-2px;
|
||||
margin-top:-2px;
|
||||
content:" ";
|
||||
width:4px;
|
||||
height:4px;
|
||||
border-radius:50%;
|
||||
background-color:#e5e5e5;
|
||||
display:inline-block;
|
||||
vertical-align:middle;
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
// packagecard/pages/cardDetail/cardDetail.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
@ -1,2 +0,0 @@
|
||||
<!--packagecard/pages/cardDetail/cardDetail.wxml-->
|
||||
<text>packagecard/pages/cardDetail/cardDetail.wxml</text>
|
@ -1 +0,0 @@
|
||||
/* packagecard/pages/cardDetail/cardDetail.wxss */
|
@ -1,66 +0,0 @@
|
||||
// packagecard/pages/cardList/cardList.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
@ -1,2 +0,0 @@
|
||||
<!--packagecard/pages/cardList/cardList.wxml-->
|
||||
<text>packagecard/pages/cardList/cardList.wxml</text>
|
@ -1 +0,0 @@
|
||||
/* packagecard/pages/cardList/cardList.wxss */
|
@ -1,66 +0,0 @@
|
||||
// packagecard/pages/moments/edit/momentedit.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
@ -1,2 +0,0 @@
|
||||
<!--packagecard/pages/moments/edit/momentedit.wxml-->
|
||||
<text>packagecard/pages/moments/edit/momentedit.wxml</text>
|
@ -1 +0,0 @@
|
||||
/* packagecard/pages/moments/edit/momentedit.wxss */
|
@ -1,66 +0,0 @@
|
||||
// packagecard/pages/moments/list/momentslist.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
@ -1,2 +0,0 @@
|
||||
<!--packagecard/pages/moments/list/momentslist.wxml-->
|
||||
<text>packagecard/pages/moments/list/momentslist.wxml</text>
|
@ -1 +0,0 @@
|
||||
/* packagecard/pages/moments/list/momentslist.wxss */
|
@ -1,66 +0,0 @@
|
||||
// packagecard/pages/moments/list/momentsshowlist.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
@ -1,2 +0,0 @@
|
||||
<!--packagecard/pages/moments/list/momentsshowlist.wxml-->
|
||||
<text>packagecard/pages/moments/list/momentsshowlist.wxml</text>
|
@ -1 +0,0 @@
|
||||
/* packagecard/pages/moments/list/momentsshowlist.wxss */
|
@ -1,66 +0,0 @@
|
||||
// packagecard/pages/moments/momentsdetail/momentsdetail.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
@ -1,2 +0,0 @@
|
||||
<!--packagecard/pages/moments/momentsdetail/momentsdetail.wxml-->
|
||||
<text>packagecard/pages/moments/momentsdetail/momentsdetail.wxml</text>
|
@ -1 +0,0 @@
|
||||
/* packagecard/pages/moments/momentsdetail/momentsdetail.wxss */
|
@ -1,66 +0,0 @@
|
||||
// packagecard/pages/moments/publish/momentpublish.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
@ -1,3 +0,0 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
<!--packagecard/pages/moments/publish/momentpublish.wxml-->
|
||||
<text>packagecard/pages/moments/publish/momentpublish.wxml</text>
|
@ -1 +0,0 @@
|
||||
/* packagecard/pages/moments/publish/momentpublish.wxss */
|
@ -1,66 +0,0 @@
|
||||
// packagecard/pages/moments/publish/momentpublishline.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
@ -1,3 +0,0 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
<!--packagecard/pages/moments/publish/momentpublishline.wxml-->
|
||||
<text>packagecard/pages/moments/publish/momentpublishline.wxml</text>
|
@ -1 +0,0 @@
|
||||
/* packagecard/pages/moments/publish/momentpublishline.wxss */
|
@ -1,66 +0,0 @@
|
||||
// packagecard/pages/moments/showlist/showlist.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
@ -1,3 +0,0 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
<!--packagecard/pages/moments/showlist/showlist.wxml-->
|
||||
<text>packagecard/pages/moments/showlist/showlist.wxml</text>
|
@ -1 +0,0 @@
|
||||
/* packagecard/pages/moments/showlist/showlist.wxss */
|
@ -1,66 +0,0 @@
|
||||
// packagecard/pages/sharePage/sharePage.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
@ -1,3 +0,0 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
<!--packagecard/pages/sharePage/sharePage.wxml-->
|
||||
<text>packagecard/pages/sharePage/sharePage.wxml</text>
|
@ -1 +0,0 @@
|
||||
/* packagecard/pages/sharePage/sharePage.wxss */
|
205
packagecard/shop/bespeak/bespeak.js
Normal file
205
packagecard/shop/bespeak/bespeak.js
Normal file
@ -0,0 +1,205 @@
|
||||
// pages/shop/bespeak/bespeak.js
|
||||
const app = getApp();
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
shopId: '',
|
||||
shopBean: null,
|
||||
active: 1,
|
||||
testGoods: {
|
||||
name: "商品"
|
||||
},
|
||||
goodsList: [],
|
||||
shopCart: [],
|
||||
tabList: [],
|
||||
TabCur: 0,
|
||||
scrollLeft: 0,
|
||||
swiperlist: [],
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
this.setData({
|
||||
shopId: options.shopId,
|
||||
})
|
||||
this.getShopDetail()
|
||||
this.getShopGoodsCatalog()
|
||||
this.getShopGoodsList()
|
||||
},
|
||||
getShopDetail() {
|
||||
let _self = this
|
||||
wx.showLoading({
|
||||
title: '加载中...',
|
||||
})
|
||||
app.restAjax.get(app.restAjax.path(app.apis.getShopDetail, [app.baseUrls.tradeUrl, _self.data.shopId]), {}, {
|
||||
headers: {
|
||||
token: app.globalData.token
|
||||
}
|
||||
}, function (code, data) {
|
||||
wx.hideLoading({})
|
||||
if (code == 200) {
|
||||
console.log(data)
|
||||
_self.setData({
|
||||
shopBean: data
|
||||
})
|
||||
}
|
||||
}, function (code, data) {
|
||||
wx.hideLoading({})
|
||||
if (data.msg) {
|
||||
wx.showToast({
|
||||
title: data.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '网络错误',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
//获取店铺所有商品类目
|
||||
getShopGoodsList() {
|
||||
let _self = this
|
||||
wx.showLoading({
|
||||
title: '加载中...',
|
||||
})
|
||||
app.restAjax.get(
|
||||
app.restAjax.path(app.restAjax.apis.getShopGoodsList, [app.restAjax.baseUrl.tradeUrl, _self.data.shopId]), {}, {
|
||||
headers: {
|
||||
token: app.globalData.token
|
||||
}
|
||||
}, (code, data) => {
|
||||
wx.hideLoading({})
|
||||
if (code == 200) {
|
||||
if (data.rows.length > 0) {
|
||||
_self.buildData(data.rows)
|
||||
} else {
|
||||
//TODO 没有数据
|
||||
}
|
||||
}
|
||||
}, (code, error) => {
|
||||
wx.hideLoading({})
|
||||
if (error.msg) {
|
||||
wx.showToast({
|
||||
title: error.msg,
|
||||
})
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '网络错误',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
//获取商店所有分类
|
||||
getShopGoodsCatalog() {
|
||||
let _self = this
|
||||
app.restAjax.get(app.restAjax.path(app.restAjax.apis.getShopCatalogList, [app.restAjax.baseUrl.tradeUrl, _self.data.shopId]), {}, {
|
||||
headers: {
|
||||
token: app.globalData.token
|
||||
}
|
||||
}, (code, data) => {
|
||||
if (code == 200) {
|
||||
_self.setData({
|
||||
tabList: data
|
||||
})
|
||||
_self.getGoodsListByCategory(_self.data.tabList[0].categoryId)
|
||||
}
|
||||
}, (code, error) => {
|
||||
if (error.msg) {
|
||||
wx.showToast({
|
||||
title: error.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '网络错误',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
getGoodsListByCategory(categoryId) {
|
||||
wx.showLoading({
|
||||
title: '加载中',
|
||||
})
|
||||
let _self = this
|
||||
app.restAjax.get(
|
||||
app.restAjax.path(app.restAjax.apis.getGoodsByCatalogAndShop, [app.restAjax.baseUrl.tradeUrl, categoryId]), {
|
||||
page: 1,
|
||||
shopId: _self.data.shopId
|
||||
}, {
|
||||
headers: {
|
||||
token: app.globalData.token
|
||||
}
|
||||
}, (code, data) => {
|
||||
wx.hideLoading({})
|
||||
if (code == 200) {
|
||||
if (data.rows.length > 0) {
|
||||
data.rows.forEach(it => {
|
||||
var picId = it.goodsPhotos.substring(0, it.goodsPhotos.indexOf(',') != -1 ? it.goodsPhotos.indexOf(',') : it.goodsPhotos.length)
|
||||
it.hotPic = app.restAjax.baseUrl.tradeUrl + app.restAjax.baseUrl.baseImgUrl + picId
|
||||
})
|
||||
_self.data.goodsList = _self.data.goodsList.concat(data.rows)
|
||||
_self.setData({
|
||||
goodsList: _self.data.goodsList
|
||||
})
|
||||
}
|
||||
}
|
||||
}, (code, error) => {
|
||||
wx.hideLoading({})
|
||||
if (error.msg) {
|
||||
wx.showToast({
|
||||
title: error.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '网络错误',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
//构建热梦商品
|
||||
buildData(datas) {
|
||||
let _self = this
|
||||
datas.forEach(it => {
|
||||
var picId = it.goodsPhotos.substring(0, it.goodsPhotos.indexOf(',') != -1 ? it.goodsPhotos.indexOf(',') : it.goodsPhotos.length)
|
||||
it.hotPic = app.restAjax.baseUrl.tradeUrl + app.restAjax.baseUrl.baseImgUrl + picId
|
||||
_self.data.swiperlist.push(it)
|
||||
})
|
||||
_self.setData({
|
||||
swiperlist: _self.data.swiperlist
|
||||
})
|
||||
},
|
||||
tabSelect(e) {
|
||||
this.setData({
|
||||
goodsList: [],
|
||||
TabCur: e.currentTarget.dataset.id,
|
||||
scrollLeft: (e.currentTarget.dataset.id - 1) * 60
|
||||
})
|
||||
var cItem = this.data.tabList[this.data.TabCur]
|
||||
this.getGoodsListByCategory(cItem.categoryId)
|
||||
},
|
||||
callPhone() {},
|
||||
//商品分类页面
|
||||
showCategoryGoods() {
|
||||
var item = this.data.tabList[this.data.TabCur]
|
||||
wx.navigateTo({
|
||||
url: '../catalog/bannerlist/goodscataloglist?shopId=' + this.data.shopId + '&catalogId=' + item.categoryId,
|
||||
})
|
||||
},
|
||||
//商品详情页面
|
||||
toGoodsDetail(e) {
|
||||
let _self = this
|
||||
wx.navigateTo({
|
||||
url: '../product/goodsdetail?shopId=' + _self.data.shopId + '&goodsId=' + e.currentTarget.dataset.item.goodsId,
|
||||
})
|
||||
},
|
||||
})
|
4
packagecard/shop/bespeak/bespeak.json
Normal file
4
packagecard/shop/bespeak/bespeak.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
}
|
||||
}
|
82
packagecard/shop/bespeak/bespeak.wxml
Normal file
82
packagecard/shop/bespeak/bespeak.wxml
Normal file
@ -0,0 +1,82 @@
|
||||
<!--pages/shop/bespeak/bespeak.wxml-->
|
||||
<cu-custom isBack="{{true}}" isRelaunch="{{false}}">
|
||||
<view slot="content">服务</view>
|
||||
</cu-custom>
|
||||
|
||||
<scroll-view>
|
||||
<!-- 商品轮播 -->
|
||||
<swiper class="screen-swiper round-dot bg-white" indicator-dots="true" circular="true" autoplay="true" interval="5000"
|
||||
style="height:550rpx;" duration="500">
|
||||
<swiper-item wx:for="{{swiperlist}}" wx:key="index">
|
||||
<image src="{{item.hotPic}}" mode='scaleToFill'></image>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</scroll-view>
|
||||
|
||||
<view class="scroll-content">
|
||||
<view class="cu-list menu">
|
||||
<!-- 名称 -->
|
||||
<view class="cu-item">
|
||||
<view class="content padding-tb-sm">
|
||||
<view class="text-black text-xxl">
|
||||
<text class="text-black margin-right-xl">{{shopBean.shopName}}</text>
|
||||
</view>
|
||||
<view class="text-gray text-sm">
|
||||
<text class="cuIcon-favor margin-right-xs">{{shopBean.shopSummary}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="action flex">
|
||||
<view>
|
||||
<text class="cuIcon-share lg text-gray"></text>
|
||||
<text>分享</text>
|
||||
</view>
|
||||
<view class="margin-left">
|
||||
<text class="cuIcon-favor lg text-gray"></text>
|
||||
<text>收藏</text>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<view class="bg-gray" style="height:20rpx;"></view>
|
||||
<!-- 地址 -->
|
||||
<view class="cu-item">
|
||||
<view class="content padding-tb-xs">
|
||||
<view class="text-black text-df cut">
|
||||
<text class="cuIcon-location text-black margin-right-sm"></text>{{shopBean.shopAddress}}
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="action flex">
|
||||
<view class="margin-left">
|
||||
<text class="cuIcon-phone lg text-gray"></text>
|
||||
<text>电话</text>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
<!-- 商品 -->
|
||||
<view class="hint-title bg-gray">
|
||||
精选商品
|
||||
</view>
|
||||
<view class="flex justify-between">
|
||||
<scroll-view scroll-x class="bg-white nav" style="width:80%;" scroll-with-animation scroll-left="{{scrollLeft}}">
|
||||
<view class="cu-item {{index==TabCur?'text-blue cur':''}}" wx:for="{{tabList}}" wx:key="index" bindtap="tabSelect"
|
||||
data-id="{{index}}">
|
||||
{{item.categoryName}}
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view style="width:130rpx;display:flex;justify-content:center;align-items:center;text-align:center;"
|
||||
class="text-blue" bindtap="showCategoryGoods">
|
||||
更多 >
|
||||
</view>
|
||||
</view>
|
||||
<scroll-view scroll-x class="bg-white">
|
||||
<view class="test">
|
||||
<view wx:for="{{goodsList}}" wx:key="index" class="margin-sm" style="width:140rpx;" bindtap="toGoodsDetail"
|
||||
data-item="{{item}}">
|
||||
<van-image width="80" height="80" use-loading-slot fit="fill" src="{{item.hotPic}}">
|
||||
<van-loading slot="loading" type="spinner" size="20" vertical />
|
||||
</van-image>
|
||||
<view class="text-cut text-center">{{item.goodsName}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
19
packagecard/shop/bespeak/bespeak.wxss
Normal file
19
packagecard/shop/bespeak/bespeak.wxss
Normal file
@ -0,0 +1,19 @@
|
||||
.test {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
margin-bottom: 80rpx;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.scroll-content {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
top: 470rpx;
|
||||
border-top-right-radius: 60rpx;
|
||||
border-top-left-radius: 60rpx;
|
||||
padding-top: 20rpx;
|
||||
z-index: 30;
|
||||
background-color: white;
|
||||
}
|
358
packagecard/shop/catalog/bannerlist/bannerlist.js
Normal file
358
packagecard/shop/catalog/bannerlist/bannerlist.js
Normal file
@ -0,0 +1,358 @@
|
||||
// pages/shop/catalog/bannerlist/bannerlist.js
|
||||
const app = getApp()
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
shopId: '',
|
||||
active: 1,
|
||||
swiperlist: [],
|
||||
typeMenu: [],
|
||||
goodsList: [],
|
||||
currentPage: 1,
|
||||
contentHeight: app.globalData.windowHeight,
|
||||
isLoadMore: false, //是否在加载中
|
||||
hasMore: true, //是否还有更多数据
|
||||
currentPage: 1,
|
||||
totalSize: 0,
|
||||
baseImg: app.restAjax.baseUrl.tradeUrl + app.restAjax.baseUrl.baseImgUrl,
|
||||
isShowCart: false,
|
||||
shopCart: []
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
this.setData({
|
||||
shopId: options.shopId,
|
||||
shopCart: app.globalData.shopCart
|
||||
})
|
||||
//获取热门商品
|
||||
this.getShopGoodsList(this.data.shopId)
|
||||
//获取店铺类别
|
||||
this.getShopGoodsCatalog(this.data.shopId)
|
||||
//获取全部商品
|
||||
this.getShopGoodsListByPage(this.data.shopId)
|
||||
this.selectComponent('#sCart').refreshCart()
|
||||
},
|
||||
//获取店铺所有商品类目
|
||||
getShopGoodsList(shopId) {
|
||||
let _self = this
|
||||
wx.showLoading({
|
||||
title: '加载中...',
|
||||
})
|
||||
app.restAjax.get(
|
||||
app.restAjax.path(app.restAjax.apis.getShopGoodsList, [app.restAjax.baseUrl.tradeUrl, shopId]), {}, {
|
||||
headers: {
|
||||
token: app.globalData.token
|
||||
}
|
||||
}, (code, data) => {
|
||||
wx.hideLoading({})
|
||||
_self.setData({
|
||||
isRefreshing: false
|
||||
})
|
||||
if (code == 200) {
|
||||
if (data.rows.length > 0) {
|
||||
_self.buildData(data.rows)
|
||||
} else {
|
||||
//TODO 没有数据
|
||||
}
|
||||
}
|
||||
}, (code, error) => {
|
||||
wx.hideLoading({})
|
||||
if (error.msg) {
|
||||
app.dialog.msg(error.msg)
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '网络错误',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
//构建热梦商品
|
||||
buildData(datas) {
|
||||
let _self = this
|
||||
datas.forEach(it => {
|
||||
var picId = it.goodsPhotos.substring(0, it.goodsPhotos.indexOf(',') != -1 ? it.goodsPhotos.indexOf(',') : it.goodsPhotos.length)
|
||||
it.hotPic = app.restAjax.baseUrl.tradeUrl + app.restAjax.baseUrl.baseImgUrl + picId
|
||||
_self.data.swiperlist.push(it)
|
||||
})
|
||||
_self.setData({
|
||||
swiperlist: _self.data.swiperlist
|
||||
})
|
||||
},
|
||||
//显示热门商品详情
|
||||
showHot(e) {
|
||||
let _self = this
|
||||
wx.navigateTo({
|
||||
url: '../../product/goodsdetail?shopId=' + _self.data.shopId + '&goodsId=' + e.currentTarget.dataset.item.goodsId,
|
||||
})
|
||||
},
|
||||
//获取商店所有分类
|
||||
getShopGoodsCatalog(shopId) {
|
||||
let _self = this
|
||||
app.restAjax.get(app.restAjax.path(app.restAjax.apis.getShopCatalogList, [app.restAjax.baseUrl.tradeUrl, shopId]), {}, {
|
||||
headers: {
|
||||
token: app.globalData.token
|
||||
}
|
||||
}, (code, data) => {
|
||||
if (code == 200) {
|
||||
_self.setData({
|
||||
typeMenu: data
|
||||
})
|
||||
}
|
||||
}, (code, error) => {
|
||||
if (error.msg) {
|
||||
app.dialog.msg(error.msg)
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '网络错误',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
//分页获取商品
|
||||
getShopGoodsListByPage(id) {
|
||||
let _self = this
|
||||
app.restAjax.get(
|
||||
app.restAjax.path(app.restAjax.apis.getShopGoodsList, [app.restAjax.baseUrl.tradeUrl, id]), {
|
||||
page: _self.data.currentPage
|
||||
}, {
|
||||
headers: {
|
||||
token: app.globalData.token
|
||||
}
|
||||
}, (code, data) => {
|
||||
_self.setData({
|
||||
isLoadMore: false
|
||||
})
|
||||
if (code == 200) {
|
||||
if (data.rows.length > 0) {
|
||||
data.rows.forEach(it => {
|
||||
it.buyNum = 0
|
||||
})
|
||||
data.rows.forEach(it => {
|
||||
//判断购物车是否存在该商品
|
||||
if (app.globalData.shopCart.length > 0) {
|
||||
app.globalData.shopCart.forEach(i => {
|
||||
if (i.goodsId == it.goodsId) {
|
||||
it.buyNum = i.buyNum
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
_self.data.goodsList = _self.data.goodsList.concat(data.rows)
|
||||
_self.setData({
|
||||
goodsList: _self.data.goodsList
|
||||
})
|
||||
} else {
|
||||
_self.setData({
|
||||
hasMore: false
|
||||
})
|
||||
}
|
||||
}
|
||||
}, (code, error) => {
|
||||
wx.hideLoading({})
|
||||
if (error.msg) {
|
||||
app.dialog.msg(error.msg)
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '网络错误',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
doLoadMore(e) {
|
||||
let _self = this
|
||||
if (_self.data.hasMore) {
|
||||
if (_self.data.isLoadMore) {
|
||||
return
|
||||
}
|
||||
_self.setData({
|
||||
isLoadMore: true,
|
||||
currentPage: ++_self.data.currentPage
|
||||
})
|
||||
_self.getShopGoodsListByPage(_self.data.shopId)
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '暂无更多数据',
|
||||
icon: 'none',
|
||||
duration: 500
|
||||
})
|
||||
}
|
||||
},
|
||||
//商品详情页面
|
||||
toGoodsDetail(e) {
|
||||
let _self = this
|
||||
wx.navigateTo({
|
||||
url: '../../product/goodsdetail?shopId=' + _self.data.shopId + '&goodsId=' + e.currentTarget.dataset.item.goodsId,
|
||||
})
|
||||
},
|
||||
//商品分类页面
|
||||
toGoodsCatalogPage(e) {
|
||||
wx.navigateTo({
|
||||
url: './goodscataloglist?shopId=' + this.data.shopId + '&catalogId=' + e.currentTarget.dataset.item.categoryId,
|
||||
})
|
||||
},
|
||||
onShow() {
|
||||
let _self = this
|
||||
if (app.globalData.shopCart.length > 0) {
|
||||
_self.data.goodsList.forEach(it => {
|
||||
var isExist = false
|
||||
app.globalData.shopCart.forEach(i => {
|
||||
if (i.goodsId == it.goodsId) {
|
||||
isExist = true
|
||||
it.buyNum = i.buyNum
|
||||
}
|
||||
})
|
||||
if (!isExist) {
|
||||
it.buyNum = 0
|
||||
}
|
||||
})
|
||||
} else {
|
||||
_self.data.goodsList.forEach(it => {
|
||||
it.buyNum = 0
|
||||
})
|
||||
}
|
||||
this.setData({
|
||||
goodsList: _self.data.goodsList,
|
||||
shopCart: app.globalData.shopCart
|
||||
})
|
||||
this.selectComponent('#sCart').refreshCart()
|
||||
},
|
||||
//列表添加购物车
|
||||
addToCart(e) {
|
||||
let _self = this
|
||||
let goods = e.currentTarget.dataset.item
|
||||
_self.data.goodsList.forEach(it => {
|
||||
if (goods.goodsId == it.goodsId) {
|
||||
it.buyNum += 1
|
||||
if (it.buyNum > goods.goodsTotal) {
|
||||
it.buyNum = goods.goodsTotal
|
||||
wx.showToast({
|
||||
title: '超出库存',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
this.selectComponent('#sCart').listAddToCart(goods)
|
||||
_self.setData({
|
||||
goodsList: _self.data.goodsList,
|
||||
shopCart: app.globalData.shopCart
|
||||
})
|
||||
},
|
||||
removeToCart(e) {
|
||||
let goods = e.currentTarget.dataset.item
|
||||
let _self = this
|
||||
_self.data.goodsList.forEach(it => {
|
||||
if (goods.goodsId == it.goodsId) {
|
||||
it.buyNum -= 1
|
||||
}
|
||||
})
|
||||
this.selectComponent('#sCart').listRemoveCart(goods)
|
||||
_self.setData({
|
||||
goodsList: _self.data.goodsList,
|
||||
shopCart: app.globalData.shopCart
|
||||
})
|
||||
},
|
||||
//显示购物车弹框
|
||||
doShowCart() {
|
||||
var _self = this
|
||||
if (this.data.shopCart.length > 0) {
|
||||
//判断当前购物车是否存在该商店的商品
|
||||
var isExist = false
|
||||
this.data.shopCart.forEach(it => {
|
||||
if (it.shopId == _self.data.shopId) {
|
||||
isExist = true
|
||||
}
|
||||
})
|
||||
if (isExist) {
|
||||
if (this.data.isShowCart) {
|
||||
this.setData({
|
||||
isShowCart: false
|
||||
})
|
||||
} else {
|
||||
this.setData({
|
||||
isShowCart: true
|
||||
})
|
||||
}
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '购物车空空如也',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '购物车空空如也',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
},
|
||||
//隐藏购物车弹框
|
||||
onHideCart() {
|
||||
this.setData({
|
||||
isShowCart: false
|
||||
})
|
||||
},
|
||||
//删除购物车中的商品
|
||||
delGoods(e) {
|
||||
let _self = this
|
||||
var index = e.currentTarget.dataset.index
|
||||
var goods = e.currentTarget.dataset.goods
|
||||
app.globalData.shopCart.splice(index, 1)
|
||||
//删除购物车中数据
|
||||
_self.selectComponent('#sCart').refreshCart()
|
||||
//将列表中的数据购买数量重置
|
||||
_self.data.goodsList.forEach(it => {
|
||||
if (it.goodsId == goods.goodsId) {
|
||||
it.buyNum = 0
|
||||
}
|
||||
})
|
||||
_self.setData({
|
||||
goodsList: _self.data.goodsList,
|
||||
shopCart: app.globalData.shopCart
|
||||
})
|
||||
if (_self.data.shopCart.length <= 0) {
|
||||
_self.setData({
|
||||
isShowCart: false
|
||||
})
|
||||
}
|
||||
},
|
||||
//购物车弹框删除或添加商品
|
||||
onChange(e) {
|
||||
let buyNum = e.detail
|
||||
let goods = e.currentTarget.dataset.goods
|
||||
let _self = this
|
||||
//遍历列表
|
||||
_self.data.goodsList.forEach(it => {
|
||||
if (it.goodsId == goods.goodsId) {
|
||||
it.buyNum = buyNum
|
||||
}
|
||||
})
|
||||
//遍历购物车
|
||||
_self.data.shopCart.forEach(it => {
|
||||
if (it.goodsId == goods.goodsId) {
|
||||
it.buyNum = buyNum
|
||||
}
|
||||
})
|
||||
//刷新视图
|
||||
_self.setData({
|
||||
goodsList: _self.data.goodsList,
|
||||
shopCart: _self.data.shopCart
|
||||
})
|
||||
//刷新购物车
|
||||
_self.selectComponent('#sCart').refreshCart()
|
||||
},
|
||||
onHide() {
|
||||
this.setData({
|
||||
isShowCart: false
|
||||
})
|
||||
}
|
||||
})
|
4
packagecard/shop/catalog/bannerlist/bannerlist.json
Normal file
4
packagecard/shop/catalog/bannerlist/bannerlist.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
}
|
||||
}
|
78
packagecard/shop/catalog/bannerlist/bannerlist.wxml
Normal file
78
packagecard/shop/catalog/bannerlist/bannerlist.wxml
Normal file
@ -0,0 +1,78 @@
|
||||
<!--pages/shop/catalog/bannerlist/bannerlist.wxml-->
|
||||
<cu-custom isBack="{{true}}" isRelaunch="{{false}}">
|
||||
<view slot="content">服务</view>
|
||||
</cu-custom>
|
||||
<scroll-view scroll-y="true" bindscrolltolower="doLoadMore" style="height:{{contentHeight}}px;margin-bottom:80rpx;">
|
||||
<!-- 商品轮播 -->
|
||||
<swiper class="screen-swiper square-dot bg-white" indicator-dots="true" circular="true" autoplay="true"
|
||||
interval="5000" duration="500">
|
||||
<swiper-item wx:for="{{swiperlist}}" wx:key="index" bindtap="showHot" data-item="{{item}}">
|
||||
<image src="{{item.hotPic}}" mode='aspectFill'></image>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<!-- 分类菜单 -->
|
||||
<view class="cu-list grid col-4 bo-border padding-top-xs margin-top-ls">
|
||||
<view wx:for="{{typeMenu}}" wx:key="index" bindtap="toGoodsCatalogPage" data-item="{{item}}">
|
||||
<view class="cu-item padding-xs flex flex-direction" style="align-items:center;">
|
||||
<view class="cu-avatar radius lg" style="background-image:url({{baseImg+item.categoryLogo}});">
|
||||
</view>
|
||||
<view class="text-cut radius" style="width:200rpx">{{item.categoryName}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 全部商品列表 -->
|
||||
<view class="hint-title">
|
||||
<text>全部商品</text>
|
||||
</view>
|
||||
<view class="cu-list menu-avatar">
|
||||
<view class="cu-item margin-xs" wx:for="{{goodsList}}" wx:key="index">
|
||||
<view class="cu-avatar radius xl" style="background-image:url({{baseImg+item.goodsIcon}});"
|
||||
bindtap="toGoodsDetail" data-item="{{item}}">
|
||||
</view>
|
||||
<view class="content" style="width:75%;">
|
||||
<view class="text-depblack" bindtap="toGoodsDetail" data-item="{{item}}">{{item.goodsName}}</view>
|
||||
<view class="text-gray text-sm flex" bindtap="toGoodsDetail" data-item="{{item}}">
|
||||
<text class="text-cut">
|
||||
<text class="text-red margin-right-xs"></text>{{item.goodsSummary}}
|
||||
</text>
|
||||
</view>
|
||||
<view class="flex justify-between" style="align-items:center;">
|
||||
<view class="text-red text-df">¥{{item.goodsUnitPrice}}</view>
|
||||
<view class="flex margin-top-xs" style="align-items:center;">
|
||||
<image src="/images/ic_remove_cart.png" mode="scaleToFill" style="width:40rpx;height:40rpx;"
|
||||
data-item="{{item}}" bindtap="removeToCart" wx:if="{{item.buyNum>0}}"></image>
|
||||
<view class="solid"
|
||||
style="width:auto;height:40rpx;min-width:60rpx;text-align:center;display:flex;justify-content:center;align-items:center;">
|
||||
{{item.buyNum}}</view>
|
||||
<image src="/images/ic_add_cart.png" mode="scaleToFill" style="width:40rpx;height:40rpx;"
|
||||
data-item="{{item}}" bindtap="addToCart"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<customcart id="sCart" shopId="{{shopId}}" showBtn="{{false}}" bind:showcart="doShowCart">
|
||||
|
||||
</customcart>
|
||||
|
||||
<van-action-sheet show="{{ isShowCart }}" title="购物车" bind:close="onHideCart" style="padding-bottom:180rpx;">
|
||||
<view class="cu-card article" style="margin-top:10rpx;padding-bottom:80rpx;">
|
||||
<view class="cu-item shadow padding-sm" wx:for="{{shopCart}}" wx:key="index" data-item="{{item}}">
|
||||
<view class="content">
|
||||
<image src="{{baseImg+item.goodsIcon}}" mode="scaleToFill" style="width:80px;height:80px;"></image>
|
||||
<view class="desc">
|
||||
<view>{{item.goodsName}}</view>
|
||||
<view class="text-cut-width">{{item.goodsSummary}}</view>
|
||||
<view class="flex justify-between" style="align-items:center;">
|
||||
<view class="text-red">¥{{item.goodsUnitPrice}}</view>
|
||||
<van-stepper value="{{ item.buyNum }}" bind:change="onChange" data-goods="{{item}}" integer="true"
|
||||
min="1" />
|
||||
<view class="cu-tag text-red" bindtap="delGoods" data-index="{{index}}" data-goods="{{item}}">删除
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</van-action-sheet>
|
9
packagecard/shop/catalog/bannerlist/bannerlist.wxss
Normal file
9
packagecard/shop/catalog/bannerlist/bannerlist.wxss
Normal file
@ -0,0 +1,9 @@
|
||||
/* pages/shop/catalog/bannerlist/bannerlist.wxss */
|
||||
|
||||
.screen-swiper {
|
||||
min-height:455rpx;
|
||||
}
|
||||
.page {
|
||||
height: 100Vh;
|
||||
width: 100vw;
|
||||
}
|
250
packagecard/shop/catalog/bannerlist/goodscataloglist.js
Normal file
250
packagecard/shop/catalog/bannerlist/goodscataloglist.js
Normal file
@ -0,0 +1,250 @@
|
||||
// pages/shop/catalog/bannerlist/goodscataloglist.js
|
||||
const app = getApp()
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
shopId: '',
|
||||
catalogId: '',
|
||||
active: 1,
|
||||
swiperlist: [],
|
||||
typeMenu: [],
|
||||
shopCart: [],
|
||||
isShowCart: false,
|
||||
goodsList: [],
|
||||
currentPage: 1,
|
||||
contentHeight: app.globalData.windowHeight,
|
||||
isLoadMore: false, //是否在加载中
|
||||
hasMore: true, //是否还有更多数据
|
||||
currentPage: 1,
|
||||
totalSize: 0,
|
||||
baseImg: app.restAjax.baseUrl.tradeUrl + app.restAjax.baseUrl.baseImgUrl
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
this.setData({
|
||||
shopId: options.shopId,
|
||||
catalogId: options.catalogId,
|
||||
shopCart: app.globalData.shopCart
|
||||
})
|
||||
this.getShopGoodsList(this.data.catalogId)
|
||||
},
|
||||
//根据类目Id获取商店商品
|
||||
getShopGoodsList(catalogID) {
|
||||
let _self = this
|
||||
app.restAjax.get(
|
||||
app.restAjax.path(app.restAjax.apis.getGoodsByCatalogAndShop, [app.restAjax.baseUrl.tradeUrl, catalogID]), {
|
||||
page: _self.data.currentPage,
|
||||
shopId: _self.data.shopId
|
||||
}, {
|
||||
headers: {
|
||||
token: app.globalData.token
|
||||
}
|
||||
}, (code, data) => {
|
||||
_self.setData({
|
||||
isLoadMore: false
|
||||
})
|
||||
if (code == 200) {
|
||||
if (data.rows.length > 0) {
|
||||
data.rows.forEach(it => {
|
||||
//判断购物车是否存在该商品
|
||||
if (app.globalData.shopCart.length > 0) {
|
||||
app.globalData.shopCart.forEach(i => {
|
||||
if (i.goodsId == it.goodsId) {
|
||||
it.buyNum = i.buyNum
|
||||
} else {
|
||||
it.buyNum = 0
|
||||
}
|
||||
})
|
||||
} else {
|
||||
it.buyNum = 0
|
||||
}
|
||||
})
|
||||
_self.data.goodsList = _self.data.goodsList.concat(data.rows)
|
||||
_self.setData({
|
||||
goodsList: _self.data.goodsList
|
||||
})
|
||||
} else {
|
||||
_self.setData({
|
||||
hasMore: false
|
||||
})
|
||||
}
|
||||
}
|
||||
}, (code, error) => {
|
||||
wx.hideLoading({})
|
||||
if (error.msg) {
|
||||
app.dialog.msg(error.msg)
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '网络错误',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
doLoadMore(e) {
|
||||
let _self = this
|
||||
if (_self.data.hasMore) {
|
||||
if (_self.data.isLoadMore) {
|
||||
return
|
||||
}
|
||||
_self.setData({
|
||||
isLoadMore: true,
|
||||
currentPage: ++_self.data.currentPage
|
||||
})
|
||||
_self.getShopGoodsList(_self.data.catalogId)
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '暂无更多数据',
|
||||
icon: 'none',
|
||||
duration: 500
|
||||
})
|
||||
}
|
||||
},
|
||||
//商品详情页面
|
||||
toGoodsDetail(e) {
|
||||
let _self = this
|
||||
wx.navigateTo({
|
||||
url: '../../product/goodsdetail?shopId=' + _self.data.shopId + '&goodsId=' + e.currentTarget.dataset.item.goodsId,
|
||||
})
|
||||
},
|
||||
onShow() {
|
||||
let _self = this
|
||||
if (app.globalData.shopCart.length > 0) {
|
||||
_self.data.goodsList.forEach(it => {
|
||||
var isExist = false
|
||||
app.globalData.shopCart.forEach(i => {
|
||||
if (i.goodsId == it.goodsId) {
|
||||
isExist = true
|
||||
it.buyNum = i.buyNum
|
||||
}
|
||||
})
|
||||
if (!isExist) {
|
||||
it.buyNum = 0
|
||||
}
|
||||
})
|
||||
} else {
|
||||
_self.data.goodsList.forEach(it => {
|
||||
it.buyNum = 0
|
||||
})
|
||||
}
|
||||
_self.setData({
|
||||
goodsList: _self.data.goodsList
|
||||
})
|
||||
if (_self.selectComponent('#sCart')) {
|
||||
_self.selectComponent('#sCart').refreshCart()
|
||||
}
|
||||
},
|
||||
//列表添加购物车
|
||||
addToCart(e) {
|
||||
let _self = this
|
||||
let goods = e.currentTarget.dataset.item
|
||||
_self.data.goodsList.forEach(it => {
|
||||
if (goods.goodsId == it.goodsId) {
|
||||
it.buyNum += 1
|
||||
if (it.buyNum > goods.goodsTotal) {
|
||||
it.buyNum = goods.goodsTotal
|
||||
wx.showToast({
|
||||
title: '超出库存',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
_self.setData({
|
||||
goodsList: _self.data.goodsList
|
||||
})
|
||||
_self.selectComponent('#sCart').listAddToCart(goods)
|
||||
},
|
||||
removeToCart(e) {
|
||||
let goods = e.currentTarget.dataset.item
|
||||
let _self = this
|
||||
_self.data.goodsList.forEach(it => {
|
||||
if (goods.goodsId == it.goodsId) {
|
||||
it.buyNum -= 1
|
||||
}
|
||||
})
|
||||
_self.setData({
|
||||
goodsList: _self.data.goodsList
|
||||
})
|
||||
this.selectComponent('#sCart').listRemoveCart(goods)
|
||||
},
|
||||
//显示购物车弹框
|
||||
doShowCart() {
|
||||
if (this.data.shopCart.length > 0) {
|
||||
this.setData({
|
||||
isShowCart: true
|
||||
})
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '购物车空空如也',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
},
|
||||
//隐藏购物车弹框
|
||||
onHideCart() {
|
||||
this.setData({
|
||||
isShowCart: false
|
||||
})
|
||||
},
|
||||
//删除购物车中的商品
|
||||
delGoods(e) {
|
||||
let _self = this
|
||||
var index = e.currentTarget.dataset.index
|
||||
var goods = e.currentTarget.dataset.goods
|
||||
app.globalData.shopCart.splice(index, 1)
|
||||
//删除购物车中数据
|
||||
_self.selectComponent('#sCart').refreshCart()
|
||||
//将列表中的数据购买数量重置
|
||||
_self.data.goodsList.forEach(it => {
|
||||
if (it.goodsId == goods.goodsId) {
|
||||
it.buyNum = 0
|
||||
}
|
||||
})
|
||||
_self.setData({
|
||||
goodsList: _self.data.goodsList,
|
||||
shopCart: app.globalData.shopCart
|
||||
})
|
||||
if (_self.data.shopCart.length <= 0) {
|
||||
_self.setData({
|
||||
isShowCart: false
|
||||
})
|
||||
}
|
||||
},
|
||||
//购物车弹框删除或添加商品
|
||||
onChange(e) {
|
||||
let buyNum = e.detail
|
||||
let goods = e.currentTarget.dataset.goods
|
||||
let _self = this
|
||||
//遍历列表
|
||||
_self.data.goodsList.forEach(it => {
|
||||
if (it.goodsId == goods.goodsId) {
|
||||
it.buyNum = buyNum
|
||||
}
|
||||
})
|
||||
//遍历购物车
|
||||
_self.data.shopCart.forEach(it => {
|
||||
if (it.goodsId == goods.goodsId) {
|
||||
it.buyNum = buyNum
|
||||
}
|
||||
})
|
||||
//刷新视图
|
||||
_self.setData({
|
||||
goodsList: _self.data.goodsList,
|
||||
shopCart: _self.data.shopCart
|
||||
})
|
||||
//刷新购物车
|
||||
_self.selectComponent('#sCart').refreshCart()
|
||||
},
|
||||
onHide() {
|
||||
this.setData({
|
||||
isShowCart: false
|
||||
})
|
||||
}
|
||||
})
|
64
packagecard/shop/catalog/bannerlist/goodscataloglist.wxml
Normal file
64
packagecard/shop/catalog/bannerlist/goodscataloglist.wxml
Normal file
@ -0,0 +1,64 @@
|
||||
<!--pages/shop/catalog/bannerlist/bannerlist.wxml-->
|
||||
<cu-custom isBack="{{true}}" isRelaunch="{{false}}">
|
||||
<view slot="content">服务</view>
|
||||
</cu-custom>
|
||||
<scroll-view scroll-y="true" bindscrolltolower="doLoadMore" style="height:{{contentHeight}}px;margin-bottom:80rpx;"
|
||||
wx:if="{{goodsList.length>0}}">
|
||||
<!-- 全部商品列表 -->
|
||||
<view class="cu-list menu-avatar">
|
||||
<view class="cu-item" wx:for="{{goodsList}}" wx:key="index">
|
||||
<view class="cu-avatar radius lg" style="background-image:url({{baseImg+item.goodsIcon}});"
|
||||
bindtap="toGoodsDetail" data-item="{{item}}">
|
||||
</view>
|
||||
<view class="content" style="width:75%;">
|
||||
<view class="text-depblack" bindtap="toGoodsDetail" data-item="{{item}}">{{item.goodsName}}</view>
|
||||
<view class="text-gray text-sm flex" bindtap="toGoodsDetail" data-item="{{item}}">
|
||||
<text class="text-cut">
|
||||
<text class="text-red margin-right-xs"></text>{{item.goodsSummary}}
|
||||
</text>
|
||||
</view>
|
||||
<!-- 底部按钮 -->
|
||||
<view class="flex justify-between" style="align-items:center;">
|
||||
<view class="text-red text-df">¥{{item.goodsUnitPrice}}</view>
|
||||
<view class="flex margin-top-xs" style="align-items:center;">
|
||||
<image src="/images/ic_remove_cart.png" mode="scaleToFill" style="width:40rpx;height:40rpx;"
|
||||
data-item="{{item}}" bindtap="removeToCart" wx:if="{{item.buyNum>0}}"></image>
|
||||
<view class="solid"
|
||||
style="width:auto;height:40rpx;min-width:60rpx;text-align:center;display:flex;justify-content:center;align-items:center;">
|
||||
{{item.buyNum}}</view>
|
||||
<image src="/images/ic_add_cart.png" mode="scaleToFill" style="width:40rpx;height:40rpx;"
|
||||
data-item="{{item}}" bindtap="addToCart"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<van-empty description="暂无数据" wx:else />
|
||||
|
||||
<customcart id="sCart" shopId="{{shopId}}" showBtn="{{false}}" bind:showcart="doShowCart"
|
||||
wx:if="{{goodsList.length>0}}">
|
||||
</customcart>
|
||||
|
||||
|
||||
|
||||
<van-action-sheet show="{{ isShowCart }}" title="购物车" bind:close="onHideCart" style="padding-bottom:180rpx;z-index:90;">
|
||||
<view class="cu-card article" style="margin-top:10rpx;padding-bottom:80rpx;">
|
||||
<view class="cu-item shadow padding-sm" wx:for="{{shopCart}}" wx:key="index" data-item="{{item}}">
|
||||
<view class="content">
|
||||
<image src="{{baseImg+item.goodsIcon}}" mode="scaleToFill"></image>
|
||||
<view class="desc">
|
||||
<view>{{item.goodsName}}</view>
|
||||
<view class="text-cut-width">{{item.goodsSummary}}</view>
|
||||
<view class="flex justify-between" style="align-items:center;">
|
||||
<view class="text-red">¥{{item.goodsUnitPrice}}</view>
|
||||
<van-stepper value="{{ item.buyNum }}" bind:change="onChange" data-goods="{{item}}"
|
||||
integer="true" min="1" />
|
||||
<view class="cu-tag text-red" bindtap="delGoods" data-index="{{index}}" data-goods="{{item}}">删除
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</van-action-sheet>
|
@ -0,0 +1 @@
|
||||
/* pages/shop/catalog/bannerlist/goodscataloglist.wxss */
|
475
packagecard/shop/catalog/column/column.js
Normal file
475
packagecard/shop/catalog/column/column.js
Normal file
@ -0,0 +1,475 @@
|
||||
// pages/category/index.js
|
||||
const app = getApp()
|
||||
Page({
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
CustomBar: app.globalData.CustomBar,
|
||||
productList: [],
|
||||
isRefreshing: false,
|
||||
currentPage: 1,
|
||||
totalSize: 0,
|
||||
shopId: '',
|
||||
isAddPage: false,
|
||||
isCatalogPage: false,
|
||||
activeNames: ['0'],
|
||||
baseImageUrl: app.loginUrl + app.baseImgUrl,
|
||||
currentCatalogId: '',
|
||||
curIndex: 0,
|
||||
active: 1,
|
||||
curGoodsList: [],
|
||||
contentHeight: app.globalData.windowHeight - app.globalData.CustomBar,
|
||||
isLoadMore: false,
|
||||
hasMore: true,
|
||||
isShowCart: false,
|
||||
shopCart: [],
|
||||
baseImg: app.restAjax.baseUrl.tradeUrl + app.restAjax.baseUrl.baseImgUrl,
|
||||
},
|
||||
/**
|
||||
* 切换类目
|
||||
*/
|
||||
switchRightTap(e) {
|
||||
let curindex = parseInt(e.currentTarget.dataset.curindex);
|
||||
this.data.productList[curindex].goodsList = []
|
||||
this.setData({
|
||||
currentPage: 1,
|
||||
hasMore: true,
|
||||
isLoadMore: false,
|
||||
curIndex: curindex
|
||||
})
|
||||
let item = this.data.productList[curindex]
|
||||
this.getGoodsListByCId(item.categoryId)
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
this.setData({
|
||||
shopId: options.shopId,
|
||||
shopCart: app.globalData.shopCart
|
||||
})
|
||||
this.getShopCatalogList(this.data.shopId)
|
||||
this.selectComponent('#sCart').refreshCart()
|
||||
},
|
||||
//获取店铺所有商品类目
|
||||
getShopCatalogList(id) {
|
||||
let _self = this
|
||||
wx.showLoading({
|
||||
title: '加载中...',
|
||||
})
|
||||
app.restAjax.get(app.restAjax.path(app.apis.getShopCatalogList, [app.baseUrls.tradeUrl, id]), {}, {
|
||||
headers: {
|
||||
token: app.globalData.token
|
||||
}
|
||||
}, (code, data) => {
|
||||
wx.hideLoading({})
|
||||
_self.setData({
|
||||
isRefreshing: false
|
||||
})
|
||||
if (code == 200) {
|
||||
_self.buildDatas(data)
|
||||
}
|
||||
}, (code, error) => {
|
||||
wx.hideLoading({})
|
||||
if (error.msg) {
|
||||
app.dialog.msg(error.msg)
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '网络错误',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
doAdd(e) {
|
||||
let key = e.currentTarget.dataset.key
|
||||
if ('chooseCatalog' == key) {
|
||||
wx.navigateTo({
|
||||
url: './choosecatalog?shopId=' + this.data.shopId,
|
||||
})
|
||||
} else {
|
||||
if (e.currentTarget.dataset.item) {
|
||||
wx.navigateTo({
|
||||
url: './addproduct?shopId=' + this.data.shopId + '&cataLogId=' + e.currentTarget.dataset.item.categoryId,
|
||||
})
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '请先添加类目',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
manageGoods(e) {
|
||||
wx.navigateTo({
|
||||
url: '../../product/goodsdetail?shopId=' + e.currentTarget.dataset.item.shopId + '&goodsId=' + e.currentTarget.dataset.item.goodsId
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 获取商品列表
|
||||
*/
|
||||
getGoodsList(shopId) {
|
||||
wx.showLoading({
|
||||
title: '加载中...',
|
||||
})
|
||||
app.restAjax.get(app.restAjax.path(app.apis.getShopGoodsList, [app.baseUrls.tradeUrl, shopId]), {}, {
|
||||
headers: {
|
||||
token: app.globalData.token
|
||||
}
|
||||
}, (code, data) => {
|
||||
wx.hideLoading({})
|
||||
this.setData({
|
||||
isRefreshing: false
|
||||
})
|
||||
if (code == 200) {
|
||||
this.buildDatas(data)
|
||||
}
|
||||
}, (code, error) => {
|
||||
wx.hideLoading({})
|
||||
if (error.msg) {
|
||||
app.dialog.msg(error.msg)
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '网络错误',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
//构建数据
|
||||
buildDatas(data) {
|
||||
let _self = this
|
||||
if (data.length > 0) {
|
||||
data.forEach(el => {
|
||||
el.goodsList = []
|
||||
_self.data.productList.push(el)
|
||||
})
|
||||
_self.setData({
|
||||
curIndex: 0,
|
||||
productList: _self.data.productList
|
||||
})
|
||||
_self.getGoodsListByCId(_self.data.productList[0].categoryId)
|
||||
}
|
||||
},
|
||||
//去除重复的
|
||||
unique(rows) {
|
||||
let temp = rows.concat()
|
||||
let tempList = []
|
||||
for (var i = 0; i < temp.length; i++) {
|
||||
for (var j = i + 1; j < temp.length; j++) {
|
||||
if (temp[i].categoryId == temp[j].categoryId) {
|
||||
temp.splice(j, 1);
|
||||
j--
|
||||
}
|
||||
}
|
||||
}
|
||||
temp.forEach(el => {
|
||||
tempList.push({
|
||||
name: el.categoryName,
|
||||
id: el.categoryId,
|
||||
goods: []
|
||||
})
|
||||
})
|
||||
return tempList
|
||||
},
|
||||
//刷新页面
|
||||
dorefreshList() {
|
||||
this.setData({
|
||||
currentPage: 1,
|
||||
isLoadMore: false,
|
||||
hasMore: true,
|
||||
productList: []
|
||||
})
|
||||
this.getShopCatalogList(this.data.shopId)
|
||||
},
|
||||
onShow() {
|
||||
if (this.data.isAddPage) {
|
||||
this.setData({
|
||||
isAddPage: false
|
||||
})
|
||||
this.dorefreshList()
|
||||
}
|
||||
this.selectComponent('#sCart').refreshCart()
|
||||
},
|
||||
//根据类目ID获取商品
|
||||
getGoodsListByCId(id) {
|
||||
let _self = this
|
||||
wx.showLoading({
|
||||
title: '加载中...',
|
||||
})
|
||||
app.restAjax.get(app.restAjax.path(app.apis.getGoodsByCatalogAndShop, [app.baseUrls.tradeUrl, id]), {
|
||||
page: _self.data.currentPage,
|
||||
shopId: _self.data.shopId
|
||||
}, {
|
||||
headers: {
|
||||
token: app.globalData.token
|
||||
}
|
||||
}, (code, data) => {
|
||||
wx.hideLoading({})
|
||||
_self.setData({
|
||||
isLoadMore: false
|
||||
})
|
||||
if (code == 200) {
|
||||
if (data.rows.length > 0) {
|
||||
data.rows.forEach(it => {
|
||||
it.buyNum = 0
|
||||
})
|
||||
data.rows.forEach(it => {
|
||||
//判断购物车是否存在该商品
|
||||
if (app.globalData.shopCart.length > 0) {
|
||||
app.globalData.shopCart.forEach(i => {
|
||||
if (i.goodsId == it.goodsId) {
|
||||
it.buyNum = i.buyNum
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
_self.data.productList.forEach(el => {
|
||||
if (el.categoryId == id) {
|
||||
el.goodsList = el.goodsList.concat(data.rows)
|
||||
}
|
||||
})
|
||||
_self.setData({
|
||||
productList: _self.data.productList
|
||||
})
|
||||
} else {
|
||||
_self.setData({
|
||||
hasMore: false
|
||||
})
|
||||
}
|
||||
}
|
||||
}, (code, error) => {
|
||||
wx.hideLoading({})
|
||||
_self.setData({
|
||||
isLoadMore: false
|
||||
})
|
||||
if (error.msg) {
|
||||
app.dialog.msg(error.msg)
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '网络错误',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
onChange(e) {
|
||||
let _self = this
|
||||
let item = e.currentTarget.dataset.item
|
||||
this.setData({
|
||||
activeNames: e.detail,
|
||||
currentCatalogId: item.categoryId
|
||||
})
|
||||
console.log(e)
|
||||
if (e.detail.length > 1) {
|
||||
//展开
|
||||
if (item.goodsList || item.goodsList.length <= 0) {
|
||||
_self.getGoodsListByCId(item.categoryId)
|
||||
}
|
||||
}
|
||||
},
|
||||
doSearchGoods() {
|
||||
wx.navigateTo({
|
||||
url: './searchproduct?shopId=' + this.data.shopId,
|
||||
})
|
||||
},
|
||||
//加载更多
|
||||
doLoadMore(e) {
|
||||
let _self = this
|
||||
if (_self.data.hasMore) {
|
||||
if (_self.data.isLoadMore) {
|
||||
return
|
||||
}
|
||||
let item = _self.data.productList[_self.data.curIndex]
|
||||
_self.setData({
|
||||
isLoadMore: true,
|
||||
currentPage: ++_self.data.currentPage
|
||||
})
|
||||
_self.getGoodsListByCId(item.categoryId)
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '暂无更多数据',
|
||||
icon: 'none',
|
||||
duration: 500
|
||||
})
|
||||
}
|
||||
},
|
||||
doDelCategory(e) {
|
||||
let _self = this
|
||||
wx.showLoading({
|
||||
title: '删除中...',
|
||||
})
|
||||
app.restAjax.delete(app.restAjax.path(app.apis.doDelShopCategoryById, [app.baseUrls.tradeUrl, e.currentTarget.dataset.item.categoryId]), {}, {
|
||||
headers: {
|
||||
token: app.globalData.token
|
||||
}
|
||||
}, (code, data) => {
|
||||
wx.hideLoading({})
|
||||
if (code == 200) {
|
||||
_self.setData({
|
||||
productList: []
|
||||
})
|
||||
wx.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'success'
|
||||
})
|
||||
_self.getShopCatalogList(_self.data.shopId)
|
||||
}
|
||||
}, (code, error) => {
|
||||
wx.hideLoading({})
|
||||
if (error.msg) {
|
||||
app.dialog.msg(error.msg)
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '网络错误',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
showConfirmDialog(e) {
|
||||
let _self = this
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
content: '确定要删除该类目吗?(删除后该类目下所有商品将删除!)',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
_self.doDelCategory(e)
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
//列表添加购物车
|
||||
addToCart(e) {
|
||||
let _self = this
|
||||
let goods = e.currentTarget.dataset.item
|
||||
_self.data.productList[_self.data.curIndex].goodsList.forEach(it => {
|
||||
if (goods.goodsId == it.goodsId) {
|
||||
it.buyNum += 1
|
||||
if (it.buyNum > goods.goodsTotal) {
|
||||
it.buyNum = goods.goodsTotal
|
||||
wx.showToast({
|
||||
title: '超出库存',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
this.selectComponent('#sCart').listAddToCart(goods)
|
||||
_self.setData({
|
||||
productList: _self.data.productList,
|
||||
shopCart: app.globalData.shopCart
|
||||
})
|
||||
},
|
||||
removeToCart(e) {
|
||||
let goods = e.currentTarget.dataset.item
|
||||
let _self = this
|
||||
_self.data.productList[_self.data.curIndex].goodsList.forEach(it => {
|
||||
if (goods.goodsId == it.goodsId) {
|
||||
it.buyNum -= 1
|
||||
}
|
||||
})
|
||||
this.selectComponent('#sCart').listRemoveCart(goods)
|
||||
_self.setData({
|
||||
productList: _self.data.productList,
|
||||
shopCart: app.globalData.shopCart
|
||||
})
|
||||
},
|
||||
//显示购物车弹框
|
||||
doShowCart() {
|
||||
var _self = this
|
||||
if (this.data.shopCart.length > 0) {
|
||||
//判断当前购物车是否存在该商店的商品
|
||||
var isExist = false
|
||||
this.data.shopCart.forEach(it => {
|
||||
if (it.shopId == _self.data.shopId) {
|
||||
isExist = true
|
||||
}
|
||||
})
|
||||
if (isExist) {
|
||||
if (this.data.isShowCart) {
|
||||
this.setData({
|
||||
isShowCart: false
|
||||
})
|
||||
} else {
|
||||
this.setData({
|
||||
isShowCart: true
|
||||
})
|
||||
}
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '购物车空空如也',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '购物车空空如也',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
},
|
||||
//隐藏购物车弹框
|
||||
onHideCart() {
|
||||
this.setData({
|
||||
isShowCart: false
|
||||
})
|
||||
},
|
||||
//删除购物车中的商品
|
||||
delGoods(e) {
|
||||
let _self = this
|
||||
var index = e.currentTarget.dataset.index
|
||||
var goods = e.currentTarget.dataset.goods
|
||||
app.globalData.shopCart.splice(index, 1)
|
||||
//删除购物车中数据
|
||||
_self.selectComponent('#sCart').refreshCart()
|
||||
//将列表中的数据购买数量重置
|
||||
_self.data.productList[_self.data.curIndex].goodsList.forEach(it => {
|
||||
if (it.goodsId == goods.goodsId) {
|
||||
it.buyNum = 0
|
||||
}
|
||||
})
|
||||
_self.setData({
|
||||
productList: _self.data.productList,
|
||||
shopCart: app.globalData.shopCart
|
||||
})
|
||||
if (_self.data.shopCart.length <= 0) {
|
||||
_self.setData({
|
||||
isShowCart: false
|
||||
})
|
||||
}
|
||||
},
|
||||
//购物车弹框删除或添加商品
|
||||
onChange(e) {
|
||||
let buyNum = e.detail
|
||||
let goods = e.currentTarget.dataset.goods
|
||||
let _self = this
|
||||
//遍历列表
|
||||
_self.data.productList[_self.data.curIndex].goodsList.forEach(it => {
|
||||
if (it.goodsId == goods.goodsId) {
|
||||
it.buyNum = buyNum
|
||||
}
|
||||
})
|
||||
//遍历购物车
|
||||
_self.data.shopCart.forEach(it => {
|
||||
if (it.goodsId == goods.goodsId) {
|
||||
it.buyNum = buyNum
|
||||
}
|
||||
})
|
||||
//刷新视图
|
||||
_self.setData({
|
||||
productList: _self.data.productList,
|
||||
shopCart: _self.data.shopCart
|
||||
})
|
||||
//刷新购物车
|
||||
_self.selectComponent('#sCart').refreshCart()
|
||||
},
|
||||
onHide() {
|
||||
this.setData({
|
||||
isShowCart: false
|
||||
})
|
||||
}
|
||||
})
|
6
packagecard/shop/catalog/column/column.json
Normal file
6
packagecard/shop/catalog/column/column.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"navigationBarTitleText": "分类",
|
||||
"usingComponents": {
|
||||
"loadmore": "/components/loadmore/index"
|
||||
}
|
||||
}
|
76
packagecard/shop/catalog/column/column.wxml
Normal file
76
packagecard/shop/catalog/column/column.wxml
Normal file
@ -0,0 +1,76 @@
|
||||
<!--pages/mine/shop/choose.wxml-->
|
||||
<cu-custom isBack="{{true}}">
|
||||
<view slot="content">商品管理</view>
|
||||
</cu-custom>
|
||||
<view class="category">
|
||||
<!-- 左边分类 -->
|
||||
<scroll-view class="nav_left" scroll-y="true">
|
||||
<block wx:for="{{productList}}" wx:key="index">
|
||||
<view class="nav_left_bg {{curIndex==index ? 'nav_left_item-active nav_left_border' : ''}}"
|
||||
data-curindex="{{index}}">
|
||||
<view class="nav_left_items {{curIndex==index ? 'nav_left_item-active' : ''}} text-cut flex-twice"
|
||||
data-curindex="{{index}}" bindtap="switchRightTap">{{item.categoryName}}
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</scroll-view>
|
||||
<!-- 右边商品 -->
|
||||
<scroll-view class="nav_right" scroll-y="true" bindscrolltolower="doLoadMore" style="height:{{contentHeight}}px">
|
||||
<view class="cu-list menu-avatar" wx:for="{{productList[curIndex].goodsList}}" wx:key="index">
|
||||
<view class="cu-item">
|
||||
<view class="cu-avatar radius xl" style="background-image:url({{baseImageUrl+item.goodsIcon}});"
|
||||
data-item="{{item}}" bindtap="manageGoods">
|
||||
<!-- <view class="{{item.goodsStatus == 1 ? 'cu-tag badge' : 'cu-tag badgegray'}}">
|
||||
{{item.goodsStatus=='1' ? '在售' : '下架' }}</view> -->
|
||||
</view>
|
||||
<view class="content" style="width:85%;">
|
||||
<view class="text-depblack" data-item="{{item}}" bindtap="manageGoods" style="width:80%;">
|
||||
<text class="text-cut">{{item.goodsName}}</text>
|
||||
<text class="cuIcon-hotfill lg text-red" wx:if="{{item.isPopular == '1' }}"></text>
|
||||
</view>
|
||||
<view class="text-gray text-sm flex" style="width:80%;" data-item="{{item}}" bindtap="manageGoods">
|
||||
<text class="text-cut">{{item.goodsSummary}}</text>
|
||||
</view>
|
||||
<view class="bottom-action margin-top-ls">
|
||||
<view class="text-lg text-red">¥:{{item.goodsUnitPrice}}</view>
|
||||
<view class="flex margin-top-xs" style="align-items:center;">
|
||||
<image src="/images/ic_remove_cart.png" mode="scaleToFill" style="width:40rpx;height:40rpx;"
|
||||
data-item="{{item}}" bindtap="removeToCart" wx:if="{{item.buyNum>0}}"></image>
|
||||
<view class="solid"
|
||||
style="width:auto;height:40rpx;min-width:60rpx;text-align:center;display:flex;justify-content:center;align-items:center;">
|
||||
{{item.buyNum}}</view>
|
||||
<image src="/images/ic_add_cart.png" mode="scaleToFill" style="width:40rpx;height:40rpx;"
|
||||
data-item="{{item}}" bindtap="addToCart"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<van-loading wx:if="{{isLoadMore}}" size="24px">加载中...</van-loading>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<customcart id="sCart" shopId="{{shopId}}" showBtn="{{false}}" bind:showcart="doShowCart">
|
||||
|
||||
</customcart>
|
||||
|
||||
<van-action-sheet show="{{ isShowCart }}" title="购物车" bind:close="onHideCart" style="padding-bottom:180rpx;">
|
||||
<view class="cu-card article" style="margin-top:10rpx;padding-bottom:80rpx;">
|
||||
<view class="cu-item shadow padding-sm" wx:for="{{shopCart}}" wx:key="index" data-item="{{item}}">
|
||||
<view class="content">
|
||||
<image src="{{baseImg+item.goodsIcon}}" mode="scaleToFill" style="width:80px;height:80px;"></image>
|
||||
<view class="desc">
|
||||
<view>{{item.goodsName}}</view>
|
||||
<view class="text-cut-width">{{item.goodsSummary}}</view>
|
||||
<view class="flex justify-between" style="align-items:center;">
|
||||
<view class="text-red">¥{{item.goodsUnitPrice}}</view>
|
||||
<van-stepper value="{{ item.buyNum }}" bind:change="onChange" data-goods="{{item}}" integer="true"
|
||||
min="1" />
|
||||
<view class="cu-tag text-red" bindtap="delGoods" data-index="{{index}}" data-goods="{{item}}">删除
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</van-action-sheet>
|
94
packagecard/shop/catalog/column/column.wxss
Normal file
94
packagecard/shop/catalog/column/column.wxss
Normal file
@ -0,0 +1,94 @@
|
||||
/* pages/mine/product/productmanage/productlist.wxss */
|
||||
|
||||
.category {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
height: 100%;
|
||||
margin-bottom: 80rpx;
|
||||
}
|
||||
|
||||
.nav_left {
|
||||
background: #f8f8f8;
|
||||
width: 30%;
|
||||
height: 100%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.nav_right {
|
||||
background: #fff;
|
||||
width: 70%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.nav_left_bg {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 10rpx;
|
||||
background: #f8f8f8;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 0;
|
||||
height: 0;
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
.nav_left_items {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.nav_left_border {
|
||||
border-left-color: #0054bd;
|
||||
border-left-width: 2px;
|
||||
border-left-style: solid;
|
||||
}
|
||||
|
||||
.nav_left_item-active {
|
||||
background-color: #fff;
|
||||
color: #0054bd;
|
||||
}
|
||||
|
||||
.jd-category {
|
||||
margin: 40rpx 16rpx 0;
|
||||
}
|
||||
|
||||
.jd-category-wrap {
|
||||
overflow: hidden;
|
||||
padding: 20rpx 20rpx 0;
|
||||
}
|
||||
|
||||
.jd-category .title {
|
||||
font-size: 28rpx;
|
||||
height: 60rpx;
|
||||
line-height: 30rpx;
|
||||
font-weight: 700;
|
||||
color: #080808
|
||||
}
|
||||
|
||||
.jd-category-style {
|
||||
width: 32.8%;
|
||||
float: left;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.list_img {
|
||||
width: 150rpx;
|
||||
height: 150rpx;
|
||||
}
|
||||
|
||||
.list_text {
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
color: #686868;
|
||||
margin-top: 10rpx;
|
||||
height: 70rpx;
|
||||
}
|
300
packagecard/shop/catalog/list/list.js
Normal file
300
packagecard/shop/catalog/list/list.js
Normal file
@ -0,0 +1,300 @@
|
||||
// pages/shop/catalog/list/list.js
|
||||
const app = getApp()
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
shopId: '',
|
||||
active: 1,
|
||||
swiperlist: [],
|
||||
typeMenu: [],
|
||||
goodsList: [],
|
||||
currentPage: 1,
|
||||
contentHeight: app.globalData.windowHeight,
|
||||
isLoadMore: false, //是否在加载中
|
||||
hasMore: true, //是否还有更多数据
|
||||
currentPage: 1,
|
||||
totalSize: 0,
|
||||
baseImg: app.baseUrls.tradeUrl + app.baseUrls.baseImgUrl,
|
||||
isShowCart: false,
|
||||
shopCart: [],
|
||||
countTime: 2000, //延迟搜索 时间
|
||||
searchWaiting: false, //是否等待搜索倒计时中,
|
||||
searchKey: ''
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
this.setData({
|
||||
shopId: options.shopId,
|
||||
shopCart: app.globalData.shopCart
|
||||
})
|
||||
//获取全部商品
|
||||
this.getShopGoodsListByPage()
|
||||
this.selectComponent('#sCart').refreshCart()
|
||||
},
|
||||
getShopGoodsListByPage() {
|
||||
let _self = this
|
||||
wx.showLoading({
|
||||
title: '加载中...',
|
||||
})
|
||||
app.restAjax.get(
|
||||
app.restAjax.path(app.apis.getShopGoodsList, [app.baseUrls.tradeUrl, _self.data.shopId]), {
|
||||
page: _self.data.currentPage,
|
||||
keywords: _self.data.searchKey
|
||||
}, {
|
||||
headers: {
|
||||
token: app.globalData.token
|
||||
}
|
||||
}, (code, data) => {
|
||||
wx.hideLoading({})
|
||||
_self.setData({
|
||||
isLoadMore: false
|
||||
})
|
||||
if (code == 200) {
|
||||
if (data.rows.length > 0) {
|
||||
data.rows.forEach(it => {
|
||||
//构建图片
|
||||
var photos = it.goodsPhotos
|
||||
var pList = photos.split(',')
|
||||
it.showPhoto = _self.data.baseImg + pList[0]
|
||||
//判断购物车是否存在该商品
|
||||
if (app.globalData.shopCart.length > 0) {
|
||||
app.globalData.shopCart.forEach(i => {
|
||||
if (i.goodsId == it.goodsId) {
|
||||
it.buyNum = i.buyNum
|
||||
} else {
|
||||
it.buyNum = 0
|
||||
}
|
||||
})
|
||||
} else {
|
||||
it.buyNum = 0
|
||||
}
|
||||
})
|
||||
_self.data.goodsList = _self.data.goodsList.concat(data.rows)
|
||||
_self.setData({
|
||||
goodsList: _self.data.goodsList
|
||||
})
|
||||
} else {
|
||||
_self.setData({
|
||||
hasMore: false
|
||||
})
|
||||
}
|
||||
}
|
||||
}, (code, error) => {
|
||||
wx.hideLoading({})
|
||||
if (error.msg) {
|
||||
app.dialog.msg(error.msg)
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '网络错误',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
doLoadMore(e) {
|
||||
let _self = this
|
||||
if (_self.data.hasMore) {
|
||||
if (_self.data.isLoadMore) {
|
||||
return
|
||||
}
|
||||
_self.setData({
|
||||
isLoadMore: true,
|
||||
currentPage: ++_self.data.currentPage
|
||||
})
|
||||
_self.getShopGoodsListByPage(_self.data.shopId)
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '暂无更多数据',
|
||||
icon: 'none',
|
||||
duration: 500
|
||||
})
|
||||
}
|
||||
},
|
||||
//商品详情页面
|
||||
toGoodsDetail(e) {
|
||||
let _self = this
|
||||
wx.navigateTo({
|
||||
url: '../../product/goodsdetail?shopId=' + _self.data.shopId + '&goodsId=' + e.currentTarget.dataset.item.goodsId,
|
||||
})
|
||||
},
|
||||
//列表添加购物车
|
||||
addToCart(e) {
|
||||
let _self = this
|
||||
let goods = e.currentTarget.dataset.item
|
||||
_self.data.goodsList.forEach(it => {
|
||||
if (goods.goodsId == it.goodsId) {
|
||||
it.buyNum += 1
|
||||
if (it.buyNum > goods.goodsTotal) {
|
||||
it.buyNum = goods.goodsTotal
|
||||
wx.showToast({
|
||||
title: '超出库存',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
this.selectComponent('#sCart').listAddToCart(goods)
|
||||
_self.setData({
|
||||
goodsList: _self.data.goodsList,
|
||||
shopCart: app.globalData.shopCart
|
||||
})
|
||||
},
|
||||
removeToCart(e) {
|
||||
let goods = e.currentTarget.dataset.item
|
||||
let _self = this
|
||||
_self.data.goodsList.forEach(it => {
|
||||
if (goods.goodsId == it.goodsId) {
|
||||
it.buyNum -= 1
|
||||
}
|
||||
})
|
||||
this.selectComponent('#sCart').listRemoveCart(goods)
|
||||
_self.setData({
|
||||
goodsList: _self.data.goodsList,
|
||||
shopCart: app.globalData.shopCart
|
||||
})
|
||||
},
|
||||
//显示购物车弹框
|
||||
doShowCart() {
|
||||
var _self = this
|
||||
if (this.data.shopCart.length > 0) {
|
||||
//判断当前购物车是否存在该商店的商品
|
||||
var isExist = false
|
||||
this.data.shopCart.forEach(it => {
|
||||
if (it.shopId == _self.data.shopId) {
|
||||
isExist = true
|
||||
}
|
||||
})
|
||||
if (isExist) {
|
||||
if (this.data.isShowCart) {
|
||||
this.setData({
|
||||
isShowCart: false
|
||||
})
|
||||
} else {
|
||||
this.setData({
|
||||
isShowCart: true
|
||||
})
|
||||
}
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '购物车空空如也',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '购物车空空如也',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
},
|
||||
//隐藏购物车弹框
|
||||
onHideCart() {
|
||||
this.setData({
|
||||
isShowCart: false
|
||||
})
|
||||
},
|
||||
//删除购物车中的商品
|
||||
delGoods(e) {
|
||||
let _self = this
|
||||
var index = e.currentTarget.dataset.index
|
||||
var goods = e.currentTarget.dataset.goods
|
||||
app.globalData.shopCart.splice(index, 1)
|
||||
//删除购物车中数据
|
||||
_self.selectComponent('#sCart').refreshCart()
|
||||
//将列表中的数据购买数量重置
|
||||
_self.data.goodsList.forEach(it => {
|
||||
if (it.goodsId == goods.goodsId) {
|
||||
it.buyNum = 0
|
||||
}
|
||||
})
|
||||
_self.setData({
|
||||
goodsList: _self.data.goodsList,
|
||||
shopCart: app.globalData.shopCart
|
||||
})
|
||||
if (_self.data.shopCart.length <= 0) {
|
||||
_self.setData({
|
||||
isShowCart: false
|
||||
})
|
||||
}
|
||||
},
|
||||
//购物车弹框删除或添加商品
|
||||
onChange(e) {
|
||||
let buyNum = e.detail
|
||||
let goods = e.currentTarget.dataset.goods
|
||||
let _self = this
|
||||
//遍历列表
|
||||
_self.data.goodsList.forEach(it => {
|
||||
if (it.goodsId == goods.goodsId) {
|
||||
it.buyNum = buyNum
|
||||
}
|
||||
})
|
||||
//遍历购物车
|
||||
_self.data.shopCart.forEach(it => {
|
||||
if (it.goodsId == goods.goodsId) {
|
||||
it.buyNum = buyNum
|
||||
}
|
||||
})
|
||||
//刷新视图
|
||||
_self.setData({
|
||||
goodsList: _self.data.goodsList,
|
||||
shopCart: _self.data.shopCart
|
||||
})
|
||||
//刷新购物车
|
||||
_self.selectComponent('#sCart').refreshCart()
|
||||
},
|
||||
onHide() {
|
||||
this.setData({
|
||||
isShowCart: false
|
||||
})
|
||||
},
|
||||
searchGoods(e) {
|
||||
this.setData({
|
||||
countTime: 2000,
|
||||
searchKey: e.detail.value,
|
||||
})
|
||||
//是否处于搜索倒计时中
|
||||
if (!this.data.searchWaiting) {
|
||||
this.timer();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 延迟搜索
|
||||
*/
|
||||
timer() {
|
||||
var that = this;
|
||||
this.setData({
|
||||
searchWaiting: true
|
||||
})
|
||||
|
||||
let promise = new Promise((resolve, reject) => {
|
||||
let setTimer = setInterval(
|
||||
() => {
|
||||
console.log('搜索倒计时: ' + that.data.countTime);
|
||||
this.setData({
|
||||
countTime: this.data.countTime - 1000
|
||||
})
|
||||
if (this.data.countTime <= 0) {
|
||||
console.log('开始搜索: ' + that.data.params);
|
||||
this.setData({
|
||||
countTime: 2000,
|
||||
searchWaiting: false,
|
||||
})
|
||||
resolve(setTimer)
|
||||
}
|
||||
}, 1000)
|
||||
})
|
||||
promise.then((setTimer) => {
|
||||
this.setData({
|
||||
currentPage: 1,
|
||||
goodsList: []
|
||||
})
|
||||
this.getShopGoodsListByPage()
|
||||
clearInterval(setTimer) //清除计时器
|
||||
})
|
||||
},
|
||||
})
|
60
packagecard/shop/catalog/list/list.wxml
Normal file
60
packagecard/shop/catalog/list/list.wxml
Normal file
@ -0,0 +1,60 @@
|
||||
<!--pages/shop/catalog/list/list.wxml-->
|
||||
<cu-custom isBack="{{true}}" isRelaunch="{{false}}">
|
||||
<view slot="content">服务</view>
|
||||
</cu-custom>
|
||||
<!-- 搜索框 -->
|
||||
<view class="cu-bar search bg-white padding-xs">
|
||||
<view class="search-form radius">
|
||||
<text class="cuIcon-search"></text>
|
||||
<input type="text" placeholder="搜商品关键字,如:手机" confirm-type="search" bindinput="searchGoods"></input>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 商品列表 -->
|
||||
<scroll-view scroll-y="true" bindscrolltolower="doLoadMore" style="height:{{contentHeight}}px;margin-bottom:80rpx;">
|
||||
<view wx:for="{{goodsList}}" wx:key="index">
|
||||
<view class="cu-card case margin-sm">
|
||||
<view class="cu-item shadow" bindtap="toGoodsDetail" data-item="{{item}}">
|
||||
<view class="image" style="height:320rpx">
|
||||
<image src="{{item.showPhoto}}" mode="widthFix"></image>
|
||||
<view class="cu-tag bg-red">热销</view>
|
||||
</view>
|
||||
<view class="cu-list bg-black-tr">
|
||||
<view class="cu-item bg-black-tr">
|
||||
<view class="flex justify-between">
|
||||
<view class="margin-left-sm text-white text-xl">{{item.goodsName}}</view>
|
||||
<view class="text-red text-xxl flex justify-end">
|
||||
<view class="text-red text-xxl margin-right">
|
||||
<text class="margin-lr"></text>¥{{item.goodsUnitPrice}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<customcart id="sCart" shopId="{{shopId}}" showBtn="{{false}}" bind:showcart="doShowCart">
|
||||
|
||||
</customcart>
|
||||
|
||||
<van-action-sheet show="{{ isShowCart }}" title="购物车" bind:close="onHideCart" style="padding-bottom:180rpx;">
|
||||
<view class="cu-card article" style="margin-top:10rpx;padding-bottom:80rpx;">
|
||||
<view class="cu-item shadow padding-sm" wx:for="{{shopCart}}" wx:key="index" data-item="{{item}}">
|
||||
<view class="content">
|
||||
<image src="{{baseImg+item.goodsIcon}}" mode="scaleToFill" style="width:80px;height:80px;"></image>
|
||||
<view class="desc">
|
||||
<view>{{item.goodsName}}</view>
|
||||
<view class="text-cut-width">{{item.goodsSummary}}</view>
|
||||
<view class="flex justify-between" style="align-items:center;">
|
||||
<view class="text-red">¥{{item.goodsUnitPrice}}</view>
|
||||
<van-stepper value="{{ item.buyNum }}" bind:change="onChange" data-goods="{{item}}" integer="true"
|
||||
min="1" />
|
||||
<view class="cu-tag text-red" bindtap="delGoods" data-index="{{index}}" data-goods="{{item}}">删除
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</van-action-sheet>
|
1
packagecard/shop/catalog/list/list.wxss
Normal file
1
packagecard/shop/catalog/list/list.wxss
Normal file
@ -0,0 +1 @@
|
||||
/* pages/shop/catalog/list/list.wxss */
|
121
packagecard/shop/index/shop.js
Normal file
121
packagecard/shop/index/shop.js
Normal file
@ -0,0 +1,121 @@
|
||||
// pages/shop/shop.js
|
||||
const app = getApp()
|
||||
Page({
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
type: app.globalData.servicePageType,
|
||||
isPageBack: false,
|
||||
active: 1
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
// if (this.data.type == 1) {
|
||||
// console.log("测试")
|
||||
// wx.navigateTo({
|
||||
// url: '../../shop/catalog/bannerlist/bannerlist'
|
||||
// })
|
||||
// } else if (this.data.type == 2) {
|
||||
// wx.navigateTo({
|
||||
// url: '../../shop/catalog/column/column',
|
||||
// })
|
||||
// } else if (this.data.type == 3) {
|
||||
// wx.navigateTo({
|
||||
// url: '../../shop/catalog/list/list',
|
||||
// })
|
||||
// } else if (this.data.type == 4) {
|
||||
// wx.navigateTo({
|
||||
// url: '../../shop/bespeak/bespeak',
|
||||
// })
|
||||
// }
|
||||
},
|
||||
tabChange(e) {
|
||||
this.setData({
|
||||
active: e.detail
|
||||
})
|
||||
if (this.data.active == 0) {
|
||||
//首页
|
||||
wx.redirectTo({
|
||||
url: '/pages/index/index',
|
||||
})
|
||||
} else if (this.data.active == 1) {
|
||||
// 服务
|
||||
wx.redirectTo({
|
||||
url: '/pages/shop/index/shop',
|
||||
})
|
||||
} else {
|
||||
//我的
|
||||
wx.redirectTo({
|
||||
url: '/pages/mine/index/index',
|
||||
})
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
// if (!this.data.isPageBack) {
|
||||
// if (this.data.type == 1) {
|
||||
// console.log("测试")
|
||||
// wx.navigateTo({
|
||||
// url: '../../shop/catalog/bannerlist/bannerlist'
|
||||
// })
|
||||
// } else if (this.data.type == 2) {
|
||||
// wx.navigateTo({
|
||||
// url: '../../shop/catalog/column/column',
|
||||
// })
|
||||
// } else if (this.data.type == 3) {
|
||||
// wx.navigateTo({
|
||||
// url: '../../shop/catalog/list/list',
|
||||
// })
|
||||
// } else if (this.data.type == 4) {
|
||||
// wx.navigateTo({
|
||||
// url: '../../shop/catalog/bannerlist/bannerlist'
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
},
|
||||
clickT: function () {
|
||||
|
||||
}
|
||||
})
|
8
packagecard/shop/index/shop.wxml
Normal file
8
packagecard/shop/index/shop.wxml
Normal file
@ -0,0 +1,8 @@
|
||||
<!--pages/shop/shop.wxml-->
|
||||
<!-- 标题栏 -->
|
||||
<cu-custom bgColor="bg-gradual-blue" isBack="{{false}}">
|
||||
<view slot="content">服务</view>
|
||||
</cu-custom>
|
||||
<view>
|
||||
<text>数据加载中...</text>
|
||||
</view>
|
1
packagecard/shop/index/shop.wxss
Normal file
1
packagecard/shop/index/shop.wxss
Normal file
@ -0,0 +1 @@
|
||||
/* pages/shop/shop.wxss */
|
170
packagecard/shop/product/affirmorder.js
Normal file
170
packagecard/shop/product/affirmorder.js
Normal file
@ -0,0 +1,170 @@
|
||||
// pages/shop/product/affirmorder.js
|
||||
const app = getApp()
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
totalPrice: 0,
|
||||
goodsList: [], //商品列表
|
||||
shopId: '',
|
||||
shopDetailBean: null, //店铺详情
|
||||
baseImg: app.urls.baseImgUrl,
|
||||
remark: '', //备注
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
this.setData({
|
||||
shopId: options.shopId
|
||||
})
|
||||
let shopCart = app.globalData.shopCart
|
||||
let price = 0
|
||||
shopCart.forEach(it => {
|
||||
if (it.shopId == this.data.shopId) {
|
||||
it.totalPrice = it.goodsUnitPrice * it.buyNum
|
||||
this.data.goodsList = this.data.goodsList.concat(it)
|
||||
price += it.totalPrice
|
||||
}
|
||||
})
|
||||
//计算价格
|
||||
this.setData({
|
||||
totalPrice: price *= 100,
|
||||
goodsList: this.data.goodsList
|
||||
})
|
||||
this.getShopDetailById(this.data.shopId)
|
||||
},
|
||||
//提交订单
|
||||
onSubmit() {
|
||||
let _self = this
|
||||
wx.showLoading({
|
||||
title: '预定中...',
|
||||
})
|
||||
var params = _self.buildSubmitParams()
|
||||
console.log(params)
|
||||
app.restAjax.post(app.restAjax.path(app.restAjax.apis.doSaveOrder, [app.restAjax.baseUrl.tradeUrl]), params, {
|
||||
headers: {
|
||||
token: app.globalData.token
|
||||
}
|
||||
}, (code, data) => {
|
||||
wx.hideLoading({})
|
||||
if (code == 200) {
|
||||
//提交成功
|
||||
app.globalData.shopCart = []
|
||||
wx.redirectTo({
|
||||
url: '../../mine/order/ordersuccess?price=' + _self.data.totalPrice / 100 + '&shopId=' + _self.data.shopId + '&orderId=' + data.data,
|
||||
})
|
||||
}
|
||||
}, (code, err) => {
|
||||
wx.hideLoading({})
|
||||
if (err.msg) {
|
||||
app.dialog.msg(err.msg)
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '网络错误',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
//构建订单信息
|
||||
buildSubmitParams() {
|
||||
let _self = this
|
||||
var array = []
|
||||
_self.data.goodsList.forEach(it => {
|
||||
var item = {
|
||||
"goodsCount": it.buyNum,
|
||||
"goodsId": it.goodsId,
|
||||
"goodsLogo": it.goodsIcon,
|
||||
"goodsName": it.goodsName,
|
||||
"goodsPrice": it.goodsUnitPrice,
|
||||
"shopId": it.shopId,
|
||||
"totalPrice": it.totalPrice,
|
||||
"words": _self.data.remark
|
||||
}
|
||||
array = array.concat(item)
|
||||
})
|
||||
return array
|
||||
},
|
||||
textareaBInput(e) {
|
||||
this.setData({
|
||||
remark: e.detail.value
|
||||
})
|
||||
},
|
||||
//获取店铺详情
|
||||
getShopDetailById(id) {
|
||||
wx.showLoading({
|
||||
title: '加载中...',
|
||||
})
|
||||
app.restAjax.get(app.restAjax.path(app.restAjax.apis.getShopDetail, [app.restAjax.baseUrl.tradeUrl, id]), {}, {
|
||||
headers: {
|
||||
token: app.globalData.token
|
||||
}
|
||||
}, (code, data) => {
|
||||
wx.hideLoading({})
|
||||
if (code == 200) {
|
||||
this.setData({
|
||||
shopDetailBean: data
|
||||
})
|
||||
}
|
||||
}, (code, err) => {
|
||||
wx.hideLoading({})
|
||||
if (err.msg) {
|
||||
app.dialog.msg(err.msg)
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '网络错误',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
//商品数量修改
|
||||
onChange(e) {
|
||||
let buyNum = e.detail
|
||||
let goods = e.currentTarget.dataset.goods
|
||||
let _self = this
|
||||
let price = 0
|
||||
_self.data.goodsList.forEach(it => {
|
||||
if (it.goodsId == goods.goodsId) {
|
||||
it.buyNum = buyNum
|
||||
it.totalPrice = it.goodsUnitPrice * it.buyNum
|
||||
}
|
||||
price += it.totalPrice
|
||||
})
|
||||
_self.setData({
|
||||
totalPrice: price * 100,
|
||||
goodsList: _self.data.goodsList
|
||||
})
|
||||
app.globalData.shopCart = _self.data.goodsList
|
||||
},
|
||||
// 删除商品
|
||||
delGoods(e) {
|
||||
let _self = this
|
||||
var index = e.currentTarget.dataset.index
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
content: '确定要删除该商品吗?',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
_self.data.goodsList.splice(index, 1)
|
||||
_self.setData({
|
||||
goodsList: _self.data.goodsList
|
||||
})
|
||||
var price = 0
|
||||
_self.data.goodsList.forEach(it => {
|
||||
it.totalPrice = it.goodsUnitPrice * it.buyNum
|
||||
price += it.totalPrice
|
||||
})
|
||||
_self.setData({
|
||||
totalPrice: price * 100
|
||||
})
|
||||
app.globalData.shopCart = _self.data.goodsList
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
54
packagecard/shop/product/affirmorder.wxml
Normal file
54
packagecard/shop/product/affirmorder.wxml
Normal file
@ -0,0 +1,54 @@
|
||||
<!-- 订单确认页面 -->
|
||||
<cu-custom isBack="{{true}}" isRelaunch="{{false}}">
|
||||
<view slot="content">订单确认</view>
|
||||
</cu-custom>
|
||||
<scroll-view style="background-color:#f5f5f5;margin-bottom:80rpx;" wx:if="{{goodsList.length>0}}">
|
||||
<!-- 店铺详情 -->
|
||||
<view class="cu-card article">
|
||||
<view class="cu-item">
|
||||
<view class="padding-sm flex flex-wrap flex-direction">
|
||||
<view class="flex " style="align-items:center;">
|
||||
<view class="cu-avatar round sm" style="background-image:url({{baseImg+shopDetailBean.shopLogo}});">
|
||||
</view>
|
||||
<view class="text-xxl">{{shopDetailBean.shopName}}</view>
|
||||
</view>
|
||||
<view class="margin-top-sm">店铺地址:{{shopDetailBean.shopAddress}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 订单商品列表 -->
|
||||
<view class="cu-card article">
|
||||
<view class="cu-item shadow padding-sm" wx:for="{{goodsList}}" wx:key="index" data-item="{{item}}">
|
||||
<view class="content">
|
||||
<image src="{{baseImg+item.goodsIcon}}" mode="scaleToFill" style="width:80px;height:80px;"></image>
|
||||
<view class="desc">
|
||||
<view>{{item.goodsName}}</view>
|
||||
<view class="text-cut-width">{{item.goodsSummary}}</view>
|
||||
<view class="flex justify-between" style="align-items:center;">
|
||||
<view class="text-red">¥{{item.goodsUnitPrice}}</view>
|
||||
<van-stepper value="{{ item.buyNum }}" bind:change="onChange" data-goods="{{item}}"
|
||||
integer="true" min="1" />
|
||||
<view class="cu-tag text-red" bindtap="delGoods" data-index="{{index}}" data-goods="{{item}}">删除
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 订单备注 -->
|
||||
<view class="cu-card article">
|
||||
<view class="cu-bar bg-white margin-top-xs">
|
||||
<view class="action">
|
||||
订单备注
|
||||
</view>
|
||||
</view>
|
||||
<view class="bg-white">
|
||||
<view class="cu-form-group">
|
||||
<textarea class="border-line padding-left-xs padding-right-xs margin-left-xs margin-right-xs"
|
||||
maxlength="-1" bindinput="textareaBInput" placeholder="请输入订单备注信息"></textarea>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<van-empty description="购物车空空如也" wx:else />
|
||||
<van-submit-bar wx:if="{{goodsList.length>0}}" price="{{ totalPrice }}" button-text="提交订单" bind:submit="onSubmit" />
|
1
packagecard/shop/product/affirmorder.wxss
Normal file
1
packagecard/shop/product/affirmorder.wxss
Normal file
@ -0,0 +1 @@
|
||||
/* pages/shop/product/affirmorder.wxss */
|
160
packagecard/shop/product/goodsdetail.js
Normal file
160
packagecard/shop/product/goodsdetail.js
Normal file
@ -0,0 +1,160 @@
|
||||
// pages/shop/product/goodsdetail.js
|
||||
const app = getApp()
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
shopId: '', //商店ID
|
||||
goodsId: '', //商品ID
|
||||
picList: [], //商品
|
||||
goodsDetail: null, //商品详情Bean
|
||||
goodsPrices: 10000,
|
||||
_options: null,
|
||||
isShowCart: false,
|
||||
shopCart: [],
|
||||
baseImg: app.baseUrls.tradeUrl + app.baseUrls.baseImgUrl
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
this.setData({
|
||||
_options: options,
|
||||
shopId: options.shopId,
|
||||
goodsId: options.goodsId,
|
||||
shopCart: app.globalData.shopCart
|
||||
})
|
||||
console.log(this.data.baseImg)
|
||||
this.getGoodsDetail()
|
||||
},
|
||||
//获取商品详情
|
||||
getGoodsDetail() {
|
||||
wx.showLoading({
|
||||
title: '加载中...',
|
||||
})
|
||||
let _self = this
|
||||
app.restAjax.get(app.restAjax.path(app.restAjax.apis.getGoodsDetail, [app.restAjax.baseUrl.tradeUrl, _self.data.goodsId]), {}, {
|
||||
headers: {
|
||||
token: app.globalData.token
|
||||
}
|
||||
}, (code, data) => {
|
||||
wx.hideLoading({})
|
||||
if (code == 200) {
|
||||
_self.buildPicList(data)
|
||||
_self.setData({
|
||||
goodsDetail: data
|
||||
})
|
||||
}
|
||||
}, (code, err) => {
|
||||
wx.hideLoading({})
|
||||
if (err.msg) {
|
||||
app.dialog.msg(err.msg)
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '网络错误',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
//构建图片数据
|
||||
buildPicList(data) {
|
||||
let _self = this
|
||||
let picStrs = data.goodsPhotos.split(',')
|
||||
picStrs.forEach(it => {
|
||||
let url = _self.data.baseImg + it
|
||||
_self.data.picList = _self.data.picList.concat(url)
|
||||
})
|
||||
_self.setData({
|
||||
picList: _self.data.picList
|
||||
})
|
||||
},
|
||||
|
||||
onShow() {
|
||||
this.setData({
|
||||
shopCart: app.globalData.shopCart
|
||||
})
|
||||
this.selectComponent('#sCart').refreshCart()
|
||||
},
|
||||
//显示购物车弹框
|
||||
doShowCart() {
|
||||
if (this.data.shopCart.length > 0) {
|
||||
this.setData({
|
||||
isShowCart: true
|
||||
})
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '购物车空空如也',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
},
|
||||
//隐藏购物车弹框
|
||||
onHideCart() {
|
||||
this.setData({
|
||||
isShowCart: false
|
||||
})
|
||||
},
|
||||
//删除购物车中的商品
|
||||
delGoods(e) {
|
||||
let _self = this
|
||||
var index = e.currentTarget.dataset.index
|
||||
var goods = e.currentTarget.dataset.goods
|
||||
app.globalData.shopCart.splice(index, 1)
|
||||
//删除购物车中数据
|
||||
_self.selectComponent('#sCart').refreshCart()
|
||||
//将列表中的数据购买数量重置
|
||||
_self.data.goodsList.forEach(it => {
|
||||
if (it.goodsId == goods.goodsId) {
|
||||
it.buyNum = 0
|
||||
}
|
||||
})
|
||||
_self.setData({
|
||||
goodsList: _self.data.goodsList,
|
||||
shopCart: app.globalData.shopCart
|
||||
})
|
||||
if (_self.data.shopCart.length <= 0) {
|
||||
_self.setData({
|
||||
isShowCart: false
|
||||
})
|
||||
}
|
||||
},
|
||||
//购物车弹框删除或添加商品
|
||||
onChange(e) {
|
||||
let buyNum = e.detail
|
||||
let goods = e.currentTarget.dataset.goods
|
||||
let _self = this
|
||||
//遍历列表
|
||||
_self.data.goodsList.forEach(it => {
|
||||
if (it.goodsId == goods.goodsId) {
|
||||
it.buyNum = buyNum
|
||||
}
|
||||
})
|
||||
//遍历购物车
|
||||
_self.data.shopCart.forEach(it => {
|
||||
if (it.goodsId == goods.goodsId) {
|
||||
it.buyNum = buyNum
|
||||
}
|
||||
})
|
||||
//刷新视图
|
||||
_self.setData({
|
||||
goodsList: _self.data.goodsList,
|
||||
shopCart: _self.data.shopCart
|
||||
})
|
||||
//刷新购物车
|
||||
_self.selectComponent('#sCart').refreshCart()
|
||||
},
|
||||
onHide() {
|
||||
this.setData({
|
||||
isShowCart: false
|
||||
})
|
||||
},
|
||||
doRefreshShopcart() {
|
||||
this.setData({
|
||||
shopCart: app.globalData.shopCart
|
||||
})
|
||||
}
|
||||
})
|
5
packagecard/shop/product/goodsdetail.json
Normal file
5
packagecard/shop/product/goodsdetail.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"van-action-sheet": "/vant/dist/action-sheet/index"
|
||||
}
|
||||
}
|
68
packagecard/shop/product/goodsdetail.wxml
Normal file
68
packagecard/shop/product/goodsdetail.wxml
Normal file
@ -0,0 +1,68 @@
|
||||
<!-- 商品详情页面 -->
|
||||
<cu-custom isBack="{{true}}" isRelaunch="{{false}}">
|
||||
<view slot="content">详情</view>
|
||||
</cu-custom>
|
||||
|
||||
<!-- 商品轮播图 -->
|
||||
<scroll-view>
|
||||
<swiper class="screen-swiper square-dot bg-white" indicator-dots="true" circular="true" autoplay="true"
|
||||
interval="5000" duration="500" style="height:550rpx;">
|
||||
<swiper-item wx:for="{{picList}}" wx:key="index">
|
||||
<image src="{{item}}" mode='scaleToFill'></image>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</scroll-view>
|
||||
<view class="cu-list scroll-content" style="margin-bottom:90rpx;">
|
||||
<!-- 商品详细信息 -->
|
||||
<!-- 价格 -->
|
||||
<view class="cu-item padding-left-lg padding-right-lg bg-white">
|
||||
<view class="content text-red">¥ <text class="text-blod text-xxl">{{goodsDetail.goodsUnitPrice}}
|
||||
</text></view>
|
||||
<!-- 名称 -->
|
||||
<view class="margin-top-ls text-xl text-black bg-white margin-top-sm"> {{goodsDetail.goodsName}}</view>
|
||||
<view class="text-gray text-sm margin-top-sm">库存:{{goodsDetail.goodsTotal}}</view>
|
||||
</view>
|
||||
<!-- 描述 -->
|
||||
<view class="margin-top-sm bg-gray" style="height:20rpx;"></view>
|
||||
<view class="margin-top-ls text-gray text-lg bg-white padding-sm"> {{goodsDetail.goodsSummary}}</view>
|
||||
<view class="hint-title bg-gray">
|
||||
<image src="../../../../images/title-bg.png" mode="scaleToFill"></image>
|
||||
<text>宝贝详情</text>
|
||||
</view>
|
||||
<!-- 视频 -->
|
||||
<view wx:if="{{goodsDetail.goodsVideo.length>0}}" class="padding-xs bg-white margin-top-ls">
|
||||
<video id="myVideo" src="{{baseImg+goodsDetail.goodsVideo}}" binderror="videoErrorCallback"
|
||||
show-center-play-btn='{{true}}' bindenterpictureinpicture='bindVideoEnterPictureInPicture'
|
||||
bindleavepictureinpicture='bindVideoLeavePictureInPicture' style="width:100%;border-radius:20rpx;"></video>
|
||||
</view>
|
||||
<!-- 图片 -->
|
||||
<view class="margin-top-ls bg-white padding-sm">
|
||||
<image wx:for="{{picList}}" wx:key="index" src="{{item}}" style="width:100%" mode="widthFix"></image>
|
||||
</view>
|
||||
</view>
|
||||
<customcart id="sCart" shopId="{{shopId}}" goods="{{goodsDetail}}" showBtn="{{true}}" bind:showcart="doShowCart"
|
||||
bind:refreshShopCart="doRefreshShopcart">
|
||||
|
||||
</customcart>
|
||||
|
||||
|
||||
<van-action-sheet show="{{ isShowCart }}" title="购物车" bind:close="onHideCart" style="padding-bottom:180rpx;">
|
||||
<view class="cu-card article" style="margin-top:100rpx;padding-bottom:80rpx;">
|
||||
<view class="cu-item shadow padding-sm" wx:for="{{shopCart}}" wx:key="index" data-item="{{item}}">
|
||||
<view class="content">
|
||||
<image src="{{baseImg+item.goodsIcon}}" mode="scaleToFill"></image>
|
||||
<view class="desc">
|
||||
<view>{{item.goodsName}}</view>
|
||||
<view class="text-cut-width">{{item.goodsSummary}}</view>
|
||||
<view class="flex justify-between" style="align-items:center;">
|
||||
<view class="text-red">¥{{item.goodsUnitPrice}}</view>
|
||||
<van-stepper value="{{ item.buyNum }}" bind:change="onChange" data-goods="{{item}}" integer="true"
|
||||
min="1" />
|
||||
<view class="cu-tag text-red" bindtap="delGoods" data-index="{{index}}" data-goods="{{item}}">删除
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</van-action-sheet>
|
11
packagecard/shop/product/goodsdetail.wxss
Normal file
11
packagecard/shop/product/goodsdetail.wxss
Normal file
@ -0,0 +1,11 @@
|
||||
/* pages/shop/product/goodsdetail.wxss */
|
||||
.scroll-content {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
top: 530rpx;
|
||||
border-top-right-radius: 60rpx;
|
||||
border-top-left-radius: 60rpx;
|
||||
padding-top: 20rpx;
|
||||
z-index: 30;
|
||||
background-color: white;
|
||||
}
|
98
packagecard/shop/product/product.js
Normal file
98
packagecard/shop/product/product.js
Normal file
@ -0,0 +1,98 @@
|
||||
// pages/shop/product/product.js
|
||||
const app = getApp()
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
isSticky: false,
|
||||
titleBarHeight: 0,
|
||||
statusBarHeight: 0,
|
||||
swiperlist: [
|
||||
'https://image.weilanwl.com/img/4x3-1.jpg',
|
||||
'https://image.weilanwl.com/img/4x3-2.jpg',
|
||||
'https://image.weilanwl.com/img/4x3-3.jpg',
|
||||
'https://image.weilanwl.com/img/4x3-4.jpg',
|
||||
],
|
||||
tabList: [
|
||||
"热门推荐",
|
||||
"破尿酸",
|
||||
"除皱瘦脸",
|
||||
"眼部整形",
|
||||
"水光华能"
|
||||
],
|
||||
TabCur: 0,
|
||||
scrollLeft: 0
|
||||
},
|
||||
tabSelect(e) {
|
||||
this.setData({
|
||||
TabCur: e.currentTarget.dataset.id,
|
||||
scrollLeft: (e.currentTarget.dataset.id - 1) * 60
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
let height = app.globalData.CustomBar
|
||||
let statusHeight = app.globalData.StatusBar
|
||||
this.setData({
|
||||
titleBarHeight: height,
|
||||
statusBarHeight: statusHeight
|
||||
})
|
||||
},
|
||||
scrollSticky(event) {
|
||||
this.setData({
|
||||
isSticky: event.detail.isFixed
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
5
packagecard/shop/product/product.json
Normal file
5
packagecard/shop/product/product.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"van-sticky": "../../../vant/dist/sticky/index"
|
||||
}
|
||||
}
|
24
packagecard/shop/product/product.wxml
Normal file
24
packagecard/shop/product/product.wxml
Normal file
@ -0,0 +1,24 @@
|
||||
<!--pages/shop/product/product.wxml-->
|
||||
<cu-custom isBack="{{false}}" isRelaunch="{{true}}" bgColor="{{isSticky === true ? 'bg-white' : ''}}">
|
||||
<view slot="content" class="text-black" wx:if="{{isSticky}}">商品详情</view>
|
||||
</cu-custom>
|
||||
<!-- style="padding-top:{{isSticky === true ? statusBarHeight : 0}}px;margin-top:-{{isSticky === true ? statusBarHeight : 0}}px" -->
|
||||
|
||||
<scroll-view style="margin-top:-{{titleBarHeight}}px">
|
||||
<!-- 商品轮播 -->
|
||||
<swiper class="screen-swiper xl square-dot bg-white" indicator-dots="true" circular="true" autoplay="true"
|
||||
interval="5000" duration="500">
|
||||
<swiper-item wx:for="{{swiperlist}}" wx:key="index">
|
||||
<image src="{{item}}" mode='aspectFill'></image>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<!-- 商品内容 -->
|
||||
<van-sticky offset-top="{{titleBarHeight}}" bind:scroll="scrollSticky">
|
||||
<scroll-view scroll-x class="bg-white nav" scroll-with-animation scroll-left="{{scrollLeft}}">
|
||||
<view class="cu-item {{index==TabCur?'text-blue cur':''}}" wx:for="{{tabList}}" wx:key="index" bindtap="tabSelect"
|
||||
data-id="{{index}}">
|
||||
{{tabList[index]}}
|
||||
</view>
|
||||
</scroll-view>
|
||||
</van-sticky>
|
||||
</scroll-view>
|
1
packagecard/shop/product/product.wxss
Normal file
1
packagecard/shop/product/product.wxss
Normal file
@ -0,0 +1 @@
|
||||
/* pages/shop/product/product.wxss */
|
66
packagecard/shop/shopingcart/cart.js
Normal file
66
packagecard/shop/shopingcart/cart.js
Normal file
@ -0,0 +1,66 @@
|
||||
// pages/shop/shopingcart/cart.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
2
packagecard/shop/shopingcart/cart.wxml
Normal file
2
packagecard/shop/shopingcart/cart.wxml
Normal file
@ -0,0 +1,2 @@
|
||||
<!--pages/shop/shopingcart/cart.wxml-->
|
||||
<text>pages/shop/shopingcart/cart.wxml</text>
|
1
packagecard/shop/shopingcart/cart.wxss
Normal file
1
packagecard/shop/shopingcart/cart.wxss
Normal file
@ -0,0 +1 @@
|
||||
/* pages/shop/shopingcart/cart.wxss */
|
72
pages/mine/columnlist/columnlist.js
Normal file
72
pages/mine/columnlist/columnlist.js
Normal file
@ -0,0 +1,72 @@
|
||||
// pages/mine/columnlist/columnlist.js
|
||||
const app = getApp()
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
groupId: '',
|
||||
menuList: [],
|
||||
title: '栏目',
|
||||
imgUrl: app.urls.baseImgUrl
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
this.setData({
|
||||
groupId: options.id,
|
||||
title: options.title
|
||||
})
|
||||
this.getList()
|
||||
},
|
||||
|
||||
getList() {
|
||||
wx.showLoading({
|
||||
title: '加载中...',
|
||||
})
|
||||
var _self = this
|
||||
app.http.get(app.urls.getColumnListByGroupId, {
|
||||
header: {
|
||||
token: app.globalData.token
|
||||
},
|
||||
data: {
|
||||
configColumnGroupId: _self.data.groupId
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
wx.hideLoading({})
|
||||
_self.setData({
|
||||
menuList: res.data
|
||||
})
|
||||
})
|
||||
.catch(err => {
|
||||
wx.hideLoading({})
|
||||
})
|
||||
},
|
||||
choosePage(e) {
|
||||
// 栏目列表页跳转方式1:小程序页面,2:其他小程序,3:网址
|
||||
var path = e.currentTarget.dataset.path
|
||||
var type = e.currentTarget.dataset.type
|
||||
var item = e.currentTarget.dataset.item
|
||||
switch (type) {
|
||||
case '1': //跳转小程序内部
|
||||
case '3': //链接
|
||||
wx.navigateTo({
|
||||
url: path + '?id=' + item.configColumnId + '&mode=' + item.configTableMode + '&type=' + item.configColumnType + '&title=' + item.configColumnName
|
||||
})
|
||||
break
|
||||
case '2': //其他小程序
|
||||
wx.navigateToMiniProgram({
|
||||
appId: '',
|
||||
success(res) {
|
||||
// 打开成功
|
||||
}
|
||||
})
|
||||
break
|
||||
}
|
||||
},
|
||||
|
||||
})
|
31
pages/mine/columnlist/columnlist.wxml
Normal file
31
pages/mine/columnlist/columnlist.wxml
Normal file
@ -0,0 +1,31 @@
|
||||
<!--pages/mine/columnlist/columnlist.wxml-->
|
||||
<cu-custom isBack="{{true}}">
|
||||
<view slot="content">{{title}}</view>
|
||||
</cu-custom>
|
||||
<!-- 菜单 -->
|
||||
<view wx:if="{{menuList.length>0}}" style="width:100%;">
|
||||
<view class="cu-list menu card-menu shadow-lg radius" style="margin-top:30rpx;margin-left:0rpx;margin-right:0rpx;"
|
||||
wx:for-item="group" wx:for="{{menuList}}" wx:key="index">
|
||||
<!-- 纵向 -->
|
||||
<view class="cu-list menu card-menu shadow-lg radius" bindtap="choosePage" data-item="{{group}}"
|
||||
data-path="{{group.configColumnRowTargetUrl}}" data-type="{{group.configColumnRowTargetMode}}">
|
||||
<view class="cu-item arrow border-bottom-sm margin-top-sm" style="padding-bottom:10rpx;">
|
||||
<image wx:if="{{group.configColumnPhoto.length>0}}" class="cu-avatar radius lg"
|
||||
src="{{imgUrl + group.configColumnPhoto}}" mode="scaleToFill"></image>
|
||||
<view class="content padding-left-xs" style="width:80%;">
|
||||
<view class="text-black">
|
||||
<text class="text-cut">{{group.configColumnName}}</text>
|
||||
</view>
|
||||
<view class="text-gray text-sm flex">
|
||||
<text class="text-cut">{{group.configColumnRemark}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="action">
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:else style="margin-top:200rpx;width:100%;">
|
||||
<van-empty description="暂无数据" image="/images/ic_empty_data.png" />
|
||||
</view>
|
1
pages/mine/columnlist/columnlist.wxss
Normal file
1
pages/mine/columnlist/columnlist.wxss
Normal file
@ -0,0 +1 @@
|
||||
/* pages/mine/columnlist/columnlist.wxss */
|
@ -11,6 +11,7 @@ Page({
|
||||
userIcon: '../../../images/ic_user_default.png',
|
||||
menuList: [],
|
||||
imgUrl: app.urls.baseImgUrl,
|
||||
Height: 0,
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
@ -21,7 +22,6 @@ Page({
|
||||
nickName: app.globalData.userInfo.name,
|
||||
name: app.globalData.userInfo.name
|
||||
})
|
||||
_self.getItemList()
|
||||
},
|
||||
getItemList() {
|
||||
wx.showLoading({
|
||||
@ -157,6 +157,13 @@ Page({
|
||||
onPullDownRefresh() {
|
||||
this.getItemList()
|
||||
},
|
||||
//跳转到二级栏目页面
|
||||
goColumnList(e) {
|
||||
var item = e.currentTarget.dataset.item
|
||||
wx.navigateTo({
|
||||
url: '../columnlist/columnlist?id=' + item.configColumnGroupId + '&title=' + item.configColumnGroupName,
|
||||
})
|
||||
},
|
||||
// 跳转到 我的名片
|
||||
goMyCard: function () {
|
||||
wx.navigateTo({
|
||||
@ -168,5 +175,30 @@ Page({
|
||||
wx.navigateTo({
|
||||
url: '../../mine/setting/columnsetting'
|
||||
})
|
||||
},
|
||||
imgHeight(e) {
|
||||
var winWid = wx.getSystemInfoSync().windowWidth; //获取当前屏幕的宽度
|
||||
var imgh = e.detail.height; //图片高度
|
||||
var imgw = e.detail.width; //图片宽度
|
||||
var swiperH = winWid * imgh / imgw * 0.88 + "px"
|
||||
|
||||
this.setData({
|
||||
Height: swiperH //设置高度
|
||||
})
|
||||
},
|
||||
//引导跳转
|
||||
toFunction(e) {
|
||||
var _self = this
|
||||
var path = ''
|
||||
_self.data.menuList.forEach(it => {
|
||||
//判断引导
|
||||
if (it.configColumnGroupDirection == '3') {
|
||||
//引导
|
||||
path = it.configColumnGroupTargetUrl
|
||||
}
|
||||
})
|
||||
wx.navigateTo({
|
||||
url: path,
|
||||
})
|
||||
}
|
||||
})
|
@ -19,6 +19,10 @@
|
||||
wx:for-item="group" wx:for="{{menuList}}" wx:key="index" wx:if="{{group.configColumnGroupStatus=='1'}}">
|
||||
<!-- 横向 -->
|
||||
<view wx:if="{{group.configColumnGroupDirection=='1'}}">
|
||||
<view class="cu-bar bg-white solid-top">
|
||||
<view class="action text-black">{{group.configColumnGroupName}}</view>
|
||||
<view class="action"></view>
|
||||
</view>
|
||||
<view class="cu-list grid col-4 no-border">
|
||||
<view class="cu-item align-center justify-center" data-path="{{item.configColumnTargetUrl}}"
|
||||
wx:if="{{item.configColumnStatus=='1'}}" data-type="{{item.configColumnTargetMode}}" bindtap="choosePage"
|
||||
@ -31,27 +35,62 @@
|
||||
</view>
|
||||
</view>
|
||||
<!-- 纵向 -->
|
||||
<view wx:else>
|
||||
<view wx:for="{{group.configColumnList}}" wx:for-item="item" data-path="{{item.configColumnTargetUrl}}"
|
||||
data-type="{{item.configColumnTargetMode}}" wx:key="index" data-item="{{item}}" bindtap="choosePage">
|
||||
<view class="cu-list menu card-menu shadow-lg radius">
|
||||
<view class="cu-item arrow border-bottom-sm margin-top-sm" style="padding-bottom:10rpx;">
|
||||
<image wx:if="{{item.configColumnPhoto.length>0}}" class="cu-avatar radius lg"
|
||||
src="{{imgUrl + item.configColumnPhoto}}" mode="scaleToFill"></image>
|
||||
<view class="content padding-left-xs" style="width:80%;">
|
||||
<view class="text-black">
|
||||
<text class="text-cut">{{item.configColumnName}}</text>
|
||||
</view>
|
||||
<view class="text-gray text-sm flex">
|
||||
<text class="text-cut">{{item.configColumnRemark}}</text>
|
||||
</view>
|
||||
<view wx:elif="{{group.configColumnGroupDirection=='2'}}">
|
||||
<view class="cu-list menu card-menu shadow-lg radius" bindtap="goColumnList" data-item="{{group}}">
|
||||
<view class="cu-item arrow border-bottom-sm margin-top-sm" style="padding-bottom:10rpx;">
|
||||
<image wx:if="{{group.configColumnGroupPhoto.length>0}}" class="cu-avatar radius lg"
|
||||
src="{{imgUrl + group.configColumnGroupPhoto}}" mode="scaleToFill"></image>
|
||||
<view class="content padding-left-xs" style="width:80%;">
|
||||
<view class="text-black">
|
||||
<text class="text-cut">{{group.configColumnGroupName}}</text>
|
||||
</view>
|
||||
<view class="action">
|
||||
<view class="text-gray text-sm flex">
|
||||
<text class="text-cut">{{group.configColumnGroupRemark}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="action">
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 引导图片 -->
|
||||
<view wx:elif="{{group.configColumnGroupDirection=='3'}}">
|
||||
<!-- 轮播图 -->
|
||||
<view class="hint-title">
|
||||
<image src="/images/title-bg.png" mode="scaleToFill"></image>
|
||||
<text>{{group.configColumnGroupName}}</text>
|
||||
</view>
|
||||
<view wx:if="{{group.configColumnGroupStyle=='ec3605f5-3409-4554-ae85-efac8a75fc0d'}}"
|
||||
class="flex align-center justify-center" style="width:100%;">
|
||||
<swiper style="width:80%;margin-top:20rpx;height:{{Height}};" indicator-dots="{{true}}" autoplay="{{true}}">
|
||||
<block wx:for="{{group.configColumnList}}" wx:key="pIndex" wx:for-index="pIndex" wx:for-item="photo">
|
||||
<swiper-item style="width:100%;">
|
||||
<image bindload='imgHeight' style="width:100%;border-radius:20rpx;"
|
||||
src="{{imgUrl + photo.configColumnPhoto}}" mode="widthFix">
|
||||
</image>
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
</view>
|
||||
<!-- 平铺 -->
|
||||
<view wx:else class="flex flex-direction align-center justify-center" style="width:100%;">
|
||||
<block wx:for="{{group.configColumnList}}" wx:key="pIndex" wx:for-index="pIndex" wx:for-item="photo">
|
||||
<image style="width:90%;border-radius:20rpx;margin-top:5rpx;" src="{{imgUrl + photo.configColumnPhoto}}"
|
||||
mode="widthFix">
|
||||
</image>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 创建名片 -->
|
||||
<view class="creat-card" bindtap="toFunction">
|
||||
<image src="/images/create-btn.png"></image>
|
||||
</view>
|
||||
|
||||
<!-- 一个条目 -->
|
||||
<!-- <view wx:for="{{group.configColumnList}}" wx:for-item="item" data-path="{{item.configColumnTargetUrl}}"
|
||||
data-type="{{item.configColumnTargetMode}}" wx:key="index" data-item="{{item}}" bindtap="choosePage">
|
||||
|
||||
</view> -->
|
@ -123,4 +123,29 @@ map,
|
||||
.play-box image {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
}
|
||||
|
||||
.creat-card {
|
||||
position: fixed;
|
||||
right: 20rpx;
|
||||
bottom: 20rpx;
|
||||
padding: 20rpx;
|
||||
background: #0054bd;
|
||||
border-radius: 50%;
|
||||
box-sizing: border-box;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.creat-card image {
|
||||
width: 80rpx;
|
||||
height: 60rpx;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
@ -27,14 +27,14 @@
|
||||
</view>
|
||||
</view>
|
||||
<!-- 纵向 -->
|
||||
<view wx:else>
|
||||
<view wx:elif="{{group.configColumnGroupDirection=='2'}}">
|
||||
<view wx:for="{{group.configColumnList}}" wx:for-item="item" data-path="{{item.configColumnTargetUrl}}"
|
||||
data-type="{{item.configColumnTargetMode}}" wx:for-index="idx" wx:key="idx" data-item="{{item}}">
|
||||
<view class="cu-list menu card-menu shadow-lg radius">
|
||||
<view class="cu-item border-bottom-sm" style="padding:20rpx;margin-top:5rpx;">
|
||||
<image wx:if="{{item.configColumnPhoto.length>0}}" class="cu-avatar radius lg"
|
||||
src="{{imgUrl + item.configColumnPhoto}}" mode="scaleToFill"></image>
|
||||
<view class="content padding-left-xs" style="width:80%;" data-id="{{item.configColumnId}}"
|
||||
<view class="content padding-left-xs" style="width:60%;" data-id="{{item.configColumnId}}"
|
||||
data-index="{{index}}" data-idx="{{idx}}" catchtap="showInput">
|
||||
<view class="text-black">
|
||||
<text class="text-cut">{{item.configColumnName}}</text>
|
||||
|
@ -7,8 +7,7 @@ var apis = {
|
||||
doUploadAudio: `app/file/uploadaudio`, //上传音频
|
||||
/**用户相关 */
|
||||
wxLogin: `wechat/miniapp/sign/default`, //微信用户登录
|
||||
/**个人中心 */
|
||||
getMenuList: `app/configcolumngroup/list`,
|
||||
|
||||
/**店铺相关 **/
|
||||
doSaveShop: `app/shop/save`, //保存商店
|
||||
doUpdateShopInfo: `app/shop/updateshop/{shopId}`, //更新店铺信息
|
||||
@ -49,6 +48,8 @@ var apis = {
|
||||
|
||||
//个人中心列表
|
||||
//栏目数据
|
||||
/**个人中心 */
|
||||
getMenuList: `app/cardconfigcolumngroup/list`,
|
||||
getMomentsList: `app/configcolumndata/list/{configColumnId}`, //获取栏目数据列表
|
||||
doSaveMoments: `app/configcolumndata/save/{configColumnId}`, //保存栏目数据
|
||||
getMomentsField: `app/configcolumndata/listfield/{configColumnId}`, //获取栏目字段列表
|
||||
@ -59,6 +60,7 @@ var apis = {
|
||||
getMineColumnList: `app/configcolumnset/list`, //获取我的栏目配置列表
|
||||
doSaveColumnDisplay: `app/configcolumnset/savedisplay`, //保存我的栏目隐藏显示
|
||||
doSaveColumnName: `app/configcolumnset/savename`, //保存我的栏目名称
|
||||
getColumnListByGroupId: `app/configcolumn/list`, //根据栏目组id获取栏目? configColumnGroupId
|
||||
|
||||
//名片信息
|
||||
getCardList: `app/cardtemplate/list`, //获取名片列表
|
||||
|
Loading…
Reference in New Issue
Block a user