银花优选微信小程序修改后的最新版本代码
This commit is contained in:
143
pages/businessview/index.js
Normal file
143
pages/businessview/index.js
Normal file
@@ -0,0 +1,143 @@
|
||||
var WxParse = null;
|
||||
var app = getApp()
|
||||
var that=null
|
||||
Page( {
|
||||
data: {
|
||||
loadingHidden:false,
|
||||
nodataHidden:true,
|
||||
indicatorDots: false,
|
||||
indicatorDots0: true,
|
||||
vertical: false,
|
||||
vertical0: false,
|
||||
autoplay: true,
|
||||
interval: 6000,
|
||||
interval0: 8000,
|
||||
duration: 1000,
|
||||
duration0: 1000,
|
||||
viewid:0,
|
||||
showpic:0,
|
||||
title:"",
|
||||
products:[],
|
||||
images:[],
|
||||
Start:0,
|
||||
latitude:"",
|
||||
longitude:"",
|
||||
distance:"",
|
||||
address:"",
|
||||
fwbody:""
|
||||
},
|
||||
|
||||
onLoad: function(options) {
|
||||
that = this
|
||||
if(options.id){
|
||||
that.setData({
|
||||
viewid: options.id
|
||||
});
|
||||
}
|
||||
that.clearCache();//清本页缓存
|
||||
that.getlist(0);//第一次加载数据
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh: function () {
|
||||
that.clearCache();
|
||||
that.getlist(0);//第一次加载数据
|
||||
},
|
||||
|
||||
// 页面上拉触底事件(上拉加载更多)
|
||||
onReachBottom: function () {
|
||||
that.getlist(1);//后台获取新数据并追加渲染
|
||||
},
|
||||
|
||||
// 清缓存
|
||||
clearCache:function(){
|
||||
that.setData({
|
||||
products: [],
|
||||
Start: 0,
|
||||
loadingHidden:false
|
||||
});
|
||||
}, getlist: function (gp) {
|
||||
|
||||
var userId = wx.getStorageSync("userId")
|
||||
var LoginId = wx.getStorageSync("LoginId")
|
||||
var latitude = wx.getStorageSync("latitude")
|
||||
var longitude = wx.getStorageSync("longitude")
|
||||
wx.request({
|
||||
url: app.globalData.apiurl + "/xapiajax.ashx",
|
||||
data: {
|
||||
action:"getbusinessview",
|
||||
userId:(!userId?"":userId),
|
||||
LoginId:(!LoginId?"":LoginId),
|
||||
latitude:(!latitude?"":latitude),
|
||||
longitude:(!LoginId?"":longitude),
|
||||
viewId:that.data.viewid,
|
||||
Start:that.data.Start
|
||||
},
|
||||
method:"GET",
|
||||
dataType:"json",
|
||||
header: {
|
||||
"content-type": "application/json" // 默认值
|
||||
},
|
||||
success (res) {
|
||||
|
||||
var tmpArr = null;
|
||||
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,
|
||||
showpic:res.data.showpic,
|
||||
loadingHidden:true
|
||||
})
|
||||
|
||||
if(gp==0||gp==1){
|
||||
that.setData({
|
||||
images:res.data.pic,
|
||||
title:res.data.name,
|
||||
address:res.data.address,
|
||||
distance:res.data.distance,
|
||||
longitude:res.data.lon,
|
||||
latitude:res.data.lat,
|
||||
fwbody:res.data.fwbody,
|
||||
})
|
||||
if(res.data.productlist.length==0){
|
||||
that.setData({
|
||||
nodataHidden:false
|
||||
})
|
||||
}else{
|
||||
that.setData({
|
||||
nodataHidden:true
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
},swiperchange:function(e) {
|
||||
|
||||
},closeserver:function(e) {
|
||||
that.setData({
|
||||
bodyHidden:true
|
||||
})
|
||||
},inserver :function(e) {
|
||||
|
||||
},onamap:function(e) {
|
||||
var address = that.data.address
|
||||
var lat = that.data.latitude
|
||||
var lon = that.data.longitude
|
||||
wx.navigateTo({
|
||||
url: "../map/index?lat=" + lon + "&lon=" + lat + "&address=" + address
|
||||
})
|
||||
},oncopy0:function(e) {
|
||||
var address = that.data.address
|
||||
wx.setClipboardData({
|
||||
data: address,
|
||||
success: function (res) {
|
||||
wx.showToast({
|
||||
title: "复制成功"
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
3
pages/businessview/index.json
Normal file
3
pages/businessview/index.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "商家详情"
|
||||
}
|
||||
73
pages/businessview/index.wxml
Normal file
73
pages/businessview/index.wxml
Normal file
@@ -0,0 +1,73 @@
|
||||
<view class="container">
|
||||
<view class="container0" wx:if="{{showpic==0}}">
|
||||
<view class="swiper" style="padding: 0.8em;">
|
||||
<swiper class="swiper_box" indicator-dots="{{indicatorDots}}" vertical="{{vertical}}" circular="true"
|
||||
autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" bindchange="swiperchange">
|
||||
<block wx:for="{{images}}" wx:key="index">
|
||||
<swiper-item bindtap="onslide" data-id="{{item.img}}">
|
||||
<image src="{{item.img}}" class="slide-image"/>
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
</view>
|
||||
</view>
|
||||
<view class="business_view">
|
||||
<view class="view_title">{{title}}</view>
|
||||
<view class="view_distance">
|
||||
<view class="view_distance_box">
|
||||
<view class="ub-f1">距您直线距离<span id="distance_box">{{distance}}</span>
|
||||
</view>
|
||||
<view class="ico" catchtap="inserver">
|
||||
<image src="../../images/Pin-Assistor.png" bindtap="onamap" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="ub view_address">
|
||||
<view class="ub-f1">
|
||||
地址:<span id="address_box">{{address}}</span>
|
||||
</view>
|
||||
<view class="ub ico" catchtap="inserver">
|
||||
<image src="../../images/copy.png" bindtap="oncopy0" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="view_fwbody">
|
||||
服务内容:<view id="fwbody_box">{{fwbody}}</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="choice_box" wx-if='{{Products.length>0}}'>
|
||||
<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">零售价:<text>¥{{item.scje}}</text>
|
||||
</view>
|
||||
<view class="hyje">会员价:<text>¥{{item.hyje}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="right_button" >
|
||||
<view>立即抢购</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
250
pages/businessview/index.wxss
Normal file
250
pages/businessview/index.wxss
Normal file
@@ -0,0 +1,250 @@
|
||||
page{
|
||||
background: #ccc;
|
||||
}
|
||||
.container {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-size: 14px;
|
||||
color: #000;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.container0{
|
||||
margin-top: 0em;
|
||||
padding: 0.8em;
|
||||
box-sizing: border-box;
|
||||
|
||||
}
|
||||
|
||||
.swiper{
|
||||
width:100%;
|
||||
background-color: #fff;
|
||||
border-radius:0.5em;
|
||||
padding: 0.8em;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.swiper_box {
|
||||
width: 100%;
|
||||
min-height: 14em;
|
||||
}
|
||||
|
||||
swiper-item image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: inline-block;
|
||||
}
|
||||
.business_view {
|
||||
width: 100%;
|
||||
padding: 0 0.8em;
|
||||
padding-bottom: 0.8em;
|
||||
background-color: #fff;
|
||||
box-sizing: border-box;
|
||||
color: #939393;
|
||||
line-height: 2em;
|
||||
}
|
||||
.view_title {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
width: 100%;
|
||||
font-size: 1em;
|
||||
font-weight: 900;
|
||||
color:#000;
|
||||
}
|
||||
.view_distance {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.view_distance .view_distance_box {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.view_distance .view_distance_box .ico {
|
||||
margin-left: 0.5em;
|
||||
margin-top: 0.3em;
|
||||
width: 1.2em;
|
||||
height: 1.2em;
|
||||
}
|
||||
|
||||
.view_distance .view_distance_box .ico image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.view_address {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.view_address .ico {
|
||||
margin-top: 0.3em;
|
||||
width: 1.4em;
|
||||
height: 1.4em;
|
||||
}
|
||||
|
||||
.view_address .ico image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.view_fwbody {
|
||||
width: 100%;
|
||||
}
|
||||
.text{
|
||||
margin-top: 0;
|
||||
line-height: 2.5em;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
||||
.text .line_flag{
|
||||
margin-top: 0em;
|
||||
margin-left: 0.5em;
|
||||
margin-right: 0.5em;
|
||||
width:0.5em;
|
||||
height: 1.5em;
|
||||
line-height: 1.5em;
|
||||
background-color: #f0514d;
|
||||
border-radius:0.2em;
|
||||
}
|
||||
|
||||
.text .line_more{
|
||||
flex: 1;
|
||||
text-align: right;
|
||||
align-self: center;
|
||||
color:#ff0000
|
||||
}
|
||||
|
||||
.choice_box {
|
||||
margin-top:0em;
|
||||
margin-bottom:4em;
|
||||
padding:0.8em;
|
||||
z-index:11;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.choice_box .choice_box_to{
|
||||
padding:0;
|
||||
background-color:#ffffff;
|
||||
box-sizing: border-box;
|
||||
border-radius:0.5em;
|
||||
}
|
||||
.choice_box .choice_box_to .text{
|
||||
|
||||
}
|
||||
.choice_box .choice_box_to .text .line_flag{
|
||||
background-color: #00B050;
|
||||
}
|
||||
.choice_box .choice_list .choice_item{
|
||||
padding:0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-bottom: 1px solid #f1f1f1;
|
||||
}
|
||||
.choice_box .choice_list .choice_item .choice_item_box{
|
||||
padding:0;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
.choice_box .choice_list .choice_item .choice_image{
|
||||
float:left;
|
||||
position: relative;
|
||||
display: block;
|
||||
width: 42%;
|
||||
height: 10em;
|
||||
padding: 1em;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
}
|
||||
.choice_box .choice_list .choice_item .choice_image_box{
|
||||
float:left;
|
||||
position: relative;
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.choice_box .choice_list .choice_item .choice_image_box image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.choice_box .choice_list .choice_item .choice_image_box .YPTNum{
|
||||
position: absolute;
|
||||
bottom:0;
|
||||
left:0;
|
||||
line-height: 2em;
|
||||
font-size: 1em;
|
||||
width:100%;
|
||||
text-align: center;
|
||||
background:rgba(0, 0, 0, 0.5);
|
||||
color:#fff;
|
||||
}
|
||||
.choice_box .choice_list .right_title{
|
||||
float:left;
|
||||
display: flex;
|
||||
flex-direction:column;
|
||||
box-sizing: border-box;
|
||||
padding:1em;
|
||||
padding-left: 0;
|
||||
width:58%;
|
||||
height: 10em;
|
||||
|
||||
}
|
||||
.choice_box .choice_list .right_name {
|
||||
float:left;
|
||||
margin-bottom: 0.5em;
|
||||
display:block;
|
||||
width:100%;
|
||||
height:3em;
|
||||
text-align: left;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.choice_box .choice_list .jeto{
|
||||
display: flex;
|
||||
flex-direction:column;
|
||||
font-size: 0.85em;
|
||||
color:#848484;
|
||||
}
|
||||
|
||||
|
||||
.choice_box .choice_list .jeto .scje{
|
||||
text-decoration:line-through;
|
||||
}
|
||||
.choice_box .choice_list .jeto .hyje{
|
||||
color: #ff4d00;
|
||||
line-height:1.5em;
|
||||
margin-top: 0.2em;
|
||||
}
|
||||
.choice_box .choice_list .right_button {
|
||||
float:left;
|
||||
display:block;
|
||||
margin:0;
|
||||
margin-top: 0.5em;
|
||||
width:100%;
|
||||
}
|
||||
.choice_box .choice_list .right_button view{
|
||||
float:right;
|
||||
display:block;
|
||||
margin:0;
|
||||
width:6em;
|
||||
text-align: center;
|
||||
padding:0.2em 0.5em;
|
||||
box-sizing: border-box;
|
||||
background:linear-gradient(to right,#00B050,#00B050);
|
||||
color:#fff;
|
||||
border-radius:0.5em;
|
||||
overflow: hidden;
|
||||
}
|
||||
.choice_box .choice_list .right_button view.visited{
|
||||
background:linear-gradient(to left,#e1e1e1,#e8e8e8);
|
||||
border:1px solid #dfdfdf;
|
||||
color:#aaa;
|
||||
}
|
||||
.nodata{padding-top:1em; text-align: center; line-height: 1.5em; color:#939393;}
|
||||
.nodata image {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
}
|
||||
Reference in New Issue
Block a user