invoice.js
1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
* 我的消息model
* @author: yyq<yanqing.yang@yoho.cn>
* @date: 2016/8/29
*/
'use strict';
const _ = require('lodash');
module.exports = class extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
}
getInvoiceDetail(orderCode, uid) {
return this.get({data: {
method: 'app.invoice.detail',
uid: uid,
order_code: orderCode
}}).then(result => {
if (result.code === 200) {
_.unset(result, 'data.uid');
_.set(result, 'data.invoicesType', _.get(result, 'data.invoices_type') === 2 ? '电子发票' : '纸质发票');
}
return result;
});
}
submitInvoiceSupply(info, uid) {
let param = {
order_code: info.orderCode,
invoices_type: info.invoicesType,
invoices_title: info.titleName,
invoice_content: info.contentId,
receiverMobile: info.receiver,
buyerTaxNumber: info.taxNumber,
invoice_payable_type: info.taxNumber ? 2 : 1
};
return this.get({data: Object.assign(param, {
method: 'app.invoice.supply',
uid: uid
})}).then(result => {
_.unset(result, 'data.uid');
return result;
});
}
};