| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 | const _Http = getApp().globalData.http;Page({	data: {		brand: {}, //当前品牌		brandList: [], //品牌列表		typeList: [],		cType: {},		loading: true,		"content": {			"pageNumber": 1,			"pageTotal": 1,			"where": {				"condition": ""			},			sort: []		},		filter: [{			label: "标准",			index: null,			showName: "value", //显示字段			valueKey: "name", //返回Key			selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象			value: "", //选中值			list: []		}]	},	onLoad(options) {		this.getBrand()		this.getNum();		this.getOptionTypeSelect();	},	/* 获取系统分类 */	getOptionTypeSelect() {		_Http.basic({			"classname": "sysmanage.develop.optiontype.optiontype",			"method": "optiontypeselect",			"content": {				"pageNumber": 1,				"pageSize": 999,				"typename": "itemstandards",				"parameter": {					"siteid": wx.getStorageSync('userMsg').siteid				}			}		}, false).then(res => {			console.log("系统标准列表", res)			if (res.msg == '成功') this.setData({				"filter[0].list": res.data			})		})	},	/* 处理筛选 */	handleFilter({detail}){		console.log(detail)	},	/* 切换分类 */	typeChange({		detail	}) {		let typeList = this.data.typeList;		if (typeList.length - 1 != detail.rowIndex) typeList = typeList.slice(0, detail.rowIndex + 1);		typeList[detail.rowIndex].active = detail.index		if (detail.item.subdep.length) typeList.push({			active: -1,			list: detail.item.subdep		})		this.setData({			cType: detail.item,			typeList		});		this.getList(true);	},	/* 获取品牌 */	getBrand() {		_Http.basic({			"id": 20220924163702,			"content": {				"pageSize": 999,			}		}).then(res => {			console.log("查询品牌", res)			if (res.data.length) this.setData({				brandList: res.data,				brand: res.data[0],			});			this.getTypeList();		})	},	/* 获取分类 */	getTypeList() {		_Http.basic({			"id": "20220922110403",			"content": {				"sa_brandid": this.data.brand.sa_brandid			}		}).then(res => {			console.log("营销类别", res)			if (res.data[0].ttemclass) this.setData({				['typeList[0]']: {					active: 0,					list: res.data[0].ttemclass				},				"cType": res.data[0].ttemclass[0]			});			this.getList(true);		})	},	/* 获取产品 */	getList(init = false) {		if (init.detail != undefined) init = init.detail;		let content = this.data.content;		if (init) content.pageNumber = 1;		if (content.pageNumber > content.pageTotal) return;		content.brandids = [this.data.brand.sa_brandid];		content.where.itemclassid = this.data.cType.itemclassid;		_Http.basic({			"id": 20220926142203,			content		}).then(res => {			console.log("商品列表", res)			this.selectComponent('#ListBox').RefreshToComplete();			this.setData({				list: res.data,				"content.pageNumber": res.pageNumber + 1,				"content.pageTotal": res.pageTotal,				"content.sort": res.sort,				loading: false			})			this.setListHeight()		})	},	startFiltration() {		/* _Http.basic().then(res => {			console.log("获取领域", res)		}) */	},	/* 搜索 */	onSearch({		detail	}) {		this.setData({			"content.where.condition": detail		});		this.getList(true)	},	onReady() {		this.setListHeight()	},	/* 设置页面高度 */	setListHeight() {		this.selectComponent("#ListBox").setHeight(".division", this);	},	/* 获取购物车数量 */	getNum() {		_Http.basic({			"id": 20220927093202,			"content": {}		}).then(res => {			console.log("购物车数量", res)			getApp().globalData.num = res.data.num;			this.selectComponent("#Float").setNum(res.data.num)		});	},	onShow() {		if (getApp().globalData.num) this.selectComponent("#Float").setNum(getApp().globalData.num)	}})
 |