Browse Source

完成买家、收藏、商品详情、结算页面的更新

pull/1/head
徐飞洋 2 months ago
parent
commit
f1c55ae906
  1. 33
      pages/buyer/index.js
  2. 10
      pages/buyer/index.wxml
  3. 290
      pages/favorites/index.js
  4. 169
      pages/goods-detail/goods-detail.js
  5. 4
      pages/goods-detail/goods-detail.wxml
  6. 2
      pages/index/index.wxml
  7. 60
      pages/settlement/index.js
  8. 21
      pages/settlement/index.wxml
  9. 222
      pages/settlement/index.wxss

33
pages/buyer/index.js

@ -30,6 +30,36 @@ function formatGrossWeight(grossWeight, weight) {
console.log('两个参数都无效,返回空字符串');
return ""; // 返回空字符串以支持文字输入
}
// 提取地区中的省份信息
function extractProvince(region) {
if (!region || typeof region !== 'string') {
return region;
}
// 查找各种省份格式的位置
const provinceEndIndex = region.indexOf('省');
const autonomousRegionEndIndex = region.indexOf('自治区');
const municipalityEndIndex = region.indexOf('市'); // 用于直辖市,如北京市、上海市
const specialRegionEndIndex = region.indexOf('特别行政区'); // 用于香港、澳门
if (provinceEndIndex !== -1) {
// 包含"省"字,提取到"省"字结束
return region.substring(0, provinceEndIndex + 1);
} else if (autonomousRegionEndIndex !== -1) {
// 包含"自治区",提取到"自治区"结束
return region.substring(0, autonomousRegionEndIndex + 3);
} else if (specialRegionEndIndex !== -1) {
// 包含"特别行政区",提取到"特别行政区"结束
return region.substring(0, specialRegionEndIndex + 5);
} else if (municipalityEndIndex === 2) {
// 直辖市(如北京市、上海市),市字在第2个字符位置
return region.substring(0, municipalityEndIndex + 1);
}
// 如果没有找到匹配的格式,返回原字符串
return region;
}
Page({
// 分享给朋友/群聊
onShareAppMessage() {
@ -878,7 +908,8 @@ Page({
yolk: product.yolk,
spec: (product.spec && product.spec !== '无') ? product.spec : (product.specification && product.specification !== '无') ? product.specification : '',
specification: (product.spec && product.spec !== '无') ? product.spec : (product.specification && product.specification !== '无') ? product.specification : '',
region: product.region || '', // 【新增】添加地区字段
fullRegion: product.region || '', // 保存完整地区数据
region: product.region ? extractProvince(product.region) : '', // 只显示省份
grossWeight: grossWeightValue,
displayGrossWeight: formatGrossWeight(grossWeightValue, product.weight),
seller: product.seller && (product.seller.name || product.seller.nickName) ? (product.seller.name || product.seller.nickName) : '未知卖家',

10
pages/buyer/index.wxml

@ -70,11 +70,15 @@
<!-- 下半部分按钮区域(40%高度) -->
<view style="flex: 0.4; display: flex; justify-content: space-between; align-items: center; padding: 0 20rpx;">
<!-- 收藏人数显示 -->
<text style="color: #2b66f0ff; font-size: 28rpx; font-weight: bold;">已有{{item.reservedCount || 0}}人收藏</text>
<view style="display: flex; align-items: center;">
<text style="color: #060c0cff; font-size: 28rpx; font-weight: bold; margin-right: 8rpx;">已有</text>
<text style="color: #d865d8ff; font-size: 28rpx; font-weight: bold;">{{item.reservedCount || 0}}</text>
<text style="color: #060c0cff; font-size: 28rpx; font-weight: bold; margin-left: 8rpx;">人收藏</text>
</view>
<!-- 根据是否已收藏显示不同的按钮 -->
<button
wx:if="{{item.isFavorite}}"
style="background-color: #91c41aff; color: white; font-size: 24rpx; font-weight: bold; width: 150rpx; height: 60rpx; border-radius: 999rpx; display: flex; justify-content: center; align-items: center; padding: 0; border: none; margin: 0; background: none; background-color: #91c41aff;"
style="background-color: #9DC209; color: white; font-size: 24rpx; font-weight: bold; width: 150rpx; height: 60rpx; border-radius: 999rpx; display: flex; justify-content: center; align-items: center; padding: 0; border: none; margin: 0; transition: background-color 0.3s ease;"
bindtap="cancelFavorite"
data-item="{{item}}"
>
@ -82,7 +86,7 @@
</button>
<button
wx:else
style="background-color: #f74ac3; color: white; font-size: 24rpx; font-weight: bold; width: 150rpx; height: 60rpx; border-radius: 999rpx; display: flex; justify-content: center; align-items: center; padding: 0; border: none; margin: 0; background: none; background-color: #f74ac3;"
style="background-color: #2F82FF; color: white; font-size: 24rpx; font-weight: bold; width: 150rpx; height: 60rpx; border-radius: 999rpx; display: flex; justify-content: center; align-items: center; padding: 0; border: none; margin: 0; transition: background-color 0.3s ease;"
bindtap="addFavorite"
data-item="{{item}}"
>

290
pages/favorites/index.js

@ -1,6 +1,36 @@
// pages/favorites/index.js
const API = require('../../utils/api.js');
// 提取地区中的省份信息
function extractProvince(region) {
if (!region || typeof region !== 'string') {
return region;
}
// 查找各种省份格式的位置
const provinceEndIndex = region.indexOf('省');
const autonomousRegionEndIndex = region.indexOf('自治区');
const municipalityEndIndex = region.indexOf('市'); // 用于直辖市,如北京市、上海市
const specialRegionEndIndex = region.indexOf('特别行政区'); // 用于香港、澳门
if (provinceEndIndex !== -1) {
// 包含"省"字,提取到"省"字结束
return region.substring(0, provinceEndIndex + 1);
} else if (autonomousRegionEndIndex !== -1) {
// 包含"自治区",提取到"自治区"结束
return region.substring(0, autonomousRegionEndIndex + 3);
} else if (specialRegionEndIndex !== -1) {
// 包含"特别行政区",提取到"特别行政区"结束
return region.substring(0, specialRegionEndIndex + 5);
} else if (municipalityEndIndex === 2) {
// 直辖市(如北京市、上海市),市字在第2个字符位置
return region.substring(0, municipalityEndIndex + 1);
}
// 如果没有找到匹配的格式,返回原字符串
return region;
}
Page({
/**
@ -156,42 +186,105 @@ Page({
return;
}
API.getFavorites(phoneNumber).then(res => {
console.log('获取收藏列表成功:', res);
// 检查API返回是否成功
if (res && res.code === 200 && res.data) {
let favorites = res.data.favorites || [];
// 转换supplyStatus字段值
favorites = favorites.map(item => {
if (item.Product && item.Product.supplyStatus) {
// 将supplyStatus由"平台货源"、"三方认证"、"三方未认证"修改为"预售"、"现货"
// 平台货源和三方认证转为现货,三方未认证转为预售
if (['平台货源', '三方认证'].includes(item.Product.supplyStatus)) {
item.Product.supplyStatus = "现货";
} else if (item.Product.supplyStatus === '三方未认证') {
item.Product.supplyStatus = "预售";
// 首先获取所有商品列表,确保包含联系人信息
API.getProductList('published', {
page: 1,
pageSize: 100 // 获取足够多的商品,确保包含所有收藏商品
}).then(productListRes => {
console.log('获取商品列表成功:', productListRes);
// 然后获取收藏列表
return API.getFavorites(phoneNumber).then(res => {
console.log('获取收藏列表成功:', res);
// 检查API返回是否成功
if (res && res.code === 200 && res.data) {
let favorites = res.data.favorites || [];
// 获取商品列表数据
const allProducts = productListRes && productListRes.products ? productListRes.products : [];
// 转换supplyStatus字段值,并从商品列表中获取联系人信息
favorites = favorites.map(item => {
if (item.Product && item.Product.supplyStatus) {
// 将supplyStatus由"平台货源"、"三方认证"、"三方未认证"修改为"预售"、"现货"
// 平台货源和三方认证转为现货,三方未认证转为预售
if (['平台货源', '三方认证'].includes(item.Product.supplyStatus)) {
item.Product.supplyStatus = "现货";
} else if (item.Product.supplyStatus === '三方未认证') {
item.Product.supplyStatus = "预售";
}
}
}
return item;
});
// 从商品列表中查找对应的商品,获取联系人信息
const productId = item.Product?.productId || item.productId;
const matchingProduct = allProducts.find(product =>
String(product.id) === String(productId) ||
String(product.productId) === String(productId)
);
// 提取联系人信息
let product_contact = '';
let contact_phone = '';
let fullRegion = '';
let province = '';
// 优先从商品列表中获取联系人信息和地区信息
if (matchingProduct) {
product_contact = matchingProduct.product_contact || matchingProduct.contact || '';
contact_phone = matchingProduct.contact_phone || matchingProduct.phone || '';
// 保存完整地区数据
fullRegion = matchingProduct.fullRegion || matchingProduct.region || '';
// 提取省份
province = extractProvince(fullRegion);
}
// 然后尝试从收藏数据中获取
else if (item.Product) {
product_contact = item.Product.product_contact || item.Product.contact || '';
contact_phone = item.Product.contact_phone || item.Product.phone || '';
// 保存完整地区数据
fullRegion = item.Product.region || '';
// 提取省份
province = extractProvince(fullRegion);
}
// 更新item对象,确保联系人信息和地区信息同时存在于顶层和Product对象中
item.product_contact = product_contact;
item.contact_phone = contact_phone;
item.fullRegion = fullRegion;
item.region = province;
if (item.Product) {
item.Product.product_contact = product_contact;
item.Product.contact_phone = contact_phone;
item.Product.fullRegion = fullRegion;
item.Product.region = province;
}
return item;
});
console.log('更新后的收藏列表:', favorites);
this.setData({
favoritesList: favorites,
hasFavorites: favorites.length > 0,
loading: false
});
} else {
// API返回格式不正确
this.setData({
loading: false,
hasFavorites: false
});
wx.showToast({
title: '数据获取失败',
icon: 'none'
});
}
this.setData({
favoritesList: favorites,
hasFavorites: favorites.length > 0,
loading: false
});
} else {
// API返回格式不正确
this.setData({
loading: false,
hasFavorites: false
});
wx.showToast({
title: '数据获取失败',
icon: 'none'
});
}
// 停止下拉刷新
if (isPullDown) {
wx.stopPullDownRefresh();
}
});
}).catch(err => {
console.error('获取收藏列表失败:', err);
wx.showToast({
@ -202,7 +295,6 @@ Page({
loading: false,
hasFavorites: false
});
}).finally(() => {
// 停止下拉刷新
if (isPullDown) {
wx.stopPullDownRefresh();
@ -253,14 +345,18 @@ Page({
/**
* 跳转到商品详情页
*/
goToGoodsDetail: function (e) {
// 检查用户是否登录
goToGoodsDetail: function(e) {
console.log('goToGoodsDetail - e.currentTarget.dataset:', e.currentTarget.dataset);
const goodsItem = e.currentTarget.dataset.item;
console.log('goToGoodsDetail - goodsItem:', goodsItem);
console.log('goToGoodsDetail - goodsItem.Product:', goodsItem.Product);
// 检查用户登录状态
const openid = wx.getStorageSync('openid');
const userId = wx.getStorageSync('userId');
if (!openid || !userId) {
console.log('用户未登录,需要授权登录');
// 显示授权登录弹窗
console.log('用户未登录,提示登录');
wx.showToast({
title: '请先登录',
icon: 'none'
@ -268,12 +364,116 @@ Page({
return;
}
const goodsItem = e.currentTarget.dataset.item;
// 获取嵌套在Product对象中的商品数据
const productData = goodsItem.Product;
// 跳转到商品详情页面,并传递商品数据,使用encodeURIComponent编码JSON字符串
wx.navigateTo({
url: '/pages/goods-detail/goods-detail?goodsData=' + encodeURIComponent(JSON.stringify(productData))
// 获取商品ID
const productId = goodsItem.Product?.productId || goodsItem.productId;
console.log('获取完整商品详情 - productId:', productId);
// 调用API.getProductList获取完整的商品列表,确保包含联系人信息
wx.showLoading({ title: '加载中' });
API.getProductList('published', {
page: 1,
pageSize: 100 // 获取足够多的商品,确保包含当前商品
}).then(productListRes => {
console.log('获取商品列表成功:', productListRes);
// 获取商品列表数据
const allProducts = productListRes && productListRes.products ? productListRes.products : [];
// 从商品列表中查找对应的商品,获取联系人信息
const matchingProduct = allProducts.find(product =>
String(product.id) === String(productId) ||
String(product.productId) === String(productId)
);
// 提取联系人信息
let product_contact = '';
let contact_phone = '';
let region = '';
// 优先从商品列表中获取联系人信息
if (matchingProduct) {
product_contact = matchingProduct.product_contact || matchingProduct.contact || '';
contact_phone = matchingProduct.contact_phone || matchingProduct.phone || '';
region = matchingProduct.region || '';
console.log('从商品列表获取到联系人信息:', { product_contact, contact_phone, region });
}
// 然后尝试从收藏数据中获取
else {
product_contact = goodsItem.product_contact || goodsItem.Product?.product_contact || goodsItem.Product?.contact || goodsItem.contact || '';
contact_phone = goodsItem.contact_phone || goodsItem.Product?.contact_phone || goodsItem.Product?.phone || goodsItem.phone || '';
region = goodsItem.region || goodsItem.Product?.region || '';
console.log('从收藏数据获取到联系人信息:', { product_contact, contact_phone, region });
}
// 确保商品ID正确设置
const productData = goodsItem.Product || {};
const completeGoodsData = {
// 首先包含原始商品对象的所有字段
...goodsItem,
// 然后用Product对象中的字段覆盖
...productData,
// 确保商品ID正确设置
id: productData.productId || goodsItem.productId,
productId: productData.productId || goodsItem.productId,
// 强制设置从商品列表中获取到的联系人信息和地区信息
product_contact: product_contact,
contact_phone: contact_phone,
// 保存完整地区数据
fullRegion: region,
// 只显示省份
region: extractProvince(region)
};
// 专门检查并记录联系人信息
console.log('联系人信息检查:');
console.log('- 联系人姓名:', completeGoodsData.product_contact || '暂无');
console.log('- 联系电话:', completeGoodsData.contact_phone || '暂无');
// 添加更多日志,确保我们没有丢失重要信息
console.log('准备传递的完整商品数据:', completeGoodsData);
wx.hideLoading();
// 跳转到商品详情页
wx.navigateTo({
url: '/pages/goods-detail/goods-detail?goodsData=' + encodeURIComponent(JSON.stringify(completeGoodsData))
});
// 后台调用API.updateProductContacts(),与buyer页面保持一致
console.log('开始调用API.updateProductContacts()');
API.updateProductContacts().then(function(res) {
console.log('商品联系人更新成功:', res);
}).catch(function(err) {
console.error('商品联系人更新失败:', err);
});
}).catch(err => {
console.error('获取商品列表失败:', err);
wx.hideLoading();
// 即使获取商品列表失败,也尝试跳转到详情页
// 保存当前已有的联系人信息
const existingContactInfo = {
product_contact: goodsItem.product_contact || goodsItem.Product?.product_contact || goodsItem.Product?.contact || goodsItem.contact || '',
contact_phone: goodsItem.contact_phone || goodsItem.Product?.contact_phone || goodsItem.Product?.phone || goodsItem.phone || '',
region: goodsItem.region || goodsItem.Product?.region || ''
};
// 确保商品ID正确设置
const productData = goodsItem.Product || {};
const completeGoodsData = {
...goodsItem,
...productData,
id: productData.productId || goodsItem.productId,
productId: productData.productId || goodsItem.productId,
product_contact: existingContactInfo.product_contact,
contact_phone: existingContactInfo.contact_phone,
region: existingContactInfo.region
};
// 跳转到商品详情页
wx.navigateTo({
url: '/pages/goods-detail/goods-detail?goodsData=' + encodeURIComponent(JSON.stringify(completeGoodsData))
});
});
},

169
pages/goods-detail/goods-detail.js

@ -83,69 +83,46 @@ Page({
initialTouch: null, // 初始触摸点
},
onLoad(options) {
onLoad: function (options) {
console.log('商品详情页面加载,参数:', options);
// 检查是否来自seller页面
const fromSeller = options.fromSeller === '1' ? true : false;
// 支持两种参数传递方式:直接传递商品数据或仅传递商品ID
// 解析传入的商品数据
let goodsData = null;
if (options.goodsData) {
try {
// 解析JSON字符串为商品对象
const goodsData = JSON.parse(decodeURIComponent(options.goodsData));
goodsData = JSON.parse(decodeURIComponent(options.goodsData));
console.log('解析后的商品数据:', goodsData);
// 确保商品ID的一致性
const productIdStr = String(goodsData.productId || goodsData.id);
// 无论是否有传递数据,都调用API获取最新的商品详情(特别是联系人信息)
this.loadGoodsDetail(productIdStr);
// 设置来源标识
// 优先使用传入的商品数据中的联系人信息
this.setData({
fromSeller: fromSeller
goodsDetail: goodsData,
fromSeller: options.fromSeller === 'true'
});
} catch (error) {
console.error('解析商品数据失败:', error);
wx.showToast({
title: '数据解析错误',
icon: 'none',
duration: 2000
});
// 2秒后返回上一页
setTimeout(() => {
wx.navigateBack();
}, 2000);
}
} else if (options.id) {
// 如果只传递了商品ID,则从服务器加载商品详情
this.loadGoodsDetail(options.id);
// 设置来源标识
this.setData({
fromSeller: fromSeller
});
}
// 从商品数据中提取商品ID
let productId;
if (goodsData && (goodsData.id || goodsData.productId)) {
productId = goodsData.id || goodsData.productId;
} else if (options.productId) {
productId = options.productId;
} else {
wx.showToast({
title: '参数错误',
icon: 'none',
duration: 2000
});
// 2秒后返回上一页
setTimeout(() => {
wx.navigateBack();
}, 2000);
console.error('未找到商品ID');
return;
}
// 加载商品详情(即使已有goodsData,也调用API获取最新数据)
this.loadGoodsDetail(productId, goodsData);
},
// 加载商品详情
loadGoodsDetail(goodsId) {
wx.showLoading({
title: '加载中',
});
API.getProductDetail({ productId: goodsId })
loadGoodsDetail: function (productId, preloadedData = null) {
// 首先显示预加载的数据,确保UI快速响应
if (preloadedData) {
console.log('使用预加载数据显示UI');
}
API.getProductDetail({ productId: productId })
.then(res => {
console.log('获取商品详情成功:', res);
if (res && res.code === 200 && res.data) {
@ -153,6 +130,32 @@ Page({
const reservedGoodsIds = wx.getStorageSync('reservedGoodsIds') || [];
const product = res.data;
// 详细检查联系人相关字段 - 特别关注数据库字段名
console.log('===== 数据库字段名详细检查 =====');
console.log('- 数据库字段 product_contact:', product.product_contact, '(类型:', typeof product.product_contact, ')');
console.log('- 数据库字段 contact_phone:', product.contact_phone, '(类型:', typeof product.contact_phone, ')');
console.log('- 其他可能的字段:');
console.log(' - contactPhone:', product.contactPhone);
console.log(' - phone:', product.phone);
console.log(' - contact:', product.contact);
// 检查完整的API响应字段,确保不错过任何重要信息
console.log('API响应完整字段列表:', Object.keys(product).sort());
// 只过滤hidden状态的商品
if (product.status === 'hidden') {
wx.showToast({
title: '商品已下架',
icon: 'none',
duration: 2000
});
// 2秒后返回上一页
setTimeout(() => {
wx.navigateBack();
}, 2000);
return;
}
// 确保商品ID的一致性
const productIdStr = String(product.productId || product.id);
@ -176,18 +179,54 @@ Page({
} else if (supplyStatusValue === '三方未认证') {
supplyStatusValue = '预售';
}
// 关键修改:优先使用预加载数据中的联系人信息,如果有的话
let contactPhone = '';
let contactName = '';
let region = '';
// 首先检查预加载数据
if (preloadedData) {
contactPhone = preloadedData.contact_phone || preloadedData.contactPhone || preloadedData.phone || '';
contactName = preloadedData.product_contact || preloadedData.contact || preloadedData.contactName || '';
region = preloadedData.region || '';
console.log('从预加载数据获取联系人信息:', { contactName, contactPhone, region });
}
// 如果预加载数据中没有,则使用API返回的数据
if (!contactPhone) {
contactPhone = product.contact_phone !== null && product.contact_phone !== undefined ? product.contact_phone :
(product.contactPhone || product.phone || '暂无联系电话');
}
if (!contactName) {
contactName = product.product_contact !== null && product.product_contact !== undefined ? product.product_contact :
(product.contact || product.contactName || '联系人信息暂不可用');
}
if (!region && product.region) {
region = extractProvince(product.region);
}
// 如果region仍为空,尝试从预加载数据中提取
if (!region && preloadedData && preloadedData.region) {
region = extractProvince(preloadedData.region);
}
if (!region) region = '地区未知';
// 转换商品数据格式
const formattedGoods = {
id: productIdStr,
productId: productIdStr,
name: product.productName,
// 直接使用数据库字段名
name: product.productName || product.name || '商品名称',
price: product.price,
minOrder: product.minOrder || product.quantity,
yolk: product.yolk,
spec: product.spec || product.specification,
region: extractProvince(product.region),
contact_phone: product.contact_phone || product.contactPhone,
product_contact: product.product_contact || product.contactName,
spec: product.spec || product.specification || '暂无规格',
region: region,
// 直接使用数据库字段名,确保与表结构完全一致
product_contact: contactName,
contact_phone: contactPhone,
// 保留原始字段引用,确保数据完整性
imageUrls: product.imageUrls || product.images || [],
displayGrossWeight: formatGrossWeight(grossWeightValue, product.weight),
isReserved: reservedGoodsIds.some(itemId => String(itemId) === productIdStr),
@ -197,9 +236,19 @@ Page({
status: product.status,
supplyStatus: supplyStatusValue,
sourceType: product.sourceType || '',
sourceTypeColor: getSourceTypeColor(product.sourceType)
sourceTypeColor: getSourceTypeColor(product.sourceType),
// 复制原始产品对象中的所有字段,确保不丢失任何数据
...product,
// 合并预加载数据中的字段,优先使用预加载数据中的联系人信息
...(preloadedData || {})
};
console.log('最终格式化后的数据:', {
product_contact: formattedGoods.product_contact,
contact_phone: formattedGoods.contact_phone,
region: formattedGoods.region
});
this.setData({
goodsDetail: formattedGoods
});
@ -444,7 +493,7 @@ Page({
// 获取已预约商品ID列表
let reservedGoodsIds = wx.getStorageSync('reservedGoodsIds') || [];
// 检查是否已经预约过
if (reservedGoodsIds.some(itemId => String(itemId) === String(id))) {
wx.showToast({
@ -458,7 +507,7 @@ Page({
// 添加到已预约列表
reservedGoodsIds.push(id);
wx.setStorageSync('reservedGoodsIds', reservedGoodsIds);
// 更新页面状态
this.setData({
'goodsDetail.isReserved': true
@ -495,4 +544,4 @@ Page({
goBack() {
wx.navigateBack();
}
});
});

4
pages/goods-detail/goods-detail.wxml

@ -106,7 +106,7 @@
</view>
<!-- 联系信息 -->
<view class="contact-info" wx:if="{{goodsDetail.status === 'published'}}">
<view class="contact-info">
<text class="contact-label">联系信息</text>
<view class="contact-content">
<view class="contact-item">
@ -126,7 +126,7 @@
</view>
<!-- 操作按钮区域 -->
<view class="action-buttons" wx:if="{{goodsDetail.status === 'published'}}">
<view class="action-buttons" wx:if="{{!fromSeller}}">
<button
class="call-button bottom-button"
bindtap="makePhoneCall"

2
pages/index/index.wxml

@ -1,5 +1,4 @@
<view class="container">
<view class="title">中国最专业的鸡蛋现货交易平台</view>
<!-- 滚动图片区域 -->
<view class="swiper-container">
<swiper indicator-dots="{{true}}" autoplay="{{true}}" interval="3000" duration="1000" circular="{{true}}" style="width: 100%; height: 300rpx;">
@ -19,6 +18,7 @@
</view>
</view>
<!-- 按钮区域 -->
<view class="title">"中国最专业的鸡蛋现货交易平台"</view>
<view class="buttons-section">
<!-- 第一行 -->
<view class="btn-row">

60
pages/settlement/index.js

@ -38,9 +38,15 @@ Page({
// 登录弹窗相关
showAuthModal: false,
showOneKeyLoginModal: false,
// 合作模式帮助弹窗
showCooperationHelp: false,
selectedCooperationDetail: null,
loginModalTitle: '请先登录',
loginModalContent: '为了您的账户安全,请先完成手机号登录',
showLoginButton: true
showLoginButton: true,
// 合作模式帮助弹窗
showCooperationHelp: false
},
onLoad(options) {
@ -1453,5 +1459,57 @@ Page({
} catch (error) {
console.error('同步入驻状态失败:', error);
}
},
/**
* 显示合作模式帮助弹窗
*/
showCooperationHelp() {
this.setData({
showCooperationHelp: true,
selectedCooperationDetail: null
});
},
/**
* 显示合作模式详情
*/
showCooperationDetail(e) {
const type = e.currentTarget.dataset.type;
const cooperationDetails = {
'货源委托': {
title: '货源委托',
content: '货源委托是指供应商将货源委托给平台销售,平台负责销售和结算,供应商无需自行销售,只需要按照约定时间、数量、质量标准提供货源即可。'
},
'自主定价销售': {
title: '自主定价销售',
content: '供应商可以自主制定销售价格,自行负责销售和盈亏,平台提供交易撮合服务,按约定收取服务费。'
},
'区域包场合作': {
title: '区域包场合作',
content: '在指定区域内独家合作,享受区域保护政策,平台提供区域内的独家销售权限和支持。'
},
'其他': {
title: '其他合作模式',
content: '其他特殊合作模式,需与平台单独协商具体合作条款和条件。'
}
};
this.setData({
selectedCooperationDetail: cooperationDetails[type] || {
title: type,
content: '暂无详细说明'
}
});
},
/**
* 关闭合作模式帮助弹窗
*/
closeCooperationHelp() {
this.setData({
showCooperationHelp: false,
selectedCooperationDetail: null
});
}
});

21
pages/settlement/index.wxml

@ -142,6 +142,7 @@
<view class="form-item">
<view class="form-header">
<text class="form-label required">合作模式</text>
<view class="tip-button" bindtap="showCooperationHelp">?</view>
</view>
<view class="cooperation-options">
<view
@ -363,4 +364,24 @@
<button class="auth-cancel-button" bindtap="closeOneKeyLoginModal">取消</button>
</view>
</view>
</view>
<!-- 合作模式帮助弹窗 -->
<view wx:if="{{showCooperationHelp}}" class="cooperation-help-overlay">
<view class="cooperation-help-container">
<view class="cooperation-help-title">合作模式说明</view>
<view class="cooperation-help-content">
<view class="cooperation-buttons">
<button class="cooperation-button" bindtap="showCooperationDetail" data-type="货源委托">货源委托</button>
<button class="cooperation-button" bindtap="showCooperationDetail" data-type="自主定价销售">自主定价销售</button>
<button class="cooperation-button" bindtap="showCooperationDetail" data-type="区域包场合作">区域包场合作</button>
<button class="cooperation-button" bindtap="showCooperationDetail" data-type="其他">其他</button>
</view>
<view class="cooperation-detail" wx:if="{{selectedCooperationDetail}}">
<view class="detail-title">{{selectedCooperationDetail.title}}</view>
<view class="detail-content">{{selectedCooperationDetail.content}}</view>
</view>
</view>
<button class="cooperation-help-button" bindtap="closeCooperationHelp">关闭</button>
</view>
</view>

222
pages/settlement/index.wxss

@ -837,8 +837,226 @@ picker {
font-size: 28rpx;
color: #000;
font-weight: 400;
line-height: 1.3;
pointer-events: none;
}
/* 问号帮助按钮样式 */
.tip-button {
width: 36rpx;
height: 36rpx;
border-radius: 50%;
border: 2rpx solid #999;
background-color: #fff;
color: #999;
font-size: 24rpx;
font-weight: bold;
display: flex;
align-items: center;
justify-content: center;
margin-left: 10rpx;
cursor: pointer;
user-select: none;
transition: all 0.2s ease;
}
.tip-button:active {
transform: scale(0.9);
background-color: #f0f0f0;
}
/* 合作模式帮助弹窗样式 */
.cooperation-help-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.6);
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
padding: 20rpx;
}
.cooperation-help-container {
background-color: #fff;
border-radius: 20rpx;
padding: 50rpx 40rpx;
max-width: 92%;
max-height: 88%;
overflow-y: auto;
box-shadow: 0 12rpx 40rpx rgba(0, 0, 0, 0.2);
background: linear-gradient(to bottom, #ffffff, #f8f9fa);
}
/* 自定义滚动条样式 */
.cooperation-help-container::-webkit-scrollbar {
width: 8rpx;
height: 8rpx;
}
.cooperation-help-container::-webkit-scrollbar-track {
background: #f5f5f5;
border-radius: 4rpx;
}
.cooperation-help-container::-webkit-scrollbar-thumb {
background: #d0d0d0;
border-radius: 4rpx;
}
.cooperation-help-container::-webkit-scrollbar-thumb:hover {
background: #b8b8b8;
}
.cooperation-help-title {
font-size: 38rpx;
font-weight: bold;
color: #2c3e50;
margin-bottom: 40rpx;
text-align: center;
padding-bottom: 25rpx;
border-bottom: 2rpx solid #e8f5e8;
letter-spacing: 2rpx;
}
.cooperation-help-content {
font-size: 30rpx;
color: #555555;
line-height: 56rpx;
margin-bottom: 50rpx;
}
/* 一级标题样式 */
.cooperation-help-content h3 {
font-size: 34rpx;
font-weight: 700;
color: #2c3e50;
margin: 50rpx 0 25rpx 0;
padding-left: 15rpx;
border-left: 8rpx solid #07C160;
background-color: #f0f9f0;
padding: 15rpx 20rpx;
border-radius: 8rpx;
letter-spacing: 1rpx;
}
/* 二级标题样式 */
.cooperation-help-content h4 {
font-size: 32rpx;
font-weight: 600;
color: #34495e;
margin: 40rpx 0 20rpx 0;
padding-left: 20rpx;
background-color: #f8f9fa;
padding: 12rpx 20rpx;
border-radius: 6rpx;
}
/* 段落样式 */
.cooperation-help-content p {
margin: 25rpx 0;
text-indent: 2em;
color: #666666;
padding: 0 10rpx;
text-align: justify;
word-break: break-word;
}
/* 列表样式优化 */
.cooperation-help-content ul, .cooperation-help-content ol {
margin: 25rpx 0 25rpx 60rpx;
}
.cooperation-help-content li {
margin: 20rpx 0;
color: #666666;
line-height: 52rpx;
text-indent: 0;
}
/* 列表项数字/符号样式 */
.cooperation-help-content ol li {
font-weight: 500;
color: #495057;
}
.cooperation-buttons {
display: flex;
flex-direction: column;
gap: 20rpx;
margin-bottom: 30rpx;
}
.cooperation-button {
width: 100%;
padding: 24rpx;
background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
color: #333;
border: 2rpx solid rgba(7, 193, 96, 0.2);
border-radius: 12rpx;
font-size: 30rpx;
font-weight: 500;
transition: all 0.3s ease;
cursor: pointer;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
display: flex;
justify-content: center;
align-items: center;
}
.cooperation-button:active {
transform: scale(0.98);
background: linear-gradient(135deg, #07C160 0%, #06ae56 100%);
color: white;
border-color: #07C160;
}
.cooperation-detail {
margin-top: 20rpx;
padding: 24rpx;
background: linear-gradient(135deg, #f0fff4 0%, #e6ffe9 100%);
border-radius: 12rpx;
border: 2rpx solid #c6f6d5;
}
.detail-title {
font-size: 32rpx;
font-weight: 700;
color: #07C160;
margin-bottom: 16rpx;
text-align: center;
}
.detail-content {
font-size: 28rpx;
color: #4a5568;
line-height: 1.6;
text-align: center;
white-space: pre-line;
}
/* 按钮样式优化 */
.cooperation-help-button {
width: 100%;
height: 92rpx;
background: linear-gradient(135deg, #07C160 0%, #06b358 100%);
color: #fff;
border: none;
border-radius: 46rpx;
font-size: 36rpx;
font-weight: bold;
cursor: pointer;
transition: all 0.3s ease;
margin-top: 30rpx;
box-shadow: 0 6rpx 20rpx rgba(7, 193, 96, 0.3);
letter-spacing: 2rpx;
}
.cooperation-help-button:active {
transform: scale(0.96);
box-shadow: 0 3rpx 12rpx rgba(7, 193, 96, 0.4);
background: linear-gradient(135deg, #06b358 0%, #05a050 100%);
}
.cooperation-option.active .cooperation-text {

Loading…
Cancel
Save