You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
high-mini/subPages/addAgent/addAgent.vue

170 lines
3.7 KiB

<template>
<view>
<view class="username">
<view class="namecont">代理商名称</view>
<input placeholder="请输入代理商名称" v-model="agentname" type="text"
placeholder-style="color: #bfbfbf;font-size:14px;padding-top:2px;" />
</view>
<view class="username">
<view class="namecont">手机号</view>
<input placeholder="请输入手机号" v-model="agentphone" type="number"
placeholder-style="color: #bfbfbf;font-size:14px;padding-top:2px;" />
</view>
<view class="username">
<view class="namecont">所在地址</view>
<input placeholder="请输入所在地址" v-model="agentaddress" type="text"
placeholder-style="color: #bfbfbf;font-size:14px;padding-top:2px;" />
</view>
<view class="btn mart50" @click="addgent()"> </view>
</view>
</template>
<script>
import {
insertChildAgent
} from '../../Utils/Api.js';
export default {
data() {
return {
agentname: '', //名称
agentphone: '', //电话
agentaddress: '' //地址
}
},
methods: {
//添加代理商
addgent() {
let that = this;
if (that.agentname == '') {
uni.showToast({
title: '请填写代理商名称',
icon: "none",
duration: 2000
});
return;
}
if (that.agentphone == '') {
uni.showToast({
title: '请填写手机号',
icon: "none",
duration: 2000
});
return;
}
if (that.agentaddress == '') {
uni.showToast({
title: '请填写所在地址',
icon: "none",
duration: 2000
});
return;
}
uni.showModal({
title: '添加代理商',
content: '确认信息是否正确。',
success: function(res) {
if (res.confirm) {
uni.showLoading({
title: '添加中'
})
let datas = {
"agentName": that.agentname,
"agentPhone": that.agentphone,
"agentAddress": that.agentaddress
}
insertChildAgent(datas).then(res => {
uni.hideLoading();
if (res.return_code == '000000') {
uni.showToast({
title: '添加成功',
icon: 'none',
duration: 2000,
success() {
setTimeout(() => {
uni.navigateBack({})
}, 1500);
}
})
return;
}
uni.showToast({
title: res.return_msg,
duration: 2000,
icon: 'none'
})
})
}
}
})
}
}
}
</script>
<style lang="scss">
.username {
width: calc(100% - 90upx);
height: 100upx;
display: flex;
align-items: center;
background-color: rgba($color: #ffffff, $alpha: 0.1);
border-bottom: 1px solid #f6f6f6;
padding: 8upx 45upx;
input {
width: 70%;
height: 50upx;
font-size: 16px;
color: #333333;
font-weight: blod;
}
.get-code {
position: absolute;
display: flex;
align-items: center;
justify-content: center;
right: 7px;
z-index: 3;
border: 1px solid #bfbfbf;
width: 25%;
padding: 3px 5px;
border-radius: 22px;
&:after {
content: " ";
width: 1upx;
height: 50upx;
position: absolute;
z-index: 3;
margin-right: 100%;
left: 0;
top: 20upx;
}
}
.namecont {
color: #666666;
width: 28%;
}
}
.btn {
bottom: 0px;
position: absolute;
color: #FFFFFF;
background-color: #0083f5;
width: 90%;
margin-left: 5%;
margin-top: 80rpx;
margin-bottom: 50rpx;
height: 90rpx;
display: flex;
justify-content: center;
align-items: center;
border-radius: 45rpx;
font-size: 40rpx;
}
</style>