Browse Source

修改入驻流程逻辑和减少下架状态货源空白页

pull/1/head
徐飞洋 3 months ago
parent
commit
c83364b43b
  1. 45
      pages/seller/index.js
  2. 20
      pages/seller/index.wxml
  3. 4
      pages/seller/index.wxss
  4. 105
      pages/settlement/index.js

45
pages/seller/index.js

@ -46,6 +46,8 @@ Page({
grossWeight: '', // 【新增】毛重字段,支持中文 grossWeight: '', // 【新增】毛重字段,支持中文
imageUrls: [] // 图片URL数组,支持多张图片 imageUrls: [] // 图片URL数组,支持多张图片
}, },
newSupplyRegionArray: [], // 新创建货源的省市区数组
editSupplyRegionArray: [], // 编辑货源的省市区数组,
editSupply: { editSupply: {
yolkIndex: 0, yolkIndex: 0,
specIndex: 0 specIndex: 0
@ -1316,6 +1318,37 @@ Page({
}) })
}, },
// 新创建货源地区选择处理
onNewSupplyRegionChange(e) {
const regionArray = e.detail.value
const region = regionArray.join(' ')
this.setData({
newSupplyRegionArray: regionArray,
newSupply: {
...this.data.newSupply,
region: region
}
})
// 实时保存到本地存储
wx.setStorageSync('newSupplyDraft', this.data.newSupply);
},
// 编辑货源地区选择处理
onEditSupplyRegionChange(e) {
const regionArray = e.detail.value
const region = regionArray.join(' ')
this.setData({
editSupplyRegionArray: regionArray,
editSupply: {
...this.data.editSupply,
region: region
}
})
},
// 处理蛋黄选择变更 // 处理蛋黄选择变更
onYolkChange(e) { onYolkChange(e) {
const index = e.detail.value const index = e.detail.value
@ -2182,9 +2215,18 @@ Page({
specIndex: specIndex specIndex: specIndex
}; };
// 解析地区字符串为省市区数组,用于初始化三级下拉框
let editSupplyRegionArray = [];
if (supply.region) {
// 尝试将地区字符串拆分为省市区数组
// 假设地区格式为 "省份 城市 区县"
editSupplyRegionArray = supply.region.split(' ').filter(item => item.trim() !== '');
}
console.log('【调试】编辑弹窗数据设置:', { console.log('【调试】编辑弹窗数据设置:', {
supplyRegion: supply.region, supplyRegion: supply.region,
editSupplyRegion: supplyWithFormattedTime.region editSupplyRegion: supplyWithFormattedTime.region,
editSupplyRegionArray: editSupplyRegionArray
}); });
// 如果是上架操作,设置自动上架标志 // 如果是上架操作,设置自动上架标志
@ -2202,6 +2244,7 @@ Page({
this.setData({ this.setData({
editSupply: supplyWithFormattedTime, editSupply: supplyWithFormattedTime,
editSupplyRegionArray: editSupplyRegionArray,
showEditModal: true showEditModal: true
}); });

20
pages/seller/index.wxml

@ -538,7 +538,15 @@
<view style="font-size: 28rpx; font-weight: 500; color: #333; margin-bottom: 12rpx; margin-left: 10rpx;">地区</view> <view style="font-size: 28rpx; font-weight: 500; color: #333; margin-bottom: 12rpx; margin-left: 10rpx;">地区</view>
<input class="input" placeholder="请输入地区" bindinput="onInput" data-field="region" value="{{newSupply.region}}" 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> <picker
mode="region"
value="{{newSupplyRegionArray}}"
bindchange="onNewSupplyRegionChange"
class="region-picker input"
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>{{newSupply.region || '请选择省市区'}}</text>
</picker>
<view style="display: flex; justify-content: space-between; margin-top: 20rpx; margin-bottom: 20rpx; gap: 20rpx;"> <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="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>
@ -613,7 +621,15 @@
<view style="font-size: 28rpx; font-weight: 500; color: #333; margin-bottom: 12rpx; margin-left: 10rpx;">地区</view> <view style="font-size: 28rpx; font-weight: 500; color: #333; margin-bottom: 12rpx; margin-left: 10rpx;">地区</view>
<input class="input" placeholder="请输入地区" bindinput="onEditInput" data-field="region" value="{{editSupply.region}}" 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> <picker
mode="region"
value="{{editSupplyRegionArray}}"
bindchange="onEditSupplyRegionChange"
class="region-picker input"
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>{{editSupply.region || '请选择省市区'}}</text>
</picker>
<view style="display: flex; justify-content: space-between; margin-top: 20rpx; margin-bottom: 20rpx; gap: 20rpx;"> <view style="display: flex; justify-content: space-between; margin-top: 20rpx; margin-bottom: 20rpx; gap: 20rpx;">
<button bindtap="hideEditModal" 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="hideEditModal" 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>

4
pages/seller/index.wxss

@ -645,9 +645,9 @@ button {
text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.2); text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.2);
} }
/* 页空白页样式 */ /* 四分之一页空白页样式 */
.half-page-blank { .half-page-blank {
height: 50vh; height: 25vh;
background-color: transparent; background-color: transparent;
} }

105
pages/settlement/index.js

@ -183,22 +183,34 @@ Page({
await this.syncSettlementStatus(); await this.syncSettlementStatus();
// 根据入驻状态处理 // 根据入驻状态处理
if (this.data.partnerstatus === 'approved' || this.data.partnerstatus === 'underreview') { if (this.data.partnerstatus === 'approved') {
console.log('用户已入驻或审核中,直接进入相应页面'); console.log('用户已入驻成功,直接进入审核状态页面');
this.setData({
showGuidePage: false,
currentStep: 3 // 审核状态页面
});
} else if (this.data.partnerstatus === 'underreview') {
console.log('用户申请正在审核中,直接进入审核状态页面');
this.setData({ this.setData({
showGuidePage: false, showGuidePage: false,
currentStep: 3 // 审核状态页面 currentStep: 3 // 审核状态页面
}); });
} else { } else {
console.log('用户未入驻,正常进行入驻流程'); console.log('用户未入驻或审核失败,开始入驻流程');
this.setData({ this.setData({
showGuidePage: false showGuidePage: false,
currentStep: 0 // 进入第一步:选择身份
}); });
} }
} catch (error) { } catch (error) {
console.error('检查入驻状态时出错:', error); console.error('检查入驻状态时出错:', error);
// 出错时仍允许用户开始入驻流程
this.setData({
showGuidePage: false,
currentStep: 0 // 进入第一步:选择身份
});
wx.showToast({ wx.showToast({
title: '系统繁忙,请稍后再试', title: '获取状态失败,已进入入驻流程',
icon: 'none' icon: 'none'
}); });
} }
@ -1048,7 +1060,7 @@ Page({
}, },
// 重新提交备案 // 重新提交备案
async resubmitApplication() { resubmitApplication() {
try { try {
// 检查用户是否已登录 // 检查用户是否已登录
const openid = wx.getStorageSync('openid'); const openid = wx.getStorageSync('openid');
@ -1061,52 +1073,51 @@ Page({
return; // 取消重新提交申请 return; // 取消重新提交申请
} }
const API = require('../../utils/api.js'); // 更新本地状态
const applicationId = wx.getStorageSync('applicationId'); wx.setStorageSync('settlementStatus', '');
wx.removeStorageSync('applicationId');
if (!applicationId) {
wx.showToast({
title: '未找到申请记录',
icon: 'none'
});
return;
}
wx.showLoading({
title: '正在重新提交...',
mask: true
});
const result = await API.resubmitSettlementApplication(applicationId);
wx.hideLoading(); // 重置表单数据,让用户重新开始入驻流程
this.setData({
// 重置步骤
currentStep: 0,
partnerstatus: null,
showGuidePage: true,
if (result && result.success) { // 重置身份选择
// 更新本地状态 collaborationid: '',
wx.setStorageSync('settlementStatus', ''); showIdentityError: false,
// 让用户重新走一遍入驻流程,但保留初始填写的数据 // 重置基本信息
this.setData({ company: '',
currentStep: 0, // 重置为第一步,让用户重新填写 showCompanyNameError: false,
partnerstatus: null, // 将合作商状态设置为Null companyNameError: '',
showGuidePage: true // 显示引导页面 province: '',
}); city: '',
district: '',
detailedaddress: '',
showRegionError: false,
regionError: '',
cooperation: '',
showCooperationError: false,
cooperationError: '',
// 重置上传资料
businesslicenseurl: null,
proofurl: null,
// 重置审核相关
auditFailedReason: ''
});
wx.showToast({ wx.showToast({
title: '重新提交成功,请重新填写并提交申请', title: '已进入重新申请流程',
icon: 'success' icon: 'success'
}); });
} else {
wx.showToast({
title: result.message || '重新提交失败',
icon: 'none'
});
}
} catch (error) { } catch (error) {
wx.hideLoading(); console.error('重新开始申请失败:', error);
console.error('重新提交申请失败:', error);
wx.showToast({ wx.showToast({
title: '重新提交失败,请重试', title: '操作失败,请重试',
icon: 'none' icon: 'none'
}); });
} }
@ -1190,7 +1201,7 @@ Page({
console.log('已同步服务器入驻状态:', userData.partnerstatus); console.log('已同步服务器入驻状态:', userData.partnerstatus);
// 根据partnerstatus更新页面步骤 // 根据partnerstatus更新页面步骤
if (userData.partnerstatus === 'approved' || userData.partnerstatus === 'reviewfailed') { if (userData.partnerstatus === 'approved' || userData.partnerstatus === 'underreview' || userData.partnerstatus === 'reviewfailed') {
this.setData({ this.setData({
showGuidePage: false, showGuidePage: false,
currentStep: 3 currentStep: 3

Loading…
Cancel
Save