Component({
	properties: {
		list: {
			type: Array
		},
		deleteItem: {
			type: Function
		},
		changeProduct: {
			type: Function
		}, //修改队列
		disabled: {
			type: Boolean
		}
	},
	options: {
		addGlobalClass: true
	},
	methods: {
		toProductDetail(e) {
			const {
				item
			} = e.currentTarget.dataset;
		},
		onBlur(e) {
			let {
				data,
				name
			} = e.currentTarget.dataset;
			this.triggerEvent("changeProduct", {
				"sa_aftersalesmag_itemsid": data.sa_aftersalesmag_itemsid,
				"sa_orderitemsid": data.sa_orderitemsid,
				"itemid": data.itemid,
				"qty": name == 'qty' ? e.detail.value : data.qty,
				"price": name == 'price' ? e.detail.value : data.price,
				"reason": name == 'reason' ? e.detail.value : data.reason,
			})
		},
		deleteProduct(e) {
			if (this.data.disabled) return wx.showToast({
				title: '当前状态不可删除！',
				icon: "none"
			})
			let {
				item
			} = e.currentTarget.dataset;
			this.triggerEvent("deleteItem", item)
		},
		isEdit() {
			if (this.data.disabled) wx.showToast({
				title: '当前状态不可编辑！',
				icon: "none"
			})
		}
	}
})