paySubmit.vue
6.57 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>
<Page name="paySubmit" flank>
<template #header>
<view class="row">
<view class="label">支付数量:</view>
<view>合计运费:{{ form.totalFeeAmount }},合计服务费:{{ form.totalServiceAmount }},支付总额:{{ form.totalPayAmount }}</view>
</view>
<view class="row" style="justify-content: space-between; color: #999999">
<view>服务费率:{{ form.serviceRate }}</view>
<view>油卡返点率:{{ form.oilRate }}</view>
</view>
</template>
<template #content>
<view class="card" v-for="(item, key) in form.detail" :key="key">
<view class="item">
<view class="label"><render-dict dict="ONLINE_FREIGHT_ORDER_FEE_TYPE" :value="item.feeType"></render-dict></view>
<view class="content"
><text class="amount">¥{{ item.feeAmount }}</text></view
>
</view>
<view class="item">
<view class="label">服务费</view>
<view class="content"
><text class="amount">¥{{ item.serviceAmount }}</text></view
>
</view>
<view class="item">
<view class="label">支付总额</view>
<view class="content"
><text class="amount">¥{{ item.payAmount }}</text></view
>
</view>
<view class="item">
<view class="label">承运司机</view>
<view class="content">{{ item.driverName }}{{ item.driverMobile }}</view>
</view>
<view class="item">
<view class="label">收款人</view>
<view class="content">{{ item.recAccountName }}{{ item.recMobile }}</view>
</view>
<view class="item">
<view class="label">承运车辆</view>
<view class="content">{{ item.vehicleLicenseNum }}</view>
</view>
<view class="item">
<view class="label">订单号</view>
<view class="content" style="color: #0066ff">{{ item.orderCode }}</view>
</view>
</view>
</template>
<template #footer>
<u-button :loading="loading" type="primary" @tap="(pwdStr = ''), (pwdShow = true)">继续支付</u-button>
</template>
<u-popup :show="pwdShow" :closeable="false" mode="center" :round="10" :safeAreaInsetBottom="false">
<view class="popup">
<view class="title">输入密码</view>
<view class="row">
<u-input v-model="pwdStr" type="password" input-align="center" border="bottom" placeholder="请输入支付密码"></u-input>
</view>
<view class="but">
<u-button @tap="pwdShow = false">取消</u-button>
<u-button :loading="loading" type="primary" @tap="onSubmit">确定支付</u-button>
</view>
</view>
</u-popup>
</Page>
</template>
<script>
export default {
name: 'paySubmit',
data() {
return {
loading: false,
pwdShow: false,
pwdStr: '',
selection: [],
form: {
oilRate: '',
payCount: '',
serviceRate: '',
totalFeeAmount: '',
totalPayAmount: '',
totalServiceAmount: '',
detail: [
{
customerOrderCode: '',
driverMobile: '',
driverName: '',
feeAmount: '',
feeType: '',
orderCode: '',
payAmount: '',
payCode: '',
recAccountName: '',
recMobile: '',
serviceAmount: '',
vehicleLicenseNum: '',
},
],
},
};
},
onLoad() {
const eventChannel = this.getOpenerEventChannel();
eventChannel.on('payPlanDate', data => {
this.form = data.form || {};
this.selection = data.selection || [];
});
},
methods: {
onSubmit() {
if (this.loading) {
return;
}
if (!this.pwdStr) {
uni.showToast({ title: '支付密码不能为空' });
return;
}
this.loading = true;
uni.$u.api.paymentPlan
.checkPayPassword({ payPassword: this.pwdStr })
.then(res => {
uni.$u.api.paymentPlan
.pay(this.selection)
.then(res => {
this.pwdShow = false;
uni.showToast({ title: '提交成功' });
this.getOpenerEventChannel().emit('refreshData');
setTimeout(() => uni.navigateBack(), 500);
})
.catch(() => {
this.loading = false;
});
})
.catch(() => {
this.loading = false;
});
},
},
};
</script>
<style lang="scss">
.page-paySubmit {
&__header {
padding: 0 !important;
.row {
margin: 10px;
display: flex;
.label {
width: 180rpx;
}
}
}
&__content {
.card {
background-color: $color-white;
color: $color-text;
padding: $padding-base $padding-sm;
margin-bottom: $padding-sm;
border-radius: $radius-md;
box-shadow: $shadow-normal;
font-size: $font-md;
.item {
margin: $padding-sm 0;
display: flex;
justify-content: space-between;
.label {
width: 170upx;
font-weight: 400;
font-size: 28upx;
color: #999999;
line-height: 28upx;
text-align: left;
font-style: normal;
}
.content {
font-weight: 400;
font-size: 28upx;
color: #2b2a27;
line-height: 28upx;
text-align: right;
font-style: normal;
.amount {
color: #ff4f3b;
}
&--warning {
color: #f52723;
font-size: 20rpx;
margin-left: 20upx;
padding-left: 10upx;
padding-right: 10upx;
border-radius: 8upx;
border: 2rpx solid #f52723;
}
}
}
}
}
&__footer {
background-color: $color-white;
}
.popup {
padding-left: $padding-md;
padding-right: $padding-md;
padding-bottom: $padding-lg;
width: 70vw;
.title {
padding-top: $padding-xs;
padding-bottom: $padding-xs;
display: flex;
align-content: center;
justify-content: center;
font-weight: 400;
font-size: 32rpx;
color: #2b2a27;
line-height: 45px;
text-align: left;
font-style: normal;
}
.alert {
color: orange;
font-size: 24rpx;
display: flex;
padding-bottom: 20rpx;
}
.row {
display: flex;
padding: 10upx 0;
.text {
width: 130rpx;
}
}
.but {
margin-top: $padding-md;
display: flex;
gap: 20px;
}
}
}
</style>