819527061@qq.com
2024-05-11 f73ed7862edc9c3cb78a2610486643a2fa079fde
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
<template>
    <view class="addSigner-wrap">
        <u-popup v-model="popupShow"  mode="center" width="90%" border-radius="8" closeable>
            <view  class="addSigner-form">
                <view class="addSigner-title">
                    新增签收人
                </view>
                <u-form :model="form" ref="uForm">
                    <u-form-item prop="name"> 
                       <u-input v-model="form.name" placeholder="请输入姓名"/>
                    </u-form-item>
                    <!-- <u-form-item>
                        <u-input 
                           v-model="form.sex" 
                           disabled  
                           placeholder="请选择性别"
                           type="select"
                           @click="show=true" />
                        <u-select 
                          v-model="show" 
                          :list="list"
                          @confirm="confirmBtn"
                          @cancel="cancelBtn"></u-select>
                        
                    </u-form-item> -->
                    <u-form-item prop="phone">
                        <u-input v-model="form.phone" placeholder="请输入手机号"/>
                    </u-form-item>
                </u-form>
                <view class="button-box">
                    <view class="cancelBtn-box">
                        <u-button type="info" class="cancelBtn" @click="cancel">取消</u-button>
                    </view>
                    <view class="cancelBtn-box">
                        <u-button type="success" @click="submit">提交</u-button>
                    </view>
                </view>
            </view>
        </u-popup>
    </view>
</template>
 
<script>
    export default {
        name:"addSigner",
        data() {
            return {
                show:false,
                popupShow:false,
                form: {
                    name: '',
                    phone:''
                },
                rules:{
                    name: [
                        {
                            required: true,
                            message:'请输入姓名',
                            trigger: ['change','blur']
                        }
                    ],
                    phone: [
                        {
                            required: true,
                            message:'请输入手机号',
                            trigger: ['change','blur']
                        },
                        {
                            validator: (rule, value, callback) => {
                                return this.$u.test.mobile(value)
                            },
                            message: '手机号码不正确',
                            trigger: ['change','blur']
                        }
                    ]
                }
            };
        },
        onReady() {
            this.$refs.uForm.setRules(this.rules);
        },
        methods:{
            init() {
                this.popupShow = true
                this.form.name = ''
                this.form.phone = ''
                
            },
            submit() {
                this.$refs.uForm.validate(valid => {
                    this.form.customerId = this.$store.state.customerId
                    console.log('this.form.customerId======',this.form.customerId)
                    if(valid) {
                        if(this.form.customerId) {
                            this.$u.api.insertReceive(this.form).then(res => {
                                if(res.code == 200) {
                                    this.$u.toast(res.message)
                                    this.popupShow = false
                                    this.$emit('refeshSignerList')
                                }
                            })
                        }else {
                            this.$u.toast('请先去登录')
                        }
                        
                    }
                })
            },
            cancel() {
                this.popupShow = false
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    .cancelBtn-box {
        /deep/ .u-btn--default{
            background-color: #1F9F4C;
            width: 260rpx;
            height: 76rpx;
            color: #fff;
        }
    }
   .addSigner-form{
       width: 100%;
       padding: 32rpx;
       box-sizing: border-box;
   }
   .button-box{
       display: flex;
       margin-top: 40rpx;
       margin-bottom: 40rpx;
       justify-content: center;
       .cancelBtn-box{
           margin-right: 40rpx;
           
       }
   }
   .addSigner-title{
       text-align: center;
       font-size: 32rpx;
       color: #111111;
       font-weight: light;
   }
</style>