invoiceTitle.vue
6.95 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
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
<template>
<view>
<view>
<view class="uni-list" v-if="items.length>0">
<radio-group @change="titleChange">
<label class="display-block border-bottom-5" v-for="(item, index) in items" :key="item.value">
<view class="elec-card bg-white">
<view class="elec-card-left float-left" >
<view class="elec-card-msg">{{item.name}}</view>
<view class="elec-card-msg">发票类型:{{item.invoiceType | invoiceTypeFilter}}</view>
</view>
<view class="elec-card-right float-right" @click="toUse(JSON.stringify(item))">
<button class="mini-btn color-62c7ee" type="primary" size="mini" >
去使用
</button>
</view>
</view>
<view class="uni-list-cell uni-list-cell-pd">
<view>
<radio :value="JSON.stringify(item)" :checked="item.isDefault == 1"/>
</view>
<view style="flex:1;">默认抬头</view>
<view>
<button class="mini-btn margin-left-5" type="primary" size="mini"
@click="detailLookBtn(JSON.stringify(item), index)">查看
</button>
<button class="mini-btn margin-left-5" type="default" size="mini"
@click="detailEditBtn(JSON.stringify(item), index)">编辑
</button>
<button class="mini-btn margin-left-5" type="warn" size="mini"
@click="detailDelBtn(JSON.stringify(item), index)">删除
</button>
</view>
</view>
</label>
</radio-group>
</view>
<view style="padding: 30px;text-align: center" v-else>暂无抬头,请先添加!</view>
<view class="billing-all">
<button type="primary" class="title-submit" @click="addInvoiceTitle">添加发票抬头</button>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
items: [
// {
// value: '1',
// checked: 'true'
// },
// {
// value: '2'
// },
// {
// value: '3'
// },
],
current: 0,
};
},
onLoad(params) {
},
onShow(){
this.queryCustInvoiceInfoList()
},
methods: {
queryCustInvoiceInfoList() {
let that = this
var queryCustInvoiceInfoList = this.$common.queryCustInvoiceInfoList;
var jsondata = {};
uni.request({
url: queryCustInvoiceInfoList,
data: JSON.stringify(this.$common.requestSign(jsondata)),
dataType: "json",
method: "POST",
success: (res) => {
console.log(res)
if (res.data.code == 0) {
this.items = res.data.data
}
}
})
},
titleChange: function (evt) {
console.log(JSON.parse(evt.detail.value))
let jsonData = JSON.parse(evt.detail.value)
// for (let i = 0; i < this.items.length; i++) {
// if (this.items[i].default === evt.detail.value) {
// this.current = i;
// break;
// }
// }
var updateCustInvoiceInfo = this.$common.updateCustInvoiceInfo;
var jsondata = {
address:jsonData.address,
bankName:jsonData.bankName,
cardNo:jsonData.cardNo,
isDefault:'1',
phone:jsonData.phone,
taxid:jsonData.taxid,
name:jsonData.name,
invoiceType:jsonData.invoiceType,
id:jsonData.id,
remark:jsonData.remark,
email:jsonData.email,
// name: this.baseFormDataPerson.invoicetitle,
// email: this.baseFormDataPerson.email,
// remark: this.baseFormDataPerson.remark,
// isDefault: '1',// 是否默认客户抬头信息,1表示是默认抬头信息,0不是默认抬头信息(默认0)
// invoiceType: '0', // 发票类型(个人、公司),0 表示个人,1表示公司
};
uni.request({
url: updateCustInvoiceInfo,
data: JSON.stringify(this.$common.requestSign(jsondata)),
dataType: "json",
method: "POST",
success: (res) => {
console.log(res)
if (res.data.code == 0) {
uni.showToast({
icon:'none',
title: `设置成功`
})
}
}
})
},
detailLookBtn(val) {
uni.setStorageSync('companyMsg',val)
uni.navigateTo({
url: '../companyMsg/companyMsg'
});
},
detailEditBtn(val,i) {
uni.setStorageSync('titleIfo',val)
uni.navigateTo({
url: '../editTitle/editTitle'
});
},
detailDelBtn(val,i) {
console.log(val)
console.log(i)
var deleteCustInvoiceInfoByID = this.$common.deleteCustInvoiceInfoByID;
var jsondata = {
id: JSON.parse(val).id,
};
uni.request({
url: deleteCustInvoiceInfoByID,
data: JSON.stringify(this.$common.requestSign(jsondata)),
dataType: "json",
method: "POST",
success: (res) => {
console.log(res)
if (res.data.code == 0) {
this.queryCustInvoiceInfoList()
uni.showToast({
icon:'none',
title: `删除成功`
})
}
}
})
},
addInvoiceTitle() {
uni.navigateTo({
url: '../addTitle/addTitle'
});
},
toUse(val) {
console.log(val)
uni.setStorageSync('useTitleIfo',val)
let i = JSON.parse(val)
uni.navigateTo({
url: '../billing/billing?invoiceType='+i.invoiceType+'&email='+i.email+'&name='+i.name+'&remark='+i.remark+'&phone='+i.phone
});
}
},
filters:{
invoiceTypeFilter(val){
console.log(val)
if(val=='0'){
return '个人'
}
if(val=='1'){
return '企业'
}
}
}
}
</script>
<style lang="scss">
.elec-card {
width: 100%;
height: 64upx;
padding: 22upx 30upx;
border-bottom: 1px solid #e5e5e5;
}
.elec-card-left {
width: 70%;
height: 64upx;
}
.elec-card-right {
width: 26%;
height: 64upx;
line-height: 64upx;
}
.elec-card-msg {
line-height: 32upx;
color: rgba(0, 0, 0, .7);
}
.billing-all {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 46px;
line-height: 46px;
// font-size: 24px;
}
</style>