银花优选微信小程序修改后的最新版本代码
This commit is contained in:
215
pages/othershop0/index.js
Normal file
215
pages/othershop0/index.js
Normal file
@@ -0,0 +1,215 @@
|
||||
var WxParse = null;
|
||||
//获取应用实例
|
||||
var app = getApp()
|
||||
var sopenFrame=null
|
||||
var sopenFrame0=null
|
||||
var that=null
|
||||
Page({
|
||||
data: {
|
||||
indicatorDots: true,
|
||||
vertical: false,
|
||||
autoplay: true,
|
||||
interval: 6000,
|
||||
duration: 1000,
|
||||
loadingHidden: false, // loading
|
||||
images:[],
|
||||
t:0,
|
||||
t0:0,
|
||||
Start:0,
|
||||
Products:[],
|
||||
},
|
||||
|
||||
//事件处理函数
|
||||
swiperchange: function(e) {
|
||||
//console.log(e.detail.current)
|
||||
},onShow: function () {
|
||||
if (typeof this.getTabBar === 'function' && this.getTabBar()) {
|
||||
this.getTabBar().setData({
|
||||
selected: 1
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
onLoad: function(options) {
|
||||
|
||||
that=this;
|
||||
WxParse = require('../../wxParse/wxParse.js');
|
||||
if(options.t){
|
||||
that.setData({
|
||||
t:options.t
|
||||
})
|
||||
|
||||
|
||||
if(options.t==2){
|
||||
wx.setNavigationBarTitle({
|
||||
title: "健康知识"
|
||||
})
|
||||
}
|
||||
if(options.t==4){
|
||||
wx.setNavigationBarTitle({
|
||||
title: "会客厅"
|
||||
})
|
||||
}if(options.t==5){
|
||||
wx.setNavigationBarTitle({
|
||||
title: "流量专区"
|
||||
})
|
||||
}if(options.t==7){
|
||||
wx.setNavigationBarTitle({
|
||||
title: "品牌展示"
|
||||
})
|
||||
}if(options.t==10){
|
||||
wx.setNavigationBarTitle({
|
||||
title: "企业介绍"
|
||||
})
|
||||
}if(options.t==11){
|
||||
wx.setNavigationBarTitle({
|
||||
title: "操作教程"
|
||||
})
|
||||
} if(options.t==12){
|
||||
wx.setNavigationBarTitle({
|
||||
title: "补贴专区"
|
||||
})
|
||||
} if(options.t==13){
|
||||
wx.setNavigationBarTitle({
|
||||
title: "体验区"
|
||||
})
|
||||
}
|
||||
}
|
||||
if(options.t0){
|
||||
that.setData({
|
||||
t0:options.t0
|
||||
})
|
||||
}
|
||||
that.rdata(0);
|
||||
sopenFrame=setInterval(function (){
|
||||
if(app.globalData.IFRefreshordershop0==1){
|
||||
app.globalData.IFRefreshordershop0=0;
|
||||
that.setData({
|
||||
Start: 0
|
||||
});
|
||||
that.rdata(0);
|
||||
}
|
||||
}, 1000);
|
||||
},onPullDownRefresh: function () {
|
||||
//在当前页面显示导航条加载动画
|
||||
wx.showNavigationBarLoading();
|
||||
//显示 loading 提示框。需主动调用 wx.hideLoading 才能关闭提示框
|
||||
wx.showLoading({
|
||||
title: '刷新中...',
|
||||
|
||||
})
|
||||
that.clearCache();
|
||||
that.setData({
|
||||
loadingHidden:true
|
||||
});
|
||||
that.rdata(1);
|
||||
},// 页面上拉触底事件(上拉加载更多)
|
||||
onReachBottom: function () {
|
||||
that.setData({
|
||||
loadingHidden:false
|
||||
});
|
||||
that.rdata(2);//后台获取新数据并追加渲染
|
||||
},onnav:function(e) {
|
||||
var index = e.currentTarget.dataset.id
|
||||
if(index==1){
|
||||
that.setData({
|
||||
t:15
|
||||
})
|
||||
}else{
|
||||
that.setData({
|
||||
t:13
|
||||
})
|
||||
}
|
||||
that.clearCache();
|
||||
that.rdata(1);
|
||||
},
|
||||
|
||||
// 清缓存
|
||||
clearCache:function(){
|
||||
that.setData({
|
||||
Start: 0,
|
||||
loadingHidden:false
|
||||
});
|
||||
},rdata:function(t) {
|
||||
try{
|
||||
var userId = wx.getStorageSync("userId")
|
||||
var LoginId = wx.getStorageSync("LoginId")
|
||||
|
||||
wx.request({
|
||||
url: app.globalData.apiurl + "/xapiajax.ashx",
|
||||
|
||||
data: {
|
||||
action:"getothershopdata0",
|
||||
userId:(!userId?"":userId),
|
||||
LoginId:(!LoginId?"":LoginId),
|
||||
t:that.data.t,
|
||||
t0:that.data.t0,
|
||||
Start:that.data.Start
|
||||
},
|
||||
method:"GET",
|
||||
dataType:"json",
|
||||
header: {
|
||||
"content-type": "application/json" // 默认值
|
||||
},
|
||||
success (res) {
|
||||
|
||||
if(res.data.status==1){
|
||||
|
||||
var tmpArr = null;
|
||||
if(that.data.Start==0){
|
||||
tmpArr = res.data.productlist;
|
||||
|
||||
that.setData({
|
||||
Products:tmpArr,
|
||||
Start: res.data.productlist.length,
|
||||
loadingHidden:true
|
||||
})
|
||||
|
||||
|
||||
}else{
|
||||
|
||||
tmpArr = that.data.Products;
|
||||
if(res.data.productlist.length>0){
|
||||
tmpArr.push.apply(tmpArr,res.data.productlist);
|
||||
}
|
||||
that.setData({
|
||||
Products:tmpArr,
|
||||
Start: that.data.Start+res.data.productlist.length,
|
||||
loadingHidden:true
|
||||
})
|
||||
}
|
||||
if(t==1){
|
||||
//隐藏loading 提示框
|
||||
wx.hideLoading();
|
||||
//隐藏导航条加载动画
|
||||
wx.hideNavigationBarLoading();
|
||||
//停止下拉刷新
|
||||
wx.stopPullDownRefresh();
|
||||
}
|
||||
|
||||
}else{
|
||||
if(res.data.msg=="您未登录"||res.data.msg=="参数错误"){
|
||||
wx.removeStorageSync('userId')
|
||||
wx.removeStorageSync('LoginId')
|
||||
that.rdata(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}catch(err){
|
||||
wx.showToast({
|
||||
title: err,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
},gotodetail:function(e) {
|
||||
|
||||
var id = e.currentTarget.dataset.id
|
||||
wx.navigateTo({
|
||||
url: "../details/index?id="+id
|
||||
})
|
||||
|
||||
},qxdetail:function(e) {
|
||||
}
|
||||
})
|
||||
3
pages/othershop0/index.json
Normal file
3
pages/othershop0/index.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
49
pages/othershop0/index.wxml
Normal file
49
pages/othershop0/index.wxml
Normal file
@@ -0,0 +1,49 @@
|
||||
<!--index.wxml-->
|
||||
<import src="../../wxParse/wxParse.wxml"/>
|
||||
<view class="container">
|
||||
<view class="myorder-menu">
|
||||
<view class='{{t==13?"hover":""}}' bindtap="onnav" data-id="0">体验区</view>
|
||||
<view class='{{t==15?"hover":""}}' bindtap="onnav" data-id="1">镇街服务商</view>
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
<view class="choice_box">
|
||||
<view class="choice_box_to">
|
||||
<view class="text">
|
||||
<view class="line_flag"></view>
|
||||
<text>商品列表</text>
|
||||
</view>
|
||||
<view class="choice_list">
|
||||
|
||||
<view class="choice_item" wx:for="{{Products}}" wx:key="index" bindtap="gotodetail" data-id="{{item._id}}">
|
||||
<view class="choice_item_box">
|
||||
<view class="choice_image">
|
||||
<view class="choice_image_box">
|
||||
<image src="{{item.image}}"></image>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view class="right_title">
|
||||
<view class="right_name" >{{item.name}}</view>
|
||||
<view class="jeto">
|
||||
<view class="scje" wx:if="{{t != 7}}">零售价:<text>¥{{item.scje}}</text>
|
||||
</view>
|
||||
<view class="hyje">{{t == 7?"金额":"会员价"}}:<text>¥{{item.hyje}}</text>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="right_button" >
|
||||
<view>{{t == 7?"立即申请":"立即购买"}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<loading hidden="{{loadingHidden}}">
|
||||
加载中...
|
||||
</loading>
|
||||
722
pages/othershop0/index.wxss
Normal file
722
pages/othershop0/index.wxss
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user