1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- 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
- }
- },
- 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({
- title: `提示`,
- content: `是否确定修改“${data.itemname}”数量为:${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) {
- wx.showToast({
- title: '数量不符合规则,已重置为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.msg != '成功') return wx.showToast({
- title: res.msg,
- icon: "none"
- });
- this.triggerEvent("changeItem", data)
- });
- }
- }
- })
|