yuminge-app/yun-min-program-plugin-master/packageI/invoice/components/childOrderList/childOrderList.js

110 lines
2.8 KiB
JavaScript

// packageI/invoice/components/childOrderList/childOrderList.js
const app = getApp();
Component({
properties: {
invoiceType: {
type: [String, Number],
value: 1
},
orderList: {
type: Array,
value: []
},
sinvoice: {
type: Object,
value: {},
},
loading: {
type: Boolean,
value: false
},
finshed: {
type: Boolean,
value: false
}
},
/**
* 组件的初始数据
*/
data: {
visibilityPopup: false,
invoice_list: null,
order_id: "",
order_item: null,
showAddressList: false,
},
lifetimes: {
attached () {
this._initData();
},
},
/**
* 组件的方法列表
*/
methods: {
_initData () {
this.setData({
visibilityPopup: false,
invoice_list: null,
order_id: "",
showAddressList: false,
})
},
showEditInvoice (e) {
this.setData({
order_item: e.detail.order_item,
order_id: e.detail.order_item.id,
goods_ids: e.detail.goods_id,
});
let sinvoice = JSON.parse(JSON.stringify(this.data.sinvoice));
let address = this.data.order_item.address;
this.selectComponent('.invoicePop').initData({
address,
sinvoice
});
},
subInvoice(data) {
// 弹窗获取发票数据
this.setData({
invoice_list: data.detail, //72638
});
let json = this.data.invoice_list;
let urlStr = app.getNetAddresss("plugin.invoice.frontend.index.confirm-invoicing");
app._postNetWork({
url: urlStr,
data: {
data: {
order_id: this.data.order_id,
goods_id: this.data.goods_ids,
...json
}
},
success: ({data: res}) => {
if (res.result != 1) {
return app.tips(res.msg);
}
app.tips("申请成功");
this.triggerEvent("addSuccess");
this.selectComponent('.invoicePop').closePop();
}
})
},
invoiceShowAddressFun(){
this.setData({
showAddressList: true,
});
},
confirmSelectAddress(e) {
let info = e.detail.loc ? e.detail.form : e.detail
this.selectComponent('.invoicePop').setAddress(info);
this.setData({
showAddressList: false,
});
},
}
})