diff --git a/miniprogram/app.js b/miniprogram/app.js
deleted file mode 100644
index 8025975..0000000
--- a/miniprogram/app.js
+++ /dev/null
@@ -1,29 +0,0 @@
-App({
- globalData: {
- userInfo: null,
- token: null,
- baseUrl: 'http://localhost:8000/api/v1',
- },
-
- onLaunch() {
- const token = wx.getStorageSync('token');
- if (token) {
- this.globalData.token = token;
- }
- },
-
- setToken(token) {
- this.globalData.token = token;
- wx.setStorageSync('token', token);
- },
-
- clearToken() {
- this.globalData.token = null;
- wx.removeStorageSync('token');
- },
-
- getAuthHeader() {
- const token = this.globalData.token;
- return token ? { Authorization: `Bearer ${token}` } : {};
- },
-});
\ No newline at end of file
diff --git a/miniprogram/app.json b/miniprogram/app.json
deleted file mode 100644
index 9bfe6a0..0000000
--- a/miniprogram/app.json
+++ /dev/null
@@ -1,55 +0,0 @@
-{
- "pages": [
- "pages/login/login",
- "pages/index/index",
- "pages/translate/translate",
- "pages/customers/customers",
- "pages/marketing/marketing",
- "pages/quotation/quotation"
- ],
- "window": {
- "backgroundTextStyle": "light",
- "navigationBarBackgroundColor": "#1890ff",
- "navigationBarTitleText": "外贸小助手",
- "navigationBarTextStyle": "white"
- },
- "tabBar": {
- "color": "#666666",
- "selectedColor": "#1890ff",
- "backgroundColor": "#ffffff",
- "borderStyle": "black",
- "list": [
- {
- "pagePath": "pages/index/index",
- "text": "首页",
- "iconPath": "assets/home.png",
- "selectedIconPath": "assets/home-active.png"
- },
- {
- "pagePath": "pages/translate/translate",
- "text": "翻译",
- "iconPath": "assets/translate.png",
- "selectedIconPath": "assets/translate-active.png"
- },
- {
- "pagePath": "pages/customers/customers",
- "text": "客户",
- "iconPath": "assets/customers.png",
- "selectedIconPath": "assets/customers-active.png"
- },
- {
- "pagePath": "pages/marketing/marketing",
- "text": "营销",
- "iconPath": "assets/marketing.png",
- "selectedIconPath": "assets/marketing-active.png"
- },
- {
- "pagePath": "pages/quotation/quotation",
- "text": "报价",
- "iconPath": "assets/quotation.png",
- "selectedIconPath": "assets/quotation-active.png"
- }
- ]
- },
- "sitemapLocation": "sitemap.json"
-}
\ No newline at end of file
diff --git a/miniprogram/app.wxss b/miniprogram/app.wxss
deleted file mode 100644
index 3bd6565..0000000
--- a/miniprogram/app.wxss
+++ /dev/null
@@ -1,102 +0,0 @@
-page {
- background-color: #f5f5f5;
- font-size: 28rpx;
- color: #333;
-}
-
-.container {
- padding: 20rpx;
-}
-
-.btn-primary {
- background-color: #1890ff;
- color: #fff;
- border-radius: 8rpx;
- padding: 20rpx 40rpx;
- font-size: 28rpx;
-}
-
-.btn-primary:active {
- background-color: #40a9ff;
-}
-
-.btn-secondary {
- background-color: #fff;
- color: #1890ff;
- border: 1rpx solid #1890ff;
- border-radius: 8rpx;
- padding: 20rpx 40rpx;
- font-size: 28rpx;
-}
-
-.card {
- background-color: #fff;
- border-radius: 12rpx;
- padding: 30rpx;
- margin-bottom: 20rpx;
- box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
-}
-
-.input-field {
- border: 1rpx solid #d9d9d9;
- border-radius: 8rpx;
- padding: 20rpx;
- font-size: 28rpx;
- width: 100%;
- box-sizing: border-box;
-}
-
-.input-field:focus {
- border-color: #40a9ff;
-}
-
-.section-title {
- font-size: 32rpx;
- font-weight: bold;
- margin-bottom: 20rpx;
- color: #333;
-}
-
-.text-gray {
- color: #999;
-}
-
-.text-primary {
- color: #1890ff;
-}
-
-.text-success {
- color: #52c41a;
-}
-
-.text-warning {
- color: #faad14;
-}
-
-.text-danger {
- color: #ff4d4f;
-}
-
-.flex {
- display: flex;
-}
-
-.flex-center {
- display: flex;
- align-items: center;
- justify-content: center;
-}
-
-.flex-between {
- display: flex;
- align-items: center;
- justify-content: space-between;
-}
-
-.mt-10 { margin-top: 10rpx; }
-.mt-20 { margin-top: 20rpx; }
-.mt-30 { margin-top: 30rpx; }
-.mb-10 { margin-bottom: 10rpx; }
-.mb-20 { margin-bottom: 20rpx; }
-.mb-30 { margin-bottom: 30rpx; }
-.p-20 { padding: 20rpx; }
\ No newline at end of file
diff --git a/miniprogram/pages/customers/customers.js b/miniprogram/pages/customers/customers.js
deleted file mode 100644
index fc03089..0000000
--- a/miniprogram/pages/customers/customers.js
+++ /dev/null
@@ -1,121 +0,0 @@
-const { customerApi } = require('../../utils/api');
-
-Page({
- data: {
- customers: [],
- page: 1,
- hasMore: true,
- loading: false,
- showAddModal: false,
- newCustomer: {
- name: '',
- company: '',
- country: '',
- phone: '',
- whatsapp_id: '',
- email: '',
- },
- },
-
- onLoad() {
- this.loadCustomers();
- },
-
- onReachBottom() {
- if (this.data.hasMore && !this.data.loading) {
- this.setData({ page: this.data.page + 1 });
- this.loadCustomers(true);
- }
- },
-
- async loadCustomers(isAppend = false) {
- if (this.data.loading) return;
-
- this.setData({ loading: true });
- try {
- const result = await customerApi.list(this.data.page);
- this.setData({
- customers: isAppend ? [...this.data.customers, ...result.items] : result.items,
- hasMore: result.items.length >= result.size,
- loading: false,
- });
- } catch (err) {
- wx.showToast({ title: err.message || '加载失败', icon: 'none' });
- this.setData({ loading: false });
- }
- },
-
- showAdd() {
- this.setData({ showAddModal: true });
- },
-
- hideAdd() {
- this.setData({ showAddModal: false });
- },
-
- onInput(e) {
- const field = e.currentTarget.dataset.field;
- const value = e.detail.value;
- this.setData({
- [`newCustomer.${field}`]: value,
- });
- },
-
- async addCustomer() {
- const { newCustomer } = this.data;
- if (!newCustomer.name) {
- wx.showToast({ title: '请输入客户名称', icon: 'none' });
- return;
- }
-
- try {
- await customerApi.create(newCustomer);
- wx.showToast({ title: '添加成功', icon: 'success' });
- this.hideAdd();
- this.setData({ page: 1, customers: [] });
- this.loadCustomers();
- } catch (err) {
- wx.showToast({ title: err.message || '添加失败', icon: 'none' });
- }
- },
-
- async deleteCustomer(e) {
- const id = e.currentTarget.dataset.id;
- wx.showModal({
- title: '确认删除',
- content: '确定要删除该客户吗?',
- success: async (res) => {
- if (res.confirm) {
- try {
- await customerApi.delete(id);
- wx.showToast({ title: '已删除', icon: 'success' });
- this.setData({ page: 1, customers: [] });
- this.loadCustomers();
- } catch (err) {
- wx.showToast({ title: '删除失败', icon: 'none' });
- }
- }
- },
- });
- },
-
- viewDetail(e) {
- const id = e.currentTarget.dataset.id;
- wx.navigateTo({ url: `/pages/customers/detail?id=${id}` });
- },
-
- getStatusClass(status) {
- const map = {
- lead: 'text-primary',
- negotiating: 'text-warning',
- closed: 'text-success',
- };
- return map[status] || '';
- },
-
- onPullDownRefresh() {
- this.setData({ page: 1, customers: [] });
- this.loadCustomers();
- wx.stopPullDownRefresh();
- },
-});
\ No newline at end of file
diff --git a/miniprogram/pages/customers/customers.json b/miniprogram/pages/customers/customers.json
deleted file mode 100644
index 314ec7a..0000000
--- a/miniprogram/pages/customers/customers.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "navigationBarTitleText": "客户管理",
- "enablePullDownRefresh": true,
- "usingComponents": {}
-}
\ No newline at end of file
diff --git a/miniprogram/pages/customers/customers.wxml b/miniprogram/pages/customers/customers.wxml
deleted file mode 100644
index 2d7acbc..0000000
--- a/miniprogram/pages/customers/customers.wxml
+++ /dev/null
@@ -1,68 +0,0 @@
-
-
-
-
-
-
- {{item.name}}
-
- {{item.company}} {{item.country ? '· ' + item.country : ''}}
-
-
- 最后联系: {{item.last_contact_at}}
-
-
-
- {{item.status === 'lead' ? '潜在' : item.status === 'negotiating' ? '谈判中' : '已成交'}}
-
-
-
-
- 暂无客户,点击上方添加
-
-
-
-
-
- 添加客户
-
-
- 姓名 *
-
-
-
-
- 公司
-
-
-
-
- 国家
-
-
-
-
- 电话
-
-
-
-
- WhatsApp
-
-
-
-
- 邮箱
-
-
-
-
- 取消
- 确定
-
-
-
-
\ No newline at end of file
diff --git a/miniprogram/pages/customers/customers.wxss b/miniprogram/pages/customers/customers.wxss
deleted file mode 100644
index 1f2c078..0000000
--- a/miniprogram/pages/customers/customers.wxss
+++ /dev/null
@@ -1,160 +0,0 @@
-.header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 30rpx;
- background: #fff;
-}
-
-.add-btn {
- background: #1890ff;
- color: #fff;
- font-size: 28rpx;
- padding: 15rpx 30rpx;
- border-radius: 8rpx;
-}
-
-.customer-list {
- padding: 0 30rpx;
-}
-
-.customer-item {
- background: #fff;
- border-radius: 12rpx;
- padding: 30rpx;
- margin-bottom: 20rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
-}
-
-.customer-info {
- flex: 1;
-}
-
-.customer-name {
- font-size: 30rpx;
- font-weight: bold;
- color: #333;
- margin-bottom: 8rpx;
-}
-
-.customer-meta {
- font-size: 24rpx;
- color: #999;
-}
-
-.customer-status {
- padding: 6rpx 16rpx;
- border-radius: 20rpx;
- font-size: 22rpx;
-}
-
-.status-lead {
- background: #e6f7ff;
- color: #1890ff;
-}
-
-.status-negotiating {
- background: #fffbe6;
- color: #faad14;
-}
-
-.status-closed {
- background: #f6ffed;
- color: #52c41a;
-}
-
-.customer-actions {
- display: flex;
- gap: 20rpx;
-}
-
-.action-btn {
- font-size: 24rpx;
- color: #999;
- padding: 10rpx;
-}
-
-.delete-btn {
- color: #ff4d4f;
-}
-
-.empty {
- text-align: center;
- padding: 100rpx;
- color: #999;
-}
-
-.modal {
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background: rgba(0, 0, 0, 0.5);
- display: flex;
- align-items: center;
- justify-content: center;
- z-index: 100;
-}
-
-.modal-content {
- background: #fff;
- border-radius: 12rpx;
- padding: 40rpx;
- width: 80%;
- max-height: 80vh;
- overflow-y: auto;
-}
-
-.modal-title {
- font-size: 32rpx;
- font-weight: bold;
- margin-bottom: 30rpx;
- text-align: center;
-}
-
-.form-group {
- margin-bottom: 20rpx;
-}
-
-.form-label {
- font-size: 26rpx;
- color: #666;
- margin-bottom: 10rpx;
- display: block;
-}
-
-.form-input {
- border: 1rpx solid #d9d9d9;
- border-radius: 8rpx;
- padding: 20rpx;
- font-size: 28rpx;
- width: 100%;
- box-sizing: border-box;
-}
-
-.modal-btns {
- display: flex;
- gap: 20rpx;
- margin-top: 30rpx;
-}
-
-.modal-btn {
- flex: 1;
- padding: 20rpx;
- border-radius: 8rpx;
- text-align: center;
- font-size: 28rpx;
-}
-
-.btn-cancel {
- background: #f5f5f5;
- color: #666;
-}
-
-.btn-confirm {
- background: #1890ff;
- color: #fff;
-}
\ No newline at end of file
diff --git a/miniprogram/pages/index/index.js b/miniprogram/pages/index/index.js
deleted file mode 100644
index 7824ba5..0000000
--- a/miniprogram/pages/index/index.js
+++ /dev/null
@@ -1,80 +0,0 @@
-const app = getApp();
-const { authApi, customerApi, translateApi } = require('../../utils/api');
-
-Page({
- data: {
- userInfo: null,
- stats: {
- customers: 0,
- silentCustomers: 0,
- todayTranslations: 0,
- quotations: 0,
- },
- silentCustomers: [],
- loading: true,
- },
-
- onLoad() {
- this.loadData();
- },
-
- onShow() {
- const token = app.globalData.token;
- if (!token) {
- wx.redirectTo({ url: '/pages/login/login' });
- } else {
- this.loadData();
- }
- },
-
- async loadData() {
- try {
- const userInfo = await authApi.getUserInfo();
- const silentData = await customerApi.getSilent(3);
-
- this.setData({
- userInfo,
- stats: {
- customers: silentData.count + Math.floor(Math.random() * 10),
- silentCustomers: silentData.count,
- todayTranslations: Math.floor(Math.random() * 20),
- quotations: Math.floor(Math.random() * 5),
- },
- silentCustomers: silentData.customers.slice(0, 5),
- loading: false,
- });
- } catch (err) {
- console.error('Failed to load data:', err);
- this.setData({ loading: false });
- }
- },
-
- goToTranslate() {
- wx.switchTab({ url: '/pages/translate/translate' });
- },
-
- goToCustomers() {
- wx.switchTab({ url: '/pages/customers/customers' });
- },
-
- goToMarketing() {
- wx.switchTab({ url: '/pages/marketing/marketing' });
- },
-
- goToQuotation() {
- wx.switchTab({ url: '/pages/quotation/quotation' });
- },
-
- onLogout() {
- wx.showModal({
- title: '确认退出',
- content: '确定要退出登录吗?',
- success: (res) => {
- if (res.confirm) {
- app.clearToken();
- wx.redirectTo({ url: '/pages/login/login' });
- }
- },
- });
- },
-});
\ No newline at end of file
diff --git a/miniprogram/pages/index/index.json b/miniprogram/pages/index/index.json
deleted file mode 100644
index ab888fc..0000000
--- a/miniprogram/pages/index/index.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "navigationBarTitleText": "外贸小助手",
- "usingComponents": {}
-}
\ No newline at end of file
diff --git a/miniprogram/pages/index/index.wxml b/miniprogram/pages/index/index.wxml
deleted file mode 100644
index d996197..0000000
--- a/miniprogram/pages/index/index.wxml
+++ /dev/null
@@ -1,61 +0,0 @@
-
-
-
-
-
- {{stats.customers}}
- 客户数
-
-
- {{stats.silentCustomers}}
- 待跟进
-
-
- {{stats.todayTranslations}}
- 今日翻译
-
-
- {{stats.quotations}}
- 报价单
-
-
-
-
-
-
- 待跟进客户
-
-
- {{item.name}}
- 沉默 {{item.silence_days}} 天
-
-
-
-
-
-
\ No newline at end of file
diff --git a/miniprogram/pages/index/index.wxss b/miniprogram/pages/index/index.wxss
deleted file mode 100644
index c9591f6..0000000
--- a/miniprogram/pages/index/index.wxss
+++ /dev/null
@@ -1,142 +0,0 @@
-.header {
- background: linear-gradient(135deg, #1890ff, #40a9ff);
- padding: 40rpx 30rpx;
- color: #fff;
-}
-
-.user-info {
- display: flex;
- align-items: center;
-}
-
-.avatar {
- width: 100rpx;
- height: 100rpx;
- border-radius: 50%;
- background-color: rgba(255, 255, 255, 0.3);
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 48rpx;
- margin-right: 20rpx;
-}
-
-.user-detail {
- flex: 1;
-}
-
-.username {
- font-size: 36rpx;
- font-weight: bold;
- margin-bottom: 8rpx;
-}
-
-.tier-badge {
- font-size: 24rpx;
- background: rgba(255, 255, 255, 0.2);
- padding: 4rpx 16rpx;
- border-radius: 20rpx;
-}
-
-.stats-grid {
- display: flex;
- flex-wrap: wrap;
- padding: 30rpx;
- background: #fff;
- margin: -30rpx 30rpx 30rpx;
- border-radius: 12rpx;
- box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
-}
-
-.stat-item {
- width: 25%;
- text-align: center;
- padding: 20rpx 0;
-}
-
-.stat-value {
- font-size: 40rpx;
- font-weight: bold;
- color: #1890ff;
- display: block;
-}
-
-.stat-label {
- font-size: 24rpx;
- color: #999;
- margin-top: 8rpx;
-}
-
-.menu-grid {
- display: flex;
- flex-wrap: wrap;
- padding: 0 30rpx;
-}
-
-.menu-item {
- width: 25%;
- padding: 30rpx;
- box-sizing: border-box;
- text-align: center;
-}
-
-.menu-icon {
- width: 80rpx;
- height: 80rpx;
- background: #e6f7ff;
- border-radius: 20rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- margin: 0 auto 10rpx;
- font-size: 40rpx;
-}
-
-.menu-text {
- font-size: 24rpx;
- color: #666;
-}
-
-.section {
- padding: 30rpx;
-}
-
-.section-title {
- font-size: 32rpx;
- font-weight: bold;
- margin-bottom: 20rpx;
-}
-
-.silent-list {
- background: #fff;
- border-radius: 12rpx;
-}
-
-.silent-item {
- padding: 30rpx;
- border-bottom: 1rpx solid #f0f0f0;
- display: flex;
- justify-content: space-between;
- align-items: center;
-}
-
-.silent-item:last-child {
- border-bottom: none;
-}
-
-.customer-name {
- font-size: 28rpx;
- color: #333;
-}
-
-.silence-days {
- font-size: 24rpx;
- color: #ff4d4f;
-}
-
-.logout-btn {
- margin: 40rpx 30rpx;
- background: #fff;
- color: #ff4d4f;
- border: 1rpx solid #ff4d4f;
-}
\ No newline at end of file
diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js
deleted file mode 100644
index 2fabcc9..0000000
--- a/miniprogram/pages/login/login.js
+++ /dev/null
@@ -1,81 +0,0 @@
-const app = getApp();
-const { authApi } = require('../../utils/api');
-
-Page({
- data: {
- phone: '',
- password: '',
- username: '',
- isRegister: false,
- loading: false,
- error: '',
- },
-
- onPhoneInput(e) {
- this.setData({ phone: e.detail.value });
- },
-
- onPasswordInput(e) {
- this.setData({ password: e.detail.value });
- },
-
- onUsernameInput(e) {
- this.setData({ username: e.detail.value });
- },
-
- toggleMode() {
- this.setData({
- isRegister: !this.data.isRegister,
- error: '',
- });
- },
-
- async handleSubmit() {
- const { phone, password, username, isRegister } = this.data;
-
- if (!phone || !password) {
- this.setData({ error: '请输入手机号和密码' });
- return;
- }
-
- if (isRegister && !username) {
- this.setData({ error: '请输入用户名' });
- return;
- }
-
- this.setData({ loading: true, error: '' });
-
- try {
- if (isRegister) {
- await authApi.register(phone, password, username);
- wx.showToast({ title: '注册成功,请登录', icon: 'success' });
- this.setData({ isRegister: false });
- } else {
- const res = await authApi.login(phone, password);
- app.setToken(res.access_token);
- app.globalData.userInfo = res.user;
- wx.showToast({ title: '登录成功', icon: 'success' });
- setTimeout(() => {
- wx.switchTab({ url: '/pages/index/index' });
- }, 1000);
- }
- } catch (err) {
- this.setData({ error: err.message || '操作失败,请重试' });
- } finally {
- this.setData({ loading: false });
- }
- },
-
- handleWechatLogin() {
- wx.getUserProfile({
- desc: '用于完善用户资料',
- success: (res) => {
- console.log('微信登录', res.userInfo);
- wx.showToast({ title: '微信登录开发中', icon: 'none' });
- },
- fail: (err) => {
- console.log('微信登录失败', err);
- }
- });
- },
-});
\ No newline at end of file
diff --git a/miniprogram/pages/login/login.json b/miniprogram/pages/login/login.json
deleted file mode 100644
index 3e94c7f..0000000
--- a/miniprogram/pages/login/login.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "navigationBarTitleText": "登录",
- "navigationStyle": "custom"
-}
\ No newline at end of file
diff --git a/miniprogram/pages/login/login.wxml b/miniprogram/pages/login/login.wxml
deleted file mode 100644
index 8d399d5..0000000
--- a/miniprogram/pages/login/login.wxml
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
- TradeMate
- 外贸小助手
-
-
-
- {{isRegister ? '注册' : '登录'}}
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{error}}
-
-
-
-
- {{isRegister ? '已有账号?立即登录' : '没有账号?立即注册'}}
-
-
-
-
- 或
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/miniprogram/pages/login/login.wxss b/miniprogram/pages/login/login.wxss
deleted file mode 100644
index 2f5e845..0000000
--- a/miniprogram/pages/login/login.wxss
+++ /dev/null
@@ -1,142 +0,0 @@
-.container {
- min-height: 100vh;
- background: linear-gradient(180deg, #1890ff 0%, #e6f7ff 100%);
- padding: 120rpx 60rpx 60rpx;
- box-sizing: border-box;
-}
-
-.logo-section {
- text-align: center;
- margin-bottom: 80rpx;
-}
-
-.logo {
- font-size: 60rpx;
- font-weight: bold;
- color: #fff;
- letter-spacing: 4rpx;
-}
-
-.subtitle {
- font-size: 28rpx;
- color: rgba(255, 255, 255, 0.8);
- margin-top: 16rpx;
-}
-
-.form-section {
- background: #fff;
- border-radius: 24rpx;
- padding: 48rpx 40rpx;
- box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.1);
-}
-
-.form-title {
- font-size: 40rpx;
- font-weight: 600;
- color: #333;
- text-align: center;
- margin-bottom: 48rpx;
-}
-
-.input-group {
- margin-bottom: 32rpx;
-}
-
-.input {
- width: 100%;
- height: 96rpx;
- background: #f5f5f5;
- border-radius: 16rpx;
- padding: 0 24rpx;
- font-size: 28rpx;
- box-sizing: border-box;
-}
-
-.input:focus {
- background: #e6f7ff;
- border: 2rpx solid #1890ff;
-}
-
-.error {
- color: #ff4d4f;
- font-size: 24rpx;
- margin-bottom: 24rpx;
- text-align: center;
-}
-
-.submit-btn {
- width: 100%;
- height: 96rpx;
- background: #1890ff;
- color: #fff;
- border-radius: 16rpx;
- font-size: 32rpx;
- font-weight: 500;
- display: flex;
- align-items: center;
- justify-content: center;
- border: none;
-}
-
-.submit-btn[disabled] {
- background: #a0cfff;
-}
-
-.toggle-mode {
- text-align: center;
- margin-top: 32rpx;
- color: #666;
- font-size: 26rpx;
-}
-
-.divider {
- display: flex;
- align-items: center;
- margin: 48rpx 0;
-}
-
-.divider .line {
- flex: 1;
- height: 1rpx;
- background: #e8e8e8;
-}
-
-.divider .text {
- padding: 0 24rpx;
- color: #999;
- font-size: 24rpx;
-}
-
-.wechat-btn {
- width: 100%;
- height: 96rpx;
- background: #07c160;
- color: #fff;
- border-radius: 16rpx;
- font-size: 32rpx;
- font-weight: 500;
- display: flex;
- align-items: center;
- justify-content: center;
- border: none;
-}
-
-.wechat-icon {
- font-size: 36rpx;
- font-weight: bold;
- margin-right: 16rpx;
-}
-
-.footer {
- text-align: center;
- margin-top: 60rpx;
- font-size: 24rpx;
-}
-
-.agreement {
- color: #999;
-}
-
-.link {
- color: #1890ff;
-}
\ No newline at end of file
diff --git a/miniprogram/pages/marketing/marketing.js b/miniprogram/pages/marketing/marketing.js
deleted file mode 100644
index c7f415b..0000000
--- a/miniprogram/pages/marketing/marketing.js
+++ /dev/null
@@ -1,95 +0,0 @@
-const { marketingApi } = require('../../utils/api');
-
-Page({
- data: {
- productName: '',
- description: '',
- category: '',
- target: 'US importers',
- style: 'professional',
- results: [],
- keywords: [],
- loading: false,
- activeTab: 'generate',
- },
-
- onLoad() {},
-
- switchTab(e) {
- const tab = e.currentTarget.dataset.tab;
- this.setData({ activeTab: tab });
- },
-
- onInput(e) {
- const field = e.currentTarget.dataset.field;
- this.setData({ [field]: e.detail.value });
- },
-
- onTargetChange(e) {
- this.setData({ target: e.detail.value });
- },
-
- onStyleChange(e) {
- this.setData({ style: e.detail.value });
- },
-
- async generateContent() {
- const { productName, description, target, style } = this.data;
- if (!productName || !description) {
- wx.showToast({ title: '请填写产品信息', icon: 'none' });
- return;
- }
-
- this.setData({ loading: true });
- try {
- const result = await marketingApi.generate(productName, description, this.data.category, target, style);
- this.setData({
- results: result.results.filter(r => r.content),
- loading: false,
- });
- } catch (err) {
- wx.showToast({ title: err.message || '生成失败', icon: 'none' });
- this.setData({ loading: false });
- }
- },
-
- async generateKeywords() {
- const { productName, description } = this.data;
- if (!productName || !description) {
- wx.showToast({ title: '请填写产品信息', icon: 'none' });
- return;
- }
-
- this.setData({ loading: true });
- try {
- const result = await marketingApi.getKeywords(productName, description, this.data.category);
- this.setData({
- keywords: result.keywords,
- loading: false,
- });
- } catch (err) {
- wx.showToast({ title: err.message || '生成失败', icon: 'none' });
- this.setData({ loading: false });
- }
- },
-
- copyText(e) {
- const text = e.currentTarget.dataset.text;
- wx.setClipboardData({
- data: text,
- success: () => {
- wx.showToast({ title: '已复制', icon: 'success' });
- },
- });
- },
-
- clear() {
- this.setData({
- productName: '',
- description: '',
- category: '',
- results: [],
- keywords: [],
- });
- },
-});
\ No newline at end of file
diff --git a/miniprogram/pages/marketing/marketing.json b/miniprogram/pages/marketing/marketing.json
deleted file mode 100644
index a987e51..0000000
--- a/miniprogram/pages/marketing/marketing.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "navigationBarTitleText": "营销素材",
- "usingComponents": {}
-}
\ No newline at end of file
diff --git a/miniprogram/pages/marketing/marketing.wxml b/miniprogram/pages/marketing/marketing.wxml
deleted file mode 100644
index 48fa968..0000000
--- a/miniprogram/pages/marketing/marketing.wxml
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
- 生成文案
- 关键词
-
-
-
-
- 产品名称 *
-
-
-
-
- 产品描述 *
-
-
-
-
- 产品类别
-
-
-
-
-
- 目标市场
-
-
-
- 风格
-
-
-
-
-
-
-
-
- 生成结果
-
-
- {{item.content}}
-
- 复制文案
-
-
-
-
-
- 关键词建议
-
- {{item}}
-
-
-
\ No newline at end of file
diff --git a/miniprogram/pages/marketing/marketing.wxss b/miniprogram/pages/marketing/marketing.wxss
deleted file mode 100644
index 2372983..0000000
--- a/miniprogram/pages/marketing/marketing.wxss
+++ /dev/null
@@ -1,123 +0,0 @@
-.tabs {
- display: flex;
- background: #fff;
- padding: 20rpx;
-}
-
-.tab {
- flex: 1;
- text-align: center;
- padding: 20rpx;
- font-size: 28rpx;
- color: #666;
- border-bottom: 4rpx solid transparent;
-}
-
-.tab.active {
- color: #1890ff;
- border-bottom-color: #1890ff;
- font-weight: bold;
-}
-
-.form-section {
- padding: 30rpx;
-}
-
-.form-group {
- margin-bottom: 20rpx;
-}
-
-.form-label {
- font-size: 26rpx;
- color: #666;
- margin-bottom: 10rpx;
- display: block;
-}
-
-.form-input {
- border: 1rpx solid #d9d9d9;
- border-radius: 8rpx;
- padding: 20rpx;
- font-size: 28rpx;
- width: 100%;
- box-sizing: border-box;
-}
-
-.form-textarea {
- min-height: 150rpx;
-}
-
-.select-row {
- display: flex;
- gap: 20rpx;
-}
-
-.select-group {
- flex: 1;
-}
-
-.btn-generate {
- background: #1890ff;
- color: #fff;
- margin: 0 30rpx 30rpx;
-}
-
-.results {
- padding: 0 30rpx 30rpx;
-}
-
-.result-item {
- background: #fff;
- border-radius: 12rpx;
- padding: 30rpx;
- margin-bottom: 20rpx;
-}
-
-.result-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 15rpx;
-}
-
-.result-style {
- font-size: 24rpx;
- color: #1890ff;
- font-weight: bold;
-}
-
-.result-provider {
- font-size: 22rpx;
- color: #999;
-}
-
-.result-content {
- font-size: 28rpx;
- line-height: 1.6;
- color: #333;
- white-space: pre-wrap;
-}
-
-.copy-btn {
- color: #1890ff;
- font-size: 24rpx;
- padding: 10rpx 0;
-}
-
-.keywords-section {
- padding: 30rpx;
-}
-
-.keyword-list {
- display: flex;
- flex-wrap: wrap;
- gap: 15rpx;
-}
-
-.keyword-tag {
- background: #e6f7ff;
- color: #1890ff;
- padding: 10rpx 20rpx;
- border-radius: 20rpx;
- font-size: 26rpx;
-}
\ No newline at end of file
diff --git a/miniprogram/pages/quotation/quotation.js b/miniprogram/pages/quotation/quotation.js
deleted file mode 100644
index a2db425..0000000
--- a/miniprogram/pages/quotation/quotation.js
+++ /dev/null
@@ -1,155 +0,0 @@
-const { quotationApi, customerApi } = require('../../utils/api');
-
-Page({
- data: {
- quotations: [],
- page: 1,
- hasMore: true,
- loading: false,
- showCreateModal: false,
- customers: [],
- newQuotation: {
- customer_id: '',
- title: '',
- items: [],
- currency: 'USD',
- payment_terms: 'T/T 30% deposit',
- delivery_terms: 'FOB',
- lead_time: '',
- notes: '',
- },
- tempItem: {
- product_name: '',
- quantity: 1,
- unit_price: 0,
- },
- },
-
- onLoad() {
- this.loadQuotations();
- },
-
- onReachBottom() {
- if (this.data.hasMore && !this.data.loading) {
- this.setData({ page: this.data.page + 1 });
- this.loadQuotations(true);
- }
- },
-
- async loadQuotations(isAppend = false) {
- if (this.data.loading) return;
-
- this.setData({ loading: true });
- try {
- const result = await quotationApi.list(this.data.page);
- this.setData({
- quotations: isAppend ? [...this.data.quotations, ...result.items] : result.items,
- hasMore: result.items.length >= result.size,
- loading: false,
- });
- } catch (err) {
- wx.showToast({ title: err.message || '加载失败', icon: 'none' });
- this.setData({ loading: false });
- }
- },
-
- async showCreate() {
- try {
- const customers = await customerApi.list(1, 100);
- this.setData({
- showCreateModal: true,
- customers: customers.items,
- });
- } catch (err) {
- wx.showToast({ title: '加载客户失败', icon: 'none' });
- }
- },
-
- hideCreate() {
- this.setData({
- showCreateModal: false,
- newQuotation: {
- customer_id: '',
- title: '',
- items: [],
- currency: 'USD',
- payment_terms: 'T/T 30% deposit',
- delivery_terms: 'FOB',
- lead_time: '',
- notes: '',
- },
- });
- },
-
- onInput(e) {
- const field = e.currentTarget.dataset.field;
- const value = e.detail.value;
- this.setData({ [`newQuotation.${field}`]: value });
- },
-
- onItemInput(e) {
- const field = e.currentTarget.dataset.field;
- const value = e.detail.value;
- this.setData({ [`tempItem.${field}`]: value });
- },
-
- addItem() {
- const { tempItem, newQuotation } = this.data;
- if (!tempItem.product_name) {
- wx.showToast({ title: '请输入产品名称', icon: 'none' });
- return;
- }
-
- this.setData({
- newQuotation: {
- ...newQuotation,
- items: [...newQuotation.items, { ...tempItem }],
- },
- tempItem: {
- product_name: '',
- quantity: 1,
- unit_price: 0,
- },
- });
- },
-
- removeItem(e) {
- const index = e.currentTarget.dataset.index;
- const { newQuotation } = this.data;
- newQuotation.items.splice(index, 1);
- this.setData({ newQuotation });
- },
-
- async createQuotation() {
- const { newQuotation } = this.data;
- if (!newQuotation.customer_id) {
- wx.showToast({ title: '请选择客户', icon: 'none' });
- return;
- }
- if (newQuotation.items.length === 0) {
- wx.showToast({ title: '请添加产品', icon: 'none' });
- return;
- }
-
- try {
- await quotationApi.create(newQuotation);
- wx.showToast({ title: '创建成功', icon: 'success' });
- this.hideCreate();
- this.setData({ page: 1, quotations: [] });
- this.loadQuotations();
- } catch (err) {
- wx.showToast({ title: err.message || '创建失败', icon: 'none' });
- }
- },
-
- viewDetail(e) {
- const id = e.currentTarget.dataset.id;
- wx.navigateTo({ url: `/pages/quotation/detail?id=${id}` });
- },
-
- onPullDownRefresh() {
- this.setData({ page: 1, quotations: [] });
- this.loadQuotations();
- wx.stopPullDownRefresh();
- },
-});
\ No newline at end of file
diff --git a/miniprogram/pages/quotation/quotation.json b/miniprogram/pages/quotation/quotation.json
deleted file mode 100644
index edeb9b6..0000000
--- a/miniprogram/pages/quotation/quotation.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "navigationBarTitleText": "报价单",
- "enablePullDownRefresh": true,
- "usingComponents": {}
-}
\ No newline at end of file
diff --git a/miniprogram/pages/quotation/quotation.wxml b/miniprogram/pages/quotation/quotation.wxml
deleted file mode 100644
index 3926fe4..0000000
--- a/miniprogram/pages/quotation/quotation.wxml
+++ /dev/null
@@ -1,89 +0,0 @@
-
-
-
-
-
-
-
- 货币: {{item.currency}} ·条款: {{item.delivery_terms}}
-
-
- 合计: ${{item.total || 0}}
-
-
-
-
- 暂无报价单,点击上方创建
-
-
-
-
-
- 新建报价单
-
-
- 客户 *
-
-
- {{customers[customerIndex] ? customers[customerIndex].name : '请选择客户'}}
-
-
-
-
-
- 标题
-
-
-
-
- 产品明细
-
- {{item.product_name}}
- x{{item.quantity}}
- ${{item.unit_price}}
- ×
-
-
-
-
-
-
-
- + 添加产品
-
-
-
- 货币
-
-
-
-
- 付款条款
-
-
-
-
- 交货条款
-
-
-
-
- 交货周期
-
-
-
-
- 取消
- 创建
-
-
-
-
\ No newline at end of file
diff --git a/miniprogram/pages/quotation/quotation.wxss b/miniprogram/pages/quotation/quotation.wxss
deleted file mode 100644
index 876a56b..0000000
--- a/miniprogram/pages/quotation/quotation.wxss
+++ /dev/null
@@ -1,195 +0,0 @@
-.header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 30rpx;
- background: #fff;
-}
-
-.add-btn {
- background: #1890ff;
- color: #fff;
- font-size: 28rpx;
- padding: 15rpx 30rpx;
- border-radius: 8rpx;
-}
-
-.quotation-list {
- padding: 0 30rpx;
-}
-
-.quotation-item {
- background: #fff;
- border-radius: 12rpx;
- padding: 30rpx;
- margin-bottom: 20rpx;
-}
-
-.quotation-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 15rpx;
-}
-
-.quotation-title {
- font-size: 30rpx;
- font-weight: bold;
- color: #333;
-}
-
-.quotation-status {
- padding: 6rpx 16rpx;
- border-radius: 20rpx;
- font-size: 22rpx;
-}
-
-.status-draft {
- background: #f5f5f5;
- color: #666;
-}
-
-.status-sent {
- background: #e6f7ff;
- color: #1890ff;
-}
-
-.status-accepted {
- background: #f6ffed;
- color: #52c41a;
-}
-
-.quotation-info {
- font-size: 24rpx;
- color: #999;
- margin-bottom: 10rpx;
-}
-
-.quotation-total {
- font-size: 32rpx;
- font-weight: bold;
- color: #ff4d4f;
-}
-
-.empty {
- text-align: center;
- padding: 100rpx;
- color: #999;
-}
-
-.modal {
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background: rgba(0, 0, 0, 0.5);
- display: flex;
- align-items: flex-start;
- justify-content: center;
- z-index: 100;
- overflow-y: auto;
- padding-top: 50rpx;
-}
-
-.modal-content {
- background: #fff;
- border-radius: 12rpx;
- padding: 40rpx;
- width: 85%;
- max-height: 90vh;
- overflow-y: auto;
-}
-
-.modal-title {
- font-size: 32rpx;
- font-weight: bold;
- margin-bottom: 30rpx;
- text-align: center;
-}
-
-.form-group {
- margin-bottom: 20rpx;
-}
-
-.form-label {
- font-size: 26rpx;
- color: #666;
- margin-bottom: 10rpx;
- display: block;
-}
-
-.form-input {
- border: 1rpx solid #d9d9d9;
- border-radius: 8rpx;
- padding: 20rpx;
- font-size: 28rpx;
- width: 100%;
- box-sizing: border-box;
-}
-
-.items-section {
- background: #f9f9f9;
- padding: 20rpx;
- border-radius: 8rpx;
- margin-bottom: 20rpx;
-}
-
-.item-row {
- display: flex;
- gap: 10rpx;
- align-items: center;
- margin-bottom: 15rpx;
-}
-
-.item-input {
- flex: 1;
-}
-
-.qty-input {
- width: 100rpx;
-}
-
-.price-input {
- width: 150rpx;
-}
-
-.remove-item {
- color: #ff4d4f;
- font-size: 32rpx;
- padding: 10rpx;
-}
-
-.add-item-btn {
- background: #fff;
- border: 1rpx dashed #1890ff;
- color: #1890ff;
- font-size: 26rpx;
- padding: 15rpx;
- text-align: center;
- border-radius: 8rpx;
-}
-
-.modal-btns {
- display: flex;
- gap: 20rpx;
- margin-top: 30rpx;
-}
-
-.modal-btn {
- flex: 1;
- padding: 20rpx;
- border-radius: 8rpx;
- text-align: center;
- font-size: 28rpx;
-}
-
-.btn-cancel {
- background: #f5f5f5;
- color: #666;
-}
-
-.btn-confirm {
- background: #1890ff;
- color: #fff;
-}
\ No newline at end of file
diff --git a/miniprogram/pages/translate/translate.js b/miniprogram/pages/translate/translate.js
deleted file mode 100644
index f349c0d..0000000
--- a/miniprogram/pages/translate/translate.js
+++ /dev/null
@@ -1,101 +0,0 @@
-const { translateApi } = require('../../utils/api');
-
-Page({
- data: {
- tab: 'translate',
- sourceText: '',
- translatedText: '',
- targetLang: 'en',
- langOptions: [
- { value: 'en', label: 'English' },
- { value: 'zh', label: '中文' },
- { value: 'es', label: 'Español' },
- { value: 'fr', label: 'Français' },
- { value: 'de', label: 'Deutsch' },
- { value: 'ja', label: '日本語' },
- { value: 'pt', label: 'Português' },
- ],
- replyInquiry: '',
- replySuggestions: [],
- loading: false,
- },
-
- onLoad() {},
-
- switchTab(e) {
- const tab = e.currentTarget.dataset.tab;
- this.setData({ tab });
- },
-
- onSourceInput(e) {
- this.setData({ sourceText: e.detail.value });
- },
-
- onReplyInput(e) {
- this.setData({ replyInquiry: e.detail.value });
- },
-
- onLangChange(e) {
- this.setData({ targetLang: e.detail.value });
- },
-
- async doTranslate() {
- if (!this.data.sourceText.trim()) {
- wx.showToast({ title: '请输入要翻译的内容', icon: 'none' });
- return;
- }
-
- this.setData({ loading: true });
- try {
- const result = await translateApi.translate(
- this.data.sourceText,
- this.data.targetLang
- );
- this.setData({
- translatedText: result.translated_text,
- loading: false,
- });
- } catch (err) {
- wx.showToast({ title: err.message || '翻译失败', icon: 'none' });
- this.setData({ loading: false });
- }
- },
-
- async doGetReply() {
- if (!this.data.replyInquiry.trim()) {
- wx.showToast({ title: '请输入客户询盘内容', icon: 'none' });
- return;
- }
-
- this.setData({ loading: true });
- try {
- const result = await translateApi.getReply(this.data.replyInquiry);
- this.setData({
- replySuggestions: result.suggestions,
- loading: false,
- });
- } catch (err) {
- wx.showToast({ title: err.message || '生成回复失败', icon: 'none' });
- this.setData({ loading: false });
- }
- },
-
- copyText(e) {
- const text = e.currentTarget.dataset.text;
- wx.setClipboardData({
- data: text,
- success: () => {
- wx.showToast({ title: '已复制', icon: 'success' });
- },
- });
- },
-
- clearInput() {
- this.setData({
- sourceText: '',
- translatedText: '',
- replyInquiry: '',
- replySuggestions: [],
- });
- },
-});
\ No newline at end of file
diff --git a/miniprogram/pages/translate/translate.json b/miniprogram/pages/translate/translate.json
deleted file mode 100644
index 208d3ad..0000000
--- a/miniprogram/pages/translate/translate.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "navigationBarTitleText": "智能翻译",
- "usingComponents": {}
-}
\ No newline at end of file
diff --git a/miniprogram/pages/translate/translate.wxml b/miniprogram/pages/translate/translate.wxml
deleted file mode 100644
index f91ee57..0000000
--- a/miniprogram/pages/translate/translate.wxml
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
- 翻译
- 回复建议
-
-
-
-
-
- 输入要翻译的内容
-
-
-
-
- 目标语言
-
- {{langOptions[langOptions.findIndex(function(item) { return item.value === targetLang })].label}}
-
-
-
-
-
-
-
- {{translatedText}}
-
-
-
-
-
- 输入客户询盘内容
-
-
-
-
-
-
- 回复建议
-
- {{item.tone}}
- {{item.reply}}
-
- 复制
-
-
-
-
-
-
\ No newline at end of file
diff --git a/miniprogram/pages/translate/translate.wxss b/miniprogram/pages/translate/translate.wxss
deleted file mode 100644
index dc6ae19..0000000
--- a/miniprogram/pages/translate/translate.wxss
+++ /dev/null
@@ -1,114 +0,0 @@
-.tabs {
- display: flex;
- background: #fff;
- padding: 20rpx;
-}
-
-.tab {
- flex: 1;
- text-align: center;
- padding: 20rpx;
- font-size: 28rpx;
- color: #666;
- border-bottom: 4rpx solid transparent;
-}
-
-.tab.active {
- color: #1890ff;
- border-bottom-color: #1890ff;
- font-weight: bold;
-}
-
-.content {
- padding: 30rpx;
-}
-
-.input-area {
- background: #fff;
- border-radius: 12rpx;
- padding: 20rpx;
- margin-bottom: 20rpx;
-}
-
-.input-label {
- font-size: 24rpx;
- color: #999;
- margin-bottom: 10rpx;
- display: block;
-}
-
-.textarea {
- width: 100%;
- min-height: 200rpx;
- font-size: 28rpx;
- line-height: 1.5;
-}
-
-.lang-select {
- display: flex;
- align-items: center;
- justify-content: space-between;
- background: #fff;
- padding: 20rpx;
- border-radius: 12rpx;
- margin-bottom: 20rpx;
-}
-
-.picker {
- color: #1890ff;
- font-weight: bold;
-}
-
-.btn-translate {
- background: #1890ff;
- color: #fff;
- margin-bottom: 20rpx;
-}
-
-.result-area {
- background: #fff;
- border-radius: 12rpx;
- padding: 20rpx;
-}
-
-.result-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 10rpx;
-}
-
-.copy-btn {
- color: #1890ff;
- font-size: 24rpx;
-}
-
-.result-text {
- font-size: 28rpx;
- line-height: 1.6;
- color: #333;
- white-space: pre-wrap;
-}
-
-.suggestions {
- margin-top: 30rpx;
-}
-
-.suggestion-item {
- background: #fff;
- border-radius: 12rpx;
- padding: 20rpx;
- margin-bottom: 20rpx;
-}
-
-.suggestion-tone {
- font-size: 24rpx;
- color: #1890ff;
- margin-bottom: 10rpx;
-}
-
-.suggestion-content {
- font-size: 28rpx;
- line-height: 1.5;
- color: #333;
-}
\ No newline at end of file
diff --git a/miniprogram/project.config.json b/miniprogram/project.config.json
deleted file mode 100644
index 1b4d9c4..0000000
--- a/miniprogram/project.config.json
+++ /dev/null
@@ -1,46 +0,0 @@
-{
- "description": "外贸小助手 - 微信小程序",
- "packOptions": {
- "ignore": []
- },
- "setting": {
- "bundle": false,
- "userConfirmedBundleSwitch": false,
- "urlCheck": true,
- "scopeDataCheck": false,
- "coverView": true,
- "es6": true,
- "postcss": true,
- "compileHotReLoad": false,
- "lazyloadPlaceholderEnable": false,
- "preloadBackgroundData": false,
- "minified": true,
- "autoAudits": false,
- "newFeature": false,
- "uglifyFileName": false,
- "uploadWithSourceMap": true,
- "useIsolateContext": true,
- "nodeModules": false,
- "enhance": true,
- "useMultiFrameRuntime": true,
- "useApiHook": true,
- "useApiHostProcess": true,
- "showShadowRootInWxmlPanel": true,
- "packNpmManually": false,
- "packNpmRelationList": [],
- "minifyWXSS": true,
- "disableUseStrict": false,
- "minifyWXML": true,
- "showES6CompileOption": false,
- "useCompilerPlugins": false
- },
- "compileType": "miniprogram",
- "libVersion": "3.3.4",
- "appid": "wxxxxxxxxxxx",
- "projectname": "trade-assistant",
- "condition": {},
- "editorSetting": {
- "tabIndent": "insertTwoSpaces",
- "tabSize": 2
- }
-}
\ No newline at end of file
diff --git a/miniprogram/sitemap.json b/miniprogram/sitemap.json
deleted file mode 100644
index 37c8c39..0000000
--- a/miniprogram/sitemap.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
- "rules": [
- {
- "action": "allow",
- "page": "*"
- }
- ]
-}
\ No newline at end of file
diff --git a/miniprogram/utils/api.js b/miniprogram/utils/api.js
deleted file mode 100644
index fd374b3..0000000
--- a/miniprogram/utils/api.js
+++ /dev/null
@@ -1,96 +0,0 @@
-const app = getApp();
-
-const request = (url, method = 'GET', data = {}) => {
- return new Promise((resolve, reject) => {
- const header = {
- 'Content-Type': 'application/json',
- ...app.getAuthHeader(),
- };
-
- wx.request({
- url: `${app.globalData.baseUrl}${url}`,
- method,
- data,
- header,
- success: (res) => {
- if (res.statusCode === 200) {
- resolve(res.data);
- } else if (res.statusCode === 401) {
- app.clearToken();
- wx.redirectTo({ url: '/pages/login/login' });
- reject(new Error('Unauthorized'));
- } else {
- reject(new Error(res.data?.detail || 'Request failed'));
- }
- },
- fail: (err) => {
- reject(err);
- },
- });
- });
-};
-
-export const authApi = {
- login: (phone, password) => request('/auth/login', 'POST', { username: phone, password }),
- register: (phone, password, username) => request('/auth/register', 'POST', { phone, password, username }),
- getUserInfo: () => request('/auth/me'),
-};
-
-export const translateApi = {
- translate: (text, targetLang, sourceLang = 'auto') =>
- request('/translate', 'POST', { text, target_lang: targetLang, source_lang: sourceLang }),
- getReply: (inquiry, tone = 'professional', count = 3) =>
- request('/translate/reply', 'POST', { inquiry, tone, count }),
- extract: (text, type = 'auto') =>
- request('/translate/extract', 'POST', { text, extract_type: type }),
-};
-
-export const customerApi = {
- list: (page = 1, size = 20, status) => {
- const params = new URLSearchParams({ page, size });
- if (status) params.append('status', status);
- return request(`/customers?${params.toString()}`);
- },
- get: (id) => request(`/customers/${id}`),
- create: (data) => request('/customers', 'POST', data),
- update: (id, data) => request(`/customers/${id}`, 'PATCH', data),
- delete: (id) => request(`/customers/${id}`, 'DELETE'),
- getSilent: (days = 3) => request(`/customers/silent?days=${days}`),
- getConversation: (id, page = 1, size = 50) =>
- request(`/customers/${id}/conversation?page=${page}&size=${size}`),
-};
-
-export const marketingApi = {
- generate: (productName, description, category, target = 'US importers', style = 'professional') =>
- request('/marketing/generate', 'POST', {
- product_name: productName,
- description,
- category,
- target,
- style,
- }),
- getKeywords: (productName, description, category) =>
- request('/marketing/keywords', 'POST', {
- product_name: productName,
- description,
- category,
- }),
- analyzeCompetitors: (productName, description, category, market = 'US') =>
- request('/marketing/competitor-analysis', 'POST', {
- product_name: productName,
- description,
- category,
- market,
- }),
-};
-
-export const quotationApi = {
- list: (page = 1, size = 20) => request(`/quotations?page=${page}&size=${size}`),
- get: (id) => request(`/quotations/${id}`),
- create: (data) => request('/quotations', 'POST', data),
- updateStatus: (id, status) => request(`/quotations/${id}/status`, 'PATCH', { status }),
-};
-
-export const whatsappApi = {
- send: (to, text) => request('/whatsapp/send', 'POST', { to, text }),
-};
\ No newline at end of file