From 595bfb4171a92df518e4b0e99db068a8055990f1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E9=A3=9E=E6=B4=8B?=
<15778543+xufeiyang6017@user.noreply.gitee.com>
Date: Thu, 5 Feb 2026 15:43:15 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B8=85=E7=90=86=E9=A1=B9=E7=9B=AE=E6=96=87?=
=?UTF-8?q?=E4=BB=B6=EF=BC=8C=E6=9B=B4=E6=96=B0=E9=85=8D=E7=BD=AE=E4=BB=A5?=
=?UTF-8?q?=E5=8C=B9=E9=85=8D=E5=AE=9E=E9=99=85=E6=96=87=E4=BB=B6=E7=B3=BB?=
=?UTF-8?q?=E7=BB=9F=E7=BB=93=E6=9E=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app.json | 33 -
custom-tab-bar/index.js | 2 -
pages/eggbar/create-post.js | 66 -
pages/eggbar/create-post.wxml | 2 -
pages/eggbar/eggbar.js | 66 -
pages/eggbar/eggbar.wxml | 2 -
pages/evaluate/index.js | 314 --
pages/evaluate/index.json | 6 -
pages/evaluate/index.wxml | 159 -
pages/evaluate/index.wxss | 1145 ------
pages/evaluate1/index.js | 292 --
pages/evaluate1/index.json | 4 -
pages/evaluate1/index.wxml | 78 -
pages/evaluate1/index.wxss | 450 ---
pages/evaluate1/product-list.js | 70 -
pages/evaluate1/product-list.json | 4 -
pages/evaluate1/product-list.wxml | 49 -
pages/evaluate1/product-list.wxss | 311 --
pages/evaluate1/spec-detail.js | 76 -
pages/evaluate1/spec-detail.json | 4 -
pages/evaluate1/spec-detail.wxml | 59 -
pages/evaluate1/spec-detail.wxss | 401 ---
pages/notopen/index.js | 82 -
pages/notopen/index.json | 4 -
pages/notopen/index.wxml | 8 -
pages/notopen/index.wxss | 69 -
pages/seller/index.js | 5510 -----------------------------
pages/seller/index.json | 5 -
pages/seller/index.wxml | 934 -----
pages/seller/index.wxss | 1018 ------
30 files changed, 11223 deletions(-)
delete mode 100644 pages/eggbar/create-post.js
delete mode 100644 pages/eggbar/create-post.wxml
delete mode 100644 pages/eggbar/eggbar.js
delete mode 100644 pages/eggbar/eggbar.wxml
delete mode 100644 pages/evaluate/index.js
delete mode 100644 pages/evaluate/index.json
delete mode 100644 pages/evaluate/index.wxml
delete mode 100644 pages/evaluate/index.wxss
delete mode 100644 pages/evaluate1/index.js
delete mode 100644 pages/evaluate1/index.json
delete mode 100644 pages/evaluate1/index.wxml
delete mode 100644 pages/evaluate1/index.wxss
delete mode 100644 pages/evaluate1/product-list.js
delete mode 100644 pages/evaluate1/product-list.json
delete mode 100644 pages/evaluate1/product-list.wxml
delete mode 100644 pages/evaluate1/product-list.wxss
delete mode 100644 pages/evaluate1/spec-detail.js
delete mode 100644 pages/evaluate1/spec-detail.json
delete mode 100644 pages/evaluate1/spec-detail.wxml
delete mode 100644 pages/evaluate1/spec-detail.wxss
delete mode 100644 pages/notopen/index.js
delete mode 100644 pages/notopen/index.json
delete mode 100644 pages/notopen/index.wxml
delete mode 100644 pages/notopen/index.wxss
delete mode 100644 pages/seller/index.js
delete mode 100644 pages/seller/index.json
delete mode 100644 pages/seller/index.wxml
delete mode 100644 pages/seller/index.wxss
diff --git a/app.json b/app.json
index aa30cf6..61214cb 100644
--- a/app.json
+++ b/app.json
@@ -1,24 +1,16 @@
{
"pages": [
"pages/index/index",
- "pages/evaluate/index",
- "pages/evaluate1/index",
- "pages/evaluate1/product-list",
- "pages/evaluate1/spec-detail",
"pages/evaluate2/index",
"pages/evaluate2/one",
"pages/evaluate2/product-list",
"pages/evaluate2/spec-detail",
- "pages/eggbar/eggbar",
- "pages/eggbar/create-post",
"pages/settlement/index",
"pages/publish/index",
"pages/buyer/index",
- "pages/seller/index",
"pages/profile/index",
"pages/profile/authentication/index",
"pages/favorites/index",
- "pages/notopen/index",
"pages/create-supply/index",
"pages/goods-detail/goods-detail",
"pages/goods-update/goods-update",
@@ -41,27 +33,6 @@
"debug-gross-weight"
],
"independent": false
- },
- {
- "root": "pages/test",
- "pages": [
- "undercarriage-test"
- ],
- "independent": false
- },
- {
- "root": "pages/test-tools",
- "pages": [
- "test-mode-switch",
- "connection-test",
- "api-test",
- "phone-test",
- "clear-storage",
- "gross-weight-tester",
- "fix-connection",
- "order-test"
- ],
- "independent": false
}
],
"window": {
@@ -89,10 +60,6 @@
"pagePath": "pages/evaluate2/index",
"text": "估"
},
- {
- "pagePath": "pages/eggbar/eggbar",
- "text": "蛋吧"
- },
{
"pagePath": "pages/favorites/index",
"text": "收藏"
diff --git a/custom-tab-bar/index.js b/custom-tab-bar/index.js
index 118e4d2..0e3980b 100644
--- a/custom-tab-bar/index.js
+++ b/custom-tab-bar/index.js
@@ -17,7 +17,6 @@ Component({
{ key: 'index', route: 'pages/index/index' },
{ key: 'chat', route: 'pages/chat/index', badgeKey: 'chat' },
{ key: 'evaluate', route: 'pages/evaluate2/one' },
- { key: 'settlement', route: 'pages/eggbar/eggbar' },
{ key: 'favorites', route: 'pages/favorites/index' },
{ key: 'profile', route: 'pages/profile/index' }
]
@@ -115,7 +114,6 @@ Component({
'pages/index/index',
'pages/chat/index',
'pages/evaluate2/one',
- 'pages/eggbar/eggbar',
'pages/favorites/index',
'pages/profile/index'
];
diff --git a/pages/eggbar/create-post.js b/pages/eggbar/create-post.js
deleted file mode 100644
index ac7846c..0000000
--- a/pages/eggbar/create-post.js
+++ /dev/null
@@ -1,66 +0,0 @@
-// pages/eggbar/create-post.js
-Page({
-
- /**
- * 页面的初始数据
- */
- data: {
-
- },
-
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
-
- },
-
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
-
- },
-
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
-
- },
-
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
-
- },
-
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
-
- },
-
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
-
- },
-
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
-
- },
-
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
-
- }
-})
\ No newline at end of file
diff --git a/pages/eggbar/create-post.wxml b/pages/eggbar/create-post.wxml
deleted file mode 100644
index 7ae6811..0000000
--- a/pages/eggbar/create-post.wxml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-pages/eggbar/create-post.wxml
\ No newline at end of file
diff --git a/pages/eggbar/eggbar.js b/pages/eggbar/eggbar.js
deleted file mode 100644
index 5b7c9b3..0000000
--- a/pages/eggbar/eggbar.js
+++ /dev/null
@@ -1,66 +0,0 @@
-// pages/eggbar/eggbar.js
-Page({
-
- /**
- * 页面的初始数据
- */
- data: {
-
- },
-
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
-
- },
-
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
-
- },
-
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
-
- },
-
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
-
- },
-
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
-
- },
-
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
-
- },
-
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
-
- },
-
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
-
- }
-})
\ No newline at end of file
diff --git a/pages/eggbar/eggbar.wxml b/pages/eggbar/eggbar.wxml
deleted file mode 100644
index cb8adce..0000000
--- a/pages/eggbar/eggbar.wxml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-pages/eggbar/eggbar.wxml
\ No newline at end of file
diff --git a/pages/evaluate/index.js b/pages/evaluate/index.js
deleted file mode 100644
index 88b9b10..0000000
--- a/pages/evaluate/index.js
+++ /dev/null
@@ -1,314 +0,0 @@
-// pages/evaluate/index.js
-//估价页面 - 简化版三步骤流程
-
-const api = require('../../utils/api');
-
-Page({
- data: {
- currentStep: 1,
- // 月日选择
- selectedMonth: '',
- selectedMonthIndex: 0,
- selectedDay: '',
- selectedDayIndex: 0,
- months: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
- days: [],
- // 地区和品种选择
- selectedRegion: '',
- selectedRegionIndex: 0,
- selectedBreed: '',
- selectedBreedIndex: 0,
- evaluateResult: {
- estimatedPrice: '0.00',
- priceRange: '0.00 - 0.00',
- confidence: '85%'
- },
-
- // 地区选项
- regionOptions: [
- '成都市场报价'
- ],
- // 品种选项
- breedOptions: [
- '黄蛋(红蛋)',
- '粉蛋'
- ]
- },
-
- onLoad() {
- console.log('估价页面初始化 - 简化版')
-
- // 初始化为当前北京时间
- this.initCurrentDate()
- },
-
- // 初始化当前日期
- initCurrentDate() {
- const now = new Date()
- const currentMonth = (now.getMonth() + 1).toString()
- const currentDate = now.getDate().toString()
-
- // 设置默认月份
- const monthIndex = this.data.months.indexOf(currentMonth)
- this.setData({
- selectedMonth: currentMonth,
- selectedMonthIndex: monthIndex >= 0 ? monthIndex : 0
- })
-
- // 根据当前月份更新日期数组
- this.updateDaysForMonth(currentMonth)
-
- // 设置默认日期
- const dayIndex = this.data.days.indexOf(currentDate)
- this.setData({
- selectedDay: dayIndex >= 0 ? currentDate : '',
- selectedDayIndex: dayIndex >= 0 ? dayIndex : 0
- })
- },
-
- // 第一步:点击我知道了
- onIKnow() {
- this.setData({
- currentStep: 2
- })
- },
-
- // 月份选择器变化
- onMonthChange(e) {
- const monthIndex = e.detail.value
- const selectedMonth = this.data.months[monthIndex]
-
- // 更新月份
- this.setData({
- selectedMonth: selectedMonth,
- selectedMonthIndex: monthIndex,
- selectedDay: '', // 清空日期选择
- selectedDayIndex: 0
- })
-
- // 根据月份设置对应的日期数组
- this.updateDaysForMonth(selectedMonth)
- },
-
- // 日期选择器变化
- onDayChange(e) {
- const dayIndex = e.detail.value
- const selectedDay = this.data.days[dayIndex]
- this.setData({
- selectedDay: selectedDay,
- selectedDayIndex: dayIndex
- })
- },
-
- // 根据月份更新日期数组
- updateDaysForMonth(month) {
- let daysCount
-
- // 根据月份设置日期数量
- switch(month) {
- case '2': // 2月
- daysCount = 28 // 简化处理,不考虑闰年
- break
- case '4':
- case '6':
- case '9':
- case '11': // 小月
- daysCount = 30
- break
- default: // 大月
- daysCount = 31
- }
-
- const days = []
- for (let i = 1; i <= daysCount; i++) {
- days.push(i.toString())
- }
-
- this.setData({
- days: days,
- selectedDay: '',
- selectedDayIndex: 0
- })
- },
-
- // 地区选择器变化
- onRegionChange(e) {
- const index = e.detail.value
- const selectedRegion = this.data.regionOptions[index]
- this.setData({
- selectedRegion: selectedRegion,
- selectedRegionIndex: index
- })
- },
-
- // 品种选择器变化
- onBreedChange(e) {
- const index = e.detail.value
- const selectedBreed = this.data.breedOptions[index]
- this.setData({
- selectedBreed: selectedBreed,
- selectedBreedIndex: index
- })
- },
-
- // 开始估价
- startEvaluation() {
- const { selectedMonth, selectedDay, selectedRegion, selectedBreed } = this.data
-
- if (!selectedMonth || !selectedDay || !selectedRegion || !selectedBreed) {
- wx.showToast({
- title: '请完成所有选择',
- icon: 'none',
- duration: 2000
- })
- return
- }
-
- // 显示加载中
- wx.showLoading({
- title: '估价中...',
- mask: true
- })
-
- // 调用真实的价格评估API
- api.evaluatePrice(selectedMonth, selectedDay, selectedRegion, selectedBreed)
- .then(result => {
- console.log('价格评估结果:', result);
-
- // 更新评估结果
- this.setData({
- evaluateResult: {
- estimatedPrice: result.estimatedPrice || '0.00',
- priceRange: result.priceRange || '0.00 - 0.00',
- confidence: result.confidence || '85%'
- },
- currentStep: 3
- });
-
- wx.hideLoading()
-
- wx.showToast({
- title: '估价完成',
- icon: 'success',
- duration: 1500
- })
- })
- .catch(error => {
- console.error('价格评估失败:', error);
-
- wx.hideLoading()
-
- wx.showToast({
- title: '估价失败: ' + (error.message || '未知错误'),
- icon: 'none',
- duration: 3000
- })
-
- // 可以选择保持当前步骤或者回到上一步
- // this.goBack();
- })
- },
-
- // 获取时间系数
- getTimeMultiplier(timeValue) {
- const multipliers = {
- 'today': 1.0,
- 'tomorrow': 0.98,
- 'week': 0.95,
- 'month': 0.90
- }
- return multipliers[timeValue] || 1.0
- },
-
- // 获取地区系数
- getRegionMultiplier(region) {
- const tier1Cities = ['北京', '上海', '广州', '深圳']
- const tier2Cities = ['天津', '江苏', '浙江', '山东']
-
- if (tier1Cities.includes(region)) return 1.15
- if (tier2Cities.includes(region)) return 1.05
- return 1.0
- },
-
- // 获取品种系数
- getBreedMultiplier(breed) {
- const premiumBreeds = ['绿壳', '双黄蛋', '黑鸡土蛋']
- const popularBreeds = ['罗曼粉', '伊莎粉', '海蓝褐']
-
- if (premiumBreeds.includes(breed)) return 1.20
- if (popularBreeds.includes(breed)) return 1.10
- return 1.0
- },
-
- // 计算价格区间
- calculatePriceRange(basePrice) {
- const min = (basePrice * 0.9).toFixed(2)
- const max = (basePrice * 1.1).toFixed(2)
- return `${min} - ${max}`
- },
-
- // 计算置信度
- calculateConfidence(month, day, region, breed) {
- let confidence = 80 // 基础置信度
-
- // 根据选择增加置信度
- // 如果选择了今日(当前月份和日期),增加置信度
- const now = new Date()
- const currentMonth = (now.getMonth() + 1).toString()
- const currentDate = now.getDate().toString()
-
- if (month === currentMonth && day === currentDate) {
- confidence += 10
- }
-
- // 根据地区增加置信度
- if (['北京', '上海', '广州', '深圳'].includes(region)) confidence += 5
- if (['罗曼粉', '伊莎粉', '海蓝褐'].includes(breed)) confidence += 5
-
- return Math.min(confidence, 95) + '%'
- },
-
- // 重新估价
- restartEvaluation() {
- this.setData({
- currentStep: 1,
- selectedMonth: '',
- selectedMonthIndex: 0,
- selectedDay: '',
- selectedDayIndex: 0,
- selectedRegion: '',
- selectedRegionIndex: 0,
- selectedBreed: '',
- selectedBreedIndex: 0,
- evaluateResult: {
- estimatedPrice: '0.00',
- priceRange: '0.00 - 0.00',
- confidence: '85%'
- }
- })
- },
-
- // 重置估价(与restartEvaluation相同)
- resetEvaluation() {
- this.restartEvaluation()
- },
-
- // 查看市场
- goToMarket() {
- // 实际应用中,这里会跳转到市场页面
- wx.showToast({
- title: '功能开发中...',
- icon: 'none',
- duration: 2000
- })
- },
-
- // 返回上一步
- goBack() {
- if (this.data.currentStep > 1) {
- this.setData({
- currentStep: this.data.currentStep - 1
- })
- }
- }
-})
\ No newline at end of file
diff --git a/pages/evaluate/index.json b/pages/evaluate/index.json
deleted file mode 100644
index 9c3c247..0000000
--- a/pages/evaluate/index.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "navigationBarTitleText": "鸡蛋估价",
- "navigationBarBackgroundColor": "#ffffff",
- "navigationBarTextStyle": "black",
- "backgroundColor": "#f5f5f5"
-}
\ No newline at end of file
diff --git a/pages/evaluate/index.wxml b/pages/evaluate/index.wxml
deleted file mode 100644
index 9714d1e..0000000
--- a/pages/evaluate/index.wxml
+++ /dev/null
@@ -1,159 +0,0 @@
-
-
-
-
-
- 🥚
- 鸡蛋估价系统
-
- 欢迎使用鸡蛋估价功能!\n\n本系统将帮助您快速估算鸡蛋的市场价值。
- \n\n估价流程:\n1. 选择您希望了解价格的时间范围\n2. 选择您所在的地区\n3. 选择鸡蛋品种\n\n系统将基于这些信息为您提供初步的价格估算。
- \n请注意:\n• 此估价仅供参考,实际价格受市场波动影响\n• 建议咨询专业人士获取更准确的价格信息\n• 系统不支持真实交易,仅用于价格预估
-
-
-
-
-
-
-
-
-
-
-
- 选择估价参数
- 请完成以下选择,系统将为您估价
-
-
-
- 选择时间
-
-
-
-
-
- {{selectedMonth ? selectedMonth + '月' : '选择月份'}}
-
- ▼
-
-
-
-
-
-
-
- {{selectedDay ? selectedDay + '日' : '选择日期'}}
-
- ▼
-
-
-
-
-
-
-
- 选择地区
-
-
-
- {{selectedRegion || '请选择地区'}}
-
- ▼
-
-
-
-
-
-
- 选择品种
-
-
-
- {{selectedBreed || '请选择品种'}}
-
- ▼
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 预估价格
-
- ¥
- {{evaluateResult.estimatedPrice}}
- 元/斤
-
- 价格区间:¥{{evaluateResult.priceRange}}
-
-
-
-
- 估价详情
-
-
- 时间
- {{selectedMonth}}月{{selectedDay}}日
-
-
- 地区
- {{selectedRegion}}
-
-
- 品种
- {{selectedBreed}}
-
-
- 可信度
- {{evaluateResult.confidence}}
-
-
-
-
-
-
- 💡
- 此价格为系统初步估算,仅供参考。实际成交价格可能因市场供需、季节因素、品质差异等有所变动。建议结合多个渠道信息做出决策。
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/evaluate/index.wxss b/pages/evaluate/index.wxss
deleted file mode 100644
index 94a21ab..0000000
--- a/pages/evaluate/index.wxss
+++ /dev/null
@@ -1,1145 +0,0 @@
-/* pages/evaluate/index.wxss */
-.evaluate-page {
- min-height: 100vh;
- background: linear-gradient(135deg, #f9f9f9, #f5f5f5);
- font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
-}
-
-/* 顶部导航 */
-.evaluate-header {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 30rpx 32rpx;
- background: white;
- border-bottom: 1rpx solid #f0f0f0;
- position: sticky;
- top: 0;
- z-index: 100;
- box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.03);
-}
-
-.header-back {
- font-size: 48rpx;
- color: #333;
- width: 60rpx;
- transition: color 0.2s ease;
-}
-
-.header-back:active {
- color: #FF6B00;
-}
-
-.header-title {
- font-size: 36rpx;
- font-weight: 600;
- color: #333;
-}
-
-.header-placeholder {
- width: 60rpx;
-}
-
-/* 进度指示器 */
-.progress-indicator {
- background: white;
- padding: 30rpx 32rpx;
- border-bottom: 1rpx solid #f0f0f0;
-}
-
-.progress-dots {
- display: flex;
- justify-content: space-between;
- margin-bottom: 20rpx;
- position: relative;
-}
-
-.progress-dots::after {
- content: '';
- position: absolute;
- top: 14rpx;
- left: 0;
- right: 0;
- height: 8rpx;
- background: #e0e0e0;
- z-index: 1;
-}
-
-.progress-dot {
- width: 28rpx;
- height: 28rpx;
- background: #e0e0e0;
- border-radius: 50%;
- transition: all 0.3s ease;
- position: relative;
- z-index: 2;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 16rpx;
- color: transparent;
-}
-
-.progress-dot.active {
- background: #FF6B00;
- color: white;
- transform: scale(1.1);
- box-shadow: 0 4rpx 12rpx rgba(255, 107, 0, 0.3);
-}
-
-.progress-text {
- font-size: 28rpx;
- color: #FF6B00;
- text-align: center;
- font-weight: 500;
-}
-
-/* 步骤内容 */
-.evaluate-step {
- padding: 60rpx 32rpx 40rpx;
- display: block;
- align-items: flex-start;
- justify-content: flex-start;
-}
-
-.step-content {
- max-width: 100%;
- display: block;
- align-items: flex-start;
- justify-content: flex-start;
-}
-
-.step-title {
- font-size: 48rpx;
- font-weight: 700;
- color: #333;
- margin-bottom: 20rpx;
- letter-spacing: 1rpx;
-}
-
-.step-subtitle {
- font-size: 28rpx;
- color: #666;
- margin-bottom: 60rpx;
- line-height: 42rpx;
-}
-
-/* 城市选择头部返回按钮 */
-.city-header {
- margin-bottom: 40rpx;
- padding: 20rpx 0;
-}
-
-.city-back {
- font-size: 32rpx;
- color: #666;
- display: inline-flex;
- align-items: center;
- padding: 10rpx 16rpx;
- border-radius: 12rpx;
- transition: all 0.2s ease;
-}
-
-.city-back:active {
- background: #f5f5f5;
- color: #FF6B00;
-}
-
-/* 返回上一步按钮样式 */
-.back-btn {
- font-size: 28rpx;
- color: #666;
- display: inline-flex;
- align-items: center;
- padding: 10rpx 0;
- margin-bottom: 20rpx;
- background: transparent;
- border: none;
- border-radius: 0;
- transition: color 0.2s ease;
-}
-
-.back-btn::after {
- border: none;
-}
-
-.back-btn:active {
- color: #FF6B00;
-}
-
-/* 类别列表 */
-.category-list {
- background: white;
- border-radius: 20rpx;
- overflow: hidden;
- box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.04);
-}
-
-.category-item {
- display: flex;
- align-items: center;
- padding: 36rpx;
- border-bottom: 1rpx solid #f5f5f5;
- transition: all 0.2s ease;
- position: relative;
- overflow: hidden;
-}
-
-.category-item::before {
- content: '';
- position: absolute;
- left: 0;
- top: 0;
- bottom: 0;
- width: 0;
- background: linear-gradient(90deg, rgba(255, 107, 0, 0.05), transparent);
- transition: width 0.3s ease;
-}
-
-.category-item:active::before {
- width: 100%;
-}
-
-.category-item:last-child {
- border-bottom: none;
-}
-
-.category-item.selected {
- background: #fff8f0;
- border-left: 8rpx solid #FF6B00;
-}
-
-.category-icon {
- font-size: 64rpx;
- margin-right: 24rpx;
- filter: drop-shadow(0 4rpx 8rpx rgba(0, 0, 0, 0.1));
-}
-
-.category-info {
- flex: 1;
-}
-
-.category-name {
- font-size: 32rpx;
- font-weight: 600;
- color: #333;
- margin-bottom: 8rpx;
- display: flex;
- align-items: center;
- flex-wrap: wrap;
-}
-
-.rank-number {
- display: inline-flex;
- align-items: center;
- justify-content: center;
- width: 40rpx;
- height: 40rpx;
- background: #F5F5F5;
- color: #666;
- border-radius: 6rpx;
- font-size: 26rpx;
- font-weight: 600;
- margin-right: 20rpx;
- min-width: 40rpx;
- line-height: 40rpx;
- text-align: center;
- transition: all 0.2s ease;
-}
-
-/* 前三名的特殊样式 */
-.rank-number.rank-1 {
- background: #FF6B00;
- color: white;
- transform: scale(1.05);
- box-shadow: 0 4rpx 12rpx rgba(255, 107, 0, 0.25);
-}
-
-.rank-number.rank-2 {
- background: #FF9500;
- color: white;
- box-shadow: 0 4rpx 12rpx rgba(255, 149, 0, 0.2);
-}
-
-.rank-number.rank-3 {
- background: #FFB74D;
- color: white;
- box-shadow: 0 4rpx 12rpx rgba(255, 183, 77, 0.15);
-}
-
-/* 销售标签样式 */
-.sales-tag {
- display: flex;
- align-items: center;
- background: linear-gradient(135deg, #FF6B00, #FF9500);
- padding: 6rpx 16rpx;
- border-radius: 20rpx;
- margin-left: 10rpx;
- box-shadow: 0 4rpx 12rpx rgba(255, 107, 0, 0.2);
- animation: pulse 2s infinite;
-}
-
-@keyframes pulse {
- 0%, 100% {
- transform: scale(1);
- }
- 50% {
- transform: scale(1.05);
- }
-}
-
-.sales-icon {
- font-size: 22rpx;
- margin-right: 6rpx;
-}
-
-.sales-count {
- font-size: 22rpx;
- color: #FFF;
- font-weight: 600;
-}
-
-.category-desc {
- font-size: 24rpx;
- color: #666;
-}
-
-.category-arrow {
- font-size: 36rpx;
- color: #999;
-}
-
-/* 选项列表 */
-.option-list {
- background: white;
- border-radius: 20rpx;
- overflow: hidden;
- box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.04);
-}
-
-.option-item {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 36rpx;
- border-bottom: 1rpx solid #f5f5f5;
- transition: all 0.2s ease;
- position: relative;
- overflow: hidden;
-}
-
-.option-item::before {
- content: '';
- position: absolute;
- left: 0;
- top: 0;
- bottom: 0;
- width: 0;
- background: linear-gradient(90deg, rgba(255, 107, 0, 0.05), transparent);
- transition: width 0.3s ease;
-}
-
-.option-item:active::before {
- width: 100%;
-}
-
-.option-item:last-child {
- border-bottom: none;
-}
-
-.option-item.selected {
- background: #fff8f0;
- border-left: 8rpx solid #FF6B00;
-}
-
-.option-text {
- font-size: 32rpx;
- color: #333;
- font-weight: 500;
- display: flex;
- align-items: center;
- flex-wrap: wrap;
- flex: 1;
-}
-
-/* 销售信息样式 */
-.sales-info {
- display: flex;
- align-items: center;
- background: rgba(255, 107, 0, 0.1);
- padding: 6rpx 16rpx;
- border-radius: 20rpx;
- margin-left: 15rpx;
- transition: all 0.2s ease;
-}
-
-.sales-info .sales-icon {
- font-size: 22rpx;
- margin-right: 6rpx;
-}
-
-.sales-info .sales-count {
- font-size: 22rpx;
- color: #FF6B00;
- font-weight: 600;
-}
-
-.option-arrow {
- font-size: 36rpx;
- color: #999;
- transition: transform 0.2s ease;
-}
-
-.option-item:active .option-arrow {
- transform: translateX(4rpx);
-}
-
-/* 条件列表 */
-.condition-list {
- background: white;
- border-radius: 20rpx;
- overflow: hidden;
- box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.04);
-}
-
-.condition-item {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 36rpx;
- border-bottom: 1rpx solid #f5f5f5;
- transition: all 0.3s ease;
- position: relative;
- overflow: hidden;
- text-align: left;
-}
-
-.condition-item::before {
- content: '';
- position: absolute;
- left: 0;
- top: 0;
- bottom: 0;
- width: 0;
- background: linear-gradient(90deg, rgba(255, 107, 0, 0.05), transparent);
- transition: width 0.3s ease;
-}
-
-.condition-item:active::before {
- width: 100%;
-}
-
-.condition-item:last-child {
- border-bottom: none;
-}
-
-.condition-item.selected {
- background: #fff8f0;
- border-left: 8rpx solid #FF6B00;
-}
-
-.condition-info {
- flex: 1;
- text-align: left;
- align-self: flex-start;
-}
-
-.condition-name {
- font-size: 32rpx;
- font-weight: 600;
- color: #333;
- margin-bottom: 12rpx;
- display: flex;
- align-items: center;
- text-align: left;
- justify-content: flex-start;
- align-self: flex-start;
-}
-
-.condition-desc {
- font-size: 26rpx;
- color: #666;
- line-height: 36rpx;
- text-align: left;
- align-self: flex-start;
-}
-
-.condition-check {
- color: #FF6B00;
- font-size: 36rpx;
- font-weight: bold;
- background: white;
- width: 50rpx;
- height: 50rpx;
- border-radius: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
- box-shadow: 0 4rpx 12rpx rgba(255, 107, 0, 0.3);
-}
-
-/* 获取报价按钮 */
-.get-price-section {
- margin-top: 80rpx;
- padding: 0 32rpx;
-}
-
-.get-price-btn {
- background: linear-gradient(135deg, #FF6B00, #FF9500);
- color: white;
- border: none;
- border-radius: 50rpx;
- padding: 32rpx 0;
- font-size: 34rpx;
- font-weight: 700;
- width: 100%;
- box-shadow: 0 10rpx 30rpx rgba(255, 107, 0, 0.35);
- transition: all 0.3s ease;
- letter-spacing: 2rpx;
-}
-
-.get-price-btn:active {
- transform: scale(0.98);
- box-shadow: 0 6rpx 20rpx rgba(255, 107, 0, 0.3);
-}
-
-.get-price-btn::after {
- content: none;
-}
-
-/* 结果页面 */
-.result-step {
- background: linear-gradient(135deg, #fff8f0, #ffffff);
- min-height: 100vh;
-}
-
-.result-header {
- text-align: center;
- padding: 80rpx 0 30rpx;
- background: white;
- box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.03);
- animation: fadeIn 0.8s ease-out;
-}
-
-.result-icon {
- font-size: 140rpx;
- margin-bottom: 30rpx;
- animation: bounce 1s ease-out;
-}
-
-@keyframes bounce {
- 0% {
- transform: translateY(-30rpx) scale(0.8);
- opacity: 0;
- }
- 70% {
- transform: translateY(10rpx) scale(1.1);
- }
- 100% {
- transform: translateY(0) scale(1);
- opacity: 1;
- }
-}
-
-.result-title {
- font-size: 48rpx;
- font-weight: 700;
- color: #333;
- margin-bottom: 20rpx;
- letter-spacing: 2rpx;
- animation: fadeUp 0.6s ease-out;
-}
-
-.result-subtitle {
- font-size: 28rpx;
- color: #666;
- animation: fadeUp 0.6s ease-out 0.2s both;
-}
-
-@keyframes fadeUp {
- from {
- transform: translateY(20rpx);
- opacity: 0;
- }
- to {
- transform: translateY(0);
- opacity: 1;
- }
-}
-
-.result-content {
- padding: 40rpx 32rpx;
-}
-
-/* 商品信息卡片 */
-.product-info-card {
- background: white;
- border-radius: 20rpx;
- padding: 40rpx;
- margin-bottom: 50rpx;
- box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.04);
- animation: slideUp 0.8s ease-out;
-}
-
-@keyframes slideUp {
- from {
- transform: translateY(40rpx);
- opacity: 0;
- }
- to {
- transform: translateY(0);
- opacity: 1;
- }
-}
-
-.product-type {
- font-size: 36rpx;
- font-weight: 700;
- color: #333;
- margin-bottom: 20rpx;
- letter-spacing: 1rpx;
-}
-
-.product-details {
- display: flex;
- gap: 20rpx;
- flex-wrap: wrap;
-}
-
-.product-brand, .product-model {
- font-size: 28rpx;
- color: #666;
- background: #f5f5f5;
- padding: 14rpx 28rpx;
- border-radius: 30rpx;
- font-weight: 500;
- transition: all 0.2s ease;
-}
-
-.product-brand:active, .product-model:active {
- background: #e8e8e8;
-}
-
-/* 价格结果 */
-.price-result {
- text-align: center;
- margin-top: 30rpx;
- margin-bottom: 0;
- padding: 0 32rpx;
- animation: pulseScale 1s ease-out;
-}
-
-@keyframes pulseScale {
- 0% {
- transform: scale(0.9);
- opacity: 0;
- }
- 50% {
- transform: scale(1.05);
- }
- 100% {
- transform: scale(1);
- opacity: 1;
- }
-}
-
-.price-label {
- font-size: 28rpx;
- color: #666;
- margin-bottom: 24rpx;
- font-weight: 500;
-}
-
-.price-amount {
- display: flex;
- align-items: baseline;
- justify-content: center;
- gap: 12rpx;
- margin-bottom: 16rpx;
-}
-
-.price-symbol {
- font-size: 44rpx;
- color: #FF6B00;
- font-weight: 700;
-}
-
-.price-number {
- font-size: 80rpx;
- font-weight: bold;
- color: #FF6B00;
- line-height: 1;
- text-shadow: 0 4rpx 12rpx rgba(255, 107, 0, 0.2);
-}
-
-.price-unit {
- font-size: 30rpx;
- color: #666;
- font-weight: 500;
-}
-
-/* 状况汇总 */
-.condition-summary {
- background: white;
- border-radius: 20rpx;
- padding: 40rpx;
- margin-bottom: 40rpx;
- box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.04);
- animation: slideUp 0.8s ease-out 0.4s both;
-}
-
-.summary-title {
- font-size: 32rpx;
- font-weight: 700;
- color: #333;
- margin-bottom: 24rpx;
- letter-spacing: 1rpx;
-}
-
-.condition-items {
- display: flex;
- flex-wrap: wrap;
- gap: 20rpx;
-}
-
-.condition-item {
- background: #f5f5f5;
- padding: 20rpx 32rpx;
- border-radius: 16rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
- gap: 12rpx;
- flex: 1;
- min-width: 200rpx;
- transition: all 0.2s ease;
-}
-
-.condition-item:active {
- background: #e8e8e8;
-}
-
-.condition-label {
- font-size: 26rpx;
- color: #666;
- font-weight: 500;
-}
-
-.condition-value {
- font-size: 32rpx;
- font-weight: 700;
- color: #333;
- letter-spacing: 1rpx;
-}
-
-/* 价格提示 */
-.price-tips {
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 12rpx;
- padding: 24rpx;
- background: rgba(255, 107, 0, 0.05);
- border-radius: 16rpx;
- margin: 0 20rpx 60rpx;
- animation: fadeUp 0.8s ease-out 0.6s both;
-}
-
-.tip-icon {
- font-size: 30rpx;
- color: #FF6B00;
- flex-shrink: 0;
- margin-top: 4rpx;
-}
-
-.tip-text {
- font-size: 26rpx;
- color: #666;
- line-height: 38rpx;
- flex: 1;
- text-align: center;
-}
-
-/* 结果操作按钮 */
-.result-actions {
- display: flex;
- gap: 24rpx;
- padding: 0 32rpx 60rpx;
- animation: slideUp 0.8s ease-out 0.8s both;
-}
-
-.btn-secondary {
- flex: 1;
- background: white;
- color: #666;
- border: 1rpx solid #e0e0e0;
- border-radius: 50rpx;
- padding: 32rpx 0;
- font-size: 34rpx;
- font-weight: 700;
- transition: all 0.3s ease;
- letter-spacing: 2rpx;
- box-shadow: 0 6rpx 16rpx rgba(0, 0, 0, 0.04);
-}
-
-.btn-secondary:active {
- background: #f8f8f8;
- transform: scale(0.98);
- box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.03);
-}
-
-.btn-primary {
- flex: 1;
- background: linear-gradient(135deg, #FF6B00, #FF9500);
- color: white;
- border: none;
- border-radius: 50rpx;
- padding: 32rpx 0;
- font-size: 34rpx;
- font-weight: 700;
- transition: all 0.3s ease;
- letter-spacing: 2rpx;
- box-shadow: 0 10rpx 30rpx rgba(255, 107, 0, 0.35);
-}
-
-.btn-primary:active {
- transform: scale(0.98);
- box-shadow: 0 6rpx 20rpx rgba(255, 107, 0, 0.3);
-}
-
-.btn-secondary::after, .btn-primary::after {
- content: none;
-}
-
-/* ========== 新增3步流程样式 ========== */
-
-/* 步骤1:提示说明页面样式 */
-.step-icon {
- font-size: 120rpx;
- text-align: center;
- margin-bottom: 40rpx;
- animation: fadeIn 1s ease-out;
-}
-
-.step-description {
- background: white;
- border-radius: 20rpx;
- padding: 40rpx;
- margin-bottom: 60rpx;
- box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.04);
- font-size: 28rpx;
- color: #333;
- line-height: 48rpx;
- white-space: pre-line;
- animation: slideUp 0.8s ease-out;
-}
-
-.know-btn-wrapper {
- text-align: center;
-}
-
-.know-btn {
- background: linear-gradient(135deg, #FF6B00, #FF9500);
- color: white;
- border: none;
- border-radius: 50rpx;
- padding: 32rpx 80rpx;
- font-size: 34rpx;
- font-weight: 700;
- box-shadow: 0 10rpx 30rpx rgba(255, 107, 0, 0.35);
- transition: all 0.3s ease;
- letter-spacing: 2rpx;
-}
-
-.know-btn:active {
- transform: scale(0.98);
- box-shadow: 0 6rpx 20rpx rgba(255, 107, 0, 0.3);
-}
-
-.know-btn::after {
- content: none;
-}
-
-/* 步骤2:选择参数页面样式 */
-.selection-group {
- background: white;
- border-radius: 20rpx;
- padding: 40rpx;
- margin-bottom: 30rpx;
- box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.04);
- animation: slideUp 0.8s ease-out;
-}
-
-.selection-group:last-child {
- margin-bottom: 60rpx;
-}
-
-.group-title {
- font-size: 32rpx;
- font-weight: 700;
- color: #333;
- margin-bottom: 30rpx;
- letter-spacing: 1rpx;
-}
-
-.option-check {
- color: #FF6B00;
- font-size: 36rpx;
- font-weight: bold;
- background: white;
- width: 50rpx;
- height: 50rpx;
- border-radius: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
- box-shadow: 0 4rpx 12rpx rgba(255, 107, 0, 0.3);
-}
-
-.evaluate-btn-wrapper {
- text-align: center;
-}
-
-.evaluate-btn {
- background: linear-gradient(135deg, #FF6B00, #FF9500);
- color: white;
- border: none;
- border-radius: 50rpx;
- padding: 32rpx 0;
- font-size: 34rpx;
- font-weight: 700;
- width: 100%;
- box-shadow: 0 10rpx 30rpx rgba(255, 107, 0, 0.35);
- transition: all 0.3s ease;
- letter-spacing: 2rpx;
-}
-
-.evaluate-btn.active {
- background: linear-gradient(135deg, #FF6B00, #FF9500);
- transform: scale(1);
-}
-
-.evaluate-btn.active:active {
- transform: scale(0.98);
- box-shadow: 0 6rpx 20rpx rgba(255, 107, 0, 0.3);
-}
-
-.evaluate-btn.disabled {
- background: #ccc;
- box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
- transform: none;
-}
-
-.evaluate-btn::after {
- content: none;
-}
-
-/* 步骤3:估价结果页面样式 */
-.result-header {
- text-align: center;
- padding: 60rpx 0 40rpx;
- background: white;
- box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.03);
- animation: fadeIn 0.8s ease-out;
-}
-
-.result-icon {
- font-size: 120rpx;
- margin-bottom: 20rpx;
- animation: bounce 1s ease-out;
-}
-
-.result-title {
- font-size: 42rpx;
- font-weight: 700;
- color: #333;
- margin-bottom: 20rpx;
- letter-spacing: 2rpx;
- animation: fadeUp 0.6s ease-out;
-}
-
-.result-subtitle {
- font-size: 26rpx;
- color: #666;
- animation: fadeUp 0.6s ease-out 0.2s both;
-}
-
-.price-card {
- background: white;
- border-radius: 20rpx;
- padding: 40rpx;
- margin: 40rpx 0;
- box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.04);
- text-align: center;
- animation: pulseScale 1s ease-out;
-}
-
-.price-label {
- font-size: 28rpx;
- color: #666;
- margin-bottom: 24rpx;
- font-weight: 500;
-}
-
-.price-amount {
- display: flex;
- align-items: baseline;
- justify-content: center;
- gap: 12rpx;
- margin-bottom: 16rpx;
-}
-
-.price-symbol {
- font-size: 44rpx;
- color: #FF6B00;
- font-weight: 700;
-}
-
-.price-number {
- font-size: 72rpx;
- font-weight: bold;
- color: #FF6B00;
- line-height: 1;
- text-shadow: 0 4rpx 12rpx rgba(255, 107, 0, 0.2);
-}
-
-.price-unit {
- font-size: 28rpx;
- color: #666;
- font-weight: 500;
-}
-
-.price-range {
- font-size: 26rpx;
- color: #999;
- margin-top: 12rpx;
-}
-
-.evaluation-details {
- background: white;
- border-radius: 20rpx;
- padding: 40rpx;
- margin-bottom: 40rpx;
- box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.04);
- animation: slideUp 0.8s ease-out 0.4s both;
-}
-
-.detail-title {
- font-size: 32rpx;
- font-weight: 700;
- color: #333;
- margin-bottom: 30rpx;
- letter-spacing: 1rpx;
- text-align: center;
-}
-
-.detail-items {
- display: grid;
- grid-template-columns: 1fr 1fr;
- gap: 20rpx;
-}
-
-.detail-item {
- display: flex;
- flex-direction: column;
- align-items: center;
- padding: 20rpx;
- background: #f8f8f8;
- border-radius: 12rpx;
- transition: all 0.2s ease;
-}
-
-.detail-item:active {
- background: #f0f0f0;
-}
-
-.detail-label {
- font-size: 24rpx;
- color: #666;
- margin-bottom: 8rpx;
- font-weight: 500;
-}
-
-.detail-value {
- font-size: 28rpx;
- font-weight: 700;
- color: #333;
- text-align: center;
-}
-
-/* ========== 下拉框选择器样式 ========== */
-
-.picker-wrapper {
- display: flex;
- align-items: center;
- justify-content: space-between;
- background: white;
- border: 2rpx solid #e0e0e0;
- border-radius: 16rpx;
- padding: 32rpx;
- transition: all 0.3s ease;
- position: relative;
-}
-
-.picker-wrapper:active {
- border-color: #FF6B00;
- background: #fff8f0;
-}
-
-.picker-wrapper.small {
- padding: 24rpx;
- margin: 0 10rpx;
- border-radius: 12rpx;
-}
-
-.picker-wrapper.disabled {
- background: #f5f5f5;
- border-color: #e0e0e0;
-}
-
-.picker-wrapper.disabled:active {
- border-color: #e0e0e0;
- background: #f5f5f5;
-}
-
-.picker-display {
- flex: 1;
- font-size: 32rpx;
- color: #999;
- transition: color 0.3s ease;
-}
-
-.picker-display.selected {
- color: #333;
- font-weight: 500;
-}
-
-.picker-arrow {
- font-size: 24rpx;
- color: #999;
- transition: transform 0.3s ease;
- margin-left: 20rpx;
-}
-
-.picker-wrapper:active .picker-arrow {
- transform: scale(1.1);
-}
-
-/* ========== 月日二级框样式 ========== */
-
-.date-selector {
- display: flex;
- align-items: center;
- justify-content: space-between;
- background: white;
- border-radius: 20rpx;
- padding: 20rpx;
- box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.04);
-}
-
-.date-selector .picker-wrapper {
- flex: 1;
- margin: 0;
- box-shadow: none;
- border: 2rpx solid #e0e0e0;
-}
\ No newline at end of file
diff --git a/pages/evaluate1/index.js b/pages/evaluate1/index.js
deleted file mode 100644
index cb960df..0000000
--- a/pages/evaluate1/index.js
+++ /dev/null
@@ -1,292 +0,0 @@
-Page({
- data: {
- productName: '',
- specifications: [],
- loading: false,
- error: ''
- },
- onLoad(options) {
- let productName = '';
- // 首先检查URL参数
- if (options.productName) {
- productName = options.productName;
- } else {
- // 然后检查本地存储(用于wx.switchTab导航)
- productName = wx.getStorageSync('selectedProductName') || '';
- // 清除本地存储中的商品名称,避免影响下次进入
- if (productName) {
- wx.removeStorageSync('selectedProductName');
- }
- }
-
- if (productName) {
- this.setData({ productName: productName });
- this.loadSpecifications(productName);
- } else {
- // 如果没有商品名称参数,跳转到商品列表页面
- wx.redirectTo({
- url: '/pages/evaluate1/product-list'
- });
- }
- },
-
- loadSpecifications(productName) {
- this.setData({ loading: true, specifications: [] });
-
- // 直接从本地存储获取商品数据,避免重复请求
- const localGoods = wx.getStorageSync('goods') || [];
- console.log('从本地存储获取的商品数量:', localGoods.length);
-
- if (localGoods.length > 0) {
- this.processSpecifications(productName, localGoods);
- } else {
- // 如果本地没有数据,再请求服务器
- const api = require('../../utils/api');
- api.getProducts(1, 1000).then(result => {
- // 从返回对象中提取products数组
- const products = result.products || [];
- this.processSpecifications(productName, products);
- }).catch(err => {
- console.error('获取规格失败:', err);
- this.setData({
- error: '获取规格失败,请稍后重试',
- loading: false
- });
- });
- }
- },
-
- // 解析规格,提取类型(净重/毛重)和数值范围
- parseSpecification(spec) {
- const weightMatch = spec.match(/(净重|毛重)(\d+)-(\d+)/);
- if (weightMatch) {
- const type = weightMatch[1]; // 净重或毛重
- const min = parseFloat(weightMatch[2]);
- const max = parseFloat(weightMatch[3]);
- const avg = (min + max) / 2;
- return {
- type: type,
- min: min,
- max: max,
- avg: avg
- };
- }
- return null;
- },
-
- processSpecifications(productName, products) {
- console.log('处理的商品数据数量:', products.length);
- console.log('当前处理的商品名称:', productName);
-
- // 检查products是否为空
- if (!products || products.length === 0) {
- console.error('商品数据为空');
- this.setData({
- error: '商品数据为空',
- loading: false
- });
- return;
- }
-
- // 过滤出当前商品名称的所有商品
- const filteredProducts = products.filter(product => {
- const match = product.productName === productName;
- console.log('商品:', product.productName, '规格:', product.specification, '价格:', product.price, '匹配:', match);
- return match;
- });
-
- console.log('过滤后的商品数量:', filteredProducts.length);
- console.log('过滤后的商品详情:', filteredProducts);
-
- // 检查filteredProducts是否为空
- if (filteredProducts.length === 0) {
- console.error('未找到商品名称为"' + productName + '"的商品');
- this.setData({
- error: '未找到对应商品名称的商品',
- loading: false
- });
- return;
- }
-
- // 提取规格和价格,处理可能的空值和空格
- const specPriceMap = {};
- filteredProducts.forEach((product, productIndex) => {
- const specStr = (product.specification || product.spec || '').trim();
- const price = product.price || '';
-
- console.log(`处理第${productIndex + 1}个商品: 规格字符串='${specStr}', 价格字符串='${price}'`);
-
- // 价格为空的不参与计算
- if (!price || price.trim() === '') {
- console.log(`商品价格为空,跳过处理`);
- return;
- }
-
- if (specStr.length > 0) {
- // 处理逗号分隔的多个规格,确保每个规格都被正确分割
- // 首先按逗号分割
- let specs = specStr.split(',').map(spec => spec.trim()).filter(spec => spec.length > 0);
-
- // 进一步处理规格,确保每个规格都是独立的
- const processedSpecs = [];
- specs.forEach(spec => {
- // 检查规格是否包含多个规格(例如:"净重29-30,净重31-32")
- if (spec.includes(',')) {
- // 按中文逗号分割
- const subSpecs = spec.split(',').map(s => s.trim()).filter(s => s.length > 0);
- processedSpecs.push(...subSpecs);
- } else {
- processedSpecs.push(spec);
- }
- });
-
- specs = processedSpecs;
-
- // 处理逗号分隔的多个价格
- const prices = (price || '').split(',').map(p => p.trim()).filter(p => p && p.trim() !== '');
-
- console.log(`规格数组:`, specs);
- console.log(`价格数组:`, prices);
-
- // 价格为空的不参与计算
- if (prices.length === 0) {
- console.log(`价格数组为空,跳过处理`);
- return;
- }
-
- // 将规格和价格配对
- specs.forEach((spec, index) => {
- if (spec.length > 0) {
- // 确保价格索引不超出范围
- const priceIndex = index % prices.length;
- const matchedPrice = prices[priceIndex] || '';
- console.log(`规格'${spec}' 配对价格: '${matchedPrice}'`);
-
- // 只有当价格不为空时才添加该规格
- if (matchedPrice && matchedPrice.trim() !== '') {
- // 收集相同规格的所有价格,以便计算平均值
- if (!specPriceMap[spec]) {
- specPriceMap[spec] = [];
- }
- specPriceMap[spec].push(matchedPrice);
- } else {
- console.log(`规格'${spec}' 价格为空,不添加`);
- }
- }
- });
- }
- });
-
- // 转换为规格对象数组
- const specifications = Object.keys(specPriceMap).map(spec => {
- const prices = specPriceMap[spec];
- console.log(`规格'${spec}' 的所有原始价格:`, prices);
-
- // 解析规格
- const specInfo = this.parseSpecification(spec);
-
- // 处理每个价格
- const processedPrices = prices.map(price => {
- if (!price || price.trim() === '' || isNaN(parseFloat(price))) {
- return 0;
- }
-
- const priceValue = parseFloat(price);
- console.log(`处理价格: ${priceValue}`);
-
- // 价格<10的需要按照公式计算
- if (priceValue < 10 && specInfo) {
- console.log(`价格 ${priceValue} < 10,按照公式计算`);
- if (specInfo.type === '净重') {
- // 净重:规格平均值 × 价格
- return specInfo.avg * priceValue;
- } else if (specInfo.type === '毛重') {
- // 毛重:(规格平均值 - 5) × 价格
- return (specInfo.avg - 5) * priceValue;
- }
- }
- // 价格>=10的直接使用
- return priceValue;
- }).filter(price => price > 0); // 过滤掉0值
-
- console.log(`规格'${spec}' 处理后的价格:`, processedPrices);
-
- // 计算处理后价格的平均值
- let finalPrice = 0;
- let finalPriceText = '';
-
- if (processedPrices.length > 0) {
- const sum = processedPrices.reduce((acc, price) => acc + price, 0);
- finalPrice = sum / processedPrices.length;
- finalPriceText = finalPrice.toFixed(2);
- console.log(`规格'${spec}' 处理后价格的平均值: ${finalPriceText} (基于 ${processedPrices.length} 个价格)`);
- } else {
- console.log(`规格'${spec}' 没有有效价格`);
- }
-
- const specObj = {
- name: spec,
- price: finalPriceText,
- priceText: finalPriceText,
- finalPrice: finalPrice,
- finalPriceText: finalPriceText
- };
-
- console.log('创建的规格对象:', specObj);
-
- return specObj;
- });
-
- console.log('提取的规格和价格:', specifications);
-
- // 对规格进行排序
- specifications.sort((a, b) => {
- // 解析两个规格
- const specA = this.parseSpecification(a.name);
- const specB = this.parseSpecification(b.name);
-
- // 如果有一个规格解析失败,保持原顺序
- if (!specA || !specB) {
- return 0;
- }
-
- // 1. 按类型排序:净重在前,毛重在后
- if (specA.type !== specB.type) {
- return specA.type === '净重' ? -1 : 1;
- }
-
- // 2. 按规格最小值排序:从小到大
- return specA.min - specB.min;
- });
-
- console.log('排序后的规格:', specifications);
-
- this.setData({
- specifications: specifications,
- error: '', // 清除之前的错误
- loading: false
- });
- },
-
- // 跳转到规格详情页面
- goToSpecDetail(e) {
- const specItem = e.currentTarget.dataset.spec;
- console.log('点击的规格项:', specItem);
- console.log('传递的价格:', specItem.finalPriceText);
- wx.navigateTo({
- url: `/pages/evaluate1/spec-detail?productName=${encodeURIComponent(this.data.productName)}&specification=${encodeURIComponent(specItem.name)}&price=${encodeURIComponent(specItem.finalPriceText)}`
- });
- },
-
- // 返回上一页
- goBack() {
- wx.navigateBack();
- },
-
- // 返回商品列表页面
- goBackToProductList() {
- wx.redirectTo({
- url: '/pages/evaluate1/product-list'
- });
- }
-});
\ No newline at end of file
diff --git a/pages/evaluate1/index.json b/pages/evaluate1/index.json
deleted file mode 100644
index e583a2d..0000000
--- a/pages/evaluate1/index.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "navigationBarTitleText": "估价",
- "usingComponents": {}
-}
\ No newline at end of file
diff --git a/pages/evaluate1/index.wxml b/pages/evaluate1/index.wxml
deleted file mode 100644
index 0a664b1..0000000
--- a/pages/evaluate1/index.wxml
+++ /dev/null
@@ -1,78 +0,0 @@
-
-
-
-
-
-
-
-
- 正在加载规格数据...
-
-
-
-
- ⚠️
- {{error}}
-
-
-
-
-
-
-
-
-
-
- 商品名称
-
-
- {{productName}}
-
-
-
-
-
-
-
-
-
- {{item.name}}
-
-
- 参考价格
- ¥{{item.finalPriceText}}
-
- →
-
-
-
-
-
- 暂无更多规格选择
-
-
-
-
-
- 📋
- 该商品暂无可用规格
-
-
-
-
\ No newline at end of file
diff --git a/pages/evaluate1/index.wxss b/pages/evaluate1/index.wxss
deleted file mode 100644
index 1e117b3..0000000
--- a/pages/evaluate1/index.wxss
+++ /dev/null
@@ -1,450 +0,0 @@
-.container {
- display: flex;
- flex-direction: column;
- min-height: 100vh;
- background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
- font-family: 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
-}
-
-.header {
- background: #fff;
- box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.08);
- position: sticky;
- top: 0;
- z-index: 10;
-}
-
-.header-content {
- padding: 30rpx 0;
- text-align: center;
-}
-
-.title {
- font-size: 36rpx;
- font-weight: 700;
- color: #2c3e50;
- letter-spacing: 2rpx;
-}
-
-.content {
- flex: 1;
- padding: 16rpx;
-}
-
-/* 加载状态 */
-.loading {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- padding: 160rpx 0;
-}
-
-.loading-spinner {
- width: 80rpx;
- height: 80rpx;
- border: 8rpx solid rgba(74, 144, 226, 0.2);
- border-top: 8rpx solid #4a90e2;
- border-radius: 50%;
- animation: spin 1s linear infinite;
- margin-bottom: 32rpx;
-}
-
-@keyframes spin {
- 0% { transform: rotate(0deg); }
- 100% { transform: rotate(360deg); }
-}
-
-.loading-text {
- font-size: 28rpx;
- color: #666;
- font-weight: 500;
-}
-
-/* 错误提示卡片 */
-.error-card {
- background: #fff;
- border-radius: 16rpx;
- padding: 48rpx;
- margin: 32rpx 0;
- box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.08);
- display: flex;
- flex-direction: column;
- align-items: center;
- text-align: center;
-}
-
-.error-icon {
- font-size: 80rpx;
- margin-bottom: 24rpx;
-}
-
-.error-text {
- font-size: 28rpx;
- color: #e74c3c;
- margin-bottom: 32rpx;
- line-height: 1.5;
-}
-
-/* 按钮样式 */
-.button-group {
- display: flex;
- gap: 16rpx;
- width: 100%;
- max-width: 600rpx;
-}
-
-.btn-primary {
- flex: 1;
- height: 80rpx;
- line-height: 80rpx;
- font-size: 28rpx;
- font-weight: 600;
- border-radius: 40rpx;
- background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
- color: #fff;
- border: none;
- box-shadow: 0 4rpx 12rpx rgba(96, 165, 250, 0.4);
- transition: all 0.3s ease;
-}
-
-.btn-primary:hover {
- transform: translateY(-2rpx);
- box-shadow: 0 6rpx 16rpx rgba(74, 144, 226, 0.5);
-}
-
-.btn-secondary {
- flex: 1;
- height: 80rpx;
- line-height: 80rpx;
- font-size: 28rpx;
- font-weight: 600;
- border-radius: 40rpx;
- background: #fff;
- color: #4a90e2;
- border: 2rpx solid #4a90e2;
- transition: all 0.3s ease;
-}
-
-.btn-secondary:hover {
- background: rgba(74, 144, 226, 0.05);
- transform: translateY(-2rpx);
-}
-
-.btn-back {
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 8rpx 24rpx;
- font-size: 24rpx;
- color: #4a90e2;
- background: transparent;
- border: 1rpx solid #4a90e2;
- border-radius: 20rpx;
- transition: all 0.3s ease;
- box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.05);
-}
-
-.btn-back:hover {
- background: rgba(74, 144, 226, 0.1);
- transform: translateY(-2rpx);
- box-shadow: 0 4rpx 12rpx rgba(74, 144, 226, 0.2);
-}
-
-.btn-back-icon {
- margin-right: 8rpx;
- font-size: 20rpx;
-}
-
-.btn-back-text {
- font-size: 22rpx;
-}
-
-/* 商品信息卡片 */
-.product-card {
- background: rgba(255, 255, 255, 0.95);
- border-radius: 20rpx;
- padding: 32rpx;
- margin-bottom: 24rpx;
- box-shadow: 0 6rpx 20rpx rgba(0,0,0,0.08);
- backdrop-filter: blur(8rpx);
- border: 1rpx solid rgba(255, 255, 255, 0.3);
-}
-
-.product-info-container {
- width: 100%;
- box-sizing: border-box;
-}
-
-.product-info-row {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 16rpx;
- width: 100%;
- box-sizing: border-box;
-}
-
-.product-label {
- font-size: 24rpx;
- color: #666;
- font-weight: 500;
- flex: 1;
-}
-
-.product-name {
- font-size: 32rpx;
- font-weight: 700;
- color: #2c3e50;
- line-height: 1.4;
- word-break: break-word;
- margin-top: 12rpx;
- padding: 12rpx 0;
- border-top: 1rpx solid #f1f5f9;
-}
-
-/* 规格列表区域 */
-.spec-section {
- margin-top: 24rpx;
-}
-
-.section-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 24rpx;
- padding: 0 8rpx;
-}
-
-.section-title {
- font-size: 30rpx;
- font-weight: 700;
- color: #2c3e50;
- padding-left: 16rpx;
- border-left: 6rpx solid #4a90e2;
-}
-
-.section-count {
- font-size: 24rpx;
- color: #999;
- background: rgba(74, 144, 226, 0.1);
- padding: 6rpx 16rpx;
- border-radius: 20rpx;
-}
-
-/* 规格网格布局 */
-.spec-grid {
- display: grid;
- grid-template-columns: repeat(3, 1fr);
- gap: 20rpx;
- margin-top: 16rpx;
-}
-
-/* 规格卡片 */
-.spec-card {
- background: rgba(255, 255, 255, 0.95);
- border-radius: 20rpx;
- padding: 32rpx 24rpx;
- box-shadow: 0 6rpx 20rpx rgba(0,0,0,0.08);
- transition: all 0.3s ease;
- cursor: pointer;
- position: relative;
- overflow: hidden;
- backdrop-filter: blur(8rpx);
- border: 1rpx solid rgba(255, 255, 255, 0.3);
- min-height: 200rpx;
- display: flex;
- flex-direction: column;
-}
-
-.spec-card::before {
- content: '';
- position: absolute;
- top: 0;
- left: 0;
- width: 6rpx;
- height: 100%;
- background: linear-gradient(180deg, #60a5fa 0%, #3b82f6 100%);
-}
-
-.spec-card:hover {
- transform: translateY(-6rpx);
- box-shadow: 0 12rpx 32rpx rgba(0,0,0,0.15);
- background: rgba(255, 255, 255, 1);
-}
-
-.spec-card:active {
- transform: translateY(-2rpx);
- box-shadow: 0 8rpx 24rpx rgba(0,0,0,0.12);
-}
-
-.spec-info {
- margin-bottom: 20rpx;
- flex: 1;
- display: flex;
- align-items: center;
-}
-
-.spec-name {
- font-size: 28rpx;
- font-weight: 600;
- color: #2c3e50;
- line-height: 1.4;
- word-break: break-word;
- padding-right: 40rpx;
-}
-
-.spec-price {
- display: flex;
- flex-direction: column;
- margin-top: 16rpx;
-}
-
-.price-label {
- font-size: 20rpx;
- color: #999;
- margin-bottom: 4rpx;
-}
-
-.price-value {
- font-size: 36rpx;
- font-weight: 700;
- color: #e74c3c;
- transition: all 0.3s ease;
-}
-
-.spec-card:hover .price-value {
- transform: scale(1.05);
-}
-
-.spec-arrow {
- position: absolute;
- top: 32rpx;
- right: 28rpx;
- font-size: 32rpx;
- color: #4a90e2;
- font-weight: bold;
- opacity: 0.6;
- transition: all 0.3s ease;
-}
-
-.spec-card:hover .spec-arrow {
- opacity: 1;
- transform: translateX(4rpx);
-}
-
-/* 空状态 */
-.empty-state {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- padding: 160rpx 0;
- text-align: center;
-}
-
-.empty-icon {
- font-size: 160rpx;
- margin-bottom: 40rpx;
- opacity: 0.6;
-}
-
-.empty-text {
- font-size: 32rpx;
- color: #666;
- margin-bottom: 48rpx;
- line-height: 1.4;
- padding: 0 40rpx;
-}
-
-/* 响应式设计 */
-@media (max-width: 750rpx) {
- .content {
- padding: 20rpx;
- }
-
- .spec-grid {
- grid-template-columns: repeat(3, 1fr);
- gap: 16rpx;
- }
-
- .product-card {
- padding: 28rpx;
- }
-
- .spec-card {
- padding: 28rpx 20rpx;
- min-height: 180rpx;
- }
-
- .title {
- font-size: 32rpx;
- }
-
- .section-title {
- font-size: 28rpx;
- }
-
- .product-name {
- font-size: 28rpx;
- }
-
- .price-value {
- font-size: 32rpx;
- }
-
- .button-group {
- flex-direction: column;
- gap: 12rpx;
- }
-
- .btn-primary,
- .btn-secondary {
- width: 100%;
- }
-}
-
-/* 小屏幕设备适配 */
-@media (max-width: 414rpx) {
- .spec-grid {
- grid-template-columns: repeat(3, 1fr);
- gap: 12rpx;
- }
-
- .spec-card {
- padding: 24rpx 16rpx;
- min-height: 160rpx;
- }
-
- .spec-name {
- font-size: 24rpx;
- }
-
- .price-value {
- font-size: 28rpx;
- }
-}
-
-/* 暂无更多规格提示 */
-.no-more {
- display: flex;
- justify-content: center;
- align-items: center;
- padding: 48rpx 0;
- margin-top: 16rpx;
- margin-bottom: 100rpx; /* 添加底部边距,避免被导航栏遮挡 */
-}
-
-.no-more-text {
- font-size: 24rpx;
- color: #999;
- background: rgba(0, 0, 0, 0.03);
- padding: 12rpx 32rpx;
- border-radius: 30rpx;
- font-weight: 500;
-}
-
-/* 调整规格网格布局,确保不被导航栏遮挡 */
-.spec-section {
- margin-bottom: 40rpx;
-}
diff --git a/pages/evaluate1/product-list.js b/pages/evaluate1/product-list.js
deleted file mode 100644
index 9405738..0000000
--- a/pages/evaluate1/product-list.js
+++ /dev/null
@@ -1,70 +0,0 @@
-Page({
- data: {
- productNames: [],
- loading: false,
- error: ''
- },
- onLoad(options) {
- this.loadProductNames();
- },
-
- loadProductNames() {
- this.setData({ loading: true, error: '' });
-
- const api = require('../../utils/api');
- // 使用较大的pageSize来获取更多商品数据
- api.getProducts(1, 1000).then(result => {
- console.log('API返回结果:', result);
- // 从返回对象中提取products数组,如果不存在则使用空数组
- const products = result.products || [];
- console.log('提取的products数组:', products);
- console.log('products数组长度:', products.length);
-
- // 过滤出price不为空的商品
- const productsWithPrice = products.filter(product => product.price);
- console.log('price不为空的商品:', productsWithPrice);
- console.log('price不为空的商品数量:', productsWithPrice.length);
-
- // 提取这些商品的productName
- const productNames = productsWithPrice.map(product => product.productName);
- console.log('提取的productName数组:', productNames);
-
- // 过滤掉空的productName
- const nonEmptyProductNames = productNames.filter(Boolean);
- console.log('非空的productName数组:', nonEmptyProductNames);
-
- // 去重
- const uniqueProductNames = [...new Set(nonEmptyProductNames)];
- console.log('去重后的productName数组:', uniqueProductNames);
- console.log('去重后的productName数量:', uniqueProductNames.length);
-
- this.setData({
- productNames: uniqueProductNames,
- loading: false
- });
- }).catch(err => {
- console.error('获取商品列表失败:', err);
- this.setData({
- error: '获取商品列表失败,请稍后重试',
- loading: false
- });
- });
- },
-
- selectProduct(e) {
- const productName = e.currentTarget.dataset.product;
- console.log('选择商品:', productName);
- // 将商品名称存储到本地存储,因为wx.switchTab不支持URL参数
- wx.setStorageSync('selectedProductName', productName);
- // 使用wx.switchTab导航到tabBar页面
- wx.switchTab({
- url: '/pages/evaluate1/index',
- success: function(res) {
- console.log('跳转成功:', res);
- },
- fail: function(err) {
- console.error('跳转失败:', err);
- }
- });
- }
-});
\ No newline at end of file
diff --git a/pages/evaluate1/product-list.json b/pages/evaluate1/product-list.json
deleted file mode 100644
index a15d4a3..0000000
--- a/pages/evaluate1/product-list.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "navigationBarTitleText": "选择商品",
- "usingComponents": {}
-}
\ No newline at end of file
diff --git a/pages/evaluate1/product-list.wxml b/pages/evaluate1/product-list.wxml
deleted file mode 100644
index fd570b2..0000000
--- a/pages/evaluate1/product-list.wxml
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
-
-
-
-
- 正在加载商品数据...
-
-
-
-
- ⚠️
- {{error}}
-
-
-
-
-
-
-
-
- 🛍️
- {{item}}
- →
-
-
-
-
-
- 暂无更多商品选择
-
-
-
-
\ No newline at end of file
diff --git a/pages/evaluate1/product-list.wxss b/pages/evaluate1/product-list.wxss
deleted file mode 100644
index 5bd2737..0000000
--- a/pages/evaluate1/product-list.wxss
+++ /dev/null
@@ -1,311 +0,0 @@
-.container {
- display: flex;
- flex-direction: column;
- min-height: 100vh;
- background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
- font-family: 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
- overflow-x: hidden;
- width: 100%;
- box-sizing: border-box;
-}
-
-.header {
- background: #fff;
- box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.08);
- position: sticky;
- top: 0;
- z-index: 10;
-}
-
-.header-content {
- padding: 30rpx 0;
- text-align: center;
- width: 100%;
- box-sizing: border-box;
-}
-
-.title {
- font-size: 36rpx;
- font-weight: 700;
- color: #2c3e50;
- letter-spacing: 2rpx;
-}
-
-.content {
- flex: 1;
- padding: 16rpx;
- width: 100%;
- box-sizing: border-box;
- overflow-x: hidden;
-}
-
-/* 加载状态 */
-.loading {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- padding: 160rpx 0;
-}
-
-.loading-spinner {
- width: 80rpx;
- height: 80rpx;
- border: 8rpx solid rgba(74, 144, 226, 0.2);
- border-top: 8rpx solid #4a90e2;
- border-radius: 50%;
- animation: spin 1s linear infinite;
- margin-bottom: 32rpx;
-}
-
-@keyframes spin {
- 0% { transform: rotate(0deg); }
- 100% { transform: rotate(360deg); }
-}
-
-.loading-text {
- font-size: 28rpx;
- color: #666;
- font-weight: 500;
-}
-
-/* 错误提示卡片 */
-.error-card {
- background: #fff;
- border-radius: 16rpx;
- padding: 48rpx;
- margin: 32rpx 0;
- box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.08);
- display: flex;
- flex-direction: column;
- align-items: center;
- text-align: center;
-}
-
-.error-icon {
- font-size: 80rpx;
- margin-bottom: 24rpx;
-}
-
-.error-text {
- font-size: 28rpx;
- color: #e74c3c;
- margin-bottom: 32rpx;
- line-height: 1.5;
-}
-
-/* 按钮样式 */
-.btn-primary {
- width: 240rpx;
- height: 80rpx;
- line-height: 80rpx;
- font-size: 28rpx;
- font-weight: 600;
- border-radius: 40rpx;
- background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
- color: #fff;
- border: none;
- box-shadow: 0 4rpx 12rpx rgba(96, 165, 250, 0.4);
- transition: all 0.3s ease;
-}
-
-.btn-primary:hover {
- transform: translateY(-2rpx);
- box-shadow: 0 6rpx 16rpx rgba(74, 144, 226, 0.5);
-}
-
-/* 商品列表区域 */
-.product-section {
- margin-top: 24rpx;
-}
-
-.section-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 24rpx;
- padding: 0 8rpx;
-}
-
-.section-title {
- font-size: 30rpx;
- font-weight: 700;
- color: #2c3e50;
- padding-left: 16rpx;
- border-left: 6rpx solid #4a90e2;
-}
-
-.section-count {
- font-size: 24rpx;
- color: #999;
- background: rgba(74, 144, 226, 0.1);
- padding: 6rpx 16rpx;
- border-radius: 20rpx;
-}
-
-/* 商品网格布局 */
-.product-grid {
- display: grid;
- grid-template-columns: repeat(3, 1fr);
- gap: 20rpx;
- margin-top: 16rpx;
- width: 100%;
- box-sizing: border-box;
- overflow-x: hidden;
-}
-
-/* 商品卡片 */
-.product-card {
- background: rgba(255, 255, 255, 0.95);
- border-radius: 20rpx;
- padding: 32rpx 24rpx;
- box-shadow: 0 6rpx 20rpx rgba(0,0,0,0.08);
- transition: all 0.3s ease;
- cursor: pointer;
- position: relative;
- overflow: hidden;
- display: flex;
- flex-direction: column;
- align-items: center;
- text-align: center;
- min-height: 180rpx;
- backdrop-filter: blur(8rpx);
- border: 1rpx solid rgba(255, 255, 255, 0.3);
- width: 100%;
- box-sizing: border-box;
-}
-
-.product-card::before {
- content: '';
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 6rpx;
- background: linear-gradient(90deg, #60a5fa 0%, #3b82f6 100%);
-}
-
-.product-card:hover {
- transform: translateY(-6rpx);
- box-shadow: 0 12rpx 32rpx rgba(0,0,0,0.15);
- background: rgba(255, 255, 255, 1);
-}
-
-.product-card:active {
- transform: translateY(-2rpx);
- box-shadow: 0 8rpx 24rpx rgba(0,0,0,0.12);
-}
-
-.product-icon {
- font-size: 72rpx;
- margin-bottom: 20rpx;
- opacity: 0.9;
- transition: all 0.3s ease;
-}
-
-.product-card:hover .product-icon {
- transform: scale(1.1);
- opacity: 1;
-}
-
-.product-name {
- font-size: 28rpx;
- font-weight: 600;
- color: #2c3e50;
- line-height: 1.4;
- word-break: break-word;
- margin-bottom: 20rpx;
- flex: 1;
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 0 8rpx;
-}
-
-.product-arrow {
- position: absolute;
- bottom: 20rpx;
- right: 24rpx;
- font-size: 28rpx;
- color: #4a90e2;
- font-weight: bold;
- opacity: 0.6;
- transition: all 0.3s ease;
-}
-
-.product-card:hover .product-arrow {
- opacity: 1;
- transform: translateX(4rpx);
-}
-
-/* 响应式设计 */
-@media (max-width: 750rpx) {
- .content {
- padding: 20rpx;
- }
-
- .product-grid {
- grid-template-columns: repeat(3, 1fr);
- gap: 16rpx;
- }
-
- .product-card {
- padding: 28rpx 20rpx;
- min-height: 160rpx;
- }
-
- .title {
- font-size: 32rpx;
- }
-
- .section-title {
- font-size: 28rpx;
- }
-
- .product-name {
- font-size: 24rpx;
- }
-
- .product-icon {
- font-size: 60rpx;
- }
-}
-
-/* 小屏幕设备适配 */
-@media (max-width: 414rpx) {
- .product-grid {
- grid-template-columns: repeat(3, 1fr);
- gap: 12rpx;
- }
-
- .product-card {
- padding: 20rpx 16rpx;
- min-height: 140rpx;
- }
-
- .product-name {
- font-size: 22rpx;
- }
-
- .product-icon {
- font-size: 50rpx;
- }
-}
-
-/* 暂无更多商品提示 */
-.no-more {
- display: flex;
- justify-content: center;
- align-items: center;
- padding: 48rpx 0;
- margin-top: 16rpx;
-}
-
-.no-more-text {
- font-size: 24rpx;
- color: #999;
- background: rgba(0, 0, 0, 0.03);
- padding: 12rpx 32rpx;
- border-radius: 30rpx;
- font-weight: 500;
-}
diff --git a/pages/evaluate1/spec-detail.js b/pages/evaluate1/spec-detail.js
deleted file mode 100644
index 4194c37..0000000
--- a/pages/evaluate1/spec-detail.js
+++ /dev/null
@@ -1,76 +0,0 @@
-Page({
- data: {
- productName: '',
- specification: '',
- price: 0,
- quantity: 1,
- totalPrice: 0,
- loading: false,
- error: ''
- },
- onLoad(options) {
- console.log('接收到的参数:', options);
- // 即使参数不完整,也要尝试获取并设置
- const productName = options.productName ? decodeURIComponent(options.productName) : '';
- const specification = options.specification ? decodeURIComponent(options.specification) : '';
- let price = 0;
-
- if (options.price) {
- const decodedPrice = decodeURIComponent(options.price);
- console.log('解码后的价格:', decodedPrice);
- price = parseFloat(decodedPrice) || 0;
- }
-
- console.log('解析后的参数:', { productName, specification, price });
-
- this.setData({
- productName: productName,
- specification: specification,
- price: price,
- totalPrice: 0 // 初始时总价为0,不显示
- });
- },
-
- // 件数输入变化
- onQuantityChange(e) {
- const quantity = parseInt(e.detail.value) || 1;
- this.setData({
- quantity: quantity
- // 只更新件数,不更新总价,等待点击计算按钮
- });
- },
-
- // 减少数量
- decreaseQuantity() {
- if (this.data.quantity > 1) {
- this.setData({
- quantity: this.data.quantity - 1
- });
- }
- },
-
- // 增加数量
- increaseQuantity() {
- this.setData({
- quantity: this.data.quantity + 1
- });
- },
-
- // 计算价格
- calculatePrice() {
- const totalPrice = Math.round(this.data.price * this.data.quantity * 10) / 10;
- this.setData({
- totalPrice: totalPrice
- });
- wx.showToast({
- title: '计算完成',
- icon: 'success',
- duration: 1000
- });
- },
-
- // 返回上一页
- goBack() {
- wx.navigateBack();
- }
-});
\ No newline at end of file
diff --git a/pages/evaluate1/spec-detail.json b/pages/evaluate1/spec-detail.json
deleted file mode 100644
index df4e0af..0000000
--- a/pages/evaluate1/spec-detail.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "navigationBarTitleText": "规格详情",
- "usingComponents": {}
-}
\ No newline at end of file
diff --git a/pages/evaluate1/spec-detail.wxml b/pages/evaluate1/spec-detail.wxml
deleted file mode 100644
index e4c2898..0000000
--- a/pages/evaluate1/spec-detail.wxml
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-
-
-
-
-
-
- 规格信息
-
- 规格
- {{specification}}
-
-
- 单价
- ¥{{price || 0}}
-
- 您已选择此规格进行估价
-
-
-
-
- 数量设置
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 预估结果
-
- 预估总价
- ¥{{totalPrice}}
-
- 此价格为预估价格,实际价格可能会有所变动
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/evaluate1/spec-detail.wxss b/pages/evaluate1/spec-detail.wxss
deleted file mode 100644
index 8fd2942..0000000
--- a/pages/evaluate1/spec-detail.wxss
+++ /dev/null
@@ -1,401 +0,0 @@
-/* 页面容器 */
-.page-container {
- min-height: 100vh;
- background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
- font-family: 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
- display: flex;
- flex-direction: column;
- box-sizing: border-box;
-}
-
-/* 头部样式 */
-.page-header {
- background: rgba(255, 255, 255, 0.95);
- backdrop-filter: blur(10rpx);
- box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.05);
- padding: 28rpx 0;
- text-align: center;
- position: sticky;
- top: 0;
- z-index: 10;
-}
-
-.header-title {
- font-size: 30rpx;
- font-weight: 700;
- color: #2c3e50;
- letter-spacing: 1rpx;
-}
-
-/* 主要内容区域 */
-.main-content {
- flex: 1;
- padding: 24rpx;
- display: flex;
- flex-direction: column;
- gap: 24rpx;
- padding-bottom: 48rpx;
- box-sizing: border-box;
-}
-
-/* 卡片基础样式 */
-.info-card,
-.control-card,
-.result-card {
- background: rgba(255, 255, 255, 0.95);
- border-radius: 24rpx;
- padding: 32rpx;
- box-shadow: 0 6rpx 24rpx rgba(0,0,0,0.08);
- backdrop-filter: blur(12rpx);
- border: 1rpx solid rgba(255, 255, 255, 0.4);
- transition: all 0.3s ease;
- box-sizing: border-box;
-}
-
-.info-card:hover,
-.control-card:hover,
-.result-card:hover {
- box-shadow: 0 8rpx 32rpx rgba(0,0,0,0.12);
- transform: translateY(-4rpx);
- background: rgba(255, 255, 255, 0.98);
-}
-
-/* 卡片标题 */
-.card-subtitle {
- font-size: 26rpx;
- font-weight: 600;
- color: #64748b;
- margin-bottom: 24rpx;
- padding-bottom: 16rpx;
- border-bottom: 1rpx solid #f1f5f9;
-}
-
-/* 信息行样式 */
-.info-row {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 16rpx 0;
- border-bottom: 1rpx solid #f8fafc;
-}
-
-.info-row:last-child {
- border-bottom: none;
-}
-
-.info-label {
- font-size: 26rpx;
- color: #64748b;
- font-weight: 500;
-}
-
-.info-value {
- font-size: 26rpx;
- font-weight: 600;
- color: #2c3e50;
-}
-
-.info-value.price {
- color: #ef4444;
- font-size: 32rpx;
- font-weight: 700;
-}
-
-/* 提示信息 */
-.info-hint {
- font-size: 22rpx;
- color: #94a3b8;
- text-align: center;
- margin-top: 20rpx;
- padding-top: 20rpx;
- border-top: 1rpx solid #f1f5f9;
-}
-
-/* 数量控制 */
-.quantity-box {
- display: flex;
- align-items: center;
- gap: 24rpx;
- margin-top: 12rpx;
- justify-content: center;
-}
-
-.quantity-btn {
- width: 80rpx;
- height: 80rpx;
- border-radius: 40rpx;
- font-size: 36rpx;
- font-weight: bold;
- background: rgba(255, 255, 255, 0.9);
- color: #3b82f6;
- border: 2rpx solid rgba(96, 165, 250, 0.4);
- backdrop-filter: blur(12rpx);
- display: flex;
- align-items: center;
- justify-content: center;
- transition: all 0.3s ease;
- box-shadow: 0 4rpx 12rpx rgba(0,0,0,0.08);
-}
-
-.quantity-btn:hover {
- background: rgba(59, 130, 246, 0.1);
- border-color: rgba(59, 130, 246, 0.6);
- transform: scale(1.1);
-}
-
-.quantity-btn.minus:hover {
- background: rgba(239, 68, 68, 0.1);
- border-color: rgba(239, 68, 68, 0.6);
- color: #ef4444;
-}
-
-.quantity-btn.plus:hover {
- background: rgba(16, 185, 129, 0.1);
- border-color: rgba(16, 185, 129, 0.6);
- color: #10b981;
-}
-
-.quantity-input {
- width: 160rpx;
- height: 80rpx;
- border: 2rpx solid rgba(96, 165, 250, 0.4);
- border-radius: 16rpx;
- padding: 0 24rpx;
- font-size: 28rpx;
- font-weight: 600;
- text-align: center;
- color: #2c3e50;
- background: rgba(255, 255, 255, 0.95);
- backdrop-filter: blur(12rpx);
- box-shadow: inset 0 2rpx 8rpx rgba(0,0,0,0.08);
- box-sizing: border-box;
-}
-
-/* 按钮区域 */
-.button-section {
- margin-top: 12rpx;
-}
-
-.button-section.bottom {
- margin-top: 20rpx;
-}
-
-/* 按钮样式 */
-.primary-btn {
- width: 100%;
- height: 92rpx;
- line-height: 92rpx;
- font-size: 28rpx;
- font-weight: 600;
- border-radius: 46rpx;
- background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
- color: #fff;
- border: none;
- box-shadow: 0 6rpx 24rpx rgba(59, 130, 246, 0.4);
- transition: all 0.3s ease;
- text-align: center;
-}
-
-.primary-btn:hover {
- transform: translateY(-4rpx);
- box-shadow: 0 8rpx 32rpx rgba(59, 130, 246, 0.5);
-}
-
-.secondary-btn {
- width: 100%;
- height: 84rpx;
- line-height: 84rpx;
- font-size: 26rpx;
- font-weight: 600;
- border-radius: 42rpx;
- background: rgba(255, 255, 255, 0.95);
- color: #3b82f6;
- border: 2rpx solid rgba(59, 130, 246, 0.4);
- backdrop-filter: blur(12rpx);
- transition: all 0.3s ease;
- text-align: center;
- box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.08);
-}
-
-.secondary-btn:hover {
- background: rgba(59, 130, 246, 0.08);
- border-color: rgba(59, 130, 246, 0.6);
- transform: translateY(-4rpx);
- box-shadow: 0 6rpx 24rpx rgba(59, 130, 246, 0.3);
-}
-
-/* 结果卡片 */
-.result-card {
- animation: fadeInUp 0.6s ease-out;
-}
-
-@keyframes fadeInUp {
- from {
- opacity: 0;
- transform: translateY(30rpx);
- }
- to {
- opacity: 1;
- transform: translateY(0);
- }
-}
-
-/* 结果行 */
-.result-row {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 20rpx 0;
-}
-
-.result-label {
- font-size: 26rpx;
- color: #64748b;
- font-weight: 500;
-}
-
-.result-value {
- font-size: 36rpx;
- font-weight: 700;
- color: #ef4444;
- text-shadow: 0 2rpx 4rpx rgba(239, 68, 68, 0.2);
-}
-
-/* 结果提示 */
-.result-hint {
- font-size: 22rpx;
- color: #94a3b8;
- text-align: center;
- margin-top: 16rpx;
- padding-top: 16rpx;
- border-top: 1rpx solid #f1f5f9;
- line-height: 1.5;
-}
-
-/* 响应式设计 */
-@media (max-width: 750rpx) {
- .main-content {
- padding: 20rpx;
- gap: 20rpx;
- }
-
- .info-card,
- .control-card,
- .result-card {
- padding: 28rpx;
- }
-
- .header-title {
- font-size: 28rpx;
- }
-
- .card-subtitle {
- font-size: 24rpx;
- margin-bottom: 20rpx;
- }
-
- .info-label,
- .info-value {
- font-size: 24rpx;
- }
-
- .info-value.price {
- font-size: 30rpx;
- }
-
- .result-value {
- font-size: 32rpx;
- }
-
- .quantity-box {
- gap: 20rpx;
- }
-
- .quantity-btn {
- width: 72rpx;
- height: 72rpx;
- font-size: 32rpx;
- }
-
- .quantity-input {
- width: 140rpx;
- height: 72rpx;
- font-size: 26rpx;
- }
-
- .primary-btn {
- height: 84rpx;
- line-height: 84rpx;
- font-size: 26rpx;
- }
-
- .secondary-btn {
- height: 76rpx;
- line-height: 76rpx;
- font-size: 24rpx;
- }
-}
-
-/* 小屏幕设备适配 */
-@media (max-width: 375rpx) {
- .main-content {
- padding: 16rpx;
- gap: 16rpx;
- }
-
- .info-card,
- .control-card,
- .result-card {
- padding: 24rpx;
- }
-
- .header-title {
- font-size: 26rpx;
- }
-
- .card-subtitle {
- font-size: 22rpx;
- margin-bottom: 16rpx;
- }
-
- .info-label,
- .info-value {
- font-size: 22rpx;
- }
-
- .info-value.price {
- font-size: 28rpx;
- }
-
- .result-value {
- font-size: 28rpx;
- }
-
- .quantity-box {
- gap: 16rpx;
- }
-
- .quantity-btn {
- width: 64rpx;
- height: 64rpx;
- font-size: 28rpx;
- }
-
- .quantity-input {
- width: 120rpx;
- height: 64rpx;
- font-size: 24rpx;
- }
-
- .primary-btn {
- height: 76rpx;
- line-height: 76rpx;
- font-size: 24rpx;
- }
-
- .secondary-btn {
- height: 68rpx;
- line-height: 68rpx;
- font-size: 22rpx;
- }
-}
diff --git a/pages/notopen/index.js b/pages/notopen/index.js
deleted file mode 100644
index 413bfa2..0000000
--- a/pages/notopen/index.js
+++ /dev/null
@@ -1,82 +0,0 @@
-Page({
- // 分享给朋友/群聊
- onShareAppMessage() {
- return {
- title: '鸡蛋贸易平台 - 功能敬请期待',
- path: '/pages/notopen/index',
- imageUrl: '/images/你有好蛋.png'
- }
- },
-
- // 分享到朋友圈
- onShareTimeline() {
- return {
- title: '鸡蛋贸易平台 - 功能敬请期待',
- query: '',
- imageUrl: '/images/你有好蛋.png'
- }
- },
-
- /**
- * 页面的初始数据
- */
- data: {
- },
-
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- },
-
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
-
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
-
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
-
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
-
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
-
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
-
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- },
-
- /**
- * 返回首页
- */
- onBackTap: function () {
- wx.switchTab({
- url: '/pages/index/index'
- })
- }
-})
\ No newline at end of file
diff --git a/pages/notopen/index.json b/pages/notopen/index.json
deleted file mode 100644
index 464cc72..0000000
--- a/pages/notopen/index.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "navigationBarTitleText": "又鸟蛋平台",
- "usingComponents": {}
-}
\ No newline at end of file
diff --git a/pages/notopen/index.wxml b/pages/notopen/index.wxml
deleted file mode 100644
index 369b90a..0000000
--- a/pages/notopen/index.wxml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
- 功能暂未开放
- 该功能正在紧张开发中,敬请期待
-
-
\ No newline at end of file
diff --git a/pages/notopen/index.wxss b/pages/notopen/index.wxss
deleted file mode 100644
index c1e7ef7..0000000
--- a/pages/notopen/index.wxss
+++ /dev/null
@@ -1,69 +0,0 @@
-.container {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- height: 100vh;
- width: 100vw;
- background-color: #ffffff;
- padding: 40rpx;
- box-sizing: border-box;
- margin: 0;
-}
-
-/* 重置页面默认样式 */
-page {
- height: 100vh;
- width: 100vw;
- margin: 0;
- padding: 0;
- background-color: #ffffff;
-}
-
-.icon {
- margin-bottom: 60rpx;
-}
-
-.lock-icon {
- width: 120rpx;
- height: 120rpx;
- background-size: contain;
- background-repeat: no-repeat;
- background-position: center;
- background-image: url('data:image/svg+xml;utf8,');
-}
-
-.title {
- font-size: 36rpx;
- font-weight: bold;
- color: #333333;
- margin-bottom: 24rpx;
-}
-
-.subtitle {
- font-size: 28rpx;
- color: #999999;
- margin-bottom: 80rpx;
- text-align: center;
-}
-
-.back-btn {
- width: 320rpx;
- height: 88rpx;
- background-color: #1989fa;
- color: white;
- font-size: 32rpx;
- border-radius: 44rpx;
- box-shadow: 0 4rpx 16rpx rgba(25, 137, 250, 0.3);
- border: none;
- outline: none;
-}
-
-.back-btn::after {
- border: none;
-}
-
-.back-btn:active {
- background-color: #0c7ad9;
- transform: scale(0.98);
-}
\ No newline at end of file
diff --git a/pages/seller/index.js b/pages/seller/index.js
deleted file mode 100644
index 91e8690..0000000
--- a/pages/seller/index.js
+++ /dev/null
@@ -1,5510 +0,0 @@
-// pages/seller/index.js
-const API = require('../../utils/api.js')
-
-Page({
- // 分享给朋友/群聊
- onShareAppMessage() {
- return {
- title: '我在鸡蛋贸易平台发布了货源',
- path: '/pages/seller/index',
- imageUrl: '/images/你有好蛋.png'
- }
- },
-
- // 分享到朋友圈
- onShareTimeline() {
- return {
- title: '我在鸡蛋贸易平台发布了货源',
- query: '',
- imageUrl: '/images/你有好蛋.png'
- }
- },
- data: {
- supplies: [],
- publishedSupplies: [],
- pendingSupplies: [], // 审核中的货源
- rejectedSupplies: [], // 审核失败的货源
- draftSupplies: [],
- showModal: false,
- showEditModal: false,
- showRejectReasonModal: false, // 控制审核失败原因弹窗显示
- currentRejectSupply: null, // 当前显示的审核失败货源
- rejectReason: '', // 审核失败原因
- showTabBar: true, // 控制底部自定义tab-bar的显示状态
- showSpecSelectModal: false, // 控制规格选择弹窗显示
- modalSpecSearchKeyword: '', // 规格弹窗中的搜索关键词
- filteredModalSpecOptions: [], // 弹窗中过滤后的规格选项
- selectedModalSpecIndex: -1, // 弹窗中选中的规格索引
- currentSpecMode: 'create', // 当前规格选择模式:create 或 edit
- showNameSelectModal: false, // 控制商品名称选择弹窗显示
- showYolkSelectModal: false, // 控制蛋黄选择弹窗显示
- selectedNameIndex: -1, // 商品名称弹窗中选中的索引
- selectedYolkIndex: -1,//蛋黄弹窗中选中的索引,
- // 商品名称选项列表
- productNameOptions: ['罗曼粉', '伊莎粉', '罗曼灰', '海蓝灰', '海蓝褐', '绿壳', '粉一', '粉二', '粉八', '京粉1号', '京红', '京粉6号', '京粉3号', '农大系列', '黑鸡土蛋', '双黄蛋', '大午金凤', '黑凤'],
- // 蛋黄选项
- yolkOptions: ['红心', '黄心', '双色'],
- // 规格选项
- specOptions: ['格子装', '散托', '不限规格', '净重47+', '净重46-47', '净重45-46', '净重44-45', '净重43-44', '净重42-43', '净重41-42', '净重40-41', '净重39-40', '净重38-39', '净重37-39', '净重37-38', '净重36-38', '净重36-37', '净重35-36', '净重34-35', '净重33-34', '净重32-33', '净重32-34', '净重31-32', '净重30-35', '净重30-34', '净重30-32', '净重30-31', '净重29-31', '净重29-30', '净重28-29', '净重28以下', '毛重52以上', '毛重50-51', '毛重48-49', '毛重47-48', '毛重46-47', '毛重45-47', '毛重45-46', '毛重44-45', '毛重43-44', '毛重42-43', '毛重41-42', '毛重40-41', '毛重38-39', '毛重36-37', '毛重34-35', '毛重32-33', '毛重30-31', '毛重30以下'],
- // 规格搜索相关变量
- specSearchKeyword: '', // 创建货源弹窗中的规格搜索关键词
- editSpecSearchKeyword: '', // 编辑货源弹窗中的规格搜索关键词
- filteredSpecOptions: [], // 过滤后的规格选项数组
- filteredEditSpecOptions: [], // 编辑货源过滤后的规格选项数组
- // 地区选择相关变量 - 三级联动
- showRegionSelectModal: false, // 控制地区选择弹窗显示
- currentRegionMode: 'create', // 当前地区选择模式:create 或 edit
- // 三级联动地区数据结构
- regionOptions: [
- // 直辖市
- {
- name: '北京市',
- cities: [
- {
- name: '北京市',
- districts: ['东城区', '西城区', '朝阳区', '丰台区', '石景山区', '海淀区', '门头沟区', '房山区', '通州区', '顺义区', '昌平区', '大兴区', '怀柔区', '平谷区', '密云区', '延庆区']
- }
- ]
- },
- {
- name: '陕西省',
- cities: [
- { name: '西安市', districts: ['新城区', '碑林区', '莲湖区', '灞桥区', '未央区', '雁塔区', '阎良区', '临潼区', '长安区', '高陵区', '鄠邑区', '蓝田县', '周至县'] },
- { name: '铜川市', districts: ['王益区', '印台区', '耀州区', '宜君县'] },
- { name: '宝鸡市', districts: ['渭滨区', '金台区', '陈仓区', '凤翔区', '岐山县', '扶风县', '眉县', '陇县', '千阳县', '麟游县', '凤县', '太白县'] },
- { name: '咸阳市', districts: ['秦都区', '杨陵区', '渭城区', '兴平市', '三原县', '泾阳县', '乾县', '礼泉县', '永寿县', '长武县', '旬邑县', '淳化县', '武功县'] },
- { name: '渭南市', districts: ['临渭区', '华州区', '韩城市', '华阴市', '潼关县', '大荔县', '合阳县', '澄城县', '蒲城县', '白水县', '富平县'] },
- { name: '延安市', districts: ['宝塔区', '安塞区', '延长县', '延川县', '子长市', '志丹县', '吴起县', '甘泉县', '富县', '洛川县', '宜川县', '黄龙县', '黄陵县'] },
- { name: '汉中市', districts: ['汉台区', '南郑区', '城固县', '洋县', '西乡县', '勉县', '宁强县', '略阳县', '镇巴县', '留坝县', '佛坪县'] },
- { name: '榆林市', districts: ['榆阳区', '横山区', '神木市', '府谷县', '靖边县', '定边县', '绥德县', '米脂县', '佳县', '吴堡县', '清涧县', '子洲县'] },
- { name: '安康市', districts: ['汉滨区', '汉阴县', '石泉县', '宁陕县', '紫阳县', '岚皋县', '平利县', '镇坪县', '旬阳市', '白河县'] },
- { name: '商洛市', districts: ['商州区', '洛南县', '丹凤县', '商南县', '山阳县', '镇安县', '柞水县'] }
- ]
- },
- {
- name: '甘肃省',
- cities: [
- { name: '兰州市', districts: ['城关区', '七里河区', '西固区', '安宁区', '红古区', '永登县', '皋兰县', '榆中县'] },
- { name: '嘉峪关市', districts: ['嘉峪关市'] },
- { name: '金昌市', districts: ['金川区', '永昌县'] },
- { name: '白银市', districts: ['白银区', '平川区', '靖远县', '会宁县', '景泰县'] },
- { name: '天水市', districts: ['秦州区', '麦积区', '清水县', '秦安县', '甘谷县', '武山县', '张家川回族自治县'] },
- { name: '武威市', districts: ['凉州区', '民勤县', '古浪县', '天祝藏族自治县'] },
- { name: '张掖市', districts: ['甘州区', '肃南裕固族自治县', '民乐县', '临泽县', '高台县', '山丹县'] },
- { name: '平凉市', districts: ['崆峒区', '泾川县', '灵台县', '崇信县', '华亭市', '庄浪县', '静宁县'] },
- { name: '酒泉市', districts: ['肃州区', '金塔县', '瓜州县', '肃北蒙古族自治县', '阿克塞哈萨克族自治县', '玉门市', '敦煌市'] },
- { name: '庆阳市', districts: ['西峰区', '庆城县', '环县', '华池县', '合水县', '正宁县', '宁县', '镇原县'] },
- { name: '定西市', districts: ['安定区', '通渭县', '陇西县', '渭源县', '临洮县', '漳县', '岷县'] },
- { name: '陇南市', districts: ['武都区', '成县', '文县', '宕昌县', '康县', '西和县', '礼县', '徽县', '两当县'] },
- { name: '临夏回族自治州', districts: ['临夏市', '临夏县', '康乐县', '永靖县', '广河县', '和政县', '东乡族自治县', '积石山保安族东乡族撒拉族自治县'] },
- { name: '甘南藏族自治州', districts: ['合作市', '临潭县', '卓尼县', '舟曲县', '迭部县', '玛曲县', '碌曲县', '夏河县'] }
- ]
- },
- {
- name: '青海省',
- cities: [
- { name: '西宁市', districts: ['城东区', '城中区', '城西区', '城北区', '大通回族土族自治县', '湟中区', '湟源县'] },
- { name: '海东市', districts: ['乐都区', '平安区', '民和回族土族自治县', '互助土族自治县', '化隆回族自治县', '循化撒拉族自治县'] },
- { name: '海北藏族自治州', districts: ['海晏县', '祁连县', '刚察县', '门源回族自治县'] },
- { name: '黄南藏族自治州', districts: ['同仁市', '尖扎县', '泽库县', '河南蒙古族自治县'] },
- { name: '海南藏族自治州', districts: ['共和县', '同德县', '贵德县', '兴海县', '贵南县'] },
- { name: '果洛藏族自治州', districts: ['玛沁县', '班玛县', '甘德县', '达日县', '久治县', '玛多县'] },
- { name: '玉树藏族自治州', districts: ['玉树市', '杂多县', '称多县', '治多县', '囊谦县', '曲麻莱县'] },
- { name: '海西蒙古族藏族自治州', districts: ['格尔木市', '德令哈市', '茫崖市', '天峻县', '都兰县', '乌兰县'] }
- ]
- },
- {
- name: '台湾省',
- cities: [
- { name: '台北市', districts: ['中正区', '大同区', '中山区', '松山区', '大安区', '万华区', '信义区', '士林区', '北投区', '内湖区', '南港区', '文山区'] },
- { name: '高雄市', districts: ['新兴区', '前金区', '苓雅区', '盐埕区', '鼓山区', '旗津区', '前镇区', '三民区', '楠梓区', '小港区', '左营区', '仁武区', '大树区', '鸟松区', '冈山区', '桥头区', '燕巢区', '田寮区', '阿莲区', '路竹区', '湖内区', '茄萣区', '永安区', '弥陀区', '梓官区', '旗山区', '美浓区', '六龟区', '甲仙区', '杉林区', '内门区', '茂林区', '桃源区', '那玛夏区'] },
- { name: '新北市', districts: ['板桥区', '三重区', '中和区', '永和区', '新庄区', '新店区', '树林区', '莺歌区', '三峡区', '淡水区', '汐止区', '瑞芳区', '土城区', '芦洲区', '五股区', '泰山区', '林口区', '八里区', '三芝区', '石门区', '金山区', '万里区', '金山区', '贡寮区', '坪林区', '乌来区', '深坑区', '石碇区', '新店区', '双溪区', '平溪区', '中山区', '大同区', '中正区', '万华区', '信义区', '松山区', '大安区', '南港区', '内湖区', '士林区', '北投区', '文山区'] },
- { name: '台中市', districts: ['中区', '东区', '南区', '西区', '北区', '北屯区', '西屯区', '南屯区', '太平区', '大里区', '雾峰区', '乌日区', '丰原区', '后里区', '石冈区', '东势区', '和平区', '新社区', '潭子区', '大雅区', '神冈区', '大肚区', '沙鹿区', '龙井区', '梧栖区', '清水区', '大甲区', '外埔区', '大安区长'] },
- { name: '台南市', districts: ['中西区', '东区', '南区', '北区', '安平区', '安南区', '永康区', '归仁区', '新化区', '左镇区', '玉井区', '楠西区', '南化区', '仁德区', '关庙区', '龙崎区', '官田区', '麻豆区', '佳里区', '西港区', '七股区', '将军区', '学甲区', '北门区', '新营区', '后壁区', '白河区', '东山区', '六甲区', '下营区', '柳营区', '盐水区', '善化区', '大内区', '山上区', '新市', '安定区'] },
- { name: '桃园市', districts: ['桃园区', '中坜区', '平镇区', '八德区', '杨梅区', '芦竹区', '大溪区', '龙潭区', '龟山区', '大园区', '观音区', '新屋区', '复兴区'] },
- { name: '宜兰县', districts: ['宜兰市', '头城镇', '罗东镇', '苏澳镇', '礁溪乡', '壮围乡', '员山乡', '冬山乡', '五结乡', '三星乡', '大同乡', '南澳乡'] },
- { name: '新竹县', districts: ['竹北市', '竹东镇', '新埔镇', '关西镇', '湖口乡', '新丰乡', '芎林乡', '宝山乡', '北埔乡', '峨眉乡', '尖石乡', '横山乡', '五峰乡'] },
- { name: '苗栗县', districts: ['苗栗市', '苑里镇', '通霄镇', '后龙镇', '竹南镇', '头份市', '造桥乡', '西湖乡', '头屋乡', '公馆乡', '铜锣乡', '三义乡', '西湖乡', '南庄乡', '大湖乡', '卓兰镇', '泰安乡'] },
- { name: '彰化县', districts: ['彰化市', '和美镇', '鹿港镇', '溪湖镇', '员林市', '北斗镇', '田中镇', '二林镇', '永靖乡', '伸港乡', '线西乡', '福兴乡', '秀水乡', '花坛乡', '芬园乡', '大村乡', '埔盐乡', '埔心乡', '溪州乡', '竹塘乡', '社头乡', '二水乡', '田尾乡', '埤头乡', '芳苑乡', '大城乡', '竹塘乡', '溪湖乡', '埤头乡'] },
- { name: '南投县', districts: ['南投市', '埔里镇', '草屯镇', '竹山镇', '集集镇', '名间乡', '鹿谷乡', '中寮乡', '鱼池乡', '国姓乡', '水里乡', '信义乡', '仁爱乡'] },
- { name: '云林县', districts: ['斗六市', '斗南镇', '虎尾镇', '土库镇', '西螺镇', '北港镇', '古坑乡', '大埤乡', '莿桐乡', '林内乡', '二仑乡', '仑背乡', '麦寮乡', '东势乡', '褒忠乡', '台西乡', '元长乡', '四湖乡', '口湖乡', '水林乡'] },
- { name: '嘉义县', districts: ['太保市', '朴子市', '布袋镇', '大林镇', '民雄乡', '溪口乡', '新港乡', '六脚乡', '东石乡', '义竹乡', '鹿草乡', '水上乡', '中埔乡', '竹崎乡', '梅山乡', '番路乡', '大埔乡', '阿里山乡'] },
- { name: '屏东县', districts: ['屏东市', '潮州镇', '东港镇', '恒春镇', '万丹乡', '长治乡', '麟洛乡', '九如乡', '里港乡', '盐埔乡', '高树乡', '万峦乡', '内埔乡', '竹田乡', '新埤乡', '枋寮乡', '枋山乡', '春日乡', '来义乡', '富里乡', '狮子乡', '牡丹乡', '车城乡', '满州乡', '枋寮乡', '三地门乡', '雾台乡'] },
- { name: '台东县', districts: ['台东市', '成功镇', '关山镇', '卑南乡', '鹿野乡', '池上乡', '东河乡', '长滨乡', '太麻里乡', '金峰乡', '大武乡', '绿岛乡', '兰屿乡', '延平乡', '海端乡', '达仁乡'] },
- { name: '花莲县', districts: ['花莲市', '凤林镇', '玉里镇', '新城乡', '吉安乡', '寿丰乡', '秀林乡', '光复乡', '丰滨乡', '瑞穗乡', '富里乡', '万荣乡', '卓溪乡'] },
- { name: '澎湖县', districts: ['马公市', '湖西乡', '白沙乡', '西屿乡', '望安乡', '七美乡'] },
- { name: '金门县', districts: ['金城镇', '金湖镇', '金沙镇', '金宁乡', '烈屿乡', '乌丘乡'] },
- { name: '连江县', districts: ['南竿乡', '北竿乡', '莒光乡', '东引乡'] }
- ]
- },
- {
- name: '云南省',
- cities: [
- { name: '昆明市', districts: ['五华区', '盘龙区', '官渡区', '西山区', '东川区', '呈贡区', '晋宁区', '富民县', '宜良县', '石林彝族自治县', '嵩明县', '禄劝彝族苗族自治县', '寻甸回族彝族自治县'] },
- { name: '曲靖市', districts: ['麒麟区', '沾益区', '马龙区', '宣威市', '富源县', '罗平县', '师宗县', '陆良县', '会泽县'] },
- { name: '玉溪市', districts: ['红塔区', '江川区', '澄江市', '通海县', '华宁县', '易门县', '峨山彝族自治县', '新平彝族傣族自治县', '元江哈尼族彝族傣族自治县'] },
- { name: '保山市', districts: ['隆阳区', '腾冲市', '施甸县', '龙陵县', '昌宁县'] },
- { name: '昭通市', districts: ['昭阳区', '鲁甸县', '巧家县', '盐津县', '大关县', '永善县', '绥江县', '镇雄县', '彝良县', '威信县', '水富市'] },
- { name: '丽江市', districts: ['古城区', '玉龙纳西族自治县', '永胜县', '华坪县', '宁蒗彝族自治县'] },
- { name: '普洱市', districts: ['思茅区', '宁洱哈尼族彝族自治县', '墨江哈尼族自治县', '景东彝族自治县', '景谷傣族彝族自治县', '镇沅彝族哈尼族拉祜族自治县', '江城哈尼族彝族自治县', '孟连傣族拉祜族佤族自治县', '澜沧拉祜族自治县', '西盟佤族自治县'] },
- { name: '临沧市', districts: ['临翔区', '凤庆县', '云县', '永德县', '镇康县', '双江拉祜族佤族布朗族傣族自治县', '耿马傣族佤族自治县', '沧源佤族自治县'] },
- { name: '楚雄彝族自治州', districts: ['楚雄市', '双柏县', '牟定县', '南华县', '姚安县', '大姚县', '永仁县', '元谋县', '武定县', '禄丰市'] },
- { name: '红河哈尼族彝族自治州', districts: ['蒙自市', '个旧市', '开远市', '弥勒市', '建水县', '石屏县', '泸西县', '元阳县', '红河县', '金平苗族瑶族傣族自治县', '绿春县', '屏边苗族自治县', '河口瑶族自治县'] },
- { name: '文山壮族苗族自治州', districts: ['文山市', '砚山县', '西畴县', '麻栗坡县', '马关县', '丘北县', '广南县', '富宁县'] },
- { name: '西双版纳傣族自治州', districts: ['景洪市', '勐海县', '勐腊县'] },
- { name: '大理白族自治州', districts: ['大理市', '漾濞彝族自治县', '祥云县', '宾川县', '弥渡县', '南涧彝族自治县', '巍山彝族回族自治县', '永平县', '云龙县', '洱源县', '剑川县', '鹤庆县'] },
- { name: '德宏傣族景颇族自治州', districts: ['芒市', '瑞丽市', '梁河县', '盈江县', '陇川县'] },
- { name: '怒江傈僳族自治州', districts: ['泸水市', '福贡县', '贡山独龙族怒族自治县', '兰坪白族普米族自治县'] },
- { name: '迪庆藏族自治州', districts: ['香格里拉市', '德钦县', '维西傈僳族自治县'] }
- ]
- },
- {
- name: '贵州省',
- cities: [
- { name: '贵阳市', districts: ['南明区', '云岩区', '花溪区', '乌当区', '白云区', '观山湖区', '开阳县', '息烽县', '修文县', '清镇市'] },
- { name: '六盘水市', districts: ['钟山区', '六枝特区', '水城区', '盘州市'] },
- { name: '遵义市', districts: ['红花岗区', '汇川区', '播州区', '赤水市', '仁怀市', '桐梓县', '绥阳县', '正安县', '道真仡佬族苗族自治县', '务川仡佬族苗族自治县', '凤冈县', '湄潭县', '余庆县', '习水县'] },
- { name: '安顺市', districts: ['西秀区', '平坝区', '普定县', '镇宁布依族苗族自治县', '关岭布依族苗族自治县', '紫云苗族布依族自治县'] },
- { name: '毕节市', districts: ['七星关区', '赫章县', '威宁彝族回族苗族自治县', '纳雍县', '织金县', '黔西县', '金沙县', '大方县'] },
- { name: '铜仁市', districts: ['碧江区', '万山区', '江口县', '玉屏侗族自治县', '石阡县', '思南县', '印江土家族苗族自治县', '德江县', '沿河土家族自治县', '松桃苗族自治县'] },
- { name: '黔东南苗族侗族自治州', districts: ['凯里市', '黄平县', '施秉县', '三穗县', '镇远县', '岑巩县', '天柱县', '锦屏县', '剑河县', '台江县', '黎平县', '榕江县', '从江县', '雷山县', '麻江县', '丹寨县'] },
- { name: '黔南布依族苗族自治州', districts: ['都匀市', '福泉市', '荔波县', '贵定县', '瓮安县', '独山县', '平塘县', '罗甸县', '长顺县', '龙里县', '惠水县', '三都水族自治县'] },
- { name: '黔西南布依族苗族自治州', districts: ['兴义市', '兴仁市', '普安县', '晴隆县', '贞丰县', '望谟县', '册亨县', '安龙县'] }
- ]
- },
- {
- name: '海南省',
- cities: [
- { name: '海口市', districts: ['秀英区', '龙华区', '琼山区', '美兰区'] },
- { name: '三亚市', districts: ['吉阳区', '天涯区', '海棠区', '崖州区'] },
- { name: '三沙市', districts: ['西沙区', '南沙区'] },
- { name: '儋州市', districts: ['那大镇', '和庆镇', '南丰镇', '大成镇', '雅星镇', '兰洋镇', '光村镇', '木棠镇', '海头镇', '峨蔓镇', '王五镇', '白马井镇', '中和镇', '排浦镇', '东成镇'] },
- { name: '五指山市', districts: ['通什镇', '南圣镇', '毛阳镇', '番阳镇', '水满乡', '畅好乡', '毛道乡'] },
- { name: '文昌市', districts: ['文城镇', '重兴镇', '蓬莱镇', '会文镇', '东路镇', '潭牛镇', '东阁镇', '文教镇', '东郊镇', '龙楼镇', '昌洒镇', '翁田镇', '抱罗镇', '冯坡镇', '锦山镇', '铺前镇', '公坡镇'] },
- { name: '琼海市', districts: ['嘉积镇', '万泉镇', '石壁镇', '中原镇', '博鳌镇', '阳江镇', '龙江镇', '潭门镇', '塔洋镇', '长坡镇', '会山镇', '大路镇'] },
- { name: '万宁市', districts: ['万城镇', '龙滚镇', '山根镇', '和乐镇', '后安镇', '大茂镇', '东澳镇', '礼纪镇', '长丰镇', '北大镇', '南桥镇', '三更罗镇', '东兴农场', '东和农场'] },
- { name: '东方市', districts: ['八所镇', '东河镇', '大田镇', '感城镇', '板桥镇', '三家镇', '四更镇', '新龙镇', '天安乡', '江边乡'] },
- { name: '定安县', districts: ['定城镇', '新竹镇', '龙湖镇', '雷鸣镇', '龙门镇', '岭口镇', '翰林镇', '龙河镇', '黄竹镇', '富文镇'] },
- { name: '屯昌县', districts: ['屯城镇', '新兴镇', '枫木镇', '乌坡镇', '南吕镇', '南坤镇', '坡心镇', '西昌镇'] },
- { name: '澄迈县', districts: ['金江镇', '老城镇', '瑞溪镇', '永发镇', '加乐镇', '文儒镇', '中兴镇', '仁兴镇', '福山镇', '桥头镇', '大丰镇', '邦溪镇'] },
- { name: '临高县', districts: ['临城镇', '波莲镇', '东英镇', '博厚镇', '皇桐镇', '多文镇', '和舍镇', '南宝镇', '新盈镇', '调楼镇', '加来镇'] },
- { name: '白沙黎族自治县', districts: ['牙叉镇', '七坊镇', '打安镇', '邦溪镇', '南开乡', '元门乡', '阜龙乡', '细水乡', '青松乡', '金波乡', '荣邦乡'] },
- { name: '昌江黎族自治县', districts: ['石碌镇', '叉河镇', '十月田镇', '乌烈镇', '昌化镇', '海尾镇', '七叉镇', '王下乡'] },
- { name: '乐东黎族自治县', districts: ['抱由镇', '万冲镇', '大安镇', '志仲镇', '千家镇', '九所镇', '利国镇', '黄流镇', '佛罗镇', '尖峰镇', '莺歌海镇', '尖峰岭', '山荣农场'] },
- { name: '陵水黎族自治县', districts: ['椰林镇', '新村镇', '英州镇', '本号镇', '隆广镇', '三才镇', '光坡镇', '文罗镇', '黎安镇', '提蒙乡', '群英乡'] },
- { name: '保亭黎族苗族自治县', districts: ['保城镇', '什玲镇', '加茂镇', '响水镇', '新政镇', '三道镇', '六弓乡', '南林乡', '毛感乡'] },
- { name: '琼中黎族苗族自治县', districts: ['营根镇', '湾岭镇', '黎母山镇', '和平镇', '长征镇', '红毛镇', '中平镇', '吊罗山乡', '上安乡', '什运乡'] }
- ]
- },
- {
- name: '内蒙古自治区',
- cities: [
- { name: '呼和浩特市', districts: ['新城区', '回民区', '玉泉区', '赛罕区', '土默特左旗', '托克托县', '和林格尔县', '清水河县', '武川县'] },
- { name: '包头市', districts: ['东河区', '昆都仑区', '青山区', '石拐区', '白云鄂博矿区', '九原区', '土默特右旗', '固阳县', '达尔罕茂明安联合旗'] },
- { name: '乌海市', districts: ['海勃湾区', '海南区', '乌达区'] },
- { name: '赤峰市', districts: ['红山区', '元宝山区', '松山区', '阿鲁科尔沁旗', '巴林左旗', '巴林右旗', '林西县', '克什克腾旗', '翁牛特旗', '喀喇沁旗', '宁城县', '敖汉旗'] },
- { name: '通辽市', districts: ['科尔沁区', '霍林郭勒市', '科尔沁左翼中旗', '科尔沁左翼后旗', '开鲁县', '库伦旗', '奈曼旗', '扎鲁特旗'] },
- { name: '鄂尔多斯市', districts: ['东胜区', '康巴什区', '达拉特旗', '准格尔旗', '鄂托克前旗', '鄂托克旗', '杭锦旗', '乌审旗', '伊金霍洛旗'] },
- { name: '呼伦贝尔市', districts: ['海拉尔区', '扎赉诺尔区', '满洲里市', '牙克石市', '扎兰屯市', '额尔古纳市', '根河市', '阿荣旗', '莫力达瓦达斡尔族自治旗', '鄂伦春自治旗', '鄂温克族自治旗', '陈巴尔虎旗', '新巴尔虎左旗', '新巴尔虎右旗'] },
- { name: '巴彦淖尔市', districts: ['临河区', '五原县', '磴口县', '乌拉特前旗', '乌拉特中旗', '乌拉特后旗', '杭锦后旗'] },
- { name: '乌兰察布市', districts: ['集宁区', '丰镇市', '卓资县', '化德县', '商都县', '兴和县', '凉城县', '察哈尔右翼前旗', '察哈尔右翼中旗', '察哈尔右翼后旗', '四子王旗'] },
- { name: '兴安盟', districts: ['乌兰浩特市', '阿尔山市', '科尔沁右翼前旗', '科尔沁右翼中旗', '扎赉特旗', '突泉县'] },
- { name: '锡林郭勒盟', districts: ['锡林浩特市', '二连浩特市', '阿巴嘎旗', '苏尼特左旗', '苏尼特右旗', '东乌珠穆沁旗', '西乌珠穆沁旗', '太仆寺旗', '镶黄旗', '正镶白旗', '正蓝旗', '多伦县'] },
- { name: '阿拉善盟', districts: ['阿拉善左旗', '阿拉善右旗', '额济纳旗'] }
- ]
- },
- {
- name: '广西壮族自治区',
- cities: [
- { name: '南宁市', districts: ['兴宁区', '青秀区', '江南区', '西乡塘区', '良庆区', '邕宁区', '武鸣区', '隆安县', '马山县', '上林县', '宾阳县', '横州市'] },
- { name: '柳州市', districts: ['城中区', '鱼峰区', '柳南区', '柳北区', '柳江区', '柳城县', '鹿寨县', '融安县', '融水苗族自治县', '三江侗族自治县'] },
- { name: '桂林市', districts: ['秀峰区', '叠彩区', '象山区', '七星区', '雁山区', '临桂区', '阳朔县', '灵川县', '全州县', '兴安县', '永福县', '灌阳县', '龙胜各族自治县', '资源县', '平乐县', '荔浦市', '恭城瑶族自治县'] },
- { name: '梧州市', districts: ['万秀区', '长洲区', '龙圩区', '苍梧县', '藤县', '蒙山县', '岑溪市'] },
- { name: '北海市', districts: ['海城区', '银海区', '铁山港区', '合浦县'] },
- { name: '防城港市', districts: ['港口区', '防城区', '上思县', '东兴市'] },
- { name: '钦州市', districts: ['钦南区', '钦北区', '灵山县', '浦北县'] },
- { name: '贵港市', districts: ['港北区', '港南区', '覃塘区', '平南县', '桂平市'] },
- { name: '玉林市', districts: ['玉州区', '福绵区', '容县', '陆川县', '博白县', '兴业县', '北流市'] },
- { name: '百色市', districts: ['右江区', '田阳区', '田东县', '德保县', '那坡县', '凌云县', '乐业县', '田林县', '西林县', '隆林各族自治县', '靖西市', '平果市'] },
- { name: '贺州市', districts: ['八步区', '平桂区', '昭平县', '钟山县', '富川瑶族自治县'] },
- { name: '河池市', districts: ['金城江区', '宜州区', '南丹县', '天峨县', '凤山县', '东兰县', '罗城仫佬族自治县', '环江毛南族自治县', '巴马瑶族自治县', '都安瑶族自治县', '大化瑶族自治县'] },
- { name: '来宾市', districts: ['兴宾区', '忻城县', '象州县', '武宣县', '金秀瑶族自治县', '合山市'] },
- { name: '崇左市', districts: ['江州区', '扶绥县', '宁明县', '龙州县', '大新县', '天等县', '凭祥市'] }
- ]
- },
- {
- name: '西藏自治区',
- cities: [
- { name: '拉萨市', districts: ['城关区', '堆龙德庆区', '达孜区', '林周县', '当雄县', '尼木县', '曲水县', '墨竹工卡县'] },
- { name: '日喀则市', districts: ['桑珠孜区', '南木林县', '江孜县', '定日县', '萨迦县', '拉孜县', '昂仁县', '谢通门县', '白朗县', '仁布县', '康马县', '定结县', '仲巴县', '亚东县', '吉隆县', '聂拉木县', '萨嘎县', '岗巴县'] },
- { name: '昌都市', districts: ['卡若区', '江达县', '贡觉县', '类乌齐县', '丁青县', '察雅县', '八宿县', '左贡县', '芒康县', '洛隆县', '边坝县'] },
- { name: '林芝市', districts: ['巴宜区', '工布江达县', '米林县', '墨脱县', '波密县', '察隅县', '朗县'] },
- { name: '山南市', districts: ['乃东区', '扎囊县', '贡嘎县', '桑日县', '琼结县', '曲松县', '措美县', '洛扎县', '加查县', '隆子县', '错那市', '浪卡子县'] },
- { name: '那曲市', districts: ['色尼区', '嘉黎县', '比如县', '聂荣县', '安多县', '申扎县', '索县', '班戈县', '巴青县', '尼玛县', '双湖县'] },
- { name: '阿里地区', districts: ['噶尔县', '普兰县', '札达县', '日土县', '革吉县', '改则县', '措勤县'] }
- ]
- },
- {
- name: '宁夏回族自治区',
- cities: [
- { name: '银川市', districts: ['兴庆区', '西夏区', '金凤区', '永宁县', '贺兰县', '灵武市'] },
- { name: '石嘴山市', districts: ['大武口区', '惠农区', '平罗县'] },
- { name: '吴忠市', districts: ['利通区', '红寺堡区', '盐池县', '同心县', '青铜峡市'] },
- { name: '固原市', districts: ['原州区', '西吉县', '隆德县', '泾源县', '彭阳县'] },
- { name: '中卫市', districts: ['沙坡头区', '中宁县', '海原县'] }
- ]
- },
- {
- name: '新疆维吾尔自治区',
- cities: [
- { name: '乌鲁木齐市', districts: ['天山区', '沙依巴克区', '新市区', '水磨沟区', '头屯河区', '达坂城区', '米东区', '乌鲁木齐县'] },
- { name: '克拉玛依市', districts: ['克拉玛依区', '独山子区', '白碱滩区', '乌尔禾区'] },
- { name: '吐鲁番市', districts: ['高昌区', '鄯善县', '托克逊县'] },
- { name: '哈密市', districts: ['伊州区', '巴里坤哈萨克自治县', '伊吾县'] },
- { name: '昌吉回族自治州', districts: ['昌吉市', '阜康市', '呼图壁县', '玛纳斯县', '奇台县', '吉木萨尔县', '木垒哈萨克自治县'] },
- { name: '博尔塔拉蒙古自治州', districts: ['博乐市', '阿拉山口市', '精河县', '温泉县'] },
- { name: '巴音郭楞蒙古自治州', districts: ['库尔勒市', '轮台县', '尉犁县', '若羌县', '且末县', '焉耆回族自治县', '和静县', '和硕县', '博湖县'] },
- { name: '阿克苏地区', districts: ['阿克苏市', '温宿县', '库车市', '沙雅县', '新和县', '拜城县', '乌什县', '阿瓦提县', '柯坪县'] },
- { name: '克孜勒苏柯尔克孜自治州', districts: ['阿图什市', '阿克陶县', '阿合奇县', '乌恰县'] },
- { name: '喀什地区', districts: ['喀什市', '疏附县', '疏勒县', '英吉沙县', '泽普县', '莎车县', '叶城县', '麦盖提县', '岳普湖县', '伽师县', '巴楚县', '塔什库尔干塔吉克自治县'] },
- { name: '和田地区', districts: ['和田市', '和田县', '墨玉县', '皮山县', '洛浦县', '策勒县', '于田县', '民丰县'] },
- { name: '伊犁哈萨克自治州', districts: ['伊宁市', '奎屯市', '霍尔果斯市', '伊宁县', '察布查尔锡伯自治县', '霍城县', '巩留县', '新源县', '昭苏县', '特克斯县', '尼勒克县'] },
- { name: '塔城地区', districts: ['塔城市', '乌苏市', '额敏县', '沙湾市', '托里县', '裕民县', '和布克赛尔蒙古自治县'] },
- { name: '阿勒泰地区', districts: ['阿勒泰市', '布尔津县', '富蕴县', '福海县', '哈巴河县', '青河县', '吉木乃县'] },
- { name: '石河子市', districts: ['新城街道', '向阳街道', '红山街道', '老街街道', '东城街道', '北泉镇', '石河子总场'] },
- { name: '阿拉尔市', districts: ['幸福路街道', '金银川路街道', '青松路街道', '南口街道', '托喀依乡'] },
- { name: '图木舒克市', districts: ['齐干却勒街道', '前海街道', '永安坝街道', '草湖镇'] },
- { name: '五家渠市', districts: ['军垦路街道', '青湖路街道', '人民路街道', '梧桐镇', '蔡家湖镇'] },
- { name: '铁门关市', districts: ['迎宾街道', '二十九团', '三十团'] },
- { name: '双河市', districts: ['红星路街道', '八十一团', '八十四团'] },
- { name: '可克达拉市', districts: ['幸福路街道', '六十六团', '六十七团'] },
- { name: '昆玉市', districts: ['昆泉镇', '二二四团', '四十七团'] },
- { name: '胡杨河市', districts: ['金山路街道', '一二九团', '一三三团'] },
- { name: '新星市', districts: ['中心团场'] }
- ]
- },
- {
- name: '上海市',
- cities: [
- {
- name: '上海市',
- districts: ['黄浦区', '徐汇区', '长宁区', '静安区', '普陀区', '虹口区', '杨浦区', '闵行区', '宝山区', '嘉定区', '浦东新区', '金山区', '松江区', '青浦区', '奉贤区', '崇明区']
- }
- ]
- },
- {
- name: '天津市',
- cities: [
- {
- name: '天津市',
- districts: ['和平区', '河东区', '河西区', '南开区', '河北区', '红桥区', '东丽区', '西青区', '津南区', '北辰区', '武清区', '宝坻区', '滨海新区', '宁河区', '静海区', '蓟州区']
- }
- ]
- },
- {
- name: '重庆市',
- cities: [
- {
- name: '重庆市',
- districts: ['渝中区', '大渡口区', '江北区', '沙坪坝区', '九龙坡区', '南岸区', '北碚区', '渝北区', '巴南区', '万州区', '涪陵区', '黔江区', '长寿区', '江津区', '合川区', '永川区', '南川区', '綦江区', '大足区', '璧山区', '铜梁区', '潼南区', '荣昌区', '开州区', '梁平区', '武隆区', '城口县', '丰都县', '垫江县', '忠县', '云阳县', '奉节县', '巫山县', '巫溪县', '石柱土家族自治县', '秀山土家族苗族自治县', '酉阳土家族苗族自治县', '彭水苗族土家族自治县']
- }
- ]
- },
- // 河北省
- {
- name: '河北省',
- cities: [
- {
- name: '石家庄市',
- districts: ['长安区', '桥西区', '新华区', '井陉矿区', '裕华区', '藁城区', '鹿泉区', '栾城区', '井陉县', '正定县', '行唐县', '灵寿县', '高邑县', '深泽县', '赞皇县', '无极县', '平山县', '元氏县', '赵县', '辛集市', '晋州市', '新乐市']
- },
- {
- name: '唐山市',
- districts: ['路南区', '路北区', '古冶区', '开平区', '丰南区', '丰润区', '曹妃甸区', '滦南县', '乐亭县', '迁西县', '玉田县', '遵化市', '迁安市', '滦州市']
- },
- {
- name: '秦皇岛市',
- districts: ['海港区', '山海关区', '北戴河区', '抚宁区', '青龙满族自治县', '昌黎县', '卢龙县']
- },
- {
- name: '邯郸市',
- districts: ['邯山区', '丛台区', '复兴区', '峰峰矿区', '肥乡区', '永年区', '临漳县', '成安县', '大名县', '涉县', '磁县', '邱县', '鸡泽县', '广平县', '馆陶县', '曲周县', '武安市', '魏县']
- },
- {
- name: '邢台市',
- districts: ['桥东区', '桥西区', '邢台县', '临城县', '内丘县', '柏乡县', '隆尧县', '任县', '南和县', '宁晋县', '巨鹿县', '新河县', '广宗县', '平乡县', '威县', '清河县', '临西县', '南宫市', '沙河市']
- },
- {
- name: '保定市',
- districts: ['竞秀区', '莲池区', '满城区', '清苑区', '徐水区', '涞水县', '阜平县', '定兴县', '唐县', '高阳县', '容城县', '涞源县', '望都县', '安新县', '易县', '曲阳县', '蠡县', '顺平县', '博野县', '雄县', '涿州市', '定州市', '安国市', '高碑店市']
- },
- {
- name: '张家口市',
- districts: ['桥东区', '桥西区', '宣化区', '下花园区', '万全区', '崇礼区', '张北县', '康保县', '沽源县', '尚义县', '蔚县', '阳原县', '怀安县', '怀来县', '涿鹿县', '赤城县']
- },
- {
- name: '承德市',
- districts: ['双桥区', '双滦区', '鹰手营子矿区', '承德县', '兴隆县', '平泉市', '滦平县', '隆化县', '丰宁满族自治县', '宽城满族自治县', '围场满族蒙古族自治县']
- },
- {
- name: '沧州市',
- districts: ['新华区', '运河区', '沧县', '青县', '东光县', '海兴县', '盐山县', '肃宁县', '南皮县', '吴桥县', '献县', '孟村回族自治县', '泊头市', '任丘市', '黄骅市', '河间市']
- },
- {
- name: '廊坊市',
- districts: ['安次区', '广阳区', '固安县', '永清县', '香河县', '大城县', '文安县', '大厂回族自治县', '霸州市', '三河市']
- },
- {
- name: '衡水市',
- districts: ['桃城区', '冀州区', '枣强县', '武邑县', '武强县', '饶阳县', '安平县', '故城县', '景县', '阜城县', '深州市']
- }
- ]
- },
- // 山西省
- {
- name: '山西省',
- cities: [
- {
- name: '太原市',
- districts: ['小店区', '迎泽区', '杏花岭区', '尖草坪区', '万柏林区', '晋源区', '清徐县', '阳曲县', '娄烦县', '古交市']
- },
- {
- name: '大同市',
- districts: ['新荣区', '平城区', '云冈区', '云州区', '阳高县', '天镇县', '广灵县', '灵丘县', '浑源县', '左云县']
- },
- {
- name: '阳泉市',
- districts: ['城区', '矿区', '郊区', '平定县', '盂县']
- },
- {
- name: '长治市',
- districts: ['潞州区', '上党区', '屯留区', '潞城区', '襄垣县', '平顺县', '黎城县', '壶关县', '长子县', '武乡县', '沁县', '沁源县']
- },
- {
- name: '晋城市',
- districts: ['城区', '沁水县', '阳城县', '陵川县', '泽州县', '高平市']
- },
- {
- name: '朔州市',
- districts: ['朔城区', '平鲁区', '山阴县', '应县', '右玉县', '怀仁市']
- },
- {
- name: '晋中市',
- districts: ['榆次区', '太谷区', '榆社县', '左权县', '和顺县', '昔阳县', '寿阳县', '祁县', '平遥县', '灵石县', '介休市']
- },
- {
- name: '运城市',
- districts: ['盐湖区', '临猗县', '万荣县', '闻喜县', '稷山县', '新绛县', '绛县', '垣曲县', '夏县', '平陆县', '芮城县', '永济市', '河津市']
- },
- {
- name: '忻州市',
- districts: ['忻府区', '定襄县', '五台县', '代县', '繁峙县', '宁武县', '静乐县', '神池县', '五寨县', '岢岚县', '河曲县', '保德县', '偏关县', '原平市']
- },
- {
- name: '临汾市',
- districts: ['尧都区', '曲沃县', '翼城县', '襄汾县', '洪洞县', '古县', '安泽县', '浮山县', '吉县', '乡宁县', '大宁县', '隰县', '永和县', '蒲县', '汾西县', '侯马市', '霍州市']
- },
- {
- name: '吕梁市',
- districts: ['离石区', '文水县', '交城县', '兴县', '临县', '柳林县', '石楼县', '岚县', '方山县', '中阳县', '交口县', '孝义市', '汾阳市']
- }
- ]
- },
- // 辽宁省
- {
- name: '辽宁省',
- cities: [
- {
- name: '沈阳市',
- districts: ['和平区', '沈河区', '大东区', '皇姑区', '铁西区', '苏家屯区', '浑南区', '沈北新区', '于洪区', '辽中区', '康平县', '法库县', '新民市']
- },
- {
- name: '大连市',
- districts: ['中山区', '西岗区', '沙河口区', '甘井子区', '旅顺口区', '金州区', '普兰店区', '长海县', '瓦房店市', '庄河市']
- },
- {
- name: '鞍山市',
- districts: ['铁东区', '铁西区', '立山区', '千山区', '台安县', '岫岩满族自治县', '海城市']
- },
- {
- name: '抚顺市',
- districts: ['新抚区', '东洲区', '望花区', '顺城区', '抚顺县', '新宾满族自治县', '清原满族自治县']
- },
- {
- name: '本溪市',
- districts: ['平山区', '溪湖区', '明山区', '南芬区', '本溪满族自治县', '桓仁满族自治县']
- },
- {
- name: '丹东市',
- districts: ['元宝区', '振兴区', '振安区', '宽甸满族自治县', '东港市', '凤城市']
- },
- {
- name: '锦州市',
- districts: ['古塔区', '凌河区', '太和区', '黑山县', '义县', '凌海市', '北镇市']
- },
- {
- name: '营口市',
- districts: ['站前区', '西市区', '鲅鱼圈区', '老边区', '盖州市', '大石桥市']
- },
- {
- name: '阜新市',
- districts: ['海州区', '新邱区', '太平区', '清河门区', '细河区', '阜新蒙古族自治县', '彰武县']
- },
- {
- name: '辽阳市',
- districts: ['白塔区', '文圣区', '宏伟区', '弓长岭区', '太子河区', '辽阳县', '灯塔市']
- },
- {
- name: '盘锦市',
- districts: ['双台子区', '兴隆台区', '大洼区', '盘山县']
- },
- {
- name: '铁岭市',
- districts: ['银州区', '清河区', '铁岭县', '西丰县', '昌图县', '调兵山市', '开原市']
- },
- {
- name: '朝阳市',
- districts: ['双塔区', '龙城区', '朝阳县', '建平县', '喀喇沁左翼蒙古族自治县', '北票市', '凌源市']
- },
- {
- name: '葫芦岛市',
- districts: ['连山区', '龙港区', '南票区', '绥中县', '建昌县', '兴城市']
- }
- ]
- },
- // 吉林省
- {
- name: '吉林省',
- cities: [
- {
- name: '长春市',
- districts: ['南关区', '宽城区', '朝阳区', '二道区', '绿园区', '双阳区', '九台区', '农安县', '榆树市', '德惠市', '公主岭市']
- },
- {
- name: '吉林市',
- districts: ['昌邑区', '龙潭区', '船营区', '丰满区', '永吉县', '蛟河市', '桦甸市', '舒兰市', '磐石市']
- },
- {
- name: '四平市',
- districts: ['铁西区', '铁东区', '梨树县', '伊通满族自治县', '双辽市']
- },
- {
- name: '辽源市',
- districts: ['龙山区', '西安区', '东丰县', '东辽县']
- },
- {
- name: '通化市',
- districts: ['东昌区', '二道江区', '通化县', '辉南县', '柳河县', '梅河口市', '集安市']
- },
- {
- name: '白山市',
- districts: ['浑江区', '江源区', '抚松县', '靖宇县', '长白朝鲜族自治县', '临江市']
- },
- {
- name: '松原市',
- districts: ['宁江区', '前郭尔罗斯蒙古族自治县', '长岭县', '乾安县', '扶余市']
- },
- {
- name: '白城市',
- districts: ['洮北区', '镇赉县', '通榆县', '洮南市', '大安市']
- },
- {
- name: '延边朝鲜族自治州',
- districts: ['延吉市', '图们市', '敦化市', '珲春市', '龙井市', '和龙市', '汪清县', '安图县']
- }
- ]
- },
- // 黑龙江省
- {
- name: '黑龙江省',
- cities: [
- {
- name: '哈尔滨市',
- districts: ['道里区', '南岗区', '道外区', '平房区', '松北区', '香坊区', '呼兰区', '阿城区', '双城区', '依兰县', '方正县', '宾县', '巴彦县', '木兰县', '通河县', '延寿县', '尚志市', '五常市']
- },
- {
- name: '齐齐哈尔市',
- districts: ['龙沙区', '建华区', '铁锋区', '昂昂溪区', '富拉尔基区', '碾子山区', '梅里斯达斡尔族区', '龙江县', '依安县', '泰来县', '甘南县', '富裕县', '克山县', '克东县', '拜泉县', '讷河市']
- },
- {
- name: '鸡西市',
- districts: ['鸡冠区', '恒山区', '滴道区', '梨树区', '城子河区', '麻山区', '鸡东县', '虎林市', '密山市']
- },
- {
- name: '鹤岗市',
- districts: ['向阳区', '工农区', '南山区', '兴安区', '东山区', '兴山区', '萝北县', '绥滨县']
- },
- {
- name: '双鸭山市',
- districts: ['尖山区', '岭东区', '四方台区', '宝山区', '集贤县', '友谊县', '宝清县', '饶河县']
- },
- {
- name: '大庆市',
- districts: ['萨尔图区', '龙凤区', '让胡路区', '红岗区', '大同区', '肇州县', '肇源县', '林甸县', '杜尔伯特蒙古族自治县']
- },
- {
- name: '伊春市',
- districts: ['伊美区', '乌翠区', '友好区', '金林区', '汤旺县', '丰林县', '大箐山县', '南岔县', '嘉荫县', '铁力市']
- },
- {
- name: '佳木斯市',
- districts: ['向阳区', '前进区', '东风区', '郊区', '桦南县', '桦川县', '汤原县', '抚远市', '同江市', '富锦市']
- },
- {
- name: '七台河市',
- districts: ['新兴区', '桃山区', '茄子河区', '勃利县']
- },
- {
- name: '牡丹江市',
- districts: ['东安区', '阳明区', '爱民区', '西安区', '东宁市', '绥芬河市', '海林市', '宁安市', '穆棱市', '林口县']
- },
- {
- name: '黑河市',
- districts: ['爱辉区', '嫩江市', '北安市', '五大连池市', '逊克县', '孙吴县']
- },
- {
- name: '绥化市',
- districts: ['北林区', '望奎县', '兰西县', '青冈县', '庆安县', '明水县', '绥棱县', '安达市', '肇东市', '海伦市']
- },
- {
- name: '大兴安岭地区',
- districts: ['加格达奇区', '松岭区', '新林区', '呼中区', '呼玛县', '塔河县', '漠河市']
- }
- ]
- },
- // 江苏省
- {
- name: '江苏省',
- cities: [
- {
- name: '南京市',
- districts: ['玄武区', '秦淮区', '建邺区', '鼓楼区', '浦口区', '栖霞区', '雨花台区', '江宁区', '六合区', '溧水区', '高淳区']
- },
- {
- name: '无锡市',
- districts: ['锡山区', '惠山区', '滨湖区', '梁溪区', '新吴区', '江阴市', '宜兴市']
- },
- {
- name: '徐州市',
- districts: ['鼓楼区', '云龙区', '贾汪区', '泉山区', '铜山区', '丰县', '沛县', '睢宁县', '新沂市', '邳州市']
- },
- {
- name: '常州市',
- districts: ['天宁区', '钟楼区', '新北区', '武进区', '金坛区', '溧阳市']
- },
- {
- name: '苏州市',
- districts: ['姑苏区', '虎丘区', '吴中区', '相城区', '吴江区', '苏州工业园区', '昆山市', '常熟市', '张家港市', '太仓市']
- },
- {
- name: '南通市',
- districts: ['崇川区', '港闸区', '通州区', '如东县', '启东市', '如皋市', '海门市', '海安市']
- },
- {
- name: '连云港市',
- districts: ['连云区', '海州区', '赣榆区', '东海县', '灌云县', '灌南县']
- },
- {
- name: '淮安市',
- districts: ['淮安区', '淮阴区', '清江浦区', '洪泽区', '涟水县', '盱眙县', '金湖县']
- },
- {
- name: '盐城市',
- districts: ['亭湖区', '盐都区', '大丰区', '响水县', '滨海县', '阜宁县', '射阳县', '建湖县', '东台市']
- },
- {
- name: '扬州市',
- districts: ['广陵区', '邗江区', '江都区', '宝应县', '仪征市', '高邮市']
- },
- {
- name: '镇江市',
- districts: ['京口区', '润州区', '丹徒区', '丹阳市', '扬中市', '句容市']
- },
- {
- name: '泰州市',
- districts: ['海陵区', '高港区', '姜堰区', '兴化市', '靖江市', '泰兴市']
- },
- {
- name: '宿迁市',
- districts: ['宿城区', '宿豫区', '沭阳县', '泗阳县', '泗洪县']
- }
- ]
- },
- // 浙江省
- {
- name: '浙江省',
- cities: [
- {
- name: '杭州市',
- districts: ['上城区', '下城区', '江干区', '拱墅区', '西湖区', '滨江区', '萧山区', '余杭区', '富阳区', '临安区', '桐庐县', '淳安县', '建德市']
- },
- {
- name: '宁波市',
- districts: ['海曙区', '江北区', '北仑区', '镇海区', '鄞州区', '奉化区', '象山县', '宁海县', '余姚市', '慈溪市']
- },
- {
- name: '温州市',
- districts: ['鹿城区', '龙湾区', '瓯海区', '洞头区', '永嘉县', '平阳县', '苍南县', '文成县', '泰顺县', '瑞安市', '乐清市']
- },
- {
- name: '嘉兴市',
- districts: ['南湖区', '秀洲区', '嘉善县', '海盐县', '海宁市', '平湖市', '桐乡市']
- },
- {
- name: '湖州市',
- districts: ['吴兴区', '南浔区', '德清县', '长兴县', '安吉县']
- },
- {
- name: '绍兴市',
- districts: ['越城区', '柯桥区', '上虞区', '新昌县', '诸暨市', '嵊州市']
- },
- {
- name: '金华市',
- districts: ['婺城区', '金东区', '武义县', '浦江县', '磐安县', '兰溪市', '义乌市', '东阳市', '永康市']
- },
- {
- name: '衢州市',
- districts: ['柯城区', '衢江区', '常山县', '开化县', '龙游县', '江山市']
- },
- {
- name: '舟山市',
- districts: ['定海区', '普陀区', '岱山县', '嵊泗县']
- },
- {
- name: '台州市',
- districts: ['椒江区', '黄岩区', '路桥区', '玉环市', '三门县', '天台县', '仙居县', '温岭市', '临海市']
- },
- {
- name: '丽水市',
- districts: ['莲都区', '青田县', '缙云县', '遂昌县', '松阳县', '云和县', '庆元县', '景宁畲族自治县', '龙泉市']
- }
- ]
- },
- // 安徽省
- {
- name: '安徽省',
- cities: [
- {
- name: '合肥市',
- districts: ['瑶海区', '庐阳区', '蜀山区', '包河区', '长丰县', '肥东县', '肥西县', '庐江县', '巢湖市']
- },
- {
- name: '芜湖市',
- districts: ['镜湖区', '弋江区', '鸠江区', '三山区', '芜湖县', '繁昌县', '南陵县', '无为县']
- },
- {
- name: '蚌埠市',
- districts: ['龙子湖区', '蚌山区', '禹会区', '淮上区', '怀远县', '五河县', '固镇县']
- },
- {
- name: '淮南市',
- districts: ['大通区', '田家庵区', '谢家集区', '八公山区', '潘集区', '凤台县', '寿县']
- },
- {
- name: '马鞍山市',
- districts: ['花山区', '雨山区', '博望区', '当涂县', '含山县', '和县']
- },
- {
- name: '淮北市',
- districts: ['杜集区', '相山区', '烈山区', '濉溪县']
- },
- {
- name: '铜陵市',
- districts: ['铜官区', '义安区', '郊区', '枞阳县']
- },
- {
- name: '安庆市',
- districts: ['迎江区', '大观区', '宜秀区', '怀宁县', '枞阳县', '潜山县', '太湖县', '宿松县', '望江县', '岳西县', '桐城市']
- },
- {
- name: '黄山市',
- districts: ['屯溪区', '黄山区', '徽州区', '歙县', '休宁县', '黟县', '祁门县']
- },
- {
- name: '滁州市',
- districts: ['琅琊区', '南谯区', '来安县', '全椒县', '定远县', '凤阳县', '天长市', '明光市']
- },
- {
- name: '阜阳市',
- districts: ['颍州区', '颍东区', '颍泉区', '临泉县', '太和县', '阜南县', '颍上县', '界首市']
- },
- {
- name: '宿州市',
- districts: ['埇桥区', '砀山县', '萧县', '灵璧县', '泗县']
- },
- {
- name: '六安市',
- districts: ['金安区', '裕安区', '叶集区', '霍邱县', '舒城县', '金寨县', '霍山县']
- },
- {
- name: '亳州市',
- districts: ['谯城区', '涡阳县', '蒙城县', '利辛县']
- },
- {
- name: '池州市',
- districts: ['贵池区', '东至县', '石台县', '青阳县']
- },
- {
- name: '宣城市',
- districts: ['宣州区', '郎溪县', '广德县', '泾县', '绩溪县', '旌德县', '宁国市']
- }
- ]
- },
- // 福建省
- {
- name: '福建省',
- cities: [
- {
- name: '福州市',
- districts: ['鼓楼区', '台江区', '仓山区', '马尾区', '晋安区', '长乐区', '闽侯县', '连江县', '罗源县', '闽清县', '永泰县', '平潭县']
- },
- {
- name: '厦门市',
- districts: ['思明区', '海沧区', '湖里区', '集美区', '同安区', '翔安区']
- },
- {
- name: '莆田市',
- districts: ['城厢区', '涵江区', '荔城区', '秀屿区', '仙游县']
- },
- {
- name: '三明市',
- districts: ['梅列区', '三元区', '明溪县', '清流县', '宁化县', '大田县', '尤溪县', '沙县', '将乐县', '泰宁县', '建宁县', '永安市']
- },
- {
- name: '泉州市',
- districts: ['鲤城区', '丰泽区', '洛江区', '泉港区', '惠安县', '安溪县', '永春县', '德化县', '金门县', '石狮市', '晋江市', '南安市']
- },
- {
- name: '漳州市',
- districts: ['芗城区', '龙文区', '云霄县', '漳浦县', '诏安县', '长泰县', '东山县', '南靖县', '平和县', '华安县', '龙海市']
- },
- {
- name: '南平市',
- districts: ['延平区', '建阳区', '顺昌县', '浦城县', '光泽县', '松溪县', '政和县', '邵武市', '武夷山市', '建瓯市']
- },
- {
- name: '龙岩市',
- districts: ['新罗区', '永定区', '长汀县', '上杭县', '武平县', '连城县', '漳平市']
- },
- {
- name: '宁德市',
- districts: ['蕉城区', '霞浦县', '古田县', '屏南县', '寿宁县', '周宁县', '柘荣县', '福安市', '福鼎市']
- }
- ]
- },
- // 江西省
- {
- name: '江西省',
- cities: [
- {
- name: '南昌市',
- districts: ['东湖区', '西湖区', '青云谱区', '湾里区', '青山湖区', '新建区', '南昌县', '安义县', '进贤县']
- },
- {
- name: '景德镇市',
- districts: ['昌江区', '珠山区', '浮梁县', '乐平市']
- },
- {
- name: '萍乡市',
- districts: ['安源区', '湘东区', '莲花县', '上栗县', '芦溪县']
- },
- {
- name: '九江市',
- districts: ['濂溪区', '浔阳区', '柴桑区', '武宁县', '修水县', '永修县', '德安县', '都昌县', '湖口县', '彭泽县', '瑞昌市', '共青城市', '庐山市']
- },
- {
- name: '新余市',
- districts: ['渝水区', '分宜县']
- },
- {
- name: '鹰潭市',
- districts: ['月湖区', '余江区', '贵溪市']
- },
- {
- name: '赣州市',
- districts: ['章贡区', '南康区', '赣县区', '信丰县', '大余县', '上犹县', '崇义县', '安远县', '龙南县', '定南县', '全南县', '宁都县', '于都县', '兴国县', '会昌县', '寻乌县', '石城县', '瑞金市', '龙南市']
- },
- {
- name: '吉安市',
- districts: ['吉州区', '青原区', '吉安县', '吉水县', '峡江县', '新干县', '永丰县', '泰和县', '遂川县', '万安县', '安福县', '永新县', '井冈山市']
- },
- {
- name: '宜春市',
- districts: ['袁州区', '奉新县', '万载县', '上高县', '宜丰县', '靖安县', '铜鼓县', '丰城市', '樟树市', '高安市']
- },
- {
- name: '抚州市',
- districts: ['临川区', '东乡区', '南城县', '黎川县', '南丰县', '崇仁县', '乐安县', '宜黄县', '金溪县', '资溪县', '广昌县']
- },
- {
- name: '上饶市',
- districts: ['信州区', '广丰区', '广信区', '玉山县', '铅山县', '横峰县', '弋阳县', '余干县', '鄱阳县', '万年县', '婺源县', '德兴市']
- }
- ]
- },
- // 山东省
- {
- name: '山东省',
- cities: [
- {
- name: '济南市',
- districts: ['历下区', '市中区', '槐荫区', '天桥区', '历城区', '长清区', '章丘区', '济阳区', '莱芜区', '钢城区', '平阴县', '商河县']
- },
- {
- name: '青岛市',
- districts: ['市南区', '市北区', '黄岛区', '崂山区', '李沧区', '城阳区', '即墨区', '胶州市', '平度市', '莱西市']
- },
- {
- name: '淄博市',
- districts: ['淄川区', '张店区', '博山区', '临淄区', '周村区', '桓台县', '高青县', '沂源县']
- },
- {
- name: '枣庄市',
- districts: ['市中区', '薛城区', '峄城区', '台儿庄区', '山亭区', '滕州市']
- },
- {
- name: '东营市',
- districts: ['东营区', '河口区', '垦利区', '利津县', '广饶县']
- },
- {
- name: '烟台市',
- districts: ['芝罘区', '福山区', '牟平区', '莱山区', '蓬莱区', '长岛县', '龙口市', '莱阳市', '莱州市', '蓬莱市', '招远市', '栖霞市', '海阳市']
- },
- {
- name: '潍坊市',
- districts: ['潍城区', '寒亭区', '坊子区', '奎文区', '临朐县', '昌乐县', '青州市', '诸城市', '寿光市', '安丘市', '高密市', '昌邑市']
- },
- {
- name: '济宁市',
- districts: ['任城区', '兖州区', '微山县', '鱼台县', '金乡县', '嘉祥县', '汶上县', '泗水县', '梁山县', '曲阜市', '邹城市']
- },
- {
- name: '泰安市',
- districts: ['泰山区', '岱岳区', '宁阳县', '东平县', '新泰市', '肥城市']
- },
- {
- name: '威海市',
- districts: ['环翠区', '文登区', '荣成市', '乳山市']
- },
- {
- name: '日照市',
- districts: ['东港区', '岚山区', '五莲县', '莒县']
- },
- {
- name: '临沂市',
- districts: ['兰山区', '罗庄区', '河东区', '沂南县', '郯城县', '沂水县', '兰陵县', '费县', '平邑县', '莒南县', '蒙阴县', '临沭县']
- },
- {
- name: '德州市',
- districts: ['德城区', '陵城区', '宁津县', '庆云县', '临邑县', '齐河县', '平原县', '夏津县', '武城县', '乐陵市', '禹城市']
- },
- {
- name: '聊城市',
- districts: ['东昌府区', '茌平区', '阳谷县', '莘县', '东阿县', '冠县', '高唐县', '临清市']
- },
- {
- name: '滨州市',
- districts: ['滨城区', '沾化区', '惠民县', '阳信县', '无棣县', '博兴县', '邹平市']
- },
- {
- name: '菏泽市',
- districts: ['牡丹区', '定陶区', '曹县', '单县', '成武县', '巨野县', '郓城县', '鄄城县', '东明县']
- }
- ]
- },
- // 河南省
- {
- name: '河南省',
- cities: [
- {
- name: '郑州市',
- districts: ['中原区', '二七区', '管城回族区', '金水区', '上街区', '惠济区', '中牟县', '巩义市', '荥阳市', '新密市', '新郑市', '登封市']
- },
- {
- name: '开封市',
- districts: ['龙亭区', '顺河回族区', '鼓楼区', '禹王台区', '祥符区', '杞县', '通许县', '尉氏县', '兰考县']
- },
- {
- name: '洛阳市',
- districts: ['老城区', '西工区', '瀍河回族区', '涧西区', '吉利区', '洛龙区', '孟津县', '新安县', '栾川县', '嵩县', '汝阳县', '宜阳县', '洛宁县', '伊川县', '偃师市']
- },
- {
- name: '平顶山市',
- districts: ['新华区', '卫东区', '石龙区', '湛河区', '宝丰县', '叶县', '鲁山县', '郏县', '舞钢市', '汝州市']
- },
- {
- name: '安阳市',
- districts: ['文峰区', '北关区', '殷都区', '龙安区', '安阳县', '汤阴县', '滑县', '内黄县', '林州市']
- },
- {
- name: '鹤壁市',
- districts: ['鹤山区', '山城区', '淇滨区', '浚县', '淇县']
- },
- {
- name: '新乡市',
- districts: ['红旗区', '卫滨区', '凤泉区', '牧野区', '新乡县', '获嘉县', '原阳县', '延津县', '封丘县', '长垣县', '卫辉市', '辉县市']
- },
- {
- name: '焦作市',
- districts: ['解放区', '中站区', '马村区', '山阳区', '修武县', '博爱县', '武陟县', '温县', '沁阳市', '孟州市']
- },
- {
- name: '濮阳市',
- districts: ['华龙区', '清丰县', '南乐县', '范县', '台前县', '濮阳县']
- },
- {
- name: '许昌市',
- districts: ['魏都区', '建安区', '鄢陵县', '襄城县', '禹州市', '长葛市']
- },
- {
- name: '漯河市',
- districts: ['源汇区', '郾城区', '召陵区', '舞阳县', '临颍县']
- },
- {
- name: '三门峡市',
- districts: ['湖滨区', '陕州区', '渑池县', '卢氏县', '义马市', '灵宝市']
- },
- {
- name: '南阳市',
- districts: ['宛城区', '卧龙区', '南召县', '方城县', '西峡县', '镇平县', '内乡县', '淅川县', '社旗县', '唐河县', '新野县', '桐柏县', '邓州市']
- },
- {
- name: '商丘市',
- districts: ['梁园区', '睢阳区', '民权县', '睢县', '宁陵县', '柘城县', '虞城县', '夏邑县', '永城市']
- },
- {
- name: '信阳市',
- districts: ['浉河区', '平桥区', '罗山县', '光山县', '新县', '商城县', '固始县', '潢川县', '淮滨县', '息县']
- },
- {
- name: '周口市',
- districts: ['川汇区', '淮阳区', '扶沟县', '西华县', '商水县', '沈丘县', '郸城县', '太康县', '鹿邑县', '项城市']
- },
- {
- name: '驻马店市',
- districts: ['驿城区', '西平县', '上蔡县', '平舆县', '正阳县', '确山县', '泌阳县', '汝南县', '遂平县', '新蔡县']
- },
- {
- name: '济源市',
- districts: ['济源市']
- }
- ]
- },
- // 湖北省
- {
- name: '湖北省',
- cities: [
- {
- name: '武汉市',
- districts: ['江岸区', '江汉区', '硚口区', '汉阳区', '武昌区', '青山区', '洪山区', '东西湖区', '汉南区', '蔡甸区', '江夏区', '黄陂区', '新洲区']
- },
- {
- name: '黄石市',
- districts: ['黄石港区', '西塞山区', '下陆区', '铁山区', '阳新县', '大冶市']
- },
- {
- name: '十堰市',
- districts: ['茅箭区', '张湾区', '郧阳区', '郧西县', '竹山县', '竹溪县', '房县', '丹江口市']
- },
- {
- name: '宜昌市',
- districts: ['西陵区', '伍家岗区', '点军区', '猇亭区', '夷陵区', '远安县', '兴山县', '秭归县', '长阳土家族自治县', '五峰土家族自治县', '宜都市', '当阳市', '枝江市']
- },
- {
- name: '襄阳市',
- districts: ['襄城区', '樊城区', '襄州区', '南漳县', '谷城县', '保康县', '老河口市', '枣阳市', '宜城市']
- },
- {
- name: '鄂州市',
- districts: ['梁子湖区', '华容区', '鄂城区']
- },
- {
- name: '荆门市',
- districts: ['东宝区', '掇刀区', '京山市', '沙洋县', '钟祥市']
- },
- {
- name: '孝感市',
- districts: ['孝南区', '孝昌县', '大悟县', '云梦县', '应城市', '安陆市', '汉川市']
- },
- {
- name: '荆州市',
- districts: ['沙市区', '荆州区', '公安县', '监利县', '江陵县', '石首市', '洪湖市', '松滋市']
- },
- {
- name: '黄冈市',
- districts: ['黄州区', '团风县', '红安县', '罗田县', '英山县', '浠水县', '蕲春县', '黄梅县', '麻城市', '武穴市']
- },
- {
- name: '咸宁市',
- districts: ['咸安区', '嘉鱼县', '通城县', '崇阳县', '通山县', '赤壁市']
- },
- {
- name: '随州市',
- districts: ['曾都区', '随县', '广水市']
- },
- {
- name: '恩施土家族苗族自治州',
- districts: ['恩施市', '利川市', '建始县', '巴东县', '宣恩县', '咸丰县', '来凤县', '鹤峰县']
- },
- {
- name: '仙桃市',
- districts: ['仙桃市']
- },
- {
- name: '潜江市',
- districts: ['潜江市']
- },
- {
- name: '天门市',
- districts: ['天门市']
- },
- {
- name: '神农架林区',
- districts: ['神农架林区']
- }
- ]
- },
- // 湖南省
- {
- name: '湖南省',
- cities: [
- {
- name: '长沙市',
- districts: ['芙蓉区', '天心区', '岳麓区', '开福区', '雨花区', '望城区', '长沙县', '宁乡市', '浏阳市']
- },
- {
- name: '株洲市',
- districts: ['荷塘区', '芦淞区', '石峰区', '天元区', '株洲县', '攸县', '茶陵县', '炎陵县', '醴陵市']
- },
- {
- name: '湘潭市',
- districts: ['雨湖区', '岳塘区', '湘潭县', '湘乡市', '韶山市']
- },
- {
- name: '衡阳市',
- districts: ['珠晖区', '雁峰区', '石鼓区', '蒸湘区', '南岳区', '衡阳县', '衡南县', '衡山县', '衡东县', '祁东县', '耒阳市', '常宁市']
- },
- {
- name: '邵阳市',
- districts: ['双清区', '大祥区', '北塔区', '邵东县', '新邵县', '邵阳县', '隆回县', '洞口县', '绥宁县', '新宁县', '城步苗族自治县', '武冈市']
- },
- {
- name: '岳阳市',
- districts: ['岳阳楼区', '云溪区', '君山区', '岳阳县', '华容县', '湘阴县', '平江县', '汨罗市', '临湘市']
- },
- {
- name: '常德市',
- districts: ['武陵区', '鼎城区', '安乡县', '汉寿县', '澧县', '临澧县', '桃源县', '石门县', '津市市']
- },
- {
- name: '张家界市',
- districts: ['永定区', '武陵源区', '慈利县', '桑植县']
- },
- {
- name: '益阳市',
- districts: ['资阳区', '赫山区', '南县', '桃江县', '安化县', '沅江市']
- },
- {
- name: '郴州市',
- districts: ['北湖区', '苏仙区', '桂阳县', '宜章县', '永兴县', '嘉禾县', '临武县', '汝城县', '桂东县', '安仁县', '资兴市']
- },
- {
- name: '永州市',
- districts: ['零陵区', '冷水滩区', '祁阳县', '东安县', '双牌县', '道县', '江永县', '宁远县', '蓝山县', '新田县', '江华瑶族自治县']
- },
- {
- name: '怀化市',
- districts: ['鹤城区', '中方县', '沅陵县', '辰溪县', '溆浦县', '会同县', '麻阳苗族自治县', '新晃侗族自治县', '芷江侗族自治县', '靖州苗族侗族自治县', '通道侗族自治县', '洪江市']
- },
- {
- name: '娄底市',
- districts: ['娄星区', '双峰县', '新化县', '冷水江市', '涟源市']
- },
- {
- name: '湘西土家族苗族自治州',
- districts: ['吉首市', '泸溪县', '凤凰县', '花垣县', '保靖县', '古丈县', '永顺县', '龙山县']
- }
- ]
- },
- // 广东省
- {
- name: '广东省',
- cities: [
- {
- name: '广州市',
- districts: ['荔湾区', '越秀区', '海珠区', '天河区', '白云区', '黄埔区', '番禺区', '花都区', '南沙区', '从化区', '增城区']
- },
- {
- name: '深圳市',
- districts: ['罗湖区', '福田区', '南山区', '宝安区', '龙岗区', '盐田区', '龙华区', '坪山区', '光明区']
- },
- {
- name: '珠海市',
- districts: ['香洲区', '斗门区', '金湾区']
- },
- {
- name: '汕头市',
- districts: ['龙湖区', '金平区', '濠江区', '潮阳区', '潮南区', '澄海区', '南澳县']
- },
- {
- name: '佛山市',
- districts: ['禅城区', '南海区', '顺德区', '三水区', '高明区']
- },
- {
- name: '韶关市',
- districts: ['武江区', '浈江区', '曲江区', '始兴县', '仁化县', '翁源县', '乳源瑶族自治县', '新丰县', '乐昌市', '南雄市']
- },
- {
- name: '河源市',
- districts: ['源城区', '紫金县', '龙川县', '连平县', '和平县', '东源县']
- },
- {
- name: '梅州市',
- districts: ['梅江区', '梅县区', '大埔县', '丰顺县', '五华县', '平远县', '蕉岭县', '兴宁市']
- },
- {
- name: '惠州市',
- districts: ['惠城区', '惠阳区', '博罗县', '惠东县', '龙门县']
- },
- {
- name: '汕尾市',
- districts: ['城区', '海丰县', '陆河县', '陆丰市']
- },
- {
- name: '东莞市',
- districts: ['东莞市']
- },
- {
- name: '中山市',
- districts: ['中山市']
- },
- {
- name: '江门市',
- districts: ['蓬江区', '江海区', '新会区', '台山市', '开平市', '鹤山市', '恩平市']
- },
- {
- name: '阳江市',
- districts: ['江城区', '阳东区', '阳西县', '阳春市']
- },
- {
- name: '湛江市',
- districts: ['赤坎区', '霞山区', '坡头区', '麻章区', '遂溪县', '徐闻县', '廉江市', '雷州市', '吴川市']
- },
- {
- name: '茂名市',
- districts: ['茂南区', '电白区', '高州市', '化州市', '信宜市']
- },
- {
- name: '肇庆市',
- districts: ['端州区', '鼎湖区', '高要区', '广宁县', '怀集县', '封开县', '德庆县', '四会市']
- },
- {
- name: '清远市',
- districts: ['清城区', '清新区', '佛冈县', '阳山县', '连山壮族瑶族自治县', '连南瑶族自治县', '英德市', '连州市']
- },
- {
- name: '潮州市',
- districts: ['湘桥区', '潮安区', '饶平县']
- },
- {
- name: '揭阳市',
- districts: ['榕城区', '揭东区', '揭西县', '惠来县', '普宁市']
- },
- {
- name: '云浮市',
- districts: ['云城区', '云安区', '新兴县', '郁南县', '罗定市']
- },
- {
- name: '顺德区',
- districts: ['顺德区']
- },
- {
- name: '南海区',
- districts: ['南海区']
- },
- {
- name: '温州市',
- districts: ['鹿城区', '龙湾区', '瓯海区', '洞头区', '瑞安市', '乐清市', '永嘉县', '平阳县', '苍南县', '文成县', '泰顺县']
- },
- {
- name: '嘉兴市',
- districts: ['南湖区', '秀洲区', '海宁市', '平湖市', '桐乡市', '嘉善县', '海盐县']
- },
- {
- name: '湖州市',
- districts: ['吴兴区', '南浔区', '德清县', '长兴县', '安吉县']
- }
- ]
- },
- {
- name: '四川省',
- cities: [
- {
- name: '成都市',
- districts: ['锦江区', '青羊区', '金牛区', '武侯区', '成华区', '龙泉驿区', '青白江区', '新都区', '温江区', '双流区', '郫都区', '新津区', '金堂县', '大邑县', '蒲江县', '都江堰市', '彭州市', '邛崃市', '崇州市', '简阳市']
- },
- {
- name: '绵阳市',
- districts: ['涪城区', '游仙区', '安州区', '三台县', '盐亭县', '梓潼县', '北川羌族自治县', '平武县', '江油市']
- },
- {
- name: '德阳市',
- districts: ['旌阳区', '罗江区', '中江县', '广汉市', '什邡市', '绵竹市']
- },
- {
- name: '自贡市',
- districts: ['自流井区', '贡井区', '大安区', '沿滩区', '荣县', '富顺县']
- },
- {
- name: '攀枝花市',
- districts: ['东区', '西区', '仁和区', '米易县', '盐边县']
- },
- {
- name: '泸州市',
- districts: ['江阳区', '纳溪区', '龙马潭区', '泸县', '合江县', '叙永县', '古蔺县']
- },
- {
- name: '广元市',
- districts: ['利州区', '昭化区', '朝天区', '旺苍县', '青川县', '剑阁县', '苍溪县']
- },
- {
- name: '遂宁市',
- districts: ['船山区', '安居区', '蓬溪县', '射洪市', '大英县']
- },
- {
- name: '内江市',
- districts: ['市中区', '东兴区', '威远县', '资中县', '隆昌市']
- },
- {
- name: '乐山市',
- districts: ['市中区', '沙湾区', '五通桥区', '金口河区', '犍为县', '井研县', '夹江县', '沐川县', '峨边彝族自治县', '马边彝族自治县', '峨眉山市']
- },
- {
- name: '资阳市',
- districts: ['雁江区', '安岳县', '乐至县']
- },
- {
- name: '宜宾市',
- districts: ['翠屏区', '南溪区', '叙州区', '江安县', '长宁县', '高县', '珙县', '筠连县', '兴文县', '屏山县']
- },
- {
- name: '南充市',
- districts: ['顺庆区', '高坪区', '嘉陵区', '南部县', '营山县', '蓬安县', '仪陇县', '西充县', '阆中市']
- },
- {
- name: '广安市',
- districts: ['广安区', '前锋区', '岳池县', '武胜县', '邻水县', '华蓥市']
- },
- {
- name: '达州市',
- districts: ['通川区', '达川区', '宣汉县', '开江县', '大竹县', '渠县', '万源市']
- },
- {
- name: '巴中市',
- districts: ['巴州区', '恩阳区', '通江县', '南江县', '平昌县']
- },
- {
- name: '眉山市',
- districts: ['东坡区', '彭山区', '仁寿县', '洪雅县', '丹棱县', '青神县']
- },
- {
- name: '雅安市',
- districts: ['雨城区', '名山区', '荥经县', '汉源县', '石棉县', '天全县', '芦山县', '宝兴县']
- },
- {
- name: '阿坝藏族羌族自治州',
- districts: ['马尔康市', '汶川县', '理县', '茂县', '松潘县', '九寨沟县', '金川县', '小金县', '黑水县', '壤塘县', '阿坝县', '若尔盖县', '红原县']
- },
- {
- name: '甘孜藏族自治州',
- districts: ['康定市', '泸定县', '丹巴县', '九龙县', '雅江县', '道孚县', '炉霍县', '甘孜县', '新龙县', '德格县', '白玉县', '石渠县', '色达县', '理塘县', '巴塘县', '乡城县', '稻城县', '得荣县']
- },
- {
- name: '凉山彝族自治州',
- districts: ['西昌市', '木里藏族自治县', '盐源县', '德昌县', '会理市', '会东县', '宁南县', '普格县', '布拖县', '金阳县', '昭觉县', '喜德县', '冕宁县', '越西县', '甘洛县', '美姑县', '雷波县']
- }
- ]
- },
- {
- name: '香港特别行政区',
- cities: [
- {
- name: '香港岛',
- districts: ['中西区', '湾仔区', '东区', '南区']
- },
- {
- name: '九龙',
- districts: ['油尖旺区', '深水埗区', '九龙城区', '黄大仙区', '观塘区']
- },
- {
- name: '新界',
- districts: ['北区', '大埔区', '沙田区', '西贡区', '荃湾区', '屯门区', '元朗区', '葵青区', '离岛区']
- }
- ]
- },
- {
- name: '澳门特别行政区',
- cities: [
- {
- name: '澳门半岛',
- districts: ['花地玛堂区', '圣安多尼堂区', '大堂区', '望德堂区', '风顺堂区']
- },
- {
- name: '氹仔岛',
- districts: ['嘉模堂区']
- },
- {
- name: '路环岛',
- districts: ['圣方济各堂区']
- },
- {
- name: '路氹城',
- districts: ['路氹填海区']
- }
- ]
- }
- ],
- // 三级联动选中状态
- selectedProvinceIndex: 0,
- selectedCityIndex: 0,
- selectedDistrictIndex: 0,
- // 当前显示的市和区选项
- currentCities: [],
- currentDistricts: [],
- // 地区搜索相关
- regionSearchKeyword: '',
- editRegionSearchKeyword: '',
- filteredRegionOptions: [],
- showSearchResults: false,
- newSupply: {
- name: '', // 品种
- price: '',
- minOrder: '',
- yolk: '', // 蛋黄字段
- yolkIndex: 0, // 蛋黄选项索引
- spec: '', // 规格字段
- specIndex: 0, // 规格选项索引
- region: '', // 【新增】地区字段
- grossWeight: '', // 【新增】毛重字段,支持中文
- imageUrls: [] // 图片URL数组,支持多张图片
- },
- newSupplyRegionArray: [], // 新创建货源的省市区数组
- editSupplyRegionArray: [], // 编辑货源的省市区数组
- editSupply: {
- yolkIndex: 0,
- specIndex: 0
- },
- currentImageIndex: 0, // 用于滑动时记录当前图片索引
- searchKeyword: '', // 搜索关键词
- // 图片缩放相关数据
- scale: 1, // 缩放比例
- offsetX: 0, // X轴偏移
- offsetY: 0, // Y轴偏移
- lastDistance: 0, // 上一次两指距离
- lastTouchPoint: null, // 上一次触摸点
- imageWidth: 375, // 图片原始宽度
- imageHeight: 375, // 图片原始高度
- minScale: 1, // 最小缩放比例
- maxScale: 4, // 最大缩放比例
- doubleTapTimeout: null, // 双击超时计时器
- doubleTapCount: 0, // 双击计数
-
-
- // 分页相关数据
- pagination: {
- published: {
- page: 1,
- pageSize: 20,
- hasMore: true,
- loading: false
- },
- pending: {
- page: 1,
- pageSize: 20,
- hasMore: true,
- loading: false
- },
- rejected: {
- page: 1,
- pageSize: 20,
- hasMore: true,
- loading: false
- },
- draft: {
- page: 1,
- pageSize: 20,
- hasMore: true,
- loading: false
- }
- },
-
- // 当前正在加载的状态类型
- currentLoadingType: null,
-
- // 图片预览相关状态
- showImagePreview: false, // 控制图片预览弹窗显示
- previewImageUrls: [], // 预览的图片URL列表
- previewImageIndex: 0, // 当前预览图片的索引
-
- // 折叠状态控制
- isPublishedExpanded: true, // 已上架货源是否展开
- isPendingExpanded: true, // 审核中货源是否展开
- isRejectedExpanded: true, // 审核失败货源是否展开
- isDraftExpanded: true, // 下架状态货源是否展开
-
- // 自动发布控制
- autoPublishAfterEdit: false, // 编辑后是否自动发布(上架)
-
- // 页面加载状态控制
- _hasLoadedOnShow: false, // 标记onShow是否已经加载过数据
-
- // 页面滚动锁定状态
- pageScrollLock: false, // 控制页面是否锁定滚动
- touchMoveBlocked: false, // iOS设备触摸事件阻止
-
- // 授权登录相关状态
- showAuthModal: false, // 控制未授权提示弹窗显示
- showOneKeyLoginModal: false, // 控制一键登录弹窗显示
- pendingUserType: 'seller', // 记录用户即将选择的身份类型
- avatarUrl: '/images/default-avatar.png', // 默认头像
- partnerstatus: '' // 用户入驻状态,用于显示入驻/未入驻
- },
-
- onLoad() {
- console.log('卖家页面onLoad开始执行');
- // 移除强制登录检查,允许用户浏览货源页面
- this.loadSupplies();
- // 初始化规格搜索相关数据
- this.setData({
- specSearchKeyword: '',
- editSpecSearchKeyword: '',
- filteredSpecOptions: this.data.specOptions,
- filteredEditSpecOptions: this.data.specOptions,
- // 初始化三级联动地区数据
- currentCities: this.data.regionOptions[this.data.selectedProvinceIndex].cities,
- currentDistricts: this.data.regionOptions[this.data.selectedProvinceIndex].cities[this.data.selectedCityIndex].districts
- });
-
- // 尝试从本地存储加载草稿数据
- const draftData = wx.getStorageSync('newSupplyDraft');
- if (draftData) {
- this.setData({
- newSupply: draftData
- });
- console.log('从本地存储加载了草稿数据');
- }
-
- console.log('卖家页面onLoad执行完毕');
- },
-
- // 重新登录方法 - 跳转到登录页面
- reLogin() {
- console.log('执行reLogin方法,跳转到登录页面');
- wx.showToast({
- title: '请先登录',
- icon: 'none',
- duration: 2000,
- complete: () => {
- setTimeout(() => {
- wx.switchTab({
- url: '/pages/index/index'
- });
- }, 2000);
- }
- });
- },
-
- // 轮播图切换事件
- swiperChange: function (e) {
- const current = e.detail.current;
- const id = e.currentTarget.dataset.id;
-
- if (!id) {
- console.error('swiperChange: 缺少商品ID');
- return;
- }
-
- console.log(`商品 ${id} 的轮播图切换到第 ${current} 张`);
-
- // 更新特定商品的当前图片索引
- this.updateProductCurrentIndex(id, current);
- },
-
- // 更新商品当前图片索引
- updateProductCurrentIndex: function (productId, index) {
- // 更新所有货源列表中的对应商品
- const updateSupplies = (supplies) => {
- return supplies.map(supply => {
- if (supply.id === productId) {
- return {
- ...supply,
- currentImageIndex: index
- };
- }
- return supply;
- });
- };
-
- this.setData({
- supplies: updateSupplies(this.data.supplies),
- publishedSupplies: updateSupplies(this.data.publishedSupplies),
- pendingSupplies: updateSupplies(this.data.pendingSupplies),
- rejectedSupplies: updateSupplies(this.data.rejectedSupplies),
- draftSupplies: updateSupplies(this.data.draftSupplies)
- });
- },
-
- // 切换已上架货源的折叠状态
- togglePublishedExpand() {
- this.setData({
- isPublishedExpanded: !this.data.isPublishedExpanded
- });
- },
-
- // 切换审核中货源的折叠状态
- togglePendingExpand() {
- this.setData({
- isPendingExpanded: !this.data.isPendingExpanded
- });
- },
-
- // 切换审核失败货源的折叠状态
- toggleRejectedExpand() {
- this.setData({
- isRejectedExpanded: !this.data.isRejectedExpanded
- });
- },
-
- // 切换下架状态货源的折叠状态
- toggleDraftExpand() {
- this.setData({
- isDraftExpanded: !this.data.isDraftExpanded
- });
- },
-
- // 清除搜索
- clearSearch() {
- this.setData({
- searchKeyword: ''
- }, () => {
- // 重新加载所有数据
- this.loadSupplies();
- });
- },
-
- // 处理搜索输入
- onSearchInput(e) {
- this.setData({
- searchKeyword: e.detail.value
- });
- },
-
- // 搜索货源
- searchSupplies() {
- console.log('搜索货源,关键词:', this.data.searchKeyword);
-
- // 根据搜索关键词过滤所有状态的货源
- const keyword = this.data.searchKeyword.toLowerCase().trim();
- if (!keyword) {
- // 如果关键词为空,重新加载所有数据
- this.loadSupplies();
- return;
- }
-
- // 获取所有货源
- const allSupplies = this.data.supplies;
-
- // 过滤符合条件的货源
- const filteredSupplies = allSupplies.filter(supply => {
- // 搜索名称、品种等字段
- const name = (supply.name || '').toLowerCase();
- const productName = (supply.productName || '').toLowerCase();
- const yolk = (supply.yolk || '').toLowerCase();
- const spec = (supply.spec || '').toLowerCase();
-
- return name.includes(keyword) ||
- productName.includes(keyword) ||
- yolk.includes(keyword) ||
- spec.includes(keyword);
- });
-
- // 将过滤后的货源按照状态分类
- const publishedSupplies = filteredSupplies.filter(s => s.status === 'published');
- const pendingSupplies = filteredSupplies.filter(s => s.status === 'pending_review');
- const rejectedSupplies = filteredSupplies.filter(s => s.status === 'rejected');
- const draftSupplies = filteredSupplies.filter(s => s.status === 'draft');
-
- // 更新UI显示
- this.setData({
- publishedSupplies,
- pendingSupplies,
- rejectedSupplies,
- draftSupplies
- });
-
-
- },
-
- // 下拉刷新处理函数
- onPullDownRefresh() {
- console.log('====== 触发下拉刷新 ======');
-
- // 重新加载所有货源数据
- this.loadSupplies()
- .then(() => {
- console.log('下拉刷新数据加载成功');
- wx.showToast({
- title: '刷新成功',
- icon: 'success',
- duration: 1500
- });
- })
- .catch(err => {
- console.error('下拉刷新数据加载失败:', err);
- wx.showToast({
- title: '刷新失败,请重试',
- icon: 'none',
- duration: 2000
- });
- })
- .finally(() => {
- console.log('====== 下拉刷新动画停止 ======');
- wx.stopPullDownRefresh();
- });
- },
-
- onShow() {
- console.log('seller页面onShow开始加载')
- // 获取用户入驻状态
- this.getUserStatus();
- // 检查页面是否是初次加载(onLoad已调用loadSupplies)
- // 避免在页面初次加载时重复加载数据
- if (!this.data._hasLoadedOnShow) {
- this.setData({
- _hasLoadedOnShow: true
- });
- // 为了避免onLoad和onShow的重复加载,这里不立即调用
- // 而是在短暂延迟后调用,确保不会与onLoad的加载冲突
- setTimeout(() => {
- this.loadSupplies();
- }, 500);
- } else {
- // 页面不是初次显示,正常加载数据
- this.loadSupplies();
- }
-
- // 更新自定义tabBar状态
- if (typeof this.getTabBar === 'function' && this.getTabBar()) {
- this.getTabBar().setData({
- selected: 2
- });
- }
- // 更新全局tab状态
- const app = getApp();
- app.updateCurrentTab('seller');
- },
-
- // 获取用户入驻状态
- getUserStatus() {
- const openid = wx.getStorageSync('openid');
- if (openid) {
- API.getUserInfo(openid)
- .then(response => {
- console.log('获取到的用户信息响应:', response);
- // 修复:访问data字段获取用户信息
- const userInfo = response.data || {};
- console.log('处理后的用户信息:', userInfo);
- this.setData({
- partnerstatus: userInfo.partnerstatus || ''
- });
- })
- .catch(err => {
- console.error('获取用户信息失败:', err);
- });
- }
- },
-
- // 加载货源列表并分类 - 修改为分页加载
- loadSupplies() {
- console.log('开始加载货源数据 - 分页模式');
-
- // 重置所有分页状态
- this.resetAllPagination();
-
- // 并行加载所有类型的货源
- return Promise.all([
- this.loadSuppliesFromServer('published', 1),
- this.loadSuppliesFromServer('pending', 1),
- this.loadSuppliesFromServer('rejected', 1),
- this.loadSuppliesFromServer('draft', 1)
- ]).then(results => {
- console.log('所有类型货源加载完成');
- return results;
- }).catch(err => {
- console.error('加载货源失败:', err);
- throw err;
- });
- },
-
- // 重置所有分页状态
- resetAllPagination() {
- this.setData({
- 'pagination.published.page': 1,
- 'pagination.published.hasMore': true,
- 'pagination.published.loading': false,
-
- 'pagination.pending.page': 1,
- 'pagination.pending.hasMore': true,
- 'pagination.pending.loading': false,
-
- 'pagination.rejected.page': 1,
- 'pagination.rejected.hasMore': true,
- 'pagination.rejected.loading': false,
-
- 'pagination.draft.page': 1,
- 'pagination.draft.hasMore': true,
- 'pagination.draft.loading': false,
-
- currentLoadingType: null
- });
- },
-
- // 搜索货源 - 修改为使用本地数据
- searchSupplies() {
- console.log('搜索货源,关键词:', this.data.searchKeyword);
-
- const keyword = this.data.searchKeyword.toLowerCase().trim();
- if (!keyword) {
- // 如果关键词为空,重新加载所有数据
- this.loadSupplies();
- return;
- }
-
- // 从所有货源中搜索
- const allSupplies = this.data.supplies;
-
- // 过滤符合条件的货源
- const filteredSupplies = allSupplies.filter(supply => {
- const name = (supply.name || '').toLowerCase();
- const productName = (supply.productName || '').toLowerCase();
- const yolk = (supply.yolk || '').toLowerCase();
- const spec = (supply.spec || '').toLowerCase();
-
- return name.includes(keyword) ||
- productName.includes(keyword) ||
- yolk.includes(keyword) ||
- spec.includes(keyword);
- });
-
- // 将过滤后的货源按照状态分类
- const publishedSupplies = filteredSupplies.filter(s => s.status === 'published');
- const pendingSupplies = filteredSupplies.filter(s => s.status === 'pending_review' || s.status === 'reviewed');
- const rejectedSupplies = filteredSupplies.filter(s => s.status === 'rejected');
- const draftSupplies = filteredSupplies.filter(s => s.status === 'draft' || s.status === 'sold_out');
-
- // 更新UI显示
- this.setData({
- publishedSupplies,
- pendingSupplies,
- rejectedSupplies,
- draftSupplies
- });
-
-
- },
-
- // 修改图片URL处理函数
- processImageUrls: function (imageUrls) {
- if (!imageUrls || !Array.isArray(imageUrls)) {
- return [];
- }
-
- return imageUrls.map(url => {
- if (!url || typeof url !== 'string') return '';
-
- let processedUrl = url.trim();
-
- // 处理占位符URL - 替换为本地默认图片
- if (processedUrl.startsWith('placeholder://')) {
- console.log('检测到占位符URL,替换为默认图片:', processedUrl);
- return '/images/default-product.png'; // 使用本地默认图片
- }
-
- // 处理临时文件路径
- if (processedUrl.startsWith('http://tmp/') || processedUrl.startsWith('wxfile://')) {
- console.log('检测到临时文件路径,保持原样:', processedUrl);
- return processedUrl;
- }
-
- // 确保HTTP URL格式正确
- if (processedUrl.startsWith('//')) {
- processedUrl = 'https:' + processedUrl;
- } else if (!processedUrl.startsWith('http') && !processedUrl.startsWith('/')) {
- // 如果是相对路径但没有斜杠,添加斜杠
- processedUrl = '/' + processedUrl;
- }
-
- return processedUrl;
- }).filter(url => url && url !== '');
- },
-
-
-
- // 直接从服务器获取货源数据并显示 - 支持分页
- loadSuppliesFromServer(type = 'all', page = 1) {
- return new Promise((resolve, reject) => {
- const openid = wx.getStorageSync('openid');
- console.log(`loadSuppliesFromServer - type: ${type}, page: ${page}, openid:`, openid);
-
- if (!openid) {
- console.warn('openid不存在,显示空数据状态,允许用户浏览页面');
- // 未登录状态下显示空数据,不跳转,允许用户浏览页面
- this.setData({
- supplies: [],
- publishedSupplies: [],
- pendingSupplies: [],
- rejectedSupplies: [],
- draftSupplies: []
- });
-
- resolve([]);
- return;
- }
-
- console.log(`开始从服务器获取${type}类型商品数据,第${page}页`);
-
- // 根据类型设置请求参数
- let status = [];
- let pageSize = 20;
-
- switch (type) {
- case 'published':
- status = ['published'];
- pageSize = this.data.pagination.published.pageSize;
- this.setData({
- 'pagination.published.loading': true,
- currentLoadingType: 'published'
- });
- break;
- case 'pending':
- status = ['pending_review', 'reviewed'];
- pageSize = this.data.pagination.pending.pageSize;
- this.setData({
- 'pagination.pending.loading': true,
- currentLoadingType: 'pending'
- });
- break;
- case 'rejected':
- status = ['rejected'];
- pageSize = this.data.pagination.rejected.pageSize;
- this.setData({
- 'pagination.rejected.loading': true,
- currentLoadingType: 'rejected'
- });
- break;
- case 'draft':
- status = ['draft', 'sold_out'];
- pageSize = this.data.pagination.draft.pageSize;
- this.setData({
- 'pagination.draft.loading': true,
- currentLoadingType: 'draft'
- });
- break;
- default:
- // 全部加载,不分类型
- status = ['all'];
- pageSize = 100; // 初始加载时使用较大值
- }
-
- const requestData = {
- openid: openid,
- viewMode: 'seller',
- status: status,
- page: page,
- pageSize: pageSize
- };
-
- console.log('请求参数:', requestData);
-
- API.getAllSupplies(requestData)
- .then(res => {
- console.log(`从服务器获取${type}类型数据响应:`, res);
-
- if (res && res.success && res.products) {
- console.log(`从服务器获取到${type}类型商品数据,共`, res.products.length, '条');
-
- // 处理服务器返回的商品数据
- console.log('【调试】服务器返回的商品数据:', res.products);
- const serverSupplies = res.products
- .filter(product => product.status !== 'hidden')
- .map(serverProduct => {
- // 状态映射
- const mappedStatus = serverProduct.status;
-
- // 处理图片URL
- let imageUrls = this.processImageUrls(serverProduct.imageUrls);
-
- // 处理创建时间
- const createdAt = serverProduct.created_at || null;
- const formattedCreatedAt = this.formatCreateTime(createdAt);
-
- return {
- id: serverProduct.productId,
- name: serverProduct.productName,
- productName: serverProduct.productName, // 【新增】同时设置productName字段
- price: serverProduct.price,
- minOrder: serverProduct.quantity,
- grossWeight: serverProduct.grossWeight,
- yolk: serverProduct.yolk,
- spec: serverProduct.specification,
- region: serverProduct.region || '未知地区', // 【修复】添加默认地区
- serverProductId: serverProduct.productId,
- status: mappedStatus,
- rejectReason: serverProduct.rejectReason || '',
- imageUrls: imageUrls,
- created_at: createdAt,
- formattedCreatedAt: formattedCreatedAt,
- currentImageIndex: 0,
- // 添加联系信息字段,确保与买蛋页面一致
- product_contact: serverProduct.product_contact || '',
- contact_phone: serverProduct.contact_phone || ''
- };
- });
-
- // 根据类型更新数据
- this.updateSuppliesByType(type, serverSupplies, res, page);
-
- resolve(serverSupplies);
- } else {
- console.log(`服务器没有返回${type}类型商品数据或返回格式不正确`);
- this.handleNoData(type);
- resolve([]);
- }
- })
- .catch(err => {
- console.error(`从服务器获取${type}类型数据失败:`, err);
- this.handleLoadError(type, err);
- reject(err);
- })
- .finally(() => {
- // 重置加载状态
- this.resetLoadingState(type);
- });
- });
- },
-
- // 根据类型更新货源数据
- updateSuppliesByType(type, newSupplies, response, currentPage) {
- const paginationKey = `pagination.${type}`;
-
- // 更新分页信息
- const hasMore = currentPage < (response.totalPages || 1);
- this.setData({
- [`${paginationKey}.hasMore`]: hasMore,
- [`${paginationKey}.page`]: currentPage
- });
-
- // 更新货源列表
- if (currentPage === 1) {
- // 第一页,直接替换
- this.setData({
- [`${type}Supplies`]: newSupplies
- });
- } else {
- // 后续页面,追加数据
- const existingSupplies = this.data[`${type}Supplies`] || [];
- const updatedSupplies = [...existingSupplies, ...newSupplies];
- this.setData({
- [`${type}Supplies`]: updatedSupplies
- });
- }
-
- // 更新总列表(用于搜索等功能)
- this.updateAllSupplies();
-
- console.log(`更新${type}类型货源完成,当前数量:`, this.data[`${type}Supplies`].length, '是否有更多:', hasMore);
- },
-
- // 更新所有货源列表(用于搜索)
- updateAllSupplies() {
- const allSupplies = [
- ...this.data.publishedSupplies,
- ...this.data.pendingSupplies,
- ...this.data.rejectedSupplies,
- ...this.data.draftSupplies
- ];
-
- this.setData({
- supplies: allSupplies
- });
- },
-
- // 处理无数据情况
- handleNoData(type) {
- const paginationKey = `pagination.${type}`;
- this.setData({
- [`${paginationKey}.hasMore`]: false,
- [`${type}Supplies`]: []
- });
- },
-
- // 处理加载错误
- handleLoadError(type, err) {
- const paginationKey = `pagination.${type}`;
- this.setData({
- [`${paginationKey}.loading`]: false
- });
-
- // 检查是否是用户不存在的错误
- if (err.message && (err.message.includes('404') || err.message.includes('用户不存在'))) {
- console.log('用户不存在,跳转到登录页面');
- wx.showToast({
- title: '用户不存在,请重新登录',
- icon: 'none',
- duration: 2000,
- success: () => {
- wx.removeStorageSync('openid');
- wx.removeStorageSync('userInfo');
- setTimeout(() => {
- wx.switchTab({
- url: '/pages/index/index'
- });
- }, 2000);
- }
- });
- }
- },
-
- // 重置加载状态
- resetLoadingState(type) {
- if (type !== 'all') {
- this.setData({
- [`pagination.${type}.loading`]: false,
- currentLoadingType: null
- });
- }
- },
-
- // 加载更多货源
- loadMoreSupplies(type) {
- const pagination = this.data.pagination[type];
-
- if (!pagination.hasMore || pagination.loading) {
- console.log(`没有更多${type}类型数据或正在加载中`);
- return;
- }
-
- console.log(`开始加载更多${type}类型数据,当前页码:`, pagination.page);
-
- const nextPage = pagination.page + 1;
- this.loadSuppliesFromServer(type, nextPage)
- .then(() => {
- console.log(`加载更多${type}类型数据成功`);
- })
- .catch(err => {
- console.error(`加载更多${type}类型数据失败:`, err);
- wx.showToast({
- title: '加载失败,请重试',
- icon: 'none',
- duration: 2000
- });
- });
- },
-
- // 已上架货源加载更多
- onReachPublishedBottom() {
- console.log('已上架货源滚动到底部,加载更多');
- this.loadMoreSupplies('published');
- },
-
- // 审核中货源加载更多
- onReachPendingBottom() {
- console.log('审核中货源滚动到底部,加载更多');
- this.loadMoreSupplies('pending');
- },
-
- // 审核失败货源加载更多
- onReachRejectedBottom() {
- console.log('审核失败货源滚动到底部,加载更多');
- this.loadMoreSupplies('rejected');
- },
-
- // 下架状态货源加载更多
- onReachDraftBottom() {
- console.log('下架状态货源滚动到底部,加载更多');
- this.loadMoreSupplies('draft');
- },
-
- // 从服务器同步最新的商品数据 (现在直接使用服务器数据,不再保存到本地存储)
- syncSuppliesFromServer() {
- // 调用新的直接从服务器获取数据的方法
- console.log('syncSuppliesFromServer: 直接从服务器获取最新数据');
- this.loadSuppliesFromServer();
- },
-
- // 从本地存储加载货源数据(已废弃,现在直接从服务器获取)
- loadSuppliesFromLocal() {
- console.log('loadSuppliesFromLocal: 已废弃,现在直接从服务器获取数据');
- this.loadSuppliesFromServer();
- },
-
- // 同步货源数据到商品列表 - 移除本地存储操作
- syncSuppliesToGoods(supplies) {
- try {
- console.log('开始同步货源数据到商品列表 - 通过服务器同步')
-
- // 直接通知服务器同步已上架商品,不操作本地存储
- // 修复:移除supply.status === 'reviewed',reviewed状态不应被视为已上架
- const publishedSupplies = supplies.filter(supply =>
- supply.status === 'published'
- );
-
- if (publishedSupplies.length > 0) {
- // 延迟一小段时间,避免与服务器交互过于频繁
- setTimeout(() => {
- // 这里应该有一个API调用,通知服务器同步商品
- // API.syncPublishedSuppliesToGoods(publishedSupplies)
- // .then(res => {
- // console.log('服务器同步商品成功:', res)
- // })
- // .catch(err => {
- // console.error('服务器同步商品失败:', err)
- // })
- console.log('已上架商品:', publishedSupplies)
- }, 500);
- }
- } catch (error) {
- console.error('同步货源到商品列表过程中发生错误:', error)
- }
- },
-
- // 显示一键登录弹窗
- showOneKeyLogin() {
- this.setData({
- showAuthModal: false,
- showOneKeyLoginModal: true
- })
- },
-
- // 关闭未授权提示弹窗
- closeAuthModal() {
- this.setData({ showAuthModal: false })
- },
-
- // 关闭一键登录弹窗
- closeOneKeyLoginModal() {
- this.setData({ showOneKeyLoginModal: false })
- },
-
- // 选择头像
- onChooseAvatar(e) {
- const { avatarUrl } = e.detail
- this.setData({
- avatarUrl
- })
- },
-
- // 处理昵称提交
- getUserName(e) {
- const { name } = e.detail.value
- const type = 'seller' // 卖家页面固定为卖家类型
-
- if (!name) {
- wx.showToast({
- title: '请输入昵称',
- icon: 'none',
- duration: 2000
- })
- return
- }
-
- // 创建用户信息对象
- const userInfo = {
- name: name,
- avatarUrl: this.data.avatarUrl,
- gender: 0,
- country: '',
- province: '',
- city: '',
- language: 'zh_CN'
- }
-
- // 保存用户信息
- this.saveUserInfo(userInfo, type)
-
- // 隐藏表单
- this.setData({
- showUserInfoForm: false
- })
-
- // 完成设置
- this.finishSetUserType(type)
- },
-
- // 取消用户信息表单
- cancelUserInfoForm() {
- this.setData({
- showUserInfoForm: false
- })
- wx.hideLoading()
- },
-
- // 处理手机号授权
- async onGetPhoneNumber(e) {
- // 打印详细错误信息,方便调试
- console.log('getPhoneNumber响应:', e.detail)
-
- // 关闭手机号授权弹窗
- this.setData({ showOneKeyLoginModal: false })
-
- // 用户点击拒绝授权
- if (e.detail.errMsg === 'getPhoneNumber:fail user deny') {
- wx.showToast({
- title: '需要授权手机号才能使用',
- icon: 'none',
- duration: 2000
- })
- return
- }
-
- // 处理没有权限的情况
- if (e.detail.errMsg === 'getPhoneNumber:fail no permission') {
- wx.showToast({
- title: '当前环境无法获取手机号权限',
- icon: 'none',
- duration: 3000
- })
- console.warn('获取手机号权限失败: 请注意,微信小程序获取手机号功能需要满足以下条件:1. 小程序必须完成微信企业认证;2. 需要在小程序后台配置相应权限;3. 必须使用button组件的open-type="getPhoneNumber"触发。')
- return
- }
-
- // 检查是否已经登录,避免重复授权
- const existingOpenid = wx.getStorageSync('openid')
- const existingUserId = wx.getStorageSync('userId')
- const existingUserInfo = wx.getStorageSync('userInfo')
-
- if (existingOpenid && existingUserId && existingUserInfo && existingUserInfo.phoneNumber) {
- console.log('用户已登录且手机号有效,直接完成身份设置')
- // 直接完成身份设置,跳过重复授权
- const currentUserType = this.data.pendingUserType || 'seller'
- this.finishSetUserType(currentUserType)
- return
- }
-
- wx.showLoading({
- title: '登录中...',
- mask: true
- })
-
- try {
- if (e.detail.errMsg === 'getPhoneNumber:ok') {
- // 用户同意授权,实际处理授权流程
- console.log('用户同意授权获取手机号')
-
- // 1. 先执行微信登录获取code
- const loginRes = await new Promise((resolve, reject) => {
- wx.login({
- success: resolve,
- fail: reject
- })
- })
-
- if (!loginRes.code) {
- throw new Error('获取登录code失败')
- }
-
- console.log('获取登录code成功:', loginRes.code)
-
- // 2. 使用code换取openid
- const openidRes = await API.getOpenid(loginRes.code)
-
- let openid = null;
- let userId = null;
- console.log('openidRes完整响应:', JSON.stringify(openidRes));
-
- if (openidRes && typeof openidRes === 'object') {
- if (openidRes.data && typeof openidRes.data === 'object') {
- console.log('识别到标准服务器返回格式,从data字段提取信息');
- openid = openidRes.data.openid || openidRes.data.OpenID || null;
- userId = openidRes.data.userId || null;
- } else {
- console.log('尝试从根对象直接提取openid');
- openid = openidRes.openid || openidRes.OpenID || null;
- userId = openidRes.userId || null;
- }
- }
-
- if (!openid) {
- console.error('无法从服务器响应中提取openid,完整响应:', JSON.stringify(openidRes));
- throw new Error(`获取openid失败: 服务器返回数据格式可能不符合预期,请检查服务器配置。响应数据为: ${JSON.stringify(openidRes)}`);
- }
-
- console.log('获取openid成功:', openid)
-
- // 3. 存储openid和session_key
- wx.setStorageSync('openid', openid)
-
- if (openidRes && openidRes.session_key) {
- wx.setStorageSync('sessionKey', openidRes.session_key)
- } else if (openidRes && openidRes.data && openidRes.data.session_key) {
- wx.setStorageSync('sessionKey', openidRes.data.session_key)
- }
-
- if (userId) {
- wx.setStorageSync('userId', userId)
- console.log('使用从服务器data字段提取的userId:', userId)
- } else if (openidRes && openidRes.userId) {
- wx.setStorageSync('userId', openidRes.userId)
- console.log('使用服务器根对象中的userId:', openidRes.userId)
- } else {
- const tempUserId = 'user_' + Date.now()
- wx.setStorageSync('userId', tempUserId)
- console.log('生成临时userId:', tempUserId)
- }
-
- // 4. 上传手机号加密数据到服务器解密
- const phoneData = {
- ...e.detail,
- openid: openid
- }
-
- console.log('准备上传手机号加密数据到服务器')
- const phoneRes = await API.uploadPhoneNumberData(phoneData)
-
- if (!phoneRes || (!phoneRes.success && !phoneRes.phoneNumber)) {
- if (phoneRes && phoneRes.phoneNumber) {
- console.warn('服务器返回格式可能不符合预期,但成功获取手机号');
- } else {
- throw new Error('获取手机号失败: ' + (phoneRes && phoneRes.message ? phoneRes.message : '未知错误'))
- }
- }
-
- const hasPhoneConflict = phoneRes.phoneNumberConflict || false
- const isNewPhone = phoneRes.isNewPhone || true
- const phoneNumber = phoneRes.phoneNumber || null
- const finalPhoneNumber = phoneNumber
-
- console.log('手机号解密结果:', {
- phoneNumber: finalPhoneNumber,
- hasPhoneConflict: hasPhoneConflict,
- isNewPhone: isNewPhone
- })
-
- // 5. 获取用户微信头像和昵称
- let userProfile = null;
- let tempUserInfo = {
- name: '微信用户',
- avatarUrl: this.data.avatarUrl,
- gender: 0,
- country: '',
- province: '',
- city: '',
- language: 'zh_CN',
- phoneNumber: finalPhoneNumber
- };
-
- try {
- userProfile = await new Promise((resolve, reject) => {
- wx.getUserProfile({
- desc: '用于完善会员资料',
- success: resolve,
- fail: reject
- });
- });
- console.log('获取用户信息成功:', userProfile);
-
- // 更新临时用户信息
- tempUserInfo = {
- name: userProfile.userInfo.name || userProfile.userInfo.nickName,
- avatarUrl: userProfile.userInfo.avatarUrl,
- gender: userProfile.userInfo.gender,
- country: userProfile.userInfo.country,
- province: userProfile.userInfo.province,
- city: userProfile.userInfo.city,
- language: userProfile.userInfo.language,
- phoneNumber: finalPhoneNumber
- };
- } catch (err) {
- console.warn('获取用户信息失败:', err);
- // 如果获取失败,继续使用现有临时用户信息
- }
-
- const storedUserId = wx.getStorageSync('userId')
- const currentUserType = this.data.pendingUserType || 'seller'
-
- console.log('用户身份类型:', currentUserType)
-
- if (this.data.pendingUserType) {
- this.setData({ pendingUserType: null })
- }
-
- // 保存用户信息并等待上传完成
- console.log('开始保存用户信息并上传到服务器...')
- const uploadResult = await this.saveUserInfo(tempUserInfo, currentUserType)
- console.log('用户信息保存并上传完成')
-
- wx.hideLoading()
-
- if (uploadResult && uploadResult.phoneNumberConflict) {
- wx.showToast({
- title: '登录成功,但手机号已被其他账号绑定',
- icon: 'none',
- duration: 3000
- })
- } else {
- wx.showToast({
- title: '登录成功,手机号已绑定',
- icon: 'success',
- duration: 2000
- })
- }
-
- // 完成设置并跳转
- this.finishSetUserType(currentUserType)
- } else {
- console.log('手机号授权失败:', e.detail.errMsg)
- wx.hideLoading()
- wx.showToast({
- title: '需要授权手机号才能使用',
- icon: 'none',
- duration: 2000
- })
- return
- }
- } catch (error) {
- wx.hideLoading()
- console.error('登录过程中发生错误:', error)
-
- let errorMsg = '登录失败,请重试'
- if (error.message.includes('网络')) {
- errorMsg = '网络连接失败,请检查网络后重试'
- } else if (error.message.includes('服务器')) {
- errorMsg = '服务器连接失败,请稍后重试'
- }
-
- wx.showToast({
- title: errorMsg,
- icon: 'none',
- duration: 3000
- })
-
- try {
- wx.removeStorageSync('openid')
- wx.removeStorageSync('sessionKey')
- wx.removeStorageSync('userId')
- } catch (e) {
- console.error('清除临时登录信息失败:', e)
- }
- }
- },
-
- // 保存用户信息
- async saveUserInfo(userInfo, type) {
- try {
- // 获取userId
- const userId = wx.getStorageSync('userId')
-
- // 保存用户信息到本地存储
- wx.setStorageSync('userInfo', userInfo)
-
- // 更新用户类型信息
- let users = wx.getStorageSync('users') || {}
- users[userId] = {
- ...users[userId],
- type: type,
- userInfo: userInfo,
- lastLoginTime: Date.now()
- }
- wx.setStorageSync('users', users)
-
- console.log('用户信息保存成功:', userInfo)
-
- // 上传用户信息到服务器
- return await this.uploadUserInfoToServer(userInfo, userId, type)
- } catch (error) {
- console.error('保存用户信息失败:', error)
- throw error
- }
- },
-
- // 上传用户信息到服务器
- async uploadUserInfoToServer(userInfo, userId, type) {
- const openid = wx.getStorageSync('openid')
-
- const uploadData = {
- userId: userId,
- openid: openid,
- ...userInfo,
- type: type,
- timestamp: Date.now()
- }
-
- try {
- const res = await API.uploadUserInfo(uploadData)
- console.log('用户信息上传成功:', res)
-
- // 入驻成功后,将用户类型设置为seller
- API.updateUserType('seller');
-
- return res
- } catch (err) {
- console.error('用户信息上传失败:', err)
- return {
- success: true,
- message: '本地登录成功,服务器连接失败'
- }
- }
- },
-
- // 完成用户类型设置并跳转
- finishSetUserType(type) {
- const userId = wx.getStorageSync('userId')
-
- // 获取当前用户类型
- let users = wx.getStorageSync('users')
- if (typeof users !== 'object' || users === null) {
- users = {}
- }
- if (!users[userId]) {
- users[userId] = {}
- }
-
- // 如果当前类型是 Colleague,直接跳转到对应页面,不修改用户类型
- if (users[userId].type === 'Colleague') {
- console.log('当前用户是 Colleague 类型,不允许修改用户类型,直接跳转')
- setTimeout(() => {
- if (type === 'buyer') {
- wx.switchTab({ url: '/pages/buyer/index' })
- } else {
- wx.switchTab({ url: '/pages/seller/index' })
- }
- }, 1000)
- return
- }
-
- // 更新用户类型
- users[userId].type = type
- wx.setStorageSync('users', users)
-
- // 打标签
- let tags = wx.getStorageSync('tags')
- if (typeof tags !== 'object' || tags === null) {
- tags = {}
- }
- tags[userId] = tags[userId] || []
- tags[userId] = tags[userId].filter(tag => !tag.startsWith('身份:'))
- tags[userId].push(`身份:${type}`)
- wx.setStorageSync('tags', tags)
-
- console.log('用户类型设置完成,准备跳转到', type === 'buyer' ? '买家页面' : '卖家页面')
-
- setTimeout(() => {
- if (type === 'buyer') {
- wx.switchTab({ url: '/pages/buyer/index' })
- } else {
- // 卖家登录成功后,重新显示创建货源弹窗
- // 从本地存储加载保存的表单数据
- const savedSupply = wx.getStorageSync('newSupplyDraft') || { name: '', price: '', minOrder: '', yolk: '', spec: '', imageUrls: [] };
- this.setData({
- showImagePreview: false,
- showModal: true,
- newSupply: savedSupply
- });
- this.disablePageScroll();
- }
- }, 500)
- },
-
- // 显示添加货源弹窗
- showAddSupply(e) {
- console.log('点击创建新货源按钮');
-
- // 阻止事件冒泡,防止触发父元素的点击事件
- if (e && e.stopPropagation) {
- e.stopPropagation();
- }
-
- // 从本地存储加载之前保存的货源数据
- const savedSupply = wx.getStorageSync('newSupplyDraft') || { name: '', price: '', minOrder: '', yolk: '', spec: '', imageUrls: [] };
-
- // 直接显示创建货源弹窗,无需登录验证
- this.setData({
- showImagePreview: false,
- showModal: true,
- newSupply: savedSupply
- });
-
- // 锁定页面滚动
- this.disablePageScroll();
- },
-
- // 隐藏弹窗
- hideModal() {
- this.setData({
- showModal: false,
- showImagePreview: false // 确保图片预览弹窗关闭
- })
- // 恢复页面滚动
- this.enablePageScroll()
- },
-
- // 隐藏编辑弹窗
- hideEditModal() {
- this.setData({
- showEditModal: false
- })
- // 恢复页面滚动
- this.enablePageScroll()
- },
-
- // 禁用页面滚动
- disablePageScroll() {
- // 获取页面实例并设置样式来禁用滚动
- const pages = getCurrentPages()
- const currentPage = pages[pages.length - 1]
- if (currentPage) {
- currentPage.setData({
- pageScrollLock: true
- })
- }
- },
-
- // 启用页面滚动
- enablePageScroll() {
- // 获取页面实例并恢复滚动
- const pages = getCurrentPages()
- const currentPage = pages[pages.length - 1]
- if (currentPage) {
- currentPage.setData({
- pageScrollLock: false
- })
- }
- },
-
- // 输入内容处理
- onInput(e) {
- const field = e.currentTarget.dataset.field
- const value = e.detail.value
- const newSupply = this.data.newSupply
- newSupply[field] = value
- this.setData({ newSupply })
-
- // 实时保存到本地存储
- wx.setStorageSync('newSupplyDraft', newSupply);
- },
-
- // 编辑输入处理
- onEditInput(e) {
- const field = e.currentTarget.dataset.field
- const value = e.detail.value
- // 创建一个新的对象,而不是直接修改data中的对象
- this.setData({
- editSupply: {
- ...this.data.editSupply,
- [field]: value
- }
- })
- },
-
- // 新创建货源地区选择处理
- onNewSupplyRegionChange(e) {
- const regionArray = e.detail.value
- const region = regionArray.join(' ')
-
- this.setData({
- newSupplyRegionArray: regionArray,
- newSupply: {
- ...this.data.newSupply,
- region: region
- }
- })
-
- // 实时保存到本地存储
- wx.setStorageSync('newSupplyDraft', this.data.newSupply);
- },
-
- // 编辑货源地区选择处理
- onEditSupplyRegionChange(e) {
- const regionArray = e.detail.value
- const region = regionArray.join(' ')
-
- this.setData({
- editSupplyRegionArray: regionArray,
- editSupply: {
- ...this.data.editSupply,
- region: region
- }
- })
- },
-
- // 处理蛋黄选择变更
- onYolkChange(e) {
- const index = e.detail.value
- const yolk = this.data.yolkOptions[index]
- this.setData({
- 'newSupply.yolkIndex': index,
- 'newSupply.yolk': yolk
- })
- },
-
- // 处理规格选择变更 - 现在直接打开自定义弹窗
- onSpecChange(e) {
- // 由于我们使用自定义弹窗,这个函数现在只需要打开弹窗即可
- this.openSpecSelectModal({ currentTarget: { dataset: { mode: 'create' } } });
- },
-
- // 处理编辑模式下的蛋黄选择变更
- onEditYolkChange(e) {
- console.warn('此方法已弃用,请使用openYolkSelectModal替代');
- },
-
- // 处理编辑模式下的规格选择变更 - 现在直接打开自定义弹窗
- onEditSpecChange(e) {
- // 由于我们使用自定义弹窗,这个函数现在只需要打开弹窗即可
- this.openSpecSelectModal({ currentTarget: { dataset: { mode: 'edit' } } });
- },
- // 商品名称选择变化处理
- onNameChange(e) {
- const index = e.detail.value
- const productName = this.data.productNameOptions[index]
- const newSupply = this.data.newSupply
- // 品种和商品名称保持一致
- newSupply.name = productName // 更新品种字段
- newSupply.productName = productName // 更新商品名称字段
- this.setData({ newSupply })
- },
-
- // 编辑商品名称选择变化处理
- onEditNameChange(e) {
- console.warn('此方法已弃用,请使用openNameSelectModal替代');
- },
- // 添加新货源 - 先创建商品再上传图片(修复版)
- addSupply() {
- // 检查登录状态
- const userId = wx.getStorageSync('userId');
- const openid = wx.getStorageSync('openid');
- const userInfo = wx.getStorageSync('userInfo');
-
- if (!userId || !openid || !userInfo) {
- console.log('用户未登录,显示登录提示');
- // 登录前保存当前表单数据到本地存储
- wx.setStorageSync('newSupplyDraft', this.data.newSupply);
- // 用户未登录,显示未授权提示弹窗
- wx.showModal({
- title: '登录提示',
- content: '请先登录再发布商品',
- showCancel: true,
- confirmText: '去登录',
- success: (res) => {
- if (res.confirm) {
- // 用户点击确定,跳转到登录页面或显示登录弹窗
- this.setData({
- showAuthModal: true,
- pendingUserType: 'seller'
- });
- }
- }
- });
- return;
- }
-
- const { name, price, minOrder, yolk, spec, region, imageUrls } = this.data.newSupply
- if (!name || !price || !minOrder || !yolk) {
- wx.showToast({ title: '请填写完整信息', icon: 'none', duration: 2000 })
- return
- }
-
- // 显示加载中提示
- wx.showLoading({ title: '正在验证权限...', mask: true })
-
- // 检查用户的partnerstatus是否为approved
- API.getUserInfo(openid)
- .then(response => {
- const userInfoRes = response.data;
- console.log('获取用户信息成功:', userInfoRes)
-
- // 检查partnerstatus字段
- const partnerStatus = userInfoRes.partnerstatus || 'pending'
- console.log('用户合作状态:', partnerStatus)
-
- if (partnerStatus !== 'approved') {
- throw new Error('partnerstatus_not_approved')
- }
-
- // 第一步:先创建商品(不带图片)
- const productData = {
- productName: name,
- price: price, // 保留原始字符串,不进行数字转换
- quantity: Number(minOrder),
- grossWeight: this.data.newSupply.grossWeight && this.data.newSupply.grossWeight !== '' ? this.data.newSupply.grossWeight : "",
-
- yolk: yolk,
- specification: spec || '',
- region: region || '', // 【新增】添加地区字段
- rejectReason: '',
- imageUrls: [] // 明确设置为空数组
- }
-
- console.log('第一步:准备创建商品,数据:', productData)
-
- // 更新加载提示
- wx.showLoading({ title: '正在创建商品...', mask: true })
-
- // 调用API创建商品(不带图片)
- return API.publishProduct(productData)
- })
- .then(res => {
- console.log('商品创建成功:', res)
-
- // 第二步:如果有图片,上传图片到已创建的商品
- if (imageUrls && imageUrls.length > 0) {
- wx.showLoading({ title: '正在上传图片...', mask: true })
- console.log('开始上传图片到已创建商品,数量:', imageUrls.length)
-
- // 获取创建的商品ID - 从多个可能的位置获取
- const productId = res.productId || res.data?.productId || res.product?.productId
-
- if (productId) {
- console.log('找到商品ID:', productId)
- // 【关键修复】使用专门的方法上传图片到已存在商品
- return this.uploadImagesToExistingProduct(productId, imageUrls, openid)
- .then(uploadRes => {
- console.log('图片上传成功:', uploadRes)
- return { ...res, imageUpload: uploadRes }
- })
- } else {
- console.error('无法获取商品ID,响应数据:', res)
- throw new Error('无法获取商品ID,无法上传图片')
- }
- } else {
- // 没有图片,直接返回
- return res
- }
- })
- .then(finalRes => {
- wx.hideLoading()
- wx.showToast({
- title: imageUrls && imageUrls.length > 0 ? '创建成功,图片已上传' : '创建成功',
- duration: 3000
- })
-
- // 重置表单
- this.setData({
- showModal: false,
- newSupply: { name: '', price: '', minOrder: '', yolk: '', spec: '', imageUrls: [] }
- })
-
- // 清除本地存储的草稿数据
- wx.removeStorageSync('newSupplyDraft');
-
- this.enablePageScroll()
-
- // 重新加载数据
- this.loadSupplies()
- })
- .catch(err => {
- console.error('商品创建或图片上传失败:', err)
- wx.hideLoading()
-
- // 处理权限不足的情况
- if (err.message === 'partnerstatus_not_approved') {
- wx.showModal({
- title: '权限不足',
- content: '您的合作伙伴身份尚未通过审核,请等待审核通过后再发布商品',
- showCancel: true,
- cancelText: '取消',
- confirmText: '立即入驻',
- success: (res) => {
- if (res.confirm) {
- // 跳转到入驻页面
- wx.navigateTo({
- url: '/pages/settlement/index'
- })
- }
- }
- })
- return
- }
-
- // 其他错误处理:所有错误都显示通用提示,不再跳转登录
- let errorMsg = '上传服务器失败'
- if (err.message && err.message.includes('商品不存在')) {
- errorMsg = '商品创建失败,无法上传图片'
- }
- wx.showModal({
- title: '发布失败',
- content: errorMsg + '\n\n错误详情: ' + (err.message || JSON.stringify(err)),
- showCancel: false,
- success: () => {
- this.loadSupplies()
- }
- })
- })
- },
-
- // 上传商品图片 - 修复版,专门用于为已存在商品上传图片
- uploadProductImages(productId, imageUrls) {
- return new Promise((resolve, reject) => {
- if (!productId) {
- reject(new Error('商品ID不能为空'))
- return
- }
-
- if (!imageUrls || imageUrls.length === 0) {
- resolve({ success: true, message: '没有图片需要上传' })
- return
- }
-
- console.log('开始为已存在商品上传图片,商品ID:', productId, '图片数量:', imageUrls.length)
-
- // 获取openid
- const openid = wx.getStorageSync('openid')
- if (!openid) {
- reject(new Error('用户未登录'))
- return
- }
-
- // 【关键修复】使用专门的图片上传方法,而不是创建新商品
- this.uploadImagesToExistingProduct(productId, imageUrls, openid)
- .then(resolve)
- .catch(reject)
- })
- },
-
- // 【修复】上传商品图片 - 确保顺序执行
- uploadImagesToExistingProduct(productId, imageUrls, openid) {
- return new Promise((resolve, reject) => {
- console.log('【图片上传】开始为已存在商品上传图片,商品ID:', productId);
-
- // 【关键修复】顺序上传图片,避免并发问题
- const uploadSequentially = async () => {
- const results = [];
-
- for (let i = 0; i < imageUrls.length; i++) {
- try {
- console.log(`顺序上传第${i + 1}/${imageUrls.length}张图片`);
-
- const result = await new Promise((resolveUpload, rejectUpload) => {
- const formData = {
- productId: productId,
- openid: openid,
- action: 'add_images_only',
- imageIndex: i,
- totalImages: imageUrls.length,
- isUpdate: 'true',
- timestamp: Date.now()
- };
-
- wx.uploadFile({
- url: API.BASE_URL + '/api/products/upload',
- filePath: imageUrls[i],
- name: 'images',
- formData: formData,
- success: (res) => {
- if (res.statusCode === 200) {
- try {
- const data = JSON.parse(res.data);
- if (data.success) {
- console.log(`第${i + 1}张图片上传成功,当前总数:`, data.totalCount);
- resolveUpload(data);
- } else {
- rejectUpload(new Error(data.message || '图片上传失败'));
- }
- } catch (parseError) {
- rejectUpload(new Error('服务器响应格式错误'));
- }
- } else {
- rejectUpload(new Error(`HTTP ${res.statusCode}`));
- }
- },
- fail: (err) => {
- rejectUpload(new Error('网络错误: ' + err.errMsg));
- }
- });
- });
-
- results.push(result);
-
- // 添加延迟,避免服务器处理压力过大
- if (i < imageUrls.length - 1) {
- await new Promise(resolve => setTimeout(resolve, 500));
- }
-
- } catch (error) {
- console.error(`第${i + 1}张图片上传失败:`, error);
- // 继续上传其他图片,不中断流程
- results.push({ success: false, error: error.message });
- }
- }
-
- return results;
- };
-
- uploadSequentially()
- .then(results => {
- // 取最后一个成功的结果作为最终状态
- const successfulResults = results.filter(r => r && r.success);
- if (successfulResults.length > 0) {
- const lastResult = successfulResults[successfulResults.length - 1];
- resolve({
- success: true,
- message: `成功上传${successfulResults.length}张图片`,
- imageUrls: lastResult.imageUrls || [],
- allImageUrls: lastResult.allImageUrls || [],
- uploadedCount: successfulResults.length,
- totalCount: lastResult.totalCount || successfulResults.length,
- results: results
- });
- } else {
- reject(new Error('所有图片上传失败'));
- }
- })
- .catch(error => {
- console.error('图片上传失败:', error);
- reject(error);
- });
- });
- },
-
- // 准备上架操作:只显示编辑页面,用户点击提交后才执行上架
- preparePublishSupply(e) {
- // 阻止事件冒泡,防止触发父元素的点击事件
- if (e && e.stopPropagation) {
- e.stopPropagation();
- }
-
- // 设置自动上架标志为true
- this.setData({
- autoPublishAfterEdit: true
- });
- console.log('设置编辑后自动上架标志为true');
-
- // 调用showEditSupply方法显示编辑页面,但不自动执行上架
- this.showEditSupply(e, true); // 传递第二个参数表示这是上架操作
- },
-
- // 保存编辑后的货源信息
- saveEdit() {
- const { editSupply, autoPublishAfterEdit } = this.data;
-
- // 验证必填信息
- if (!editSupply.name || !editSupply.price || !editSupply.minOrder || !editSupply.yolk) {
- wx.showToast({ title: '请填写完整信息', icon: 'none', duration: 2000 });
- return;
- }
-
- // 显示加载中提示
- wx.showLoading({ title: '正在同步...', mask: true });
-
- // 获取openid
- const openid = wx.getStorageSync('openid');
-
- if (!openid) {
- wx.hideLoading();
- wx.showModal({
- title: '登录状态异常',
- content: '您的登录状态已失效,请重新登录后再尝试保存',
- showCancel: false,
- success: () => {
- wx.showToast({
- title: '保存失败,请先登录',
- icon: 'none',
- duration: 3000
- });
- this.setData({ showEditModal: false });
- this.enablePageScroll();
- }
- });
- return;
- }
-
- // 检查用户合作状态
- API.getUserInfo(openid)
- .then(response => {
- const userInfo = response.data;
- if (userInfo.partnerstatus !== 'approved') {
- wx.hideLoading();
- wx.showModal({
- title: '权限不足',
- content: '您的合作伙伴身份尚未通过审核,无法保存商品',
- showCancel: true,
- cancelText: '取消',
- confirmText: '立即入驻',
- success: (res) => {
- if (res.confirm) {
- // 跳转到入驻页面
- wx.navigateTo({
- url: '/pages/settlement/index'
- })
- }
- this.setData({ showEditModal: false });
- this.enablePageScroll();
- }
- });
- return Promise.reject('partnerstatus not approved');
- }
- return Promise.resolve();
- })
- .catch(err => {
- if (err !== 'partnerstatus not approved') {
- wx.hideLoading();
- wx.showToast({
- title: '获取用户信息失败',
- icon: 'none',
- duration: 3000
- });
- this.setData({ showEditModal: false });
- this.enablePageScroll();
- }
- return Promise.reject(err);
- })
- .then(() => {
- // 【关键修复】准备商品数据 - 确保包含地区字段
- // 品种和商品名称保持一致,使用商品名称的值
- const productName = editSupply.productName || editSupply.name;
- const productData = {
- productName: productName, // 使用统一的商品名称
- price: editSupply.price, // 保留原始字符串,不进行数字转换
- quantity: Number(editSupply.minOrder),
- grossWeight: editSupply.grossWeight !== undefined && editSupply.grossWeight !== null && editSupply.grossWeight !== '' ? editSupply.grossWeight : "",
- yolk: editSupply.yolk,
- specification: editSupply.spec || '',
- region: editSupply.region || '', // 【重要】确保地区字段传递
- imageUrls: editSupply.imageUrls || [],
- created_at: new Date().toISOString(),
- status: autoPublishAfterEdit ? 'pending_review' : ''
- };
-
- console.log('【调试】准备提交的商品数据:', {
- productData: productData,
- hasRegion: !!productData.region,
- regionValue: productData.region
- });
-
- // 判断是编辑现有商品还是创建新商品
- if (editSupply.serverProductId) {
- // 编辑现有商品
- productData.productId = editSupply.serverProductId;
-
- console.log('【调试】调用API.editProduct,商品ID:', editSupply.serverProductId);
-
- // 【关键修复】使用正确的API调用格式
- const requestData = {
- openid: openid,
- productId: editSupply.serverProductId,
- product: {
- productName: productData.productName,
- price: productData.price,
- quantity: productData.quantity,
- grossWeight: productData.grossWeight,
- yolk: productData.yolk,
- specification: productData.specification,
- region: productData.region, // 【重要】确保在product对象中传递地区字段
- imageUrls: productData.imageUrls
- },
- status: productData.status || ''
- };
-
- console.log('【调试】最终发送的请求数据:', requestData);
-
- // 直接使用wx.request调用,避免API封装层的问题
- wx.request({
- url: API.BASE_URL + '/api/product/edit',
- method: 'POST',
- data: requestData,
- success: (res) => {
- console.log('【调试】编辑商品成功响应:', res);
- wx.hideLoading();
- this.setData({ showEditModal: false });
- this.enablePageScroll();
- wx.showToast({ title: '更新成功', duration: 2000 });
-
- // 重新加载数据
- setTimeout(() => {
- this.loadSupplies();
- }, 100);
- },
- fail: (err) => {
- console.error('【调试】编辑商品失败:', err);
- wx.hideLoading();
- wx.showToast({ title: '保存失败,请重试', icon: 'none', duration: 2000 });
- }
- });
- } else {
- // 创建新商品并提交审核
- // 调用添加商品接口
- wx.request({
- url: API.BASE_URL + '/api/product/add',
- method: 'POST',
- data: productData,
- success: (res) => {
- console.log('商品创建成功:', res);
- wx.hideLoading();
-
- // 关闭编辑弹窗
- this.setData({ showEditModal: false });
- // 恢复页面滚动
- this.enablePageScroll();
-
- wx.showToast({ title: '更新成功,等待审核', duration: 2000 });
-
- // 重新加载商品列表
- setTimeout(() => {
- this.loadSupplies();
- }, 100);
- },
- fail: (err) => {
- console.error('商品创建失败:', err);
- wx.hideLoading();
- wx.showToast({ title: '创建失败,请重试', icon: 'none', duration: 2000 });
- }
- });
- }
- });
- },
-
- // 预览图片
- previewImage(e) {
- const { urls, index } = e.currentTarget.dataset
-
- console.log('准备预览图片,原始URLs:', urls);
- console.log('当前预览图片索引:', index);
- console.log('当前预览图片原始URL:', urls[index]);
-
- // 修复图片URL格式化问题
- const formattedUrls = urls.map(url => {
- if (!url) return '';
- // 移除URL中的引号
- let formattedUrl = url.toString().replace(/['"`]/g, '');
- // 确保URL以http://或https://开头,特殊处理wxfile://格式
- // 特殊处理占位符URL(以placeholder://协议开头)
- const isHttpProtocol = formattedUrl.startsWith('http');
- const isWxfileProtocol = formattedUrl.startsWith('wxfile://');
- const isPlaceholderUrl = formattedUrl.startsWith('placeholder://');
-
- console.log('previewImage - 原始URL:', url);
- console.log('previewImage - 移除引号后的URL:', formattedUrl);
- console.log('previewImage - isHttpProtocol:', isHttpProtocol, 'isWxfileProtocol:', isWxfileProtocol, 'isPlaceholderUrl:', isPlaceholderUrl);
-
- // 对于占位符URL,返回空字符串,这样就不会在预览中显示它们
- if (isPlaceholderUrl) {
- console.log('previewImage - 占位符URL,不参与预览:', formattedUrl);
- return '';
- }
-
- if (formattedUrl && !isHttpProtocol && !isWxfileProtocol) {
- console.warn('previewImage - 图片URL缺少协议,添加https://前缀:', formattedUrl);
- formattedUrl = 'https://' + formattedUrl;
- } else {
- console.log('previewImage - URL已包含有效协议或为wxfile格式,无需添加前缀:', formattedUrl);
- }
-
- // 尝试解码可能被编码的URL路径段
- try {
- // 先检查是否包含%2F等已编码的斜杠
- if (formattedUrl.includes('%2F')) {
- // 只解码路径部分,保留查询参数
- const parts = formattedUrl.split('?');
- if (parts.length > 1) {
- formattedUrl = decodeURIComponent(parts[0]) + '?' + parts[1];
- } else {
- formattedUrl = decodeURIComponent(formattedUrl);
- }
- }
- } catch (e) {
- console.error('解码URL失败:', e);
- }
- // 简单验证URL格式
- if (formattedUrl && /^https?:\/\/.+\..+/.test(formattedUrl)) {
- return formattedUrl;
- }
- return '';
- });
-
- console.log('格式化后的URLs:', formattedUrls);
- console.log('当前预览图片格式化后URL:', formattedUrls[index]);
-
- // 锁定页面滚动
- this.disablePageScroll();
-
- this.setData({
- showImagePreview: true,
- previewImageUrls: formattedUrls.filter(url => url), // 过滤掉无效URL
- previewImageIndex: parseInt(index)
- })
- },
-
- // 跳转到商品详情页面
- showGoodsDetail: function (e) {
- // 检查用户是否登录
- const openid = wx.getStorageSync('openid');
- const userId = wx.getStorageSync('userId');
-
- if (!openid || !userId) {
- console.log('用户未登录,显示登录提示和弹窗');
- // 提示登录后才可查看详情
- wx.showToast({
- title: '登录后才可查看详情',
- icon: 'none',
- duration: 1500
- });
- // 显示登录弹窗
- setTimeout(() => {
- this.showOneKeyLogin();
- });
- return;
- }
-
- const goodsItem = e.currentTarget.dataset.item;
- // 跳转到商品详情页面,并传递商品数据和来源标识,使用encodeURIComponent编码JSON字符串
- wx.navigateTo({
- url: '/pages/goods-detail/goods-detail?goodsData=' + encodeURIComponent(JSON.stringify(goodsItem)) + '&fromSeller=1'
- });
- },
-
- // 关闭图片预览
- closeImagePreview() {
- this.setData({
- showImagePreview: false
- })
-
- // 恢复页面滚动
- this.enablePageScroll();
- },
-
- // 切换预览图片
- onPreviewImageChange(e) {
- this.setData({
- previewImageIndex: e.detail.current,
- // 切换图片时重置缩放状态
- scale: 1,
- offsetX: 0,
- offsetY: 0
- })
- },
-
- // 处理图片点击事件
- handleImageTap() {
- // 清除之前的双击计时器
- if (this.data.doubleTapTimeout) {
- clearTimeout(this.data.doubleTapTimeout)
- this.setData({ doubleTapTimeout: null })
- }
-
- // 增加双击计数
- const newDoubleTapCount = this.data.doubleTapCount + 1
- this.setData({ doubleTapCount: newDoubleTapCount })
-
- // 如果是第一次点击,设置计时器
- if (newDoubleTapCount === 1) {
- const timer = setTimeout(() => {
- // 单击操作:重置缩放
- this.resetZoom()
- this.setData({ doubleTapCount: 0, doubleTapTimeout: null })
- }, 300)
- this.setData({ doubleTapTimeout: timer })
- } else if (newDoubleTapCount === 2) {
- // 双击操作:切换缩放状态
- if (this.data.scale > 1) {
- this.resetZoom()
- } else {
- this.zoomToFit(this.data.imageWidth, this.data.imageHeight)
- }
- this.setData({ doubleTapCount: 0, doubleTapTimeout: null })
- }
- },
-
- // 处理触摸开始事件
- handleTouchStart(e) {
- // 清除双击计时器
- if (this.data.doubleTapTimeout) {
- clearTimeout(this.data.doubleTapTimeout)
- this.setData({ doubleTapTimeout: null, doubleTapCount: 0 })
- }
-
- // 双指触摸时计算距离
- if (e.touches.length === 2) {
- const distance = this.calculateDistance(e.touches[0], e.touches[1])
- this.setData({ lastDistance: distance })
- } else if (e.touches.length === 1) {
- // 单指触摸时记录触摸点 - 使用pageX和pageY而非clientX和clientY
- const touch = e.touches[0]
- this.setData({
- lastTouchPoint: {
- pageX: touch.pageX,
- pageY: touch.pageY
- }
- })
- }
- },
-
- // 处理触摸移动事件
- handleTouchMove(e) {
- // 小程序中阻止冒泡通过catchtap等方式实现
-
- if (e.touches.length === 2) {
- // 双指缩放
- const currentDistance = this.calculateDistance(e.touches[0], e.touches[1])
- const scaleRatio = currentDistance / this.data.lastDistance
- let newScale = this.data.scale * scaleRatio
-
- // 限制缩放范围
- newScale = Math.max(this.data.minScale, Math.min(this.data.maxScale, newScale))
-
- this.setData({
- scale: newScale,
- lastDistance: currentDistance
- })
- } else if (e.touches.length === 1 && this.data.scale > 1 && this.data.lastTouchPoint) {
- // 单指移动(仅在缩放后可移动)
- const currentTouch = e.touches[0]
- // 使用pageX和pageY而非clientX和clientY
- const deltaX = currentTouch.pageX - this.data.lastTouchPoint.pageX
- const deltaY = currentTouch.pageY - this.data.lastTouchPoint.pageY
-
- let newOffsetX = this.data.offsetX + deltaX
- let newOffsetY = this.data.offsetY + deltaY
-
- // 限制拖动范围
- const maxOffsetX = (this.data.imageWidth * this.data.scale - this.data.imageWidth) / 2
- const maxOffsetY = (this.data.imageHeight * this.data.scale - this.data.imageHeight) / 2
-
- newOffsetX = Math.max(-maxOffsetX, Math.min(maxOffsetX, newOffsetX))
- newOffsetY = Math.max(-maxOffsetY, Math.min(maxOffsetY, newOffsetY))
-
- this.setData({
- offsetX: newOffsetX,
- offsetY: newOffsetY,
- lastTouchPoint: {
- pageX: currentTouch.pageX,
- pageY: currentTouch.pageY
- }
- })
- }
- },
-
- // 处理触摸结束事件
- handleTouchEnd() {
- // 重置触摸点和距离
- this.setData({
- lastTouchPoint: null,
- lastDistance: 0
- })
- },
-
- // 重置缩放
- resetZoom() {
- this.setData({
- scale: 1,
- offsetX: 0,
- offsetY: 0
- })
- },
-
- // 计算两点之间的距离
- calculateDistance(touch1, touch2) {
- // 在小程序中使用pageX和pageY而非clientX和clientY
- const dx = touch1.pageX - touch2.pageX
- const dy = touch1.pageY - touch2.pageY
- return Math.sqrt(dx * dx + dy * dy)
- },
-
- // 缩放图片以适应屏幕
- zoomToFit(imageWidth, imageHeight) {
- // 假设屏幕宽度为375px
- const screenWidth = 375
- let newScale = 2
-
- this.setData({ scale: newScale })
- },
-
- // 图片加载完成事件
- onPreviewImageLoad(e) {
- this.setData({
- imageWidth: e.detail.width,
- imageHeight: e.detail.height
- })
- },
-
- // 图片加载失败处理 - 增强版
- imageError(e) {
- const url = e.currentTarget.dataset.src || '未知URL';
- const errMsg = e.detail.errMsg || '未知错误';
-
- console.error(`图片加载失败 [${errMsg}]: ${url}`);
-
- // 尝试使用占位图替代
- const target = e.currentTarget;
- try {
- // 在实际运行中,小程序会自动使用fallback-src
- // 这里添加日志记录以便追踪
- console.log(`为失败图片设置占位图: ${url}`);
- } catch (err) {
- console.error('设置占位图时出错:', err);
- }
-
- // 记录失败的URL到本地,便于调试
- try {
- const failedUrls = wx.getStorageSync('imageLoadFailures') || [];
- if (!failedUrls.includes(url)) {
- failedUrls.push({ url, time: new Date().toISOString(), error: errMsg });
- // 只保留最近20条记录
- if (failedUrls.length > 20) {
- failedUrls.shift();
- }
- wx.setStorageSync('imageLoadFailures', failedUrls);
- }
- } catch (storageErr) {
- console.error('存储失败URL时出错:', storageErr);
- }
- },
-
- // 图片加载成功处理 - 增强版
- imageLoad(e) {
- const url = e.currentTarget.dataset.src;
- const width = e.detail.width;
- const height = e.detail.height;
-
- console.log(`图片加载成功: ${url} (${width}x${height})`);
-
- // 可以在这里添加图片统计逻辑
- try {
- const successCount = wx.getStorageSync('imageLoadSuccessCount') || 0;
- wx.setStorageSync('imageLoadSuccessCount', successCount + 1);
- } catch (storageErr) {
- console.error('存储成功计数时出错:', storageErr);
- }
- },
-
- // 显示编辑弹窗 - 修复版
- showEditSupply(e, isPublishOperation = false) {
- // 阻止事件冒泡,防止触发父元素的点击事件
- if (e && e.stopPropagation) {
- e.stopPropagation();
- }
-
- // 确保图片预览弹窗关闭
- this.setData({
- showImagePreview: false
- });
-
- const id = e.currentTarget.dataset.id;
- console.log('显示编辑弹窗,货源ID:', id, '是否上架操作:', isPublishOperation);
-
- if (!id) {
- console.error('显示编辑弹窗失败:缺少货源ID');
- wx.showToast({ title: '操作失败,缺少货源信息', icon: 'none', duration: 2000 });
- return;
- }
-
- // 在所有货源列表中查找
- let supply = null;
- const allSupplies = [
- ...this.data.publishedSupplies,
- ...this.data.pendingSupplies,
- ...this.data.rejectedSupplies,
- ...this.data.draftSupplies
- ];
-
- supply = allSupplies.find(s => s.id === id);
-
- // 如果没找到,尝试在主列表中查找
- if (!supply) {
- supply = this.data.supplies.find(s => s.id === id);
- }
-
- // 安全检查:确保supply存在
- if (!supply) {
- console.error('未找到ID为', id, '的货源');
- wx.showToast({ title: '未找到该货源', icon: 'none', duration: 2000 });
- this.setData({ showEditModal: false });
- // 确保页面滚动状态正常
- this.enablePageScroll();
- this.loadSupplies();
- return;
- }
-
- // 计算蛋黄和规格的索引值
- const yolkIndex = this.data.yolkOptions.indexOf(supply.yolk) >= 0 ? this.data.yolkOptions.indexOf(supply.yolk) : 0;
- const specIndex = this.data.specOptions.indexOf(supply.spec) >= 0 ? this.data.specOptions.indexOf(supply.spec) : 0;
-
- // 设置编辑货源数据,显示编辑弹窗
- // 确保商品名称和品种字段同步
- const productName = supply.productName || supply.name;
- const supplyWithFormattedTime = {
- ...supply,
- formattedCreatedAt: this.formatCreateTime(supply.created_at),
- region: supply.region || '', // 【新增】确保地区字段存在
- name: productName, // 确保品种字段有值
- productName: productName, // 确保商品名称字段有值
- yolkIndex: yolkIndex,
- specIndex: specIndex
- };
-
- // 解析地区字符串为省市区数组,用于初始化三级下拉框
- let editSupplyRegionArray = [];
- if (supply.region) {
- // 尝试将地区字符串拆分为省市区数组
- // 假设地区格式为 "省份 城市 区县"
- editSupplyRegionArray = supply.region.split(' ').filter(item => item.trim() !== '');
- }
-
- console.log('【调试】supply对象完整结构:', supply);
- console.log('【调试】编辑弹窗数据设置:', {
- supplyRegion: supply.region,
- editSupplyRegion: supplyWithFormattedTime.region,
- editSupplyRegionArray: editSupplyRegionArray
- });
-
- // 如果是上架操作,设置自动上架标志
- if (isPublishOperation) {
- this.setData({
- autoPublishAfterEdit: true
- });
- console.log('设置编辑后自动上架标志为true');
- } else {
- this.setData({
- autoPublishAfterEdit: false
- });
- console.log('设置编辑后自动上架标志为false');
- }
-
- this.setData({
- editSupply: supplyWithFormattedTime,
- editSupplyRegionArray: editSupplyRegionArray,
- showEditModal: true
- });
-
- // 锁定页面滚动
- this.disablePageScroll();
-
- // 显示提示信息
- wx.showToast({
- title: '请编辑信息后点击提交',
- icon: 'none',
- duration: 2000
- });
- },
-
- // 上架货源 - 移除本地存储操作
- publishSupply(e) {
- // 阻止事件冒泡,防止触发父元素的点击事件
- if (e && e.stopPropagation) {
- e.stopPropagation();
- }
-
- // 确保图片预览弹窗关闭
- this.setData({
- showImagePreview: false
- });
-
- // 登录验证
- const userId = wx.getStorageSync('userId');
- const openid = wx.getStorageSync('openid');
- const userInfo = wx.getStorageSync('userInfo');
-
- if (!userId || !openid || !userInfo) {
- wx.showModal({
- title: '提示',
- content: '请先登录再进行商品上架操作',
- showCancel: false,
- success: (res) => {
- if (res.confirm) {
- this.setData({ showAuthModal: true });
- }
- }
- });
- return;
- }
-
- // 检查用户合作状态
- API.getUserInfo(openid)
- .then(response => {
- const userInfo = response.data;
- if (userInfo.partnerstatus !== 'approved') {
- wx.hideLoading();
- this.enablePageScroll();
- wx.showModal({
- title: '权限不足',
- content: '您的合作状态尚未通过审核,暂时无法进行商品上架操作',
- showCancel: true,
- cancelText: '取消',
- confirmText: '立即入驻',
- success: (res) => {
- if (res.confirm) {
- // 跳转到入驻页面
- wx.navigateTo({
- url: '/pages/settlement/index'
- })
- }
- }
- });
- return;
- }
-
- const id = e.currentTarget.dataset.id
- // 优先使用编辑中的商品数据
- let supply = null
-
- // 检查是否存在编辑中的数据
- if (this.data.editSupply && this.data.editSupply.id === id) {
- supply = { ...this.data.editSupply };
- } else {
- // 否则从supplies中查找
- supply = this.data.supplies.find(s => s.id === id)
- }
-
- if (!supply) {
- wx.hideLoading();
- this.enablePageScroll();
- wx.showToast({
- title: '货源信息不存在',
- icon: 'none',
- duration: 2000
- });
- return;
- }
-
- wx.showLoading({ title: '处理中...', mask: true });
-
- // 判断当前货源状态,决定设置什么状态
- // 重新提交的商品应该先进入审核中
- let newStatus = 'pending_review'; // 默认审核中
- if (supply.status === 'reviewed') {
- newStatus = 'published'; // 已审核通过的货源可以直接上架
- }
-
- // 同步数据到服务器数据库
- // 仅当有serverProductId时才同步到服务器
- if (supply.serverProductId) {
- const openid = wx.getStorageSync('openid');
- if (openid) {
- // 审核失败、隐藏、审核中或下架的货源重新提交时,调用编辑接口同步商品内容和状态
- if (supply.status === 'rejected' || supply.status === 'hidden' || supply.status === 'pending_review' || supply.status === 'sold_out') {
- console.log('审核失败、隐藏、审核中或下架货源重新提交,同步商品内容和状态到服务器');
- // 准备商品数据,转换为服务器需要的格式
- const productData = {
- openid: openid,
- productId: supply.serverProductId,
- product: {
- productName: supply.name,
- price: supply.price,
- quantity: supply.minOrder,
- grossWeight: supply.grossWeight || "",
- yolk: supply.yolk,
- specification: supply.spec,
- resubmit: true // 关键参数:告诉服务器这是重新提交审核
- },
- status: newStatus // 明确传递状态参数,确保变为审核中状态
- };
-
- console.log('准备发送商品编辑请求 - URL:', API.BASE_URL + '/api/product/edit');
- console.log('准备发送的商品数据:', productData);
- // 调用编辑商品接口,该接口会自动设置状态为pending_review
- wx.request({
- url: API.BASE_URL + '/api/product/edit',
- method: 'POST',
- data: productData,
- success: (res) => {
- console.log('商品内容和状态同步成功:', res);
- // 重新加载数据以更新UI
- this.loadSupplies();
- },
- fail: (err) => {
- console.error('商品内容和状态同步失败:', err);
- // 重新加载数据以更新UI
- this.loadSupplies();
- },
- complete: () => {
- // 确保在请求完成后隐藏loading并显示提示
- try {
- wx.hideLoading();
- // 恢复页面滚动
- this.enablePageScroll();
- wx.showToast({
- title: newStatus === 'published' ? '上架成功' : '重新提交成功,等待审核',
- duration: 2000
- });
- } catch (e) {
- console.error('显示提示时出错:', e);
- // 确保即使在错误情况下也隐藏loading并恢复滚动
- try {
- wx.hideLoading();
- this.enablePageScroll();
- } catch (innerErr) {
- console.error('隐藏loading时出错:', innerErr);
- }
- }
- }
- });
- return; // 异步操作,稍后再继续执行
- } else {
- // 其他情况只更新状态
- wx.request({
- url: API.BASE_URL + '/api/product/review',
- method: 'POST',
- data: {
- openid: openid,
- productId: supply.serverProductId,
- status: newStatus
- },
- success: () => {
- this.loadSupplies();
- },
- fail: (err) => {
- console.error('更新状态失败:', err);
- this.loadSupplies();
- },
- complete: () => {
- try {
- wx.hideLoading();
- // 恢复页面滚动
- this.enablePageScroll();
- wx.showToast({
- title: newStatus === 'published' ? '上架成功' : '重新提交成功,等待审核',
- duration: 2000
- });
- } catch (e) {
- console.error('显示提示时出错:', e);
- // 确保即使在错误情况下也隐藏loading并恢复滚动
- try {
- wx.hideLoading();
- this.enablePageScroll();
- } catch (innerErr) {
- console.error('隐藏loading时出错:', innerErr);
- }
- }
- }
- });
- return; // 异步操作,稍后再继续执行
- }
- } else {
- // 没有openid时的处理
- wx.hideLoading();
- // 恢复页面滚动
- this.enablePageScroll();
- wx.showToast({
- title: '登录状态异常,请重新登录',
- icon: 'none',
- duration: 2000
- });
- }
- } else {
- // 如果没有serverProductId,提示用户
- wx.hideLoading();
- // 恢复页面滚动
- this.enablePageScroll();
- wx.showToast({
- title: '无法上架,商品未上传到服务器',
- icon: 'none',
- duration: 2000
- });
- }
- })
- .catch(err => {
- console.error('获取用户信息失败:', err);
- wx.hideLoading();
- this.enablePageScroll();
- wx.showToast({
- title: '获取用户信息失败',
- icon: 'none',
- duration: 2000
- });
- });
- },
-
- // 下架货源 - 移除本地存储操作
- unpublishSupply(e) {
- // 阻止事件冒泡,防止触发父元素的点击事件
- if (e && e.stopPropagation) {
- e.stopPropagation();
- }
-
- const supplyId = e.currentTarget.dataset.id;
-
- // 添加确认对话框,防止误触
- wx.showModal({
- title: '确认下架',
- content: '确定要下架该商品吗?',
- confirmText: '确定',
- cancelText: '取消',
- success: (res) => {
- if (res.confirm) {
- console.log('下架商品 - ID:', supplyId);
- console.log('当前商品列表长度:', this.data.supplies.length);
- console.log('当前已上架商品列表长度:', this.data.publishedSupplies.length);
-
- // 查找对应商品
- let supply = this.data.supplies.find(s => s.id === supplyId);
-
- // 如果在主列表中找不到,尝试在已上架商品列表中查找
- if (!supply) {
- supply = this.data.publishedSupplies.find(s => s.id === supplyId);
- console.log('在已上架列表中查找结果:', supply ? '找到' : '未找到');
- }
-
- // 如果仍然找不到商品,尝试直接使用传入的ID下架(容错处理)
- if (!supply) {
- console.warn('未在本地列表中找到商品,但尝试直接下架:', supplyId);
-
- // 禁用页面滚动
- this.disablePageScroll();
- wx.showLoading({ title: '下架中...', mask: true });
-
- // 直接使用传入的ID尝试下架
- API.hideProduct(supplyId)
- .then(res => {
- console.log('直接下架成功:', res);
- wx.hideLoading();
- this.enablePageScroll();
- wx.showToast({ title: '已下架', icon: 'success', duration: 2000 });
-
- // 清理购物车并重新加载列表
- this.cleanUnpublishedFromAllCarts(supplyId);
- setTimeout(() => {
- this.loadSupplies();
- }, 100);
- })
- .catch(err => {
- console.error('直接下架失败:', err);
- wx.hideLoading();
- this.enablePageScroll();
- wx.showToast({ title: '下架失败,请重试', icon: 'none', duration: 2000 });
- });
- return;
- }
-
- // 检查是否有serverProductId,只有上传到服务器的商品才能下架
- if (!supply.serverProductId) {
- // 没有serverProductId,提示用户
- wx.showToast({ title: '无法下架,商品未上传到服务器', icon: 'none', duration: 2000 });
- return;
- }
-
- // 禁用页面滚动
- this.disablePageScroll();
- wx.showLoading({ title: '下架中...', mask: true });
-
- // 调用API下架商品
- API.hideProduct(supply.serverProductId)
- .then(res => {
- console.log('服务器下架成功:', res);
- wx.hideLoading();
- // 恢复页面滚动
- this.enablePageScroll();
- wx.showToast({ title: '已下架', icon: 'success', duration: 2000 });
-
- // 清理所有用户购物车中已下架的商品
- this.cleanUnpublishedFromAllCarts(supply.serverProductId);
-
- // 只需要调用一次loadSupplies
- setTimeout(() => {
- this.loadSupplies();
- }, 100);
- })
- .catch(err => {
- console.error('服务器下架失败:', err);
- wx.hideLoading();
- // 恢复页面滚动
- this.enablePageScroll();
- wx.showToast({ title: '服务器同步失败,请重试', icon: 'none', duration: 3000 });
-
- // 只需要调用一次loadSupplies
- setTimeout(() => {
- this.loadSupplies();
- }, 100);
- });
- } else if (res.cancel) {
- console.log('用户取消下架操作');
- }
- }
- });
- },
-
- // 清理所有用户购物车中已下架的商品 - 移除本地存储操作
- cleanUnpublishedFromAllCarts(supplyId) {
- try {
- console.log('开始清理购物车中的已下架商品:', supplyId)
- // 直接通知服务器清理购物车
- setTimeout(() => {
- API.removeFromAllCarts(supplyId)
- .then(res => {
- console.log('清理所有购物车中的已下架商品完成:', res)
- })
- .catch(err => {
- console.error('清理服务器购物车失败:', err)
- })
- }, 0);
- } catch (error) {
- console.error('清理购物车过程中发生错误:', error)
- }
- },
-
- // 删除货源(软删除:只在服务器标记为隐藏)
- deleteSupply(e) {
- // 阻止事件冒泡,防止触发父元素的点击事件
- if (e && e.stopPropagation) {
- e.stopPropagation();
- }
-
- // 确保图片预览弹窗关闭
- this.setData({
- showImagePreview: false
- });
-
- const id = e.currentTarget.dataset.id
- const supply = this.data.supplies.find(s => s.id === id)
-
- if (!supply) {
- wx.showToast({ title: '货源不存在', icon: 'none', duration: 2000 })
- return
- }
-
- // 显示确认弹窗
- wx.showModal({
- title: '确认删除',
- content: '确定要删除该货源吗?删除后将不再显示,但数据会保留。',
- success: (res) => {
- if (res.confirm) {
- wx.showLoading({ title: '删除中...' })
-
- // 确保使用正确的productId格式
- let productIdToHide;
- // 将id转换为字符串,避免startsWith调用错误
- const idStr = String(id);
-
- if (supply.serverProductId) {
- productIdToHide = supply.serverProductId;
- console.log('使用服务器返回的productId:', productIdToHide);
- } else if (idStr.startsWith('product_')) {
- productIdToHide = id;
- console.log('使用已有的product_前缀ID:', productIdToHide);
- } else {
- // 如果本地ID不是以product_开头,尝试直接使用
- productIdToHide = id;
- console.log('使用本地ID作为productId:', productIdToHide);
- }
-
- API.deleteProduct(productIdToHide).then(() => {
- console.log('服务器标记商品为隐藏成功:', productIdToHide)
- wx.hideLoading()
- wx.showToast({
- title: '删除成功',
- icon: 'success',
- duration: 2000
- })
- // 手动加载数据更新UI
- this.loadSupplies()
- }).catch(error => {
- console.error('服务器标记商品为隐藏失败:', error);
- console.error('错误详情:', JSON.stringify(error));
-
- wx.hideLoading()
- // 手动加载数据更新UI
- this.loadSupplies()
-
- // 提供更详细的错误信息
- let errorMsg = '服务器操作失败';
- if (error.message && error.message.includes('连接失败')) {
- errorMsg = '无法连接服务器,请检查网络连接后重试';
- } else if (error.message && error.message.includes('商品不存在')) {
- errorMsg = '该商品在服务器上可能已不存在';
- }
-
- wx.showToast({
- title: errorMsg,
- icon: 'none',
- duration: 3000
- })
- })
- }
- }
- })
- },
-
- // 格式化创建时间为 年/月/日 时:分 格式
- formatCreateTime: function (timeValue) {
- // 添加详细日志记录传入的参数
- console.log('formatCreateTime - 输入值:', timeValue, '类型:', typeof timeValue);
-
- if (!timeValue) {
- console.log('formatCreateTime - 输入为空,返回"无"');
- return '无';
- }
-
- try {
- // 首先尝试直接创建Date对象
- let date = new Date(timeValue);
-
- // 如果日期无效,且输入是字符串,尝试将其转换为数字,再创建Date对象
- if (isNaN(date.getTime()) && typeof timeValue === 'string') {
- console.log('formatCreateTime - 尝试将字符串转换为数字');
- const numericTime = Number(timeValue);
- // 只有当转换后的数字不是NaN时才使用新的Date对象
- if (!isNaN(numericTime)) {
- date = new Date(numericTime);
- }
- }
-
- console.log('formatCreateTime - Date对象:', date, '时间戳:', date.getTime());
-
- // 检查日期是否有效
- if (isNaN(date.getTime())) {
- console.log('formatCreateTime - 日期无效,返回"无"');
- return '无';
- }
-
- const year = date.getFullYear();
- const month = (date.getMonth() + 1).toString().padStart(2, '0');
- const day = date.getDate().toString().padStart(2, '0');
- const hours = date.getHours().toString().padStart(2, '0');
- const minutes = date.getMinutes().toString().padStart(2, '0');
-
- const formattedTime = `${year}/${month}/${day} ${hours}:${minutes}`;
- console.log('formatCreateTime - 格式化结果:', formattedTime);
-
- return formattedTime;
- } catch (error) {
- console.error('时间格式化错误:', error);
- return '无';
- }
- },
-
- // 格式化时间为北京时间(UTC+8)并转换为 年-月-日-时:分 格式
- formatTimeToBeijing: function (timeValue) {
- if (!timeValue) {
- return '无';
- }
-
- try {
- // 创建Date对象
- const date = new Date(timeValue);
-
- // 检查日期是否有效
- if (isNaN(date.getTime())) {
- return '无';
- }
-
- // 使用Date对象的方法直接获取UTC时间,然后加8小时计算北京时间
- const utcYear = date.getUTCFullYear();
- const utcMonth = date.getUTCMonth();
- const utcDate = date.getUTCDate();
- const utcHours = date.getUTCHours() + 8; // 直接加8小时
-
- // 创建北京时间Date对象
- const beijingTime = new Date(Date.UTC(utcYear, utcMonth, utcDate, utcHours, date.getUTCMinutes()));
-
- // 格式化时间,使用连字符分隔
- const year = beijingTime.getFullYear();
- const month = (beijingTime.getMonth() + 1).toString().padStart(2, '0');
- const day = beijingTime.getDate().toString().padStart(2, '0');
- const hours = beijingTime.getHours().toString().padStart(2, '0');
- const minutes = beijingTime.getMinutes().toString().padStart(2, '0');
-
- // 返回格式:年-月-日-时:分
- return `${year}-${month}-${day}-${hours}:${minutes}`;
- } catch (error) {
- console.error('北京时间格式化错误:', error);
- return '无';
- }
- },
-
- // 显示审核失败原因弹窗
- showRejectReason: function (e) {
- // 阻止事件冒泡
- if (e && e.stopPropagation) {
- e.stopPropagation();
- }
-
- const id = e.currentTarget.dataset.id;
- console.log('显示审核失败原因,货源ID:', id);
-
- // 显示加载提示
- wx.showLoading({
- title: '获取最新审核原因...',
- mask: true
- });
-
- // 重新获取审核失败商品列表,确保获取到最新的审核失败原因
- API.getProductList('rejected', {
- page: 1,
- pageSize: 20,
- timestamp: new Date().getTime()
- }).then(data => {
- if (data && data.products && Array.isArray(data.products)) {
- // 从最新获取的列表中查找当前商品
- const supply = data.products.find(product => product.id === id);
-
- if (supply) {
- console.log('找到最新货源信息:', supply);
-
- // 更新本地审核失败商品列表
- this.setData({
- rejectedSupplies: data.products
- });
-
- // 锁定页面滚动
- this.disablePageScroll();
-
- // 设置当前显示的货源和最新的失败原因
- this.setData({
- currentRejectSupply: supply,
- rejectReason: supply.rejectReason || '暂无详细的审核失败原因,请联系客服了解详情。',
- showRejectReasonModal: true
- });
- } else {
- // 如果在最新列表中没找到,尝试在本地所有列表中查找
- let localSupply = null;
- const allSupplies = [
- ...this.data.publishedSupplies,
- ...this.data.pendingSupplies,
- ...this.data.rejectedSupplies,
- ...this.data.draftSupplies,
- ...this.data.supplies
- ];
-
- localSupply = allSupplies.find(s => s.id === id);
-
- if (localSupply) {
- console.log('在本地列表中找到货源信息:', localSupply);
-
- // 锁定页面滚动
- this.disablePageScroll();
-
- // 设置当前显示的货源和失败原因
- this.setData({
- currentRejectSupply: localSupply,
- rejectReason: localSupply.rejectReason || '暂无详细的审核失败原因,请联系客服了解详情。',
- showRejectReasonModal: true
- });
- } else {
- console.error('未找到ID为', id, '的货源');
- wx.showToast({ title: '未找到该货源', icon: 'none', duration: 2000 });
- }
- }
- } else {
- // 如果获取列表失败,尝试在本地所有列表中查找
- let supply = null;
- const allSupplies = [
- ...this.data.publishedSupplies,
- ...this.data.pendingSupplies,
- ...this.data.rejectedSupplies,
- ...this.data.draftSupplies,
- ...this.data.supplies
- ];
-
- supply = allSupplies.find(s => s.id === id);
-
- if (supply) {
- console.log('在本地列表中找到货源信息:', supply);
-
- // 锁定页面滚动
- this.disablePageScroll();
-
- // 设置当前显示的货源和失败原因
- this.setData({
- currentRejectSupply: supply,
- rejectReason: supply.rejectReason || '暂无详细的审核失败原因,请联系客服了解详情。',
- showRejectReasonModal: true
- });
- } else {
- console.error('未找到ID为', id, '的货源');
- wx.showToast({ title: '未找到该货源', icon: 'none', duration: 2000 });
- }
- }
- }).catch(err => {
- console.error('获取审核失败商品列表失败:', err);
-
- // 失败时,尝试在本地所有列表中查找
- let supply = null;
- const allSupplies = [
- ...this.data.publishedSupplies,
- ...this.data.pendingSupplies,
- ...this.data.rejectedSupplies,
- ...this.data.draftSupplies,
- ...this.data.supplies
- ];
-
- supply = allSupplies.find(s => s.id === id);
-
- if (supply) {
- console.log('在本地列表中找到货源信息:', supply);
-
- // 锁定页面滚动
- this.disablePageScroll();
-
- // 设置当前显示的货源和失败原因
- this.setData({
- currentRejectSupply: supply,
- rejectReason: supply.rejectReason || '暂无详细的审核失败原因,请联系客服了解详情。',
- showRejectReasonModal: true
- });
- } else {
- console.error('未找到ID为', id, '的货源');
- wx.showToast({ title: '未找到该货源', icon: 'none', duration: 2000 });
- }
- }).finally(() => {
- // 隐藏加载提示
- wx.hideLoading();
- });
- },
-
-
- // 关闭审核失败原因弹窗
- closeRejectReasonModal: function () {
- console.log('关闭审核失败原因弹窗');
- this.setData({
- showRejectReasonModal: false
- // 注意:这里不立即清空 currentRejectSupply,确保后续操作能使用
- });
-
- // 恢复页面滚动
- this.enablePageScroll();
- },
-
- // 打开规格选择弹窗
- openSpecSelectModal: function (e) {
- const mode = e.currentTarget.dataset.mode || 'create';
- const currentSpec = mode === 'create' ? this.data.newSupply.spec : this.data.editSupply.spec;
- const specOptions = this.data.specOptions;
- let selectedIndex = -1;
-
- // 查找当前选中规格的索引
- if (currentSpec) {
- selectedIndex = specOptions.indexOf(currentSpec);
- }
-
- // 通过全局数据控制自定义tab-bar的显示状态
- const app = getApp();
- if (app && app.globalData) {
- app.globalData.showTabBar = false;
- }
-
- this.setData({
- showSpecSelectModal: true,
- currentSpecMode: mode,
- modalSpecSearchKeyword: '',
- filteredModalSpecOptions: specOptions,
- selectedModalSpecIndex: selectedIndex,
- showTabBar: false // 隐藏底部tab-bar
- });
- },
-
- // 关闭规格选择弹窗
- closeSpecSelectModal: function () {
- // 通过全局数据控制自定义tab-bar的显示状态
- const app = getApp();
- if (app && app.globalData) {
- app.globalData.showTabBar = true;
- }
-
- this.setData({
- showSpecSelectModal: false,
- modalSpecSearchKeyword: '',
- selectedModalSpecIndex: -1,
- showTabBar: true // 显示底部tab-bar
- });
- },
-
- // 弹窗中规格搜索输入 - 简化版确保测试场景工作
- onModalSpecSearchInput: function (e) {
- const keyword = e.detail.value.trim(); // 添加trim()处理空格
- console.log('规格搜索输入:', keyword);
-
- const specOptions = this.data.specOptions;
- console.log('可用规格选项:', specOptions.length, '个');
-
- let filteredOptions = specOptions;
-
- if (keyword) {
- // 简化的模糊搜索算法 - 确保基本功能工作
- filteredOptions = specOptions.filter(option => {
- const optionLower = option.toLowerCase();
- const keywordLower = keyword.toLowerCase();
-
- // 基本包含搜索 - 这是核心逻辑
- if (optionLower.includes(keywordLower)) {
- return true;
- }
-
- // 对于数字范围搜索,优化匹配逻辑
- if (keywordLower.includes('-') || keywordLower.includes('+')) {
- // 尝试匹配数字部分
- const keywordNumbers = keywordLower.match(/\d+/g);
- if (keywordNumbers) {
- return keywordNumbers.some(num => optionLower.includes(num));
- }
- }
-
- return false;
- });
-
- console.log('搜索结果:', filteredOptions.length, '个匹配项');
- console.log('搜索结果详情:', filteredOptions);
-
- // 如果没有匹配结果,显示友好提示
- if (filteredOptions.length === 0) {
- wx.showToast({
- title: `未找到包含"${keyword}"的规格`,
- icon: 'none',
- duration: 2000
- });
- } else {
- // 显示匹配数量
- wx.showToast({
- title: `找到${filteredOptions.length}个匹配项`,
- icon: 'none',
- duration: 1500
- });
- }
- } else {
- console.log('搜索词为空,显示所有规格');
- }
-
- this.setData({
- modalSpecSearchKeyword: keyword,
- filteredModalSpecOptions: filteredOptions,
- selectedModalSpecIndex: -1 // 搜索时重置选择
- });
- },
-
- // 清除弹窗中的规格搜索关键词 - 简化版
- clearModalSpecSearch: function () {
- console.log('清除规格搜索关键词');
-
- this.setData({
- modalSpecSearchKeyword: '',
- filteredModalSpecOptions: this.data.specOptions,
- selectedModalSpecIndex: -1
- });
-
- console.log('搜索已清除,显示所有规格选项:', this.data.specOptions.length, '个');
-
- // 提供友好的反馈
- wx.showToast({
- title: '已清除搜索条件',
- icon: 'success',
- duration: 1000
- });
- },
-
- // 双击检测变量
- lastTapTime: {},
- tapCount: {},
-
- // 通用双击检测函数
- handleDoubleTap: function (e, type, callback) {
- // 确保lastTapTime对象存在
- if (!this.lastTapTime) {
- this.lastTapTime = {};
- }
-
- const currentTime = Date.now();
- const index = e.currentTarget.dataset.index;
- const tapKey = `${type}-${index}`;
- const lastTap = this.lastTapTime[tapKey] || 0;
- const tapInterval = currentTime - lastTap;
-
- if (tapInterval < 300 && tapInterval > 0) {
- // 双击事件触发,执行确认选择
- callback();
- // 清除双击记录
- delete this.lastTapTime[tapKey];
- } else {
- // 单击事件触发,执行选择操作
- this.lastTapTime[tapKey] = currentTime;
- setTimeout(() => {
- delete this.lastTapTime[tapKey];
- }, 300);
- }
- },
-
- // 弹窗中选择规格
- onModalSpecSelect: function (e) {
- const index = e.currentTarget.dataset.index;
- const selectedSpec = this.data.filteredModalSpecOptions[index];
- this.setData({
- selectedModalSpecIndex: index,
- modalSpecSearchKeyword: selectedSpec // 自动填充搜索框为当前选择的规格
- });
-
- // 检测双击
- this.handleDoubleTap(e, 'spec', () => {
- this.confirmSpecSelection();
- });
- },
-
- // 确认规格选择
- confirmSpecSelection: function () {
- if (this.data.selectedModalSpecIndex === -1) {
- wx.showToast({
- title: '请选择规格',
- icon: 'none'
- });
- return;
- }
-
- const selectedSpec = this.data.filteredModalSpecOptions[this.data.selectedModalSpecIndex];
- const specOptions = this.data.specOptions;
- const originalIndex = specOptions.indexOf(selectedSpec);
-
- // 根据当前模式更新对应的规格信息
- if (this.data.currentSpecMode === 'create') {
- const newSupply = this.data.newSupply;
- newSupply.spec = selectedSpec;
- newSupply.specIndex = originalIndex;
- this.setData({
- newSupply: newSupply
- });
-
- // 实时保存到本地存储
- wx.setStorageSync('newSupplyDraft', newSupply);
- } else if (this.data.currentSpecMode === 'edit') {
- this.setData({
- 'editSupply.spec': selectedSpec,
- 'editSupply.specIndex': originalIndex
- });
- }
-
- // 关闭弹窗
- this.closeSpecSelectModal();
-
- // 恢复页面滚动
- this.enablePageScroll();
-
- // 延迟清空数据,确保操作完成
- setTimeout(() => {
- this.setData({
- currentRejectSupply: null,
- rejectReason: ''
- });
- }, 500);
- },
-
- // 编辑审核失败的货源
- editRejectedSupply: function () {
- // 先保存当前货源数据,再关闭弹窗
- const currentRejectSupply = this.data.currentRejectSupply;
-
- if (!currentRejectSupply || !currentRejectSupply.id) {
- wx.showToast({ title: '货源信息不存在', icon: 'none', duration: 2000 });
- return;
- }
-
- // 关闭失败原因弹窗
- this.closeRejectReasonModal();
-
- // 延迟一小段时间确保弹窗完全关闭
- setTimeout(() => {
- // 模拟点击编辑按钮的事件对象
- const mockEvent = {
- stopPropagation: function () { },
- currentTarget: {
- dataset: {
- id: currentRejectSupply.id
- }
- }
- };
-
- // 调用显示编辑弹窗的方法
- this.showEditSupply(mockEvent);
- }, 100);
- },
-
- // 重新提交审核失败的货源
- resubmitRejectedSupply: function () {
- // 先保存当前货源数据,再关闭弹窗
- const currentRejectSupply = this.data.currentRejectSupply;
-
- if (!currentRejectSupply || !currentRejectSupply.id) {
- wx.showToast({ title: '货源信息不存在', icon: 'none', duration: 2000 });
- return;
- }
-
- // 关闭失败原因弹窗
- this.closeRejectReasonModal();
-
- // 延迟一小段时间确保弹窗完全关闭
- setTimeout(() => {
- // 模拟点击上架按钮的事件对象
- const mockEvent = {
- stopPropagation: function () { },
- currentTarget: {
- dataset: {
- id: currentRejectSupply.id
- }
- }
- };
-
- // 设置自动上架标志
- this.setData({ autoPublishAfterEdit: true });
-
- // 调用上架方法
- this.preparePublishSupply(mockEvent);
- }, 100);
- },
-
-
- // 选择图片方法 - 修复添加照片功能
- chooseImage: function (e) {
- const type = e.currentTarget.dataset.type; // 获取操作类型:new或edit
- let currentImages = [];
-
- // 根据类型获取当前已选择的图片列表
- if (type === 'new') {
- currentImages = this.data.newSupply.imageUrls || [];
- } else {
- currentImages = this.data.editSupply.imageUrls || [];
- }
-
- // 计算还能选择的图片数量
- const maxCount = 5 - currentImages.length;
- if (maxCount <= 0) {
- wx.showToast({
- title: '最多只能上传5张图片',
- icon: 'none',
- duration: 2000
- });
- return;
- }
-
- // 调用微信小程序的图片选择API
- wx.chooseImage({
- count: maxCount,
- sizeType: ['compressed'], // 压缩图片以减小尺寸
- sourceType: ['album', 'camera'], // 可以从相册选择或拍照
- success: (res) => {
- // 获取选择的图片临时文件路径
- const tempFilePaths = res.tempFilePaths;
-
- // 合并已选择的图片和新选择的图片
- const updatedImages = [...currentImages, ...tempFilePaths];
-
- // 根据类型更新数据
- if (type === 'new') {
- const newSupply = this.data.newSupply;
- newSupply.imageUrls = updatedImages;
- this.setData({
- newSupply: newSupply
- });
-
- // 实时保存到本地存储
- wx.setStorageSync('newSupplyDraft', newSupply);
- } else {
- this.setData({
- 'editSupply.imageUrls': updatedImages
- });
- }
-
- console.log(`成功选择了${tempFilePaths.length}张图片,当前共${updatedImages.length}张`);
- },
- fail: (err) => {
- console.error('选择图片失败:', err);
- if (err.errMsg !== 'chooseImage:fail cancel') { // 排除用户主动取消的情况
- wx.showToast({
- title: '选择图片失败,请重试',
- icon: 'none',
- duration: 2000
- });
- }
- }
- });
- },
-
- // 格式化创建时间
- formatCreateTime: function (timeValue) {
- console.log('formatCreateTime - 输入值:', timeValue, '类型:', typeof timeValue);
-
- if (!timeValue) {
- console.log('formatCreateTime - 输入为空,返回"无"');
- return '无';
- }
-
- try {
- // 处理 ISO 8601 格式的字符串 (如: 2025-10-20T08:21:06.000Z)
- let date;
-
- if (typeof timeValue === 'string') {
- // 直接使用 ISO 字符串创建 Date 对象
- date = new Date(timeValue);
-
- // 如果日期无效,尝试其他解析方式
- if (isNaN(date.getTime())) {
- // 尝试移除可能的额外字符
- const cleanTime = timeValue.replace(/[^\d\-T:.]/g, '');
- date = new Date(cleanTime);
- }
- } else if (typeof timeValue === 'number') {
- // 如果是时间戳
- date = new Date(timeValue);
- } else {
- // 其他情况尝试直接创建
- date = new Date(timeValue);
- }
-
- console.log('formatCreateTime - 解析后的Date对象:', date);
-
- // 检查日期是否有效
- if (isNaN(date.getTime())) {
- console.log('formatCreateTime - 日期无效,返回"无"');
- return '无';
- }
-
- // 获取本地时间(考虑时区)
- const year = date.getFullYear();
- const month = (date.getMonth() + 1).toString().padStart(2, '0');
- const day = date.getDate().toString().padStart(2, '0');
- const hours = date.getHours().toString().padStart(2, '0');
- const minutes = date.getMinutes().toString().padStart(2, '0');
-
- const formattedTime = `${year}/${month}/${day} ${hours}:${minutes}`;
- console.log('formatCreateTime - 格式化结果:', formattedTime);
-
- return formattedTime;
- } catch (error) {
- console.error('时间格式化错误:', error);
- return timeValue; // 出错时返回原始值
- }
- },
-
- /**
- * 删除图片
- */
- deleteImage: function (e) {
- const index = e.currentTarget.dataset.index;
- const type = e.currentTarget.dataset.type || 'new'; // 默认处理new类型
-
- if (type === 'new') {
- const newSupply = this.data.newSupply;
- const imageUrls = newSupply.imageUrls;
- imageUrls.splice(index, 1);
- newSupply.imageUrls = imageUrls;
- this.setData({
- newSupply: newSupply
- });
-
- // 实时保存到本地存储
- wx.setStorageSync('newSupplyDraft', newSupply);
- } else {
- const imageUrls = this.data.editSupply.imageUrls;
- imageUrls.splice(index, 1);
- this.setData({
- 'editSupply.imageUrls': imageUrls
- });
- }
-
- console.log(`成功删除${type}类型第${index}张图片`);
- },
-
- /**
- * iOS设备检测
- */
- isIOS() {
- const systemInfo = wx.getSystemInfoSync()
- return systemInfo.platform === 'ios'
- },
-
- /**
- * 阻止触摸移动事件(iOS专用)
- */
- blockTouchMove() {
- // 添加全局触摸事件监听器
- this.touchMoveHandler = (e) => {
- e.preventDefault()
- e.stopPropagation()
- }
-
- // 在页面根元素上阻止触摸移动
- this.setData({
- touchMoveBlocked: true
- })
- },
-
- /**
- * 恢复触摸移动事件(iOS专用)
- */
- unblockTouchMove() {
- this.touchMoveHandler = null
-
- // 移除触摸事件阻止
- this.setData({
- touchMoveBlocked: false
- })
- },
-
- // 处理创建货源弹窗中的规格搜索输入
- onSpecSearchInput(e) {
- const keyword = e.detail.value.toLowerCase().trim();
- this.setData({
- specSearchKeyword: keyword
- });
- // 过滤规格选项
- this.filterSpecOptions(keyword, 'create');
- },
-
- // 处理编辑货源弹窗中的规格搜索输入
- onEditSpecSearchInput(e) {
- const keyword = e.detail.value.toLowerCase().trim();
- this.setData({
- editSpecSearchKeyword: keyword
- });
- // 过滤规格选项
- this.filterSpecOptions(keyword, 'edit');
- },
-
- // 过滤规格选项的通用函数
- filterSpecOptions(keyword, type) {
- const specOptions = this.data.specOptions;
- let filteredOptions = specOptions;
-
- if (keyword) {
- filteredOptions = specOptions.filter(option => {
- return option.toLowerCase().includes(keyword);
- });
-
- // 如果有匹配的规格选项,自动填充第一个匹配项
- if (filteredOptions.length > 0) {
- if (type === 'create') {
- const firstMatchIndex = specOptions.indexOf(filteredOptions[0]);
- this.setData({
- 'newSupply.spec': filteredOptions[0],
- 'newSupply.specIndex': firstMatchIndex
- });
- } else if (type === 'edit') {
- const firstMatchIndex = specOptions.indexOf(filteredOptions[0]);
- this.setData({
- 'editSupply.spec': filteredOptions[0],
- 'editSupply.specIndex': firstMatchIndex
- });
- }
- }
- } else {
- // 当关键词为空时,重置规格选择
- if (type === 'create') {
- this.setData({
- 'newSupply.spec': '',
- 'newSupply.specIndex': 0
- });
- } else if (type === 'edit') {
- this.setData({
- 'editSupply.spec': '',
- 'editSupply.specIndex': 0
- });
- }
- }
-
- if (type === 'create') {
- this.setData({
- filteredSpecOptions: filteredOptions
- });
- } else if (type === 'edit') {
- this.setData({
- filteredEditSpecOptions: filteredOptions
- });
- }
- },
-
- // 清除规格搜索关键词
- clearSpecSearch() {
- this.setData({
- specSearchKeyword: '',
- filteredSpecOptions: this.data.specOptions,
- 'newSupply.spec': '', // 重置规格选择
- 'newSupply.specIndex': 0 // 重置规格索引
- });
- },
-
- // 清除编辑弹窗中的规格搜索关键词
- clearEditSpecSearch() {
- this.setData({
- editSpecSearchKeyword: '',
- filteredEditSpecOptions: this.data.specOptions,
- 'editSupply.spec': '', // 重置规格选择
- 'editSupply.specIndex': 0 // 重置规格索引
- });
- },
-
- // 打开创建货源的地区选择弹窗
- openCreateRegionModal() {
- // 通过全局数据控制自定义tab-bar的显示状态
- const app = getApp();
- if (app && app.globalData) {
- app.globalData.showTabBar = false;
- }
-
- // 重置三级联动选择和搜索
- this.setData({
- currentRegionMode: 'create',
- regionSearchKeyword: '',
- editRegionSearchKeyword: '',
- filteredRegionOptions: [],
- showSearchResults: false,
- selectedProvinceIndex: 0,
- selectedCityIndex: 0,
- selectedDistrictIndex: 0,
- currentCities: this.data.regionOptions[0].cities,
- currentDistricts: this.data.regionOptions[0].cities[0].districts,
- showRegionSelectModal: true,
- showTabBar: false // 隐藏底部tab-bar
- });
- },
-
- // 根据地区字符串查找对应的省市区索引
- findRegionIndex(region) {
- if (!region) return { provinceIndex: 0, cityIndex: 0, districtIndex: 0 };
-
- const regionArray = region.split(' ').filter(item => item.trim() !== '');
- if (regionArray.length < 3) return { provinceIndex: 0, cityIndex: 0, districtIndex: 0 };
-
- const provinceName = regionArray[0];
- const cityName = regionArray[1];
- const districtName = regionArray[2];
-
- // 查找省份索引
- let provinceIndex = 0;
- for (let i = 0; i < this.data.regionOptions.length; i++) {
- if (this.data.regionOptions[i].name === provinceName) {
- provinceIndex = i;
- break;
- }
- }
-
- // 查找城市索引
- const province = this.data.regionOptions[provinceIndex];
- let cityIndex = 0;
- for (let i = 0; i < province.cities.length; i++) {
- if (province.cities[i].name === cityName) {
- cityIndex = i;
- break;
- }
- }
-
- // 查找区县索引
- const city = province.cities[cityIndex];
- let districtIndex = 0;
- for (let i = 0; i < city.districts.length; i++) {
- if (city.districts[i] === districtName) {
- districtIndex = i;
- break;
- }
- }
-
- return { provinceIndex, cityIndex, districtIndex };
- },
-
- // 打开编辑货源的地区选择弹窗
- openEditRegionModal() {
- // 通过全局数据控制自定义tab-bar的显示状态
- const app = getApp();
- if (app && app.globalData) {
- app.globalData.showTabBar = false;
- }
-
- // 获取当前编辑货源的地区
- const currentRegion = this.data.editSupply.region;
-
- // 查找地区对应的省市区索引
- const { provinceIndex, cityIndex, districtIndex } = this.findRegionIndex(currentRegion);
-
- // 获取对应的省市区数据
- const province = this.data.regionOptions[provinceIndex];
- const city = province.cities[cityIndex];
-
- // 设置地区选择器状态
- this.setData({
- currentRegionMode: 'edit',
- regionSearchKeyword: '',
- editRegionSearchKeyword: '',
- filteredRegionOptions: [],
- showSearchResults: false,
- selectedProvinceIndex: provinceIndex,
- selectedCityIndex: cityIndex,
- selectedDistrictIndex: districtIndex,
- currentCities: province.cities,
- currentDistricts: city.districts,
- showRegionSelectModal: true,
- showTabBar: false // 隐藏底部tab-bar
- });
- },
-
- // 关闭地区选择弹窗
- closeRegionModal() {
- // 通过全局数据控制自定义tab-bar的显示状态
- const app = getApp();
- if (app && app.globalData) {
- app.globalData.showTabBar = true;
- }
-
- this.setData({
- showRegionSelectModal: false,
- showTabBar: true, // 显示底部tab-bar
- showSearchResults: false // 隐藏搜索结果
- });
- },
-
- // 地区搜索输入处理
- onRegionSearchInput(e) {
- const keyword = e.detail.value.trim();
- const mode = this.data.currentRegionMode;
-
- // 更新搜索关键词
- this.setData({
- [mode === 'create' ? 'regionSearchKeyword' : 'editRegionSearchKeyword']: keyword
- });
-
- // 过滤地区选项
- this.filterRegionOptions(keyword);
- },
-
- // 地区搜索框聚焦
- onRegionSearchFocus() {
- this.setData({
- showSearchResults: true
- });
- },
-
- // 清除地区搜索
- clearRegionSearch() {
- const mode = this.data.currentRegionMode;
-
- this.setData({
- [mode === 'create' ? 'regionSearchKeyword' : 'editRegionSearchKeyword']: '',
- filteredRegionOptions: [],
- showSearchResults: false
- });
- },
-
- // 过滤地区选项
- filterRegionOptions(keyword) {
- if (!keyword) {
- this.setData({
- filteredRegionOptions: []
- });
- return;
- }
-
- const regionOptions = this.data.regionOptions;
- const filtered = [];
-
- // 遍历所有省市区进行匹配
- regionOptions.forEach((province, provinceIndex) => {
- // 匹配省份
- if (province.name.includes(keyword)) {
- filtered.push({
- region: province.name,
- provinceIndex,
- cityIndex: 0,
- districtIndex: 0
- });
- }
-
- // 匹配城市
- province.cities.forEach((city, cityIndex) => {
- const fullCityName = `${province.name} ${city.name}`;
- if (city.name.includes(keyword) || fullCityName.includes(keyword)) {
- filtered.push({
- region: fullCityName,
- provinceIndex,
- cityIndex,
- districtIndex: 0
- });
- }
-
- // 匹配区县
- city.districts.forEach((district, districtIndex) => {
- const fullRegionName = `${province.name} ${city.name} ${district}`;
- if (district.includes(keyword) || fullRegionName.includes(keyword)) {
- filtered.push({
- region: fullRegionName,
- provinceIndex,
- cityIndex,
- districtIndex
- });
- }
- });
- });
- });
-
- this.setData({
- filteredRegionOptions: filtered
- });
- },
-
- // 选择搜索结果
- selectSearchRegion(e) {
- const { region, provinceIndex, cityIndex, districtIndex } = e.currentTarget.dataset;
-
- // 更新三级联动选择状态
- const province = this.data.regionOptions[provinceIndex];
- const city = province.cities[cityIndex];
-
- this.setData({
- selectedProvinceIndex: parseInt(provinceIndex),
- selectedCityIndex: parseInt(cityIndex),
- selectedDistrictIndex: parseInt(districtIndex),
- currentCities: province.cities,
- currentDistricts: city.districts,
- showSearchResults: false // 隐藏搜索结果
- });
- },
-
- // 处理省份选择变化
- onProvinceChange(e) {
- const index = e.detail.value;
- const province = this.data.regionOptions[index];
-
- this.setData({
- selectedProvinceIndex: index,
- selectedCityIndex: 0,
- selectedDistrictIndex: 0,
- currentCities: province.cities,
- currentDistricts: province.cities[0].districts
- });
- },
-
- // 处理城市选择变化
- onCityChange(e) {
- const index = e.detail.value;
- const cities = this.data.currentCities;
- const province = this.data.regionOptions[this.data.selectedProvinceIndex];
-
- this.setData({
- selectedCityIndex: index,
- selectedDistrictIndex: 0,
- currentDistricts: province.cities[index].districts
- });
- },
-
- // 处理地区选择变化
- onDistrictChange(e) {
- this.setData({
- selectedDistrictIndex: e.detail.value
- });
- },
-
- // 处理三级联动选择器变化
- onRegionChange(e) {
- const value = e.detail.value;
- const provinceIndex = value[0];
- const cityIndex = value[1];
- const districtIndex = value[2];
-
- const province = this.data.regionOptions[provinceIndex];
- const city = province.cities[cityIndex];
-
- // 更新选择状态
- this.setData({
- selectedProvinceIndex: provinceIndex,
- selectedCityIndex: cityIndex,
- selectedDistrictIndex: districtIndex,
- currentCities: province.cities,
- currentDistricts: city.districts
- });
- },
-
- // 确认地区选择
- confirmRegionSelection() {
- const province = this.data.regionOptions[this.data.selectedProvinceIndex];
- const city = province.cities[this.data.selectedCityIndex];
- const district = city.districts[this.data.selectedDistrictIndex];
-
- // 组合完整的地区信息
- const selectedRegion = `${province.name} ${city.name} ${district}`;
- const mode = this.data.currentRegionMode;
-
- if (mode === 'create') {
- this.setData({
- 'newSupply.region': selectedRegion
- });
- } else if (mode === 'edit') {
- this.setData({
- 'editSupply.region': selectedRegion
- });
- }
-
- this.closeRegionModal();
- },
-
- /**
- * 阻止触摸移动事件(用于WXML绑定)
- */
- preventTouchMove(e) {
- // iOS设备上阻止触摸事件冒泡和默认行为
- if (this.isIOS() && this.data.touchMoveBlocked) {
- e.preventDefault()
- e.stopPropagation()
- return false
- }
- },
-
- /**
- * 输入框触摸事件处理(防止iOS抖动)
- */
- onInputTouchStart(e) {
- // 阻止输入框触摸事件冒泡到页面
- if (this.isIOS()) {
- e.stopPropagation()
- }
- },
-
- /**
- * 输入框触摸移动事件处理(防止iOS抖动)
- */
- onInputTouchMove(e) {
- // 完全阻止输入框区域的触摸移动事件
- if (this.isIOS()) {
- e.preventDefault()
- e.stopPropagation()
- return false
- }
- },
-
- /**
- * 弹窗触摸开始事件处理(增强iOS触摸锁定)
- */
- onModalTouchStart(e) {
- // 在iOS设备上阻止弹窗区域的触摸事件冒泡到页面
- if (this.isIOS()) {
- e.stopPropagation()
- }
- },
-
- /**
- * 弹窗触摸移动事件处理(增强iOS触摸锁定)
- */
- onModalTouchMove(e) {
- // 完全阻止弹窗区域的触摸移动事件传播到页面
- if (this.isIOS()) {
- e.preventDefault()
- e.stopPropagation()
- return false
- }
- },
-
- // 商品名称选择弹窗相关函数
- openNameSelectModal() {
- // 设置当前选中的索引
- let currentName = '';
- if (this.data.showEditModal && this.data.editSupply.name) {
- currentName = this.data.editSupply.name;
- } else {
- currentName = this.data.newSupply.name;
- }
- const index = currentName ? this.data.productNameOptions.indexOf(currentName) : -1;
-
- // 通过全局数据控制自定义tab-bar的显示状态
- const app = getApp();
- if (app && app.globalData) {
- app.globalData.showTabBar = false;
- }
-
- this.setData({
- showNameSelectModal: true,
- selectedNameIndex: index >= 0 ? index : -1,
- showTabBar: false // 隐藏底部tab-bar
- });
- },
-
- closeNameSelectModal() {
- // 通过全局数据控制自定义tab-bar的显示状态
- const app = getApp();
- if (app && app.globalData) {
- app.globalData.showTabBar = true;
- }
-
- this.setData({
- showNameSelectModal: false,
- showTabBar: true // 显示底部tab-bar
- });
- },
-
- onNameSelect(e) {
- const index = e.currentTarget.dataset.index;
- this.setData({
- selectedNameIndex: index
- });
-
- // 检测双击
- this.handleDoubleTap(e, 'name', () => {
- this.confirmNameSelection();
- });
- },
-
- confirmNameSelection() {
- if (this.data.selectedNameIndex >= 0) {
- const selectedName = this.data.productNameOptions[this.data.selectedNameIndex];
-
- // 通过全局数据控制自定义tab-bar的显示状态
- const app = getApp();
- if (app && app.globalData) {
- app.globalData.showTabBar = true;
- }
-
- // 根据当前是编辑还是创建模式,更新对应的对象
- if (this.data.showEditModal) {
- this.setData({
- 'editSupply.name': selectedName, // 同时更新品种字段
- 'editSupply.productName': selectedName, // 更新商品名称字段
- showNameSelectModal: false,
- showTabBar: true // 显示底部tab-bar
- });
- } else {
- const newSupply = this.data.newSupply;
- // 品种和商品名称保持一致
- newSupply.name = selectedName; // 更新品种字段
- newSupply.productName = selectedName; // 更新商品名称字段
- this.setData({
- newSupply: newSupply,
- showNameSelectModal: false,
- showTabBar: true // 显示底部tab-bar
- });
-
- // 实时保存到本地存储
- wx.setStorageSync('newSupplyDraft', newSupply);
- }
- }
- },
-
- // 蛋黄选择弹窗相关函数
- openYolkSelectModal() {
- // 设置当前选中的索引
- let currentYolk = '';
- if (this.data.showEditModal && this.data.editSupply.yolk) {
- currentYolk = this.data.editSupply.yolk;
- } else {
- currentYolk = this.data.newSupply.yolk;
- }
- const index = currentYolk ? this.data.yolkOptions.indexOf(currentYolk) : -1;
-
- // 通过全局数据控制自定义tab-bar的显示状态
- const app = getApp();
- if (app && app.globalData) {
- app.globalData.showTabBar = false;
- }
-
- this.setData({
- showYolkSelectModal: true,
- selectedYolkIndex: index >= 0 ? index : -1,
- showTabBar: false // 隐藏底部tab-bar
- });
- },
-
- closeYolkSelectModal() {
- // 通过全局数据控制自定义tab-bar的显示状态
- const app = getApp();
- if (app && app.globalData) {
- app.globalData.showTabBar = true;
- }
-
- this.setData({
- showYolkSelectModal: false,
- showTabBar: true // 显示底部tab-bar
- });
- },
-
- onYolkSelect(e) {
- const index = e.currentTarget.dataset.index;
- this.setData({
- selectedYolkIndex: index
- });
-
- // 检测双击
- this.handleDoubleTap(e, 'yolk', () => {
- this.confirmYolkSelection();
- });
- },
-
- confirmYolkSelection() {
- if (this.data.selectedYolkIndex >= 0) {
- const selectedYolk = this.data.yolkOptions[this.data.selectedYolkIndex];
-
- // 通过全局数据控制自定义tab-bar的显示状态
- const app = getApp();
- if (app && app.globalData) {
- app.globalData.showTabBar = true;
- }
-
- // 根据当前是编辑还是创建模式,更新对应的对象
- if (this.data.showEditModal) {
- this.setData({
- 'editSupply.yolk': selectedYolk,
- 'editSupply.yolkIndex': this.data.selectedYolkIndex,
- showYolkSelectModal: false,
- showTabBar: true // 显示底部tab-bar
- });
- } else {
- const newSupply = this.data.newSupply;
- newSupply.yolk = selectedYolk;
- newSupply.yolkIndex = this.data.selectedYolkIndex;
- this.setData({
- newSupply: newSupply,
- showYolkSelectModal: false,
- showTabBar: true // 显示底部tab-bar
- });
-
- // 实时保存到本地存储
- wx.setStorageSync('newSupplyDraft', newSupply);
- }
- }
- },
-
- // 联系客服
- contactCustomerService() {
- wx.navigateTo({
- url: '/pages/customer-service/index',
- success: () => {
- console.log('跳转到客服页面成功');
- },
- fail: (err) => {
- console.error('跳转到客服页面失败', err);
- wx.showToast({
- title: '跳转到客服页面失败',
- icon: 'none'
- });
- }
- });
- },
-
- // 入驻申请
- applyForSettlement() {
- const openid = wx.getStorageSync('openid');
- if (openid) {
- API.getUserInfo(openid)
- .then(response => {
- console.log('获取到的用户信息:', response);
- const userInfo = response.data;
- const partnerstatus = userInfo.partnerstatus || '';
- if (partnerstatus === 'approved') {
- // 如果已经审核通过,显示提示
- wx.showToast({
- title: '您已成功入驻',
- icon: 'success',
- duration: 2000
- });
- } else if (partnerstatus === 'reviewfailed') {
- // 审核失败状态,进入审核失败页面
- wx.navigateTo({
- url: '/pages/settlement/index'
- });
- } else {
- // 其他状态进入入驻页面
- wx.navigateTo({
- url: '/pages/settlement/index'
- });
- }
- })
- .catch(err => {
- console.error('获取用户信息失败:', err);
- // 获取失败时,默认进入入驻页面
- wx.navigateTo({
- url: '/pages/settlement/index'
- });
- });
- } else {
- // 未登录时,直接进入入驻页面
- wx.navigateTo({
- url: '/pages/settlement/index'
- });
- }
- }
-})
\ No newline at end of file
diff --git a/pages/seller/index.json b/pages/seller/index.json
deleted file mode 100644
index 7ef5329..0000000
--- a/pages/seller/index.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "usingComponents": {},
- "enablePullDownRefresh": true,
- "backgroundTextStyle": "dark"
-}
\ No newline at end of file
diff --git a/pages/seller/index.wxml b/pages/seller/index.wxml
deleted file mode 100644
index e5e8745..0000000
--- a/pages/seller/index.wxml
+++ /dev/null
@@ -1,934 +0,0 @@
-
-我的货源
-
-
-
-
-
-
-
-
-
-
-
-
- ✘
-
-
-
-
-
-
-
-
- 已上架货源 ({{publishedSupplies.length}})
-
- ▼
- ▲
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 暂无图片
-
-
-
-
-
-
-
-
-
-
-
-
- {{(item.currentImageIndex || 0) + 1}}/{{item.imageUrls.length}}
-
-
-
-
-
-
-
- {{item.name}}
- 已上架
- 已有{{item.reservedCount || 0}}人想要
-
- 蛋黄: {{item.yolk || '无'}}
- 规格: {{item.spec || '无'}}
- 件数: {{item.minOrder}}件
- 斤重: {{item.grossWeight || ''}}斤
- 地区: {{item.region || '未设置'}}
- 创建时间: {{item.formattedCreatedAt}}
-
-
-
-
-
-
-
-
-
-
-
-
-
- 加载中...
-
-
- 点击加载更多已上架货源
-
-
-
- 没有更多已上架货源了
-
-
-
-
- 暂无已上架的货源
-
-
-
-
-
-
-
- 审核中的货源 ({{pendingSupplies.length}})
-
- ▼
- ▲
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 暂无图片
-
-
-
-
-
-
-
-
-
-
-
-
- {{(item.currentImageIndex || 0) + 1}}/{{item.imageUrls.length}}
-
-
-
-
-
-
-
- {{item.name}}
- 审核中
-
- 蛋黄: {{item.yolk || '无'}}
- 规格: {{item.spec || '无'}}
- 件数: {{item.minOrder}}件
- 斤重: {{item.grossWeight || ''}}斤
- 地区: {{item.region || '未设置'}}
- 创建时间: {{item.formattedCreatedAt}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 加载中...
-
-
- 点击加载更多审核中货源
-
-
-
- 没有更多审核中货源了
-
-
-
-
- 暂无审核中的货源
-
-
-
-
-
-
-
- 审核失败的货源 ({{rejectedSupplies.length}})
-
- ▼
- ▲
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 暂无图片
-
-
-
-
-
-
-
-
-
-
-
-
- {{(item.currentImageIndex || 0) + 1}}/{{item.imageUrls.length}}
-
-
-
-
-
-
-
- {{item.name}}
- 审核失败
-
- 蛋黄: {{item.yolk || '无'}}
- 规格: {{item.spec || '无'}}
- 件数: {{item.minOrder}}件
- 斤重: {{item.grossWeight || ''}}斤
- 地区: {{item.region || '未设置'}}
- 创建时间: {{item.formattedCreatedAt}}
-
-
- 审核失败原因:点击查看
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 加载中...
-
-
- 点击加载更多审核失败货源
-
-
-
- 没有更多审核失败货源了
-
-
-
-
- 暂无审核失败的货源
-
-
-
-
-
-
-
- 下架状态货源 ({{draftSupplies.length}})
-
- ▼
- ▲
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 暂无图片
-
-
-
-
-
-
-
-
-
-
-
-
- {{(item.currentImageIndex || 0) + 1}}/{{item.imageUrls.length}}
-
-
-
-
-
-
-
- {{item.name}}
- 已隐藏
- 已下架
- 草稿
- 已有{{item.reservedCount || 0}}人想要
-
- 蛋黄: {{item.yolk || '无'}}
- 规格: {{item.spec || '无'}}
- 件数: {{item.minOrder}}件
- 斤重: {{item.grossWeight || ''}}斤
- 地区: {{item.region || '未设置'}}
- 创建时间: {{item.formattedCreatedAt}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 加载中...
-
-
- 点击加载更多下架状态货源
-
-
-
- 没有更多下架状态货源了
-
-
-
-
- 暂无下架状态的货源
-
-
-
-
-
-
-
-
-
-
-
- ×
-
-
- 创建货源
-
-
- 商品图片
-
-
-
-
-
- ×
-
-
-
- +
-
-
- 最多上传5张图片
-
-
- 商品名称
-
-
- {{newSupply.name || '请选择商品名称'}}
- ▼
-
-
-
- 蛋黄
-
-
- {{newSupply.yolk || '请选择蛋黄类型'}}
- ▼
-
-
-
- 规格
-
-
-
- {{newSupply.spec || '请选择规格'}}
- ▼
-
-
-
-
- 地区
-
-
- {{newSupply.region || '请选择省市区'}}
- ▼
-
-
- 价格
-
-
- 件数
-
-
- 斤重
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 取消
- 编辑货源
- 提交
-
-
-
-
-
-
- 商品图片
-
-
-
-
-
- ×
-
-
-
- +
-
-
- 最多上传5张图片
-
-
- 商品名称
-
-
- {{editSupply.productName || '请选择商品名称'}}
- ▼
-
-
- 蛋黄
-
-
- {{editSupply.yolk || '请选择蛋黄类型'}}
- ▼
-
-
-
- 规格
-
-
-
- {{editSupply.spec || '请选择规格'}}
- ▼
-
-
-
- 地区
-
- {{editSupply.region || '请选择省市区'}}
-
-
- 价格
-
-
- 件数
-
-
- 斤重
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ×
-
-
-
-
-
-
-
-
-
- 审核失败原因
- ×
-
-
-
-
- {{rejectReason}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 取消
- 确定
-
-
-
-
-
- {{item}}
-
-
-
-
-
-
-
-
-
-
- 取消
- 确定
-
-
-
-
-
- {{item}}
-
-
-
-
-
-
-
-
-
-
- 取消
- 确定
-
-
-
-
-
-
-
- ✕
-
-
-
-
-
-
-
- {{item}}
-
-
-
-
-
-
-
-
- 提示
- 请先登录后再操作
-
-
-
-
-
-
-
-
-
-
-
- 授权登录
-
-
- 请授权获取您的手机号用于登录
-
-
-
-
-
-
-
-
-
-
-
-
- 完善个人信息
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 取消
- 确定
-
-
-
-
-
- 🔍
-
-
-
-
-
-
-
- 当前选择: {{regionOptions[selectedProvinceIndex].name}} {{currentCities[selectedCityIndex].name}} {{currentDistricts[selectedDistrictIndex]}}
-
-
-
-
-
- {{item.region}}
-
-
- 未找到匹配的地区
-
-
-
-
-
-
-
-
- {{item.name}}
-
-
-
-
- {{item.name}}
-
-
-
-
- {{item}}
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/seller/index.wxss b/pages/seller/index.wxss
deleted file mode 100644
index e8588ab..0000000
--- a/pages/seller/index.wxss
+++ /dev/null
@@ -1,1018 +0,0 @@
-/* pages/seller/index.wxss */
-/* 隐藏页面滚动条 */
-::-webkit-scrollbar {
- display: none;
-}
-
-scroll-view {
- -webkit-scrollbar: none;
- scrollbar-width: none;
-}
-
-/* 重置默认样式,确保不继承父类样式 */
-button {
- margin: 0;
- padding: 0;
- border: none;
- background: none;
- font-size: inherit;
- color: inherit;
- line-height: inherit;
-}
-
-/* 页面容器样式 */
-.container {
- display: flex;
- flex-direction: column;
- justify-content: flex-start;
- align-items: flex-start;
- padding: 0 20rpx;
- box-sizing: border-box;
- min-height: 100vh;
- width: 100%;
- background-color: #fafafa;
-}
-
-/* 搜索框样式 */
-.search-container {
- position: relative;
- padding: 20rpx 0;
- z-index: 10;
- box-sizing: border-box;
-}
-
-.search-box {
- width: 90%;
- display: flex;
- align-items: center;
- background-color: #f8f9fa;
- border: 2rpx solid #e9ecef;
- border-radius: 50rpx;
- padding: 0 20rpx;
- margin: 0 auto;
- transition: all 0.3s ease;
-}
-
-.search-box:focus-within {
- border-color: #07c160;
- box-shadow: 0 0 0 4rpx rgba(7, 193, 96, 0.1);
- background-color: white;
-}
-
-/* 紧凑搜索框样式 */
-.search-box-compact {
- width: 100%;
- display: flex;
- align-items: center;
- background-color: #f8f9fa;
- border: 2rpx solid #e9ecef;
- border-radius: 40rpx;
- padding: 0 16rpx;
- transition: all 0.3s ease;
-}
-
-.search-box-compact:focus-within {
- border-color: #07c160;
- box-shadow: 0 0 0 3rpx rgba(7, 193, 96, 0.1);
- background-color: white;
-}
-
-.search-icon {
- font-size: 28rpx;
- color: #999;
- margin-right: 16rpx;
-}
-
-/* 搜索图标文字 */
-.search-icon-text {
- font-size: 24rpx;
- color: #999;
- margin-right: 12rpx;
-}
-
-.search-input {
- flex: 1;
- padding: 24rpx 0;
- font-size: 28rpx;
- color: #333;
- background-color: transparent;
- border: none;
- outline: none;
-}
-
-/* 紧凑搜索输入框 */
-.search-input-compact {
- flex: 1;
- padding: 16rpx 0;
- font-size: 26rpx;
- color: #333;
- background-color: transparent;
- border: none;
- outline: none;
-}
-
-.search-input-compact::placeholder {
- color: #ccc;
- font-size: 24rpx;
-}
-
-.clear-icon {
- font-size: 50rpx;
- color: #36a913ff;
- padding: 8rpx;
- border-radius: 0;
- background-color: transparent;
- cursor: pointer;
- transition: all 0.2s ease;
-}
-
-/* 紧凑清除图标 */
-.clear-icon-compact {
- width: 28rpx;
- height: 28rpx;
- margin-left: 8rpx;
- cursor: pointer;
- transition: all 0.2s ease;
-}
-
-.clear-icon:hover {
- background-color: transparent;
- color: #666;
-}
-
-/* 地区搜索结果项样式 */
-.search-result-item {
- padding: 24rpx 32rpx;
- font-size: 28rpx;
- color: #333;
- background-color: white;
- border-bottom: 1rpx solid #f0f0f0;
- transition: background-color 0.2s ease;
-}
-
-.search-result-item:hover {
- background-color: #f5f5f5;
-}
-
-.search-result-item:last-child {
- border-bottom: none;
-}
-
-/* 页面标题栏 */
-.title-bar {
- display: flex;
- justify-content: space-between;
- align-items: center;
- width: 100%;
- margin-bottom: 20rpx;
- padding: 10rpx 0;
-}
-
-.title-bar .title {
- display: none;
-}
-
-/* 页面主标题样式 */
-.title {
- font-size: 40rpx;
- font-weight: bold;
- color: #2c3e50;
- text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.1);
- letter-spacing: 2rpx;
- margin: 20rpx 0;
- align-self: center;
-}
-
-/* 搜索框样式 */
-.search-container {
- width: 100%;
- display: flex;
- justify-content: center;
- margin-bottom: 20rpx;
- padding: 0 10rpx;
-}
-
-.search-container .search-box {
- width: 100%;
- max-width: 720rpx;
- display: flex;
- border: 2rpx solid #d9d9d9;
- border-radius: 8rpx;
- overflow: hidden;
- background-color: white;
- box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.06);
- transition: all 0.3s ease;
-}
-
-.search-container .search-box:focus-within {
- border-color: #1890ff;
- box-shadow: 0 0 0 4rpx rgba(24, 144, 255, 0.1);
-}
-
-.search-container input {
- flex: 1;
- padding: 24rpx 32rpx;
- font-size: 28rpx;
- color: #333;
- border: none;
- outline: none;
- background-color: transparent;
- background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
- background-repeat: no-repeat;
- background-position: 32rpx center;
- background-size: 28rpx 28rpx;
- padding-left: 80rpx;
-}
-
-.search-container button {
- padding: 0 40rpx;
- background-color: #1890ff;
- color: white;
- font-size: 36rpx;
- font-weight: 600;
- text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.2);
- border: none;
- outline: none;
- transition: all 0.2s ease;
- border-radius: 0 8rpx 8rpx 0;
- text-align: center;
- display: flex;
- justify-content: center;
- align-items: center;
-}
-
-.search-container button:active {
- background-color: #40a9ff;
- transform: translateY(1rpx);
- box-shadow: inset 0 2rpx 4rpx rgba(0, 0, 0, 0.1);
-}
-
-/* 立体玻璃质感按钮基础样式 */
-.glass-btn {
- position: relative;
- overflow: hidden;
- border: none;
- padding: 32rpx 45rpx;
- font-size: 32rpx;
- font-weight: 600;
- border-radius: 20rpx;
- box-shadow:
- 0 10rpx 28rpx rgba(0, 0, 0, 0.15),
- 0 0 0 1rpx rgba(255, 255, 255, 0.3) inset,
- 0 1rpx 0 rgba(255, 255, 255, 0.2) inset;
- text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.2);
- transition: all 0.3s ease;
- background: rgba(255, 255, 255, 0.8);
- backdrop-filter: blur(10rpx);
- -webkit-backdrop-filter: blur(10rpx);
- white-space: nowrap;
- width: 100%;
- text-align: center;
- margin-bottom: 20rpx;
-}
-
-/* 按压效果 */
-.glass-btn:active {
- transform: translateY(3rpx);
- box-shadow:
- 0 5rpx 15rpx rgba(0, 0, 0, 0.1),
- 0 0 0 1rpx rgba(255, 255, 255, 0.2) inset,
- 0 1rpx 0 rgba(255, 255, 255, 0.1) inset;
-}
-
-/* 主按钮 - 蓝色玻璃效果 */
-.primary-glass-btn {
- background: linear-gradient(135deg, rgba(22, 119, 255, 0.8), rgba(33, 150, 243, 0.7));
- color: white;
- box-shadow:
- 0 10rpx 28rpx rgba(22, 119, 255, 0.3),
- 0 0 0 1rpx rgba(255, 255, 255, 0.3) inset,
- 0 1rpx 0 rgba(255, 255, 255, 0.2) inset;
-}
-
-/* 联系客服按钮样式 */
-.customer-service-btn {
- background: #1890ff;
- color: white;
- font-size: 32rpx;
- font-weight: 600;
- text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.2);
- padding: 15rpx 25rpx;
- border-radius: 8rpx;
- border: none;
- box-shadow: 0 2rpx 4rpx rgba(24, 144, 255, 0.2);
- transition: all 0.2s ease;
- white-space: nowrap;
- text-align: center;
-}
-
-.customer-service-btn:active {
- transform: translateY(1rpx);
- background: #40a9ff;
- box-shadow: 0 1rpx 2rpx rgba(24, 144, 255, 0.15);
-}
-
-/* 标题栏操作区域 */
-.title-bar-actions {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 0 20rpx;
- width: 100%;
-}
-
-/* 未入驻状态样式 */
-.no-settlement-status {
- font-size: 24rpx;
- color: #ff4d4f;
- padding: 0 10rpx;
-}
-
-/* 入驻按钮样式 */
-.apply-settlement-btn {
- background: #52c41a;
- color: white;
- font-size: 32rpx;
- font-weight: 600;
- text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.2);
- padding: 15rpx 25rpx;
- border-radius: 8rpx;
- border: none;
- box-shadow: 0 2rpx 4rpx rgba(82, 196, 26, 0.2);
- transition: all 0.2s ease;
- min-width: 100rpx;
- text-align: center;
-}
-
-.apply-settlement-btn:active {
- transform: translateY(1rpx);
- background: #73d13d;
- box-shadow: 0 1rpx 2rpx rgba(82, 196, 26, 0.15);
-}
-
-/* 未入驻状态按钮 - 红色 */
-.apply-settlement-btn.not-approved {
- background: #ff4d4f;
- box-shadow: 0 2rpx 4rpx rgba(255, 77, 79, 0.2);
-}
-
-.apply-settlement-btn.not-approved:active {
- transform: translateY(1rpx);
- background: #ff7875;
- box-shadow: 0 1rpx 2rpx rgba(255, 77, 79, 0.15);
-}
-
-/* 货源分类标题 */
-.supply-category {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 20rpx;
- padding: 0 10rpx;
-}
-
-.supply-category .category-title {
- font-size: 32rpx;
- font-weight: bold;
- margin: 0;
-}
-
-.supply-category .expand-icon {
- width: 50rpx;
- height: 30rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 28rpx;
- border-radius: 15rpx;
- background-color: rgba(0, 0, 0, 0.05);
-}
-
-/* 卡片样式 */
-.card {
- width: 100%;
- margin-bottom: 30rpx;
- background-color: white;
- border-radius: 12rpx;
- overflow: hidden;
- box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.08);
-}
-
-/* 卡片内容布局 */
-.card-content {
- display: flex;
- width: 100%;
- flex-direction: column;
-}
-
-/* 图片区域 */
-.card-image {
- width: 100%;
- height: 360rpx;
- position: relative;
-}
-
-.card-image image {
- width: 100%;
- height: 100%;
- object-fit: cover;
-}
-
-/* 信息区域 */
-.card-info {
- padding: 24rpx;
- background-color: white;
-}
-
-/* 商品标题 */
-.card-title {
- font-size: 32rpx;
- font-weight: bold;
- color: #333;
- margin-bottom: 16rpx;
- word-break: break-word;
- line-height: 1.4;
-}
-
-/* 商品状态标签 */
-.status-tag {
- display: inline-block;
- margin-left: 10rpx;
- font-size: 20rpx;
- color: #fff;
- padding: 4rpx 12rpx;
- border-radius: 12rpx;
- vertical-align: middle;
-}
-
-.status-tag.published {
- background-color: #52c41a;
-}
-
-.status-tag.pending {
- background-color: #1677ff;
-}
-
-.status-tag.rejected {
- background-color: #f5222d;
-}
-
-.status-tag.draft {
- background-color: #999;
-}
-
-/* 商品详细信息 */
-.card-details {
- display: flex;
- flex-wrap: wrap;
- gap: 20rpx 40rpx;
- margin-bottom: 24rpx;
-}
-
-.detail-item {
- display: flex;
- align-items: center;
- font-size: 26rpx;
- color: #666;
- margin-bottom: 12rpx;
-}
-
-.detail-item .detail-label {
- color: #999;
- margin-right: 12rpx;
- min-width: 60rpx;
-}
-
-.detail-item .detail-value {
- color: #333;
- font-weight: 500;
-}
-
-/* 货源卡片样式 */
-.supply-card {
- width: 100%;
- margin-bottom: 25rpx;
- background-color: white;
- border-radius: 16rpx;
- overflow: hidden;
- box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.08);
- transition: all 0.3s ease;
-}
-
-.supply-card:hover {
- box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.12);
-}
-
-/* 卡片图片区域 */
-.card-image-section {
- width: 100%;
- height: 360rpx;
- position: relative;
- background-color: #f5f5f5;
-}
-
-.image-container {
- width: 100%;
- height: 100%;
- position: relative;
-}
-
-.image-swiper {
- width: 100%;
- height: 100%;
-}
-
-.supply-image {
- width: 100%;
- height: 100%;
- object-fit: cover;
-}
-
-.no-image {
- width: 100%;
- height: 100%;
- display: flex;
- justify-content: center;
- align-items: center;
- background-color: #f5f5f5;
- color: #999;
- font-size: 28rpx;
-}
-
-.swiper-pagination {
- position: absolute;
- bottom: 15rpx;
- right: 15rpx;
- background-color: rgba(0, 0, 0, 0.6);
- color: white;
- padding: 6rpx 12rpx;
- border-radius: 20rpx;
- font-size: 22rpx;
-}
-
-/* 卡片信息区域 */
-.card-info-section {
- padding: 24rpx;
- background-color: white;
-}
-
-/* 商品名称行 */
-.supply-name-row {
- display: flex;
- justify-content: space-between;
- align-items: flex-start;
- margin-bottom: 20rpx;
-}
-
-.supply-name {
- font-size: 32rpx;
- font-weight: bold;
- color: #333;
- flex: 1;
- margin-right: 15rpx;
- word-break: break-word;
- line-height: 1.4;
-}
-
-.supply-status {
- padding: 6rpx 16rpx;
- border-radius: 20rpx;
- font-size: 22rpx;
- font-weight: 600;
- color: white;
- align-self: flex-start;
-}
-
-.supply-status.published {
- background-color: #52c41a;
-}
-
-.supply-status.pending {
- background-color: #1677ff;
-}
-
-.supply-status.rejected {
- background-color: #f5222d;
-}
-
-.supply-status.draft {
- background-color: #999;
-}
-
-/* 商品详情 */
-.supply-details {
- margin-bottom: 20rpx;
-}
-
-/* 创建时间 */
-.create-time {
- font-size: 24rpx;
- color: #999;
- margin-bottom: 24rpx;
-}
-
-/* 按钮区域 */
-.card-actions {
- display: flex;
- gap: 20rpx;
- justify-content: center;
-}
-
-/* 统一按钮样式 */
-.action-btn {
- flex: 1;
- padding: 18rpx 0;
- font-size: 28rpx;
- font-weight: 600;
- border-radius: 8rpx;
- border: none;
- outline: none;
- transition: all 0.2s ease;
- text-align: center;
-}
-
-/* 按钮变体 */
-.action-btn.delete {
- background-color: #f5222d;
- color: white;
-}
-
-.action-btn.unpublish {
- background-color: #faad14;
- color: white;
-}
-
-.action-btn.edit {
- background-color: #1677ff;
- color: white;
-}
-
-.action-btn.publish {
- background-color: #52c41a;
- color: white;
-}
-
-/* 按钮点击效果 */
-.action-btn:active {
- transform: translateY(2rpx);
- opacity: 0.9;
-}
-
-/* 登录授权弹窗样式 - 专门用于登录相关弹窗 */
-.auth-modal-overlay {
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background-color: rgba(0, 0, 0, 0.5);
- display: flex;
- justify-content: center;
- align-items: center;
- z-index: 9999;
-}
-
-.auth-modal-container {
- background-color: #fff;
- border-radius: 24rpx;
- width: 85%;
- max-width: 520rpx;
- padding: 50rpx 40rpx;
- box-shadow: 0 12rpx 32rpx rgba(0, 0, 0, 0.18);
-}
-
-.auth-modal-title {
- font-size: 40rpx;
- font-weight: bold;
- color: #333;
- text-align: center;
- margin-bottom: 35rpx;
-}
-
-.auth-modal-content {
- font-size: 32rpx;
- line-height: 1.6;
- color: #666;
- text-align: center;
- margin-bottom: 50rpx;
-}
-
-.auth-modal-buttons {
- display: flex;
- flex-direction: column;
- gap: 24rpx;
-}
-
-.auth-primary-button {
- background-color: #07c160;
- color: #fff;
- font-size: 34rpx;
- font-weight: 600;
- line-height: 1.6;
- border-radius: 12rpx;
- padding: 24rpx 0;
- box-shadow: 0 4rpx 12rpx rgba(7, 193, 96, 0.3);
-}
-
-.auth-cancel-button {
- background-color: #fff;
- color: #999;
- font-size: 34rpx;
- font-weight: 500;
- line-height: 1.6;
- border-radius: 12rpx;
- padding: 24rpx 0;
- border: 2rpx solid #e5e5e5;
-}
-
-/* 头像选择样式 */
-.auth-avatar-section {
- text-align: center;
- margin-bottom: 40rpx;
-}
-
-.auth-avatar-wrapper {
- padding: 0;
- background: none;
- border: none;
- font-size: 32rpx;
- font-weight: 600;
-}
-
-.auth-avatar {
- width: 160rpx;
- height: 160rpx;
- border-radius: 50%;
-}
-
-/* 表单样式 */
-.auth-form-group {
- margin-bottom: 30rpx;
-}
-
-.auth-form-label {
- font-size: 28rpx;
- margin-bottom: 10rpx;
- display: block;
-}
-
-.auth-form-input {
- border: 1rpx solid #eee;
- border-radius: 8rpx;
- padding: 20rpx;
- width: 100%;
- max-width: 100%;
- box-sizing: border-box;
- font-size: 28rpx;
-}
-
-.auth-form-actions {
- text-align: center;
- margin-top: 40rpx;
-}
-
-.auth-confirm-button {
- background-color: #07c160;
- color: white;
- width: 100%;
- border-radius: 8rpx;
- border: none;
- font-size: 32rpx;
- font-weight: 600;
- text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.2);
-}
-
-/* 四分之一页空白页样式 */
-.half-page-blank {
- height: 25vh;
- background-color: transparent;
-}
-
-/* 加载更多样式 */
-.load-more {
- text-align: center;
- padding: 30rpx;
- color: #666;
- background-color: #f9f9f9;
- border-radius: 8rpx;
- margin: 20rpx 0;
-}
-
-.loading-text {
- color: #999;
- font-size: 26rpx;
-}
-
-.load-more-text {
- color: #1677ff;
- font-size: 26rpx;
- padding: 15rpx 30rpx;
- border: 1rpx solid #1677ff;
- border-radius: 8rpx;
- display: inline-block;
- background-color: white;
-}
-
-.no-more {
- text-align: center;
- padding: 30rpx;
- color: #999;
- font-size: 26rpx;
- background-color: #f9f9f9;
- border-radius: 8rpx;
- margin: 20rpx 0;
-}
-
-/* 页面滚动锁定样式 */
-.page-scroll-lock {
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- overflow: hidden;
- height: 100vh;
-
- /* iOS设备特殊锁定机制 */
- -webkit-overflow-scrolling: auto;
- touch-action: none;
- pointer-events: none;
-
- /* iOS设备硬件加速处理 */
- transform: translateZ(0);
- -webkit-transform: translateZ(0);
-}
-
-/* iOS设备子元素交互修复 */
-.page-scroll-lock view,
-.page-scroll-lock text,
-.page-scroll-lock image,
-.page-scroll-lock button,
-.page-scroll-lock input,
-.page-scroll-lock textarea,
-.page-scroll-lock scroll-view,
-.page-scroll-lock swiper,
-.page-scroll-lock navigator,
-.page-scroll-lock picker,
-.page-scroll-lock slider,
-.page-scroll-lock switch {
- pointer-events: auto;
-}
-
-/* 弹窗输入框防抖动样式 */
-.modal-content .input {
- -webkit-appearance: none;
- appearance: none;
- -webkit-tap-highlight-color: transparent;
- tap-highlight-color: transparent;
- outline: none;
- -webkit-user-select: text;
- user-select: text;
- -webkit-touch-callout: none;
- touch-callout: none;
-}
-
-/* 弹窗容器硬件加速 */
-.modal-content {
- will-change: transform;
- -webkit-will-change: transform;
-}
-
-/* 输入框容器稳定性增强 */
-.modal-content input,
-.modal-content textarea {
- transform: translateZ(0);
- -webkit-transform: translateZ(0);
- perspective: 1000px;
- -webkit-perspective: 1000px;
-}
-
-/* iOS输入框防抖优化 */
-.modal-content .input {
- -webkit-appearance: none;
- appearance: none;
- -webkit-tap-highlight-color: transparent;
- touch-action: manipulation;
- -webkit-touch-callout: none;
- -webkit-user-select: text;
- user-select: text;
- -webkit-transform: translateZ(0);
- transform: translateZ(0);
- will-change: transform;
-}
-
-/* 地区选择弹窗样式 */
-.region-select-modal {
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background: rgba(0, 0, 0, 0.5);
- display: flex;
- justify-content: center;
- z-index: 9999;
- overflow: hidden;
-}
-
-.region-select-modal .modal-content {
- position: fixed;
- bottom: 0;
- left: 0;
- right: 0;
- background: white;
- border-radius: 20rpx 20rpx 0 0;
- max-height: 80vh;
- will-change: transform;
- -webkit-transition: transform 0.3s ease;
- transition: transform 0.3s ease;
-}
-
-.region-select-modal .modal-header {
- padding: 20rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- border-bottom: 1rpx solid #eee;
- background-color: white;
- border-radius: 20rpx 20rpx 0 0;
-}
-
-.region-select-modal .modal-title {
- font-size: 32rpx;
- font-weight: 500;
- color: #333;
-}
-
-.region-select-modal .modal-btn {
- font-size: 32rpx;
- padding: 10rpx 20rpx;
-}
-
-.region-select-modal .modal-btn.cancel {
- color: #333;
-}
-
-.region-select-modal .modal-btn.confirm {
- color: #07c160;
-}
-
-.region-select-modal .search-area {
- padding: 20rpx;
- background-color: white;
- border-bottom: 1rpx solid #f0f0f0;
-}
-
-.region-select-modal .search-box {
- position: relative;
- background: #f5f5f5;
- border-radius: 40rpx;
- padding: 0 30rpx;
-}
-
-.region-select-modal .search-input {
- width: 100%;
- height: 70rpx;
- line-height: 70rpx;
- font-size: 28rpx;
- background: transparent;
- -webkit-appearance: none;
- appearance: none;
- border: none;
- outline: none;
-}
-
-.region-select-modal .search-clear {
- position: absolute;
- right: 30rpx;
- top: 50%;
- transform: translateY(-50%);
- color: #999;
- font-size: 32rpx;
- cursor: pointer;
-}
-
-.region-select-modal .region-list {
- max-height: 60vh;
- overflow-y: auto;
- -webkit-overflow-scrolling: touch;
-}
-
-.region-select-modal .region-item {
- padding: 32rpx 40rpx;
- border-bottom: 1rpx solid #f0f0f0;
- font-size: 32rpx;
- color: #131413;
- text-align: center;
- cursor: pointer;
- transition: background-color 0.2s ease;
-}
-
-.region-select-modal .region-item:hover {
- background-color: #f5f5f5;
-}
-
-.region-select-modal .region-item.selected {
- color: #07c160;
- background-color: #f0f8f3;
-}
\ No newline at end of file