Commit 9cf0a6be15ddb6f5d20297f7e7fc49cb22e2021a

Authored by vking
1 parent a9f1f40f

online

1 // components/reserve/seller-box/seller-box.js 1 // components/reserve/seller-box/seller-box.js
2 import util from '../../../utils/util'; 2 import util from '../../../utils/util';
3 import App from '../../../utils/api'; 3 import App from '../../../utils/api';
  4 +
4 const {regeneratorRuntime} = global 5 const {regeneratorRuntime} = global
5 Component({ 6 Component({
6 /** 7 /**
7 * 组件的属性列表 8 * 组件的属性列表
8 */ 9 */
9 properties: { 10 properties: {
10 - seller:{  
11 - type:Object,  
12 - value:{}, 11 + seller: {
  12 + type: Object,
  13 + value: {},
13 }, 14 },
14 - hasStat:{  
15 - type:Boolean,  
16 - value:false, 15 + hasStat: {
  16 + type: Boolean,
  17 + value: false,
17 }, 18 },
18 - hasAverage:{  
19 - type:Boolean,  
20 - value:true, 19 + hasAverage: {
  20 + type: Boolean,
  21 + value: true,
21 }, 22 },
22 - hasActivity:{//滚动优惠  
23 - type:Boolean,  
24 - value:false, 23 + hasActivity: {//滚动优惠
  24 + type: Boolean,
  25 + value: false,
25 }, 26 },
26 - hasActivityTags:{//优惠标签  
27 - type:Boolean,  
28 - value:false, 27 + hasActivityTags: {//优惠标签
  28 + type: Boolean,
  29 + value: false,
29 }, 30 },
30 - hasActivityShort:{//店铺名后面的惠字  
31 - type:Boolean,  
32 - value:false, 31 + hasActivityShort: {//店铺名后面的惠字
  32 + type: Boolean,
  33 + value: false,
33 }, 34 },
34 - hasSlogan:{  
35 - type:Boolean,  
36 - value:true, 35 + hasSlogan: {
  36 + type: Boolean,
  37 + value: true,
37 }, 38 },
38 - hasBrand:{//店铺品牌  
39 - type:Boolean,  
40 - value:false, 39 + hasBrand: {//店铺品牌
  40 + type: Boolean,
  41 + value: false,
41 }, 42 },
42 - hasActivityTese:{//店铺特色  
43 - type:Boolean,  
44 - value:false, 43 + hasActivityTese: {//店铺特色
  44 + type: Boolean,
  45 + value: false,
45 }, 46 },
46 - sellerStyle:{//特殊样式  
47 - type:String,  
48 - value:'', 47 + sellerStyle: {//特殊样式
  48 + type: String,
  49 + value: '',
49 } 50 }
50 }, 51 },
51 52
52 /** 53 /**
53 * 组件的初始数据 54 * 组件的初始数据
54 */ 55 */
55 - data: {  
56 - }, 56 + data: {},
57 lifetimes: { 57 lifetimes: {
58 - attached: function () {},  
59 - moved: function () { },  
60 - detached: function () { }, 58 + attached: function () {
  59 + },
  60 + moved: function () {
  61 + },
  62 + detached: function () {
  63 + },
61 }, 64 },
62 - observers:{  
63 - 'seller':function(seller){ 65 + observers: {
  66 + 'seller': function (seller) {
64 this.init() 67 this.init()
65 } 68 }
66 }, 69 },
@@ -68,68 +71,73 @@ Component({ @@ -68,68 +71,73 @@ Component({
68 * 组件的方法列表 71 * 组件的方法列表
69 */ 72 */
70 methods: { 73 methods: {
71 - init(){  
72 - let seller=this.data.seller  
73 - if(seller.distance || seller.distance!=="") {  
74 - seller.distance = parseInt(seller.distance);  
75 - if (seller.distance > 1000) {  
76 - seller.distanceStr = (seller.distance / 1000).toFixed(2) + 'km'  
77 - } else {  
78 - seller.distanceStr = seller.distance+'m';  
79 - }  
80 - if(seller.label_c.length>0) {  
81 - let label_cstr=[];  
82 - seller.label_c.forEach(l=>{  
83 - label_cstr.push(l.name)  
84 - })  
85 - seller.label_cstr=label_cstr.join(' | ')  
86 - }  
87 - this.setData({  
88 - se: seller, 74 + init() {
  75 + let seller = this.data.seller
  76 + if (seller.distance || seller.distance !== "") {
  77 + seller.distance = parseInt(seller.distance);
  78 + if (seller.distance > 1000) {
  79 + seller.distanceStr = (seller.distance / 1000).toFixed(2) + 'km'
  80 + } else {
  81 + seller.distanceStr = seller.distance + 'm';
  82 + }
  83 + if (seller.label_c.length > 0) {
  84 + let label_cstr = [];
  85 + seller.label_c.forEach(l => {
  86 + label_cstr.push(l.name)
89 }) 87 })
  88 + seller.label_cstr = label_cstr.join(' | ')
90 } 89 }
91 - },  
92 - tapButton(e){  
93 - let type=util.attr(e,'type');  
94 - if(type=='oncall'){  
95 - let seller_tel=this.data.seller.seller_tel;  
96 - if(seller_tel.length<1){  
97 - seller_tel=[this.data.seller.phone]  
98 - }  
99 - if(seller_tel.length==1){  
100 - wx.makePhoneCall({  
101 - phoneNumber:seller_tel[0].replace(/[^\d]/g,'')  
102 - })  
103 - }else{  
104 - //wx.hideTabBar();  
105 - wx.showActionSheet({  
106 - itemList:seller_tel,  
107 - complete:()=>{  
108 - //wx.showTabBar();  
109 - },  
110 - success:(res)=>{  
111 - let phone=seller_tel[res.tapIndex]  
112 - wx.makePhoneCall({  
113 - phoneNumber:phone.replace(/[^\d]/g,'')  
114 - })  
115 - }  
116 - });  
117 - }  
118 -  
119 - }else{  
120 - util.toast('请打电话预订','none');  
121 - }  
122 - },  
123 - lookLocation:function(){  
124 - wx.openLocation({  
125 - latitude:Number(this.data.seller.lat),  
126 - longitude:Number(this.data.seller.long),  
127 - scale:17,  
128 - address:this.data.seller.map_address,  
129 - success:function (res) {  
130 - console.log(res)  
131 - } 90 + this.setData({
  91 + se: seller,
  92 + })
  93 + }
  94 + },
  95 + tapButton(e) {
  96 + let type = util.attr(e, 'type');
  97 + if (type == 'oncall') {
  98 + if(this.data.seller.is_online_reserve==1){
  99 + return wx.navigateTo({
  100 + url:util.http_build_query({id:this.data.seller.id,activeTab:'reserve'},'/pages/reserve/detail')
132 }) 101 })
133 - }, 102 + }
  103 + let seller_tel = this.data.seller.seller_tel;
  104 + if (seller_tel.length < 1) {
  105 + seller_tel = [this.data.seller.phone]
  106 + }
  107 + if (seller_tel.length == 1) {
  108 + wx.makePhoneCall({
  109 + phoneNumber: seller_tel[0].replace(/[^\d]/g, '')
  110 + })
  111 + } else {
  112 + //wx.hideTabBar();
  113 + wx.showActionSheet({
  114 + itemList: seller_tel,
  115 + complete: () => {
  116 + //wx.showTabBar();
  117 + },
  118 + success: (res) => {
  119 + let phone = seller_tel[res.tapIndex]
  120 + wx.makePhoneCall({
  121 + phoneNumber: phone.replace(/[^\d]/g, '')
  122 + })
  123 + }
  124 + });
  125 + }
  126 +
  127 + } else {
  128 + util.toast('请打电话预订', 'none');
  129 + }
  130 + },
  131 + lookLocation: function () {
  132 + wx.openLocation({
  133 + latitude: Number(this.data.seller.lat),
  134 + longitude: Number(this.data.seller.long),
  135 + scale: 17,
  136 + address: this.data.seller.map_address,
  137 + success: function (res) {
  138 + console.log(res)
  139 + }
  140 + })
  141 + },
134 } 142 }
135 }) 143 })
@@ -157,7 +157,7 @@ Page({ @@ -157,7 +157,7 @@ Page({
157 getphone(e){ 157 getphone(e){
158 console.log('getphone',e); 158 console.log('getphone',e);
159 if(e.detail.ret!=200){ 159 if(e.detail.ret!=200){
160 - return util.toast('获取失败,请手动填写','none'); 160 + return util.toast('获取失败,请重新获取','none');
161 } 161 }
162 this.user.phone=e.detail.phone 162 this.user.phone=e.detail.phone
163 this.setData({ 163 this.setData({