dcf54a32
刘淇
扬名微信公众号
|
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
|
<template>
<div style="height: 100%;display: flex;flex-direction: column;">
<div class="list-wrap">
<div class="noDada" v-if="list.length == 0">
<img src="../../../assets/images/parkInvoice/parkInvoiceNo.png" width="180px" height="140px">
<p>暂无发票抬头,请添加发票抬头才可以发票哦</p>
<!--<div style="padding: 10px;">-->
<!--<x-button type="warn">添加发票抬头</x-button>-->
<!--</div>-->
</div>
<group v-else>
<div v-for="(i, index) in list" style="border-bottom: 1px solid #D9D9D9 ">
<cell :title="i.name" :inline-desc="`发票类型: ${i.invoiceType==0?'个人':'企业'}`">
<div>
<span @click="toUse(i)"
style="color: #FFF;padding: 2px 12px;background:red;border-radius: 15px;font-size: 14px;">去使用</span>
</div>
</cell>
<cell>
<div slot="title">
<input type="radio" name="radioInvoice" :checked="i.isDefault == 1" @change="changDefault(i)">
<span class="colorBlue">默认抬头</span>
</div>
<div>
<x-button mini @click.native="checkOrEdit(i,0)">查看</x-button>
<x-button mini type="primary" style="margin-top: 0" @click.native="checkOrEdit(i,1)">编辑</x-button>
<x-button mini type="warn" style="margin-top: 0" @click.native="deleteHandle(i)">删除</x-button>
</div>
</cell>
</div>
</group>
</div>
|
dcf54a32
刘淇
扬名微信公众号
|
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
<div transfer-dom>
<confirm v-model="deleShow"
title="删除"
@on-cancel=""
@on-confirm="onConfirm"
@on-show=""
@on-hide="">
<p style="text-align:center;">您是否确定删除发票抬头?</p>
</confirm>
</div>
</div>
</template>
<script>
import { queryCustInvoiceInfoList, deleteCustInvoiceInfoByID, updateCustInvoiceInfo } from "@/api/invoice/invoice.js";
export default {
name: "invoiceOpt",
data() {
return {
deleShow: false,
list: [],// 抬头列表
deleteID: ""
};
},
mounted() {
this.queryCustInvoiceInfoList(); // 获取抬头
},
methods: {
// 前往使用
toUse: function(i) {
this.$router.push({
path: "parkInvoice",
query: {
name: i.name,
email: i.email,
remark: i.remark,
type: i.invoiceType == 0 ? "个人" : "企业"
}
});
},
// 设置默认
changDefault: function(i) {
console.log(i);
let jsondata = {};
if (i.invoiceType == 0) {
let obj = {
invoiceType: "0",// 0 :个人 , 1:企业 ,3:非营业单位
name: i.name,
email: i.email,
remark: i.remark,
isDefault: "1",
id: i.id
};
jsondata = Object.assign(obj, this.$utils.commonParams());
}
if (i.invoiceType == 1) {
let obj = {
invoiceType: "1",// 0 :个人 , 1:企业 ,3:非营业单位
name: i.name,
email: i.email,
remark: i.remark,
phone: i.iphone,//企业注册电话
address: i.address,//企业注册地址
phone: i.phone,//企业注册电话
taxid: i.taxid,//企业纳税人识别号
bankName: i.bankName,
cardNo: i.bankNum,
isDefault: "1",
id: i.id
};
jsondata = Object.assign(obj, this.$utils.commonParams());
}
jsondata.sign = this.$utils.signObject(jsondata);
updateCustInvoiceInfo(jsondata).then(response => {
console.log(jsondata);
console.log(response);
if (response.code == 0) {
this.queryCustInvoiceInfoList();
} else {
alert(response.message);
}
});
},
// 删除
deleteHandle: function(i) {
this.deleteID = i.id;
this.deleShow = true;
},
onConfirm() {
console.log("on confirm");
let obj = {
id: this.deleteID
};
let jsondata = Object.assign(obj, this.$utils.commonParams());
jsondata.sign = this.$utils.signObject(jsondata);
console.log("传参 " + JSON.stringify(jsondata));
deleteCustInvoiceInfoByID(jsondata).then(response => {
this.queryCustInvoiceInfoList();
});
},
// 获取抬头列表
queryCustInvoiceInfoList: function() {
let jsondata = this.$utils.commonParams();
jsondata.sign = this.$utils.signObject(jsondata);
console.log("传参 " + JSON.stringify(jsondata));
queryCustInvoiceInfoList(jsondata).then(response => {
console.log(response);
this.list = response.data;
});
},
// 前往开发票
toFill: function() {
this.$router.push({
path: "fill"
});
},
// 前往查看或者编辑发票
checkOrEdit: function(i, status) {
sessionStorage.setItem("invoiceData", JSON.stringify(i));
this.$router.push({
path: "checkEdit",
query: {
status: status, // 0 是查看 1是编辑
type: i.invoiceType // 0 是个人 1是企业
}
});
}
}
};
</script>
<style scoped lang="scss">
.list-wrap {
flex: 1;
overflow-y: auto;
> > > .weui-cells {
margin-top: 0;
}
}
.colorBlue {
color: #0d72e2;
}
.noDada {
text-align: center;
img {
margin: 20px auto;
}
}
</style>
|