kafapiao.vue
10.5 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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
<template>
<view class="box">
<view class="fapiaolist">
<picker @change="selecttaitou" :value="index" :range="array" range-key="name">
<view class="fapiaoitem">
<view class="fleft lei">抬头类型</view>
<view class="fright">
<!-- <view class="qdan">企业单位</view> -->
<view class="qdan">
{{array[index].name}}
</view>
<view class="qirow">
<image src="/static/img/rowright.png"></image>
</view>
</view>
</view>
</picker>
<view class="fapiaoitem">
<view class="fleft lei">发票抬头</view>
<view class="fright fatai">
<input type="text" placeholder="填写发票抬头" placeholder-class="fapiao" v-model="taitou" />
</view>
</view>
<view class="fapiaoitem">
<view class="fleft lei">税号</view>
<view class="fright fatai">
<input type="text" placeholder="填写纳税人识别号" placeholder-class="fapiao" v-model="shuihao" />
</view>
</view>
<view class="fapiaoitem">
<view class="fleft">备注</view>
<view class="fright fatai">
<input type="text" placeholder="填写备注说明" placeholder-class="fapiao" v-model="remark" />
</view>
</view>
<view class="fapiaoitem">
<view class="fleft">地址</view>
<view class="fright fatai">
<input type="text" placeholder="填写地址" placeholder-class="fapiao" v-model="address" />
</view>
</view>
<view class="fapiaoitem">
<view class="fleft">电话</view>
<view class="fright fatai">
<input type="text" placeholder="填写电话" placeholder-class="fapiao" v-model="phone" />
</view>
</view>
<view class="fapiaoitem">
<view class="fleft">开户行</view>
<view class="fright fatai">
<input type="text" placeholder="填写开户行" placeholder-class="fapiao" v-model="bank" />
</view>
</view>
<view class="fapiaoitem">
<view class="fleft">开户行账号</view>
<view class="fright fatai">
<input type="number" placeholder="填写开户行账号" placeholder-class="fapiao" v-model="banknum" />
</view>
</view>
</view>
<!-- 消费记录 -->
<view class="fapiaolist">
<view class="fapiaoitem" @click="selectjilu">
<view class="fleft">选择消费记录</view>
<view class="fright">
<view class="xiaorow">
<image src="/static/img/rowright.png"></image>
</view>
</view>
</view>
<view class="fapiaoitem">
<view class="fleft">发票金额</view>
<view class="fright fajine">
<!-- <input type="number" placeholder="填写发票金额" placeholder-class="fapiao" v-model="fapiaomoney" style="text-align: right;" /> -->
{{fapiaomoney}}
</view>
</view>
</view>
<!-- 收件人信息 -->
<view class="fapiaolist">
<view class="shouinfo">收件人信息</view>
<view class="fapiaoitem">
<view class="fleft lei">姓名</view>
<view class="fright fatai">
<input type="text" placeholder="填写收件人姓名" placeholder-class="fapiao" v-model="shouname" />
</view>
</view>
<view class="fapiaoitem">
<view class="fleft lei">电话</view>
<view class="fright fatai">
<input type="text" placeholder="填写收件人电话" placeholder-class="fapiao" v-model="shouphone" />
</view>
</view>
<view class="fapiaoitem">
<view class="fleft lei">地址</view>
<view class="fright fatai">
<input type="text" placeholder="填写收件人地址" placeholder-class="fapiao" v-model="shouaddress" />
</view>
</view>
</view>
<view class="surekai" @click="queshen" v-if="kaipiaoshow">确认开票</view>
<view class="surekai" v-else>确认开票</view>
</view>
</template>
<script>
import app from "../../App.vue"
export default {
data() {
return {
array: [{
name: "企业单位",
id: 0
},
{
name: "个人/非企业单位 ",
id: 1
}
],
index: 0,
selectid: 0,
taitou: '',
shuihao: '',
remark: '',
address: '',
phone: '',
bank: '',
banknum: '',
shouname: '',
shouphone: '',
shouaddress: '',
fapiaomoney:0,
// 选中的id
select_id:"",
kaipiaoshow:true
}
},
methods: {
selecttaitou(e) {
this.index = e.detail.value,
this.selectid = this.array[e.detail.value].id
},
// 选择消费记录
selectjilu() {
let obj={};
obj.selectid=this.selectid;
obj.taitou=this.taitou;
obj.shuihao=this.shuihao;
obj.remark=this.remark;
obj.address=this.address;
obj.phone=this.phone;
obj.bank=this.bank;
obj.banknum=this.banknum;
obj.fapiaomoney=this.fapiaomoney;
obj.shouname=this.shouname;
obj.shouphone=this.shouphone;
obj.shouaddress=this.shouaddress;
//
uni.setStorageSync("canshu",obj)
uni.navigateTo({
url: '/pages/selectxiaofeijilu/selectxiaofeijilu?id='+this.select_id
})
},
//确认审核
queshen() {
console.log(this.bank)
if (this.taitou == '') {
uni.showToast({
title: '请填写发票抬头',
icon: 'none',
})
return false
}
if (this.shuihao == '') {
uni.showToast({
title: '请填写税号',
icon: 'none',
})
return false
}
// if (this.remark == '') {
// uni.showToast({
// title: '请填写备注说明',
// icon: 'none',
// })
//
// return false
// }
//
// if (this.address == '') {
// uni.showToast({
// title: '请填写地址',
// icon: 'none',
// })
//
// return false
// }
//
// if (this.phone == '') {
// uni.showToast({
// title: '请填写电话',
// icon: 'none',
// })
//
// return false
// }
// var regphone = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
// if (!regphone.test(this.phone)) {
// uni.showToast({
// title: '请填写正确的电话',
// icon: 'none',
// })
//
// return false
// }
// if (this.bank == '') {
// uni.showToast({
// title: '请填写开户行',
// icon: 'none',
// })
//
// return false
// }
// if (this.banknum == '') {
// uni.showToast({
// title: '请填写开户行账号',
// icon: 'none',
// })
//
// return false
// }
if (this.shouname == '') {
uni.showToast({
title: '请填写收件人姓名',
icon: 'none',
})
return false
}
if (this.shouphone == '') {
uni.showToast({
title: '请填写收件人电话',
icon: 'none',
})
return false
}
var regshouphone = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
if (!regshouphone.test(this.shouphone)) {
uni.showToast({
title: '请填写正确的收件人电话',
icon: 'none',
})
return false
}
if (this.shouaddress == '') {
uni.showToast({
title: '请填写收件人地址',
icon: 'none',
})
return false
}
this.kaipiaoshow=false
var param = {
order_ids:this.select_id,
type: this.selectid,
payable: this.taitou,
paragraph: this.shuihao,
mark: this.remark,
address: this.address,
mobile: this.phone,
open_bank: this.bank,
open_account: this.banknum,
money: this.fapiaomoney,
user_name: this.shouname,
user_mobile: this.shouphone,
user_address: this.shouaddress
}
app.post("api/person/applyInvoice", param, 'post')
.then(res => {
console.log(res);
uni.showToast({
title: '开具发票成功',
icon: 'none',
})
uni.removeStorageSync('select_id');
uni.removeStorageSync('totalmoney');
uni.removeStorageSync('totalnum');
uni.removeStorageSync('canshu');
setTimeout(function() {
// uni.navigateBack({
// checked:true
// })
uni.switchTab({
url: '/pages/personcenter/personcenter'
})
}, 1500)
})
.catch(err => {
console.log(err);
uni.showToast({
title: err.msg,
icon: 'none',
})
});
},
},
onLoad(options) {
console.log('123456789',options)
// this.select_id = options.select_id;
// console.log(this.select_id,"选中的id")
// if(options.money!=undefined){
// this.fapiaomoney=options.money
// }
},
onShow() {
this.kaipiaoshow=true
let totalmoney=uni.getStorageSync("totalmoney");
console.log('9090902222',totalmoney)
if(totalmoney!=''){
this.fapiaomoney=totalmoney;
console.log('77777777',this.fapiaomoney)
}
let obj=uni.getStorageSync("canshu");
if(obj!=''){
this.selectid=obj.selectid;
this.taitou=obj.taitou;
this.shuihao=obj.shuihao;
this.remark=obj.remark;
this.address=obj.address;
this.phone=obj.phone;
this.bank=obj.bank;
this.banknum=obj.banknum;
// this.fapiaomoney=obj.fapiaomoney;
this.shouname=obj.shouname;
this.shouphone=obj.shouphone;
this.shouaddress=obj.shouaddress;
};
let pages = getCurrentPages();
let currPage = pages[pages.length - 1]; //当前页面
this.select_id = currPage.data.selectId;
console.log(this.selectId)
if(currPage.data.totlemoney!=undefined){
this.fapiaomoney=currPage.data.totlemoney
}
}
}
</script>
<style>
.fapiaoitem {
display: flex;
align-items: center;
justify-content: space-between;
padding: 40rpx 0;
box-sizing: border;
border-bottom: 1rpx solid #f5f5f5
}
.fapiaolist {
width: 686rpx;
margin: 20rpx auto 0;
background: #fff;
padding: 0 32rpx;
box-sizing: border-box;
}
.qirow {
width: 48rpx;
height: 48rpx;
font-size: 0;
transform: rotate(90deg);
margin-left: 16rpx;
}
.fright {
display: flex;
align-items: center;
}
.fleft {
color: #0A0808;
font-size: 30rpx;
}
.qdan {
color: #7F8389;
font-size: 28rpx;
}
.fatai {
color: #7F8389;
font-size: 28rpx;
text-align: right;
}
.fapiao {
color: #7F8389;
font-size: 28rpx;
}
.xiaorow {
width: 48rpx;
height: 48rpx;
font-size: 0;
}
.fajine {
color: #7F8389;
font-size: 28rpx;
}
.shouinfo {
color: #0A0808;
font-size: 32rpx;
font-weight: bold;
padding: 38rpx 0;
box-sizing: border-box;
}
.surekai {
width: 686rpx;
height: 100rpx;
background: rgba(243, 152, 0, 1);
box-shadow: 0rpx 4rpx 18rpx rgba(0, 0, 0, 0.04);
opacity: 1;
border-radius: 10rpx;
color: #fff;
font-size: 32rpx;
text-align: center;
line-height: 100rpx;
margin: 34rpx auto;
}
.lei{
position: relative;
}
.lei:before{
display:block;
content: "*";
color:#E60000;
font-size: 30rpx;
position: absolute;
top:0;
left:-15rpx;
}
</style>