addressdetail.js 3.2 KB

/*获取*/
//$(document).ready(function(){
/* 在地址栏获取参数 */

var storeid=GetQueryString("id");
console.log(storeid);

new Vue({
	el: '#addressdetail',
	data: {
		//详细地址
		//adddressdetail:{
		//	distance_text:"",
		//	open_start:"",
		//	open_end:"",
		//	store_address:"",
		//	store_name:""
        //
		//},
		addressdetail:[],
		address:{
			store_name:'',
			store_address:'',
			distance_text:'',
			open_start:'',
			open_end:''
		},
		photo:''
	},
	created: function() {
		this.details();
		//this.addresstail();
		//this.addressinfo();
//		this.store();
//		this.attribute();

//		this.change();


	},

	methods: {
		//获取信息
		details: function() {
			var that = this;

			var url = '/Store/storeList';
			var params = {
				unique_id: localStorage.getItem('unique_id')
			};
			ajaxsend(url, params, function(res) {
				/*console.log(JSON.stringify(res))*/

				console.log(res);
				var data=res.data;
				var addressdet=[];
				for(var i=0;i<data.length;i++){
					console.log(data[i].store_id);
					if(data[i].store_id==storeid){
						console.log(data[i]);
						addressdet.push(data[i]);
						that.address.store_name=data[i].store_name;
						that.address.open_start=data[i].open_start;
						that.address.open_end=data[i].open_end;
						that.address.store_address=data[i].store_address;
						that.address.distance_text=data[i].distance_text;
						console.log(addressdet);
						that.addressdetail=addressdet;
						console.log(that.addressdetail);
						that.addressinfo();
						//that.addressdetail=data[i];
						//console.log(that.adddressdetail);
						//that.adddressdetail.istance_text=data[i].distance_text;
						//console.log(that.adddressdetail.distance_text);
						//var url = '/Store/addressdetail';
						//var params = {
						//	distance_text:that.adddressdetail.distance_text,
						//	open_start:that.adddressdetail.open_start,
						//	open_end:that.adddressdetail.open_end,
						//	store_address:that.adddressdetail.store_address,
						//	store_name:that.adddressdetail.store_name,
						//	store_id:addressid
                        //
						//};
					//	ajaxsend(url, params, function(res) {
					//	/*console.log(JSON.stringify(res))*/
					//	console.log(res);
                    //
                    //
					//})
					}

				}

			})


		},
		addressinfo(){
			var that = this;
			var info=that.addressdetail;
			console.log(info);
			var store_name=info[0].store_name;
			var	open_start=info[0].open_start;
			var open_end=info[0].open_end;
			var	store_address=info[0].store_address;
		    var	distance_text=info[0].distance_text;
			//console.log(store_name);
			//console.log(open_start);
			//console.log(open_end);
			//console.log(store_address);
			//console.log(distance_text)
			var url = '/Store/storeDetail';
			var params = {
				store_id:storeid,
				store_name:that.addressdetail.store_name,
				open_start:that.addressdetail.open_start,
				open_end:that.addressdetail.open_end,
				store_address:that.addressdetail.store_address,
				distance_text:that.addressdetail.distance_text,
			}
			ajaxsend(url, params, function(res) {
				/*console.log(JSON.stringify(res))*/
				console.log(res);
				var photo=JSON.stringify(res.data.photo)
				that.photo=photo;

			})

		}


	}

})

//});