const _Http = getApp().globalData.http; Component({ properties: { data: { value: '', type: {} }, changeQty: { value: false, type: Boolean }, model: { type: String, value: 1 }, changeItem: Function, delete: Function, isdelete: { type: Boolean } }, lifetimes: { attached: function () { getApp().globalData.Language.getLanguagePackage(this) this.setData({ siteid: wx.getStorageSync('userMsg').siteid }) } }, methods: { onIconTap() { this.triggerEvent("delete", this.data.data); }, inputChange(e) { this.data.data.qty = e.detail.value this.triggerEvent("input", this.data.data); }, newOnBlur(e) { let value = e.detail.value, data = this.data.data, that = this; if (data.oldQty == value) return; wx.showModal({ cancelText: getApp().globalData.Language.getMapText('取消'), confirmText: getApp().globalData.Language.getMapText('确定'), title: getApp().globalData.Language.getMapText('提示'), content: getApp().globalData.Language.joint([{ t: 1, v: '是否确定修改', }, { v: data.itemname, f: "“", r: "”" }, { t: 1, v: '数量为', r: `:${value}` }]), complete: (res) => { if (res.cancel) { that.setData({ "data.qty": data.oldQty }) } if (res.confirm) that.triggerEvent("changeItem", data) } }) }, onBlur(e) { let { value } = e.detail, data = this.data.data, name = e.currentTarget.dataset.name; console.log(data) if (data[name] == value) return; if (name == 'qty' && value <= 0) { getApp().globalData.Language.modeBoxPrompts('数量不符合规则,已重置为1') data[name] = 1 } else { data[name] = value } _Http.basic({ "id": "20230215201903", "content": { "sa_workorderid": data.sa_workorderid, "iteminfos": [data] } }).then(res => { console.log("产品修改", res) if (res.code != '1') return wx.showToast({ title: res.msg, icon: "none" }); this.triggerEvent("changeItem", data) }); } } })