billing.vue
5.99 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
<template>
<view>
<view class="billing-content">
<view class="uni-title uni-common-mt uni-common-pl">开票类型</view>
<view class="uni-list">
<radio-group @change="typeChange">
<label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in items" :key="item.value">
<view>
<radio :value="item.value" :checked="index === current" />
</view>
<view>{{item.name}}</view>
</label>
</radio-group>
</view>
<view class="paddinglr30 bg-white uni-text border-bottom-1 pos-rel" @click="detailClick">
<view class="jy-fix-height34">
<text class="color-black">抬头类型:</text>
<text class="color-black">公司</text>
</view>
<view class="jy-fix-height34">
<text class="color-black">发票抬头:</text>
<text class="color-black">111</text>
</view>
<view class="jy-fix-height34">
<text class="color-black">纳税人识别号:</text>
<text class="color-black">1111</text>
</view>
<view class="jy-fix-height34" v-if="current === 0">
<text class="color-black">电子邮箱:</text>
<text class="color-black">111</text>
</view>
<view class="jy-fix-height34" v-if="current === 1">
<text class="color-black">邮寄地址:</text>
<text class="color-black">北京市海淀区玲珑路中关村产业园15A三层</text>
</view>
<view class="jy-fix-height34" v-if="current === 1">
<text class="color-black">联系方式:</text>
<text class="color-black">王旭 13810587647</text>
</view>
<view class="jy-fix-height34">
<text class="color-black">备注:</text>
<text class="color-black">111</text>
</view>
<view class="uni-icon pos-abs icon-arrowright uni-icon-arrowright">
</view>
</view>
<!-- 每项选择 -->
<view class="billing-list">
<checkbox-group name="check" @change="changeCheck" class="check">
<!-- 注意v-for不要设在checkbox-group上 -->
<label class="uni-list paddingl10 pos-rel" v-for="(item, index) in content" :key="item.id">
<view class="jy-fix-height34">
<checkbox :value="item.value" :checked="item.checked" /><text
class="margin-left-5">余额充值</text>
</view>
<view class="jy-fix-height34 paddinglr30 margin-left-5">{{item.name}}</view>
<view class="jy-fix-height34 paddinglr30 margin-left-5">{{item.time}}</view>
<view class="pos-abs billing-money">
{{item.money}}
</view>
</label>
</checkbox-group>
</view>
<view class="billing-total">
您已选中0笔交易,共0元
</view>
<!-- 全选 -->
<checkbox-group name="allCheck" @change="changeAll">
<label class="billing-all paddinglr30">
<checkbox :value="allCheck.value" :checked="allCheck.checked" /><text>{{allCheck.name}}</text>
<button type="primary" class="billing-submit" @click="billingSubmit">提交发票</button>
</label>
</checkbox-group>
</view>
</view>
</template>
<script>
export default {
data() {
return {
items: [{
value: '1',
name: '增值税电子普通发票',
checked: 'true'
},
{
value: '2',
name: '增值税纸质专用发票',
}
],
current: 0,
allCheck: {
name: '全选',
value: 'all',
checked: false
},
content: [{
name: '微信支付',
value: '1',
id: 1,
money: '5000',
time: '2022-01-12',
whether: true
},
{
name: '微信支付',
value: '2',
money: '5000',
time: '2022-01-12',
id: 2,
whether: true
},
{
name: '微信支付',
value: '2',
money: '5000',
time: '2022-01-12',
id: 2,
whether: true
},
{
name: '微信支付',
value: '2',
money: '5000',
time: '2022-01-12',
id: 2,
whether: true
},
{
name: '线下公对公',
value: '3',
money: '5000',
time: '2022-01-12',
id: 3,
whether: true
}
]
}
},
methods: {
typeChange: function(evt) {
for (let i = 0; i < this.items.length; i++) {
if (this.items[i].value === evt.detail.value) {
this.current = i;
break;
}
}
},
detailClick() {
uni.navigateTo({
url: '../invoiceTitle/invoiceTitle'
});
},
// 全选
changeAll: function(e) {
if (e.detail.value.length == 0) {
this.content.map(item => this.$set(item, 'checked', false));
this.$set(this.allCheck, 'checked', false);
} else {
this.content.map(item => this.$set(item, 'checked', true));
this.$set(this.allCheck, 'checked', true);
}
},
// 多选
changeCheck: function(e) {
var items = this.content;
var len = this.content.length;
var values = e.detail.value;
// console.log(values)
for (var i = 0; i < len; i++) {
var item = items[i];
if (values.includes(item.value)) {
this.$set(item, 'checked', true);
} else {
this.$set(item, 'checked', false);
}
}
// 判断选中状态
var arr = [];
this.content.forEach(item => item.whether == true ? arr.push(item) : '');
var isAll = arr.every(item => item.checked == true);
isAll ? this.$set(this.allCheck, 'checked', true) : this.$set(this.allCheck, 'checked', false)
},
billingSubmit() {
},
}
}
</script>
<style lang="scss">
.icon-arrowright {
color: #bbb;
// font-size: 20px;
right: 2upx;
top: 73px;
}
.billing-list {
width: 100%;
margin-bottom: 82px;
}
.billing-money {
top: 34px;
right: 20px;
height: 34px;
list-height: 34px;
// z-index: 1;
}
.billing-total {
position: fixed;
bottom: 46px;
left: 0;
width: 100%;
height: 34px;
line-height: 34px;
// color: #51c24e;
background-color: #f2fded;
}
.billing-all {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 46px;
line-height: 46px;
// font-size: 24px;
background-color: #f6f6f6;
}
.billing-submit {
position: fixed;
bottom: 0;
right: 0;
width: 100px;
height: 46px;
line-height: 46px;
}
</style>