2024-11-10 07:01:22 +00:00
|
|
|
import {url} from '../request'
|
|
|
|
Page({
|
|
|
|
data: {
|
|
|
|
sousuo:[],
|
|
|
|
address: "",
|
|
|
|
businessAvatar: "",
|
|
|
|
businessImages: "",
|
|
|
|
businessName: "",
|
|
|
|
businessPhone: "",
|
|
|
|
businessProfile: "",
|
|
|
|
categoryId: 0,
|
|
|
|
createTime: "",
|
|
|
|
endBusiness: "",
|
|
|
|
id: 0,
|
|
|
|
isDelete: 0,
|
|
|
|
startBusiness: "",
|
|
|
|
state: 0,
|
|
|
|
storeStatus: '',
|
|
|
|
updateTime: "",
|
2024-12-17 11:46:10 +00:00
|
|
|
userId: 0,
|
|
|
|
inputtext:'',
|
|
|
|
selectedCity:'',
|
|
|
|
},
|
|
|
|
inputchange(e){
|
|
|
|
this.setData({
|
|
|
|
inputtext:e.detail.value,
|
|
|
|
});
|
|
|
|
console.log(e.detail.value);
|
|
|
|
console.log(this.data.inputtext);
|
2024-11-10 07:01:22 +00:00
|
|
|
},
|
|
|
|
onLoad() {
|
2024-12-17 11:46:10 +00:00
|
|
|
this.localcation();
|
2024-11-10 07:01:22 +00:00
|
|
|
my.request({
|
2025-01-21 13:56:53 +00:00
|
|
|
url: url + '/api/business/listLv',
|
2024-11-10 07:01:22 +00:00
|
|
|
method: 'POST',
|
|
|
|
data: {
|
|
|
|
|
|
|
|
},
|
|
|
|
headers: {
|
|
|
|
'content-type': 'application/json',
|
|
|
|
},
|
|
|
|
dataType: 'json',
|
|
|
|
success: (res) => {
|
|
|
|
console.log('Request succeeded:', res);
|
|
|
|
if (res.data && res.data.data) {
|
|
|
|
this.setData({
|
|
|
|
sousuo: res.data.data, // 更新 tuijian 列表
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
console.log('shibaile')
|
|
|
|
}
|
|
|
|
},
|
|
|
|
fail: (error) => {
|
|
|
|
console.error('Request failed', error);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
2024-12-17 11:46:10 +00:00
|
|
|
dianpu(item) {
|
2024-11-15 03:51:28 +00:00
|
|
|
const id = item.target.dataset.num
|
2024-12-17 11:46:10 +00:00
|
|
|
// console.log('传递的数据:', id);
|
2024-11-15 03:51:28 +00:00
|
|
|
const ID = id.id
|
2024-12-17 11:46:10 +00:00
|
|
|
console.log(ID);
|
2024-11-15 03:51:28 +00:00
|
|
|
const userId = id.userId
|
|
|
|
const address = id.address
|
|
|
|
const businessName = id.businessName
|
|
|
|
const businessAvatar = id.businessAvatar
|
|
|
|
const endBusiness = id.endBusiness
|
|
|
|
const startBusiness = id.startBusiness
|
|
|
|
const storeStatus = id.storeStatus
|
2024-12-17 11:46:10 +00:00
|
|
|
const businessPhone =id.businessPhone
|
2025-01-21 13:56:53 +00:00
|
|
|
const level = id.level
|
|
|
|
console.log('Address being passed: ', level,ID,address,businessName,businessAvatar,endBusiness,startBusiness,businessPhone);
|
2024-11-15 03:51:28 +00:00
|
|
|
|
2024-11-10 07:01:22 +00:00
|
|
|
my.navigateTo({
|
2025-01-21 13:56:53 +00:00
|
|
|
url: `/pages/dianpuzhuye/dianpuzhuye?userId=${userId}
|
|
|
|
&&address=${address}&&businessName=${businessName}
|
|
|
|
&&businessAvatar=${businessAvatar}
|
|
|
|
&&startBusiness=${startBusiness}
|
|
|
|
&&endBusiness=${endBusiness}&&storeStatus=${storeStatus}
|
|
|
|
&&id=${ID}&&businessPhone=${businessPhone}&&level=${level}`,
|
2024-12-17 11:46:10 +00:00
|
|
|
});
|
|
|
|
},
|
|
|
|
find(){
|
|
|
|
my.request({
|
|
|
|
url: url + '/api/business/list/page/vo',
|
|
|
|
method: 'POST',
|
|
|
|
data: {
|
|
|
|
address: this.data.selectedCity,
|
|
|
|
businessName: this.data.inputtext,
|
|
|
|
businessProfile: "",
|
|
|
|
categoryId: "",
|
|
|
|
current: 1,
|
|
|
|
id: "",
|
|
|
|
pageSize: 20,
|
|
|
|
sortField: "",
|
|
|
|
sortOrder: "",
|
|
|
|
state: "",
|
|
|
|
storeStatus: "",
|
|
|
|
userId: ""
|
|
|
|
},
|
|
|
|
headers: {
|
|
|
|
'content-type': 'application/json',
|
|
|
|
},
|
|
|
|
dataType: 'json',
|
|
|
|
success: (res) => {
|
|
|
|
console.log('Request succeeded:', res);
|
|
|
|
if (res.data && res.data.data) {
|
|
|
|
this.setData({
|
|
|
|
sousuo:res.data.data.records
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
console.log('shibaile')
|
|
|
|
}
|
|
|
|
},
|
|
|
|
fail: (error) => {
|
|
|
|
console.error('Request failed', error);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
localcation(){
|
|
|
|
my.getLocation({
|
|
|
|
type: 1, // 获取包括省市区县数据
|
|
|
|
success: (res) => {
|
|
|
|
console.log('定位成功:', res);
|
|
|
|
this.setData({
|
|
|
|
selectedCity: res.city // 将城市名称设置到 selectedCity
|
|
|
|
});
|
|
|
|
},
|
|
|
|
fail: (error) => {
|
|
|
|
console.error('定位失败:', error);
|
|
|
|
my.alert({
|
|
|
|
title: '定位失败',
|
|
|
|
content: '无法获取当前位置,请检查定位权限设置。'
|
|
|
|
});
|
|
|
|
this.setData({
|
|
|
|
selectedCity: '定位失败'
|
|
|
|
});
|
|
|
|
}
|
2024-11-15 03:51:28 +00:00
|
|
|
});
|
2024-11-10 07:01:22 +00:00
|
|
|
}
|
|
|
|
});
|