|
@@ -170,116 +170,11 @@ export default {
|
|
|
globalEvent.addEventListener('scancode',function(e){
|
|
globalEvent.addEventListener('scancode',function(e){
|
|
|
if(e.code == 'ok'){
|
|
if(e.code == 'ok'){
|
|
|
let productIdCode = e.data
|
|
let productIdCode = e.data
|
|
|
- that.globalPDAKd(productIdCode)
|
|
|
|
|
|
|
+ console.log(productIdCode)
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
console.log('!!!!!!!!!!!!!!!!!!!!!!!!商米收银台发起监听!!!!!!!!!!!!!!!!!!!!!!!!')
|
|
console.log('!!!!!!!!!!!!!!!!!!!!!!!!商米收银台发起监听!!!!!!!!!!!!!!!!!!!!!!!!')
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- //新大陆PDA
|
|
|
|
|
- if(plus.device.vendor == 'Newland'){
|
|
|
|
|
- //PDA
|
|
|
|
|
- var main = plus.android.runtimeMainActivity(); //获取activity
|
|
|
|
|
- var receiver = plus.android.implements('io.dcloud.feature.internal.reflect.BroadcastReceiver', {
|
|
|
|
|
- onReceive: that.listenPDAkdReceive
|
|
|
|
|
- });
|
|
|
|
|
- var IntentFilter = plus.android.importClass('android.content.IntentFilter');
|
|
|
|
|
- var filter = new IntentFilter();
|
|
|
|
|
- filter.addAction("nlscan.action.SCANNER_RESULT"); //监听扫描
|
|
|
|
|
- main.registerReceiver(receiver, filter); //注册监听
|
|
|
|
|
- console.log('!!!!!!!!!!!!!!!!!!!!!!!!PDA发起监听!!!!!!!!!!!!!!!!!!!!!!!!!')
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- },
|
|
|
|
|
- //接收pda扫码
|
|
|
|
|
- listenPDAkdReceive(context, intent) {
|
|
|
|
|
- //通过intent实例引入intent类,方便以后的'.'操作
|
|
|
|
|
- plus.android.importClass(intent)
|
|
|
|
|
- var productIdCode = intent.getStringExtra("SCAN_BARCODE1")
|
|
|
|
|
- this.globalPDAKd(productIdCode)
|
|
|
|
|
- },
|
|
|
|
|
- globalPDAKd(productIdCode){
|
|
|
|
|
-
|
|
|
|
|
- //没有登陆直接扫码
|
|
|
|
|
- if(this.$util.isEmpty(this.getLoginInfo)){
|
|
|
|
|
- this.$msg('您还没有登陆')
|
|
|
|
|
- return false
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- var pages = getCurrentPages()
|
|
|
|
|
- let currentRoute = pages[pages.length-1].route;
|
|
|
|
|
-
|
|
|
|
|
- //付款码支付
|
|
|
|
|
- if(currentRoute == 'admin/billing/toPay'){
|
|
|
|
|
- this.requestCodePay(productIdCode)
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- let that = this
|
|
|
|
|
- that.kdType = 'SCAN'
|
|
|
|
|
- let currentJobType = "bill"
|
|
|
|
|
-
|
|
|
|
|
- let currentCustomId = that.skCustomId || 0
|
|
|
|
|
- let pdaCustomId = uni.getStorageSync('pdaCustomId')
|
|
|
|
|
- if(!this.$util.isEmpty(pdaCustomId) && currentRoute == 'admin/billing/affirm'){
|
|
|
|
|
- currentCustomId = pdaCustomId
|
|
|
|
|
- }
|
|
|
|
|
- if(currentCustomId == 0){
|
|
|
|
|
- this.$util.noStockRemind()
|
|
|
|
|
- this.$msg('没有客户信息')
|
|
|
|
|
- }
|
|
|
|
|
- let currentJobId = currentCustomId
|
|
|
|
|
- //涉及记住花材的代码和流程,请全项目搜索关键词remember_item
|
|
|
|
|
- let storageData = uni.getStorageSync('selectList_'+currentJobType+'_target_'+currentJobId)
|
|
|
|
|
- if(!this.$util.isEmpty(storageData)){
|
|
|
|
|
- this.setSelectInfo({ currentJobType: currentJobType, info: storageData,currentJobId:currentJobId})
|
|
|
|
|
- }
|
|
|
|
|
- let selectInfoData = this.getSelectInfo
|
|
|
|
|
- let currentList = selectInfoData[currentJobType+'_'+currentJobId] || []
|
|
|
|
|
- let index = this.allProduct.findIndex(ele => Number(ele.id) == Number(productIdCode))
|
|
|
|
|
- if(index == -1){
|
|
|
|
|
- this.$util.noStockRemind()
|
|
|
|
|
- this.$msg('没有找到花材..')
|
|
|
|
|
- return false
|
|
|
|
|
- }
|
|
|
|
|
- let currentProduct = this.allProduct[index]
|
|
|
|
|
- let storeIndex = -1
|
|
|
|
|
- if(!this.$util.isEmpty(currentList)){
|
|
|
|
|
- storeIndex = currentList.findIndex(ele=> Number(ele.id) == Number(currentProduct.id))
|
|
|
|
|
- }
|
|
|
|
|
- let currentItem = {}
|
|
|
|
|
- if(storeIndex == -1){
|
|
|
|
|
- currentProduct.bigCount = 1
|
|
|
|
|
- currentProduct.smallCount = 0
|
|
|
|
|
- currentProduct.userPrice = currentProduct.bigPrice
|
|
|
|
|
- currentItem = currentProduct
|
|
|
|
|
- if ((Number(currentItem.bigCount) * currentProduct.ratio + Number(currentItem.smallCount)) > (Number(currentProduct.bigNum) * currentProduct.ratio + Number(currentProduct.smallNum))) {
|
|
|
|
|
- this.$util.noStockRemind()
|
|
|
|
|
- uni.showToast({title:"库存不足",icon:"none"})
|
|
|
|
|
- if(currentRoute != 'admin/billing/affirm'){
|
|
|
|
|
- that.$util.pageTo({url: "/admin/billing/affirm",query:{customId:currentCustomId,kdType:that.kdType}})
|
|
|
|
|
- }
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- currentList.push(currentProduct)
|
|
|
|
|
- }else{
|
|
|
|
|
- let currentInfo = currentList[storeIndex]
|
|
|
|
|
- if (((Number(currentInfo.bigCount)+1) * currentProduct.ratio + Number(currentInfo.smallCount)) > (Number(currentProduct.bigNum) * currentProduct.ratio + Number(currentProduct.smallNum))) {
|
|
|
|
|
- this.$util.noStockRemind()
|
|
|
|
|
- uni.showToast({title:"库存不足",icon:"none"})
|
|
|
|
|
- if(currentRoute != 'admin/billing/affirm'){
|
|
|
|
|
- that.$util.pageTo({url: "/admin/billing/affirm",query:{customId:currentCustomId,kdType:that.kdType}})
|
|
|
|
|
- }
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- currentList[storeIndex].bigCount = Number(currentList[storeIndex].bigCount) + 1
|
|
|
|
|
- currentItem = currentList[storeIndex]
|
|
|
|
|
- }
|
|
|
|
|
- uni.setStorageSync('selectList_'+currentJobType+'_target_'+currentCustomId, currentList)
|
|
|
|
|
- that.setSelectInfo({ currentJobType: currentJobType, info: currentList,currentJobId:currentJobId })
|
|
|
|
|
- if(currentRoute != 'admin/billing/affirm'){
|
|
|
|
|
- that.$util.pageTo({url: "/admin/billing/affirm",query:{customId:currentCustomId,kdType:that.kdType}})
|
|
|
|
|
- }
|
|
|
|
|
},
|
|
},
|
|
|
// #endif
|
|
// #endif
|
|
|
//付款码付款
|
|
//付款码付款
|