|
@@ -16,7 +16,13 @@
|
|
|
|
|
|
<!-- 供应商名称 -->
|
|
|
<el-form-item v-if="submitForm.shopType === 2" label="供应商名称:" prop="shopName">
|
|
|
- <el-input v-model="submitForm.shopName" placeholder="请输入供应商名称" maxlength="50" show-word-limit :disabled="editType === 'edit'" />
|
|
|
+ <el-input
|
|
|
+ v-model="submitForm.shopName"
|
|
|
+ placeholder="请输入供应商名称"
|
|
|
+ maxlength="50"
|
|
|
+ show-word-limit
|
|
|
+ :disabled="editType === 'edit'"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item v-if="submitForm.shopType === 1" clearable label="供应商名称:" prop="brandId">
|
|
@@ -30,12 +36,25 @@
|
|
|
>
|
|
|
<el-option v-for="item in brandList" :key="item.id" :label="item.name" :value="item.id" />
|
|
|
</el-select>
|
|
|
- <el-input v-else v-model="submitForm.shopName" placeholder="请输入供应商名称" maxlength="50" show-word-limit :disabled="editType === 'edit'" />
|
|
|
+ <el-input
|
|
|
+ v-else
|
|
|
+ v-model="submitForm.shopName"
|
|
|
+ placeholder="请输入供应商名称"
|
|
|
+ maxlength="50"
|
|
|
+ show-word-limit
|
|
|
+ :disabled="editType === 'edit'"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
<!-- 供应商名称END -->
|
|
|
|
|
|
<el-form-item label="手机号:" prop="mobile">
|
|
|
- <el-input v-model="submitForm.mobile" placeholder="请输入手机号" maxlength="11" show-word-limit @input="handleMobileInput" />
|
|
|
+ <el-input
|
|
|
+ v-model="submitForm.mobile"
|
|
|
+ placeholder="请输入手机号"
|
|
|
+ maxlength="11"
|
|
|
+ show-word-limit
|
|
|
+ @input="handleMobileInput"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="联系人:" prop="linkMan">
|
|
@@ -58,7 +77,14 @@
|
|
|
<transition name="fade">
|
|
|
<el-form-item v-if="submitForm.shopType === 2" label="代理品牌:" prop="shopInfo" class="brand-list">
|
|
|
<template v-if="supplierBrands !== []">
|
|
|
- <el-tag v-for="(brand , index) in supplierBrands" :key="index" closable type="success" @close="handleRemoveBrand(brand)" @click="handleEditBrand(brand)">{{ brand.brandName }}</el-tag>
|
|
|
+ <el-tag
|
|
|
+ v-for="(brand, index) in supplierBrands"
|
|
|
+ :key="index"
|
|
|
+ closable
|
|
|
+ type="success"
|
|
|
+ @close="handleRemoveBrand(brand)"
|
|
|
+ @click="handleEditBrand(brand)"
|
|
|
+ >{{ brand.brandName }}</el-tag>
|
|
|
</template>
|
|
|
<el-tag type="primary" @click="handleAddBrand">添加品牌<span class="el-icon-plus" /></el-tag>
|
|
|
<el-input v-show="false" v-model="submitForm.shopInfo" />
|
|
@@ -119,7 +145,6 @@
|
|
|
<el-input v-show="false" v-model="submitForm.qrCodeImage" />
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
-
|
|
|
</transition-group>
|
|
|
|
|
|
<!-- 公众号信息END -->
|
|
@@ -138,7 +163,6 @@
|
|
|
<!-- 供应商添加品牌的对话框 -->
|
|
|
<el-dialog :title="editBrandText" :visible.sync="dialogAddBrand" width="width" @close="handleDialogAddBrandClosed">
|
|
|
<el-form ref="subFormRef" :model="subForm" label-width="120px" :rules="formDataRules">
|
|
|
-
|
|
|
<el-form-item label="选择品牌:" prop="brandId">
|
|
|
<el-select
|
|
|
v-model="subForm.brandId"
|
|
@@ -222,7 +246,6 @@
|
|
|
<el-form-item label="官网认证链接:" prop="securityLink">
|
|
|
<el-input v-model="subForm.securityLink" placeholder="请输入官网认证链接" />
|
|
|
</el-form-item>
|
|
|
-
|
|
|
</el-form>
|
|
|
|
|
|
<div slot="footer">
|
|
@@ -230,7 +253,6 @@
|
|
|
<el-button type="primary" :loading="submitLoading" @click="handleSaveBrand">确 定</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
-
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -310,7 +332,10 @@ export default {
|
|
|
formDataRules: {
|
|
|
shopType: { required: true, message: '供应商类型不能为空', tigger: 'change', type: 'number' },
|
|
|
shopName: { required: true, message: '供应名称不能为空', tigger: 'change' },
|
|
|
- mobile: [{ required: true, message: '手机号不能为空', tigger: 'change' }, { validator: validMobile, tigger: 'change' }],
|
|
|
+ mobile: [
|
|
|
+ { required: true, message: '手机号不能为空', tigger: 'change' },
|
|
|
+ { validator: validMobile, tigger: 'change' }
|
|
|
+ ],
|
|
|
linkMan: { required: true, message: '联系人不能为空', tigger: 'blur' },
|
|
|
countryId: { required: true, message: '产地不能为空', tigger: 'change', type: 'number' },
|
|
|
brandAuthLogo: { required: true, message: '品牌logo不能为空', tigger: 'change' },
|
|
@@ -342,12 +367,12 @@ export default {
|
|
|
// 去除重复的品牌后的列表
|
|
|
otherBrandList() {
|
|
|
if (this.brandTagClickType === 'add') {
|
|
|
- return this.brandList.filter(item => this.selectedBrandIds.indexOf(item.id) === -1)
|
|
|
+ return this.brandList.filter((item) => this.selectedBrandIds.indexOf(item.id) === -1)
|
|
|
}
|
|
|
|
|
|
if (this.brandTagClickType === 'edit') {
|
|
|
- const exclude = this.selectedBrandIds.filter(id => id !== this.editBrandInfo.brandId)
|
|
|
- return this.brandList.filter(item => exclude.indexOf(item.id) === -1)
|
|
|
+ const exclude = this.selectedBrandIds.filter((id) => id !== this.editBrandInfo.brandId)
|
|
|
+ return this.brandList.filter((item) => exclude.indexOf(item.id) === -1)
|
|
|
}
|
|
|
|
|
|
return this.brandList
|
|
@@ -384,7 +409,7 @@ export default {
|
|
|
// 获取供应商信息
|
|
|
fetchSupplierInfo() {
|
|
|
if (!this.id) return
|
|
|
- getSupplierById({ authUserId: this.id }).then(res => {
|
|
|
+ getSupplierById({ authUserId: this.id }).then((res) => {
|
|
|
this.initSupplierInfo(res.data)
|
|
|
})
|
|
|
},
|
|
@@ -412,7 +437,7 @@ export default {
|
|
|
}
|
|
|
} else {
|
|
|
// 代理商
|
|
|
- this.supplierBrands = info.shopInfo.map(item => {
|
|
|
+ this.supplierBrands = info.shopInfo.map((item) => {
|
|
|
item.uuid = ++uuid
|
|
|
this.selectedBrandIds.push(item.brandId)
|
|
|
return item
|
|
@@ -454,13 +479,15 @@ export default {
|
|
|
params.authUserId = this.id
|
|
|
|
|
|
console.log(params)
|
|
|
- addSupplier(params).then(res => {
|
|
|
- this.$message.success(`${this.editTypeText}供应商成功`)
|
|
|
- this.$store.dispatch('tagsView/delView', this.$route)
|
|
|
- this.$router.replace('/supplier/list')
|
|
|
- }).finally(() => {
|
|
|
- this.isLoading = false
|
|
|
- })
|
|
|
+ addSupplier(params)
|
|
|
+ .then((res) => {
|
|
|
+ this.$message.success(`${this.editTypeText}供应商成功`)
|
|
|
+ this.$store.dispatch('tagsView/delView', this.$route)
|
|
|
+ this.$router.replace('/supplier/list')
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ this.isLoading = false
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
/** 封装请求参数 */
|
|
@@ -485,7 +512,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- params.shopInfo = deepClone(this.supplierBrands).map(item => {
|
|
|
+ params.shopInfo = deepClone(this.supplierBrands).map((item) => {
|
|
|
delete item.statementFileName
|
|
|
delete item.uuid
|
|
|
return item
|
|
@@ -513,17 +540,19 @@ export default {
|
|
|
}
|
|
|
|
|
|
params.shopName = this.currentBrand.name
|
|
|
- params.shopInfo = [{
|
|
|
- brandId: this.submitForm.brandId,
|
|
|
- countryId: this.submitForm.countryId,
|
|
|
- brandAuthLogo: this.submitForm.brandAuthLogo,
|
|
|
- securityLink: this.submitForm.securityLink,
|
|
|
- statementType: 1,
|
|
|
- statementContent: '',
|
|
|
- statementFileId: null,
|
|
|
- statementImage: '',
|
|
|
- statementLink: ''
|
|
|
- }]
|
|
|
+ params.shopInfo = [
|
|
|
+ {
|
|
|
+ brandId: this.submitForm.brandId,
|
|
|
+ countryId: this.submitForm.countryId,
|
|
|
+ brandAuthLogo: this.submitForm.brandAuthLogo,
|
|
|
+ securityLink: this.submitForm.securityLink,
|
|
|
+ statementType: 1,
|
|
|
+ statementContent: '',
|
|
|
+ statementFileId: null,
|
|
|
+ statementImage: '',
|
|
|
+ statementLink: ''
|
|
|
+ }
|
|
|
+ ]
|
|
|
|
|
|
return params
|
|
|
},
|
|
@@ -533,7 +562,7 @@ export default {
|
|
|
// 品牌改变事件
|
|
|
handleBrandChange(id) {
|
|
|
console.log(id)
|
|
|
- this.currentBrand = this.brandList.find(item => item.id === id)
|
|
|
+ this.currentBrand = this.brandList.find((item) => item.id === id)
|
|
|
this.brandAuthLogoList = [{ name: this.currentBrand.name, url: this.currentBrand.authLogo }]
|
|
|
this.submitForm.brandAuthLogo = this.currentBrand.authLogo
|
|
|
this.subForm.brandAuthLogo = this.currentBrand.authLogo
|
|
@@ -586,7 +615,7 @@ export default {
|
|
|
// 从已选品牌id列表中移除
|
|
|
this.selectedBrandIds.splice(this.selectedBrandIds.indexOf(row.brandId), 1)
|
|
|
// 从已添加品牌列表中移除
|
|
|
- const findIndex = this.supplierBrands.findIndex(item => item.uuid === row.uuid)
|
|
|
+ const findIndex = this.supplierBrands.findIndex((item) => item.uuid === row.uuid)
|
|
|
this.supplierBrands.splice(findIndex, 1)
|
|
|
this.submitForm.shopInfo = this.supplierBrands.length
|
|
|
},
|
|
@@ -636,7 +665,7 @@ export default {
|
|
|
}
|
|
|
if (this.brandTagClickType === 'edit') {
|
|
|
// 使用新数据替换旧数据
|
|
|
- const findIndex = this.supplierBrands.findIndex(item => item.uuid === this.editBrandInfo.uuid)
|
|
|
+ const findIndex = this.supplierBrands.findIndex((item) => item.uuid === this.editBrandInfo.uuid)
|
|
|
this.supplierBrands.splice(findIndex, 1, brandInfo)
|
|
|
}
|
|
|
this.dialogAddBrand = false
|
|
@@ -672,7 +701,7 @@ export default {
|
|
|
},
|
|
|
// 获取品牌列表
|
|
|
getBrandList(type) {
|
|
|
- fetchBrandList({ type }).then(res => {
|
|
|
+ fetchBrandList({ type }).then((res) => {
|
|
|
if (res.code !== 0) {
|
|
|
return
|
|
|
}
|
|
@@ -683,7 +712,7 @@ export default {
|
|
|
|
|
|
// 输入框输入时
|
|
|
handleMobileInput() {
|
|
|
- this.submitForm.mobile = this.submitForm.mobile.replace(/[^\w\.\/]/ig, '')
|
|
|
+ this.submitForm.mobile = this.submitForm.mobile.replace(/[^\w\.\/]/gi, '')
|
|
|
},
|
|
|
|
|
|
/** 图片上传 */
|
|
@@ -735,7 +764,7 @@ export default {
|
|
|
this.subForm.statementFileId = response.data.fileId
|
|
|
this.statementFileName = response.data.fileName
|
|
|
// 验证表单数据并保存
|
|
|
- this.$refs.subFormRef.validate(valide => {
|
|
|
+ this.$refs.subFormRef.validate((valide) => {
|
|
|
if (!valide) return
|
|
|
this.handleSaveBrandAction()
|
|
|
})
|
|
@@ -755,13 +784,15 @@ export default {
|
|
|
confirmButtonText: '继续',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning'
|
|
|
- }).then(() => {
|
|
|
- return Promise.resolve()
|
|
|
- }).catch(() => {
|
|
|
- this.$message.info('已取消上传')
|
|
|
- this.submitLoading = false
|
|
|
- return Promise.reject()
|
|
|
})
|
|
|
+ .then(() => {
|
|
|
+ return Promise.resolve()
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.$message.info('已取消上传')
|
|
|
+ this.submitLoading = false
|
|
|
+ return Promise.reject()
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -769,26 +800,26 @@ export default {
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
.addSupplier {
|
|
|
- margin-bottom: 80px;
|
|
|
+ margin-bottom: 80px;
|
|
|
}
|
|
|
.addForm {
|
|
|
- width: 500px;
|
|
|
- margin: 0 auto;
|
|
|
- margin-top: 80px;
|
|
|
- .brand-list{
|
|
|
- .el-tag{
|
|
|
- margin-right: 5px;
|
|
|
- cursor: pointer;
|
|
|
- }
|
|
|
+ width: 500px;
|
|
|
+ margin: 0 auto;
|
|
|
+ margin-top: 80px;
|
|
|
+ .brand-list {
|
|
|
+ .el-tag {
|
|
|
+ margin-right: 5px;
|
|
|
+ cursor: pointer;
|
|
|
}
|
|
|
+ }
|
|
|
}
|
|
|
.submit-btn {
|
|
|
- text-align: center;
|
|
|
- .el-button {
|
|
|
- width: 140px;
|
|
|
- }
|
|
|
+ text-align: center;
|
|
|
+ .el-button {
|
|
|
+ width: 140px;
|
|
|
+ }
|
|
|
}
|
|
|
.hiddenInput {
|
|
|
- display: none;
|
|
|
+ display: none;
|
|
|
}
|
|
|
</style>
|