Commit 883d3be8c29e6e20c063045387fb47b0dcd4e1c7

Authored by vking
1 parent cf331da5

subscribe

// component/menu/addDelete.js
import util from '../../utils/util';
import App from '../../utils/api';
const subscribe=[
'LjNlk6OAhMcfC5i9f6IHM2HFhr3aWcTvAMiXczTkXtk',//测试 预约通知
]
Component({
/**
* 组件的属性列表
*/
properties: {
ids:{
type:Array,
value:subscribe.keys()
}
},
/**
* 组件的初始数据
*/
data: {
},
attached(){
},
ready () {
},
detached(){
},
observers: {
ids:function(){
console.log('this.data.ids',this.data.ids)
this.subscribeIds=[];
this.data.ids.forEach(i=>{
this.subscribeIds.push(subscribe[i])
})
},
},
/**
* 组件的方法列表
*/
methods: {
subscribe(){
console.log('subscribe',this.subscribeIds)
wx.requestSubscribeMessage({
tmplIds:this.subscribeIds,
success:res=>{
console.log('wx.requestSubscribeMessage.success',res)
let accept=[]
this.subscribeIds.forEach(id=>{
if(res[id]=='accept'){
accept.push(id)
}
})
if(accept.length>0){
util.toast('订阅成功','none')
setTimeout(()=>{
App.Wechat.Subscribe({
tplid:accept.toString()
})
},3000)
}else{
util.toast('订阅失败,请在设置中打开','none')
}
},
fail:(efail)=>{
console.log('wx.requestSubscribeMessage.fail',efail)
wx.showModal({
title: '授权提示',
content: '您拒绝了订阅消息,请点击确定打开授权',
confirmColor: '#199095',
cancelColor: '#999',
success: function (res) {
if (res.confirm) {
util.setting();
}
}
})
},
})
},
}
})
... ...
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
... ...
<view bindtap="subscribe" style="width: 100%;">
<slot></slot>
</view>
\ No newline at end of file
... ...
@import "../../app.wxss";
\ No newline at end of file
... ...
... ... @@ -33,14 +33,14 @@ Page({
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
this.selectComponent('#getpos').getPos();
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.selectComponent('#getpos').getPos();
this.getDetail()
},
/**
... ... @@ -64,6 +64,19 @@ Page({
console.log('onShareAppMessage', arguments)
return this.shareSetting(e);
},
getDetail(){
App.Reserve.Detail({
openid: getApp().openid,
rid: this.id
}).then(res => {
this.detail=this.formatDatail(res.data)
this.detail.ddate_solt=Number(this.detail.ddate_solt);
this.setData({
detail: this.detail,
hasOnlineReserve:res.data.type==1,
})
})
},
formatDatail(detail) {
detail.rdateStr = util.unixtoTime(detail.ddate, 'MM月DD日 WW HH:II');
detail=RS.reserve(detail);
... ... @@ -212,20 +225,14 @@ Page({
onpos(e){
console.log('onpos',e);
this.location=e.detail
App.Reserve.Detail({
openid: getApp().openid,
rid: this.id
}).then(res => {
let detail=this.formatDatail(res.data)
detail.ddate_solt=Number(detail.ddate_solt);
this.setData({
detail: detail,
hasOnlineReserve:res.data.type==1,
})
if(detail.type==1 && detail.status==6){
this.GetRecommendSellerList(detail.seller.id)
}
})
if(!this.detail){
return setTimeout(()=>{
this.onpos(e)
},500)
}
if(this.detail.type==1 && this.detail.status==6){
this.GetRecommendSellerList(this.detail.seller.id)
}
},
gotoSellerDetail(e){
console.log(e)
... ...
... ... @@ -11,6 +11,7 @@
"formids":"/components/formids/formids",
"sb-tr":"/components/reserve/seller-box-transverse/seller-box",
"getpos":"/components/userinfo/getpos",
"as":"/components/actionSheet/index"
"as":"/components/actionSheet/index",
"subscribe": "/components/userinfo/subscribe"
}
}
\ No newline at end of file
... ...
... ... @@ -26,8 +26,13 @@
<view class="icon">
<icon type="waiting" size="47" color="#C8B16D"/>
</view>
<view class="title Medium">餐厅处理中</view>
<view class="info" wx:if="{{firstShowMsg}}">{{firstShowMsg}}</view>
<view class="title Medium">{{firstShowMsg.length>10?'餐厅处理中':'餐厅休息中'}}</view>
<view class="info" wx:if="{{firstShowMsg}}">
{{firstShowMsg.length>10?firstShowMsg:'营业后将优先处理您的订单,预计早上'+firstShowMsg+'左右短信告知预订结果'}}
</view>
<subscribe class="flex-lr share-view subscribe" ids="{{[0]}}">
<view class="share-but">提醒我包间预订结果</view>
</subscribe>
</block>
<block wx:elif="{{detail.status==6}}">
<view class="icon">
... ... @@ -78,7 +83,6 @@
</userinfo>
</view>
</block>
<view style="height: 40rpx;"></view>
<card seller="{{detail.seller}}" detail="{{detail}}" bindevent="cardEvent"></card>
<view class="detail-info Medium" style="margin-top: 56rpx;">
... ...
... ... @@ -19,6 +19,8 @@
margin-bottom: 26rpx;
}
.success .info{
box-sizing: border-box;
padding: 0 5%;
font-size: 26rpx;
color:#999999
}
... ... @@ -155,4 +157,7 @@
.transverse-list .seller{
width: 98%;
margin: 0 auto;
}
.share-view.subscribe{
margin-top: 24rpx;
}
\ No newline at end of file
... ...
... ... @@ -6,7 +6,7 @@ import DA from './data';
import reddot from '../../utils/reddot';
import PubSub from '../../utils/PubSub'
const {regeneratorRuntime} = global
const mapScale=14.9//18;
const mapScale=15//18;
const transverseViewHeight=235;
const renNum=function(){
let arr=[]
... ...
... ... @@ -164,9 +164,9 @@ Page({
if(this.data.user.remark!=''){
this.setremark();
}
let firstShowMsg='餐厅一般会在10分钟内为您反馈结果,请留意短信或微信通知'
let firstShowMsg='预计10分钟左右餐厅将告知您结果(请留意短息或微信通知)'
if(!this.hasInWorkTime()){//非营业时间预订
firstShowMsg='商家未上班,上班后将第一时间告知您预订结果,请留意短信/微信通知(上班时间:'+this.data.seller.rec_stime+'—'+this.data.seller.rec_etime+')'
firstShowMsg=this.data.seller.rec_stime
}
wx.removeStorageSync('remark')
wx.redirectTo({
... ...
... ... @@ -483,7 +483,7 @@
"id": 57,
"name": "pages/customer/detail_owner",
"pathName": "pages/customer/detail_owner",
"query": "id=33347&hasFirstShow=1",
"query": "id=33347&firstShowMsg=1111",
"scene": null
},
{
... ...
... ... @@ -414,5 +414,11 @@ export default {
//写入快速备注
'App.Customer.SetUserRemarkes':{
openid:'openid',
}
},
//订阅消息
'App.Wechat.Subscribe':{
openid:'openid',
},
}
\ No newline at end of file
... ...