|
@@ -4,13 +4,9 @@ import { pageTo, isLogin } from '@/utils/util.js'
|
|
|
import { getUser, wxMiniLogin } from '@/utils/auth'
|
|
import { getUser, wxMiniLogin } from '@/utils/auth'
|
|
|
import { getDictionaries } from '@/api/mini'
|
|
import { getDictionaries } from '@/api/mini'
|
|
|
import { hasTokenAutoLogin } from '@/api/common'
|
|
import { hasTokenAutoLogin } from '@/api/common'
|
|
|
-
|
|
|
|
|
-// #ifdef APP-PLUS
|
|
|
|
|
-const shangMiPrint = uni.requireNativePlugin('G5KJ-ShangMiPrint')
|
|
|
|
|
-const globalEvent = uni.requireNativePlugin('globalEvent')
|
|
|
|
|
-// #endif
|
|
|
|
|
-
|
|
|
|
|
|
|
+import scanMins from "@/mixins/scan";
|
|
|
export default {
|
|
export default {
|
|
|
|
|
+ mixins: [scanMins],
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
// 全局混入,插入链接参数
|
|
// 全局混入,插入链接参数
|
|
@@ -25,9 +21,7 @@ export default {
|
|
|
//所有花材列表
|
|
//所有花材列表
|
|
|
allProduct:[],
|
|
allProduct:[],
|
|
|
//零售店对应的id
|
|
//零售店对应的id
|
|
|
- skCustomId:0,
|
|
|
|
|
- //SUNMI 商米
|
|
|
|
|
- globalDevice:''
|
|
|
|
|
|
|
+ skCustomId:0
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
@@ -36,10 +30,6 @@ export default {
|
|
|
onLoad: function (option) {
|
|
onLoad: function (option) {
|
|
|
|
|
|
|
|
// #ifdef APP-PLUS
|
|
// #ifdef APP-PLUS
|
|
|
- if(plus.device.vendor == 'SUNMI'){
|
|
|
|
|
- this.globalDevice = 'SUNMI'
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
//横屏锁定
|
|
//横屏锁定
|
|
|
plus.screen.lockOrientation('landscape')
|
|
plus.screen.lockOrientation('landscape')
|
|
|
// #endif
|
|
// #endif
|
|
@@ -74,7 +64,6 @@ export default {
|
|
|
let token = res.token || ''
|
|
let token = res.token || ''
|
|
|
if (!this.$util.isEmpty(token)) {
|
|
if (!this.$util.isEmpty(token)) {
|
|
|
getUser(true)
|
|
getUser(true)
|
|
|
- this.setUserShopAll()
|
|
|
|
|
}
|
|
}
|
|
|
if (this.init) {
|
|
if (this.init) {
|
|
|
this.init()
|
|
this.init()
|
|
@@ -96,10 +85,6 @@ export default {
|
|
|
})
|
|
})
|
|
|
store.commit('setLoginInfo', { ...subRes.data.admin, ...subRes.data })
|
|
store.commit('setLoginInfo', { ...subRes.data.admin, ...subRes.data })
|
|
|
this.skCustomId = subRes.data.skCustomId
|
|
this.skCustomId = subRes.data.skCustomId
|
|
|
- // #ifdef APP-PLUS
|
|
|
|
|
- this.listenScan()
|
|
|
|
|
- // #endif
|
|
|
|
|
- this.setUserShopAll()
|
|
|
|
|
if (this.init) {
|
|
if (this.init) {
|
|
|
this.init()
|
|
this.init()
|
|
|
}
|
|
}
|
|
@@ -116,27 +101,5 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
- ...mapActions(['setUserShopAll']),
|
|
|
|
|
- // #ifdef APP-PLUS
|
|
|
|
|
- //监听扫码
|
|
|
|
|
- listenScan(){
|
|
|
|
|
- let that = this
|
|
|
|
|
- //商米收银台
|
|
|
|
|
- if(globalDevice == 'SUNMI'){
|
|
|
|
|
- //https://ext.dcloud.net.cn/plugin?id=3514
|
|
|
|
|
- //初始化
|
|
|
|
|
- shangMiPrint.init()
|
|
|
|
|
- //扫码返回
|
|
|
|
|
- globalEvent.addEventListener('scancode',function(e){
|
|
|
|
|
- if(e.code == 'ok'){
|
|
|
|
|
- let productIdCode = e.data
|
|
|
|
|
- console.log(productIdCode)
|
|
|
|
|
- that.$msg(productIdCode)
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- console.log('!!!!!!!!!!!!!!!!!!!!!!!!商米收银台发起监听!!!!!!!!!!!!!!!!!!!!!!!!')
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- // #endif
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|