# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

This is "sale-client-xianyang", a Vue.js 1.x frontend application for a gas utility billing and management system. The project is a complex enterprise application with multiple modules for user management, billing, meter reading, and IoT device management.

## Development Commands

### Starting Development
```bash
# Start development server (runs on http://localhost:8084)
npm run dev

# Start example server
npm run example
```

### Building
```bash
# Production build
npm run build

# Release (includes shell script execution)
npm run release
```

### Testing
```bash
# Run unit tests with Karma
npm run unit

# Run end-to-end tests
npm run e2e

# Lint code
npm run lint
```

## Architecture and Code Organization

### Technology Stack
- **Frontend Framework**: Vue.js 1.x (legacy version)
- **Build System**: Webpack 1.x with custom configuration
- **CSS Framework**: Bootstrap with Less preprocessing
- **HTTP Client**: vue-resource and axios
- **Development Server**: Express with webpack-dev-middleware and hot reload

### Project Structure

#### Core Application Files
- `src/main.js` - Application entry point, initializes Vue and registers clients
- `src/App.vue` - Root application component with routing
- `src/sale.js` - Main module registration and component definitions (800+ lines)

#### Key Directories
- `src/components/` - Main component library organized by business domain:
  - `charge/` - Billing and payment components
  - `revenue/` - Revenue management and reporting
  - `webMeter/` - IoT meter management
  - `UserFiles/` - User account management
  - `FilesManage/` - File and document management
  - `WechatManage/` - WeChat integration components
  - `common/` - Shared utility components

#### Build Configuration
- `build/dev-server.js` - Development server with API proxy configuration
- `build/webpack.base.conf.js` - Base webpack configuration
- Development server proxies API requests to `http://192.168.150.128:8300`

### Component Architecture

The application uses Vue 1.x with asynchronous component loading for performance. Components are registered dynamically in `src/sale.js` using `Vue.component()` with `require()` callbacks.

Key architectural patterns:
- **Plugin System**: Services are registered as Vue plugins (`plugins/` directory)
- **Async Components**: Heavy components are loaded on-demand
- **Modular Organization**: Components grouped by business domain
- **Service Layer**: Separate service classes for API communication

### API Integration

The application communicates with a Java backend through REST APIs:
- Base server: `http://192.168.150.128:8300`
- API endpoints prefixed with `/rs/`
- Separate endpoints for different services (logic, SQL, file operations)

### Key Business Domains

1. **Gas Billing & Charging** (`charge/`, `revenue/`)
   - Card-based and IoT meter billing
   - Payment processing and refunds
   - Invoice management

2. **User Management** (`UserFiles/`, `FilesManage/`)
   - Customer account management
   - Address and device information
   - File archiving and merging

3. **IoT Meter Management** (`webMeter/`)
   - Remote meter reading
   - Device parameter configuration
   - Warning and alert management

4. **WeChat Integration** (`WechatManage/`)
   - WeChat service management
   - Order processing
   - Knowledge base management

## Testing

- **Unit Tests**: Located in `test/unit/specs/`
- **E2E Tests**: Located in `test/e2e/specs/`
- **Test Runner**: Karma with Mocha and Sinon-Chai
- **Coverage**: Istanbul coverage reporting

## Development Notes

### Legacy Dependencies
This project uses older versions of key dependencies:
- Vue.js 1.x (not compatible with modern Vue)
- Webpack 1.x (legacy build system)
- Bootstrap with Less instead of modern CSS frameworks

### Hot Reload
Development server supports hot module replacement for faster development cycles.

### Proxy Configuration
API requests are proxied through the development server to avoid CORS issues. Check `build/dev-server.js` for current proxy settings.

### Component Registration
New components should be registered in `src/sale.js` following the existing async loading pattern.