import {url} from '../request';
Page({
  data: {
    background: [
      {image:"../image/meijia1.jpg"},
      {image:"../image/meijia2.jpg"}
    ],
    indicatorDots: true,
    autoplay: true,
    vertical: false,
    interval: 1000,
    circular: false,
    duration: 1500,
    tuijian:[],
    address: "",
		businessAvatar: "",
		businessImages: "",
		businessName: "",
		businessPhone: "",
		businessProfile: "",
		categoryId: 0,
		createTime: "",
		endBusiness: "",
		id: 0,
		isDelete: 0,
		startBusiness: "",
		state: 0,
		storeStatus: '',
		updateTime: "",
		userId: 0
    }, 
    onLoad() {
      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({
              tuijian: 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.id
      console.log(ID);
      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
      const businessPhone =id.businessPhone
      console.log('Address being passed: ', ID,address,businessName,businessAvatar,endBusiness,startBusiness,businessPhone); 
      
      my.navigateTo({
        url: `/pages/test/test?userId=${userId}&&address=${address}&&businessName=${businessName}&&businessAvatar=${businessAvatar}&&startBusiness=${startBusiness}&&endBusiness=${endBusiness}&&storeStatus=${storeStatus}&&id=${ID}&&businessPhone=${businessPhone}`,
      });
    },
    shangmen(){
      my.navigateTo({
        url:'/pages/shangmenyuyue/shangmenyuyue'
      })
    },
    daodian(){
      my.navigateTo({
        url:'/pages/daodianfuwu/daodianfuwu'
      })
    },
    qiangdan(){
      my.navigateTo({
        url:'/pages/kehushangmenyuyueqiangdan/kehushangmenyuyueqiangdan'
      })
    },
    yuyue(){
      my.navigateTo({
        url:'/pages/wodeyuyue/wodeyuyue'
      })
    }
    
  })
