tplus-components-touch 3.32.4 → 3.32.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -84,17 +84,17 @@ var DoNameList = exports.DoNameList = {
84
84
  var printDispatch = exports.printDispatch = function printDispatch(doName, ID, otherParams) {
85
85
  return new _promise2.default(function () {
86
86
  var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(res) {
87
- var _getLoginInfo, Idstore, POSCode, printEntity, isOpenPrint, checkedPrintType, cloudPrintArguments, _ref2, electronPrint, openCashBox, dto, _ref3, isHorizontalSunMi, result;
87
+ var _getLoginInfo, IdStore, posCode, printEntity, isOpenPrint, checkedPrintType, cloudPrintArguments, _ref2, electronPrint, openCashBox, dto, _ref3, isHorizontalSunMi, result;
88
88
 
89
89
  return _regenerator2.default.wrap(function _callee$(_context) {
90
90
  while (1) {
91
91
  switch (_context.prev = _context.next) {
92
92
  case 0:
93
- _getLoginInfo = getLoginInfo(), Idstore = _getLoginInfo.IdStore, POSCode = _getLoginInfo.posCode;
93
+ _getLoginInfo = getLoginInfo(), IdStore = _getLoginInfo.IdStore, posCode = _getLoginInfo.posCode;
94
94
  _context.next = 3;
95
95
  return _api2.default.GetPrintInfomation({
96
- Idstore: Idstore,
97
- POSCode: POSCode
96
+ Idstore: IdStore,
97
+ POSCode: posCode
98
98
  });
99
99
 
100
100
  case 3:
@@ -273,16 +273,12 @@ var syncOpenCashBox = function () {
273
273
  }();
274
274
 
275
275
  var getLoginInfo = function getLoginInfo() {
276
- var _ref7 = _mutantsMicrofx.localStore.get('user') || {},
277
- _ref7$loginInfo = _ref7.loginInfo,
278
- loginInfo = _ref7$loginInfo === undefined ? {} : _ref7$loginInfo;
279
-
280
- return loginInfo;
276
+ return _mutantsMicrofx.stores.user.options.get('loginInfo');
281
277
  };
282
278
 
283
279
  var isOldOpen = exports.isOldOpen = function isOldOpen(printDetailEntitys) {
284
- var _ref8 = _mutantsUtil.platform || {},
285
- isVerticalTouch = _ref8.isVerticalTouch;
280
+ var _ref7 = _mutantsUtil.platform || {},
281
+ isVerticalTouch = _ref7.isVerticalTouch;
286
282
 
287
283
  if (isVerticalTouch) return true;
288
284
  var isOpenPrintValue = _mutantsMicrofx.localStore && _mutantsMicrofx.localStore.get('isOpenPrint');
@@ -294,8 +290,8 @@ var isOldOpen = exports.isOldOpen = function isOldOpen(printDetailEntitys) {
294
290
  }).length > 0;
295
291
  var cloudPrintArguments = _mutantsMicrofx.localStore && _mutantsMicrofx.localStore.get('cloudPrintArguments');
296
292
 
297
- var _ref9 = cloudPrintArguments || {},
298
- cloudOpen = _ref9.Open;
293
+ var _ref8 = cloudPrintArguments || {},
294
+ cloudOpen = _ref8.Open;
299
295
 
300
296
  return localOrYinMeiOpen || cloudOpen;
301
297
  };
@@ -303,8 +299,8 @@ var isOldOpen = exports.isOldOpen = function isOldOpen(printDetailEntitys) {
303
299
  var getCheckedPrintTypeDefaults = exports.getCheckedPrintTypeDefaults = function getCheckedPrintTypeDefaults() {
304
300
  var hasElectron = _mutantsMicrofx.env.platform === _mutantsMicrofx.env.constant.platform.electron;
305
301
 
306
- var _ref10 = _mutantsUtil.platform || {},
307
- isVerticalTouch = _ref10.isVerticalTouch;
302
+ var _ref9 = _mutantsUtil.platform || {},
303
+ isVerticalTouch = _ref9.isVerticalTouch;
308
304
  // 打印机选择的类型
309
305
 
310
306
 
@@ -314,8 +310,8 @@ var getCheckedPrintTypeDefaults = exports.getCheckedPrintTypeDefaults = function
314
310
  if (hasElectron || !!isVerticalTouch) {
315
311
  checkedPrintType = '1';
316
312
  } else {
317
- var _ref11 = cloudPrintArguments || {},
318
- Open = _ref11.Open;
313
+ var _ref10 = cloudPrintArguments || {},
314
+ Open = _ref10.Open;
319
315
 
320
316
  if (Open) {
321
317
  checkedPrintType = '3';
@@ -1 +1 @@
1
- {"version":3,"sources":["tplus-components-touch/components/cloudPrint/printDispatch.js"],"names":["t","i18n","getFixedT","DoNameList","DO_PRINT","DO_ONLY_PRINT","DO_MT_RETAIL","DO_DUTY_PRINT","DO_DIALY_PRINT","DO_STORAGE_PRINT","DO_PROJECT_STORAGE_PRINT","DO_PROJECT_CONSUME_PRINT","DoDesName","doPrint","doMtRetail","doOnlyRetail","doDutyPrint","doDialyPrint","doStoragePrint","doProjectStoragePrint","doProjectConsumePrint","DoPrintGlobalFunction","printDispatch","doName","ID","otherParams","res","getLoginInfo","Idstore","IdStore","POSCode","posCode","API","GetPrintInfomation","printEntity","AutoPrintTicket","isOpenPrint","isOldOpen","PrintDetailEntitys","checkedPrintType","getCheckedPrintTypeDefaults","cloudPrintArguments","localStore","get","electronPrint","openCashBox","dto","platform","isHorizontalSunMi","syncOpenCashBox","cloudPrintNoTemplate","result","env","constant","electron","Message","warn","global","execute","Open","Key","Sign","Name","Card","resolve","printUtil","PrintUtil","msg","s","ret","success","error","CashBoxCmd","window","sunMi_OperatingCashier","OpenDrawer","loginInfo","printDetailEntitys","isVerticalTouch","isOpenPrintValue","localOrYinMeiOpen","filter","item","IsEnablePrinter","length","cloudOpen","hasElectron"],"mappings":";;;;;;;;;;;;;;;;;;;AAQA;;AACA;;AACA;;AACA;;;;AACA;;;;AAEA;;;;;;AADA,IAAMA,IAAIC,qBAAKC,SAAL,CAAe,IAAf,EAAqB,WAArB,CAAV,C,CAbA;;;;;;;;;;AAgBA;AACO,IAAMC,kCAAa;AACtBC,cAAS,SADa;AAEtBC,mBAAc,cAFQ;AAGtBC,kBAAa,YAHS;AAItBC,mBAAc,aAJQ;AAKtBC,oBAAe,cALO;AAMtBC,sBAAiB,gBANK;AAOtBC,8BAAyB,uBAPH;AAQtBC,8BAAyB;;AAG7B;AAX0B,CAAnB,CAYP,IAAMC,YAAY;AACdC,aAAQ,IADM;AAEdC,gBAAW,IAFG;AAGdC,kBAAa,IAHC;AAIdC,iBAAY,IAJE;AAKdC,kBAAa,IALC;AAMdC,oBAAe,IAND;AAOdC,2BAAsB,MAPR;AAQdC,2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oBAAIL,QAAJ,KAAiBK,oBAAIC,QAAJ,CAAaN,QAAb,CAAsBO,QAA5D;;AAD6C,iBAEjBP,yBAAY,EAFK;AAAA,QAErC+B,eAFqC,UAErCA,eAFqC;AAG7C;;;AACA,QAAIvC,mBAAoBG,8BAAcA,2BAAWC,GAAX,CAAe,kBAAf,CAAtC;AACA,QAAMF,sBAAsBC,8BAAcA,2BAAWC,GAAX,CAAe,qBAAf,CAA1C;AACA,QAAGJ,qBAAqB,IAAxB,EAA8B;AAC1B,YAAG+C,eAAe,CAAC,CAACR,eAApB,EAAoC;AAChCvC,+BAAmB,GAAnB;AACH,SAFD,MAEM;AAAA,yBACeE,uBAAuB,EADtC;AAAA,gBACMkB,IADN,UACMA,IADN;;AAEF,gBAAGA,IAAH,EAAQ;AACJpB,mCAAmB,GAAnB;AACH,aAFD,MAEK;AACDA,mCAAmB,GAAnB;AACA;AACH;AACJ;AACJ;AACD,WAAOA,gBAAP;AACH,CApBM","file":"printDispatch.js","sourcesContent":["/*\r\n * @Descripttion: \r\n * @version: \r\n * @Author: chenlongad\r\n * @Date: 2020-11-17 10:02:02\r\n * @LastEditors: chenlongad\r\n * @LastEditTime: 2022-01-12 15:26:11\r\n */\r\nimport { platform } from 'mutants-util';\r\nimport {localStore,env,i18n} from 'mutants-microfx';\r\nimport { PosInitData } from 'tplus-poslogin';\r\nimport PrintUtil from './index'\r\nimport Message from '../message';\r\nconst t = i18n.getFixedT(null, 'newretail');\r\nimport API from './api';\r\n\r\n// 打印调用方法对照\r\nexport const DoNameList = {\r\n DO_PRINT:\"doPrint\",\r\n DO_ONLY_PRINT:\"doOnlyRetail\",\r\n DO_MT_RETAIL:\"doMtRetail\",\r\n DO_DUTY_PRINT:\"doDutyPrint\",\r\n DO_DIALY_PRINT:\"doDialyPrint\",\r\n DO_STORAGE_PRINT:\"doStoragePrint\",\r\n DO_PROJECT_STORAGE_PRINT:\"doProjectStoragePrint\",\r\n DO_PROJECT_CONSUME_PRINT:\"doProjectConsumePrint\"\r\n}\r\n\r\n// 打印调用方法名字对照\r\nconst DoDesName = {\r\n doPrint:\"小票\",\r\n doMtRetail:\"美团\",\r\n doOnlyRetail:\"小票\",\r\n doDutyPrint:\"交班\",\r\n doDialyPrint:\"日结\",\r\n doStoragePrint:\"储值\",\r\n doProjectStoragePrint:\"项目储值\",\r\n doProjectConsumePrint:\"扣次\"\r\n}\r\n\r\n// window打印调用方法对照\r\nconst DoPrintGlobalFunction = {\r\n doPrint:\"RetailPrintProcessBlock\",\r\n doOnlyRetail:\"OnlyRetailPrintProcess\",\r\n doMtRetail:\"MeiTuanPrintProcessBlock\",\r\n doDutyPrint:\"printShiftVoucher\",\r\n doDialyPrint:\"printDailyVoucher\",\r\n doStoragePrint:\"StoragePrintProcessBlock\",\r\n doProjectStoragePrint:\"ProjectStoragePrintProcessBlock\",\r\n doProjectConsumePrint:\"ProjectConsumePrintProcessBlock\"\r\n}\r\n\r\n\r\nexport const printDispatch = (doName,ID,otherParams) => {\r\n return new Promise(async (res) => {\r\n\r\n const { IdStore:Idstore,posCode:POSCode} = getLoginInfo();\r\n const printEntity = await API.GetPrintInfomation({\r\n Idstore,\r\n POSCode\r\n });\r\n // 开启结算完自动打印小票的选项 只判断是结算小票打印 其他的打印方式继续打印\r\n if (!printEntity.AutoPrintTicket && doName == DoNameList.DO_PRINT) {\r\n return res();\r\n }\r\n // 是否开启打印机\r\n const isOpenPrint = isOldOpen(printEntity.PrintDetailEntitys);\r\n\r\n // 获取打印机开启的类型\r\n let checkedPrintType = getCheckedPrintTypeDefaults()\r\n\r\n if(!isOpenPrint) checkedPrintType = null;\r\n\r\n // 获取云打印参数\r\n const cloudPrintArguments = localStore && localStore.get('cloudPrintArguments');\r\n\r\n let { electronPrint,openCashBox,dto} = otherParams || {};\r\n if(!dto){\r\n dto={};\r\n dto.Idstore = PosInitData('storeID');\r\n dto.POSCode = PosInitData('posCode');\r\n }\r\n\r\n const { isHorizontalSunMi } = platform || {};\r\n if (isOpenPrint && checkedPrintType === \"3\" || !checkedPrintType && !!isHorizontalSunMi) {\r\n // 1.如果未开启打印并且是商米平台 使用自带的打印机 2如果开启打印并且使用飞蛾打印机\r\n if(!!isHorizontalSunMi && openCashBox){\r\n // 开启商米的钱箱\r\n syncOpenCashBox(printEntity) \r\n }\r\n let result = await cloudPrintNoTemplate(doName, ID, cloudPrintArguments || {});\r\n res(result);\r\n } else if (isOpenPrint && (checkedPrintType === \"2\" || checkedPrintType === \"1\")) {\r\n if (env.platform !== env.constant.platform.electron && checkedPrintType === \"1\") {//获取当前是否处于Electron环境中\r\n Message.warn(t('打印小票只能在客户端中执行'))\r\n return res();\r\n }\r\n switch (doName) {\r\n case DoNameList.DO_PRINT:\r\n case DoNameList.DO_MT_RETAIL:\r\n case DoNameList.DO_ONLY_PRINT:\r\n case DoNameList.DO_DUTY_PRINT:\r\n case DoNameList.DO_DIALY_PRINT:\r\n case DoNameList.DO_STORAGE_PRINT:\r\n case DoNameList.DO_PROJECT_STORAGE_PRINT:\r\n case DoNameList.DO_PROJECT_CONSUME_PRINT: {\r\n if (global[DoPrintGlobalFunction[doName]]) {\r\n await global[DoPrintGlobalFunction[doName]].execute(ID,dto, openCashBox);\r\n return res();\r\n } else {\r\n if(!electronPrint){\r\n Message.warn(t('打印小票只能在客户端中执行'))\r\n return res();\r\n }\r\n }\r\n }\r\n }\r\n \r\n if (electronPrint) await electronPrint()\r\n res();\r\n }else {\r\n res();\r\n }\r\n })\r\n}\r\n\r\nconst cloudPrintNoTemplate = (doName,ID,{Open, Key, Sign, Name, Card }) => {\r\n return new Promise((resolve) => {\r\n const printUtil = new PrintUtil();\r\n if(doName === 'doOnlyRetail') doName = 'doPrint';\r\n printUtil[doName]({Open, Key, Sign, Name, Card }, ID, s => {\r\n const { msg, ret } = s;\r\n if (ret === 0) {\r\n Message.success(t(`打印${DoDesName[doName]}小票成功。`))\r\n }else if(ret === -1){\r\n Message.error(t(msg))\r\n } else {\r\n Message.error(t(`打印${DoDesName[doName]}小票失败。`))\r\n }\r\n resolve();\r\n })\r\n })\r\n}\r\n\r\nconst syncOpenCashBox = async(printEntity) =>{\r\n const { CashBoxCmd } = printEntity || {}\r\n return window.sunMi_OperatingCashier && window.sunMi_OperatingCashier.OpenDrawer(CashBoxCmd);\r\n}\r\n\r\nconst getLoginInfo = () => {\r\n const { loginInfo = {} } = localStore.get('user') || {};\r\n return loginInfo;\r\n}\r\n\r\nexport const isOldOpen = (printDetailEntitys) => {\r\n const { isVerticalTouch } = platform || {}\r\n if(isVerticalTouch) return true;\r\n const isOpenPrintValue = localStore && localStore.get('isOpenPrint');\r\n if(isOpenPrintValue !==null){\r\n return isOpenPrintValue === \"true\";\r\n }\r\n const localOrYinMeiOpen = printDetailEntitys && printDetailEntitys.filter((item)=>{\r\n return item.IsEnablePrinter === true\r\n }).length > 0;\r\n const cloudPrintArguments = localStore && localStore.get('cloudPrintArguments');\r\n const { Open:cloudOpen } = cloudPrintArguments || {};\r\n return localOrYinMeiOpen || cloudOpen;\r\n}\r\n\r\nexport const getCheckedPrintTypeDefaults = () => {\r\n const hasElectron = (env.platform === env.constant.platform.electron);\r\n const { isVerticalTouch } = platform || {}\r\n // 打印机选择的类型\r\n let checkedPrintType = localStore && localStore.get('checkedPrintType');\r\n const cloudPrintArguments = localStore && localStore.get('cloudPrintArguments');\r\n if(checkedPrintType === null) {\r\n if(hasElectron || !!isVerticalTouch){\r\n checkedPrintType = '1'\r\n }else {\r\n const { Open } = cloudPrintArguments || {};\r\n if(Open){\r\n checkedPrintType = '3'\r\n }else{\r\n checkedPrintType = '3'\r\n // checkedPrintType = '2' 后续改回这个 放开映美打印机后\r\n }\r\n }\r\n }\r\n return checkedPrintType\r\n}"]}
1
+ {"version":3,"sources":["tplus-components-touch/components/cloudPrint/printDispatch.js"],"names":["t","i18n","getFixedT","DoNameList","DO_PRINT","DO_ONLY_PRINT","DO_MT_RETAIL","DO_DUTY_PRINT","DO_DIALY_PRINT","DO_STORAGE_PRINT","DO_PROJECT_STORAGE_PRINT","DO_PROJECT_CONSUME_PRINT","DoDesName","doPrint","doMtRetail","doOnlyRetail","doDutyPrint","doDialyPrint","doStoragePrint","doProjectStoragePrint","doProjectConsumePrint","DoPrintGlobalFunction","printDispatch","doName","ID","otherParams","res","getLoginInfo","IdStore","posCode","API","GetPrintInfomation","Idstore","POSCode","printEntity","AutoPrintTicket","isOpenPrint","isOldOpen","PrintDetailEntitys","checkedPrintType","getCheckedPrintTypeDefaults","cloudPrintArguments","localStore","get","electronPrint","openCashBox","dto","platform","isHorizontalSunMi","syncOpenCashBox","cloudPrintNoTemplate","result","env","constant","electron","Message","warn","global","execute","Open","Key","Sign","Name","Card","resolve","printUtil","PrintUtil","msg","s","ret","success","error","CashBoxCmd","window","sunMi_OperatingCashier","OpenDrawer","stores","user","options","printDetailEntitys","isVerticalTouch","isOpenPrintValue","localOrYinMeiOpen","filter","item","IsEnablePrinter","length","cloudOpen","hasElectron"],"mappings":";;;;;;;;;;;;;;;;;;;AAQA;;AACA;;AACA;;AACA;;;;AACA;;;;AAEA;;;;;;AADA,IAAMA,IAAIC,qBAAKC,SAAL,CAAe,IAAf,EAAqB,WAArB,CAAV,C,CAbA;;;;;;;;;;AAgBA;AACO,IAAMC,kCAAa;AACtBC,cAAS,SADa;AAEtBC,mBAAc,cAFQ;AAGtBC,kBAAa,YAHS;AAItBC,mBAAc,aAJQ;AAKtBC,oBAAe,cALO;AAMtBC,sBAAiB,gBANK;AAOtBC,8BAAyB,uBAPH;AAQtBC,8BAAyB;;AAG7B;AAX0B,CAAnB,CAYP,IAAMC,YAAY;AACdC,aAAQ,IADM;AAEdC,gBAAW,IAFG;AAGdC,kBAAa,IAHC;AAIdC,iBAAY,IAJE;AAKdC,kBAAa,IALC;AAMdC,oBAAe,IAND;AAOdC,2BAAsB,MAPR;AAQdC,2BAAsB;;AAG1B;AAXkB,CAAlB,CAYA,IAAMC,wBAAwB;AAC1BR,aAAQ,yBADkB;AAE1BE,kBAAa,wBAFa;AAG1BD,gBA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AoBG,8BAAcA,2BAAWC,GAAX,CAAe,kBAAf,CAAtC;AACA,QAAMF,sBAAsBC,8BAAcA,2BAAWC,GAAX,CAAe,qBAAf,CAA1C;AACA,QAAGJ,qBAAqB,IAAxB,EAA8B;AAC1B,YAAGiD,eAAe,CAAC,CAACR,eAApB,EAAoC;AAChCzC,+BAAmB,GAAnB;AACH,SAFD,MAEM;AAAA,yBACeE,uBAAuB,EADtC;AAAA,gBACMkB,IADN,UACMA,IADN;;AAEF,gBAAGA,IAAH,EAAQ;AACJpB,mCAAmB,GAAnB;AACH,aAFD,MAEK;AACDA,mCAAmB,GAAnB;AACA;AACH;AACJ;AACJ;AACD,WAAOA,gBAAP;AACH,CApBM","file":"printDispatch.js","sourcesContent":["/*\r\n * @Descripttion: \r\n * @version: \r\n * @Author: chenlongad\r\n * @Date: 2020-11-17 10:02:02\r\n * @LastEditors: chenlongad\r\n * @LastEditTime: 2022-01-12 15:26:11\r\n */\r\nimport { platform } from 'mutants-util';\r\nimport { stores, localStore, env, i18n } from 'mutants-microfx';\r\nimport { PosInitData } from 'tplus-poslogin';\r\nimport PrintUtil from './index'\r\nimport Message from '../message';\r\nconst t = i18n.getFixedT(null, 'newretail');\r\nimport API from './api';\r\n\r\n// 打印调用方法对照\r\nexport const DoNameList = {\r\n DO_PRINT:\"doPrint\",\r\n DO_ONLY_PRINT:\"doOnlyRetail\",\r\n DO_MT_RETAIL:\"doMtRetail\",\r\n DO_DUTY_PRINT:\"doDutyPrint\",\r\n DO_DIALY_PRINT:\"doDialyPrint\",\r\n DO_STORAGE_PRINT:\"doStoragePrint\",\r\n DO_PROJECT_STORAGE_PRINT:\"doProjectStoragePrint\",\r\n DO_PROJECT_CONSUME_PRINT:\"doProjectConsumePrint\"\r\n}\r\n\r\n// 打印调用方法名字对照\r\nconst DoDesName = {\r\n doPrint:\"小票\",\r\n doMtRetail:\"美团\",\r\n doOnlyRetail:\"小票\",\r\n doDutyPrint:\"交班\",\r\n doDialyPrint:\"日结\",\r\n doStoragePrint:\"储值\",\r\n doProjectStoragePrint:\"项目储值\",\r\n doProjectConsumePrint:\"扣次\"\r\n}\r\n\r\n// window打印调用方法对照\r\nconst DoPrintGlobalFunction = {\r\n doPrint:\"RetailPrintProcessBlock\",\r\n doOnlyRetail:\"OnlyRetailPrintProcess\",\r\n doMtRetail:\"MeiTuanPrintProcessBlock\",\r\n doDutyPrint:\"printShiftVoucher\",\r\n doDialyPrint:\"printDailyVoucher\",\r\n doStoragePrint:\"StoragePrintProcessBlock\",\r\n doProjectStoragePrint:\"ProjectStoragePrintProcessBlock\",\r\n doProjectConsumePrint:\"ProjectConsumePrintProcessBlock\"\r\n}\r\n\r\n\r\nexport const printDispatch = (doName,ID,otherParams) => {\r\n return new Promise(async (res) => {\r\n const { IdStore, posCode } = getLoginInfo();\r\n const printEntity = await API.GetPrintInfomation({\r\n Idstore: IdStore,\r\n POSCode: posCode\r\n });\r\n // 开启结算完自动打印小票的选项 只判断是结算小票打印 其他的打印方式继续打印\r\n if (!printEntity.AutoPrintTicket && doName == DoNameList.DO_PRINT) {\r\n return res();\r\n }\r\n // 是否开启打印机\r\n const isOpenPrint = isOldOpen(printEntity.PrintDetailEntitys);\r\n\r\n // 获取打印机开启的类型\r\n let checkedPrintType = getCheckedPrintTypeDefaults()\r\n\r\n if(!isOpenPrint) checkedPrintType = null;\r\n\r\n // 获取云打印参数\r\n const cloudPrintArguments = localStore && localStore.get('cloudPrintArguments');\r\n\r\n let { electronPrint,openCashBox,dto} = otherParams || {};\r\n if(!dto){\r\n dto={};\r\n dto.Idstore = PosInitData('storeID');\r\n dto.POSCode = PosInitData('posCode');\r\n }\r\n\r\n const { isHorizontalSunMi } = platform || {};\r\n if (isOpenPrint && checkedPrintType === \"3\" || !checkedPrintType && !!isHorizontalSunMi) {\r\n // 1.如果未开启打印并且是商米平台 使用自带的打印机 2如果开启打印并且使用飞蛾打印机\r\n if(!!isHorizontalSunMi && openCashBox){\r\n // 开启商米的钱箱\r\n syncOpenCashBox(printEntity) \r\n }\r\n let result = await cloudPrintNoTemplate(doName, ID, cloudPrintArguments || {});\r\n res(result);\r\n } else if (isOpenPrint && (checkedPrintType === \"2\" || checkedPrintType === \"1\")) {\r\n if (env.platform !== env.constant.platform.electron && checkedPrintType === \"1\") {//获取当前是否处于Electron环境中\r\n Message.warn(t('打印小票只能在客户端中执行'))\r\n return res();\r\n }\r\n switch (doName) {\r\n case DoNameList.DO_PRINT:\r\n case DoNameList.DO_MT_RETAIL:\r\n case DoNameList.DO_ONLY_PRINT:\r\n case DoNameList.DO_DUTY_PRINT:\r\n case DoNameList.DO_DIALY_PRINT:\r\n case DoNameList.DO_STORAGE_PRINT:\r\n case DoNameList.DO_PROJECT_STORAGE_PRINT:\r\n case DoNameList.DO_PROJECT_CONSUME_PRINT: {\r\n if (global[DoPrintGlobalFunction[doName]]) {\r\n await global[DoPrintGlobalFunction[doName]].execute(ID,dto, openCashBox);\r\n return res();\r\n } else {\r\n if(!electronPrint){\r\n Message.warn(t('打印小票只能在客户端中执行'))\r\n return res();\r\n }\r\n }\r\n }\r\n }\r\n \r\n if (electronPrint) await electronPrint()\r\n res();\r\n }else {\r\n res();\r\n }\r\n })\r\n}\r\n\r\nconst cloudPrintNoTemplate = (doName,ID,{Open, Key, Sign, Name, Card }) => {\r\n return new Promise((resolve) => {\r\n const printUtil = new PrintUtil();\r\n if(doName === 'doOnlyRetail') doName = 'doPrint';\r\n printUtil[doName]({Open, Key, Sign, Name, Card }, ID, s => {\r\n const { msg, ret } = s;\r\n if (ret === 0) {\r\n Message.success(t(`打印${DoDesName[doName]}小票成功。`))\r\n }else if(ret === -1){\r\n Message.error(t(msg))\r\n } else {\r\n Message.error(t(`打印${DoDesName[doName]}小票失败。`))\r\n }\r\n resolve();\r\n })\r\n })\r\n}\r\n\r\nconst syncOpenCashBox = async(printEntity) =>{\r\n const { CashBoxCmd } = printEntity || {}\r\n return window.sunMi_OperatingCashier && window.sunMi_OperatingCashier.OpenDrawer(CashBoxCmd);\r\n}\r\n\r\nconst getLoginInfo = () => {\r\n return stores.user.options.get('loginInfo');\r\n}\r\n\r\nexport const isOldOpen = (printDetailEntitys) => {\r\n const { isVerticalTouch } = platform || {}\r\n if(isVerticalTouch) return true;\r\n const isOpenPrintValue = localStore && localStore.get('isOpenPrint');\r\n if(isOpenPrintValue !==null){\r\n return isOpenPrintValue === \"true\";\r\n }\r\n const localOrYinMeiOpen = printDetailEntitys && printDetailEntitys.filter((item)=>{\r\n return item.IsEnablePrinter === true\r\n }).length > 0;\r\n const cloudPrintArguments = localStore && localStore.get('cloudPrintArguments');\r\n const { Open:cloudOpen } = cloudPrintArguments || {};\r\n return localOrYinMeiOpen || cloudOpen;\r\n}\r\n\r\nexport const getCheckedPrintTypeDefaults = () => {\r\n const hasElectron = (env.platform === env.constant.platform.electron);\r\n const { isVerticalTouch } = platform || {}\r\n // 打印机选择的类型\r\n let checkedPrintType = localStore && localStore.get('checkedPrintType');\r\n const cloudPrintArguments = localStore && localStore.get('cloudPrintArguments');\r\n if(checkedPrintType === null) {\r\n if(hasElectron || !!isVerticalTouch){\r\n checkedPrintType = '1'\r\n }else {\r\n const { Open } = cloudPrintArguments || {};\r\n if(Open){\r\n checkedPrintType = '3'\r\n }else{\r\n checkedPrintType = '3'\r\n // checkedPrintType = '2' 后续改回这个 放开映美打印机后\r\n }\r\n }\r\n }\r\n return checkedPrintType\r\n}"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tplus-components-touch",
3
- "version": "3.32.4",
3
+ "version": "3.32.5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {