Component({
	properties: {
		list: Array,
		deleteItem: Function,
		changeProduct: Function, //修改队列
		disabled: Boolean
	},
	options: {
		addGlobalClass: true
	},
	methods: {
		onBlur(e) {
			let {
				data,
				name
			} = e.currentTarget.dataset;
			if (name == 'qty' && e.detail.value == 0) {
				this.setData({
					list: this.data.list
				})
				return wx.showToast({
					title: '商品数量不可为0!',
					icon: "none"
				})
			}
			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) {
			this.triggerEvent("deleteItem", e.currentTarget.dataset.item)
		},
		isEdit() {
			if (this.data.disabled) wx.showToast({
				title: '当前状态不可编辑！',
				icon: "none"
			})
		}
	}
})