提交 5b6ca0ad authored 作者: huaxinzhu's avatar huaxinzhu

云仓2.5-提测

上级 b4676ca5
...@@ -9,7 +9,7 @@ export function getBrandsInf(query) { ...@@ -9,7 +9,7 @@ export function getBrandsInf(query) {
} }
// 新增品牌 // 新增品牌
export function addBrand(data) { export function addBrandData(data) {
return request({ return request({
url: '/local/brands', url: '/local/brands',
method: 'post', method: 'post',
...@@ -17,12 +17,29 @@ export function addBrand(data) { ...@@ -17,12 +17,29 @@ export function addBrand(data) {
}); });
} }
// 删除 品牌
export function delBrandData(data) {
return request({
url: '/local/brand/deleteBrand',
method: 'post',
data: data
});
}
// 获取品牌详情 // 获取品牌详情
export function getDetails (id) { // export function (id) {
// return request({
// url: '?id='+id,
// method: 'get'
// })
// }
export function getDetails(query) {
return request({ return request({
url: '/local/brandsInfo?id='+id, url: '/local/brandsInfo',
method: 'get' method: 'get',
}) params: query
});
} }
// 修改品牌信息 // 修改品牌信息
......
...@@ -85,25 +85,9 @@ ...@@ -85,25 +85,9 @@
<el-form-item label="其他资质:"> <el-form-item label="其他资质:">
<div class="auth-con"> <div class="auth-con">
<!--*** 方法一 start ***-->
<!-- :class="['uploadData',{ 'hiden-dom': businessImgFileList.length >= 1 }]"-->
<!-- :class="uploadDataClass(item)"-->
<!-- <div v-for="(item,index) in qualificationList" :key="item.id" class="single-upload-con">-->
<!-- <el-upload-->
<!-- :class="uploadDataClass(item,index)"-->
<!-- action="#"-->
<!-- list-type="picture-card"-->
<!-- :limit="1"-->
<!-- :on-exceed="showTip1"-->
<!-- :http-request="(item)=> {return uploadBusinessImgs(item)}"-->
<!-- :file-list="showIndexAuthImg(item,index)"-->
<!-- ></el-upload>-->
<!-- <div class="single-title">{{ authTitleFormatter(item.content) }}</div>-->
<!-- </div>-->
<!--*** 方法一 end ***-->
<!--*** 方法二 start ***--> <!--*** 方法二 start ***-->
<div v-for="(item,index) in qualificationList" :key="item.id" class="single-upload-con"> <div v-for="(item,index) in qualificationList" :key="item.id" class="single-upload-con">
<div v-show="!item.url" class="single-auth-img" @click="upPreSpeImg(index)"></div> <div v-show="!item.url" class="single-auth-img" @click="upPreAuthImg(index)"></div>
<div v-show="item.url" class="single-auth-img-con"> <div v-show="item.url" class="single-auth-img-con">
<img class="auth-spec-img" :src="item.url" alt="" /> <img class="auth-spec-img" :src="item.url" alt="" />
...@@ -510,7 +494,7 @@ ...@@ -510,7 +494,7 @@
} }
}, },
/** 上传 对应资质图片 */ /** 上传 对应资质图片 */
upPreSpeImg(index) { upPreAuthImg(index) {
let domRef = "hxz" + index; let domRef = "hxz" + index;
this.$refs[domRef][0].value = ''; this.$refs[domRef][0].value = '';
this.$refs[domRef][0].click(); this.$refs[domRef][0].click();
...@@ -544,7 +528,7 @@ ...@@ -544,7 +528,7 @@
}, },
/** 更换图片 */ /** 更换图片 */
// changeSpeImg(index,item) { // changeSpeImg(index,item) {
// this.upPreSpeImg(index,item); // this.upPreAuthImg(index,item);
// }, // },
/** 删除 当前图片 */ /** 删除 当前图片 */
delSingleSpecImg(index,item) { delSingleSpecImg(index,item) {
......
...@@ -801,59 +801,6 @@ ...@@ -801,59 +801,6 @@
</script> </script>
<style lang="scss" type="text/stylus" scoped> <style lang="scss" type="text/stylus" scoped>
/* 手机竖屏时,可视区域的最大宽度为 480 */
//@media screen and (max-width: 480px) and (orientation: portrait) {
// .pc-content {
// display: none!important;
// }
// .mobile-show {
// display: none!important;
// }
//}
/* 手机横屏和pc最小宽度为 812px */
/* 手机横屏 812px 为iphoneX 横屏的设备独立像素*/
//@media screen and (max-width: 961px) and (orientation: landscape) {
// .pc-content {
// display: none !important;
// }
//
// .mobile-content {
// display: block!important;
// font-size: 0.16rem;
// }
//}
@media screen and (min-width: 750px) {
html {
font-size: 100px;
}
}
@media screen and (min-width: 640px) and (max-width: 749) {
html {
font-size: 85.333px;
}
}
@media screen and (min-width: 414px) and (max-width: 639) {
html {
font-size: 61.333px;
}
}
@media screen and (min-width: 375px) and (max-width: 413) {
html {
font-size: 50px;
}
}
@media screen and (min-width: 320px) and (max-width: 374) {
html {
font-size: 42.6667px;
}
}
@media screen and (max-width: 961px) { @media screen and (max-width: 961px) {
.pc-content { .pc-content {
display: none !important; display: none !important;
......
...@@ -44,8 +44,8 @@ ...@@ -44,8 +44,8 @@
<!-- <span class="tip-span ml20">关键词之间用逗号分开,最多可以添加5个</span>--> <!-- <span class="tip-span ml20">关键词之间用逗号分开,最多可以添加5个</span>-->
</el-form-item> </el-form-item>
<el-form-item label="所属品牌:" prop="goods_brand"> <el-form-item label="所属品牌:" prop="brand_id">
<el-select v-model="goodsInfoForm.goods_brand" placeholder="请选择商品品牌" style="width: 420px;"> <el-select v-model="goodsInfoForm.brand_id" placeholder="请选择商品品牌" style="width: 420px;">
<el-option <el-option
v-for="item in brandOptions" v-for="item in brandOptions"
:key="item.id" :key="item.id"
...@@ -169,6 +169,7 @@ ...@@ -169,6 +169,7 @@
deliver_area: '', // 发货地 deliver_area: '', // 发货地
unit: '', // 单位 unit: '', // 单位
goods_brand: '', // 品牌 goods_brand: '', // 品牌
brand_id: 0, // 品牌id
web_url: '', // 外部链接 web_url: '', // 外部链接
out_goods_id: '', // 商品编码 out_goods_id: '', // 商品编码
imgs: [] // 商品图片 imgs: [] // 商品图片
...@@ -262,25 +263,16 @@ ...@@ -262,25 +263,16 @@
}, },
// 获取 商品品牌 // 获取 商品品牌
getBrands() { getBrands() {
getBrandsInf().then( res => { // 增加入参
if(res.data) { let data = {
this.brandOptions = res.data.data; status: 1
}
getBrandsInf(data).then( res => {
if(res.code == 1 ) {
this.brandOptions = res.data.data ? res.data.data : [];
}else { }else {
this.brandOptions = []; this.brandOptions = [];
} }
// let num_goods_brand = Number(this.goodsInfoForm.goods_brand);
//
// if( this.goodsInfoForm.goods_brand !== '') {
// let result = this.brandOptions.find( item => {
// return item.id === num_goods_brand;
// });
// //console.log(315,result)
// if( result == undefined) {
// this.goodsInfoForm.goods_brand = '';
// }
// }
}); });
}, },
/* 修改 商品分类 类目 */ /* 修改 商品分类 类目 */
......
...@@ -178,13 +178,12 @@ ...@@ -178,13 +178,12 @@
deliver_area: res.data.deliver_area, // 发货地 deliver_area: res.data.deliver_area, // 发货地
unit: res.data.unit, // 单位 unit: res.data.unit, // 单位
goods_brand: res.data.goods_brand, // 品牌 goods_brand: res.data.goods_brand, // 品牌
brand_id: res.data.brand_id, // 品牌
web_url: res.data.web_url, // 外部链接 web_url: res.data.web_url, // 外部链接
out_goods_id: (res.data.out_goods_id == 0) ? '' : res.data.out_goods_id , // 商品编码 out_goods_id: (res.data.out_goods_id == 0) ? '' : res.data.out_goods_id , // 商品编码
imgs: res.data.imgs // 商品图片 imgs: res.data.imgs // 商品图片
} }
this.goodsinfodata.categoryStr = res.data.category_first_name + '/' + res.data.category_first_name + '/' + res.data.category_three_name; this.goodsinfodata.categoryStr = res.data.category_first_name + '/' + res.data.category_first_name + '/' + res.data.category_three_name;
// 发货地 需要 处理
// this.goodsinfodata.deliver_area = this.goodsinfodata.deliver_area === 0 ? '' : this.goodsinfodata.deliver_area;
let arr = []; let arr = [];
arr[0] = res.data.category_first_id; arr[0] = res.data.category_first_id;
...@@ -505,13 +504,18 @@ ...@@ -505,13 +504,18 @@
let spxxData = this.$refs.goodsInfo.goodsInfoForm; let spxxData = this.$refs.goodsInfo.goodsInfoForm;
// 品牌处理 goods_brand // 品牌处理 goods_brand
let brandOptions = this.$refs.goodsInfo.brandOptions; let brandOptions = this.$refs.goodsInfo.brandOptions;
for(let bi = 0; bi < brandOptions.length; bi++) { debugger
if( Number(spxxData.goods_brand) === Number(brandOptions[bi].id) ) { // goods_brand
spxxData.goods_brand = brandOptions[bi].brand_cn; if (Array.isArray(brandOptions) && brandOptions.length > 0) {
break; for(let bi = 0; bi < brandOptions.length; bi++) {
if( Number(spxxData.goods_id) === Number(brandOptions[bi].id) ) {
spxxData.goods_brand = brandOptions[bi].brand_cn;
break;
}
} }
} }
// 产地数据处理 // 产地数据处理
let areaOptions = this.$refs.goodsInfo.areaOptions; let areaOptions = this.$refs.goodsInfo.areaOptions;
for(let ai = 0; ai < areaOptions.length; ai++) { for(let ai = 0; ai < areaOptions.length; ai++) {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<el-col :span="22"> <el-col :span="22">
<el-form-item label="品牌名称"> <el-form-item label="品牌名称">
<el-input <el-input
v-model="queryParams.brand_cn" v-model="queryParams.brand_name"
placeholder="请输品牌名称" placeholder="请输品牌名称"
clearable clearable
size="small" size="small"
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
</el-form-item> </el-form-item>
<el-form-item label="品牌经营类型:"> <el-form-item label="品牌经营类型:">
<el-select v-model="queryParams.brand_type" clearable size="small" placeholder="全部品牌类型" @change="typeChange"> <el-select v-model="queryParams.brand_type" clearable size="small" placeholder="全部品牌类型">
<el-option <el-option
v-for="item in brandTypeOptions" v-for="item in brandTypeOptions"
:key="item.value" :key="item.value"
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</el-form-item> </el-form-item>
<el-form-item label="品牌状态:"> <el-form-item label="品牌状态:">
<el-select v-model="queryParams.status" clearable size="small" placeholder="全部状态" @change="statusChange"> <el-select v-model="queryParams.status" clearable size="small" placeholder="全部状态">
<el-option <el-option
v-for="item in statusOptions" v-for="item in statusOptions"
:key="item.value" :key="item.value"
...@@ -39,13 +39,13 @@ ...@@ -39,13 +39,13 @@
</el-col> </el-col>
<el-col :span="2"> <el-col :span="2">
<el-form-item style="float: right"> <el-form-item style="float: right">
<el-button type="primary" size="mini" icon="el-icon-plus" @click="handleAdd">新 增</el-button> <el-button type="primary" size="mini" icon="el-icon-plus" @click="addBrand">新 增</el-button>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
</div> </div>
<el-table v-loading="loading" :data="brandList" :height="tableHeight"> <el-table :data="brandList" :height="tableHeight">
<el-table-column label="品牌名称" prop="brand_cn" align="center"></el-table-column> <el-table-column label="品牌名称" prop="brand_cn" align="center"></el-table-column>
<el-table-column label="品牌经营类型" prop="brand_type" align="center"> <el-table-column label="品牌经营类型" prop="brand_type" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
...@@ -55,20 +55,20 @@ ...@@ -55,20 +55,20 @@
<el-table-column label="品牌商标注册号" prop="brand_number" align="center"></el-table-column> <el-table-column label="品牌商标注册号" prop="brand_number" align="center"></el-table-column>
<el-table-column label="品牌状态" prop="status" align="center"> <el-table-column label="品牌状态" prop="status" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.status === 0 ? '未审核' : scope.row.status === 1 ? '已通过' : '已拒绝'}} {{ brandStatusFormatter(scope.row.status) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="授权期限" align="center"> <el-table-column label="授权期限" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<!-- <span>{{ timeFormatter(scope.row.send_time) }}</span>--> <span>{{ timeFormatter(scope.row.brand_start_time) }}</span>
<span>--</span> <span>--</span>
<!-- <span>{{ timeFormatter(scope.row.send_time) }}</span>--> <span>{{ timeFormatter(scope.row.brand_end_time) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="审核说明" prop="sm" align="center"></el-table-column> <el-table-column label="审核说明" prop="last_check_content" align="center"></el-table-column>
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" size="small" @click="handleDetails(scope.row)" :disabled="(scope.row.id === 1)">编辑</el-button> <el-button type="text" size="small" @click="editBrand(scope.row)" :disabled="(scope.row.id === 1)">编辑</el-button>
<el-divider direction="vertical"></el-divider> <el-divider direction="vertical"></el-divider>
<el-button type="text" size="small" @click="deleteBrand(scope.row)" :disabled="(scope.row.id === 1)">删除</el-button> <el-button type="text" size="small" @click="deleteBrand(scope.row)" :disabled="(scope.row.id === 1)">删除</el-button>
</template> </template>
...@@ -83,8 +83,17 @@ ...@@ -83,8 +83,17 @@
></pagination> ></pagination>
</el-card> </el-card>
<!-- 新增/修改/详情 --> <!-- 新增/修改/详情 -->
<el-dialog :title="brandTitle" :visible.sync="isOpen" width="60%" class="brandInf-add"> <el-dialog :title="brandTitle" :visible.sync="isOpen" width="70%" class="brandInf-add" center
<el-form :model="brandForm" :rules="brandRules" ref="brandForm" label-width="140px"> :destroy-on-close="true" :close-on-click-modal="false" :before-close="handleCancel">
<el-form v-if="isOpen" :model="brandForm" :rules="brandRules" ref="brandForm" label-width="140px">
<el-row v-if="indexBrandId != 0 && brandForm.status != 3">
<p class="brand-status-con">
<span v-if="brandForm.status == 1" class="color-spe-success"><i class="el-icon-success"></i></span>
<span v-if="brandForm.status == 2" class="color-spe-error"><i class="el-icon-error"></i></span>
<span v-if="brandForm.status == 0" class="color-spe-waiting"><i class="el-icon-success"></i></span>
<span class="brand-form-status-text">{{ statusVal }}</span>
</p>
</el-row>
<el-row> <el-row>
<el-col :span="16" :offset="3"> <el-col :span="16" :offset="3">
<el-form-item label="经营品牌类型:" prop="brand_type"> <el-form-item label="经营品牌类型:" prop="brand_type">
...@@ -99,7 +108,7 @@ ...@@ -99,7 +108,7 @@
<el-row> <el-row>
<el-col :span="16" :offset="3"> <el-col :span="16" :offset="3">
<el-form-item label="品牌中文名:" prop="brand_cn"> <el-form-item label="品牌中文名:" prop="brand_cn">
<el-input v-model="brandForm.brand_cn"></el-input> <el-input v-model="brandForm.brand_cn" @input="checkIsExsitBrandName"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
...@@ -130,8 +139,8 @@ ...@@ -130,8 +139,8 @@
action="#" action="#"
list-type="picture-card" list-type="picture-card"
:http-request="uploadLogoImgs" :http-request="uploadLogoImgs"
:limit="2" :limit="1"
:on-exceed="limitTwo" :on-exceed="limit1"
:before-upload="UpImgSizeFiveKB" :before-upload="UpImgSizeFiveKB"
:on-preview="handlePreviewLogo" :on-preview="handlePreviewLogo"
:on-remove="handleRemoveLogo" :on-remove="handleRemoveLogo"
...@@ -166,8 +175,8 @@ ...@@ -166,8 +175,8 @@
action="#" action="#"
list-type="picture-card" list-type="picture-card"
:http-request="uploadCertImgs" :http-request="uploadCertImgs"
:limit="2" :limit="1"
:on-exceed="limitTwo" :on-exceed="limit1"
:before-upload="UpImgSizeTwoMb" :before-upload="UpImgSizeTwoMb"
:on-preview="handlePreviewCert" :on-preview="handlePreviewCert"
:on-remove="handleRemoveCert" :on-remove="handleRemoveCert"
...@@ -203,9 +212,37 @@ ...@@ -203,9 +212,37 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row>
<el-col :span="16" :offset="3">
<el-form-item label="商标注册有效期:" prop="brand_auth_time" v-if="brandForm.brand_type === 2">
<el-date-picker type="date" placeholder="选择日期" v-model="validityConcreteTime"
style="width: 300px;" @change="validityConcreteChange"></el-date-picker>
<el-checkbox v-model="validityLongTermVal" style="padding-left:15px;"
@change="validityLongTermChange">长期
</el-checkbox>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="16" :offset="3">
<el-form-item label="品牌授权期限:" prop="brandAuthRangeTime">
<el-date-picker
style="width:400px;"
v-model="brandForm.brandAuthRangeTime"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
/>
</el-form-item>
</el-col>
</el-row>
<el-row> <el-row>
<el-col :span="21" :offset="3"> <el-col :span="21" :offset="3">
<el-form-item label="品牌方授权书:" prop="brand_auth" v-if="brandForm.brand_type === 2"> <el-form-item label="品牌厂商授权:" prop="brand_auth" v-if="brandForm.brand_type === 2">
<div style="width:100%;height: 100%;display: flex;flex-direction: row;justify-content: normal;"> <div style="width:100%;height: 100%;display: flex;flex-direction: row;justify-content: normal;">
<div style="padding-right:6px;"> <div style="padding-right:6px;">
<el-upload <el-upload
...@@ -237,18 +274,6 @@ ...@@ -237,18 +274,6 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row>
<el-col :span="16" :offset="3">
<el-form-item label="授权有效期至:" prop="brand_auth_time" v-if="brandForm.brand_type === 2">
<el-date-picker type="date" placeholder="选择日期" v-model="validityConcreteTime"
style="width: 300px;" @change="validityConcrete"></el-date-picker>
<el-checkbox v-model="validityLongTermVal" style="padding-left:15px;"
@change="validityLongTerm">长期
</el-checkbox>
</el-form-item>
</el-col>
</el-row>
<el-row> <el-row>
<el-col :span="21" :offset="3"> <el-col :span="21" :offset="3">
<el-form-item label="品牌经营授权:" prop="brand_business_auth"> <el-form-item label="品牌经营授权:" prop="brand_business_auth">
...@@ -304,7 +329,7 @@ ...@@ -304,7 +329,7 @@
</el-row> </el-row>
<el-form-item class="btnCen"> <el-form-item class="btnCen">
<el-button type="" @click="handleCancel('brandForm')" style="margin-right: 30px"></el-button> <el-button type="" @click="handleCancel" style="margin-right: 30px"></el-button>
<el-button type="primary" @click="handleSave('brandForm')">提交审核</el-button> <el-button type="primary" @click="handleSave('brandForm')">提交审核</el-button>
</el-form-item> </el-form-item>
...@@ -314,7 +339,7 @@ ...@@ -314,7 +339,7 @@
</template> </template>
<script> <script>
import {getBrandsInf, getDetails, addBrand, upBrand, upLoadImg} from '@/api/module/brand/brand' import {getBrandsInf, getDetails, addBrandData, upBrand, upLoadImg, delBrandData} from '@/api/module/brand/brand'
import { dateFormat } from '@/utils' import { dateFormat } from '@/utils'
export default { export default {
name: "Brand", name: "Brand",
...@@ -343,7 +368,7 @@ ...@@ -343,7 +368,7 @@
let authTimeValidator = (rule, value, callback) => { let authTimeValidator = (rule, value, callback) => {
if(this.brandForm.brand_type === 2) { if(this.brandForm.brand_type === 2) {
if (this.validityConcreteTime === null && this.validityLongTermVal === false) { if (this.validityConcreteTime === null && this.validityLongTermVal === false) {
callback(new Error("授权有效期具体时间和长期必须填写其中一个")); callback(new Error("品牌注册有效期具体时间和长期必须填写其中一个"));
} else { } else {
callback(); callback();
} }
...@@ -351,6 +376,13 @@ ...@@ -351,6 +376,13 @@
callback(); callback();
} }
}; };
let authRangeTimeValidator = (rule, value, callback) => {
if( Array.isArray(this.brandForm.brandAuthRangeTime) && this.brandForm.brandAuthRangeTime.length == 2) {
callback();
}else {
callback(new Error("请选择品牌授权期限"));
}
};
let authBusValidator = (rule, value, callback) => { let authBusValidator = (rule, value, callback) => {
if(this.shopImgFileList.length > 0) { if(this.shopImgFileList.length > 0) {
callback(); callback();
...@@ -361,25 +393,26 @@ ...@@ -361,25 +393,26 @@
return { return {
fullHeight: 0, fullHeight: 0,
tableHeight: 0, tableHeight: 0,
loading: false,
isOpen: false, isOpen: false,
brandTitle: '', brandTitle: '',
brandTypeOptions: [ brandTypeOptions: [
{label: "自有品牌", value: 1}, {label: "全部品牌", value: '-1'},
{label: "品牌厂商授权", value: 2}, {label: "自有品牌", value: '1'},
{label: "品牌厂商授权", value: '2'},
], ],
statusOptions: [ statusOptions: [
{label: '未审核', value: 0}, {label: '未审核', value: '0'},
{label: '已通过', value: 1}, {label: '已通过', value: '1'},
{label: '已拒绝', value: 2} {label: '已拒绝', value: '2'},
{label: '已过期', value: '3'},
], ],
total: 0, total: 0,
queryParams: { queryParams: {
page: 1, page: 1,
limit: 10, limit: 10,
brand_cn: null, brand_name: '',
brand_type: null, brand_type: '',
status: null status: ''
}, },
LogoVisible: false, LogoVisible: false,
LogoImageUrl: '', LogoImageUrl: '',
...@@ -396,6 +429,8 @@ ...@@ -396,6 +429,8 @@
validityConcreteTime: null, validityConcreteTime: null,
validityLongTermVal: false, // 长期 validityLongTermVal: false, // 长期
brandList: [], brandList: [],
indexBrandId: 0, // 当前品牌 id
statusVal: '',
brandForm: { brandForm: {
id: 0, id: 0,
brand_type: '', // 品牌经营类型 brand_type: '', // 品牌经营类型
...@@ -405,7 +440,8 @@ ...@@ -405,7 +440,8 @@
brand_register_cert: '', // 商标注册证书 brand_register_cert: '', // 商标注册证书
brand_number: '', // 品牌商标注册号 brand_number: '', // 品牌商标注册号
brand_range: '', // 品牌类型 brand_range: '', // 品牌类型
brand_auth_time: '', // 授权有效期 == 商标授权时间期限 brand_auth_time: '', // 商品注册有效期
brandAuthRangeTime: [], // 品牌授权有效期
brand_auth: '', // 商标授权 == 品牌授权 == factoryImgFileList brand_auth: '', // 商标授权 == 品牌授权 == factoryImgFileList
brand_business_auth: '', // 商标经营授权 == 品牌经营授权 == shopImgFileList brand_business_auth: '', // 商标经营授权 == 品牌经营授权 == shopImgFileList
}, },
...@@ -418,11 +454,10 @@ ...@@ -418,11 +454,10 @@
brand_range: [{ required: true, message: '品牌类型需要选择其一', trigger: 'blur' }], brand_range: [{ required: true, message: '品牌类型需要选择其一', trigger: 'blur' }],
brand_auth: [{ required: true, message: '品牌授权书图片至少上传一张', validator: authValidator}], // 品牌授权 brand_auth: [{ required: true, message: '品牌授权书图片至少上传一张', validator: authValidator}], // 品牌授权
brand_auth_time: [{ required: true,trigger: 'change',validator:authTimeValidator }], brand_auth_time: [{ required: true,trigger: 'change',validator:authTimeValidator }],
brandAuthRangeTime: [{ required: true,trigger: 'blur',validator:authRangeTimeValidator }],
brand_business_auth: [{ required: true, message: '品牌经营授权至少上传一张图片', validator: authBusValidator }], brand_business_auth: [{ required: true, message: '品牌经营授权至少上传一张图片', validator: authBusValidator }],
}, },
downTemplatehttp: '', downTemplatehttp: '',
// shopTemplatehttp : 'http://excel.jxhh.com/brand_new.doc',
// factoryTemplatehttp : 'http://excel.jxhh.com/brand_new.doc',
shopTemplatehttp : 'http://excel.jxhh.com/brand_new.doc', shopTemplatehttp : 'http://excel.jxhh.com/brand_new.doc',
factoryTemplatehttp : 'http://excel.jxhh.com/brand_new.doc', factoryTemplatehttp : 'http://excel.jxhh.com/brand_new.doc',
} }
...@@ -441,24 +476,23 @@ ...@@ -441,24 +476,23 @@
}, },
methods: { methods: {
typeChange(val){ /** 查询 品牌 列表 */
if(val === "") { getList() {
this.queryParams.brand_type = null; let data = {
page: this.queryParams.page,
limit: this.queryParams.limit
} }
}, if (this.queryParams.brand_name != "") {
statusChange(val){ data['brand_name'] = this.queryParams.brand_name
if(val === "") {
this.queryParams.status = null;
} }
}, if (this.queryParams.brand_type == '1' || this.queryParams.brand_type == '2' || this.queryParams.brand_type == '3') {
isClick() { data['brand_type'] = this.queryParams.brand_type
return false; }
}, if (this.queryParams.status == '0' || this.queryParams.status == '1' || this.queryParams.status == '2') {
getList() { data['status'] = this.queryParams.status
this.loading = true; }
//let params = this.handleQueryParams(this.queryParams); getBrandsInf(data).then(res => {
getBrandsInf(this.queryParams).then(res => { if ( res.code == 1) {
if ( res && res.data && res.code === 1) {
if(res.data) { if(res.data) {
this.brandList = res.data.data; this.brandList = res.data.data;
this.total = res.data.count; this.total = res.data.count;
...@@ -466,12 +500,370 @@ ...@@ -466,12 +500,370 @@
this.brandList = []; this.brandList = [];
} }
}else { }else {
this.$message({ message: '数据出错啦!', type: 'error'}); this.$message({ type: 'error',message: res.message ? res.message : '获取品牌列表数据失败' });
}
});
},
/** 品牌 审核状态 */
statusFormatter(status) {
let res = '';
if (status == 0) {
res = '等待审核'
}
if (status == 1) {
res = '审核通过'
}
if (status == 2) {
res = '审核被拒绝'
}
return res
},
/** 校验品牌 */
checkIsExsitBrandName() {
if (!this.brandForm.brand_cn) return
let data = {
brand_name : this.brandForm.brand_cn
}
getDetails(data).then(res=> {
if (res.code == 1 && res.data) {
this.$message({ type: 'warning', message: '品牌名称已存在'});
}
});
},
/** 新增 品牌 */
addBrand() {
if(this.total <= 20 ) {
this.isOpen = true;
this.reset('brandForm')
this.brandTitle = '新增品牌信息';
this.indexBrandId = 0;
this.brandForm.brand_auth = '';
this.brandForm.brand_auth_time = '';
}else {
this.$message({ type: 'warning', message: '目前暂时只支持维护20个品牌数据'});
}
},
/** 编辑 品牌 */
editBrand(row) {
this.indexBrandId = row.id;
let data = {
id : this.indexBrandId
}
getDetails(data).then(res => {
if(res.code == 1) {
this.isOpen = true;
this.reset('brandForm')
this.brandTitle = '品牌信息详情';
this.brandForm = res.data;
// 品牌审核状态
this.statusVal = this.statusFormatter(res.data.status)
// 模板下载地址赋值
this.downTemplatehttp = (this.brandForm.brand_type === 1 ? this.shopTemplatehttp : this.factoryTemplatehttp);
// 品牌logo图片
let brandArr = [];
let brandUrl = {};
brandArr = this.brandForm.brand_logo.split(",");
if (brandArr.length > 0) {
brandArr.forEach(item=> {
brandUrl = {};
if (item) {
brandUrl.url = item
this.brandImgFileList.push(brandUrl)
}
});
}else {
this.brandImgFileList = [];
}
// 商标注册证书图片
let certArr = [];
let certRrl = {};
certArr = this.brandForm.brand_register_cert.split(",");
if (certArr.length > 0) {
certArr.forEach(item=> {
certRrl = {};
if (item) {
certRrl.url = item
this.certImgFileList.push(certRrl)
}
});
}else {
this.certImgFileList = [];
}
// 商标注册有效期
if(this.brandForm.brand_auth_time === 0) {
this.validityLongTermVal = true;
this.validityConcreteTime = '';
}else {
this.validityLongTermVal = false;
this.validityConcreteTime = this.timeFormatter(this.brandForm.brand_auth_time);
}
// 品牌授权期限
this.brandForm.brandAuthRangeTime = []
this.brandForm.brandAuthRangeTime.push(this.timeFormatter(this.brandForm.brand_start_time))
this.brandForm.brandAuthRangeTime.push(this.timeFormatter(this.brandForm.brand_end_time))
// 品牌厂商授权 图片
let factoryArr = [];
let factoryUrl = {};
factoryArr = this.brandForm.brand_auth.split(",");
if (factoryArr.length > 0) {
factoryArr.forEach(item=> {
factoryUrl = {};
if (item) {
factoryUrl.url = item
this.factoryImgFileList.push(factoryUrl)
}
});
}else {
this.factoryImgFileList = [];
}
// 品牌经营授权 图片
let shopArr = [];
let shopUrl = {};
shopArr = this.brandForm.brand_business_auth.split(",");
if (shopArr.length > 0) {
shopArr.forEach(item=> {
shopUrl = {};
if (item) {
shopUrl.url = item
this.shopImgFileList.push(shopUrl)
}
});
}else {
this.shopImgFileList = [];
}
}else {
this.$message({type: 'error',message: res.message ? res.message : '获取品牌失败' });
} }
this.loading = false;
}); });
}, },
/** 取消、关闭 新增,编辑 */
handleCancel() {
this.reset('brandForm')
this.isOpen = false;
},
/** 提交審核 */
handleSave(form) {
this.$refs[form].validate(valid => {
if(valid) {
// 入参数据
let brandsData = { brands: [] };
let data = {}
data['id'] = this.indexBrandId;
data['brand_type'] = this.brandForm.brand_type;
data['brand_cn'] = this.brandForm.brand_cn;
data['brand_en'] = this.brandForm.brand_en;
data['brand_number'] = this.brandForm.brand_number;
// 品牌logo图片处理
if(this.brandImgFileList.length > 0) {
for(let i = 0; i < this.brandImgFileList.length; i++) {
if(i === 0) {
data['brand_logo'] = this.brandImgFileList[i].url;
}else {
data['brand_logo'] += ',' + this.brandImgFileList[i].url;
}
}
}
// 商标注册证书图片
if(this.certImgFileList.length > 0) {
for(let a = 0; a < this.certImgFileList.length; a++) {
if(a === 0) {
data['brand_register_cert'] = this.certImgFileList[a].url;
}else {
data['brand_register_cert'] += ',' + this.certImgFileList[a].url;
}
}
}
// 品牌类型
data['brand_range'] = this.brandForm.brand_range
// 商标注册有效期
if (this.validityLongTermVal) {
data['brand_auth_time'] = 0;
}else {
data['brand_auth_time'] = new Date(this.validityConcreteTime).getTime() / 1000;
}
// 品牌 授权期限
if (Array.isArray(this.brandForm.brandAuthRangeTime) && this.brandForm.brandAuthRangeTime.length == 2) {
data['brand_start_time'] = new Date(this.brandForm.brandAuthRangeTime[0]).getTime() / 1000;
data['brand_end_time'] = new Date(this.brandForm.brandAuthRangeTime[1]).getTime() / 1000;
}
// 品牌商标授权 图片
if(this.factoryImgFileList.length > 0) {
for(let i = 0; i < this.factoryImgFileList.length; i++) {
if(i === 0) {
data['brand_auth'] = this.factoryImgFileList[i].url;
}else {
data['brand_auth'] += ',' + this.factoryImgFileList[i].url;
}
}
}
// 品牌经营授权 图片处理
if(this.shopImgFileList.length > 0) {
for(let i = 0; i < this.shopImgFileList.length; i++) {
if(i === 0) {
data['brand_business_auth'] = this.shopImgFileList[i].url;
}else {
data['brand_business_auth'] += ',' + this.shopImgFileList[i].url;
}
}
}
// 新增 品牌
if (this.indexBrandId == 0) {
// 入参 格式处理
brandsData.brands.push(data);
addBrandData(brandsData).then(res => {
if(res.code == 1) {
this.$message({ message: '新增成功', type: 'success'});
this.getList();
this.isOpen = false;
}else {
this.$message({ type: 'error', message: res.message ? res.message : "新增失败"});
}
});
}
// 修改 品牌
if (this.indexBrandId != 0) {
// 入参 格式处理
// brandsData.brands.push(data);
this.$confirm('确定要提交审核吗?提交审核后,品牌处于待审核状态,对应商品将做下架处理', '提示:', {
type: 'warning',
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(async() => {
let res = await upBrand(data)
if ( res.code == 1 ) {
this.$message({ message: '编辑成功', type: 'success'});
this.getList();
this.isOpen = false;
}else {
this.$message({ type: 'error', message: res.message ? res.message : "编辑失败"});
}
}).catch(() => {});
}
} // vilid end
})
},
/** 删除 品牌 */
deleteBrand(row) {
if (!row.id) { return }
let data = {
brand_ids: []
}
data.brand_ids.push(row.id);
this.$confirm('确定要删除品牌吗?品牌删除后,使用该品牌的商品也会作下架处理!', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(async() => {
let result = await delBrandData(data);
if(result.code == 1) {
this.$message({type:'success',message:'删除成功'});
this.getList()
}else {
this.$message({type:'error',message: result.message ? result.message : '删除成功'});
}
}).catch(()=> {});
},
/** 查询 */
handleQuery() {
this.queryParams.page = 1;
this.getList();
},
/** 商品注册有效期 具体时间 */
validityConcreteChange() {
if (this.validityConcreteTime) {
this.validityLongTermVal = false;
}
},
/** 商品注册有效期 长期 */
validityLongTermChange() {
if (this.validityLongTermVal) {
this.validityConcreteTime = null;
}
},
// 通用方法
/** 重置 编辑 表单*/
reset(formName){
if (this.$refs[formName]) {
this.$refs[formName].resetFields();
}else {
this.$nextTick(()=> {
this.$refs[formName].resetFields();
})
}
this.brandImgFileList= [];
this.certImgFileList= [];
this.factoryImgFileList= [];
this.shopImgFileList= [];
},
/** 上传图片 数量限制 */
limit1() {
this.$message({message: '最多上传1张图片', type: 'warning'});
},
/** 时间格式化 */
timeFormatter(timeVal) {
return dateFormat(timeVal *1000, 'Y-m-d')
},
/** 品牌 状态格式化 */
brandStatusFormatter(statusVal) {
let res = '';
if (statusVal == 0) {
res = '未审核'
}
if (statusVal == 1) {
res = '已通过'
}
if (statusVal == 2) {
res = '已拒绝'
}
if (statusVal == 3) {
res = '已过期'
}
return res;
},
/** 图片转换为base64位 */
getBase64(file) {
return new Promise(function(resolve, reject) {
let reader = new FileReader();
let imgResult = "";
reader.readAsDataURL(file);
reader.onload = function() {
imgResult = reader.result;
};
reader.onerror = function(error) {
reject(error);
};
reader.onloadend = function() {
resolve(imgResult);
};
});
},
/**********---------------------------------------------************************** */
// 品牌经营类型 改变触发 // 品牌经营类型 改变触发
chooseBrandType() { chooseBrandType() {
this.downTemplatehttp = ''; this.downTemplatehttp = '';
...@@ -489,9 +881,7 @@ ...@@ -489,9 +881,7 @@
chooseBrandRange() { chooseBrandRange() {
this.$refs.brandForm.clearValidate('brand_range'); this.$refs.brandForm.clearValidate('brand_range');
}, },
limitTwo() {
this.$message({message: '最多上传2张图片', type: 'warning'});
},
// 品牌商标图片 自定义上传 // 品牌商标图片 自定义上传
uploadLogoImgs(param) { uploadLogoImgs(param) {
this.getBase64(param.file).then((res) => { this.getBase64(param.file).then((res) => {
...@@ -644,322 +1034,14 @@ ...@@ -644,322 +1034,14 @@
} }
} }
}, },
} // methods end
// 授权有效期 二选一效果
validityConcrete() {
if (this.validityConcreteTime) {
this.validityLongTermVal = false;
}
},
validityLongTerm() {
if (this.validityLongTermVal) {
this.validityConcreteTime = null;
}
},
// 新增,修改,详情
handleAdd() {
if(this.total < 20 ) {
this.isOpen = true;
this.brandTitle = '新增品牌信息';
this.reset('brandForm');
this.brandForm.id = 0;
this.brandForm.brand_auth = '';
this.brandForm.brand_auth_time = '';
}else {
this.$message({ type: 'warning', message: '目前暂时只支持维护20个品牌数据!'});
}
},
/** 详情 */
handleDetails(row) {
this.isOpen = true;
this.brandTitle = '品牌信息详情';
const ids = row.id;
getDetails(ids).then(res => {
if(res.code && res.code === 1 && res.data) {
this.brandForm = res.data;
// 模板下载地址赋值
this.downTemplatehttp = (this.brandForm.brand_type === 1 ? this.shopTemplatehttp : this.factoryTemplatehttp);
// 商标logo图片处理
let brandList = {};
let brandArr = [];
if(this.brandForm.brand_logo.indexOf(",") > 0) {
brandArr = this.brandForm.brand_logo.split(",");
for(let a = 0; a < brandArr.length; a++){
brandList = {};
brandList.url = brandArr[a];
this.brandImgFileList.push(brandList);
}
}else {
brandList.url = this.brandForm.brand_logo;
this.brandImgFileList = [];
this.brandImgFileList.push(brandList);
}
// 商标注册证书处理 brand_register_cert
let certList = {};
let certArr = [];
if(this.brandForm.brand_register_cert.indexOf(",") > 0) {
certArr = this.brandForm.brand_register_cert.split(",");
for(let a = 0; a < certArr.length; a++){
certList = {};
certList.url = certArr[a];
this.certImgFileList.push(certList);
}
}else {
certList.url = this.brandForm.brand_register_cert;
this.certImgFileList = [];
this.certImgFileList.push(certList);
}
// 品牌授权 图片处理 factoryImgFileList
let factoryList = {};
let factoryArr = [];
if(this.brandForm.brand_auth.indexOf(",") > 0) {
factoryArr = this.brandForm.brand_auth.split(",");
for(let authIndex = 0; authIndex < factoryArr.length; authIndex++){
factoryList = {};
factoryList.url = factoryArr[authIndex];
this.factoryImgFileList.push(factoryList);
}
}else {
factoryList.url = this.brandForm.brand_auth;
this.factoryImgFileList = [];
this.factoryImgFileList.push(factoryList);
}
// 品牌经营授权 图片处理 shopImgFileList
let shopList = {};
let shopArr = [];
if(this.brandForm.brand_business_auth.indexOf(",") > 0) {
shopArr = this.brandForm.brand_business_auth.split(",");
for(let busIndex = 0; busIndex < shopArr.length; busIndex++){
shopList = {};
shopList.url = shopArr[busIndex];
this.shopImgFileList.push(shopList);
}
}else {
shopList.url = this.brandForm.brand_business_auth;
this.shopImgFileList = [];
this.shopImgFileList.push(shopList);
}
// 期限处理
if(this.brandForm.brand_auth_time === 0) {
this.validityLongTermVal = true;
}else {
this.validityConcreteTime = this.toStandTime(this.brandForm.brand_auth_time);
}
}else if(res.code === 0) {
if(res.msg) {
this.$message({message: res.msg, type: 'error'});
}else {
this.$message({message: '数据出错啦!', type: 'error'});
}
}
});
},
// 查询
handleQuery() {
this.queryParams.page = 1;
this.getList();
},
// 保存
handleSave(form) {
this.$refs[form].validate(valid => {
if(valid) {
let addBrandForm = {};
let toArrBrandForm = [];
if(this.validityLongTermVal) {
this.brandForm.brand_auth_time = (this.validityLongTermVal - 0 - 1);
}else if(this.validityLongTermVal === false && this.validityConcreteTime) {
this.brandForm.brand_auth_time = new Date(this.validityConcreteTime).getTime() / 1000;
}else {
this.brandForm.brand_auth_time = '';
}
// 品牌logo图片处理
if(this.brandImgFileList.length > 0) {
for(let i = 0; i < this.brandImgFileList.length; i++) {
if(i === 0) {
this.brandForm.brand_logo = this.brandImgFileList[i].url;
}else {
this.brandForm.brand_logo += ',' + this.brandImgFileList[i].url;
}
}
}
// 商标注册证书图片处理 certImgFileList
if(this.certImgFileList.length > 0) {
for(let i = 0; i < this.certImgFileList.length; i++) {
if(i === 0) {
this.brandForm.brand_register_cert = this.certImgFileList[i].url;
}else {
this.brandForm.brand_register_cert += ',' + this.certImgFileList[i].url;
}
}
}
// 品牌授权图片处理
if(this.factoryImgFileList.length > 0) {
for(let i = 0; i < this.factoryImgFileList.length; i++) {
if(i === 0) {
this.brandForm.brand_auth = this.factoryImgFileList[i].url;
}else {
this.brandForm.brand_auth += ',' + this.factoryImgFileList[i].url;
}
}
}
// 品牌经营授权 图片处理
if(this.shopImgFileList.length > 0) {
for(let i = 0; i < this.shopImgFileList.length; i++) {
if(i === 0) {
this.brandForm.brand_business_auth = this.shopImgFileList[i].url;
}else {
this.brandForm.brand_business_auth += ',' + this.shopImgFileList[i].url;
}
}
}
// 数据处理完毕
toArrBrandForm.push(this.brandForm);
addBrandForm.brands = toArrBrandForm;
// 新增/修改
if(this.brandForm.id === 0) {
addBrand(addBrandForm).then(res => {
if(res.code && res.code === 1) {
this.$message({ message: '新增成功', type: 'success'});
this.getList();
this.reset('brandForm');
this.isOpen = false;
}else if( res.code === 0) {
if(res.msg) {
this.$message({ message: res.msg, type: 'error'});
}else {
this.$message({ message: '新增失败', type: 'error'});
}
}
});
// 修改
}else {
this.$confirm('是否确认修改此数据项?', '提示:', {
type: 'warning',
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(() => {
this.edit(toArrBrandForm);
}).catch(() => {
this.isOpen = false;
});
}
}
})
},
/** 删除 品牌 */
deleteBrand(row) {
},
// 修改
edit(param) {
upBrand(param).then(res => {
if(res.code === 1) {
this.$message({ message: '修改成功', type: 'success'});
this.getList();
}else if( res.code === 0 ) {
if(res.msg) {
this.$message({
message: res.msg,
type: 'error'
});
}else {
this.$message({
message: '数据出错啦!',
type: 'error'
});
}
}
this.reset('brandForm');
this.isOpen = false;
});
},
// 取消
handleCancel(form) {
this.reset(form);
this.isOpen = false;
},
// -----------通用 方法----------
// 搜索参数处理
handleQueryParams(parmas) {
let newParmas = {};
// 对象深拷贝
newParmas = JSON.parse(JSON.stringify(parmas));
for(let key in newParmas){
if(key) {
if(newParmas[key] !== 0 && newParmas[key] !== '') {
if(!newParmas[key]) {
newParmas[key] = null;
}
}
}
}
return newParmas;
},
// 究极清空
reset(form){
if(this.$refs[form]) {
this.$refs[form].resetFields();
}else {
this.$nextTick(() => {
this.$refs[form].resetFields();
});
}
// 取消按钮,图片清空
this.brandImgFileList= [];
this.certImgFileList= [];
this.factoryImgFileList= [];
this.shopImgFileList= [];
},
// 图片转换为base64位
getBase64(file) {
return new Promise(function(resolve, reject) {
let reader = new FileReader();
let imgResult = "";
reader.readAsDataURL(file);
reader.onload = function() {
imgResult = reader.result;
};
reader.onerror = function(error) {
reject(error);
};
reader.onloadend = function() {
resolve(imgResult);
};
});
},
/** 时间格式化 */
timeFormatter(timeVal) {
return dateFormat(timeVal *1000, 'Y-m-d')
},
// 时间戳转换为 标准时间格式
toStandTime(val) {
let date = new Date(val * 1000)
let Y = date.getFullYear() + '-'
let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
const D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' '
const h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':'
const m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':'
const s = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds())
return Y + M + D + h + m + s;
},
}
} }
</script> </script>
<style lang="scss" type="text/stylus" scoped> <style lang="scss" type="text/stylus" scoped>
.brandInf-add { .brandInf-add {
/deep/.el-dialog { /deep/.el-dialog {
height: 80%; height: 85%;
overflow : hidden; overflow : hidden;
} }
/deep/.el-dialog__body{ /deep/.el-dialog__body{
...@@ -968,6 +1050,36 @@ ...@@ -968,6 +1050,36 @@
overflow-y: scroll; overflow-y: scroll;
} }
} }
.brand-status-con {
font-size: 16px;
margin: 0 10% 10px;
padding: 12px 20px;
border: 1px solid #00afff;
display : flex;
justify-content : normal;
align-items :center;
flex-direction : row;
}
.color-spe-success {
color: #67C23A;
font-size: 20px;
padding-top: 2px;
}
.color-spe-error {
color: #F56C6C;
font-size: 20px;
padding-top: 2px;
}
.color-spe-waiting {
color: #909399;
font-size: 20px;
padding-top: 2px;
}
.brand-form-status-text {
padding: 0 10px;
}
.btnCen { .btnCen {
/deep/.el-form-item__content { /deep/.el-form-item__content {
margin-left: 0!important; margin-left: 0!important;
......
...@@ -100,8 +100,8 @@ ...@@ -100,8 +100,8 @@
> >
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
</el-upload> </el-upload>
<el-dialog :visible.sync="dialogBackVisible"> <el-dialog :visible.sync="idcardBackVisible">
<img width="100%" :src="dialogBackImageUrl" alt=""> <img width="100%" :src="idcardBackImgUrl" alt="">
</el-dialog> </el-dialog>
</div> </div>
<div> <div>
...@@ -245,22 +245,22 @@ ...@@ -245,22 +245,22 @@
<!--编辑--> <!--编辑-->
<el-dialog title="编辑店铺信息" :visible.sync="isOpen" width="65%" class="shopinf-edit" <el-dialog title="编辑店铺信息" :visible.sync="isOpen" width="65%" class="shopinf-edit"
center :close-on-click-modal="false"> center :destroy-on-close="true" :close-on-click-modal="false" :before-close="handleCancel">
<el-form ref="editStoreForm" :model="editStoreForm" :rules="shopRules" label-width="180px" size="small"> <el-form v-if="isOpen" ref="editForm" :model="editForm" :rules="editRules" label-width="180px" size="small">
<el-form-item label="电商平台经验:" prop="is_business_experience"> <el-form-item label="电商平台经验:" prop="is_business_experience">
<el-radio-group v-model="storeForm.is_business_experience"> <el-radio-group v-model="editForm.is_business_experience">
<el-radio :label="1"></el-radio> <el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio> <el-radio :label="0"></el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="店铺名称:" prop="store_name" inline-message="true"> <el-form-item label="店铺名称:" prop="store_name" inline-message="true">
<el-input v-model="storeForm.store_name" style="width: 400px;" placeholder="请输入店铺名称"></el-input> <el-input v-model="editForm.store_name" style="width: 400px;" placeholder="请输入店铺名称"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="经营类目:" prop="scope"> <el-form-item label="经营类目:" prop="scope">
<el-select v-model="storeForm.scope" @remove-tag="removeTag" @visible-change="scopeVisibleChange($event)" multiple placeholder="请选择..." style="width: 400px;"> <el-select v-model="editForm.scope" @remove-tag="removeEditTag" @visible-change="editScopeVisibleChange($event)" multiple placeholder="请选择..." style="width: 400px;">
<el-option <el-option
v-for="item in scopeOptions" v-for="item in scopeOptions"
:key="item.id" :key="item.id"
...@@ -274,21 +274,21 @@ ...@@ -274,21 +274,21 @@
<div style="width:100%;height: 100%;display: flex;flex-direction: row;justify-content: normal;"> <div style="width:100%;height: 100%;display: flex;flex-direction: row;justify-content: normal;">
<div style="padding-right:6px;"> <div style="padding-right:6px;">
<el-upload <el-upload
:class="['uploadData',{ 'hiden-dom': logoImgFileList.length >= 1 }]" :class="['uploadData',{ 'hiden-dom': editLogoImgFileList.length >= 1 }]"
action="#" action="#"
list-type="picture-card" list-type="picture-card"
:limit="1" :limit="1"
:on-exceed="showTip1" :on-exceed="showTip1"
:before-upload = "beforeUpImg" :before-upload = "beforeUploadLogoImg"
:http-request="uploadLogoImgs" :http-request="uploadShopLogoImg"
:on-preview="handlePictureCardPreview" :on-preview="handleEditShopLogoView"
:on-remove="handleRemove" :on-remove="removeEditShopLogoImg"
:file-list = 'logoImgFileList' :file-list = 'editLogoImgFileList'
> >
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
</el-upload> </el-upload>
<el-dialog :visible.sync="dialogVisible" append-to-body> <el-dialog :visible.sync="isEditShopLogoVisible" append-to-body>
<img width="100%" :src="dialogImageUrl" alt=""> <img width="100%" :src="editShopLogoImgUrl" alt="">
</el-dialog> </el-dialog>
</div> </div>
<div> <div>
...@@ -303,11 +303,11 @@ ...@@ -303,11 +303,11 @@
</el-form-item> </el-form-item>
<el-form-item label="运营负责人:" prop="emergency_name" inline-message="true"> <el-form-item label="运营负责人:" prop="emergency_name" inline-message="true">
<el-input v-model="storeForm.emergency_name" style="width: 400px;" placeholder="请输入运营负责人姓名"></el-input> <el-input v-model="editForm.emergency_name" style="width: 400px;" placeholder="请输入运营负责人姓名"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="联系电话:" prop="emergency_tel"> <el-form-item label="联系电话:" prop="emergency_tel">
<el-input v-model="storeForm.emergency_tel" style="width: 400px;" placeholder="请输入联系电话"></el-input> <el-input v-model="editForm.emergency_tel" style="width: 400px;" placeholder="请输入联系电话"></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
...@@ -317,14 +317,14 @@ ...@@ -317,14 +317,14 @@
<el-form-item label="其他资质:"> <el-form-item label="其他资质:">
<div class="auth-con"> <div class="auth-con">
<div v-for="(item,index) in qualificationList" :key="item.id" class="single-upload-con"> <div v-for="(item,index) in editQualificationList" :key="item.id" class="single-upload-con">
<div v-show="!item.url" class="single-auth-img" @click="upPreSpeImg(index)"></div> <div v-show="!item.url" class="single-auth-img" @click="upPreAuthImg(index)"></div>
<div v-show="item.url" class="single-auth-img-con"> <div v-show="item.url" class="single-auth-img-con">
<img class="auth-spec-img" :src="item.url" alt="" /> <img class="auth-spec-img" :src="item.url" alt="" />
<span class="span-img-del-loading"> <span class="span-img-del-loading">
<span class="span-img-del el-icon-zoom-in zoom-span-block" @click="viewSingleSpecImg(index,item)"></span> <span class="span-img-del el-icon-zoom-in zoom-span-block" @click="viewSingleAuthImg(index,item)"></span>
<span class="span-img-del el-icon-delete del-span-block" @click="delSingleSpecImg(index,item)"></span> <span class="span-img-del el-icon-delete del-span-block" @click="delSingleAuthImg(index,item)"></span>
</span> </span>
</div> </div>
<div class="single-title">{{ authTitleFormatter(item.content) }}</div> <div class="single-title">{{ authTitleFormatter(item.content) }}</div>
...@@ -343,7 +343,7 @@ ...@@ -343,7 +343,7 @@
</el-form> </el-form>
</el-dialog> </el-dialog>
<!-- 图片预览 --> <!-- 资质图片预览 -->
<el-dialog <el-dialog
:visible.sync="imgDialog" :visible.sync="imgDialog"
:destroy-on-close="true" :destroy-on-close="true"
...@@ -359,6 +359,7 @@ ...@@ -359,6 +359,7 @@
<script> <script>
import {getGoodsType, getMainInf, getShopInf, upLoadImg, addShopInf, getUploadQualificationListData} from '@/api/module/entry'; import {getGoodsType, getMainInf, getShopInf, upLoadImg, addShopInf, getUploadQualificationListData} from '@/api/module/entry';
import { dateFormat } from '@/utils'
export default { export default {
name: "Shop", name: "Shop",
data() { data() {
...@@ -440,30 +441,16 @@ ...@@ -440,30 +441,16 @@
imgDialog: false, imgDialog: false,
// 编辑 // 编辑
isOpen: false, isOpen: false,
//-------------------------
dialogVisible: false,
// --------------------
dialogImageUrl2: '',
dialogVisible2: false,
dialogBackImageUrl: '',
dialogBackVisible: false,
logoFileList: [], // 店铺logo
businessFileList: [], // 其他资质
shopRules: {},
businessImgFileList: [],
editForm: { editForm: {
is_business_experience: 0, is_business_experience: '',
store_name: '', store_name: '',
scope: [], scope: [],
shop_logo: '', shop_logo: '',
business_auth: '',
emergency_name: '', emergency_name: '',
emergency_tel: '',
business_auth: '',
}, },
eidtRules: { editRules: {
store_name: [{required: true, message: '店铺名称不能为空', trigger: 'blur'}], store_name: [{required: true, message: '店铺名称不能为空', trigger: 'blur'}],
scope: [{required: true, message: '经营类目至少选择一种', trigger: 'change'}], scope: [{required: true, message: '经营类目至少选择一种', trigger: 'change'}],
shop_logo: [{required: true, message: '店铺Logo至少上传一张图片', validator: logoValidator}],// shop_logo: [{required: true, message: '店铺Logo至少上传一张图片', validator: logoValidator}],//
...@@ -474,6 +461,12 @@ ...@@ -474,6 +461,12 @@
], ],
business_auth: [{required: true, message: '店铺Logo至少上传一张图片', validator: busAuthValidator}],// business_auth: [{required: true, message: '店铺Logo至少上传一张图片', validator: busAuthValidator}],//
}, },
// 编辑 店铺logo
editLogoImgFileList: [],
isEditShopLogoVisible: false,
editShopLogoImgUrl: '',
// 编辑 资质
editQualificationList: [],
} }
}, // data end }, // data end
...@@ -488,12 +481,6 @@ ...@@ -488,12 +481,6 @@
this.getShop(); this.getShop();
}, },
methods: { methods: {
// 图片只预览
getPreviewImgList(ele) {
let arr = [];
arr.push(ele);
return arr;
},
/** 获取 主体即企业 信息 */ /** 获取 主体即企业 信息 */
getMain() { getMain() {
getMainInf().then(res => { getMainInf().then(res => {
...@@ -633,47 +620,13 @@ ...@@ -633,47 +620,13 @@
} }
}); });
}, },
/** 编辑 */
handleEdit() {
getShopInf().then(res=> {
/** 预览 营业执照 */ if (res.code == 1) {
handleLicenseImgview(file) { this.isOpen = true;
this.licenseImgUrl = file.url; this.editForm = res.data
this.isLicenseVisible = true; // 经营类目 数据处理
},
/** 预览 身份证 正面 */
handleIdcardPositiveImgview(file) {
this.idcardPositiveImgUrl = file.url;
this.idcardPositiveVisible = true;
},
/** 预览 身份证 反面 */
handleIdcardBackImgview(file) {
this.idcardBackImgUrl = file.url;
this.idcardBackVisible = true;
},
/** 预览 店铺 logo */
handleShopLogoPreview(file) {
this.shopLogoImgUrl = file.url;
this.shopLogoVisible = true;
},
/** 预览 当前资质对应图片 */
viewSingleSpecImg(index,item) {
this.imgDialog = false;
if (!item.url) return;
this.imgDialog = true;
this.qualificationUrl = item.url
},
// 修改 店铺信息的 回显数据
showShopInf() {
getShopInf().then(res => {
if (res.code === 1 && res.data) {
// 店铺信息修改 start
//this.editForm = res.data;
this.editForm.scope = [];
if (res.data.scope === '') { if (res.data.scope === '') {
this.editForm.scope = []; this.editForm.scope = [];
} else { } else {
...@@ -687,223 +640,121 @@ ...@@ -687,223 +640,121 @@
} }
// 店铺logo回显处理 // 店铺logo回显处理
let logoList = {}; let logoImgArr = [];
let eidtLogoArr = []; let logoImgUrl = {};
if (this.editForm.shop_logo.indexOf(",") > 0) { logoImgArr = this.editForm.shop_logo.split(",");
eidtLogoArr = this.editForm.shop_logo.split(","); if (logoImgArr.length > 0) {
for (let a = 0; a < eidtLogoArr.length; a++) { logoImgArr.forEach(item=> {
logoList = {}; logoImgUrl = {};
logoList.url = eidtLogoArr[a]; if (item) {
this.logoImgFileList.push(logoList); logoImgUrl.url = item
} this.editLogoImgFileList.push(logoImgUrl)
} else if (this.editForm.shop_logo) { }
logoList.url = this.editForm.shop_logo; });
this.logoImgFileList = []; }else {
this.logoImgFileList.push(logoList); this.editLogoImgFileList = [];
} else {
this.logoImgFileList = [];
} }
// 资质图片回显处理 // 资质图片回显处理
let businessList = {}; this.editQualificationList = this.editForm.qualification ? this.editForm.qualification : [];
let editBusArr = [];
if (this.editForm.business_auth.indexOf(",") > 0) {
editBusArr = this.editForm.business_auth.split(",");
for (let a = 0; a < editBusArr.length; a++) {
businessList = {};
businessList.url = editBusArr[a];
this.businessImgFileList.push(businessList);
}
} else if (this.editForm.business_auth) {
businessList.url = this.editForm.business_auth;
this.businessImgFileList = [];
this.businessImgFileList.push(businessList);
} else {
this.businessImgFileList = [];
}
// 店铺信息修改 end
} else if (res.code === 0 && res.msg) {
this.$message({
message: res.msg,
type: 'error'
});
} else { } else {
this.$message({ this.$message({type: 'error', message: res.msg ? res.msg : '获取店铺信息失败' });
message: "数据有误!",
type: 'error'
});
} }
}); });
}, },
// 编辑 /** 关闭/取消 编辑 */
handleEdit() { handleCancel() {
this.isOpen = true; this.resetEditForm('editForm');
this.showShopInf(); this.isOpen = false;
}, },
// 保存 /** 提交审核 */
handleAdd(formName) { handleAdd(formName) {
this.$confirm('确定要修改信息吗?信息修改后需要重新提交审核,审核周期约1-3个工作日。', '提示:', { // 其他 资质 填写拦截校验
type: 'warning', let isComplete = false;
confirmButtonText: '确定', if (this.editQualificationList.length > 0) {
cancelButtonText: '取消' for (let i = 0; i < this.editQualificationList.length; i++) {
}).then(() => { if (!this.editQualificationList[i].url) {
this.save(formName); isComplete = true;
}).catch(() => { break
this.reset('editForm');
});
},
save(formName) {
let scoprStr = '';
for (let i = 0; i < this.editForm.scope.length; i++) {
scoprStr += this.editForm.scope[i] + ',';
}
this.editForm.scope = scoprStr.substring(0, scoprStr.length - 1);
// shop_logo图片地址字段
if (this.logoImgFileList.length > 0) {
for (let i = 0; i < this.logoImgFileList.length; i++) {
if (i === 0) {
this.editForm.shop_logo = this.logoImgFileList[i].url;
} else {
this.editForm.shop_logo += ',' + this.logoImgFileList[i].url;
} }
} }
}
// 其他资质图片字段处理 if (isComplete) {
if (this.businessImgFileList.length > 0) { this.$message({type:'warning',message: '请上传对应资质所需的图片'});
for (let i = 0; i < this.businessImgFileList.length; i++) { return;
if (i === 0) {
this.editForm.business_auth = this.businessImgFileList[i].url;
} else {
this.editForm.business_auth += ',' + this.businessImgFileList[i].url;
}
} }
} }
// business_auth: '',
let data = {};
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
if (valid) { if (valid) {
addShopInf(this.editForm).then(res => { data['is_business_experience'] = this.editForm.is_business_experience;
if (res.code === 1) { data['store_name'] = this.editForm.store_name;
this.getShop(); data['emergency_name'] = this.editForm.emergency_name;
this.$message({message: '店铺信息修改成功', type: 'success'}); data['emergency_tel'] = this.editForm.emergency_tel;
this.isOpen = false; data['scope'] = this.editForm.scope.join(',');
} else if (res.code === 0 && res.msg) { // 编辑 的店铺logolist
// 处理 scope数据格式冲突 if(this.editLogoImgFileList.length > 0) {
if (this.editForm.scope === '') { for(let i = 0; i < this.editLogoImgFileList.length; i++) {
this.editForm.scope = []; if(i === 0) {
} else { data['shop_logo'] = this.editLogoImgFileList[i].url;
let scopeListStr = this.editForm.scope.split(','); }else {
let scopeList = []; data['shop_logo'] += ',' + this.editLogoImgFileList[i].url;
for (let i = 0; i < scopeListStr.length; i++) {
scopeList.push(parseInt(scopeListStr[i]));
}
this.editForm.scope = scopeList;
} }
if (res.msg) {
this.$message({
message: res.msg,
type: 'error'
});
} else {
this.$message({
message: "数据开小差了,请稍后重试",
type: 'error'
});
}
}
});
} else {
// 因 scope字段是selcet的绑定值,必须为数组类型,但是,在传给后台的时候,是字符串类型,传入的时候需要处理,回显的时候也需要处理
// 在校验时候就产出了这个bug,校验不通过的话,他已经被处理为字符串了,不通过的话,还原格式,不能还原数据
//this.storeForm.scope = [];
if (this.storeForm.scope === '') {
this.storeForm.scope = [];
} else {
let scopeListStr = this.storeForm.scope.split(',');
let scopeList = [];
for (let i = 0; i < scopeListStr.length; i++) {
scopeList.push(parseInt(scopeListStr[i]));
} }
this.storeForm.scope = scopeList;
} }
} data['qualification_auth'] = JSON.stringify(this.editQualificationList)
});
}, this.$confirm('确定要修改信息吗?信息修改后需要重新提交审核,审核周期约1-3个工作日', '提示:', {
// 取消 type: 'warning',
handleCancel() { confirmButtonText: '确定',
this.resetForm('editForm'); cancelButtonText: '取消'
this.isOpen = false; }).then(() => {
}, addShopInf(data).then(res=> {
showTip1(files, fileList) { if (res.code == 1) {
this.$message({message: '最多上传1张图片', type: 'warning'}); this.$message({type: 'success',message: '编辑成功'});
this.isOpen = false;
this.getShop();
}else {
this.$message({type: 'error',message: res.message ? res.message : '操作失败'});
}
});
}).catch(() => {});
} // valid true 通过 end
})
}, },
showTip20(files, fileList) { /** 预览 营业执照 */
this.$message({message: '最多上传20张图片', type: 'warning'}); handleLicenseImgview(file) {
this.licenseImgUrl = file.url;
this.isLicenseVisible = true;
}, },
/** 预览 身份证 正面 */
/** 上传 营业执照图片 */ handleIdcardPositiveImgview(file) {
uploadLicenseImages(param) { this.idcardPositiveImgUrl = file.url;
this.getBase64(param.file).then((res) => { this.idcardPositiveVisible = true;
let result = res.split(",");
this.Base64img = result[1];
let data = {"img_data": this.Base64img};
upLoadImg(data).then((res) => {
if (res.code == 1) {
this.licenseImgFileList.push({'url': res.data.image_url});
this.$message({type: 'success', message: '上传成功'});
this.$refs.mainForm.clearValidate('license');
// 图片识别
this.readLicenseImgInfo(this.licenseImgFileList);
} else {
this.$message({type: 'error', message: res.message ? res.message : '上传失败'});
}
});
});
}, },
// handlePictureCardPreview(file) { /** 预览 身份证 反面 */
// this.dialogImageUrl = file.url; handleIdcardBackImgview(file) {
// this.dialogVisible = true; this.idcardBackImgUrl = file.url;
// }, this.idcardBackVisible = true;
handleRemove(file, fileList) {
for (let i = 0; i < this.licenseImgFileList.length; i++) {
if (file.uid === this.licenseImgFileList[i].uid) {
this.licenseImgFileList.splice(i, 1);
}
}
}, },
/** 预览 店铺 logo */
// 上传店铺logo图片 handleShopLogoPreview(file) {
uploadLogoImgs(param) { this.shopLogoImgUrl = file.url;
this.getBase64(param.file).then((res) => { this.shopLogoVisible = true;
let result = res.split(",");
this.Base64img = result[1];
let data = {"img_data": this.Base64img};
upLoadImg(data).then((res) => {
if (res && res.code == 1) {
this.logoImgFileList.push({'url': res.data.image_url});
this.$message({message: '上传成功', type: 'success'});
this.$refs.storeForm.clearValidate('shop_logo');
}
});
});
}, },
// 上传资质图片 /** 预览 当前资质对应图片 */
uploadBusinessImgs(param) { viewSingleSpecImg(index,item) {
this.getBase64(param.file).then((res) => { this.imgDialog = false;
let result = res.split(","); if (!item.url) return;
this.Base64img = result[1]; this.imgDialog = true;
let data = {"img_data": this.Base64img}; this.qualificationUrl = item.url
upLoadImg(data).then((res) => {
if (res && res.code == 1) {
this.businessImgFileList.push({'url': res.data.image_url});
this.$message({message: '上传成功', type: 'success'});
this.$refs.storeForm.clearValidate('business_auth');
}
});
});
}, },
// 店铺logo图片上传格式和大小的校验 /** 上传 店铺logo 格式和大小的校验 */
beforeUpImg(file) { beforeUploadLogoImg(file) {
let isImgSize = (file.size / 1024) > 500; let isImgSize = (file.size / 1024) > 500;
if (file.type !== "image/png" && file.type !== "image/jpg" && file.type != "image/jpeg") { if (file.type !== "image/png" && file.type !== "image/jpg" && file.type != "image/jpeg") {
this.$message({ this.$message({
...@@ -920,189 +771,119 @@ ...@@ -920,189 +771,119 @@
return false; return false;
} }
}, },
// 其他资质图片上传 校验 /** 上传 店铺logo图片 */
// beforeUpBusImg(file) { uploadShopLogoImg(param) {
// let isImgSize = (file.size / 1024 /1024) > 2;
// if(file.type !== "image/png" && file.type !== "image/jpg" && file.type != "image/jpeg") {
// this.$message({
// message: '上传图片格式只支持png/png格式',
// type: "warning"
// });
// return false;
// }
// if(isImgSize) {
// this.$message({
// message: '上传图片大小不能超过2M',
// type: "warning"
// });
// return false;
// }
// },
// handlePictureCardPreview(file) {
// this.dialogImageUrl = file.url;
// this.dialogVisible = true;
// },
// handleRemove(file,fileList) {
// for(let i = 0; i < this.logoImgFileList.length; i++) {
// if(file.uid === this.logoImgFileList[i].uid) {
// this.logoImgFileList.splice(i,1);
// }
// }
// },
/** 上传身份证 正面 */
uploadIdcardPositive(param) {
this.getBase64(param.file).then((res) => { this.getBase64(param.file).then((res) => {
let result = res.split(","); let result = res.split(",");
this.Base64img = result[1]; this.Base64img = result[1];
let data = {"img_data": this.Base64img}; let data = {"img_data": this.Base64img};
upLoadImg(data).then((res) => { upLoadImg(data).then((res) => {
if (res.code == 1) { if (res && res.code == 1) {
this.idcardImgFileList.push({'url': res.data.image_url}); this.logoImgFileList.push({'url': res.data.image_url});
this.$message({type: 'success', message: '上传成功'}); this.$message({message: '上传成功', type: 'success'});
this.$refs.mainForm.clearValidate('idcard_front'); this.$refs.storeForm.clearValidate('shop_logo');
this.readIdcardPositive(this.idcardImgFileList);
} else {
this.$message({type: 'error', message: res.message ? res.message : '上传失败'});
} }
}); });
}); });
}, },
/** 识别 身份证 正面 */ /** 编辑 预览 店铺logo 图片 */
readIdcardPositive(fileList) { handleEditShopLogoView(file) {
if (!Array.isArray(fileList) || !fileList[0].url) return this.editShopLogoImgUrl = file.url;
let data = {img: fileList[0].url} this.isEditShopLogoVisible = true;
getIdcardImgInfoData(data).then(res => {
if (res.code == 1) {
this.mainForm.real_name = res.data.words_result['姓名'].words ? res.data.words_result['姓名'].words : '';
this.mainForm.idcard_number = res.data.words_result['公民身份号码'].words ? res.data.words_result['公民身份号码'].words : '';
}
});
}, },
// handlePictureCardPreview2(file) { /** 编辑 删除 店铺logo 图片 */
// this.dialogImageUrl2 = file.url; removeEditShopLogoImg(file) {
// this.dialogVisible2 = true; for (let i = 0; i < this.editLogoImgFileList.length; i++) {
// }, if (file.uid === this.editLogoImgFileList[i].uid) {
handleRemove2(file, fileList) { this.editLogoImgFileList.splice(i, 1);
for (let i = 0; i < this.idcardImgFileList.length; i++) {
if (file.uid === this.idcardImgFileList[i].uid) {
this.idcardImgFileList.splice(i, 1);
} }
} }
}, },
/** 上传身份证 反面 */ /** 上传 对应资质图片 */
uploadIdcardBack(param) { upPreAuthImg(index) {
this.getBase64(param.file).then((res) => { let domRef = "hxz" + index;
this.$refs[domRef][0].value = '';
this.$refs[domRef][0].click();
},
/** 真正的上传图片方法,原生input */
changeIMG(index, item) {
let curItem = item;
let inputDom = "hxz" + index;
let file = this.$refs[inputDom][0].files[0];
if( file.size > 1024 * 1024 * 3 ) {
this.$message({ type: 'error',message: '规格图片不能大于 3 M'});
return;
}
this.getBase64(file).then((res) => {
let result = res.split(","); let result = res.split(",");
this.Base64img = result[1]; this.Base64img = result[1];
let data = {"img_data": this.Base64img}; let data = {"img_data": this.Base64img}
upLoadImg(data).then((res) => { upLoadImg(data).then(res => {
if (res.code == 1) { if (res && res.code == 1) {
this.idcardBackImgFileList.push({'url': res.data.image_url}); curItem.url = res.data.image_url;
this.$message({type: 'success', message: '上传成功'}); // this.singleSpecImgList.push({'url': res.data.image_url})
this.$refs.mainForm.clearValidate('idcard_back'); this.$message({ message:'上传成功',type:'success'});
this.readIdcardBack(this.idcardBackImgFileList); }else {
} else { this.$message({ message:'上传失败,请重新上传',type:'error'});
this.$message({type: 'error', message: res.message ? res.message : '上传失败'});
}
});
});
},
/** 识别 身份证 反面 */
readIdcardBack(fileList) {
if (!Array.isArray(fileList) || !fileList[0].url) return
let data = {img: fileList[0].url}
getIdcardImgInfoData(data).then(res => {
if (res.code == 1) {
// 身份证 有效 XXXXXXXX日 => xx-xx-xx
let endStr = res.data.words_result['失效日期'].words ? res.data.words_result['失效日期'].words : '';
if (endStr == '长期') {
this.validityConcreteTime = [];
this.validityLongTermVal = true;
} else {
let beginStr = res.data.words_result['签发日期'].words ? res.data.words_result['签发日期'].words : '';
let reg = /^(\d{4})(\d{2})(\d{2})$/;
let begin = beginStr.replace(reg, "$1-$2-$3");
let end = endStr.replace(reg, "$1-$2-$3");
this.validityConcreteTime = [];
this.validityConcreteTime.push(begin);
this.validityConcreteTime.push(end);
this.validityLongTermVal = false;
} }
} })
}); });
}, },
/** 预览 身份证反面 */ /** 查看 当前资质图片 */
handleIdcardBackPreview(file) { viewSingleAuthImg(index,item) {
this.dialogBackImageUrl = file.url; this.imgDialog = false;
this.dialogBackVisible = true; // this.qualificationUrl = "";
}, if (!item.url) return;
/** 删除 身份证反面 */ this.imgDialog = true;
handleBackRemove2(file) { this.qualificationUrl = item.url
for (let i = 0; i < this.idcardBackImgFileList.length; i++) {
if (file.uid === this.idcardBackImgFileList[i].uid) {
this.idcardBackImgFileList.splice(i, 1);
}
}
},
/** 营业期限 选择区间时间时 */
periodLongTermChange() {
if (Array.isArray(this.periodConcreteTime) && this.periodConcreteTime.length == 2) {
this.periodLongTermVal = false;
}
},
/** 营业期限 选择 长期时 */
periodConcreteChange() {
if (this.periodLongTermVal) {
this.periodConcreteTime = [];
}
},
/** 身份证有效期 选择区间时间时 */
validityConcreteTimeChange() {
if (Array.isArray(this.validityConcreteTime) && this.validityConcreteTime.length == 2) {
this.validityLongTermVal = false;
}
}, },
/** 身份证有效期 选择 长期时 */ /** 删除 当前图片 */
validityLongTermValChange() { delSingleAuthImg(index,item) {
if (this.validityLongTermVal) { if( item.url ) {
this.validityConcreteTime = []; item.url = '';
this.$message({type: 'success',message: '删除成功'});
} }
}, },
/** 删除单个 经营类目 触发 */ /** 删除单个 经营类目 触发 */
removeTag(indexVal) { removeEditTag(indexVal) {
if (!indexVal) return; if (!indexVal) return;
if (this.storeForm.scope.length == 0) { if (this.editForm.scope.length == 0) {
this.qualificationList = []; this.editQualificationList = [];
} }
if (this.storeForm.scope.length > 0) { if (this.editForm.scope.length > 0) {
let data = { cate_ids: this.storeForm.scope } let data = { cate_ids: this.editForm.scope }
getUploadQualificationListData(data).then(res=> { getUploadQualificationListData(data).then(res=> {
if (res.code == 1) { if (res.code == 1) {
this.qualificationList = res.data ? res.data : []; this.editQualificationList = res.data ? res.data : [];
} }
}) })
} }
}, },
/** 经营类目 下拉框隐藏时候,触发 */ /** 经营类目 下拉框隐藏时候,触发 */
scopeVisibleChange(handleType) { editScopeVisibleChange(handleType) {
if (!handleType) { if (!handleType) {
if (Array.isArray(this.storeForm.scope) && this.storeForm.scope.length > 0) { if (Array.isArray(this.editForm.scope) && this.editForm.scope.length > 0) {
let data = { cate_ids: this.storeForm.scope } let data = { cate_ids: this.editForm.scope }
getUploadQualificationListData(data).then(res=> { getUploadQualificationListData(data).then(res=> {
if (res.code == 1) { if (res.code == 1) {
this.qualificationList = res.data ? res.data : []; this.editQualificationList = res.data ? res.data : [];
} }
}) })
} }
} }
}, },
/** 初始化 编辑 表单 */
resetEditForm(formName) {
this.$refs[formName].resetFields();
this.editQualificationList = [];
this.editLogoImgFileList = [];
},
// 图片转换为base64位 // --- 通用 ---
/** 图片转换为base64位 */
getBase64(file) { getBase64(file) {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
let reader = new FileReader(); let reader = new FileReader();
...@@ -1119,34 +900,29 @@ ...@@ -1119,34 +900,29 @@
}; };
}); });
}, },
/** 时间戳转换为 标准时间格式 */
formatterTime(time) {
return dateFormat(time *1000, 'Y-m-d')
},
/** 上传图片限制 1张 */
showTip1() {
this.$message({message: '最多上传1张图片', type: 'warning'});
},
/** 资质类目 title格式化 */ /** 资质类目 title格式化 */
authTitleFormatter(textVal) { authTitleFormatter(textVal) {
let res = '',resoult = ''; let res = '';
if (textVal) { if (textVal) {
res = textVal.trim(); res = textVal.trim();
// if(textVal.left(0) == '《') {
//
// }
// if(textVal.right(0) == '《') {
//
// }
// console.log(111,textVal.left(0));
// console.log(222,textVal.right(0));
} }
return res return res
}, },
// /** 图片只预览 */
// getPreviewImgList(ele) {
// let arr = [];
// arr.push(ele);
// return arr;
// },
// 时间戳转换为 标准时间格式
toStandTime(val) {
let date = new Date(val * 1000)
let Y = date.getFullYear() + '-'
let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
const D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' '
const h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':'
const m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':'
const s = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds())
return Y + M + D + h + m + s;
},
} }
} }
</script> </script>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论