Commit 2c93d7c7211c36ccb821386196c706b3ce260740

Authored by wangfan
1 parent fa7dd6b1

activity

... ... @@ -41,7 +41,8 @@
"pages/manager-invitation/setting/sellers",
"pages/manager-invitation/setting/seller-editor",
"pages/manager-invitation/crm/index",
"pages/manager-invitation/setting/history"
"pages/manager-invitation/setting/history",
"pages/reserve/activity"
],
"subpackages": [
{
... ...
// pages/reserve/activity.js
import util from '../../utils/util';
import App from '../../utils/api';
const {regeneratorRuntime} = global
import PubSub from '../../utils/PubSub'
Page({
/**
* 页面的初始数据
*/
data: {
seller:{},
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log('onLoad', options)
this.options=options
this.GetSellerDetail();
},
GetSellerDetail(){
let options=this.options
App.Customer.GetSellerDetail({
sid:options.id
}).then(res=>{
if(res.ret==200){
let seller=res.data
let seller_tel=[]
if(seller.seller_tel){
seller_tel=seller.seller_tel.split(',')
}else{
seller_tel=[seller.phone];
}
seller.seller_tel=seller_tel
seller.distance=parseInt(seller.distance);
if(seller.distance>1000){
seller.distanceStr=(seller.distance/1000).toFixed(2)+'公里'
}else{
seller.distanceStr=seller.distance+'米';
}
if(seller.envi_image.length<1){
seller.envi_image=['http://qn.colorcun.com/custom/lite-online/image/def-banner.png']
}
this.setData({
seller:seller,
})
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
reserve(){
let seller_tel=this.data.seller.seller_tel
if(seller_tel.length<1) return util.toast('商家电话错误','none')
if(seller_tel.length==1){//只有一个电话
let phone=seller_tel[0].replace(/[^\d]/,'')
wx.makePhoneCall({
phoneNumber:phone
})
}else{
this.selectComponent('#as').show();
}
},
reservePhone(e){
if(e.detail.value){
let phone=e.detail.value.replace(/[^\d]/,'')
wx.makePhoneCall({
phoneNumber:phone
})
}
},
follow(){
let param={
sid:this.options.id,
openid:getApp().openid,
}
if(this.data.IsCollectionSeller){//已收藏
param.cancel=1
}
let hasFollow=!this.data.IsCollectionSeller
this.setData({
IsCollectionSeller:hasFollow
})
App.Customer.SetCollectionRel(param);
PubSub.emit(
'follow',
{
sid:this.options.id,
hasFollow:hasFollow,
}
)
},
lookLocation:function(){
//console.log(this.data.seller.lat,this.data.seller.long,this.data.detail.map_address)
wx.openLocation({
latitude:Number(this.data.seller.lat),
longitude:Number(this.data.seller.long),
scale:17,
address:this.data.seller.map_address,
success:function (res) {
console.log(res)
}
})
},
})
\ No newline at end of file
... ...
{
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black",
"navigationBarTitleText":"一键订",
"usingComponents": {
"formids":"/components/formids/formids",
"nav":"/components/nav/nav"
}
}
\ No newline at end of file
... ...
<!--pages/reserve/activity.wxml-->
<nav>更多优惠</nav>
<view class="pages">
<view class="title flex-ll Semibold">
<image src="http://qn.colorcun.com/custom/lite-online/image%E5%96%87%E5%8F%AD.png"></image>
优惠活动
</view>
<view class="activity" >
<view wx:for="{{seller.activity}}" wx:key="seller.activity.key">{{item.desc}}</view>
</view>
</view>
... ...
/* pages/reserve/activity.wxss */
.pages{
width: 90%;
margin: 0 auto;
}
.title{
font-size: 30rpx;
height: 42rpx;
line-height: 42rpx;
}
.title image{
width: 30rpx;
height: 28rpx;
margin-right: 20rpx;
min-width: 30rpx;
margin-left: 8rpx;
}
.activity{
background-color: #F3F4F6;
max-width:100%;
width: 100%;
padding: 20rpx 54rpx;
font-size: 30rpx;
box-sizing:border-box;
}
.activity view{
line-height: 42rpx;
}
\ No newline at end of file
... ...
... ... @@ -31,7 +31,7 @@
<view class="icon car" wx:if="{{seller.is_parking==1}}">停车场</view>
</view>
</view>
<formids wx:if="{{seller.activity.length>0}}" class="flex-lr">
<formids wx:if="{{seller.activity.length>0}}" url="{{seller.activity.length>2?'/pages/reserve/activity?id='+seller.id:''}}">
<view class="activity flex-lr" >
<view class="activity-left">
<view class="activity-first">
... ... @@ -42,7 +42,7 @@
{{seller.activity[1].desc}}
</view>
</view>
<view class="activity-right flex-rr Semibold" wx:if="{{seller.activity.length>1}}">
<view class="activity-right flex-rr Semibold" wx:if="{{seller.activity.length>2}}">
<view>更多优惠</view>
<view class="more"></view>
</view>
... ...
... ... @@ -31,7 +31,7 @@
"list": []
},
"miniprogram": {
"current": 39,
"current": 50,
"list": [
{
"id": 0,
... ... @@ -406,6 +406,13 @@
"pathName": "pages/book/b_invitation",
"query": "id=7243",
"scene": null
},
{
"id": -1,
"name": "pages/reserve/activity 在线订座 ",
"pathName": "pages/reserve/activity",
"query": "id=1",
"scene": null
}
]
}
... ...