UNPKG

tplus-pos

Version:

pos module

177 lines (137 loc) 5.74 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _defineProperty = require('babel-runtime/core-js/object/define-property'); var _defineProperty2 = _interopRequireDefault(_defineProperty); var _getOwnPropertyDescriptor = require('babel-runtime/core-js/object/get-own-property-descriptor'); var _getOwnPropertyDescriptor2 = _interopRequireDefault(_getOwnPropertyDescriptor); var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = require('babel-runtime/helpers/createClass'); var _createClass3 = _interopRequireDefault(_createClass2); var _desc, _value, _class, _descriptor; var _mobx = require('mobx'); var _tools = require('../util/tools.js'); var _tools2 = _interopRequireDefault(_tools); var _mutantsMicrofx = require('mutants-microfx'); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _initDefineProp(target, property, descriptor, context) { if (!descriptor) return; (0, _defineProperty2.default)(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object['ke' + 'ys'](descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object['define' + 'Property'](target, property, desc); desc = null; } return desc; } function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.'); } var modeSets = ['formal', 'practice']; /** * @scaleStates ‘0‘:成功 '1':'在web中' ‘2’:没有进行电子秤配置 ‘3’:'打开电子秤失败' */ var scaleStates = ['0', '1', '2', '3']; /** * @guestShowStates ‘0‘:成功 '1':'在web中' ‘2’:没有进行客显配置 ‘3’:'打开客显失败' */ var guestShowStates = ['0', '1', '2', '3']; var Store = (_class = function () { /* 电子秤状态 */ /* 购物车抛物线相关 */ function Store() { (0, _classCallCheck3.default)(this, Store); _initDefineProp(this, 'mode', _descriptor, this); this.scaleState = '0'; this.guestShowState = '0'; } /* 客显状态 */ (0, _createClass3.default)(Store, [{ key: 'init', value: function init() { var search = _tools2.default.getSearch(_mutantsMicrofx.history.location.search); if (search && search.mode) { this.mode = search.mode; } else { this.mode = 'formal'; } this.stockState = 1; } }, { key: 'changeMode', value: function changeMode(key) { if (!~modeSets.indexOf(key)) return; this.mode = key; } // ===========================================购物车动画========================================== }, { key: 'changeCarPosition', value: function changeCarPosition(_ref) { var x = _ref.x, y = _ref.y; if (isNaN(x) || isNaN(y)) return; this.carPosition = { x: x, y: y }; } }, { key: 'changeInventoryPosition', value: function changeInventoryPosition(_ref2) { var x = _ref2.x, y = _ref2.y; if (isNaN(x) || isNaN(y)) return; this.inventoryPosition = { x: x, y: y }; } }, { key: 'changeEl', value: function changeEl(el) { this.el = el; } // ===========================================电子秤状态========================================== }, { key: 'changeScaleState', value: function changeScaleState(_ref3) { var state = _ref3.state; if (!~scaleStates.indexOf(state)) return; this.scaleState = state; } // ===========================================客显状态========================================== }, { key: 'changeGuestShowState', value: function changeGuestShowState(_ref4) { var state = _ref4.state; if (!~guestShowStates.indexOf(state)) return; this.guestShowState = state; } }]); return Store; }(), (_descriptor = _applyDecoratedDescriptor(_class.prototype, 'mode', [_mobx.observable], { enumerable: true, initializer: function initializer() { return 'formal'; } }), _applyDecoratedDescriptor(_class.prototype, 'init', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class.prototype, 'init'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'changeMode', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class.prototype, 'changeMode'), _class.prototype)), _class); exports.default = new Store(); //# sourceMappingURL=VoucherStateStore.js.map