Browse Source

清理项目文件,更新配置以匹配实际文件系统结构

Xfy
徐飞洋 4 weeks ago
parent
commit
595bfb4171
  1. 33
      app.json
  2. 2
      custom-tab-bar/index.js
  3. 66
      pages/eggbar/create-post.js
  4. 2
      pages/eggbar/create-post.wxml
  5. 66
      pages/eggbar/eggbar.js
  6. 2
      pages/eggbar/eggbar.wxml
  7. 314
      pages/evaluate/index.js
  8. 6
      pages/evaluate/index.json
  9. 159
      pages/evaluate/index.wxml
  10. 1145
      pages/evaluate/index.wxss
  11. 292
      pages/evaluate1/index.js
  12. 4
      pages/evaluate1/index.json
  13. 78
      pages/evaluate1/index.wxml
  14. 450
      pages/evaluate1/index.wxss
  15. 70
      pages/evaluate1/product-list.js
  16. 4
      pages/evaluate1/product-list.json
  17. 49
      pages/evaluate1/product-list.wxml
  18. 311
      pages/evaluate1/product-list.wxss
  19. 76
      pages/evaluate1/spec-detail.js
  20. 4
      pages/evaluate1/spec-detail.json
  21. 59
      pages/evaluate1/spec-detail.wxml
  22. 401
      pages/evaluate1/spec-detail.wxss
  23. 82
      pages/notopen/index.js
  24. 4
      pages/notopen/index.json
  25. 8
      pages/notopen/index.wxml
  26. 69
      pages/notopen/index.wxss
  27. 5510
      pages/seller/index.js
  28. 5
      pages/seller/index.json
  29. 934
      pages/seller/index.wxml
  30. 1018
      pages/seller/index.wxss

33
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": "收藏"

2
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'
];

66
pages/eggbar/create-post.js

@ -1,66 +0,0 @@
// pages/eggbar/create-post.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

2
pages/eggbar/create-post.wxml

@ -1,2 +0,0 @@
<!--pages/eggbar/create-post.wxml-->
<text>pages/eggbar/create-post.wxml</text>

66
pages/eggbar/eggbar.js

@ -1,66 +0,0 @@
// pages/eggbar/eggbar.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

2
pages/eggbar/eggbar.wxml

@ -1,2 +0,0 @@
<!--pages/eggbar/eggbar.wxml-->
<text>pages/eggbar/eggbar.wxml</text>

314
pages/evaluate/index.js

@ -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
})
}
}
})

6
pages/evaluate/index.json

@ -1,6 +0,0 @@
{
"navigationBarTitleText": "鸡蛋估价",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black",
"backgroundColor": "#f5f5f5"
}

159
pages/evaluate/index.wxml

@ -1,159 +0,0 @@
<!--pages/evaluate/index.wxml-->
<view class="evaluate-page">
<!-- 步骤1:提示说明 -->
<view wx:if="{{currentStep === 1}}" class="evaluate-step">
<view class="step-content">
<view class="step-icon">🥚</view>
<view class="step-title">鸡蛋估价系统</view>
<view class="step-description">
<text>欢迎使用鸡蛋估价功能!\n\n本系统将帮助您快速估算鸡蛋的市场价值。</text>
\n\n<text>估价流程:\n1. 选择您希望了解价格的时间范围\n2. 选择您所在的地区\n3. 选择鸡蛋品种\n\n系统将基于这些信息为您提供初步的价格估算。</text>
\n<text>请注意:\n• 此估价仅供参考,实际价格受市场波动影响\n• 建议咨询专业人士获取更准确的价格信息\n• 系统不支持真实交易,仅用于价格预估</text>
</view>
<view class="know-btn-wrapper">
<button class="know-btn" bindtap="onIKnow">我知道了</button>
</view>
</view>
</view>
<!-- 步骤2:选择参数 -->
<view wx:if="{{currentStep === 2}}" class="evaluate-step">
<view class="step-content">
<button class="back-btn" bindtap="goBack">← 返回上一步</button>
<view class="step-title">选择估价参数</view>
<view class="step-subtitle">请完成以下选择,系统将为您估价</view>
<!-- 时间选择 -->
<view class="selection-group">
<view class="group-title">选择时间</view>
<view class="date-selector">
<!-- 月份选择 -->
<picker mode="selector"
range="{{months}}"
value="{{selectedMonthIndex}}"
bindchange="onMonthChange">
<view class="picker-wrapper small">
<view class="picker-display {{selectedMonth !== '' ? 'selected' : ''}}">
{{selectedMonth ? selectedMonth + '月' : '选择月份'}}
</view>
<view class="picker-arrow">▼</view>
</view>
</picker>
<!-- 日期选择 -->
<picker mode="selector"
range="{{days}}"
value="{{selectedDayIndex}}"
bindchange="onDayChange"
disabled="{{!selectedMonth}}">
<view class="picker-wrapper small {{!selectedMonth ? 'disabled' : ''}}">
<view class="picker-display {{selectedDay ? 'selected' : ''}}">
{{selectedDay ? selectedDay + '日' : '选择日期'}}
</view>
<view class="picker-arrow">▼</view>
</view>
</picker>
</view>
</view>
<!-- 地区选择 -->
<view class="selection-group">
<view class="group-title">选择地区</view>
<picker mode="selector"
range="{{regionOptions}}"
value="{{selectedRegionIndex}}"
bindchange="onRegionChange">
<view class="picker-wrapper">
<view class="picker-display {{selectedRegion ? 'selected' : ''}}">
{{selectedRegion || '请选择地区'}}
</view>
<view class="picker-arrow">▼</view>
</view>
</picker>
</view>
<!-- 品种选择 -->
<view class="selection-group">
<view class="group-title">选择品种</view>
<picker mode="selector"
range="{{breedOptions}}"
value="{{selectedBreedIndex}}"
bindchange="onBreedChange">
<view class="picker-wrapper">
<view class="picker-display {{selectedBreed ? 'selected' : ''}}">
{{selectedBreed || '请选择品种'}}
</view>
<view class="picker-arrow">▼</view>
</view>
</picker>
</view>
<!-- 开始估价按钮 -->
<view class="evaluate-btn-wrapper">
<button class="evaluate-btn {{selectedMonth && selectedDay && selectedRegion && selectedBreed ? 'active' : 'disabled'}}"
bindtap="startEvaluation"
disabled="{{!selectedMonth || !selectedDay || !selectedRegion || !selectedBreed}}">
开始估价
</button>
</view>
</view>
</view>
<!-- 步骤3:估价结果 -->
<view wx:if="{{currentStep === 3}}" class="evaluate-step">
<view class="step-content">
<button class="back-btn" bindtap="goBack">← 返回上一步</button>
<view class="result-header">
<view class="result-icon">💰</view>
<view class="result-title">估价完成</view>
<view class="result-subtitle">基于您的选择,系统为您提供以下估价</view>
</view>
<!-- 核心价格 -->
<view class="price-card">
<view class="price-label">预估价格</view>
<view class="price-amount">
<text class="price-symbol">¥</text>
<text class="price-number">{{evaluateResult.estimatedPrice}}</text>
<text class="price-unit">元/斤</text>
</view>
<view class="price-range">价格区间:¥{{evaluateResult.priceRange}}</view>
</view>
<!-- 估价详情 -->
<view class="evaluation-details">
<view class="detail-title">估价详情</view>
<view class="detail-items">
<view class="detail-item">
<view class="detail-label">时间</view>
<view class="detail-value">{{selectedMonth}}月{{selectedDay}}日</view>
</view>
<view class="detail-item">
<view class="detail-label">地区</view>
<view class="detail-value">{{selectedRegion}}</view>
</view>
<view class="detail-item">
<view class="detail-label">品种</view>
<view class="detail-value">{{selectedBreed}}</view>
</view>
<view class="detail-item">
<view class="detail-label">可信度</view>
<view class="detail-value">{{evaluateResult.confidence}}</view>
</view>
</view>
</view>
<!-- 说明文字 -->
<view class="price-tips">
<text class="tip-icon">💡</text>
<text class="tip-text">此价格为系统初步估算,仅供参考。实际成交价格可能因市场供需、季节因素、品质差异等有所变动。建议结合多个渠道信息做出决策。</text>
</view>
<!-- 操作按钮 -->
<view class="result-actions">
<button class="btn-secondary" bindtap="resetEvaluation">重新估价</button>
<button class="btn-primary" bindtap="goToMarket">查看市场</button>
</view>
</view>
</view>
</view>

1145
pages/evaluate/index.wxss

File diff suppressed because it is too large

292
pages/evaluate1/index.js

@ -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'
});
}
});

4
pages/evaluate1/index.json

@ -1,4 +0,0 @@
{
"navigationBarTitleText": "估价",
"usingComponents": {}
}

78
pages/evaluate1/index.wxml

@ -1,78 +0,0 @@
<view class="container">
<!-- 头部导航栏 -->
<view class="header">
<view class="header-content" style="width: 4200rpx; display: block; box-sizing: border-box; height: 124rpx">
<text class="title">规格选择</text>
</view>
</view>
<view class="content">
<!-- 加载中状态 -->
<view wx:if="{{loading}}" class="loading">
<view class="loading-spinner"></view>
<text class="loading-text">正在加载规格数据...</text>
</view>
<!-- 错误提示 -->
<view wx:if="{{error}}" class="error-card">
<view class="error-icon">⚠️</view>
<text class="error-text">{{error}}</text>
<view class="button-group">
<button bindtap="loadSpecifications" data-product="{{productName}}" class="btn-primary">重新加载</button>
<button bindtap="goBackToProductList" class="btn-secondary">返回商品列表</button>
</view>
</view>
<!-- 商品信息 -->
<view wx:else class="product-card">
<view class="product-info-container">
<view class="product-info-row">
<text class="product-label">商品名称</text>
<button bindtap="goBackToProductList" class="btn-back" style="width: 172rpx; display: flex; box-sizing: border-box; left: 0rpx; top: 0rpx; height: 87rpx">
<text class="btn-back-icon">←</text>
<text class="btn-back-text">更换商品</text>
</button>
</view>
<text class="product-name">{{productName}}</text>
</view>
</view>
<!-- 规格列表 -->
<view wx:if="{{!loading && !error && specifications.length > 0}}" class="spec-section">
<view class="section-header">
<text class="section-title">可用规格</text>
<text class="section-count">{{specifications.length}}个</text>
</view>
<view class="spec-grid">
<view
wx:for="{{specifications}}"
wx:key="item.name"
class="spec-card"
data-spec="{{item}}"
bindtap="goToSpecDetail"
>
<view class="spec-info">
<text class="spec-name">{{item.name}}</text>
</view>
<view class="spec-price">
<text class="price-label">参考价格</text>
<text class="price-value">¥{{item.finalPriceText}}</text>
</view>
<view class="spec-arrow">→</view>
</view>
</view>
<!-- 暂无更多规格提示 -->
<view wx:if="{{specifications.length > 0}}" class="no-more">
<text class="no-more-text">暂无更多规格选择</text>
</view>
</view>
<!-- 无规格提示 -->
<view wx:if="{{!loading && !error && specifications.length === 0}}" class="empty-state" style="height: 600rpx; display: flex; box-sizing: border-box">
<view class="empty-icon">📋</view>
<text class="empty-text">该商品暂无可用规格</text>
<button bindtap="goBackToProductList" class="btn-secondary">返回商品列表</button>
</view>
</view>
</view>

450
pages/evaluate1/index.wxss

@ -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;
}

70
pages/evaluate1/product-list.js

@ -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);
}
});
}
});

4
pages/evaluate1/product-list.json

@ -1,4 +0,0 @@
{
"navigationBarTitleText": "选择商品",
"usingComponents": {}
}

49
pages/evaluate1/product-list.wxml

@ -1,49 +0,0 @@
<view class="container">
<!-- 头部导航栏 -->
<view class="header">
<view class="header-content" style="width: 800rpx; display: block; box-sizing: border-box">
<text class="title">商品选择</text>
</view>
</view>
<view class="content">
<!-- 加载中状态 -->
<view wx:if="{{loading}}" class="loading">
<view class="loading-spinner"></view>
<text class="loading-text">正在加载商品数据...</text>
</view>
<!-- 错误提示 -->
<view wx:if="{{error}}" class="error-card">
<view class="error-icon">⚠️</view>
<text class="error-text">{{error}}</text>
<button bindtap="loadProductNames" class="btn-primary">重新加载</button>
</view>
<!-- 商品名称列表 -->
<view wx:else class="product-section">
<view class="section-header">
<text class="section-title">商品列表</text>
<text class="section-count">{{productNames.length}}个商品</text>
</view>
<view class="product-grid">
<view
wx:for="{{productNames}}"
wx:key="*this"
class="product-card"
data-product="{{item}}"
bindtap="selectProduct"
>
<view class="product-icon">🛍️</view>
<text class="product-name">{{item}}</text>
<view class="product-arrow">→</view>
</view>
</view>
<!-- 暂无更多商品提示 -->
<view wx:if="{{productNames.length > 0}}" class="no-more">
<text class="no-more-text">暂无更多商品选择</text>
</view>
</view>
</view>
</view>

311
pages/evaluate1/product-list.wxss

@ -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;
}

76
pages/evaluate1/spec-detail.js

@ -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();
}
});

4
pages/evaluate1/spec-detail.json

@ -1,4 +0,0 @@
{
"navigationBarTitleText": "规格详情",
"usingComponents": {}
}

59
pages/evaluate1/spec-detail.wxml

@ -1,59 +0,0 @@
<view class="page-container">
<!-- 头部导航栏 -->
<view class="page-header">
<text class="header-title">{{productName || '规格详情'}}</text>
</view>
<!-- 主要内容区域 -->
<view class="main-content">
<!-- 规格信息卡片 -->
<view class="info-card">
<text class="card-subtitle">规格信息</text>
<view class="info-row">
<text class="info-label">规格</text>
<text class="info-value">{{specification}}</text>
</view>
<view class="info-row">
<text class="info-label">单价</text>
<text class="info-value price">¥{{price || 0}}</text>
</view>
<text class="info-hint">您已选择此规格进行估价</text>
</view>
<!-- 数量设置卡片 -->
<view class="control-card">
<text class="card-subtitle">数量设置</text>
<view class="quantity-box">
<button bindtap="decreaseQuantity" class="quantity-btn minus" style="width: 180rpx; display: flex; box-sizing: border-box; left: 0rpx; top: 0rpx">-</button>
<input style="width: 420rpx; display: block; box-sizing: border-box"
class="quantity-input"
type="number"
value="{{quantity}}"
bindinput="onQuantityChange"
min="1"
/>
<button bindtap="increaseQuantity" class="quantity-btn plus" style="width: 180rpx; display: flex; box-sizing: border-box; left: 0rpx; top: 0rpx">+</button>
</view>
</view>
<!-- 计算按钮 -->
<view class="button-section">
<button bindtap="calculatePrice" class="primary-btn" style="height: 120rpx; display: block; box-sizing: border-box; left: 0rpx; top: 0rpx">计算预估价格</button>
</view>
<!-- 结果展示卡片 -->
<view class="result-card" wx:if="{{totalPrice > 0}}">
<text class="card-subtitle">预估结果</text>
<view class="result-row">
<text class="result-label">预估总价</text>
<text class="result-value">¥{{totalPrice}}</text>
</view>
<text class="result-hint">此价格为预估价格,实际价格可能会有所变动</text>
</view>
<!-- 返回按钮 -->
<view class="button-section bottom">
<button bindtap="goBack" class="secondary-btn" style="height: 120rpx; display: block; box-sizing: border-box; left: 0rpx; top: 0rpx">返回规格列表</button>
</view>
</view>
</view>

401
pages/evaluate1/spec-detail.wxss

@ -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;
}
}

82
pages/notopen/index.js

@ -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'
})
}
})

4
pages/notopen/index.json

@ -1,4 +0,0 @@
{
"navigationBarTitleText": "又鸟蛋平台",
"usingComponents": {}
}

8
pages/notopen/index.wxml

@ -1,8 +0,0 @@
<view class="container">
<view class="icon">
<view class="lock-icon"></view>
</view>
<view class="title">功能暂未开放</view>
<view class="subtitle">该功能正在紧张开发中,敬请期待</view>
<button class="back-btn" bindtap="onBackTap">返回首页</button>
</view>

69
pages/notopen/index.wxss

@ -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,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23FFD93D"><path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"/></svg>');
}
.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);
}

5510
pages/seller/index.js

File diff suppressed because it is too large

5
pages/seller/index.json

@ -1,5 +0,0 @@
{
"usingComponents": {},
"enablePullDownRefresh": true,
"backgroundTextStyle": "dark"
}

934
pages/seller/index.wxml

@ -1,934 +0,0 @@
<view class="container {{pageScrollLock ? 'page-scroll-lock' : ''}}"
style="align-items: flex-start; padding: 0; width: 100%; max-width: 100vw; overflow-x: hidden; position: relative; box-sizing: border-box;"
catchtouchmove="{{touchMoveBlocked ? 'preventTouchMove' : ''}}">
<view class="title">我的货源</view>
<!-- 标题栏 -->
<view class="title-bar">
<view class="title-bar-actions">
<button
bindtap="contactCustomerService"
class="customer-service-btn"
>
联系客服
</button>
<button
bindtap="applyForSettlement"
class="apply-settlement-btn {{partnerstatus !== 'approved' ? 'not-approved' : ''}}"
>
{{partnerstatus === 'approved' ? '已入驻' : '未入驻'}}
</button>
</view>
</view>
<!-- 搜索框 -->
<view class="search-container">
<view class="search-box">
<input
class="search-input"
placeholder="搜索货源名称或品种"
bindinput="onSearchInput"
bindconfirm="searchSupplies"
value="{{searchKeyword}}"
/>
<view wx:if="searchKeyword" class="clear-icon" bindtap="clearSearch">✘</view>
</view>
</view>
<button
class="glass-btn primary-glass-btn"
bindtap="showAddSupply"
style="width: 90%;"
>
创建新货源
</button>
<!-- 已上架货源 -->
<view style="margin-top: 30rpx; width: 100%;">
<view style="font-size: 28rpx; font-weight: bold; color: #52c41a; margin-bottom: 15rpx; display: flex; justify-content: space-between; align-items: center;">
<text>已上架货源 ({{publishedSupplies.length}})</text>
<view bindtap="togglePublishedExpand" style="width: 40rpx; height: 40rpx; display: flex; align-items: center; justify-content: center;">
<text wx:if="{{isPublishedExpanded}}" style="color: #52c41a; font-size: 28rpx;">▼</text>
<text wx:else style="color: #52c41a; font-size: 28rpx;">▲</text>
</view>
</view>
<block wx:if="{{isPublishedExpanded}}">
<block wx:if="{{publishedSupplies.length > 0}}">
<view wx:for="{{publishedSupplies}}" wx:key="id" class="card" style="width: 100%;">
<!-- 图片和信息1:1比例并排显示 -->
<view style="display: flex; width: 100%; border-radius: 8rpx; overflow: hidden; background-color: #f5f5f5;">
<!-- 左侧图片区域 50%宽度 -->
<view style="width: 50%; position: relative;">
<!-- 第一张图片 -->
<view wx:if="{{item.imageUrls && item.imageUrls.length > 0}}" style="width: 100%; height: 100%;">
<image src="{{item.imageUrls[0]}}" mode="aspectFill" style="width: 100%; height: 100%;" bindtap="previewImage" data-urls="{{item.imageUrls}}" data-index="0"></image>
</view>
<view wx:else style="width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #999;">
<text>暂无图片</text>
</view>
<!-- 剩余图片可滑动区域 -->
<view wx:if="{{item.imageUrls && item.imageUrls.length > 1}}" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;">
<swiper
class="image-swiper"
style="width: 100%; height: 100%;"
current="{{item.currentImageIndex || 0}}"
bindchange="swiperChange"
data-id="{{item.id}}">
<block wx:for="{{item.imageUrls}}" wx:for-item="img" wx:for-index="idx" wx:key="idx">
<swiper-item>
<image src="{{img}}" mode="aspectFill" style="width: 100%; height: 100%;" bindtap="previewImage" data-urls="{{item.imageUrls}}" data-index="{{idx}}"></image>
</swiper-item>
</block>
</swiper>
<!-- 显示页码指示器 -->
<view style="position: absolute; bottom: 10rpx; right: 10rpx; background-color: rgba(0,0,0,0.5); color: white; padding: 5rpx 10rpx; border-radius: 15rpx; font-size: 20rpx;">
{{(item.currentImageIndex || 0) + 1}}/{{item.imageUrls.length}}
</view>
</view>
</view>
<!-- 右侧信息区域 50%宽度 -->
<view style="width: 50%; padding: 15rpx; display: flex; flex-direction: column; justify-content: space-between; background-color: white; border-left: 1rpx solid #f0f0f0;">
<view bindtap="showGoodsDetail" data-item="{{item}}">
<view style="font-size: 28rpx; font-weight: bold; word-break: break-word;">{{item.name}}
<view style="display: inline-block; margin-left: 10rpx; font-size: 18rpx; color: #fff; background-color: #52c41a; padding: 2rpx 8rpx; border-radius: 10rpx;">已上架</view>
<view style="display: inline-block; margin-left: 10rpx; font-size: 18rpx; color: #fff; background-color: #52c41a; padding: 2rpx 8rpx; border-radius: 10rpx;">已有{{item.reservedCount || 0}}人想要</view>
</view>
<view style="font-size: 24rpx; color: #666; margin-top: 8rpx;">蛋黄: {{item.yolk || '无'}}</view>
<view style="font-size: 24rpx; color: #666; margin-top: 8rpx;">规格: {{item.spec || '无'}}</view>
<view style="color: #f5222d; font-size: 24rpx; margin-top: 8rpx;">件数: {{item.minOrder}}件</view>
<view style="color: #1677ff; font-size: 24rpx; margin-top: 8rpx;">斤重: {{item.grossWeight || ''}}斤</view>
<view style="color: #722ed1; font-size: 24rpx; margin-top: 8rpx;">地区: {{item.region || '未设置'}}</view>
<view style="font-size: 22rpx; color: #999; margin-top: 8rpx;">创建时间: {{item.formattedCreatedAt}}</view>
</view>
<!-- 按钮区域 -->
<view style="display: flex; justify-content: space-around; margin-top: 10rpx; gap: 10rpx;">
<button
style="background-color: #1677ff; color: white; font-size: 22rpx; padding: 0 15rpx; line-height: 60rpx;"
bindtap="unpublishSupply"
data-id="{{item.id}}"
>
下架
</button>
</view>
</view>
</view>
</view>
<!-- 已上架货源加载更多 -->
<view class="load-more" wx:if="{{pagination.published.hasMore}}">
<view class="loading-text" wx:if="{{pagination.published.loading}}">
加载中...
</view>
<view class="load-more-text" wx:else bindtap="onReachPublishedBottom">
点击加载更多已上架货源
</view>
</view>
<view class="no-more" wx:if="{{!pagination.published.hasMore && publishedSupplies.length > 0}}">
没有更多已上架货源了
</view>
</block>
<view wx:else style="text-align: center; color: #999; font-size: 24rpx; padding: 30rpx 0;">
暂无已上架的货源
</view>
</block>
</view>
<!-- 审核中的货源 -->
<view style="margin-top: 30rpx; width: 100%;">
<view style="font-size: 28rpx; font-weight: bold; color: #1677ff; margin-bottom: 15rpx; display: flex; justify-content: space-between; align-items: center;">
<text>审核中的货源 ({{pendingSupplies.length}})</text>
<view bindtap="togglePendingExpand" style="width: 40rpx; height: 40rpx; display: flex; align-items: center; justify-content: center;">
<text wx:if="{{isPendingExpanded}}" style="color: #1677ff; font-size: 28rpx;">▼</text>
<text wx:else style="color: #1677ff; font-size: 28rpx;">▲</text>
</view>
</view>
<block wx:if="{{isPendingExpanded}}">
<block wx:if="{{pendingSupplies.length > 0}}">
<view wx:for="{{pendingSupplies}}" wx:key="id" class="card" style="width: 100%;">
<!-- 图片和信息1:1比例并排显示 -->
<view style="display: flex; width: 100%; border-radius: 8rpx; overflow: hidden; background-color: #f5f5f5;">
<!-- 左侧图片区域 50%宽度 -->
<view style="width: 50%; position: relative;">
<!-- 第一张图片 -->
<view wx:if="{{item.imageUrls && item.imageUrls.length > 0}}" style="width: 100%; height: 100%;">
<image src="{{item.imageUrls[0]}}" mode="aspectFill" style="width: 100%; height: 100%;" bindtap="previewImage" data-urls="{{item.imageUrls}}" data-index="0"></image>
</view>
<view wx:else style="width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #999;">
<text>暂无图片</text>
</view>
<!-- 剩余图片可滑动区域 -->
<view wx:if="{{item.imageUrls && item.imageUrls.length > 1}}" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;">
<swiper
class="image-swiper"
style="width: 100%; height: 100%;"
current="{{item.currentImageIndex || 0}}"
bindchange="swiperChange"
data-id="{{item.id}}">
<block wx:for="{{item.imageUrls}}" wx:for-item="img" wx:for-index="idx" wx:key="idx">
<swiper-item>
<image src="{{img}}" mode="aspectFill" style="width: 100%; height: 100%;" bindtap="previewImage" data-urls="{{item.imageUrls}}" data-index="{{idx}}"></image>
</swiper-item>
</block>
</swiper>
<!-- 显示页码指示器 -->
<view style="position: absolute; bottom: 10rpx; right: 10rpx; background-color: rgba(0,0,0,0.5); color: white; padding: 5rpx 10rpx; border-radius: 15rpx; font-size: 20rpx;">
{{(item.currentImageIndex || 0) + 1}}/{{item.imageUrls.length}}
</view>
</view>
</view>
<!-- 右侧信息区域 50%宽度 -->
<view style="width: 50%; padding: 15rpx; display: flex; flex-direction: column; justify-content: space-between; background-color: white; border-left: 1rpx solid #f0f0f0;">
<view bindtap="showGoodsDetail" data-item="{{item}}">
<view style="font-size: 28rpx; font-weight: bold; word-break: break-word;">{{item.name}}
<view style="display: inline-block; margin-left: 10rpx; font-size: 18rpx; color: #fff; background-color: #1677ff; padding: 2rpx 8rpx; border-radius: 10rpx;">审核中</view>
</view>
<view style="font-size: 24rpx; color: #666; margin-top: 8rpx;">蛋黄: {{item.yolk || '无'}}</view>
<view style="font-size: 24rpx; color: #666; margin-top: 8rpx;">规格: {{item.spec || '无'}}</view>
<view style="color: #f5222d; font-size: 24rpx; margin-top: 8rpx;">件数: {{item.minOrder}}件</view>
<view style="color: #1677ff; font-size: 24rpx; margin-top: 8rpx;">斤重: {{item.grossWeight || ''}}斤</view>
<view style="color: #722ed1; font-size: 24rpx; margin-top: 8rpx;">地区: {{item.region || '未设置'}}</view>
<view style="font-size: 22rpx; color: #999; margin-top: 8rpx;">创建时间: {{item.formattedCreatedAt}}</view>
</view>
<!-- 按钮区域 -->
<view style="display: flex; justify-content: space-around; margin-top: 10rpx; gap: 10rpx;">
<button
style="background-color: #faad14; color: white; font-size: 22rpx; padding: 0 15rpx; line-height: 60rpx;"
bindtap="showEditSupply"
data-id="{{item.id}}"
>
编辑
</button>
<button
style="background-color: #f5222d; color: white; font-size: 22rpx; padding: 0 15rpx; line-height: 60rpx;"
bindtap="deleteSupply"
data-id="{{item.id}}"
>
删除
</button>
</view>
</view>
</view>
</view>
<!-- 审核中货源加载更多 -->
<view class="load-more" wx:if="{{pagination.pending.hasMore}}">
<view class="loading-text" wx:if="{{pagination.pending.loading}}">
加载中...
</view>
<view class="load-more-text" wx:else bindtap="onReachPendingBottom">
点击加载更多审核中货源
</view>
</view>
<view class="no-more" wx:if="{{!pagination.pending.hasMore && pendingSupplies.length > 0}}">
没有更多审核中货源了
</view>
</block>
<view wx:else style="text-align: center; color: #999; font-size: 24rpx; padding: 30rpx 0;">
暂无审核中的货源
</view>
</block>
</view>
<!-- 审核失败的货源 -->
<view style="margin-top: 30rpx; width: 100%;">
<view style="font-size: 28rpx; font-weight: bold; color: #f5222d; margin-bottom: 15rpx; display: flex; justify-content: space-between; align-items: center;">
<text>审核失败的货源 ({{rejectedSupplies.length}})</text>
<view bindtap="toggleRejectedExpand" style="width: 40rpx; height: 40rpx; display: flex; align-items: center; justify-content: center;">
<text wx:if="{{isRejectedExpanded}}" style="color: #f5222d; font-size: 28rpx;">▼</text>
<text wx:else style="color: #f5222d; font-size: 28rpx;">▲</text>
</view>
</view>
<block wx:if="{{isRejectedExpanded}}">
<block wx:if="{{rejectedSupplies.length > 0}}">
<view wx:for="{{rejectedSupplies}}" wx:key="id" class="card" style="width: 100%;">
<!-- 图片和信息1:1比例并排显示 -->
<view style="display: flex; width: 100%; border-radius: 8rpx; overflow: hidden; background-color: #f5f5f5;">
<!-- 左侧图片区域 50%宽度 -->
<view style="width: 50%; position: relative;">
<!-- 第一张图片 -->
<view wx:if="{{item.imageUrls && item.imageUrls.length > 0}}" style="width: 100%; height: 100%;">
<image src="{{item.imageUrls[0]}}" mode="aspectFill" style="width: 100%; height: 100%;" bindtap="previewImage" data-urls="{{item.imageUrls}}" data-index="0"></image>
</view>
<view wx:else style="width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #999;">
<text>暂无图片</text>
</view>
<!-- 剩余图片可滑动区域 -->
<view wx:if="{{item.imageUrls && item.imageUrls.length > 1}}" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;">
<swiper
class="image-swiper"
style="width: 100%; height: 100%;"
current="{{item.currentImageIndex || 0}}"
bindchange="swiperChange"
data-id="{{item.id}}">
<block wx:for="{{item.imageUrls}}" wx:for-item="img" wx:for-index="idx" wx:key="idx">
<swiper-item>
<image src="{{img}}" mode="aspectFill" style="width: 100%; height: 100%;" bindtap="previewImage" data-urls="{{item.imageUrls}}" data-index="{{idx}}"></image>
</swiper-item>
</block>
</swiper>
<!-- 显示页码指示器 -->
<view style="position: absolute; bottom: 10rpx; right: 10rpx; background-color: rgba(0,0,0,0.5); color: white; padding: 5rpx 10rpx; border-radius: 15rpx; font-size: 20rpx;">
{{(item.currentImageIndex || 0) + 1}}/{{item.imageUrls.length}}
</view>
</view>
</view>
<!-- 右侧信息区域 50%宽度 -->
<view style="width: 50%; padding: 15rpx; display: flex; flex-direction: column; justify-content: space-between; background-color: white; border-left: 1rpx solid #f0f0f0;">
<view bindtap="showGoodsDetail" data-item="{{item}}">
<view style="font-size: 28rpx; font-weight: bold; word-break: break-word;">{{item.name}}
<view style="display: inline-block; margin-left: 10rpx; font-size: 18rpx; color: #fff; background-color: #f5222d; padding: 2rpx 8rpx; border-radius: 10rpx;">审核失败</view>
</view>
<view style="font-size: 24rpx; color: #666; margin-top: 8rpx;">蛋黄: {{item.yolk || '无'}}</view>
<view style="font-size: 24rpx; color: #666; margin-top: 8rpx;">规格: {{item.spec || '无'}}</view>
<view style="color: #f5222d; font-size: 24rpx; margin-top: 8rpx;">件数: {{item.minOrder}}件</view>
<view style="color: #1677ff; font-size: 24rpx; margin-top: 8rpx;">斤重: {{item.grossWeight || ''}}斤</view>
<view style="color: #722ed1; font-size: 24rpx; margin-top: 8rpx;">地区: {{item.region || '未设置'}}</view>
<view style="font-size: 22rpx; color: #999; margin-top: 8rpx;">创建时间: {{item.formattedCreatedAt}}</view>
<!-- 点击查看审核失败原因 -->
<view style="color: #f5222d; font-size: 24rpx; margin-top: 8rpx; text-decoration: underline;" catchtap="showRejectReason" data-id="{{item.id}}">
审核失败原因:点击查看
</view>
</view>
<!-- 按钮区域 -->
<view style="display: flex; justify-content: space-around; margin-top: 10rpx; gap: 10rpx;">
<button
style="background-color: #52c41a; color: white; font-size: 22rpx; padding: 0 15rpx; line-height: 60rpx;"
bindtap="preparePublishSupply"
data-id="{{item.id}}"
>
上架
</button>
<button
style="background-color: #f5222d; color: white; font-size: 22rpx; padding: 0 15rpx; line-height: 60rpx;"
bindtap="deleteSupply"
data-id="{{item.id}}"
>
删除
</button>
</view>
</view>
</view>
</view>
<!-- 审核失败货源加载更多 -->
<view class="load-more" wx:if="{{pagination.rejected.hasMore}}">
<view class="loading-text" wx:if="{{pagination.rejected.loading}}">
加载中...
</view>
<view class="load-more-text" wx:else bindtap="onReachRejectedBottom">
点击加载更多审核失败货源
</view>
</view>
<view class="no-more" wx:if="{{!pagination.rejected.hasMore && rejectedSupplies.length > 0}}">
没有更多审核失败货源了
</view>
</block>
<view wx:else style="text-align: center; color: #999; font-size: 24rpx; padding: 30rpx 0;">
暂无审核失败的货源
</view>
</block>
</view>
<!-- 草稿状态货源 -->
<view style="margin-top: 30rpx; width: 100%;">
<view style="font-size: 28rpx; font-weight: bold; color: #999; margin-bottom: 15rpx; display: flex; justify-content: space-between; align-items: center;">
<text>下架状态货源 ({{draftSupplies.length}})</text>
<view bindtap="toggleDraftExpand" style="width: 40rpx; height: 40rpx; display: flex; align-items: center; justify-content: center;">
<text wx:if="{{isDraftExpanded}}" style="color: #999; font-size: 28rpx;">▼</text>
<text wx:else style="color: #999; font-size: 28rpx;">▲</text>
</view>
</view>
<block wx:if="{{isDraftExpanded}}">
<block wx:if="{{draftSupplies.length > 0}}">
<view wx:for="{{draftSupplies}}" wx:key="id" class="card" style="width: 100%;">
<!-- 图片和信息1:1比例并排显示 -->
<view style="display: flex; width: 100%; border-radius: 8rpx; overflow: hidden; background-color: #f5f5f5;">
<!-- 左侧图片区域 50%宽度 -->
<view style="width: 50%; position: relative;">
<!-- 第一张图片 -->
<view wx:if="{{item.imageUrls && item.imageUrls.length > 0}}" style="width: 100%; height: 100%;">
<image src="{{item.imageUrls[0]}}" mode="aspectFill" style="width: 100%; height: 100%;" bindtap="previewImage" data-urls="{{item.imageUrls}}" data-index="0"></image>
</view>
<view wx:else style="width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #999;">
<text>暂无图片</text>
</view>
<!-- 剩余图片可滑动区域 -->
<view wx:if="{{item.imageUrls && item.imageUrls.length > 1}}" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;">
<swiper
class="image-swiper"
style="width: 100%; height: 100%;"
current="{{item.currentImageIndex || 0}}"
bindchange="swiperChange"
data-id="{{item.id}}">
<block wx:for="{{item.imageUrls}}" wx:for-item="img" wx:for-index="idx" wx:key="idx">
<swiper-item>
<image src="{{img}}" mode="aspectFill" style="width: 100%; height: 100%;" bindtap="previewImage" data-urls="{{item.imageUrls}}" data-index="{{idx}}"></image>
</swiper-item>
</block>
</swiper>
<!-- 显示页码指示器 -->
<view style="position: absolute; bottom: 10rpx; right: 10rpx; background-color: rgba(0,0,0,0.5); color: white; padding: 5rpx 10rpx; border-radius: 15rpx; font-size: 20rpx;">
{{(item.currentImageIndex || 0) + 1}}/{{item.imageUrls.length}}
</view>
</view>
</view>
<!-- 右侧信息区域 50%宽度 -->
<view style="width: 50%; padding: 15rpx; display: flex; flex-direction: column; justify-content: space-between; background-color: white; border-left: 1rpx solid #f0f0f0;">
<view bindtap="showGoodsDetail" data-item="{{item}}">
<view style="font-size: 28rpx; font-weight: bold; word-break: break-word;">{{item.name}}
<view wx:if="{{item.status === 'hidden'}}" style="display: inline-block; margin-left: 10rpx; font-size: 18rpx; color: #fff; background-color: #8c8c8c; padding: 2rpx 8rpx; border-radius: 10rpx;">已隐藏</view>
<view wx:elif="{{item.status === 'sold_out' || item.status === 'Undercarriage'}}" style="display: inline-block; margin-left: 10rpx; font-size: 18rpx; color: #fff; background-color: #d9d9d9; padding: 2rpx 8rpx; border-radius: 10rpx;">已下架</view>
<view wx:else style="display: inline-block; margin-left: 10rpx; font-size: 18rpx; color: #fff; background-color: #999; padding: 2rpx 8rpx; border-radius: 10rpx;">草稿</view>
<view style="display: inline-block; margin-left: 10rpx; font-size: 18rpx; color: #fff; background-color: #52c41a; padding: 2rpx 8rpx; border-radius: 10rpx;">已有{{item.reservedCount || 0}}人想要</view>
</view>
<view style="font-size: 24rpx; color: #666; margin-top: 8rpx;">蛋黄: {{item.yolk || '无'}}</view>
<view style="font-size: 24rpx; color: #666; margin-top: 8rpx;">规格: {{item.spec || '无'}}</view>
<view style="color: #f5222d; font-size: 24rpx; margin-top: 8rpx;">件数: {{item.minOrder}}件</view>
<view style="color: #1677ff; font-size: 24rpx; margin-top: 8rpx;">斤重: {{item.grossWeight || ''}}斤</view>
<view style="color: #722ed1; font-size: 24rpx; margin-top: 8rpx;">地区: {{item.region || '未设置'}}</view>
<view style="font-size: 22rpx; color: #999; margin-top: 8rpx;">创建时间: {{item.formattedCreatedAt}}</view>
</view>
<!-- 按钮区域 -->
<view style="display: flex; justify-content: space-around; margin-top: 10rpx; gap: 10rpx; flex-wrap: wrap;">
<button
style="background-color: #1677ff; color: white; font-size: 22rpx; padding: 0 12rpx; line-height: 56rpx;"
bindtap="preparePublishSupply"
data-id="{{item.id}}"
>
上架
</button>
<!-- <button
style="background-color: #faad14; color: white; font-size: 22rpx; padding: 0 12rpx; line-height: 56rpx;"
bindtap="showEditSupply"
data-id="{{item.id}}"
>
编辑
</button> -->
<button
style="background-color: #f5222d; color: white; font-size: 22rpx; padding: 0 12rpx; line-height: 56rpx;"
bindtap="deleteSupply"
data-id="{{item.id}}"
>
删除
</button>
</view>
</view>
</view>
</view>
<!-- 下架状态货源加载更多 -->
<view class="load-more" wx:if="{{pagination.draft.hasMore}}">
<view class="loading-text" wx:if="{{pagination.draft.loading}}">
加载中...
</view>
<view class="load-more-text" wx:else bindtap="onReachDraftBottom">
点击加载更多下架状态货源
</view>
</view>
<view class="no-more" wx:if="{{!pagination.draft.hasMore && draftSupplies.length > 0}}">
没有更多下架状态货源了
</view>
</block>
<view wx:else style="text-align: center; color: #999; font-size: 24rpx; padding: 30rpx 0;">
暂无下架状态的货源
</view>
</block>
<!-- 半页空白页 -->
<view class="half-page-blank"></view>
</view>
<!-- 创建货源弹窗 -->
<view class="modal" wx:if="{{showModal}}" style="position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: flex; justify-content: center; align-items: center; z-index: 999;" catchtouchmove="true" bindtouchstart="onModalTouchStart" bindtouchmove="onModalTouchMove">
<view class="modal-content" style="width: 100%; height: 100%; background: white; border-radius: 0; position: relative; box-shadow: none; transform: translateZ(0); -webkit-transform: translateZ(0);">
<!-- 固定的关闭按钮 -->
<view style="position: absolute; top: 20rpx; right: 20rpx; background-color: #f5f5f5; color: #666; width: 60rpx; height: 60rpx; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 36rpx; z-index: 10;" bindtap="hideModal">×</view>
<scroll-view scroll-y="true" style="height: 100vh; padding: 40rpx; box-sizing: border-box; overflow-y: scroll; -webkit-overflow-scrolling: touch; transform: translateZ(0); -webkit-transform: translateZ(0); -webkit-scrollbar: none; scrollbar-width: none;" catchtouchmove="true" bindtouchstart="onModalTouchStart" bindtouchmove="onModalTouchMove">
<view class="title" style="text-align: center; font-size: 36rpx; font-weight: bold; color: #333; margin-bottom: 30rpx; margin-top: 10rpx;">创建货源</view>
<!-- 照片上传区域 -->
<view style="font-size: 28rpx; font-weight: 500; color: #333; margin-bottom: 12rpx; margin-top: 10rpx;">商品图片</view>
<view class="upload-area" style="width: 100%; margin: 0 auto; margin-bottom: 30rpx; border: 1rpx dashed #ddd; border-radius: 12rpx; padding: 24rpx;">
<view style="display: flex; flex-wrap: wrap;">
<!-- 已上传的图片 -->
<view wx:for="{{newSupply.imageUrls}}" wx:key="index" style="position: relative; width: 160rpx; height: 160rpx; margin: 10rpx; border-radius: 12rpx; overflow: hidden; box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.1);">
<image src="{{item}}" mode="aspectFill" style="width: 100%; height: 100%;" bindtap="previewImage" data-urls="{{newSupply.imageUrls}}" data-index="{{index}}"></image>
<view class="delete-icon" style="position: absolute; top: 8rpx; right: 8rpx; background-color: rgba(0,0,0,0.6); color: white; width: 44rpx; height: 44rpx; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 28rpx;" bindtap="deleteImage" data-index="{{index}}" data-type="new">×</view>
</view>
<!-- 上传按钮 -->
<view wx:if="{{newSupply.imageUrls.length < 5}}" style="width: 160rpx; height: 160rpx; margin: 10rpx; border: 2rpx dashed #1677ff; border-radius: 12rpx; display: flex; align-items: center; justify-content: center; background-color: #f0f8ff;" bindtap="chooseImage" data-type="new">
<text style="font-size: 60rpx; color: #1677ff;">+</text>
</view>
</view>
<view style="font-size: 22rpx; color: #999; margin-top: 16rpx; text-align: center;">最多上传5张图片</view>
</view>
<view style="font-size: 28rpx; font-weight: 500; color: #333; margin-bottom: 12rpx; margin-left: 10rpx;">商品名称</view>
<view
bindtap="openNameSelectModal"
style="width: 100%; height: 90rpx; line-height: 90rpx; padding: 0 24rpx; font-size: 30rpx; border: 2rpx solid #eee; border-radius: 12rpx; box-sizing: border-box; margin: 0 auto 30rpx; display: block; background: white; position: relative;">
<view style="display: flex; justify-content: space-between; align-items: center;">
<text>{{newSupply.name || '请选择商品名称'}}</text>
<text style="color: #999;">▼</text>
</view>
</view>
<view style="font-size: 28rpx; font-weight: 500; color: #333; margin-bottom: 12rpx; margin-left: 10rpx;">蛋黄</view>
<view bindtap="openYolkSelectModal" style="width: 100%; height: 90rpx; line-height: 90rpx; padding: 0 24rpx; font-size: 30rpx; border: 2rpx solid #eee; border-radius: 12rpx; box-sizing: border-box; margin: 0 auto 30rpx; display: block; background: white; position: relative;">
<view style="display: flex; justify-content: space-between; align-items: center;">
<text>{{newSupply.yolk || '请选择蛋黄类型'}}</text>
<text style="color: #999;">▼</text>
</view>
</view>
<view style="font-size: 28rpx; font-weight: 500; color: #333; margin-bottom: 12rpx; margin-left: 10rpx;">规格</view>
<!-- 修改为可点击的视图,点击后打开自定义弹窗 -->
<view bindtap="onSpecChange" style="width: 100%; height: 90rpx; line-height: 90rpx; padding: 0 24rpx; font-size: 30rpx; border: 2rpx solid #eee; border-radius: 12rpx; box-sizing: border-box; margin: 0 auto 30rpx; display: block; background: white; position: relative; z-index: 1;">
<view style="display: flex; justify-content: space-between; align-items: center;">
<text>{{newSupply.spec || '请选择规格'}}</text>
<text style="color: #999;">▼</text>
</view>
</view>
<!-- 搜索功能已移至弹窗内 -->
<view style="font-size: 28rpx; font-weight: 500; color: #333; margin-bottom: 12rpx; margin-left: 10rpx;">地区</view>
<view bindtap="openCreateRegionModal" style="width: 100%; height: 90rpx; line-height: 90rpx; padding: 0 24rpx; font-size: 30rpx; border: 2rpx solid #eee; border-radius: 12rpx; box-sizing: border-box; margin: 0 auto 30rpx; display: block; background: white; position: relative; z-index: 1;">
<view style="display: flex; justify-content: space-between; align-items: center;">
<text>{{newSupply.region || '请选择省市区'}}</text>
<text style="color: #999;">▼</text>
</view>
</view>
<view style="font-size: 28rpx; font-weight: 500; color: #333; margin-bottom: 12rpx; margin-left: 10rpx;">价格</view>
<input class="input" type="text" placeholder="请输入价格" bindinput="onInput" data-field="price" value="{{newSupply.price}}" style="width: 100%; height: 90rpx; line-height: 90rpx; padding: 0 24rpx; font-size: 30rpx; border: 2rpx solid #eee; border-radius: 12rpx; box-sizing: border-box; margin: 0 auto 30rpx; display: block;" placeholder-style="font-size: 24rpx; color: #999; text-align: left;" catchtouchmove="true" bindtouchstart="onInputTouchStart" bindtouchmove="onInputTouchMove"></input>
<view style="font-size: 28rpx; font-weight: 500; color: #333; margin-bottom: 12rpx; margin-left: 10rpx;">件数</view>
<input class="input" type="number" placeholder="请输入件数" bindinput="onInput" data-field="minOrder" value="{{newSupply.minOrder}}" style="width: 100%; height: 90rpx; line-height: 90rpx; padding: 0 24rpx; font-size: 30rpx; border: 2rpx solid #eee; border-radius: 12rpx; box-sizing: border-box; margin: 0 auto 30rpx; display: block;" placeholder-style="font-size: 24rpx; color: #999; text-align: left;" catchtouchmove="true" bindtouchstart="onInputTouchStart" bindtouchmove="onInputTouchMove"></input>
<view style="font-size: 28rpx; font-weight: 500; color: #333; margin-bottom: 12rpx; margin-left: 10rpx;">斤重</view>
<input class="input" type="text" placeholder="请输入斤重" bindinput="onInput" data-field="grossWeight" value="{{newSupply.grossWeight || ''}}" style="width: 100%; height: 90rpx; line-height: 90rpx; padding: 0 24rpx; font-size: 30rpx; border: 2rpx solid #eee; border-radius: 12rpx; box-sizing: border-box; margin: 0 auto 30rpx; display: block;" placeholder-style="font-size: 24rpx; color: #999; text-align: left;" catchtouchmove="true" bindtouchstart="onInputTouchStart" bindtouchmove="onInputTouchMove"></input>
<view style="display: flex; justify-content: space-between; margin-top: 20rpx; margin-bottom: 20rpx; gap: 20rpx;">
<button bindtap="hideModal" style="flex: 1; height: 90rpx; line-height: 90rpx; background-color: #f5f5f5; color: #666; font-size: 30rpx; border-radius: 12rpx; margin: 0; display: flex; align-items: center; justify-content: center;">取消</button>
<button bindtap="addSupply" style="flex: 1; height: 90rpx; line-height: 90rpx; background-color: #07c160; color: white; font-size: 30rpx; border-radius: 12rpx; margin: 0; display: flex; align-items: center; justify-content: center;">创建</button>
</view>
<!-- 增加1/7屏幕高度的空白页,防止按钮被遮挡 -->
<view style="height: 14.28vh;"></view>
</scroll-view>
</view>
</view>
<!-- 编辑货源弹窗(全屏) -->
<view class="modal" wx:if="{{showEditModal}}" style="position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: white; z-index: 999;">
<!-- 顶部导航栏 -->
<view style="display: flex; justify-content: space-between; align-items: center; padding: 30rpx; border-bottom: 1rpx solid #eee; background-color: #fafafa; position: sticky; top: 0; z-index: 10;">
<view bindtap="hideEditModal" style="font-size: 32rpx; color: #666;">取消</view>
<view style="font-size: 32rpx; font-weight: bold; color: #333;">编辑货源</view>
<view bindtap="saveEdit" style="font-size: 32rpx; color: #07c160;">提交</view>
</view>
<scroll-view scroll-y="true" style="height: calc(100vh - 90rpx); overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 40rpx 60rpx; box-sizing: border-box;">
<view>
<!-- 照片上传区域 -->
<view style="font-size: 28rpx; font-weight: 500; color: #333; margin-bottom: 12rpx; margin-top: 10rpx;">商品图片</view>
<view class="upload-area" style="width: 100%; margin: 0 auto; margin-bottom: 30rpx; border: 1rpx dashed #ddd; border-radius: 12rpx; padding: 24rpx;">
<view style="display: flex; flex-wrap: wrap;">
<!-- 已上传的图片 -->
<view wx:for="{{editSupply.imageUrls}}" wx:key="index" style="position: relative; width: 160rpx; height: 160rpx; margin: 10rpx; border-radius: 12rpx; overflow: hidden; box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.1);">
<image src="{{item}}" mode="aspectFill" style="width: 100%; height: 100%;" bindtap="previewImage" data-urls="{{editSupply.imageUrls}}" data-index="{{index}}"></image>
<view class="delete-icon" style="position: absolute; top: 8rpx; right: 8rpx; background-color: rgba(0,0,0,0.6); color: white; width: 44rpx; height: 44rpx; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 28rpx;" bindtap="deleteImage" data-index="{{index}}" data-type="edit">×</view>
</view>
<!-- 上传按钮 -->
<view wx:if="{{editSupply.imageUrls.length < 5}}" style="width: 160rpx; height: 160rpx; margin: 10rpx; border: 2rpx dashed #1677ff; border-radius: 12rpx; display: flex; align-items: center; justify-content: center; background-color: #f0f8ff;" bindtap="chooseImage" data-type="edit">
<text style="font-size: 60rpx; color: #1677ff;">+</text>
</view>
</view>
<view style="font-size: 22rpx; color: #999; margin-top: 16rpx; text-align: center;">最多上传5张图片</view>
</view>
<view style="font-size: 28rpx; font-weight: 500; color: #333; margin-bottom: 12rpx; margin-left: 10rpx;">商品名称</view>
<view
bindtap="openNameSelectModal"
style="width: 100%; height: 90rpx; line-height: 90rpx; padding: 0 24rpx; font-size: 30rpx; border: 2rpx solid #eee; border-radius: 12rpx; box-sizing: border-box; margin: 0 auto 30rpx; display: block; background: white; position: relative;">
<view style="display: flex; justify-content: space-between; align-items: center;">
<text style="text-align: left;">{{editSupply.productName || '请选择商品名称'}}</text>
<text style="color: #999;">▼</text>
</view>
</view>
<view style="font-size: 28rpx; font-weight: 500; color: #333; margin-bottom: 12rpx; margin-left: 10rpx;">蛋黄</view>
<view bindtap="openYolkSelectModal" style="width: 100%; height: 90rpx; line-height: 90rpx; padding: 0 24rpx; font-size: 30rpx; border: 2rpx solid #eee; border-radius: 12rpx; box-sizing: border-box; margin: 0 auto 30rpx; display: block; background: white; position: relative;">
<view style="display: flex; justify-content: space-between; align-items: center;">
<text style="text-align: left;">{{editSupply.yolk || '请选择蛋黄类型'}}</text>
<text style="color: #999;">▼</text>
</view>
</view>
<view style="font-size: 28rpx; font-weight: 500; color: #333; margin-bottom: 12rpx; margin-left: 10rpx;">规格</view>
<!-- 修改为可点击的视图,点击后打开自定义弹窗 -->
<view bindtap="onEditSpecChange" style="width: 100%; height: 90rpx; line-height: 90rpx; padding: 0 24rpx; font-size: 30rpx; border: 2rpx solid #eee; border-radius: 12rpx; box-sizing: border-box; margin: 0 auto 30rpx; display: block; background: white; position: relative; z-index: 1;">
<view style="display: flex; justify-content: space-between; align-items: center;">
<text style="text-align: left;">{{editSupply.spec || '请选择规格'}}</text>
<text style="color: #999;">▼</text>
</view>
</view>
<!-- 搜索功能已移至弹窗内 -->
<view style="font-size: 28rpx; font-weight: 500; color: #333; margin-bottom: 12rpx; margin-left: 10rpx;">地区</view>
<view
class="region-picker input"
bindtap="openEditRegionModal"
style="width: 100%; height: 90rpx; line-height: 90rpx; padding: 0 24rpx; font-size: 30rpx; border: 2rpx solid #eee; border-radius: 12rpx; box-sizing: border-box; margin: 0 auto 30rpx; display: block;"
>
<text style="text-align: left;">{{editSupply.region || '请选择省市区'}}</text>
</view>
<view style="font-size: 28rpx; font-weight: 500; color: #333; margin-bottom: 12rpx; margin-left: 10rpx;">价格</view>
<input class="input" type="text" placeholder="请输入价格" bindinput="onEditInput" data-field="price" value="{{editSupply.price}}" style="width: 100%; height: 90rpx; line-height: 90rpx; padding: 0 24rpx; font-size: 30rpx; border: 2rpx solid #eee; border-radius: 12rpx; box-sizing: border-box; margin: 0 auto 30rpx; display: block;" placeholder-style="font-size: 24rpx; color: #999; text-align: left;"></input>
<view style="font-size: 28rpx; font-weight: 500; color: #333; margin-bottom: 12rpx; margin-left: 10rpx;">件数</view>
<input class="input" type="number" placeholder="请输入件数" bindinput="onEditInput" data-field="minOrder" value="{{editSupply.minOrder}}" style="width: 100%; height: 90rpx; line-height: 90rpx; padding: 0 24rpx; font-size: 30rpx; border: 2rpx solid #eee; border-radius: 12rpx; box-sizing: border-box; margin: 0 auto 30rpx; display: block;" placeholder-style="font-size: 24rpx; color: #999; text-align: left;"></input>
<view style="font-size: 28rpx; font-weight: 500; color: #333; margin-bottom: 12rpx; margin-left: 10rpx;">斤重</view>
<input class="input" type="text" placeholder="请输入斤重" bindinput="onEditInput" data-field="grossWeight" value="{{editSupply.grossWeight || ''}}" style="width: 100%; height: 90rpx; line-height: 90rpx; padding: 0 24rpx; font-size: 30rpx; border: 2rpx solid #eee; border-radius: 12rpx; box-sizing: border-box; margin: 0 auto 30rpx; display: block;" placeholder-style="font-size: 24rpx; color: #999; text-align: left;"></input>
<!-- 添加底部空白区域 -->
<view style="height: 20vh; background: transparent;"></view>
</view>
</scroll-view>
</view>
<!-- 图片预览弹窗 -->
<view class="image-preview-mask" wx:if="{{showImagePreview}}" style="position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.9); display: flex; justify-content: center; align-items: center; z-index: 9999;" catchtouchmove="true" bindtap="closeImagePreview">
<view style="width: 100%; height: 100%; display: flex; justify-content: center; align-items: center;">
<swiper
style="width: 100%; height: 100%;"
current="{{previewImageIndex}}"
bindchange="onPreviewImageChange"
indicator-dots="true"
indicator-color="rgba(255,255,255,0.5)"
indicator-active-color="#fff">
<block wx:for="{{previewImageUrls}}" wx:key="*this">
<swiper-item>
<image
src="{{item}}"
mode="aspectFit"
style="width: 100%; height: 100%; transform: scale({{scale}}) translate({{offsetX}}px, {{offsetY}}px); transform-origin: center; transition: transform 0.1s;"
bindtap="handleImageTap"
bindtouchstart="handleTouchStart"
bindtouchmove="handleTouchMove"
bindtouchend="handleTouchEnd"
bindload="onPreviewImageLoad"
></image>
</swiper-item>
</block>
</swiper>
<view style="position: absolute; top: 40rpx; right: 40rpx; color: white; font-size: 40rpx;">
<text bindtap="closeImagePreview" style="background: rgba(0,0,0,0.5); padding: 10rpx 20rpx; border-radius: 50%;">×</text>
</view>
</view>
</view>
<!-- 审核失败原因弹窗 -->
<view class="reject-reason-modal" wx:if="{{showRejectReasonModal}}" style="position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: flex; justify-content: center; align-items: center; z-index: 9999;" catchtouchmove="true">
<view style="width: 80%; background: white; border-radius: 16rpx; overflow: hidden;">
<!-- 弹窗标题和关闭按钮 -->
<view style="padding: 30rpx; border-bottom: 1rpx solid #eee; display: flex; justify-content: space-between; align-items: center;">
<text style="font-size: 32rpx; font-weight: bold;">审核失败原因</text>
<view style="width: 60rpx; height: 60rpx; display: flex; align-items: center; justify-content: center; font-size: 40rpx; color: #999;" bindtap="closeRejectReasonModal">×</view>
</view>
<!-- 失败原因内容 -->
<view style="padding: 30rpx;">
<view style="min-height: 200rpx; font-size: 28rpx; line-height: 48rpx; color: #333; white-space: pre-wrap; word-break: break-word; background-color: #f8f9fa; border: 1rpx solid #e9ecef; border-radius: 8rpx; padding: 24rpx; box-shadow: inset 0 1rpx 3rpx rgba(0,0,0,0.05); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;">{{rejectReason}}</view>
</view>
<!-- 操作按钮 -->
<view style="display: flex; padding: 0 30rpx 30rpx; gap: 20rpx;">
<button style="flex: 1; background-color: #52c41a; color: white; font-size: 28rpx; margin: 0; border-radius: 8rpx; border: none; height: 80rpx; line-height: 80rpx; box-shadow: 0 2rpx 8rpx rgba(82, 196, 26, 0.3);" bindtap="resubmitRejectedSupply">重新提交</button>
</view>
</view>
</view>
<!-- 蛋黄选择弹窗 - 白色样式 -->
<view class="custom-select-modal" wx:if="{{showYolkSelectModal}}" style="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;" catchtouchmove="true">
<view style="position: fixed; bottom: 0; left: 0; right: 0; background: white; border-radius: 20rpx 20rpx 0 0; max-height: 80vh;">
<!-- 顶部操作栏:取消和确定按钮 -->
<view style="padding: 20rpx; display: flex; justify-content: space-between; align-items: center; border-bottom: 1rpx solid #eee;">
<view bindtap="closeYolkSelectModal" style="font-size: 32rpx; color: #333; padding: 10rpx 20rpx;">取消</view>
<view bindtap="confirmYolkSelection" style="font-size: 32rpx; color: #07c160; padding: 10rpx 20rpx;">确定</view>
</view>
<!-- 蛋黄列表 -->
<scroll-view
scroll-y="true"
style="max-height: 60vh; padding: 0; -webkit-overflow-scrolling: touch; -webkit-scrollbar: none; scrollbar-width: none;"
enable-back-to-top="false"
>
<view
wx:for="{{yolkOptions}}"
wx:key="index"
class="select-item {{selectedYolkIndex === index ? 'selected' : ''}}"
bindtap="onYolkSelect"
data-index="{{index}}"
style="padding: 32rpx 40rpx; border-bottom: 1rpx solid #f0f0f0; font-size: 32rpx; color: {{selectedYolkIndex === index ? '#07c160' : '#131413'}}; text-align: center;"
>
{{item}}
</view>
</scroll-view>
</view>
</view>
<!-- 商品名称选择弹窗 - 白色样式 -->
<view class="custom-select-modal" wx:if="{{showNameSelectModal}}" style="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;" catchtouchmove="true">
<view style="position: fixed; bottom: 0; left: 0; right: 0; background: white; border-radius: 20rpx 20rpx 0 0; max-height: 80vh;">
<!-- 顶部操作栏:取消和确定按钮 -->
<view style="padding: 20rpx; display: flex; justify-content: space-between; align-items: center; border-bottom: 1rpx solid #eee;">
<view bindtap="closeNameSelectModal" style="font-size: 32rpx; color: #333; padding: 10rpx 20rpx;">取消</view>
<view bindtap="confirmNameSelection" style="font-size: 32rpx; color: #07c160; padding: 10rpx 20rpx;">确定</view>
</view>
<!-- 商品名称列表 -->
<scroll-view
scroll-y="true"
style="max-height: 60vh; padding: 0; -webkit-overflow-scrolling: touch;"
enable-back-to-top="false"
>
<view
wx:for="{{productNameOptions}}"
wx:key="index"
class="select-item {{selectedNameIndex === index ? 'selected' : ''}}"
bindtap="onNameSelect"
data-index="{{index}}"
style="padding: 32rpx 40rpx; border-bottom: 1rpx solid #f0f0f0; font-size: 32rpx; color: {{selectedNameIndex === index ? '#07c160' : '#131413'}}; text-align: center;"
>
{{item}}
</view>
</scroll-view>
</view>
</view>
<!-- 自定义规格选择弹窗 - 适配原生风格 -->
<view class="spec-select-modal" wx:if="{{showSpecSelectModal}}" style="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;" catchtouchmove="true">
<view style="position: fixed; bottom: 0; left: 0; right: 0; background: white; border-radius: 20rpx 20rpx 0 0; max-height: 80vh;">
<!-- 顶部操作栏:取消和确定按钮 -->
<view style="padding: 20rpx; display: flex; justify-content: space-between; align-items: center; border-bottom: 1rpx solid #eee;">
<view bindtap="closeSpecSelectModal" style="font-size: 32rpx; color: #333; padding: 10rpx 20rpx;">取消</view>
<view bindtap="confirmSpecSelection" style="font-size: 32rpx; color: #07c160; padding: 10rpx 20rpx;">确定</view>
</view>
<!-- 搜索框区域 -->
<view style="padding: 20rpx;">
<view style="position: relative; background: #f5f5f5; border-radius: 40rpx; padding: 0 30rpx;">
<input
type="text"
placeholder="搜索规格"
value="{{modalSpecSearchKeyword}}"
bindinput="onModalSpecSearchInput"
confirm-type="search"
style="width: 100%; height: 70rpx; line-height: 70rpx; font-size: 28rpx; background: transparent;"
/>
<view
wx:if="{{modalSpecSearchKeyword}}"
bindtap="clearModalSpecSearch"
style="position: absolute; right: 30rpx; top: 50%; transform: translateY(-50%); color: #999;"
>
</view>
</view>
</view>
<!-- 规格列表 -->
<scroll-view
scroll-y="true"
style="max-height: 60vh; padding: 0; -webkit-overflow-scrolling: touch;"
enable-back-to-top="false"
>
<view
wx:for="{{filteredModalSpecOptions}}"
wx:key="index"
class="spec-item {{selectedModalSpecIndex === index ? 'selected' : ''}}"
bindtap="onModalSpecSelect"
data-index="{{index}}"
style="padding: 32rpx 40rpx; border-bottom: 1rpx solid #f0f0f0; font-size: 32rpx; color: {{selectedModalSpecIndex === index ? '#07c160' : '#131413'}}; text-align: center;"
>
{{item}}
</view>
</scroll-view>
</view>
</view>
<!-- 未授权登录提示弹窗 -->
<view wx:if="{{showAuthModal}}" class="auth-modal-overlay">
<view class="auth-modal-container">
<view class="auth-modal-title">提示</view>
<view class="auth-modal-content">请先登录后再操作</view>
<view class="auth-modal-buttons">
<button class="auth-primary-button" bindtap="showOneKeyLogin">一键登录</button>
<button class="auth-cancel-button" bindtap="closeAuthModal">取消</button>
</view>
</view>
</view>
<!-- 一键登录弹窗 -->
<view wx:if="{{showOneKeyLoginModal}}" class="auth-modal-overlay">
<view class="auth-modal-container">
<view class="auth-modal-title">
<text>授权登录</text>
</view>
<view class="auth-modal-content">
<text>请授权获取您的手机号用于登录</text>
</view>
<view class="auth-modal-buttons">
<button class="auth-primary-button" open-type="getPhoneNumber" bind:getphonenumber="onGetPhoneNumber">
授权获取手机号
</button>
<button class="auth-cancel-button" bindtap="closeOneKeyLoginModal">取消</button>
</view>
</view>
</view>
<!-- 用户信息填写弹窗 -->
<view wx:if="{{showUserInfoForm}}" class="auth-modal-overlay">
<view class="auth-modal-container">
<view class="auth-modal-title">
<text>完善个人信息</text>
</view>
<!-- 头像选择 -->
<view class="auth-avatar-section">
<button class="auth-avatar-wrapper" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar">
<image class="auth-avatar" src="{{avatarUrl}}"></image>
</button>
</view>
<!-- 昵称输入 -->
<form bindsubmit="getUserName">
<view class="auth-form-group">
<view class="auth-form-label">昵称</view>
<input placeholder="请输入昵称" type="nickname" name="name" maxlength="32" class="auth-form-input"></input>
</view>
<!-- 提交按钮 -->
<view class="auth-form-actions">
<button form-type="submit" class="auth-confirm-button">确定</button>
</view>
</form>
<!-- 取消按钮 -->
<view class="auth-modal-buttons">
<button class="auth-cancel-button" bindtap="cancelUserInfoForm">取消</button>
</view>
</view>
</view>
<!-- 地区选择弹窗 -->
<view class="region-select-modal" wx:if="{{showRegionSelectModal}}" style="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;">
<view style="position: fixed; bottom: 0; left: 0; right: 0; background: white; border-radius: 20rpx 20rpx 0 0; max-height: 80vh;">
<!-- 顶部操作栏:取消和确定按钮 -->
<view style="padding: 20rpx; display: flex; justify-content: space-between; align-items: center; border-bottom: 1rpx solid #eee;">
<view bindtap="closeRegionModal" style="font-size: 32rpx; color: #333; padding: 10rpx 20rpx;">取消</view>
<view bindtap="confirmRegionSelection" style="font-size: 32rpx; color: #07c160; padding: 10rpx 20rpx;">确定</view>
</view>
<!-- 搜索框 -->
<view style="padding: 12rpx 20rpx; border-bottom: 1rpx solid #eee;">
<view class="search-box-compact">
<text class="search-icon-text">🔍</text>
<input
class="search-input-compact"
placeholder="搜索地区"
value="{{currentRegionMode === 'create' ? regionSearchKeyword : editRegionSearchKeyword}}"
bindinput="onRegionSearchInput"
bindfocus="onRegionSearchFocus"
/>
<image
class="clear-icon-compact"
wx:if="{{(currentRegionMode === 'create' && regionSearchKeyword) || (currentRegionMode === 'edit' && editRegionSearchKeyword)}}"
src="/images/close.png"
mode="aspectFit"
bindtap="clearRegionSearch"
></image>
</view>
</view>
<!-- 显示当前选择的地区 -->
<view style="padding: 20rpx; text-align: center; color: #666; font-size: 28rpx; border-bottom: 1rpx solid #f0f0f0;">
当前选择: {{regionOptions[selectedProvinceIndex].name}} {{currentCities[selectedCityIndex].name}} {{currentDistricts[selectedDistrictIndex]}}
</view>
<!-- 搜索结果区域 -->
<scroll-view
wx:if="{{showSearchResults}}"
style="max-height: 200rpx; border-bottom: 1rpx solid #eee; -webkit-scrollbar: none; scrollbar-width: none;"
scroll-y
>
<view
wx:for="{{filteredRegionOptions}}"
wx:key="item"
class="search-result-item"
bindtap="selectSearchRegion"
data-region="{{item.region}}"
data-province-index="{{item.provinceIndex}}"
data-city-index="{{item.cityIndex}}"
data-district-index="{{item.districtIndex}}"
>
{{item.region}}
</view>
<view wx:if="{{filteredRegionOptions.length === 0}}" style="padding: 20rpx; text-align: center; color: #999;">
未找到匹配的地区
</view>
</scroll-view>
<!-- 三级联动地区选择器 -->
<view style="height: 400rpx; padding: 20rpx 0;">
<picker-view
indicator-style="height: 60rpx; background-color: rgba(245, 245, 245, 0.8);"
style="width: 100%; height: 100%;"
value="{{[selectedProvinceIndex, selectedCityIndex, selectedDistrictIndex]}}"
bindchange="onRegionChange"
>
<picker-view-column>
<view wx:for="{{regionOptions}}" wx:key="index" style="line-height: 60rpx; text-align: center; font-size: 32rpx;">
{{item.name}}
</view>
</picker-view-column>
<picker-view-column>
<view wx:for="{{currentCities}}" wx:key="index" style="line-height: 60rpx; text-align: center; font-size: 32rpx;">
{{item.name}}
</view>
</picker-view-column>
<picker-view-column>
<view wx:for="{{currentDistricts}}" wx:key="index" style="line-height: 60rpx; text-align: center; font-size: 32rpx;">
{{item}}
</view>
</picker-view-column>
</picker-view>
</view>
</view>
</view>
</view>

1018
pages/seller/index.wxss

File diff suppressed because it is too large
Loading…
Cancel
Save