244 lines
7.0 KiB
Vue
244 lines
7.0 KiB
Vue
<template>
|
|
<el-form ref="merDataField" size="small" :rules="ruleValidate" :model="merData" label-width="130px" @submit.native.prevent>
|
|
<el-tabs v-loading="loading" type="border-card" v-model="activeName">
|
|
<div class="section">
|
|
<div class="title">基础信息</div>
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item label="供应商名称:" prop="supplier_name">
|
|
<el-input v-model="merData.supplier_name" placeholder="请填写供应商名称" class="selWidth" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="供应商地址:" prop="detailed_address">
|
|
<el-input v-model="merData.detailed_address" placeholder="请填写详细地址" class="selWidth" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="联系人姓名:" prop="name">
|
|
<el-input type="text" placeholder="请填写联系人姓名" v-model="merData.name" class="selWidth" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="联系电话:" prop="phone">
|
|
<el-input placeholder="请填写联系电话" v-model="merData.phone" class="selWidth" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="供应商邮箱:" prop="email">
|
|
<el-input v-model="merData.email" placeholder="请填写邮箱地址" class="selWidth" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="排序:" prop="sort">
|
|
<el-input-number v-model="merData.sort" controls-position="right" placeholder="请输入排序"/>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="状态:" prop="is_show">
|
|
<el-switch v-model="merData.is_show" :active-value="1" :inactive-value="0" :width="55" active-text="开启" inactive-text="关闭" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="商品审核:" prop="is_examine">
|
|
<el-switch v-model="merData.is_examine" :active-value="1" :inactive-value="0" :width="50" active-text="是" inactive-text="否" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="24">
|
|
<el-form-item label="备注:" prop="mark">
|
|
<el-input type="textarea" v-model="merData.mark" placeholder="请填写备注" class="selWidth" :maxlength="250" autosize :rows="5" resize="none" />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<div class="title">账号密码</div>
|
|
<el-row :gutter="24" class="mt20">
|
|
<el-col :span="24">
|
|
<el-form-item label="商户账号:" prop="supplier_account">
|
|
<el-input type="text" v-model="merData.supplier_account" :disabled="!isAdd" class="selWidth" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="24">
|
|
<el-form-item label="登陆密码:" prop="supplier_password">
|
|
<el-input type="password" v-model="merData.supplier_password" :disabled="!isAdd" class="selWidth" />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
</div>
|
|
</el-tabs>
|
|
</el-form>
|
|
</template>
|
|
|
|
<script>
|
|
import { merchantUpdate } from "@/api/merchant";
|
|
import {accountCreate} from "@/api/supplier";
|
|
|
|
export default {
|
|
props: {
|
|
merData: {
|
|
type: Object,
|
|
default: {},
|
|
},
|
|
isAdd: {
|
|
type: Boolean,
|
|
default: false,
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
loading: false,
|
|
supplierId: '',
|
|
direction: 'rtl',
|
|
activeName: 'detail',
|
|
ruleValidate: {
|
|
supplier_name: [{ required: true, message: '请输入供应商名称', trigger: 'blur' }],
|
|
supplier_account: [{ required: true, message: '请输入账号', trigger: 'blur' }],
|
|
supplier_password: [{ required: true, message: '请输入登录密码', trigger: 'blur' }],
|
|
name: [{ required: true, message: '请输入联系人姓名', trigger: 'blur' }],
|
|
phone: [
|
|
{
|
|
required: true, validator: function (rule, value, callback) {
|
|
if (!value) {
|
|
return callback(new Error('请填写联系方式'))
|
|
} else if (!/^1[3456789]\d{9}$/.test(value)) {
|
|
callback(new Error('格式不正确!'))
|
|
} else {
|
|
callback()
|
|
}
|
|
}, trigger: 'blur'
|
|
}
|
|
],
|
|
},
|
|
};
|
|
},
|
|
filters: {},
|
|
mounted() {},
|
|
methods: {
|
|
// 重置表单数据
|
|
resetData(){
|
|
this.$refs.merDataField.resetFields();
|
|
},
|
|
/*提交信息*/
|
|
onSubmit(id){
|
|
|
|
console.log('onSubmit',id)
|
|
|
|
return false;
|
|
|
|
this.$refs['merDataField'].validate(valid => {
|
|
if (valid) {
|
|
this.loading = true;
|
|
merchantUpdate(id,this.merData)
|
|
.then(async res => {
|
|
this.$message.success(res.message);
|
|
this.loading = false;
|
|
this.$emit('success');
|
|
})
|
|
.catch(res => {
|
|
this.loading = false;
|
|
this.$message.error(res.message);
|
|
});
|
|
}
|
|
});
|
|
},
|
|
// 插件供应商账号
|
|
handleCreate(){
|
|
let _this = this;
|
|
_this.$refs['merDataField'].validate((valid) => {
|
|
if (valid) {
|
|
accountCreate(_this.merData).then(async (res) => {
|
|
_this.$message.success(res.message);
|
|
_this.$emit('success');
|
|
}).catch((res) => {
|
|
_this.$message.error(res.message);
|
|
});
|
|
}
|
|
});
|
|
}
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.selWidth{
|
|
width: 100%;
|
|
}
|
|
.el-tabs--border-card {
|
|
box-shadow: none;
|
|
border-bottom: none;
|
|
}
|
|
.section {
|
|
padding: 20px 0 5px;
|
|
border-bottom: 1px dashed #eeeeee;
|
|
.title {
|
|
padding-left: 10px;
|
|
border-left: 3px solid #437FFD;
|
|
font-size: 15px;
|
|
line-height: 15px;
|
|
color: #303133;
|
|
}
|
|
.list {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
list-style: none;
|
|
padding: 0;
|
|
}
|
|
.item {
|
|
flex: 0 0 calc(100% / 2);
|
|
display: flex;
|
|
margin-top: 16px;
|
|
font-size: 13px;
|
|
color: #606266;
|
|
|
|
&:nth-child(2n + 1) {
|
|
padding-right: 20px;
|
|
padding-left: 20px;
|
|
}
|
|
&:nth-child(2n) {
|
|
padding-right: 20px;
|
|
}
|
|
}
|
|
.value {
|
|
flex: 1;
|
|
image {
|
|
display: inline-block;
|
|
width: 40px;
|
|
height: 40px;
|
|
margin: 0 12px 12px 0;
|
|
vertical-align: middle;
|
|
}
|
|
}
|
|
}
|
|
.info-red{
|
|
color: red;
|
|
font-size: 12px;
|
|
}
|
|
/deep/.el-input-number.is-controls-right .el-input__inner{
|
|
padding: 0 40px 0 10px;
|
|
}
|
|
/deep/.el-form-item__label{
|
|
font-weight: normal;
|
|
color: #282828;
|
|
}
|
|
.tab {
|
|
display: flex;
|
|
align-items: center;
|
|
.el-image {
|
|
width: 36px;
|
|
height: 36px;
|
|
margin-right: 10px;
|
|
}
|
|
}
|
|
/deep/.el-drawer__body {
|
|
overflow: auto;
|
|
}
|
|
.gary {
|
|
color: #aaa;
|
|
}
|
|
.input-tips{
|
|
font-size: 12px;
|
|
margin-left: 180px;
|
|
line-height: 20px;
|
|
color: #9d9d9d;
|
|
}
|
|
</style>
|