提交
This commit is contained in:
127
甲情_甲意/miniprogram/pages/shangmenyuyue/shangmenyuyue.js
Normal file
127
甲情_甲意/miniprogram/pages/shangmenyuyue/shangmenyuyue.js
Normal file
@ -0,0 +1,127 @@
|
||||
import {url} from '../request'
|
||||
Page({
|
||||
data: {
|
||||
selectedCity:'',
|
||||
xuanran:[],
|
||||
inputtext:'',
|
||||
},
|
||||
onShow(){
|
||||
this.chaxun();
|
||||
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: '定位失败'
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
chaxun(){
|
||||
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({
|
||||
xuanran: res.data.data, // 更新 tuijian 列表
|
||||
});
|
||||
console.log(this.data.xuanran,'askjdsakldlasjdl');
|
||||
} else {
|
||||
console.log('shibaile')
|
||||
}
|
||||
},
|
||||
fail: (error) => {
|
||||
console.error('Request failed', error);
|
||||
}
|
||||
});
|
||||
},
|
||||
onConfirm(){
|
||||
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({
|
||||
xuanran:res.data.data.records
|
||||
})
|
||||
} 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
|
||||
|
||||
console.log('Address being passed: ', ID,address,businessName,businessAvatar,endBusiness,startBusiness,businessPhone);
|
||||
|
||||
my.navigateTo({
|
||||
url: `/pages/shnagmendianpu/shnagmendianpu?userId=${userId}
|
||||
&&address=${address}&&businessName=${businessName}
|
||||
&&businessAvatar=${businessAvatar}&&startBusiness=${startBusiness}
|
||||
&&endBusiness=${endBusiness}&&storeStatus=${storeStatus}
|
||||
&&id=${ID}&&businessPhone=${businessPhone}`,
|
||||
});
|
||||
},
|
||||
onChange(e) {
|
||||
this.setData({
|
||||
inputtext:e.detail.value,
|
||||
});
|
||||
console.log(e.detail.value);
|
||||
console.log(this.data.inputtext);
|
||||
},
|
||||
|
||||
|
||||
});
|
Reference in New Issue
Block a user