|
@@ -4,14 +4,8 @@ import { pageTo, isLogin } from '@/utils/util.js'
|
|
|
import { getUser, wxMiniLogin } from '@/utils/auth'
|
|
import { getUser, wxMiniLogin } from '@/utils/auth'
|
|
|
import { postWxCode, getDictionaries } from '@/api/mini'
|
|
import { postWxCode, getDictionaries } from '@/api/mini'
|
|
|
import { getStaffApi,hasTokenAutoLogin } from '@/api/common'
|
|
import { getStaffApi,hasTokenAutoLogin } from '@/api/common'
|
|
|
-import { allProduct } from '@/api/product'
|
|
|
|
|
import { codePay} from "@/api/order/index";
|
|
import { codePay} from "@/api/order/index";
|
|
|
|
|
|
|
|
-// #ifdef APP-PLUS
|
|
|
|
|
-const shangMiPrint = uni.requireNativePlugin('G5KJ-ShangMiPrint')
|
|
|
|
|
-const globalEvent = uni.requireNativePlugin('globalEvent')
|
|
|
|
|
-// #endif
|
|
|
|
|
-
|
|
|
|
|
export default {
|
|
export default {
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
@@ -90,9 +84,7 @@ 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.listenPDAkd()
|
|
|
|
|
- // #endif
|
|
|
|
|
|
|
+
|
|
|
this.setUserShopAll()
|
|
this.setUserShopAll()
|
|
|
if (this.init) {
|
|
if (this.init) {
|
|
|
this.init()
|
|
this.init()
|
|
@@ -118,9 +110,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.listenPDAkd()
|
|
|
|
|
- // #endif
|
|
|
|
|
this.setUserShopAll()
|
|
this.setUserShopAll()
|
|
|
if (this.init) {
|
|
if (this.init) {
|
|
|
this.init()
|
|
this.init()
|
|
@@ -141,142 +130,6 @@ export default {
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
...mapActions(['setUserShopAll']),
|
|
...mapActions(['setUserShopAll']),
|
|
|
-
|
|
|
|
|
- // #ifdef APP-PLUS
|
|
|
|
|
- //监听pda扫码开单
|
|
|
|
|
- listenPDAkd(){
|
|
|
|
|
-
|
|
|
|
|
- //PDA扫码开单前准备好所有花材,首页已经有加载不再需要
|
|
|
|
|
- allProduct().then(res=>{
|
|
|
|
|
- this.allProduct = res.data.list
|
|
|
|
|
- console.log('................载入最新花材................')
|
|
|
|
|
- })
|
|
|
|
|
-
|
|
|
|
|
- this.checkStock = true
|
|
|
|
|
-
|
|
|
|
|
- let that = this
|
|
|
|
|
-
|
|
|
|
|
- //商米D1s收银台
|
|
|
|
|
- if(plus.device.vendor == 'SUNMI'){
|
|
|
|
|
- //https://ext.dcloud.net.cn/plugin?id=3514
|
|
|
|
|
- //初始化
|
|
|
|
|
- shangMiPrint.init()
|
|
|
|
|
- //扫码返回
|
|
|
|
|
- globalEvent.addEventListener('scancode',function(e){
|
|
|
|
|
- if(e.code == 'ok'){
|
|
|
|
|
- let productIdCode = e.data
|
|
|
|
|
- that.globalPDAKd(productIdCode)
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- 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 selectJobType = "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 selectJobId = currentCustomId
|
|
|
|
|
- //涉及记住花材的代码和流程,请全项目搜索关键词remember_item
|
|
|
|
|
- let storageData = uni.getStorageSync('selectList_'+selectJobType+'_target_'+selectJobId)
|
|
|
|
|
- if(!this.$util.isEmpty(storageData)){
|
|
|
|
|
- this.setSelectInfo({ selectJobType: selectJobType, info: storageData,selectJobId:selectJobId})
|
|
|
|
|
- }
|
|
|
|
|
- let selectInfoData = this.getSelectInfo
|
|
|
|
|
- let currentList = selectInfoData[selectJobType+'_'+selectJobId] || []
|
|
|
|
|
- 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_'+selectJobType+'_target_'+currentCustomId, currentList)
|
|
|
|
|
- that.setSelectInfo({ selectJobType: selectJobType, info: currentList,selectJobId:selectJobId })
|
|
|
|
|
- if(currentRoute != 'admin/billing/affirm'){
|
|
|
|
|
- that.$util.pageTo({url: "/admin/billing/affirm",query:{customId:currentCustomId,kdType:that.kdType}})
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- // #endif
|
|
|
|
|
//付款码付款
|
|
//付款码付款
|
|
|
requestCodePay(authCode){
|
|
requestCodePay(authCode){
|
|
|
let that = this
|
|
let that = this
|