|
|
@ -46,8 +46,8 @@ |
|
|
// mainurl: 'https://taketest.sdwanyue.com/api/?s=', |
|
|
// mainurl: 'https://taketest.sdwanyue.com/api/?s=', |
|
|
// mainurl: 'https://take.sdwanyue.com/api/?s=', |
|
|
// mainurl: 'https://take.sdwanyue.com/api/?s=', |
|
|
// mainurl: 'https://dev.xenjoyou.com/hiver', |
|
|
// mainurl: 'https://dev.xenjoyou.com/hiver', |
|
|
mainurl: 'https://hbkuaishi.com/hiver', |
|
|
// mainurl: 'https://hbkuaishi.com/hiver', |
|
|
// mainurl: 'http://192.168.1.192:8888/hiver', |
|
|
mainurl: 'http://192.168.1.192:8888/hiver', |
|
|
// #endif |
|
|
// #endif |
|
|
// weburl: 'https://taketest.sdwanyue.com/', |
|
|
// weburl: 'https://taketest.sdwanyue.com/', |
|
|
weburl: 'https://takeout.sdwanyue.com/', |
|
|
weburl: 'https://takeout.sdwanyue.com/', |
|
|
@ -69,7 +69,7 @@ |
|
|
$t: '', |
|
|
$t: '', |
|
|
userInfo: {}, |
|
|
userInfo: {}, |
|
|
registrationID: '', |
|
|
registrationID: '', |
|
|
printData:[] |
|
|
printData: [] |
|
|
}, |
|
|
}, |
|
|
onLaunch: function() { |
|
|
onLaunch: function() { |
|
|
let context = this; |
|
|
let context = this; |
|
|
@ -94,7 +94,7 @@ |
|
|
//监听 极光推送连接状态 |
|
|
//监听 极光推送连接状态 |
|
|
this.getNotificationEnabled(); |
|
|
this.getNotificationEnabled(); |
|
|
jpushModule.addConnectEventListener(result => { |
|
|
jpushModule.addConnectEventListener(result => { |
|
|
console.log('----------------------------',result) |
|
|
console.log('----------------------------', result) |
|
|
let connectEnable = result.connectEnable |
|
|
let connectEnable = result.connectEnable |
|
|
if (connectEnable == true) { |
|
|
if (connectEnable == true) { |
|
|
|
|
|
|
|
|
@ -110,11 +110,20 @@ |
|
|
let notificationEventType = result.notificationEventType |
|
|
let notificationEventType = result.notificationEventType |
|
|
let woopId = result.extras && result.extras.dataType === 'woop' && result.extras.value; |
|
|
let woopId = result.extras && result.extras.dataType === 'woop' && result.extras.value; |
|
|
console.log("通知", result) |
|
|
console.log("通知", result) |
|
|
|
|
|
if (result.content.includes('订单出餐已超时')) { |
|
|
|
|
|
this.onPlayAudio(2) |
|
|
|
|
|
} else{ |
|
|
|
|
|
if(result.content.includes('您有一笔新的订单')){ |
|
|
|
|
|
this.onPlayAudio(4) |
|
|
|
|
|
}else if(result.content.includes('您有一笔新的到店订单')){ |
|
|
|
|
|
this.onPlayAudio(3) |
|
|
|
|
|
} else if(result.content.includes('您有一笔订单申请退款')){ |
|
|
|
|
|
this.onPlayAudio(1) |
|
|
|
|
|
} |
|
|
this.globalData.printData.push(JSON.parse(result.android.inAppExtras)) |
|
|
this.globalData.printData.push(JSON.parse(result.android.inAppExtras)) |
|
|
console.log("通知数据",this.globalData.printData) |
|
|
|
|
|
// printer.getIsData("1") |
|
|
|
|
|
printer.getData() |
|
|
printer.getData() |
|
|
|
|
|
} |
|
|
|
|
|
console.log("通知数据", this.globalData.printData) |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
jpushModule.isPushStopped(res => { |
|
|
jpushModule.isPushStopped(res => { |
|
|
@ -151,16 +160,16 @@ |
|
|
// #ifdef MP-WEIXIN |
|
|
// #ifdef MP-WEIXIN |
|
|
this.globalData.GaoDeKey_amapkey = '52de86da47be2ea547c37dd382025a0c' |
|
|
this.globalData.GaoDeKey_amapkey = '52de86da47be2ea547c37dd382025a0c' |
|
|
// #endif |
|
|
// #endif |
|
|
if(!uni.getStorageSync('bluetoothDeviceId')){ |
|
|
if (!uni.getStorageSync('bluetoothDeviceId')) { |
|
|
uni.showModal({ |
|
|
uni.showModal({ |
|
|
title: '提示', |
|
|
title: '提示', |
|
|
content: '您还没有连接打印机,将无法为您打印小票!', |
|
|
content: '您还没有连接打印机,将无法为您打印小票!', |
|
|
confirmText:'连接蓝牙', |
|
|
confirmText: '连接蓝牙', |
|
|
cancelText:'暂不连接', |
|
|
cancelText: '暂不连接', |
|
|
success: function (res) { |
|
|
success: function(res) { |
|
|
if (res.confirm) { |
|
|
if (res.confirm) { |
|
|
uni.navigateTo({ |
|
|
uni.navigateTo({ |
|
|
url:'/pages/myCenter/setPrint' |
|
|
url: '/pages/myCenter/setPrint' |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -174,6 +183,28 @@ |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
|
|
|
onPlayAudio(type) { |
|
|
|
|
|
var audio = null; |
|
|
|
|
|
audio = uni.getBackgroundAudioManager(); |
|
|
|
|
|
audio.title = "通知音"; |
|
|
|
|
|
audio.singer = "通知音"; |
|
|
|
|
|
// #ifdef APP-PLUS |
|
|
|
|
|
if (type == 1) { //退款 |
|
|
|
|
|
audio.src = 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/cb24e35cfb1b48a58823633f23398d45.mp3'; |
|
|
|
|
|
} else if (type == 2) { //超时 |
|
|
|
|
|
audio.src = 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/4d20a1cbc92c42f4b70de1b9dacb7979.mp3'; |
|
|
|
|
|
} else if (type == 3) { //到店订单 |
|
|
|
|
|
audio.src = 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/3ced308cf72348a3adeb07d003ced5f3.mp3'; |
|
|
|
|
|
} else if (type == 4) { //新订单 |
|
|
|
|
|
audio.src = 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/c60ef3944e58461fbe7ce23ae38c70a2.mp3'; |
|
|
|
|
|
} |
|
|
|
|
|
// #endif |
|
|
|
|
|
|
|
|
|
|
|
audio.play(); |
|
|
|
|
|
audio.onEnded(function(res) { |
|
|
|
|
|
audio = null; |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
getAreaSize() { |
|
|
getAreaSize() { |
|
|
var res = uni.getSystemInfoSync() |
|
|
var res = uni.getSystemInfoSync() |
|
|
// console.log(res) |
|
|
// console.log(res) |
|
|
|