|
|
@ -1165,6 +1165,10 @@ Page({ |
|
|
try { |
|
|
try { |
|
|
const res = await API.uploadUserInfo(uploadData) |
|
|
const res = await API.uploadUserInfo(uploadData) |
|
|
console.log('用户信息上传成功:', res) |
|
|
console.log('用户信息上传成功:', res) |
|
|
|
|
|
|
|
|
|
|
|
// 入驻成功后,将用户类型设置为seller
|
|
|
|
|
|
API.updateUserType('seller'); |
|
|
|
|
|
|
|
|
return res |
|
|
return res |
|
|
} catch (err) { |
|
|
} catch (err) { |
|
|
console.error('用户信息上传失败:', err) |
|
|
console.error('用户信息上传失败:', err) |
|
|
@ -1207,10 +1211,12 @@ Page({ |
|
|
wx.switchTab({ url: '/pages/buyer/index' }) |
|
|
wx.switchTab({ url: '/pages/buyer/index' }) |
|
|
} else { |
|
|
} else { |
|
|
// 卖家登录成功后,重新显示创建货源弹窗
|
|
|
// 卖家登录成功后,重新显示创建货源弹窗
|
|
|
|
|
|
// 从本地存储加载保存的表单数据
|
|
|
|
|
|
const savedSupply = wx.getStorageSync('newSupplyDraft') || { name: '', price: '', minOrder: '', yolk: '', spec: '', imageUrls: [] }; |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
showImagePreview: false, |
|
|
showImagePreview: false, |
|
|
showModal: true, |
|
|
showModal: true, |
|
|
newSupply: { name: '', price: '', minOrder: '', yolk: '', spec: '', imageUrls: [] } |
|
|
newSupply: savedSupply |
|
|
}); |
|
|
}); |
|
|
this.disablePageScroll(); |
|
|
this.disablePageScroll(); |
|
|
} |
|
|
} |
|
|
@ -1397,6 +1403,8 @@ Page({ |
|
|
|
|
|
|
|
|
if (!userId || !openid || !userInfo) { |
|
|
if (!userId || !openid || !userInfo) { |
|
|
console.log('用户未登录,显示登录提示'); |
|
|
console.log('用户未登录,显示登录提示'); |
|
|
|
|
|
// 登录前保存当前表单数据到本地存储
|
|
|
|
|
|
wx.setStorageSync('newSupplyDraft', this.data.newSupply); |
|
|
// 用户未登录,显示未授权提示弹窗
|
|
|
// 用户未登录,显示未授权提示弹窗
|
|
|
wx.showModal({ |
|
|
wx.showModal({ |
|
|
title: '登录提示', |
|
|
title: '登录提示', |
|
|
@ -2895,6 +2903,29 @@ Page({ |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 双击检测变量
|
|
|
|
|
|
lastTapTime: {}, |
|
|
|
|
|
tapCount: {}, |
|
|
|
|
|
|
|
|
|
|
|
// 通用双击检测函数
|
|
|
|
|
|
handleDoubleTap: function(e, type, callback) { |
|
|
|
|
|
const currentTime = Date.now(); |
|
|
|
|
|
const tapKey = `${type}-${e.currentTarget.dataset.index}`; |
|
|
|
|
|
const lastTap = this.lastTapTime[tapKey] || 0; |
|
|
|
|
|
const tapInterval = currentTime - lastTap; |
|
|
|
|
|
|
|
|
|
|
|
if (tapInterval < 300 && tapInterval > 0) { |
|
|
|
|
|
// 双击事件触发,执行确认选择
|
|
|
|
|
|
callback(); |
|
|
|
|
|
} else { |
|
|
|
|
|
// 单击事件触发,执行选择操作
|
|
|
|
|
|
this.lastTapTime[tapKey] = currentTime; |
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
delete this.lastTapTime[tapKey]; |
|
|
|
|
|
}, 300); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
// 弹窗中选择规格
|
|
|
// 弹窗中选择规格
|
|
|
onModalSpecSelect: function (e) { |
|
|
onModalSpecSelect: function (e) { |
|
|
const index = e.currentTarget.dataset.index; |
|
|
const index = e.currentTarget.dataset.index; |
|
|
@ -2903,6 +2934,11 @@ Page({ |
|
|
selectedModalSpecIndex: index, |
|
|
selectedModalSpecIndex: index, |
|
|
modalSpecSearchKeyword: selectedSpec // 自动填充搜索框为当前选择的规格
|
|
|
modalSpecSearchKeyword: selectedSpec // 自动填充搜索框为当前选择的规格
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 检测双击
|
|
|
|
|
|
this.handleDoubleTap(e, 'spec', () => { |
|
|
|
|
|
this.confirmSpecSelection(); |
|
|
|
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 确认规格选择
|
|
|
// 确认规格选择
|
|
|
@ -3393,6 +3429,11 @@ Page({ |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
selectedNameIndex: index |
|
|
selectedNameIndex: index |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 检测双击
|
|
|
|
|
|
this.handleDoubleTap(e, 'name', () => { |
|
|
|
|
|
this.confirmNameSelection(); |
|
|
|
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
confirmNameSelection() { |
|
|
confirmNameSelection() { |
|
|
@ -3469,6 +3510,11 @@ Page({ |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
selectedYolkIndex: index |
|
|
selectedYolkIndex: index |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 检测双击
|
|
|
|
|
|
this.handleDoubleTap(e, 'yolk', () => { |
|
|
|
|
|
this.confirmYolkSelection(); |
|
|
|
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
confirmYolkSelection() { |
|
|
confirmYolkSelection() { |
|
|
|