Commit 2c93d7c7211c36ccb821386196c706b3ce260740

Authored by wangfan
1 parent fa7dd6b1

activity

@@ -41,7 +41,8 @@ @@ -41,7 +41,8 @@
41 "pages/manager-invitation/setting/sellers", 41 "pages/manager-invitation/setting/sellers",
42 "pages/manager-invitation/setting/seller-editor", 42 "pages/manager-invitation/setting/seller-editor",
43 "pages/manager-invitation/crm/index", 43 "pages/manager-invitation/crm/index",
44 - "pages/manager-invitation/setting/history" 44 + "pages/manager-invitation/setting/history",
  45 + "pages/reserve/activity"
45 ], 46 ],
46 "subpackages": [ 47 "subpackages": [
47 { 48 {
  1 +// pages/reserve/activity.js
  2 +import util from '../../utils/util';
  3 +import App from '../../utils/api';
  4 +const {regeneratorRuntime} = global
  5 +import PubSub from '../../utils/PubSub'
  6 +Page({
  7 +
  8 + /**
  9 + * 页面的初始数据
  10 + */
  11 + data: {
  12 + seller:{},
  13 + },
  14 +
  15 + /**
  16 + * 生命周期函数--监听页面加载
  17 + */
  18 + onLoad: function (options) {
  19 + console.log('onLoad', options)
  20 + this.options=options
  21 + this.GetSellerDetail();
  22 + },
  23 + GetSellerDetail(){
  24 + let options=this.options
  25 + App.Customer.GetSellerDetail({
  26 + sid:options.id
  27 + }).then(res=>{
  28 + if(res.ret==200){
  29 + let seller=res.data
  30 + let seller_tel=[]
  31 + if(seller.seller_tel){
  32 + seller_tel=seller.seller_tel.split(',')
  33 + }else{
  34 + seller_tel=[seller.phone];
  35 + }
  36 + seller.seller_tel=seller_tel
  37 + seller.distance=parseInt(seller.distance);
  38 + if(seller.distance>1000){
  39 + seller.distanceStr=(seller.distance/1000).toFixed(2)+'公里'
  40 + }else{
  41 + seller.distanceStr=seller.distance+'米';
  42 + }
  43 + if(seller.envi_image.length<1){
  44 + seller.envi_image=['http://qn.colorcun.com/custom/lite-online/image/def-banner.png']
  45 + }
  46 + this.setData({
  47 + seller:seller,
  48 + })
  49 + }
  50 + })
  51 + },
  52 + /**
  53 + * 生命周期函数--监听页面初次渲染完成
  54 + */
  55 + onReady: function () {
  56 +
  57 + },
  58 +
  59 + /**
  60 + * 生命周期函数--监听页面显示
  61 + */
  62 + onShow: function () {
  63 +
  64 + },
  65 +
  66 + /**
  67 + * 生命周期函数--监听页面隐藏
  68 + */
  69 + onHide: function () {
  70 +
  71 + },
  72 +
  73 + /**
  74 + * 生命周期函数--监听页面卸载
  75 + */
  76 + onUnload: function () {
  77 +
  78 + },
  79 +
  80 + /**
  81 + * 页面相关事件处理函数--监听用户下拉动作
  82 + */
  83 + onPullDownRefresh: function () {
  84 +
  85 + },
  86 +
  87 + /**
  88 + * 页面上拉触底事件的处理函数
  89 + */
  90 + onReachBottom: function () {
  91 +
  92 + },
  93 +
  94 + /**
  95 + * 用户点击右上角分享
  96 + */
  97 + onShareAppMessage: function () {
  98 +
  99 + },
  100 + reserve(){
  101 + let seller_tel=this.data.seller.seller_tel
  102 + if(seller_tel.length<1) return util.toast('商家电话错误','none')
  103 + if(seller_tel.length==1){//只有一个电话
  104 + let phone=seller_tel[0].replace(/[^\d]/,'')
  105 + wx.makePhoneCall({
  106 + phoneNumber:phone
  107 + })
  108 + }else{
  109 + this.selectComponent('#as').show();
  110 + }
  111 + },
  112 + reservePhone(e){
  113 + if(e.detail.value){
  114 + let phone=e.detail.value.replace(/[^\d]/,'')
  115 + wx.makePhoneCall({
  116 + phoneNumber:phone
  117 + })
  118 + }
  119 +
  120 + },
  121 + follow(){
  122 + let param={
  123 + sid:this.options.id,
  124 + openid:getApp().openid,
  125 + }
  126 + if(this.data.IsCollectionSeller){//已收藏
  127 + param.cancel=1
  128 + }
  129 + let hasFollow=!this.data.IsCollectionSeller
  130 + this.setData({
  131 + IsCollectionSeller:hasFollow
  132 + })
  133 + App.Customer.SetCollectionRel(param);
  134 + PubSub.emit(
  135 + 'follow',
  136 + {
  137 + sid:this.options.id,
  138 + hasFollow:hasFollow,
  139 + }
  140 + )
  141 + },
  142 + lookLocation:function(){
  143 + //console.log(this.data.seller.lat,this.data.seller.long,this.data.detail.map_address)
  144 + wx.openLocation({
  145 + latitude:Number(this.data.seller.lat),
  146 + longitude:Number(this.data.seller.long),
  147 + scale:17,
  148 + address:this.data.seller.map_address,
  149 + success:function (res) {
  150 + console.log(res)
  151 + }
  152 + })
  153 + },
  154 +})
  1 +{
  2 + "navigationBarBackgroundColor": "#ffffff",
  3 + "navigationBarTextStyle": "black",
  4 + "navigationBarTitleText":"一键订",
  5 + "usingComponents": {
  6 + "formids":"/components/formids/formids",
  7 + "nav":"/components/nav/nav"
  8 + }
  9 +}
  1 +<!--pages/reserve/activity.wxml-->
  2 +<nav>更多优惠</nav>
  3 +<view class="pages">
  4 + <view class="title flex-ll Semibold">
  5 + <image src="http://qn.colorcun.com/custom/lite-online/image%E5%96%87%E5%8F%AD.png"></image>
  6 + 优惠活动
  7 + </view>
  8 + <view class="activity" >
  9 + <view wx:for="{{seller.activity}}" wx:key="seller.activity.key">{{item.desc}}</view>
  10 + </view>
  11 +</view>
  1 +/* pages/reserve/activity.wxss */
  2 +.pages{
  3 + width: 90%;
  4 + margin: 0 auto;
  5 +}
  6 +.title{
  7 + font-size: 30rpx;
  8 + height: 42rpx;
  9 + line-height: 42rpx;
  10 +}
  11 +.title image{
  12 + width: 30rpx;
  13 + height: 28rpx;
  14 + margin-right: 20rpx;
  15 + min-width: 30rpx;
  16 + margin-left: 8rpx;
  17 +}
  18 +.activity{
  19 + background-color: #F3F4F6;
  20 + max-width:100%;
  21 + width: 100%;
  22 + padding: 20rpx 54rpx;
  23 + font-size: 30rpx;
  24 + box-sizing:border-box;
  25 +}
  26 +.activity view{
  27 + line-height: 42rpx;
  28 +}
@@ -31,7 +31,7 @@ @@ -31,7 +31,7 @@
31 <view class="icon car" wx:if="{{seller.is_parking==1}}">停车场</view> 31 <view class="icon car" wx:if="{{seller.is_parking==1}}">停车场</view>
32 </view> 32 </view>
33 </view> 33 </view>
34 - <formids wx:if="{{seller.activity.length>0}}" class="flex-lr"> 34 + <formids wx:if="{{seller.activity.length>0}}" url="{{seller.activity.length>2?'/pages/reserve/activity?id='+seller.id:''}}">
35 <view class="activity flex-lr" > 35 <view class="activity flex-lr" >
36 <view class="activity-left"> 36 <view class="activity-left">
37 <view class="activity-first"> 37 <view class="activity-first">
@@ -42,7 +42,7 @@ @@ -42,7 +42,7 @@
42 {{seller.activity[1].desc}} 42 {{seller.activity[1].desc}}
43 </view> 43 </view>
44 </view> 44 </view>
45 - <view class="activity-right flex-rr Semibold" wx:if="{{seller.activity.length>1}}"> 45 + <view class="activity-right flex-rr Semibold" wx:if="{{seller.activity.length>2}}">
46 <view>更多优惠</view> 46 <view>更多优惠</view>
47 <view class="more"></view> 47 <view class="more"></view>
48 </view> 48 </view>
@@ -31,7 +31,7 @@ @@ -31,7 +31,7 @@
31 "list": [] 31 "list": []
32 }, 32 },
33 "miniprogram": { 33 "miniprogram": {
34 - "current": 39, 34 + "current": 50,
35 "list": [ 35 "list": [
36 { 36 {
37 "id": 0, 37 "id": 0,
@@ -406,6 +406,13 @@ @@ -406,6 +406,13 @@
406 "pathName": "pages/book/b_invitation", 406 "pathName": "pages/book/b_invitation",
407 "query": "id=7243", 407 "query": "id=7243",
408 "scene": null 408 "scene": null
  409 + },
  410 + {
  411 + "id": -1,
  412 + "name": "pages/reserve/activity 在线订座 ",
  413 + "pathName": "pages/reserve/activity",
  414 + "query": "id=1",
  415 + "scene": null
409 } 416 }
410 ] 417 ]
411 } 418 }