<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>
|