银花优选微信小程序修改后的最新版本代码

This commit is contained in:
ss001
2026-02-07 16:22:31 +08:00
commit c00caf5744
516 changed files with 41796 additions and 0 deletions

123
pages/myproducts/index.js Normal file
View File

@@ -0,0 +1,123 @@
var app = getApp()
var that=null
var sopenFrame=null
var wait=120
Page( {
data: {
loadingHidden:false,
nodataHidden:true,
mybalance:[],
Start: 0,
t:0
},
onLoad: function(options) {
that = this
if(options.t){
that.setData({
t:options.t
});
}
if(that.data.t==0){
wx.setNavigationBarTitle({
title: "全部商品列表"
})
}
else if(that.data.t==1){
wx.setNavigationBarTitle({
title: "已上架商品列表"
})
}else if(that.data.t==2){
wx.setNavigationBarTitle({
title: "未上架商品列表"
})
}
that.clearCache();//清本页缓存
that.getlist(0);
}, // 下拉刷新
onPullDownRefresh: function () {
//在当前页面显示导航条加载动画
wx.showNavigationBarLoading();
//显示 loading 提示框。需主动调用 wx.hideLoading 才能关闭提示框
wx.showLoading({
title: '刷新中...',
})
that.clearCache();
that.getlist(1);//第一次加载数据
},
// 页面上拉触底事件(上拉加载更多)
onReachBottom: function () {
that.setData({
loadingHidden:false
});
that.getlist(2);//后台获取新数据并追加渲染
},
// 清缓存
clearCache:function(){
that.setData({
loadingHidden:false,
Start: 0,
mybalance:[]
});
},getlist: function(gp) {
var userId = wx.getStorageSync("userId")
var LoginId = wx.getStorageSync("LoginId")
wx.request({
url: app.globalData.apiurl + "/xapiajax.ashx",
data: {
action:"getmyproducts",
Start:that.data.Start,
t:that.data.t,
userId:(userId==null?"":userId),
LoginId:(LoginId==null?"":LoginId)
},
method:"GET",
dataType:"json",
header: {
"content-type": "application/json" // 默认值
},
success (res) {
if(res.data.status==1){
var tmpArr = null;
tmpArr = that.data.mybalance;
if(res.data.data.length>0){
tmpArr.push.apply(tmpArr,res.data.data);
}
that.setData({
mybalance: tmpArr,
Start: that.data.Start+res.data.data.length,
loadingHidden:true
})
if(gp==0||gp==1){
if(res.data.data.length==0){
that.setData({
nodataHidden:false
})
}else{
that.setData({
nodataHidden:true
})
}
}
}else{
wx.showToast({
title: res.data.msg,
icon: "none",
duration: 3000
})
}
if(gp==1){
//隐藏loading 提示框
wx.hideLoading();
//隐藏导航条加载动画
wx.hideNavigationBarLoading();
//停止下拉刷新
wx.stopPullDownRefresh();
}
}
})
}
})

View File

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

View File

@@ -0,0 +1,19 @@
<view class="container">
<view class="myproducts-box">
<view class="myproducts-item" wx:for="{{mybalance}}" wx:for-index="index">
<view class="myproducts-item-to">
<view class="imgbox"><img src="{{item.image}}" /></view>
<view class="title">{{item.name}}</view>
<view class="price">¥{{item.hyje}}</view>
</view>
</view>
</view>
</view>
<view class="nodata" hidden="{{nodataHidden}}">
<image src="../../images/order-null.png"/>
<view>暂无数据</view>
</view>
<loading hidden="{{loadingHidden}}">
加载中...
</loading>

View File

@@ -0,0 +1,50 @@
page{
background: #ccc;
}
.container {
position: relative;
width: 100%;
height: 100%;
font-size: 14px;
color: #000;
padding: 0.8em;
box-sizing: border-box;
}
.myproducts-box{
float: left;
width: 100%;
padding-top: 0.8em;
padding-left: 0.8em;
}
.myproducts-item {
float: left;
width: 50%;
padding: 0.8em;
}
.myproducts-item-to {
float: left;
width: 100%;
border-radius: 0.4em;
background-color: #fff;
border: solid 1px #dfdfdf;
overflow: hidden;
}
.myproducts-item-to .imgbox{
float: left;
width: 100%;
border-radius: 0.4em 0.4em 0 0;
}
.myproducts-item-to .title{
float: left;
width: 100%;
font-weight: 900;
}
.myproducts-item-to .price{
float: left;
width: 100%;
}
.nodata{padding-top:1em; text-align: center; line-height: 1.5em; color:#939393;}
.nodata image {
width: 80px;
height: 80px;
}