Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { debounce } from 'lodash-es';
- import * as moment from 'moment';
- import Vuex from 'vuex';
- import {
- canCreateCompany,
- conditionCashboxIsValid,
- conditionDaysIsValid,
- conditionDiscountCodeIsValid,
- customerEmailIsValid,
- customerInnIsValid,
- customerOrgIsValid,
- customerPhoneIsValid,
- isIndividualEntrepreneur,
- isLegalEntity,
- recalculate,
- setCanCreate,
- setConditions,
- setCustomer,
- setOrder,
- setPayment,
- setPaymentMethod,
- setPrice,
- setRegisterNewAccountStatus,
- setUser,
- } from './store';
- export interface VendaCartStoreState extends CartStoreState
- {
- newField: boolean;
- }
- export const vendaCartStore = new Vuex.Store<VendaCartStoreState>({
- state,
- mutations: {
- // vendaCartStore
- // new mutations
- // cartStore
- setCanCreate,
- setPrice,
- setConditions,
- setCustomer,
- setPaymentMethod,
- setPayment,
- setOrder,
- setUser,
- setRegisterNewAccountStatus,
- },
- getters: {
- // vendaCartStore
- // new getters
- // cartStore
- canCreateCompany,
- conditionCashboxIsValid,
- conditionDaysIsValid,
- conditionDiscountCodeIsValid,
- customerPhoneIsValid,
- customerEmailIsValid,
- customerInnIsValid,
- customerOrgIsValid,
- isIndividualEntrepreneur,
- isLegalEntity,
- },
- actions: {
- // vendaCartStore
- // new actions
- // cartStore
- recalculate: debounce(recalculate, 100),
- },
- });
- /* region State */
- function state (): VendaCartStoreState {
- return {
- // VendaCartStoreState
- newField: false,
- // CartStoreState
- conditions: {
- cashbox: '1',
- days: '1',
- date: moment().startOf('day').add(1, 'day').format('YYYY-MM-DD'),
- receiptEmail: false,
- discountCode: '',
- },
- customer: {
- email: '',
- inn: '',
- kpp: '',
- ogrn: '',
- orgName: '',
- org: null,
- password: '',
- passwordApp: '',
- },
- paymentMethod: 'CreditCard',
- price: null,
- payment: null,
- order: null,
- user: null,
- canCreate: null,
- registerNewAccountStatus: null,
- };
- }
- /** endregion **/
- /* region Getters */
- /** endregion **/
- /* region Mutations */
- /** endregion **/
- /* region Actions */
- /** endregion **/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement