tplus-pos
Version:
pos module
195 lines (162 loc) • 6.47 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.dataProvider = exports.appMenuKey = undefined;
var _stringify = require('babel-runtime/core-js/json/stringify');
var _stringify2 = _interopRequireDefault(_stringify);
var _regenerator = require('babel-runtime/regenerator');
var _regenerator2 = _interopRequireDefault(_regenerator);
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
var _tplusApi = require('tplus-api');
var _mutantsMicrofx = require('mutants-microfx');
var _fixedViewInfo = require('../fixedViewInfo');
var _modules = require('../modules');
var _modules2 = _interopRequireDefault(_modules);
var _setData = require('../config/setData');
var _setData2 = _interopRequireDefault(_setData);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var appMenuKey = exports.appMenuKey = { sysid: 'RE', mid: 'RE01' };
var reloginErrorCodes = ['EXSM0003', 'EXSM0004', 'EXSM0005'];
var dataProvider = exports.dataProvider = {
getModule: function getModule(_ref) {
var _this = this;
var sysid = _ref.sysid,
mid = _ref.mid;
return (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee() {
var data;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
data = _modules2.default[sysid + '_' + mid];
return _context.abrupt('return', data);
case 2:
case 'end':
return _context.stop();
}
}
}, _callee, _this);
}))();
},
getDataInfo: function getDataInfo(_ref2) {
var _this2 = this;
var sysid = _ref2.sysid,
mid = _ref2.mid;
return (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2() {
var param, data;
return _regenerator2.default.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
param = {
"vouchername": "NewRetail"
};
_context2.prev = 1;
_context2.next = 4;
return (0, _tplusApi.tApi)(param, 'chanjet.RE.INewRetailVoucherService.GetVoucherDataInfo', false, false);
case 4:
data = _context2.sent;
return _context2.abrupt('return', data);
case 8:
_context2.prev = 8;
_context2.t0 = _context2['catch'](1);
if (reloginErrorCodes.some(function (reloginErrorCode) {
return reloginErrorCode === _context2.t0.Code;
})) {
//需要重新登录时 因为dom没有加载 所以监听失效 需要控制路由跳转
//history.replace(`/login?redirect=${history.location.pathname}`);
_mutantsMicrofx.history.replace('/login');
}
case 11:
case 'end':
return _context2.stop();
}
}
}, _callee2, _this2, [[1, 8]]);
}))();
},
getData: function getData(_ref3) {
var _this3 = this;
var sysid = _ref3.sysid,
mid = _ref3.mid,
id = _ref3.id;
return (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3() {
return _regenerator2.default.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
return _context3.abrupt('return', null);
case 1:
case 'end':
return _context3.stop();
}
}
}, _callee3, _this3);
}))();
},
getViewInfo: function getViewInfo(_ref4) {
var _this4 = this;
var sysid = _ref4.sysid,
mid = _ref4.mid;
return (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4() {
var params, returnValue, voucherViewInfo, operations, viewInfoHandle;
return _regenerator2.default.wrap(function _callee4$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
params = {
"vouchername": "NewRetail"
};
returnValue = _this4.getVoucherMode();
params = returnValue == "voucher" ? { "vouchername": "RetailOrder" } : params;
voucherViewInfo = void 0;
_context4.next = 6;
return (0, _tplusApi.tApi)(params, 'chanjet.RE.INewRetailVoucherService.GetVoucherViewInfo', false, false);
case 6:
voucherViewInfo = _context4.sent;
console.log('voucherViewInfo======', (0, _stringify2.default)(voucherViewInfo));
voucherViewInfo = {
VoucherColumns: _fixedViewInfo.voucherColumns,
VoucherDetail: voucherViewInfo.Headers
};
_context4.next = 11;
return (0, _tplusApi.tApi)(params, 'chanjet.RE.INewPos.GetOperations', false, false);
case 11:
operations = _context4.sent;
viewInfoHandle = {
Voucher: voucherViewInfo,
Operations: operations,
TextBoxModal: '',
FreeItemsModal: '',
BatchModal: '',
planInfo: _fixedViewInfo.planInfo,
MemberStore: ''
};
return _context4.abrupt('return', viewInfoHandle);
case 14:
case 'end':
return _context4.stop();
}
}
}, _callee4, _this4);
}))();
},
getVoucherMode: function getVoucherMode() {
/* 获取开单模式:touch、voucher */
var data = _mutantsMicrofx.localStore.get("setting_setData") || [];
var configure = {};
if (Array.isArray(data)) {
//接口数据为数组
configure = _setData2.default.getVoucherDefaultPosMode(data);
}
var returnValue = null;
if (configure && configure.default) {
returnValue = configure.default;
}
if (returnValue) _mutantsMicrofx.localStore && _mutantsMicrofx.localStore.set('voucherDefaultPosMode', returnValue);
return returnValue;
}
};
//# sourceMappingURL=index.js.map