|
|
@@ -33,7 +33,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
- ...mapGetters(["getLoginInfo"]),
|
|
|
+ ...mapGetters(["getLoginInfo","getSelectInfo"]),
|
|
|
},
|
|
|
// 页面生命周期才触发
|
|
|
onLoad: function (option) {
|
|
|
@@ -112,8 +112,6 @@ export default {
|
|
|
// #endif
|
|
|
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
},
|
|
|
onShow(){
|
|
|
if (isLogin()&&!this.$util.isEmpty(this.getLoginInfo)) {
|
|
|
@@ -144,6 +142,7 @@ export default {
|
|
|
//PDA扫码开单前准备好所有花材
|
|
|
allProduct().then(res=>{
|
|
|
this.allProduct = res.data.list
|
|
|
+ console.log('................载入最新花材和库存................')
|
|
|
})
|
|
|
|
|
|
this.checkStock = true
|
|
|
@@ -162,11 +161,11 @@ export default {
|
|
|
that.globalPDAKd(productIdCode)
|
|
|
}
|
|
|
})
|
|
|
- console.log('!!!!!!!!!!!!!!!!!!!!!!!商米收银台发起监听!!!!!!!!!!!!!!!!!!!!!')
|
|
|
+ console.log('!!!!!!!!!!!!!!!!!!!!!!!!商米收银台发起监听!!!!!!!!!!!!!!!!!!!!!!!')
|
|
|
}
|
|
|
|
|
|
//新大陆PDA
|
|
|
- if(plus.device.vendor == 'Newland' && plus.device.model == 'NLS-MT90'){
|
|
|
+ if(plus.device.vendor == 'Newland'){
|
|
|
//PDA
|
|
|
var main = plus.android.runtimeMainActivity(); //获取activity
|
|
|
var receiver = plus.android.implements('io.dcloud.feature.internal.reflect.BroadcastReceiver', {
|
|
|
@@ -176,7 +175,7 @@ export default {
|
|
|
var filter = new IntentFilter();
|
|
|
filter.addAction("nlscan.action.SCANNER_RESULT"); //监听扫描
|
|
|
main.registerReceiver(receiver, filter); //注册监听
|
|
|
- console.log('!!!!!!!!!!!!!!!!!!!!!!!PDA发起监听!!!!!!!!!!!!!!!!!!!!!!')
|
|
|
+ console.log('!!!!!!!!!!!!!!!!!!!!!!!!PDA发起监听!!!!!!!!!!!!!!!!!!!!!!!!!')
|
|
|
}
|
|
|
|
|
|
},
|
|
|
@@ -189,37 +188,74 @@ export default {
|
|
|
},
|
|
|
globalPDAKd(productIdCode){
|
|
|
let that = this
|
|
|
- this.allProduct.forEach(function(product,index,array){
|
|
|
- if(Number(product.id) == Number(productIdCode)){
|
|
|
- that.kdType = 'SCAN'
|
|
|
- product.userPrice = product.bigPrice
|
|
|
-
|
|
|
- //已经选择过的花材,先从storage取出,跳转到下一页/admin/billing/affirm 时selectList才有数据
|
|
|
- if(uni.getStorageSync('selectList_'+that.pageType+'_custom_'+that.option.customId)){
|
|
|
- let currentInfo = uni.getStorageSync('selectList_'+that.pageType+'_custom_'+that.option.customId)
|
|
|
- if(!that.$util.isEmpty(currentInfo)){
|
|
|
- currentInfo.forEach((currentItem,currentIndex,currentArray)=>{
|
|
|
- let currentId = currentItem.id
|
|
|
- that.allProduct.forEach(function(product,index,array){
|
|
|
- if(product.id == currentId){
|
|
|
- currentArray[currentIndex].bigPrice = product.bigPrice
|
|
|
- currentArray[currentIndex].smallPrice = product.smallPrice
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
- that.setSelectInfoByType({ type: that.pageType, info: currentInfo })
|
|
|
- }
|
|
|
- }
|
|
|
+ that.kdType = 'SCAN'
|
|
|
+ let pageType = "bill"
|
|
|
|
|
|
- that.option.customId = that.skCustomId
|
|
|
- that.addEvent(product)
|
|
|
- }
|
|
|
- })
|
|
|
- var pages = getCurrentPages()
|
|
|
+ var pages = getCurrentPages()
|
|
|
let currentRoute = pages[pages.length-1].route;
|
|
|
- if(currentRoute != 'admin/billing/affirm'){
|
|
|
- that.$util.pageTo({url: "/admin/billing/affirm",query:{customId:that.skCustomId,kdType:'SCAN'}})
|
|
|
+
|
|
|
+ let currentCustomId = that.skCustomId || 0
|
|
|
+ if(!this.$util.isEmpty(this.option.customId) && currentRoute == 'admin/billing/affirm'){
|
|
|
+ currentCustomId = this.option.customId
|
|
|
+ }
|
|
|
+ if(currentCustomId == 0){
|
|
|
+ this.$util.noStockRemind()
|
|
|
+ this.$msg('没有客户信息')
|
|
|
+ }
|
|
|
+
|
|
|
+ //涉及记住花材的代码和流程,请全项目搜索关键词remember_item
|
|
|
+ if(uni.getStorageSync('selectList_'+pageType+'_custom_'+currentCustomId)){
|
|
|
+ this.setSelectInfoByType({ type: pageType, info: uni.getStorageSync('selectList_'+pageType+'_custom_'+currentCustomId)})
|
|
|
}
|
|
|
+
|
|
|
+ let currentList = this.getSelectInfo[this.pageType] || [];
|
|
|
+
|
|
|
+ let index = this.allProduct.findIndex(ele => ele.id == productIdCode)
|
|
|
+ if(index == -1){
|
|
|
+ this.$util.noStockRemind()
|
|
|
+ this.$msg('没有找到花材')
|
|
|
+ }
|
|
|
+ let currentProduct = this.allProduct[index]
|
|
|
+
|
|
|
+ let storeIndex = -1
|
|
|
+ if(!this.$util.isEmpty(currentList)){
|
|
|
+ storeIndex = currentList.findIndex(ele=> ele.id == 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_'+pageType+'_custom_'+currentCustomId, currentList)
|
|
|
+ that.setSelectInfoByType({ type: pageType, info: currentList })
|
|
|
+
|
|
|
+ if(currentRoute != 'admin/billing/affirm'){
|
|
|
+ that.$util.pageTo({url: "/admin/billing/affirm",query:{customId:currentCustomId,kdType:that.kdType}})
|
|
|
+ }
|
|
|
},
|
|
|
// #endif
|
|
|
|