UNPKG

tplus-pos

Version:

pos module

308 lines (242 loc) 9.46 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _defineProperty = require('babel-runtime/core-js/object/define-property'); var _defineProperty2 = _interopRequireDefault(_defineProperty); var _regenerator = require('babel-runtime/regenerator'); var _regenerator2 = _interopRequireDefault(_regenerator); var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator'); var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2); var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of'); var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn'); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _createClass2 = require('babel-runtime/helpers/createClass'); var _createClass3 = _interopRequireDefault(_createClass2); var _inherits2 = require('babel-runtime/helpers/inherits'); var _inherits3 = _interopRequireDefault(_inherits2); var _desc, _value, _class, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11, _descriptor12, _descriptor13, _descriptor14; var _mobx = require('mobx'); var _mutantsAppfx = require('mutants-appfx'); var _tplusComponentsTouch = require('tplus-components-touch'); var _GuideApi = require('../api/GuideApi'); var _GuideApi2 = _interopRequireDefault(_GuideApi); 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 GuideModal = (_class = function (_ViewBase) { (0, _inherits3.default)(GuideModal, _ViewBase); (0, _createClass3.default)(GuideModal, [{ key: 'type', get: function get() { return 'GuideModal'; } //模糊查询的导购员 //选中的导购员 }]); function GuideModal(store, name) { (0, _classCallCheck3.default)(this, GuideModal); var _this = (0, _possibleConstructorReturn3.default)(this, (GuideModal.__proto__ || (0, _getPrototypeOf2.default)(GuideModal)).call(this, store, name)); _initDefineProp(_this, 'checkStatus', _descriptor, _this); _initDefineProp(_this, 'visible', _descriptor2, _this); _initDefineProp(_this, 'guides', _descriptor3, _this); _initDefineProp(_this, 'guide', _descriptor4, _this); _initDefineProp(_this, 'choice', _descriptor5, _this); _initDefineProp(_this, 'show', _descriptor6, _this); _initDefineProp(_this, 'hide', _descriptor7, _this); _initDefineProp(_this, 'cancel', _descriptor8, _this); _initDefineProp(_this, 'searchGuide', _descriptor9, _this); _initDefineProp(_this, 'setChoice', _descriptor10, _this); _initDefineProp(_this, 'setGuide', _descriptor11, _this); _initDefineProp(_this, 'reset', _descriptor12, _this); _initDefineProp(_this, 'ok', _descriptor13, _this); _initDefineProp(_this, 'setCheckStatus', _descriptor14, _this); return _this; } (0, _createClass3.default)(GuideModal, null, [{ key: 'fromJS', value: function fromJS(store) { return new GuideModal(store, 'GuideModal'); } }]); return GuideModal; }(_mutantsAppfx.ViewBase), (_descriptor = _applyDecoratedDescriptor(_class.prototype, 'checkStatus', [_mobx.observable], { enumerable: true, initializer: function initializer() { return false; } }), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, 'visible', [_mobx.observable], { enumerable: true, initializer: function initializer() { return false; } }), _descriptor3 = _applyDecoratedDescriptor(_class.prototype, 'guides', [_mobx.observable], { enumerable: true, initializer: function initializer() { return []; } }), _descriptor4 = _applyDecoratedDescriptor(_class.prototype, 'guide', [_mobx.observable], { enumerable: true, initializer: function initializer() { return {}; } }), _descriptor5 = _applyDecoratedDescriptor(_class.prototype, 'choice', [_mobx.observable], { enumerable: true, initializer: function initializer() { return 'all'; } }), _descriptor6 = _applyDecoratedDescriptor(_class.prototype, 'show', [_mobx.action], { enumerable: true, initializer: function initializer() { var _this2 = this; return function (result, choice) { _this2.result = result; if (choice) { _this2.choice = choice; } _this2.visible = true; }; } }), _descriptor7 = _applyDecoratedDescriptor(_class.prototype, 'hide', [_mobx.action], { enumerable: true, initializer: function initializer() { var _this3 = this; return function () { _this3.visible = false; }; } }), _descriptor8 = _applyDecoratedDescriptor(_class.prototype, 'cancel', [_mobx.action], { enumerable: true, initializer: function initializer() { var _this4 = this; return function () { _this4.result({}); _this4.reset(); _this4.hide(); }; } }), _descriptor9 = _applyDecoratedDescriptor(_class.prototype, 'searchGuide', [_mobx.action], { enumerable: true, initializer: function initializer() { var _this5 = this; return function () { var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(keyword, other) { var repsonse; return _regenerator2.default.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: _context.next = 2; return _GuideApi2.default.getGuides(keyword, other); case 2: repsonse = _context.sent; (0, _mobx.runInAction)(function () { var data = repsonse && repsonse.Data; _this5.guides = data || []; if (data && data.length > 0) { _this5.guide = data[0]; } else { _this5.guide = ''; } }); case 4: case 'end': return _context.stop(); } } }, _callee, _this5); })); return function (_x, _x2) { return _ref.apply(this, arguments); }; }(); } }), _descriptor10 = _applyDecoratedDescriptor(_class.prototype, 'setChoice', [_mobx.action], { enumerable: true, initializer: function initializer() { var _this6 = this; return function (choice) { _this6.choice = choice; }; } }), _descriptor11 = _applyDecoratedDescriptor(_class.prototype, 'setGuide', [_mobx.action], { enumerable: true, initializer: function initializer() { var _this7 = this; return function (guide) { _this7.guide = guide; }; } }), _descriptor12 = _applyDecoratedDescriptor(_class.prototype, 'reset', [_mobx.action], { enumerable: true, initializer: function initializer() { var _this8 = this; return function () { _this8.choice = 'all'; _this8.guides = []; _this8.guide = ''; _this8.checkStatus = false; }; } }), _descriptor13 = _applyDecoratedDescriptor(_class.prototype, 'ok', [_mobx.action], { enumerable: true, initializer: function initializer() { var _this9 = this; return function () { var guide = (0, _mobx.toJS)(_this9.guide); var choice = (0, _mobx.toJS)(_this9.choice); if (!guide.ID) { _tplusComponentsTouch.Message.warn('请选择一个导购员!'); return; } _this9.result({ guide: guide, choice: choice }); _this9.reset(); _this9.hide(); }; } }), _descriptor14 = _applyDecoratedDescriptor(_class.prototype, 'setCheckStatus', [_mobx.action], { enumerable: true, initializer: function initializer() { var _this10 = this; return function (status) { _this10.checkStatus = status; }; } })), _class); exports.default = GuideModal; //# sourceMappingURL=GuideModal.js.map