|
|
@ -21,28 +21,37 @@ Scene({ |
|
|
onLoad: function (options) { |
|
|
onLoad: function (options) { |
|
|
if(options.id){ |
|
|
if(options.id){ |
|
|
this.data.id = options.id |
|
|
this.data.id = options.id |
|
|
wx.showLoading({ title: '正在获取', mask: true }) |
|
|
|
|
|
getSideOrderInfo({id: options.id}).then(result => { |
|
|
|
|
|
wx.hideLoading() |
|
|
|
|
|
result.data.settleTotalAmount = 0 |
|
|
|
|
|
result.data.settleTotalWeight = 0 |
|
|
|
|
|
for (let index = 0; index < result.data.productCategoryInfos.length; index++) { |
|
|
|
|
|
const element = result.data.productCategoryInfos[index] |
|
|
|
|
|
element.fileList = [] |
|
|
|
|
|
for (let k = 0; k < element.weightNoteImages.length; k++) { |
|
|
|
|
|
element.fileList.push({url: element.weightNoteImages[k]}) |
|
|
|
|
|
} |
|
|
|
|
|
element.settlePrice = math.times(element.settleWeight, element.settleUnitPrice) |
|
|
|
|
|
result.data.settleTotalAmount = math.plus(result.data.settleTotalAmount, element.settlePrice) |
|
|
|
|
|
result.data.settleTotalWeight = math.plus(result.data.settleTotalWeight, element.settleWeight) |
|
|
|
|
|
} |
|
|
|
|
|
this.setData({ form: result.data, admin: app.userInfo.type && app.userInfo.type.indexOf('ADMIN') >= 0 }) |
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
wx.hideLoading() |
|
|
|
|
|
util.showToast(err) |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
this.fetchOrderInfo() |
|
|
|
|
|
} |
|
|
|
|
|
event.on('OrderMessage', this, this.onEvent) |
|
|
|
|
|
}, |
|
|
|
|
|
onEvent: function(message){ |
|
|
|
|
|
if (message.what == 12) { |
|
|
|
|
|
this.fetchOrderInfo() |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
fetchOrderInfo: function(){ |
|
|
|
|
|
wx.showLoading({ title: '正在获取', mask: true }) |
|
|
|
|
|
getSideOrderInfo({id: this.data.id}).then(result => { |
|
|
|
|
|
wx.hideLoading() |
|
|
|
|
|
result.data.settleTotalAmount = 0 |
|
|
|
|
|
result.data.settleTotalWeight = 0 |
|
|
|
|
|
for (let index = 0; index < result.data.productCategoryInfos.length; index++) { |
|
|
|
|
|
const element = result.data.productCategoryInfos[index] |
|
|
|
|
|
element.fileList = [] |
|
|
|
|
|
for (let k = 0; k < element.weightNoteImages.length; k++) { |
|
|
|
|
|
element.fileList.push({url: element.weightNoteImages[k]}) |
|
|
|
|
|
} |
|
|
|
|
|
element.settlePrice = math.times(element.settleWeight, element.settleUnitPrice) |
|
|
|
|
|
result.data.settleTotalAmount = math.plus(result.data.settleTotalAmount, element.settlePrice) |
|
|
|
|
|
result.data.settleTotalWeight = math.plus(result.data.settleTotalWeight, element.settleWeight) |
|
|
|
|
|
} |
|
|
|
|
|
this.setData({ form: result.data, admin: app.userInfo.type && app.userInfo.type.indexOf('ADMIN') >= 0 }) |
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
wx.hideLoading() |
|
|
|
|
|
util.showToast(err) |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
printOrder: function(){ |
|
|
printOrder: function(){ |
|
|
wx.showLoading({ title: '正在获取', mask: true }) |
|
|
wx.showLoading({ title: '正在获取', mask: true }) |
|
|
printOrder({id: this.data.id}).then(result => { |
|
|
printOrder({id: this.data.id}).then(result => { |
|
|
@ -86,5 +95,8 @@ Scene({ |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
wx.navigateTo({ url: `/pages/process/payment/index?id=${this.data.form.scrapPaperReceiptId}` }) |
|
|
wx.navigateTo({ url: `/pages/process/payment/index?id=${this.data.form.scrapPaperReceiptId}` }) |
|
|
|
|
|
}, |
|
|
|
|
|
onUnload: function(){ |
|
|
|
|
|
event.remove('OrderMessage', this) |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |