123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501 |
- var isPC = ($(window).width()>768);
- var fleaMarketForm = new Vue({
- el:'#fleaMarketForm',
- mixins: [cmSysVitaMixins],
- data:{
- fenlei:[
- {name:'二手仪器',value:1},
- // {name:'临期产品',value:2},
- {name:'其他',value:3},
- ],
- radioList:[
- {name:'美容仪器',value:1,isChecked:true}
- ],
- publisherActions:[
- {name:'个人身份',value:1,isChecked:false},
- {name:'公司身份',value:2,isChecked:false}
- ],
- beauty:[
- {name:'医美',value:1},
- {name:'非医美',value:2},
- ],
- currentId:0,
- handleCurrent:1,
- BrandList:[],
- isShow:false,
- includedTax:'',
- GoodsImagesList:[],
- oldNum:0,
- secondType:0,
- vShow_GoodsImages:false,
- fromMessage:'',//提示文字
- formData:new FormData(),
- secondParams:{
- publishIdentity:1, // 发布者身份 1.个人身份 2.公司身份
- secondHandType:'',//一级分类
- instrumentType:1,//二手仪器分类
- name:'',
- brandId:'',//品牌ID
- brandName:'',//其他品牌
- fixedYears:null,//出厂
- companyName:'',//公司名称
- // maturityYears:'',//产品到期
- price:'',//交易价
- announType:2,//发布类型 1.二手预成交商品 2.二手估价商品
- detailTalkFlag:1,//是否启用详聊
- // normalPrice:'',//市场价
- // originalPrice:'',//采购价
- // stock:'',//数量
- productQuality:'',//商品成色
- fileType:'', // 商品包含文件类型
- contactName:'',//联系人
- contactMobile:'',//联系方式
- checkCode:'', // 联系人手机验证码
- cardNumber:'',// 收款账号
- secondProductType:'',//
- townId:'',//县区地址
- address:'',//详细地址
- image:'',//图片
- productDetails:'',//商品详细信息
- source:1,
- dockingPeopleMobile:'',
- dockingPeopleName:'',
- authenticationImage:'',//身份证正面照片
- authenticationBackImage:'',//身份证反面照片
- licenseImage:'',//营业执照照片
- commitmentImage:'',//承诺函图片
- fileName:'',//文件名称
- ossName:'',//文件OSS名称
- },
- brandname:'请选择',
- checkbox:false,
- shoplogoTwo:false,
- provinceIndex:'',
- provinceArray:[],
- cityArray: [],//市
- townArray: [],//区
- from: {
- name:'',
- province: '',//省id
- city: '',
- town: ''
- },
- TypeList:'',
- playid:'',
- checkVal:[],
- resultBj:false,
- vShow_PublishIdentity:false,
- vShow_detailTalkFlag:false,
- vShow_secondHandType:false,
- vShow_instrumentType:false,
- vShow_BrandID:false,
- vShow_Name:false,
- vShow_companyName:false,
- vShow_shopColor:false,
- vShow_contactName:false,
- vShow_contactMobile:false,
- vShow_checkCode:false,
- vShow_caimeiMobile:false,
- vShow_Address:false,
- vShow_TownId:false,
- vShow_Market:false,
- vShow_original:false,
- vShow_Number:false,
- vShow_expire:false,
- vShow_detailInfoEditor:true,
- vShow_GoodsImages:false,
- vShow_checkBox:false,
- selectBrand:false,
- PopupShow:false,
- tipsContentText:'发布二手商品,采美需要收取您每个商品100元的展示费,展示期为3个月支付完成后,商品会在1-2个工作日内进行审核,审核通过后,商品会立即上线',
- cancelButtonText:'取消发布',
- confirmButtonText:'去支付',
- isButtonsType:0,
- mobilCount:0,
- mobileCodeText:'获取验证码',
- mobilTime:null,
- isMobileDisabled:true,
- },
- methods:{
- showBrand:function(){
- var _this = this;
- _this.selectBrand = !_this.selectBrand;
- },
- hadldPublishIdentity: function(item) {
- var _this = this;
- _this.handleCurrent = item.value;
- _this.secondParams.publishIdentity = item.value;
- },
- secondHandRidio: function(item) {
- var _this = this;
- _this.currentId = item.value;
- _this.secondParams.secondHandType = item.value;
- if (item.value==1){
- _this.isShow = true;
- }else {
- _this.isShow = false;
- }
- },
- secondHandType:function(item){ //二手仪器
- item.isChecked = ! item.isChecked;
- var _this = this;
- if(item.isChecked){
- _this.checkVal.push(item.value);
- _this.secondParams.instrumentType = _this.checkVal.toString();
- } else {
- _this.checkVal.splice(_this.checkVal.indexOf(item.value), 1);
- _this.secondParams.instrumentType = _this.checkVal.toString();
- }
- },
- ChangeBrand:function(item){ //品牌列表
- var _this = this;
- _this.brandname = item.name;
- _this.secondParams.brandId = item.id;
- if(_this.secondParams.brandId==161){
- _this.shoplogoTwo = true;
- }else {
- _this.shoplogoTwo = false;
- }
- },
- Detailed:function(){
- var _this = this;
- if(event.target.checked==true){
- _this.secondParams.detailTalkFlag = 2 ;//启用价格详聊
- _this.vShow_detailTalkFlag = true;
- }else {
- _this.secondParams.detailTalkFlag = 1 ;//不启用价格详聊
- _this.vShow_detailTalkFlag = false;
- }
- },
- dragstart: function(value) { // 记录初始信息
- this.oldNum = value;
- },
- uploadGoodsImagesFn: function(event){//上传商品图片
- var _this = this;
- var inputDOM = _this.$refs.goodsImages;
- var file = inputDOM.files[0];
- var size = file.size;
- if(size > 5242880){//限制了文件的大小5MB
- CAIMEI.dialog('图片不能超过5M');
- event.target.value = '';
- return;
- }
- _this.formData.append('file', file);
- SecondApi.uploadimg(_this.formData,function(response){
- _this.GoodsImagesList.push(response.data);
- _this.secondParams.image =_this.GoodsImagesList.toString()+',';
- event.target.value = '';
- });
- },
- removeGoodsImagesFn: function(index){//删除商品图片
- var _this = this;
- _this.GoodsImagesList.splice(index,1);
- _this.secondParams.image =_this.GoodsImagesList.toString()+',';
- },
- contains:function(arr, val) {// 校验
- return arr.some(item => item === val)
- },
- handleMobileCodeInput(){//
- this.vShow_checkCode = false;
- },
- handleMobileAddresInput(){//
- this.vShow_TownId = false;
- this.vShow_Address = false;
- },
- handleMobileInput:function () {// 控制联系人手机号显示获取验证码按钮
- var re = /^1\d{10}$/;
- if(re.test(this.secondParams.contactMobile)){
- this.isMobileDisabled = false
- }
- },
- getNewMobileCodeFn:function(){//获取联系人手机号短信验证码
- var _self = this;
- var pass = verifyCheack('.massageBtn');
- if (!pass) { return false; }
- var params = {
- mobile:_self.secondParams.contactMobile,
- isCheckCaptcha:1,
- activateCodeType:6,
- platformType:0
- };
- _self.isMobileDisabled = true;
- UserApi.getRegisterMobileCode(params,function(response){
- if(response.code == 0){
- CAIMEI.dialog('验证短信已发送',false,function () {});
- var TIME_COUNT = 60;
- if (!_self.mobilTime) {
- _self.mobilCount = TIME_COUNT;
- _self.isMobileDisabled = true;
- _self.mobilTime = setInterval(function(){
- if (_self.mobilCount > 1 && _self.mobilCount <= TIME_COUNT) {
- _self.mobilCount--;
- _self.mobileCodeText = _self.mobilCount +'s重新发送';
- } else {
- _self.isMobileDisabled = false;
- clearInterval(_self.mobilTime);
- _self.mobilTime = null;
- _self.mobileCodeText = '获取验证码';
- }
- },1000)
- }
- }else{
- CAIMEI.Alert(response.msg,'确定',false);
- _self.isMobileDisabled = false;
- }
- })
- },
- showViewerImageFn2: function(index,imageIndex ){//预览图片
- var _this = this;
- var DomEven = '#ViewerGoodsImages'+index;
- var ViewerDom = document.querySelector(DomEven);
- _this.viewer = new Viewer(ViewerDom, {url:'data-image'});
- },
- getProductType:function(item){
- var _this = this;
- _this.secondType=item;
- _this.secondParams.secondProductType = item ;
- },
- submitBtn:function () {
- var _this = this;
- var re = /^1\d{10}$/;
- if(_this.secondParams.contactName == ''){
- _this.vShow_contactName = true;
- _this.fromMessage = '请输入联系人姓名';
- _this.scrollIntoView('secondHandrelease');
- setTimeout(function(){
- _this.vShow_contactName = false;
- },3000);
- return
- }
- if(_this.secondParams.contactMobile == ''){
- _this.vShow_contactMobile = true;
- _this.fromMessage = '请输入联系方式';
- _this.scrollIntoView('secondHandrelease');
- setTimeout(function(){
- _this.vShow_contactMobile = false;
- },3000);
- return
- }
- if(!re.test(_this.secondParams.contactMobile)){
- _this.vShow_contactMobile = true;
- _this.fromMessage = '联系方式格式不正确';
- _this.scrollIntoView('secondHandrelease');
- setTimeout(function(){
- _this.vShow_contactMobile = false;
- },3000);
- return
- }
- if(_this.secondParams.checkCode == ''){
- _this.vShow_checkCode = true;
- _this.fromMessage = '请输入短信验证码';
- _this.scrollIntoView('secondHandrelease');
- setTimeout(function(){
- _this.vShow_checkCode = false;
- },3000);
- return
- }
- if(_this.secondParams.secondHandType == ''){
- _this.vShow_secondHandType = true;
- _this.fromMessage = '请选择分类';
- _this.scrollIntoView('secondHandrelease');
- setTimeout(function(){
- _this.vShow_secondHandType= false;
- },3000);
- return;
- }
- if(_this.secondParams.secondHandType == 1 ){
- if(_this.secondParams.instrumentType ==''){
- _this.vShow_instrumentType = true;
- _this.fromMessage = '请完善仪器分类';
- _this.scrollIntoView('secondHandrelease');
- setTimeout(function(){
- _this.vShow_instrumentType= false;
- },3000);
- return;
- }
- }
- if(_this.secondParams.brandId == ''){
- _this.vShow_BrandID = true;
- _this.fromMessage = '请选择商品品牌';
- _this.scrollIntoView('secondHandrelease');
- setTimeout(function(){
- _this.vShow_BrandID = false;
- },3000);
- return;
- }
- if(_this.secondParams.name == ''){
- _this.vShow_Name = true;
- _this.fromMessage = '请输入商品名称';
- _this.scrollIntoView('secondHandrelease');
- setTimeout(function(){
- _this.vShow_Name = false;
- },3000);
- return
- }
- if(_this.secondParams.publishIdentity === 2){
- if(_this.secondParams.companyName == ''){
- _this.vShow_companyName = true;
- _this.fromMessage = '请输入公司名称';
- _this.scrollIntoView('vShow_Name');
- setTimeout(function(){
- _this.vShow_companyName = false;
- },3000);
- return
- }
- }
- if(_this.secondParams.productQuality == ''){
- _this.vShow_shopColor = true;
- _this.fromMessage = '请输入商品成色';
- _this.scrollIntoView('vShow_Name');
- setTimeout(function(){
- _this.vShow_shopColor = false;
- },3000);
- return
- }
- if(_this.secondParams.townId == ''|| _this.secondParams.townId == undefined){
- _this.vShow_TownId = true;
- _this.fromMessage = '请完善联系地址';
- _this.scrollIntoView('vShow_Name');
- setTimeout(function(){
- _this.vShow_TownId = false;
- },3000);
- return
- }
- if(_this.secondParams.address == ''){
- _this.vShow_Address = true;
- _this.fromMessage = '请填写详细地址';
- _this.scrollIntoView('vShow_Name');
- setTimeout(function(){
- _this.vShow_Address = false;
- },3000);
- return
- }
- if(_this.GoodsImagesList ==''){
- _this.vShow_GoodsImages = true;
- _this.fromMessage = '请上传图片';
- _this.scrollIntoView('vShow_Address');
- setTimeout(function(){
- _this.vShow_GoodsImages = false;
- },3000);
- return;
- }
- if(_this.checkbox==false){
- _this.vShow_checkBox = true;
- _this.fromMessage='请阅读并勾选同意';
- setTimeout(function(){
- _this.vShow_checkBox = false;
- },3000);
- return
- }
- console.log(_this.secondParams);
- _this.SecondHandProduct(_this.secondParams)
- },
- SecondHandProduct:function(params){//提交发布
- var _this = this;
- SecondApi.SecondHandProduct(params,function (res) {
- if (res.code==0){
- CAIMEI.Alert('发布成功!商品信息会在1-2个工作日内进行审核,采美官方人员也会联系您进行商品估价,审核通过后将立即上线到采美二手市场。', '确定', true,function () {
- window.location.href = '/flea-market/list.html';
- });
- }else{
- CAIMEI.Alert(res.msg, '确定', false);
- _this.secondBj = false;
- return
- }
- })
- },
- cancelButtonFn:function(){//弹窗操作按钮
- var _this = this;
- switch(_this.isButtonsType){
- case 1:
- _this.PopupShow = false;
- _this.SecondHandProduct(_this.secondParams);
- break;
- case 2:
- _this.PopupShow = false;
- break;
- }
- },
- confirmButtonFn:function(){//弹窗操作按钮
- var _this = this;
- switch(_this.isButtonsType){
- case 1:
- _this.PopupShow = false;
- break;
- case 2:
- window.location.href = '/pay/caimei-paycash.html?pageType=1&&type=confirm&productID='+_this.playid;
- _this.PopupShow = false;
- break;
- }
- },
- closePopupShow:function(){//关闭操作弹窗
- var _this = this;
- _this.PopupShow = false;
- },
- scrollIntoView: function(id){
- document.getElementById(id).scrollIntoView({block: 'start', behavior: 'smooth'});
- },
- province:function () {
- var _this = this;
- _this.from.province = event.target.value;
- console.log('aaa', _this.from.province)
- if(_this.from.province==''){//省为请选择时市区初始化
- _this.cityArray=[];
- _this.townArray=[];
- _this.secondParams.townId=''
- }else {
- _this.getcity();
- }
- },
- getcity:function(event){//加载市
- var _this = this;
- PublicApi.GetCity({ type:1, parentId: _this.from.province },function(response){
- if(response.code == 0 ){
- _this.cityArray = response.data;
- _this.from.city = event.target.value;
- if(_this.from.city==''){
- _this.townArray=[];
- }else {
- _this.getcTown();
- }
- }
- })
- },
- getcTown:function(event){
- var _this = this;
- PublicApi.GetTown({ type:2, parentId:_this.from.city},function(response){
- if(response.code == 0 ){
- _this.townArray = response.data;
- _this.secondParams.townId = event.target.value;
- }else{
- CAIMEI.Alert(response.msg, '确定', false);
- }
- })
- },
- changeBox:function () {
- if(event.target.checked ==true){
- this.checkbox = true
- }else {
- this.checkbox = false
- }
- },
- },
- mounted:function () {
- var _this = this;
- this.cmSysParams.pageType = '发布二手';
- this.cmSysParams.pageLabel = '发布二手';
- SecondApi.brandList({},function (res) {//品牌列表
- if(res.code == 0){
- _this.BrandList = res.data;
- }
- })
- PublicApi.GetProvince({},function(response){ //省份
- if(response.code == 0){
- _this.provinceArray = response.data
- }else{
- CAIMEI.Alert(response.msg, '确定', false);
- }
- })
- },
- })
|