zhaoxiaoqiang
2021-09-01 cd384b5b498cefb6ec2a7645fe7da39397b07166
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
<!--
 * @Author: 小明丶
 * @Date: 2019-08-30 15:34:12
 * @LastEditors: 小明丶
 * @LastEditTime: 2020-04-07 17:26:01
 * @Description: 
 -->
<template>
<!-- 商户收款:生成二维码页面 -->
    <div class="calcmoney-box h-100-g">
        <van-nav-bar title="商户收款" left-text="返回" left-arrow @click-left="onClickLeft" style="line-height: 43px;">
            <i class="iconfont iconzuojiantou" slot="left" style="font-size: 25px;"></i>
            <div slot="right" class="slot-right font-style" @click="goList">明细</div>
        </van-nav-bar>
        <div class="pay-box">
            <p>收款金额</p>
            <span class="tag">¥</span>
            <input v-model="price" autofocus readonly  type="text" class="input-money" placeholder="请输入收款金额" >
            <p class="icon-box">
                <span>支持方式:</span>
                <i class="icon iconfont scene_Staging-zhifubao" style="font-size:25px;color:#06b4fd;"></i>
            </p>
        </div>
        <div class="calc">
            <ul class="number-box">
                <li class="number-item" v-for="(item, index) in 9" :key="index" @click="numberClick(item)">{{item}}</li>
                <li class="number-item" @click="numberClick('.')">.</li>
                <li class="number-item" @click="numberClick(0)">0</li>
                <li class="number-item"></li>
            </ul>
            <div class="handler-box">
                <div class="icon-delete" @click="deleteNumber">
                    <i class="icon iconfont scene_Staging-shanchu" style="font-size:35px;"></i>
                </div>
                <div class="icon-submit" @click="submit">
                    收款
                </div>
            </div>
        </div>
    </div>
</template>
 
<script>
    export default {
        name: 'facepay_calc',
        data() {
            return {
                price: ''
            }
        },
        methods: {
            onClickLeft() {
                this.$router.go(-1);
            },
            goList(){
                let {typeId,prodId} = this.$route.query;
                this.$router.push(`/order/dmf?typeId=${typeId}&prodId=${prodId}`)
            },
            // 删除price最后一位
            deleteNumber() {
                this.price = this.price.slice(0, this.price.length - 1)
            },
            //提交生成二维码
            submit() {
                if(this.price=='0' || this.price=='0.'){
                    this.$notify_success('收款金额不能为0!')
                    return
                }
                if (!this.price.length) {
                    this.$notify_success('请输入收款金额!')
                    return
                }else{
                    this.$api.facepay_create({payAmt:+this.price,term:0,zfbVersion:this.$route.query.zfbVersion}).then(res=>{
                        let url = res.body.payQrCodeUrl;
                        let id = res.body.orderId;
                        this.$router.push(`/facepay/code?url=${url}&id=${id}`)
                    })
                }
            },
            //数字的逻辑输入判断
            numberClick(v) {
                let index = this.price.indexOf('.');
                if (v !== '.') {
                    if (this.price.length === 8) {
                        return
                    }
                    if (index > -1 && this.price.slice(index + 1, this.price.length).length == 2) {
                        // 最多输入两位小数
                        this.$notify_success('最多输入两位小数!')
                        return
                    }
                    if(this.price.length===1 && this.price ==='0'){
                        return
                    }
                } else {
                    if (!this.price.length) {
                        return
                    }
                    // if (this.price.slice(0, 1) !== '0') {
                    //     return
                    // }
                    if (index > -1) {
                        return
                    }
                }
                this.price += v;
            }
        }
    }
 
</script>
 
<style lang="less" scoped> 
 
 
    .calcmoney-box{
        //padding-top: 45px;
        background-color: #f1f1f1;
        .font-style{
            color: #333;
            font-size:16px;
        }
        .pay-box{
            &{
                background-color: #fff;
                width: 96%;
                height: 210px;
                margin: auto;
                margin-top: 15px;
                box-sizing: border-box;
                padding: 30px 15px;
                position: relative;
                border-radius: 5px;
            }
            p:nth-of-type(1){
                font-size: 14px;
                color: #333;
                font-weight: 550;
            }
            .tag {
                position: absolute;
                left: 4%;
                top: 66px;
                font-size: 27px;
            }
        }
        input::-webkit-input-placeholder { /* WebKit browsers 适配谷歌 */
            font-size: 20px;
            color:#AFAFAF;
        }
        input:-moz-placeholder { /* Mozilla Firefox 4 to 18 适配火狐 */
            font-size: 20px;
            color:#AFAFAF;
        }
        input::-moz-placeholder { /* Mozilla Firefox 19+ 适配火狐 */
            font-size: 20px;
            color:#AFAFAF;
        }
    }
 
    .input-box {
        padding: 0 15px;
        color: #bb8b52;
        padding: 30px 25px;
        position: relative;
 
        .tag {
            position: absolute;
            left: 40px;
            top: 50%;
            transform: translateY(-50%);
            font-size: 24px;
        }
    }
 
    .icon-box {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        color: #AFAFAF;
        margin-top:20px; 
    }
 
    .input-money {
        //color: #bfa073;
        height: 55px;
        line-height: 55px;
        width: 100%;
        text-align: left;
        padding-left: 35px;
        padding-top:14px; 
        box-sizing: border-box;
        border: 0;
        border-bottom: 1px solid #f1f1f1;
        outline: none;
        font-size: 22px;
    }
 
    .calc {
        position: fixed;
        bottom:0;
        width: 100%;
        font-size: 24px;
        text-align: center;
        background-color: #fff;
        .icon-delete {
            height: 140px;
            line-height: 140px;
        }
 
        .icon-submit {
            height: 140px;
            line-height: 140px;
            color: #fff;
            font-size: 16px;
            font-weight: 500;
            background-color: #896FDA;
        }
 
        &::after {
            content: "";
            clear: both;
            display: block;
        }
    }
 
    .handler-box {
        width: 25%;
        float: left;
    }
 
    .number-box {
        width: 75%;
        float: left;
 
        .number-item {
            width: 33.3333%;
            float: left;
            height: 70px;
            line-height: 70px;
            box-sizing: border-box;
            border:1px solid #f1f1f1;
        }
    }
 
</style>