提交
This commit is contained in:
141
甲情_甲意/miniprogram/pages/daodianfuwu/daodianfuwu.js
Normal file
141
甲情_甲意/miniprogram/pages/daodianfuwu/daodianfuwu.js
Normal file
@ -0,0 +1,141 @@
|
||||
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: "",
|
||||
userId: 0,
|
||||
inputtext:'',
|
||||
selectedCity:'',
|
||||
},
|
||||
inputchange(e){
|
||||
this.setData({
|
||||
inputtext:e.detail.value,
|
||||
});
|
||||
console.log(e.detail.value);
|
||||
console.log(this.data.inputtext);
|
||||
},
|
||||
onLoad() {
|
||||
this.localcation();
|
||||
my.request({
|
||||
url: url + '/api/business/list',
|
||||
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);
|
||||
}
|
||||
});
|
||||
},
|
||||
dianpu(item) {
|
||||
const id = item.target.dataset.num
|
||||
console.log('传递的数据:', id);
|
||||
const ID = id.business.id
|
||||
console.log(ID);
|
||||
const userId = id.business.userId
|
||||
const address = id.business.address
|
||||
const businessName = id.business.businessName
|
||||
const businessAvatar = id.business.businessAvatar
|
||||
const endBusiness = id.business.endBusiness
|
||||
const startBusiness = id.business.startBusiness
|
||||
const storeStatus = id.business.storeStatus
|
||||
const businessPhone =id.business.businessPhone
|
||||
// const level = id.business.level
|
||||
console.log('Address being passed: ', ID,address,businessName,businessAvatar,endBusiness,startBusiness,businessPhone);
|
||||
|
||||
my.navigateTo({
|
||||
url: `/pages/dianpuzhuye/dianpuzhuye?userId=${userId}
|
||||
&&address=${address}&&businessName=${businessName}
|
||||
&&businessAvatar=${businessAvatar}
|
||||
&&startBusiness=${startBusiness}
|
||||
&&endBusiness=${endBusiness}&&storeStatus=${storeStatus}
|
||||
&&id=${ID}&&businessPhone=${businessPhone}`,
|
||||
});
|
||||
},
|
||||
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: '定位失败'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user