Component({
	properties: {
		list: {
			type: Array
		},
		deleteItem: {
			type: Function
		},
		changeProduct: {
			type: Function
		}, //修改队列
		disabled: {
			type: Boolean
		},
		isAdd: {
			type: Boolean
		}
	},
	options: {
		addGlobalClass: true
	},
	methods: {
		toProductDetail(e) {
			const {
				item
			} = e.currentTarget.dataset;
			console.log(item)
			/* wx.navigateTo({
				url: `/packageA/market/detail?id=${item.sa_itemgroupid}&itemno=${item.itemno}`,
			}) */

		},
		onBlur(e) {
			let {
				data,
				name
			} = e.currentTarget.dataset;
			this.triggerEvent("changeProduct", {
				"sa_orderitemsid": data.sa_orderitemsid,
				"itemid": data.itemid,
				"qty": name == 'qty' ? e.detail.value : data.qty,
				"remarks": name == 'remarks' ? e.detail.value : data.remarks,
				needdate: data.needdate || "",
				deliverydate: data.deliverydate || ""
			})
		},
		changeDate(e) {
			let {
				data
			} = e.currentTarget.dataset;
			this.triggerEvent("changeProduct", {
				"sa_orderitemsid": data.sa_orderitemsid,
				"itemid": data.itemid,
				"qty": data.qty,
				"remarks": data.remarks,
				needdate: e.detail.value || "",
				deliverydate: data.deliverydate || ""
			})
		},
		deleteProduct(e) {
			let {
				item
			} = e.currentTarget.dataset;
			this.triggerEvent("deleteItem", item)
		},
		isEdit() {
			if (this.data.disabled) wx.showToast({
				title: '当前状态不可编辑！',
				icon: "none"
			})
		}
	}
})