提交 97166bd8 authored 作者: 王天霸's avatar 王天霸

测试 7-7

上级 0f62f25a
......@@ -2,9 +2,9 @@
ENV = 'development'
# 正式环境
VUE_APP_BASE_API = 'http://sjapi.jxhh.com'
#VUE_APP_BASE_API = 'http://sjapi.jxhh.com'
# 开发环境
#VUE_APP_BASE_API = 'http://192.168.111.36:8200'
VUE_APP_BASE_API = 'http://192.168.111.34:8200'
# 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true
......@@ -181,4 +181,4 @@
font-size: 13px;
color: #FFF;
opacity: 0.5;
}</style><link href=/static/css/chunk-libs.5ccc545c.css rel=stylesheet><link href=/static/css/app.59d2f10d.css rel=stylesheet></head><body><div id=app><div id=loader-wrapper><div id=loader></div><div class="loader-section section-left"></div><div class="loader-section section-right"></div><div class=load_title>正在加载系统资源,请耐心等待</div></div></div><script src=/static/js/chunk-elementUI.4e157bf4.js></script><script src=/static/js/chunk-libs.a6e9171c.js></script><script>(function(e){function c(c){for(var t,r,f=c[0],d=c[1],o=c[2],h=0,i=[];h<f.length;h++)r=f[h],u[r]&&i.push(u[r][0]),u[r]=0;for(t in d)Object.prototype.hasOwnProperty.call(d,t)&&(e[t]=d[t]);b&&b(c);while(i.length)i.shift()();return a.push.apply(a,o||[]),n()}function n(){for(var e,c=0;c<a.length;c++){for(var n=a[c],t=!0,r=1;r<n.length;r++){var f=n[r];0!==u[f]&&(t=!1)}t&&(a.splice(c--,1),e=d(d.s=n[0]))}return e}var t={},r={runtime:0},u={runtime:0},a=[];function f(e){return d.p+"static/js/"+({}[e]||e)+"."+{"chunk-03be8c46":"9b648cf3","chunk-2b9fdef2":"8557fdd7","chunk-2d0c741e":"9a348a52","chunk-2c12c5e0":"516c1bb2","chunk-2d0c7ece":"1209e0a1","chunk-2d0cbf05":"598ccefa","chunk-08486bce":"097b8333","chunk-2d0d67a2":"c58a17a6","chunk-2d0f012d":"ef4e2fdf","chunk-2d226555":"e093ec60","chunk-0b4a9e9a":"0b784562","chunk-2d0e28b6":"fba57b8a","chunk-50745d81":"80281bc2","chunk-1a1c3ba1":"3a527a54","chunk-3ce63948":"3717c228","chunk-3d04964a":"5a457908","chunk-47a8c732":"20aecc53","chunk-50652c3a":"f79a5dc4","chunk-045db2ba":"decbd14d","chunk-6ab0b06c":"dd56da98","chunk-7c2f4fe6":"1b998c06","chunk-bc27c26a":"fff4b869","chunk-ce7ff29a":"1db12d11","chunk-e1f3bd06":"91e957f5"}[e]+".js"}function d(c){if(t[c])return t[c].exports;var n=t[c]={i:c,l:!1,exports:{}};return e[c].call(n.exports,n,n.exports,d),n.l=!0,n.exports}d.e=function(e){var c=[],n={"chunk-03be8c46":1,"chunk-2b9fdef2":1,"chunk-2c12c5e0":1,"chunk-1a1c3ba1":1,"chunk-3ce63948":1,"chunk-3d04964a":1,"chunk-47a8c732":1,"chunk-50652c3a":1,"chunk-045db2ba":1,"chunk-6ab0b06c":1,"chunk-bc27c26a":1,"chunk-ce7ff29a":1,"chunk-e1f3bd06":1};r[e]?c.push(r[e]):0!==r[e]&&n[e]&&c.push(r[e]=new Promise((function(c,n){for(var t="static/css/"+({}[e]||e)+"."+{"chunk-03be8c46":"4f92804f","chunk-2b9fdef2":"a939a6d1","chunk-2d0c741e":"31d6cfe0","chunk-2c12c5e0":"3c72d4e5","chunk-2d0c7ece":"31d6cfe0","chunk-2d0cbf05":"31d6cfe0","chunk-08486bce":"31d6cfe0","chunk-2d0d67a2":"31d6cfe0","chunk-2d0f012d":"31d6cfe0","chunk-2d226555":"31d6cfe0","chunk-0b4a9e9a":"31d6cfe0","chunk-2d0e28b6":"31d6cfe0","chunk-50745d81":"31d6cfe0","chunk-1a1c3ba1":"a3735b4c","chunk-3ce63948":"9183fc08","chunk-3d04964a":"fe6be668","chunk-47a8c732":"621b0df3","chunk-50652c3a":"2c17e1a3","chunk-045db2ba":"80e50a99","chunk-6ab0b06c":"3f857bd8","chunk-7c2f4fe6":"31d6cfe0","chunk-bc27c26a":"9ccc1a67","chunk-ce7ff29a":"0f99a037","chunk-e1f3bd06":"2f3e51dd"}[e]+".css",u=d.p+t,a=document.getElementsByTagName("link"),f=0;f<a.length;f++){var o=a[f],h=o.getAttribute("data-href")||o.getAttribute("href");if("stylesheet"===o.rel&&(h===t||h===u))return c()}var i=document.getElementsByTagName("style");for(f=0;f<i.length;f++){o=i[f],h=o.getAttribute("data-href");if(h===t||h===u)return c()}var b=document.createElement("link");b.rel="stylesheet",b.type="text/css",b.onload=c,b.onerror=function(c){var t=c&&c.target&&c.target.src||u,a=new Error("Loading CSS chunk "+e+" failed.\n("+t+")");a.request=t,delete r[e],b.parentNode.removeChild(b),n(a)},b.href=u;var k=document.getElementsByTagName("head")[0];k.appendChild(b)})).then((function(){r[e]=0})));var t=u[e];if(0!==t)if(t)c.push(t[2]);else{var a=new Promise((function(c,n){t=u[e]=[c,n]}));c.push(t[2]=a);var o,h=document.createElement("script");h.charset="utf-8",h.timeout=120,d.nc&&h.setAttribute("nonce",d.nc),h.src=f(e),o=function(c){h.onerror=h.onload=null,clearTimeout(i);var n=u[e];if(0!==n){if(n){var t=c&&("load"===c.type?"missing":c.type),r=c&&c.target&&c.target.src,a=new Error("Loading chunk "+e+" failed.\n("+t+": "+r+")");a.type=t,a.request=r,n[1](a)}u[e]=void 0}};var i=setTimeout((function(){o({type:"timeout",target:h})}),12e4);h.onerror=h.onload=o,document.head.appendChild(h)}return Promise.all(c)},d.m=e,d.c=t,d.d=function(e,c,n){d.o(e,c)||Object.defineProperty(e,c,{enumerable:!0,get:n})},d.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.t=function(e,c){if(1&c&&(e=d(e)),8&c)return e;if(4&c&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(d.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&c&&"string"!=typeof e)for(var t in e)d.d(n,t,function(c){return e[c]}.bind(null,t));return n},d.n=function(e){var c=e&&e.__esModule?function(){return e["default"]}:function(){return e};return d.d(c,"a",c),c},d.o=function(e,c){return Object.prototype.hasOwnProperty.call(e,c)},d.p="/",d.oe=function(e){throw console.error(e),e};var o=window["webpackJsonp"]=window["webpackJsonp"]||[],h=o.push.bind(o);o.push=c,o=o.slice();for(var i=0;i<o.length;i++)c(o[i]);var b=h;n()})([]);</script><script src=/static/js/app.f51ee267.js></script></body></html>
\ No newline at end of file
}</style><link href=/static/css/chunk-libs.5ccc545c.css rel=stylesheet><link href=/static/css/app.c833094f.css rel=stylesheet></head><body><div id=app><div id=loader-wrapper><div id=loader></div><div class="loader-section section-left"></div><div class="loader-section section-right"></div><div class=load_title>正在加载系统资源,请耐心等待</div></div></div><script src=/static/js/chunk-elementUI.4e157bf4.js></script><script src=/static/js/chunk-libs.a6e9171c.js></script><script>(function(e){function c(c){for(var t,r,f=c[0],d=c[1],o=c[2],h=0,i=[];h<f.length;h++)r=f[h],u[r]&&i.push(u[r][0]),u[r]=0;for(t in d)Object.prototype.hasOwnProperty.call(d,t)&&(e[t]=d[t]);b&&b(c);while(i.length)i.shift()();return a.push.apply(a,o||[]),n()}function n(){for(var e,c=0;c<a.length;c++){for(var n=a[c],t=!0,r=1;r<n.length;r++){var f=n[r];0!==u[f]&&(t=!1)}t&&(a.splice(c--,1),e=d(d.s=n[0]))}return e}var t={},r={runtime:0},u={runtime:0},a=[];function f(e){return d.p+"static/js/"+({}[e]||e)+"."+{"chunk-03be8c46":"9b648cf3","chunk-291b4570":"e318e399","chunk-2b9fdef2":"8557fdd7","chunk-2d0c741e":"9a348a52","chunk-2c12c5e0":"516c1bb2","chunk-2d0c7ece":"1209e0a1","chunk-2d0cbf05":"598ccefa","chunk-08486bce":"5e40ce55","chunk-2d0d67a2":"c58a17a6","chunk-2d0f012d":"ef4e2fdf","chunk-2d226555":"e093ec60","chunk-0b4a9e9a":"0b784562","chunk-2d0e28b6":"fba57b8a","chunk-50745d81":"80281bc2","chunk-1ac27a31":"30a25236","chunk-3ce63948":"3717c228","chunk-3d04964a":"5a457908","chunk-50652c3a":"f79a5dc4","chunk-045db2ba":"decbd14d","chunk-6ab0b06c":"dd56da98","chunk-7c2f4fe6":"1b998c06","chunk-bc27c26a":"fff4b869","chunk-ce7ff29a":"1db12d11","chunk-e1f3bd06":"91e957f5"}[e]+".js"}function d(c){if(t[c])return t[c].exports;var n=t[c]={i:c,l:!1,exports:{}};return e[c].call(n.exports,n,n.exports,d),n.l=!0,n.exports}d.e=function(e){var c=[],n={"chunk-03be8c46":1,"chunk-291b4570":1,"chunk-2b9fdef2":1,"chunk-2c12c5e0":1,"chunk-1ac27a31":1,"chunk-3ce63948":1,"chunk-3d04964a":1,"chunk-50652c3a":1,"chunk-045db2ba":1,"chunk-6ab0b06c":1,"chunk-bc27c26a":1,"chunk-ce7ff29a":1,"chunk-e1f3bd06":1};r[e]?c.push(r[e]):0!==r[e]&&n[e]&&c.push(r[e]=new Promise((function(c,n){for(var t="static/css/"+({}[e]||e)+"."+{"chunk-03be8c46":"4f92804f","chunk-291b4570":"6af4e0b3","chunk-2b9fdef2":"a939a6d1","chunk-2d0c741e":"31d6cfe0","chunk-2c12c5e0":"3c72d4e5","chunk-2d0c7ece":"31d6cfe0","chunk-2d0cbf05":"31d6cfe0","chunk-08486bce":"31d6cfe0","chunk-2d0d67a2":"31d6cfe0","chunk-2d0f012d":"31d6cfe0","chunk-2d226555":"31d6cfe0","chunk-0b4a9e9a":"31d6cfe0","chunk-2d0e28b6":"31d6cfe0","chunk-50745d81":"31d6cfe0","chunk-1ac27a31":"b9db1a80","chunk-3ce63948":"9183fc08","chunk-3d04964a":"fe6be668","chunk-50652c3a":"2c17e1a3","chunk-045db2ba":"80e50a99","chunk-6ab0b06c":"3f857bd8","chunk-7c2f4fe6":"31d6cfe0","chunk-bc27c26a":"9ccc1a67","chunk-ce7ff29a":"0f99a037","chunk-e1f3bd06":"2f3e51dd"}[e]+".css",u=d.p+t,a=document.getElementsByTagName("link"),f=0;f<a.length;f++){var o=a[f],h=o.getAttribute("data-href")||o.getAttribute("href");if("stylesheet"===o.rel&&(h===t||h===u))return c()}var i=document.getElementsByTagName("style");for(f=0;f<i.length;f++){o=i[f],h=o.getAttribute("data-href");if(h===t||h===u)return c()}var b=document.createElement("link");b.rel="stylesheet",b.type="text/css",b.onload=c,b.onerror=function(c){var t=c&&c.target&&c.target.src||u,a=new Error("Loading CSS chunk "+e+" failed.\n("+t+")");a.request=t,delete r[e],b.parentNode.removeChild(b),n(a)},b.href=u;var k=document.getElementsByTagName("head")[0];k.appendChild(b)})).then((function(){r[e]=0})));var t=u[e];if(0!==t)if(t)c.push(t[2]);else{var a=new Promise((function(c,n){t=u[e]=[c,n]}));c.push(t[2]=a);var o,h=document.createElement("script");h.charset="utf-8",h.timeout=120,d.nc&&h.setAttribute("nonce",d.nc),h.src=f(e),o=function(c){h.onerror=h.onload=null,clearTimeout(i);var n=u[e];if(0!==n){if(n){var t=c&&("load"===c.type?"missing":c.type),r=c&&c.target&&c.target.src,a=new Error("Loading chunk "+e+" failed.\n("+t+": "+r+")");a.type=t,a.request=r,n[1](a)}u[e]=void 0}};var i=setTimeout((function(){o({type:"timeout",target:h})}),12e4);h.onerror=h.onload=o,document.head.appendChild(h)}return Promise.all(c)},d.m=e,d.c=t,d.d=function(e,c,n){d.o(e,c)||Object.defineProperty(e,c,{enumerable:!0,get:n})},d.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.t=function(e,c){if(1&c&&(e=d(e)),8&c)return e;if(4&c&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(d.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&c&&"string"!=typeof e)for(var t in e)d.d(n,t,function(c){return e[c]}.bind(null,t));return n},d.n=function(e){var c=e&&e.__esModule?function(){return e["default"]}:function(){return e};return d.d(c,"a",c),c},d.o=function(e,c){return Object.prototype.hasOwnProperty.call(e,c)},d.p="/",d.oe=function(e){throw console.error(e),e};var o=window["webpackJsonp"]=window["webpackJsonp"]||[],h=o.push.bind(o);o.push=c,o=o.slice();for(var i=0;i<o.length;i++)c(o[i]);var b=h;n()})([]);</script><script src=/static/js/app.3610e39d.js></script></body></html>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
.fill-store-inf[data-v-db67e44a]{width:100%;height:100%;overflow-x:hidden;overflow-y:scroll}.fill-store-inf .box-card[data-v-db67e44a]{width:80%;margin:30px auto 30px;height:calc(100% - 120px)}.fill-store-inf .box-card[data-v-db67e44a] .el-card__body{height:calc(100% - 120px);overflow-x:hidden;overflow-y:scroll}.logo-bg[data-v-db67e44a]{height:60px;background:#1890ff}.logo-bg img[data-v-db67e44a]{height:44px;margin:8px 0 8px 20px}.steps[data-v-db67e44a]{height:70px;width:60%;margin:20px auto}.steps[data-v-db67e44a] .el-step__title{font-size:16px;line-height:18px;padding-top:20px}.el-step[data-v-db67e44a] .el-step__head.is-process{color:#1890ff;border-color:#1890ff}.el-step[data-v-db67e44a] .el-step__head.is-process .el-step__icon.is-text{background-color:#1890ff}.el-step[data-v-db67e44a] .el-step__head.is-process .el-step__icon.is-text .el-step__icon-inner{color:#fff}.el-step[data-v-db67e44a] .el-step__title.is-process{color:#000;font-weight:400}.el-step[data-v-db67e44a] .el-step__head.is-success{color:#1890ff;border-color:#1890ff}.el-step[data-v-db67e44a] .el-step__head.is-success .el-step__line{background-color:#1890ff}.el-step[data-v-db67e44a] .el-step__title.is-success{color:#000}.main-con[data-v-db67e44a]{width:70%;margin:30px auto 50px;overflow-y:scroll}.main-con .tips-text[data-v-db67e44a]{font-size:14px;color:#c9c9c9;word-break:break-all}.main-con .h-warning[data-v-db67e44a]:before{color:#e3c300}.main-con .uploadData[data-v-db67e44a]{display:inline-block}.main-con .uploadData[data-v-db67e44a] .el-upload--picture-card{width:100px;height:100px}.main-con .uploadData[data-v-db67e44a] .el-upload,.main-con .uploadData[data-v-db67e44a] .el-upload-list--picture-card .el-upload-list__item,.main-con .uploadData[data-v-db67e44a] .el-upload-list--picture-card .el-upload-list__item-thumbnail{width:100px;height:100px;line-height:100px}.main-con .uploadData[data-v-db67e44a] .avatar{width:100px;height:100px}
\ No newline at end of file
.fill-store-inf[data-v-5fa248a3]{width:100%;height:100%;overflow-x:hidden;overflow-y:scroll}.fill-store-inf .box-card[data-v-5fa248a3]{width:80%;margin:30px auto 30px;height:calc(100% - 120px)}.fill-store-inf .box-card[data-v-5fa248a3] .el-card__body{height:calc(100% - 120px);overflow-x:hidden;overflow-y:scroll}.logo-bg[data-v-5fa248a3]{height:60px;background:#1890ff}.logo-bg img[data-v-5fa248a3]{height:44px;margin:8px 0 8px 20px}.steps[data-v-5fa248a3]{height:70px;width:60%;margin:20px auto}.steps[data-v-5fa248a3] .el-step__title{font-size:16px;line-height:18px;padding-top:20px}.el-step[data-v-5fa248a3] .el-step__head.is-process{color:#1890ff;border-color:#1890ff}.el-step[data-v-5fa248a3] .el-step__head.is-process .el-step__icon.is-text{background-color:#1890ff}.el-step[data-v-5fa248a3] .el-step__head.is-process .el-step__icon.is-text .el-step__icon-inner{color:#fff}.el-step[data-v-5fa248a3] .el-step__title.is-process{color:#000;font-weight:400}.el-step[data-v-5fa248a3] .el-step__head.is-success{color:#1890ff;border-color:#1890ff}.el-step[data-v-5fa248a3] .el-step__head.is-success .el-step__line{background-color:#1890ff}.el-step[data-v-5fa248a3] .el-step__title.is-success{color:#000}.main-con[data-v-5fa248a3]{width:70%;margin:30px auto 50px;overflow-y:scroll}.main-con .tips-text[data-v-5fa248a3]{font-size:14px;color:#c9c9c9;word-break:break-all}.main-con .h-warning[data-v-5fa248a3]:before{color:#e3c300}.main-con .uploadData[data-v-5fa248a3]{display:inline-block}.main-con .uploadData[data-v-5fa248a3] .el-upload--picture-card{width:100px;height:100px}.main-con .uploadData[data-v-5fa248a3] .el-upload,.main-con .uploadData[data-v-5fa248a3] .el-upload-list--picture-card .el-upload-list__item,.main-con .uploadData[data-v-5fa248a3] .el-upload-list--picture-card .el-upload-list__item-thumbnail{width:100px;height:100px;line-height:100px}.main-con .uploadData[data-v-5fa248a3] .avatar{width:100px;height:100px}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-08486bce"],{"1e8b":function(e,t,r){"use strict";r.r(t);var s=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("el-form",{ref:"form",attrs:{model:e.user,rules:e.rules,"label-width":"80px"}},[r("el-form-item",{attrs:{label:"用户昵称",prop:"user_nickname"}},[r("el-input",{model:{value:e.user.user_nickname,callback:function(t){e.$set(e.user,"user_nickname",t)},expression:"user.user_nickname"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"手机号码",prop:"mobile"}},[r("el-input",{attrs:{maxlength:"11"},model:{value:e.user.mobile,callback:function(t){e.$set(e.user,"mobile",t)},expression:"user.mobile"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"邮箱",prop:"user_email"}},[r("el-input",{attrs:{maxlength:"50"},model:{value:e.user.user_email,callback:function(t){e.$set(e.user,"user_email",t)},expression:"user.user_email"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"性别"}},[r("el-radio-group",{model:{value:e.user.sex,callback:function(t){e.$set(e.user,"sex",t)},expression:"user.sex"}},[r("el-radio",{attrs:{label:0}},[e._v("保密")]),e._v(" "),r("el-radio",{attrs:{label:1}},[e._v("男")]),e._v(" "),r("el-radio",{attrs:{label:2}},[e._v("女")])],1)],1),e._v(" "),r("el-form-item",[r("el-button",{attrs:{type:"primary",size:"mini"},on:{click:e.submit}},[e._v("保存")]),e._v(" "),r("el-button",{attrs:{type:"danger",size:"mini"},on:{click:e.close}},[e._v("关闭")])],1)],1)},a=[],i=r("c0c7"),o={props:{user:{type:Object}},data:function(){return{rules:{user_nickname:[{required:!0,message:"用户昵称不能为空",trigger:"blur"}],user_email:[{required:!0,message:"邮箱地址不能为空",trigger:"blur"},{type:"email",message:"'请输入正确的邮箱地址",trigger:["blur","change"]}],mobile:[{required:!0,message:"手机号码不能为空",trigger:"blur"},{pattern:/^1[3|4|5|6|7|8|9][0-9]\d{8}$/,message:"请输入正确的手机号码",trigger:"blur"}]}}},methods:{submit:function(){var e=this;this.$refs["form"].validate((function(t){t&&Object(i["l"])(e.user).then((function(t){0===t.code?e.msgSuccess("修改成功"):e.msgError(t.msg)}))}))},close:function(){this.$store.dispatch("tagsView/delView",this.$route),this.$router.push({path:"/index"})}}},n=o,l=r("4ac2"),u=Object(l["a"])(n,s,a,!1,null,null,null);t["default"]=u.exports},"4c1b":function(e,t,r){"use strict";r.r(t);var s=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"app-container"},[r("el-row",{attrs:{gutter:20}},[r("el-col",{attrs:{span:6,xs:24}},[r("el-card",{staticClass:"box-card"},[r("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[r("span",[e._v("个人信息")])]),e._v(" "),r("div",[r("div",{staticClass:"text-center"},[r("userAvatar",{attrs:{user:e.user}})],1),e._v(" "),r("ul",{staticClass:"list-group list-group-striped"},[r("li",{staticClass:"list-group-item"},[r("svg-icon",{attrs:{"icon-class":"user"}}),e._v("用户名称\n "),r("div",{staticClass:"pull-right"},[e._v(e._s(e.user.user_name))])],1),e._v(" "),r("li",{staticClass:"list-group-item"},[r("svg-icon",{attrs:{"icon-class":"phone"}}),e._v("手机号码\n "),r("div",{staticClass:"pull-right"},[e._v(e._s(e.user.mobile))])],1),e._v(" "),r("li",{staticClass:"list-group-item"},[r("svg-icon",{attrs:{"icon-class":"email"}}),e._v("用户邮箱\n "),r("div",{staticClass:"pull-right"},[e._v(e._s(e.user.user_email))])],1),e._v(" "),r("li",{staticClass:"list-group-item"},[r("svg-icon",{attrs:{"icon-class":"tree"}}),e._v("所属部门\n "),e.user.dept_info?r("div",{staticClass:"pull-right"},[e._v(e._s(e.user.dept_info.deptName)+" / "+e._s(e.postGroup))]):e._e()],1),e._v(" "),r("li",{staticClass:"list-group-item"},[r("svg-icon",{attrs:{"icon-class":"peoples"}}),e._v("所属角色\n "),r("div",{staticClass:"pull-right"},[e._v(e._s(e.roleGroup))])],1),e._v(" "),r("li",{staticClass:"list-group-item"},[r("svg-icon",{attrs:{"icon-class":"date"}}),e._v("创建日期\n "),r("div",{staticClass:"pull-right"},[e._v(e._s(e.parseTime(e.user.create_time)))])],1)])])])],1),e._v(" "),r("el-col",{attrs:{span:18,xs:24}},[r("el-card",[r("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[r("span",[e._v("基本资料")])]),e._v(" "),r("el-tabs",{model:{value:e.activeTab,callback:function(t){e.activeTab=t},expression:"activeTab"}},[r("el-tab-pane",{attrs:{label:"基本资料",name:"userinfo"}},[r("userInfo",{attrs:{user:e.user}})],1),e._v(" "),r("el-tab-pane",{attrs:{label:"修改密码",name:"resetPwd"}},[r("resetPwd",{attrs:{user:e.user}})],1)],1)],1)],1)],1)],1)},a=[],i=(r("a450"),r("9429")),o=r("1e8b"),n=r("ee46"),l=r("c0c7"),u={name:"Profile",components:{userAvatar:i["default"],userInfo:o["default"],resetPwd:n["default"]},data:function(){return{user:{},activeTab:"userinfo"}},created:function(){this.getUser()},computed:{postGroup:function(){return Array.isArray(this.user.posts)?this.user.posts.reduce((function(e,t,r,s){return e+t.post_name+" "}),""):""},roleGroup:function(){return Array.isArray(this.user.roles)?this.user.roles.reduce((function(e,t,r,s){return e+t.name+" "}),""):""}},methods:{getUser:function(){var e=this;Object(l["g"])().then((function(t){e.user=t.data}))}}},c=u,d=r("4ac2"),p=Object(d["a"])(c,s,a,!1,null,null,null);t["default"]=p.exports},9429:function(e,t,r){"use strict";r.r(t);var s=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",[r("img",{staticClass:"img-circle img-lg",attrs:{src:e.options.img,title:"点击上传头像"},on:{click:function(t){return e.editCropper()}}}),e._v(" "),r("el-dialog",{attrs:{title:e.title,visible:e.open,width:"800px","append-to-body":""},on:{"update:visible":function(t){e.open=t}}},[r("el-row",[r("el-col",{style:{height:"350px"},attrs:{xs:24,md:12}},[r("vue-cropper",{ref:"cropper",attrs:{img:e.options.img,info:!0,autoCrop:e.options.autoCrop,autoCropWidth:e.options.autoCropWidth,autoCropHeight:e.options.autoCropHeight,fixedBox:e.options.fixedBox},on:{realTime:e.realTime}})],1),e._v(" "),r("el-col",{style:{height:"350px"},attrs:{xs:24,md:12}},[r("div",{staticClass:"avatar-upload-preview"},[r("img",{style:e.previews.img,attrs:{src:e.previews.url}})])])],1),e._v(" "),r("br"),e._v(" "),r("el-row",[r("el-col",{attrs:{lg:2,md:2}},[r("el-upload",{attrs:{action:"#","http-request":e.requestUpload,"show-file-list":!1,"before-upload":e.beforeUpload}},[r("el-button",{attrs:{size:"small"}},[e._v("\n 上传\n "),r("i",{staticClass:"el-icon-upload el-icon--right"})])],1)],1),e._v(" "),r("el-col",{attrs:{lg:{span:1,offset:2},md:2}},[r("el-button",{attrs:{icon:"el-icon-plus",size:"small"},on:{click:function(t){return e.changeScale(1)}}})],1),e._v(" "),r("el-col",{attrs:{lg:{span:1,offset:1},md:2}},[r("el-button",{attrs:{icon:"el-icon-minus",size:"small"},on:{click:function(t){return e.changeScale(-1)}}})],1),e._v(" "),r("el-col",{attrs:{lg:{span:1,offset:1},md:2}},[r("el-button",{attrs:{icon:"el-icon-refresh-left",size:"small"},on:{click:function(t){return e.rotateLeft()}}})],1),e._v(" "),r("el-col",{attrs:{lg:{span:1,offset:1},md:2}},[r("el-button",{attrs:{icon:"el-icon-refresh-right",size:"small"},on:{click:function(t){return e.rotateRight()}}})],1),e._v(" "),r("el-col",{attrs:{lg:{span:2,offset:6},md:2}},[r("el-button",{attrs:{type:"primary",size:"small"},on:{click:function(t){return e.uploadImg()}}},[e._v("提 交")])],1)],1)],1)],1)},a=[],i=r("2559"),o=r("4360"),n=r("4c99"),l=r("c0c7"),u={components:{VueCropper:n["VueCropper"]},props:{user:{type:Object}},data:function(){var e;return{open:!1,title:"修改头像",options:(e={img:o["a"].getters.avatar},Object(i["a"])(e,"img",""),Object(i["a"])(e,"autoCrop",!0),Object(i["a"])(e,"autoCropWidth",200),Object(i["a"])(e,"autoCropHeight",200),Object(i["a"])(e,"fixedBox",!0),e),previews:{}}},methods:{editCropper:function(){this.open=!0},requestUpload:function(){},rotateLeft:function(){this.$refs.cropper.rotateLeft()},rotateRight:function(){this.$refs.cropper.rotateRight()},changeScale:function(e){e=e||1,this.$refs.cropper.changeScale(e)},beforeUpload:function(e){var t=this;if(-1==e.type.indexOf("image/"))this.msgError("文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件。");else{var r=new FileReader;r.readAsDataURL(e),r.onload=function(){t.options.img=r.result}}},uploadImg:function(){var e=this;this.$refs.cropper.getCropBlob((function(t){var r=t.type,s={"image/jpeg":"jpeg","image/png":"png"},a="temp.jpg";s[r]&&(a="temp."+s[r]);var i=new FormData;i.append("avatarfile",t,a),Object(l["n"])(i).then((function(t){0===t.code?(e.open=!1,e.options.img="http://sjapi.jxhh.com/"+t.data.fileInfo.fileUrl,e.msgSuccess("修改成功")):e.msgError(t.msg),e.$refs.cropper.clearCrop()}))}))},realTime:function(e){this.previews=e},setAvatarBase64:function(e,t){var r=this,s=new Image;s.src=e+"?v="+Math.random(),s.crossOrigin="*",s.onload=function(){var e=r.transBase64FromImage(s);t&&t(e)}},transBase64FromImage:function(e){var t=document.createElement("canvas");t.width=e.width,t.height=e.height;var r=t.getContext("2d");return r.drawImage(e,0,0,e.width,e.height),t.toDataURL("image/png")}},watch:{user:function(e){var t=this;e.avatar&&this.setAvatarBase64("http://sjapi.jxhh.com/"+e.avatar,(function(e){t.options.img=e}))}}},c=u,d=r("4ac2"),p=Object(d["a"])(c,s,a,!1,null,null,null);t["default"]=p.exports},c0c7:function(e,t,r){"use strict";r.d(t,"i",(function(){return a})),r.d(t,"f",(function(){return i})),r.d(t,"e",(function(){return o})),r.d(t,"a",(function(){return n})),r.d(t,"k",(function(){return l})),r.d(t,"c",(function(){return u})),r.d(t,"d",(function(){return c})),r.d(t,"j",(function(){return d})),r.d(t,"b",(function(){return p})),r.d(t,"g",(function(){return m})),r.d(t,"l",(function(){return f})),r.d(t,"m",(function(){return g})),r.d(t,"n",(function(){return v})),r.d(t,"h",(function(){return h}));var s=r("b775");r("c38a");function a(e){return Object(s["a"])({url:"/system/auth/userList",method:"get",params:e})}function i(){return Object(s["a"])({url:"/system/auth/addUser",method:"get"})}function o(e){return Object(s["a"])({url:"/system/auth/editUser?id="+e,method:"get"})}function n(e){return Object(s["a"])({url:"/system/auth/addUser",method:"post",data:e})}function l(e){return Object(s["a"])({url:"/system/auth/editUser",method:"post",data:e})}function u(e){return Object(s["a"])({url:"/system/auth/deleteAdmin",method:"delete",params:{ids:e}})}function c(e){return Object(s["a"])({url:"/system/user/export",method:"get",params:e})}function d(e,t){var r={userId:e,password:t};return Object(s["a"])({url:"/system/auth/resetUserPwd",method:"put",data:r})}function p(e,t){var r={userId:e,status:t};return Object(s["a"])({url:"/system/auth/changeUserStatus ",method:"put",data:r})}function m(){return Object(s["a"])({url:"/system/user/profile",method:"get"})}function f(e){return Object(s["a"])({url:"/system/user/edit",method:"post",data:e})}function g(e,t){var r={oldPassword:e,newPassword:t};return Object(s["a"])({url:"/system/user/updatePwd",method:"post",data:r})}function v(e){return Object(s["a"])({url:"/system/user/avatar",method:"post",data:e})}function h(){return Object(s["a"])({url:"/system/user/importTemplate",method:"get"})}},ee46:function(e,t,r){"use strict";r.r(t);var s=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("el-form",{ref:"form",attrs:{model:e.user,rules:e.rules,"label-width":"80px"}},[r("el-form-item",{attrs:{label:"旧密码",prop:"oldPassword"}},[r("el-input",{attrs:{placeholder:"请输入旧密码",type:"password"},model:{value:e.user.oldPassword,callback:function(t){e.$set(e.user,"oldPassword",t)},expression:"user.oldPassword"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"新密码",prop:"newPassword"}},[r("el-input",{attrs:{placeholder:"请输入新密码",type:"password"},model:{value:e.user.newPassword,callback:function(t){e.$set(e.user,"newPassword",t)},expression:"user.newPassword"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"确认密码",prop:"confirmPassword"}},[r("el-input",{attrs:{placeholder:"请确认密码",type:"password"},model:{value:e.user.confirmPassword,callback:function(t){e.$set(e.user,"confirmPassword",t)},expression:"user.confirmPassword"}})],1),e._v(" "),r("el-form-item",[r("el-button",{attrs:{type:"primary",size:"mini"},on:{click:e.submit}},[e._v("保存")]),e._v(" "),r("el-button",{attrs:{type:"danger",size:"mini"},on:{click:e.close}},[e._v("关闭")])],1)],1)},a=[],i=r("c0c7"),o={data:function(){var e=this,t=function(t,r,s){e.user.newPassword!==r?s(new Error("两次输入的密码不一致")):s()};return{test:"1test",user:{oldPassword:void 0,newPassword:void 0,confirmPassword:void 0},rules:{oldPassword:[{required:!0,message:"旧密码不能为空",trigger:"blur"}],newPassword:[{required:!0,message:"新密码不能为空",trigger:"blur"},{min:6,max:20,message:"长度在 6 到 20 个字符",trigger:"blur"}],confirmPassword:[{required:!0,message:"确认密码不能为空",trigger:"blur"},{required:!0,validator:t,trigger:"blur"}]}}},methods:{submit:function(){var e=this;this.$refs["form"].validate((function(t){t&&Object(i["m"])(e.user.oldPassword,e.user.newPassword).then((function(t){0===t.code?e.msgSuccess("修改成功"):e.msgError(t.msg)}))}))},close:function(){this.$store.dispatch("tagsView/delView",this.$route),this.$router.push({path:"/index"})}}},n=o,l=r("4ac2"),u=Object(l["a"])(n,s,a,!1,null,null,null);t["default"]=u.exports}}]);
\ No newline at end of file
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-08486bce"],{"1e8b":function(e,t,r){"use strict";r.r(t);var s=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("el-form",{ref:"form",attrs:{model:e.user,rules:e.rules,"label-width":"80px"}},[r("el-form-item",{attrs:{label:"用户昵称",prop:"user_nickname"}},[r("el-input",{model:{value:e.user.user_nickname,callback:function(t){e.$set(e.user,"user_nickname",t)},expression:"user.user_nickname"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"手机号码",prop:"mobile"}},[r("el-input",{attrs:{maxlength:"11"},model:{value:e.user.mobile,callback:function(t){e.$set(e.user,"mobile",t)},expression:"user.mobile"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"邮箱",prop:"user_email"}},[r("el-input",{attrs:{maxlength:"50"},model:{value:e.user.user_email,callback:function(t){e.$set(e.user,"user_email",t)},expression:"user.user_email"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"性别"}},[r("el-radio-group",{model:{value:e.user.sex,callback:function(t){e.$set(e.user,"sex",t)},expression:"user.sex"}},[r("el-radio",{attrs:{label:0}},[e._v("保密")]),e._v(" "),r("el-radio",{attrs:{label:1}},[e._v("男")]),e._v(" "),r("el-radio",{attrs:{label:2}},[e._v("女")])],1)],1),e._v(" "),r("el-form-item",[r("el-button",{attrs:{type:"primary",size:"mini"},on:{click:e.submit}},[e._v("保存")]),e._v(" "),r("el-button",{attrs:{type:"danger",size:"mini"},on:{click:e.close}},[e._v("关闭")])],1)],1)},a=[],i=r("c0c7"),o={props:{user:{type:Object}},data:function(){return{rules:{user_nickname:[{required:!0,message:"用户昵称不能为空",trigger:"blur"}],user_email:[{required:!0,message:"邮箱地址不能为空",trigger:"blur"},{type:"email",message:"'请输入正确的邮箱地址",trigger:["blur","change"]}],mobile:[{required:!0,message:"手机号码不能为空",trigger:"blur"},{pattern:/^1[3|4|5|6|7|8|9][0-9]\d{8}$/,message:"请输入正确的手机号码",trigger:"blur"}]}}},methods:{submit:function(){var e=this;this.$refs["form"].validate((function(t){t&&Object(i["l"])(e.user).then((function(t){0===t.code?e.msgSuccess("修改成功"):e.msgError(t.msg)}))}))},close:function(){this.$store.dispatch("tagsView/delView",this.$route),this.$router.push({path:"/index"})}}},n=o,l=r("4ac2"),u=Object(l["a"])(n,s,a,!1,null,null,null);t["default"]=u.exports},"4c1b":function(e,t,r){"use strict";r.r(t);var s=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"app-container"},[r("el-row",{attrs:{gutter:20}},[r("el-col",{attrs:{span:6,xs:24}},[r("el-card",{staticClass:"box-card"},[r("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[r("span",[e._v("个人信息")])]),e._v(" "),r("div",[r("div",{staticClass:"text-center"},[r("userAvatar",{attrs:{user:e.user}})],1),e._v(" "),r("ul",{staticClass:"list-group list-group-striped"},[r("li",{staticClass:"list-group-item"},[r("svg-icon",{attrs:{"icon-class":"user"}}),e._v("用户名称\n "),r("div",{staticClass:"pull-right"},[e._v(e._s(e.user.user_name))])],1),e._v(" "),r("li",{staticClass:"list-group-item"},[r("svg-icon",{attrs:{"icon-class":"phone"}}),e._v("手机号码\n "),r("div",{staticClass:"pull-right"},[e._v(e._s(e.user.mobile))])],1),e._v(" "),r("li",{staticClass:"list-group-item"},[r("svg-icon",{attrs:{"icon-class":"email"}}),e._v("用户邮箱\n "),r("div",{staticClass:"pull-right"},[e._v(e._s(e.user.user_email))])],1),e._v(" "),r("li",{staticClass:"list-group-item"},[r("svg-icon",{attrs:{"icon-class":"tree"}}),e._v("所属部门\n "),e.user.dept_info?r("div",{staticClass:"pull-right"},[e._v(e._s(e.user.dept_info.deptName)+" / "+e._s(e.postGroup))]):e._e()],1),e._v(" "),r("li",{staticClass:"list-group-item"},[r("svg-icon",{attrs:{"icon-class":"peoples"}}),e._v("所属角色\n "),r("div",{staticClass:"pull-right"},[e._v(e._s(e.roleGroup))])],1),e._v(" "),r("li",{staticClass:"list-group-item"},[r("svg-icon",{attrs:{"icon-class":"date"}}),e._v("创建日期\n "),r("div",{staticClass:"pull-right"},[e._v(e._s(e.parseTime(e.user.create_time)))])],1)])])])],1),e._v(" "),r("el-col",{attrs:{span:18,xs:24}},[r("el-card",[r("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[r("span",[e._v("基本资料")])]),e._v(" "),r("el-tabs",{model:{value:e.activeTab,callback:function(t){e.activeTab=t},expression:"activeTab"}},[r("el-tab-pane",{attrs:{label:"基本资料",name:"userinfo"}},[r("userInfo",{attrs:{user:e.user}})],1),e._v(" "),r("el-tab-pane",{attrs:{label:"修改密码",name:"resetPwd"}},[r("resetPwd",{attrs:{user:e.user}})],1)],1)],1)],1)],1)],1)},a=[],i=(r("a450"),r("9429")),o=r("1e8b"),n=r("ee46"),l=r("c0c7"),u={name:"Profile",components:{userAvatar:i["default"],userInfo:o["default"],resetPwd:n["default"]},data:function(){return{user:{},activeTab:"userinfo"}},created:function(){this.getUser()},computed:{postGroup:function(){return Array.isArray(this.user.posts)?this.user.posts.reduce((function(e,t,r,s){return e+t.post_name+" "}),""):""},roleGroup:function(){return Array.isArray(this.user.roles)?this.user.roles.reduce((function(e,t,r,s){return e+t.name+" "}),""):""}},methods:{getUser:function(){var e=this;Object(l["g"])().then((function(t){e.user=t.data}))}}},c=u,d=r("4ac2"),p=Object(d["a"])(c,s,a,!1,null,null,null);t["default"]=p.exports},9429:function(e,t,r){"use strict";r.r(t);var s=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",[r("img",{staticClass:"img-circle img-lg",attrs:{src:e.options.img,title:"点击上传头像"},on:{click:function(t){return e.editCropper()}}}),e._v(" "),r("el-dialog",{attrs:{title:e.title,visible:e.open,width:"800px","append-to-body":""},on:{"update:visible":function(t){e.open=t}}},[r("el-row",[r("el-col",{style:{height:"350px"},attrs:{xs:24,md:12}},[r("vue-cropper",{ref:"cropper",attrs:{img:e.options.img,info:!0,autoCrop:e.options.autoCrop,autoCropWidth:e.options.autoCropWidth,autoCropHeight:e.options.autoCropHeight,fixedBox:e.options.fixedBox},on:{realTime:e.realTime}})],1),e._v(" "),r("el-col",{style:{height:"350px"},attrs:{xs:24,md:12}},[r("div",{staticClass:"avatar-upload-preview"},[r("img",{style:e.previews.img,attrs:{src:e.previews.url}})])])],1),e._v(" "),r("br"),e._v(" "),r("el-row",[r("el-col",{attrs:{lg:2,md:2}},[r("el-upload",{attrs:{action:"#","http-request":e.requestUpload,"show-file-list":!1,"before-upload":e.beforeUpload}},[r("el-button",{attrs:{size:"small"}},[e._v("\n 上传\n "),r("i",{staticClass:"el-icon-upload el-icon--right"})])],1)],1),e._v(" "),r("el-col",{attrs:{lg:{span:1,offset:2},md:2}},[r("el-button",{attrs:{icon:"el-icon-plus",size:"small"},on:{click:function(t){return e.changeScale(1)}}})],1),e._v(" "),r("el-col",{attrs:{lg:{span:1,offset:1},md:2}},[r("el-button",{attrs:{icon:"el-icon-minus",size:"small"},on:{click:function(t){return e.changeScale(-1)}}})],1),e._v(" "),r("el-col",{attrs:{lg:{span:1,offset:1},md:2}},[r("el-button",{attrs:{icon:"el-icon-refresh-left",size:"small"},on:{click:function(t){return e.rotateLeft()}}})],1),e._v(" "),r("el-col",{attrs:{lg:{span:1,offset:1},md:2}},[r("el-button",{attrs:{icon:"el-icon-refresh-right",size:"small"},on:{click:function(t){return e.rotateRight()}}})],1),e._v(" "),r("el-col",{attrs:{lg:{span:2,offset:6},md:2}},[r("el-button",{attrs:{type:"primary",size:"small"},on:{click:function(t){return e.uploadImg()}}},[e._v("提 交")])],1)],1)],1)],1)},a=[],i=r("2559"),o=r("4360"),n=r("4c99"),l=r("c0c7"),u={components:{VueCropper:n["VueCropper"]},props:{user:{type:Object}},data:function(){var e;return{open:!1,title:"修改头像",options:(e={img:o["a"].getters.avatar},Object(i["a"])(e,"img",""),Object(i["a"])(e,"autoCrop",!0),Object(i["a"])(e,"autoCropWidth",200),Object(i["a"])(e,"autoCropHeight",200),Object(i["a"])(e,"fixedBox",!0),e),previews:{}}},methods:{editCropper:function(){this.open=!0},requestUpload:function(){},rotateLeft:function(){this.$refs.cropper.rotateLeft()},rotateRight:function(){this.$refs.cropper.rotateRight()},changeScale:function(e){e=e||1,this.$refs.cropper.changeScale(e)},beforeUpload:function(e){var t=this;if(-1==e.type.indexOf("image/"))this.msgError("文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件。");else{var r=new FileReader;r.readAsDataURL(e),r.onload=function(){t.options.img=r.result}}},uploadImg:function(){var e=this;this.$refs.cropper.getCropBlob((function(t){var r=t.type,s={"image/jpeg":"jpeg","image/png":"png"},a="temp.jpg";s[r]&&(a="temp."+s[r]);var i=new FormData;i.append("avatarfile",t,a),Object(l["n"])(i).then((function(t){0===t.code?(e.open=!1,e.options.img="http://192.168.26.179:8200/"+t.data.fileInfo.fileUrl,e.msgSuccess("修改成功")):e.msgError(t.msg),e.$refs.cropper.clearCrop()}))}))},realTime:function(e){this.previews=e},setAvatarBase64:function(e,t){var r=this,s=new Image;s.src=e+"?v="+Math.random(),s.crossOrigin="*",s.onload=function(){var e=r.transBase64FromImage(s);t&&t(e)}},transBase64FromImage:function(e){var t=document.createElement("canvas");t.width=e.width,t.height=e.height;var r=t.getContext("2d");return r.drawImage(e,0,0,e.width,e.height),t.toDataURL("image/png")}},watch:{user:function(e){var t=this;e.avatar&&this.setAvatarBase64("http://192.168.26.179:8200/"+e.avatar,(function(e){t.options.img=e}))}}},c=u,d=r("4ac2"),p=Object(d["a"])(c,s,a,!1,null,null,null);t["default"]=p.exports},c0c7:function(e,t,r){"use strict";r.d(t,"i",(function(){return a})),r.d(t,"f",(function(){return i})),r.d(t,"e",(function(){return o})),r.d(t,"a",(function(){return n})),r.d(t,"k",(function(){return l})),r.d(t,"c",(function(){return u})),r.d(t,"d",(function(){return c})),r.d(t,"j",(function(){return d})),r.d(t,"b",(function(){return p})),r.d(t,"g",(function(){return m})),r.d(t,"l",(function(){return f})),r.d(t,"m",(function(){return g})),r.d(t,"n",(function(){return v})),r.d(t,"h",(function(){return h}));var s=r("b775");r("c38a");function a(e){return Object(s["a"])({url:"/system/auth/userList",method:"get",params:e})}function i(){return Object(s["a"])({url:"/system/auth/addUser",method:"get"})}function o(e){return Object(s["a"])({url:"/system/auth/editUser?id="+e,method:"get"})}function n(e){return Object(s["a"])({url:"/system/auth/addUser",method:"post",data:e})}function l(e){return Object(s["a"])({url:"/system/auth/editUser",method:"post",data:e})}function u(e){return Object(s["a"])({url:"/system/auth/deleteAdmin",method:"delete",params:{ids:e}})}function c(e){return Object(s["a"])({url:"/system/user/export",method:"get",params:e})}function d(e,t){var r={userId:e,password:t};return Object(s["a"])({url:"/system/auth/resetUserPwd",method:"put",data:r})}function p(e,t){var r={userId:e,status:t};return Object(s["a"])({url:"/system/auth/changeUserStatus ",method:"put",data:r})}function m(){return Object(s["a"])({url:"/system/user/profile",method:"get"})}function f(e){return Object(s["a"])({url:"/system/user/edit",method:"post",data:e})}function g(e,t){var r={oldPassword:e,newPassword:t};return Object(s["a"])({url:"/system/user/updatePwd",method:"post",data:r})}function v(e){return Object(s["a"])({url:"/system/user/avatar",method:"post",data:e})}function h(){return Object(s["a"])({url:"/system/user/importTemplate",method:"get"})}},ee46:function(e,t,r){"use strict";r.r(t);var s=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("el-form",{ref:"form",attrs:{model:e.user,rules:e.rules,"label-width":"80px"}},[r("el-form-item",{attrs:{label:"旧密码",prop:"oldPassword"}},[r("el-input",{attrs:{placeholder:"请输入旧密码",type:"password"},model:{value:e.user.oldPassword,callback:function(t){e.$set(e.user,"oldPassword",t)},expression:"user.oldPassword"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"新密码",prop:"newPassword"}},[r("el-input",{attrs:{placeholder:"请输入新密码",type:"password"},model:{value:e.user.newPassword,callback:function(t){e.$set(e.user,"newPassword",t)},expression:"user.newPassword"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"确认密码",prop:"confirmPassword"}},[r("el-input",{attrs:{placeholder:"请确认密码",type:"password"},model:{value:e.user.confirmPassword,callback:function(t){e.$set(e.user,"confirmPassword",t)},expression:"user.confirmPassword"}})],1),e._v(" "),r("el-form-item",[r("el-button",{attrs:{type:"primary",size:"mini"},on:{click:e.submit}},[e._v("保存")]),e._v(" "),r("el-button",{attrs:{type:"danger",size:"mini"},on:{click:e.close}},[e._v("关闭")])],1)],1)},a=[],i=r("c0c7"),o={data:function(){var e=this,t=function(t,r,s){e.user.newPassword!==r?s(new Error("两次输入的密码不一致")):s()};return{test:"1test",user:{oldPassword:void 0,newPassword:void 0,confirmPassword:void 0},rules:{oldPassword:[{required:!0,message:"旧密码不能为空",trigger:"blur"}],newPassword:[{required:!0,message:"新密码不能为空",trigger:"blur"},{min:6,max:20,message:"长度在 6 到 20 个字符",trigger:"blur"}],confirmPassword:[{required:!0,message:"确认密码不能为空",trigger:"blur"},{required:!0,validator:t,trigger:"blur"}]}}},methods:{submit:function(){var e=this;this.$refs["form"].validate((function(t){t&&Object(i["m"])(e.user.oldPassword,e.user.newPassword).then((function(t){0===t.code?e.msgSuccess("修改成功"):e.msgError(t.msg)}))}))},close:function(){this.$store.dispatch("tagsView/delView",this.$route),this.$router.push({path:"/index"})}}},n=o,l=r("4ac2"),u=Object(l["a"])(n,s,a,!1,null,null,null);t["default"]=u.exports}}]);
\ No newline at end of file
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-47a8c732"],{3746:function(e,i,t){"use strict";t.r(i);var a=function(){var e=this,i=e.$createElement,t=e._self._c||i;return t("div",{staticClass:"fill-store-inf"},[e._m(0),e._v(" "),t("el-card",{staticClass:"box-card"},[t("div",{staticClass:"clearfix steps",attrs:{slot:"header"},slot:"header"},[t("el-steps",{attrs:{active:1,"align-center":"","finish-status":"success"}},[t("el-step",{attrs:{title:"签署入驻协议"}}),e._v(" "),t("el-step",{attrs:{title:"填写主体信息"}}),e._v(" "),t("el-step",{attrs:{title:"填写品牌信息"}}),e._v(" "),t("el-step",{attrs:{title:"填写店铺信息"}}),e._v(" "),t("el-step",{attrs:{title:"提交入驻审核"}})],1)],1),e._v(" "),t("div",{staticClass:"main-con"},[t("el-form",{ref:"mainForm",attrs:{model:e.mainForm,rules:e.mainRules,"label-width":"180px"}},[t("el-form-item",{attrs:{label:"主体类型:"}},[t("el-radio-group",{model:{value:e.mainForm.organization_type,callback:function(i){e.$set(e.mainForm,"organization_type",i)},expression:"mainForm.organization_type"}},[t("el-radio",{attrs:{label:1}},[e._v("企业/公司")]),e._v(" "),t("el-radio",{attrs:{label:2}},[e._v("个体工商户")])],1)],1),e._v(" "),t("el-form-item",{attrs:{label:"执照类型:",prop:"license_type"}},[t("el-select",{staticStyle:{width:"400px"},attrs:{placeholder:"请选择..."},model:{value:e.mainForm.license_type,callback:function(i){e.$set(e.mainForm,"license_type",i)},expression:"mainForm.license_type"}},e._l(e.zzOptions,(function(e){return t("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1)],1),e._v(" "),t("el-form-item",{attrs:{label:"营业执照电子版:",prop:"license"}},[t("div",{staticStyle:{width:"100%",height:"100%",display:"flex","flex-direction":"row","justify-content":"normal"}},[t("div",{staticStyle:{"padding-right":"6px"}},[t("el-upload",{staticClass:"uploadData",attrs:{action:"#","list-type":"picture-card","http-request":e.uploadLicenseImages,limit:2,"on-exceed":e.showTip,"before-upload":e.beforeUpImg,"on-preview":e.handlePictureCardPreview,"on-remove":e.handleRemove,"file-list":e.licenseImgFileList}},[t("i",{staticClass:"el-icon-plus"})]),e._v(" "),t("el-dialog",{attrs:{visible:e.dialogVisible},on:{"update:visible":function(i){e.dialogVisible=i}}},[t("img",{attrs:{width:"100%",src:e.dialogImageUrl,alt:""}})])],1),e._v(" "),t("div",[t("span",{staticClass:"tips-text"},[t("i",{staticClass:"el-icon-warning h-warning"})])]),e._v(" "),t("div",{staticStyle:{width:"380px","line-height":"24px","padding-top":"6px"}},[t("span",{staticClass:"tips-text"},[e._v("图片大小在2MB以内,支持png,jpg格式,最多可上传2张")])])])]),e._v(" "),t("el-form-item",{attrs:{label:"企业名称:",prop:"organization_name","inline-message":"true"}},[t("el-input",{staticStyle:{width:"400px"},model:{value:e.mainForm.organization_name,callback:function(i){e.$set(e.mainForm,"organization_name",i)},expression:"mainForm.organization_name"}}),e._v(" "),t("span",{staticClass:"tips-text"},[t("i",{staticClass:"el-icon-warning h-warning"}),e._v("请按照营业执照上登记的完整名称填写")])],1),e._v(" "),t("el-form-item",{attrs:{label:"营业执照详细地址:",prop:"organization_address"}},[t("el-input",{staticStyle:{width:"400px"},model:{value:e.mainForm.organization_address,callback:function(i){e.$set(e.mainForm,"organization_address",i)},expression:"mainForm.organization_address"}}),e._v(" "),t("span",{staticClass:"tips-text"},[t("i",{staticClass:"el-icon-warning h-warning"}),e._v("请按照营业执照上的详细地址填写")])],1),e._v(" "),t("el-form-item",{attrs:{gutter:20,label:"营业期限:",prop:"license_expires_time"}},[t("el-date-picker",{staticStyle:{width:"300px"},attrs:{type:"date",placeholder:"选择日期",disabled:e.isConcretePeriod},on:{change:e.periodConcrete},model:{value:e.periodConcreteTime,callback:function(i){e.periodConcreteTime=i},expression:"periodConcreteTime"}}),e._v(" "),t("el-checkbox",{staticStyle:{"padding-left":"15px"},attrs:{disabled:e.isPeriodDisabled},on:{change:e.periodLongTerm},model:{value:e.periodLongTermVal,callback:function(i){e.periodLongTermVal=i},expression:"periodLongTermVal"}},[e._v("长期\n ")]),e._v(" "),t("span",{staticClass:"tips-text"},[t("i",{staticClass:"el-icon-warning h-warning"}),e._v("具体时间和长期,二者必填一个")])],1),e._v(" "),t("el-form-item",{attrs:{label:"法定代表人证件类型:",prop:"idcard_type"}},[t("el-select",{staticStyle:{width:"400px"},attrs:{placeholder:"请选择..."},model:{value:e.mainForm.idcard_type,callback:function(i){e.$set(e.mainForm,"idcard_type",i)},expression:"mainForm.idcard_type"}},e._l(e.idcardTypeOptions,(function(e){return t("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1)],1),e._v(" "),t("el-form-item",{attrs:{label:"法定代表人姓名:",prop:"real_name"}},[t("el-input",{staticStyle:{width:"400px"},model:{value:e.mainForm.real_name,callback:function(i){e.$set(e.mainForm,"real_name",i)},expression:"mainForm.real_name"}}),e._v(" "),t("span",{staticClass:"tips-text"},[t("i",{staticClass:"el-icon-warning h-warning"}),e._v("请按照营业执照上登记的法人填写")])],1),e._v(" "),t("el-form-item",{attrs:{label:"法定代表人证件号:",prop:"idcard_number"}},[t("el-input",{staticStyle:{width:"400px"},model:{value:e.mainForm.idcard_number,callback:function(i){e.$set(e.mainForm,"idcard_number",i)},expression:"mainForm.idcard_number"}})],1),e._v(" "),t("el-form-item",{attrs:{label:"有效期至:",prop:"idcard_expires_time"}},[t("el-date-picker",{staticStyle:{width:"300px"},attrs:{type:"date",placeholder:"选择日期"},on:{change:e.validityConcrete},model:{value:e.validityConcreteTime,callback:function(i){e.validityConcreteTime=i},expression:"validityConcreteTime"}}),e._v(" "),t("el-checkbox",{staticStyle:{"padding-left":"15px"},on:{change:e.validityLongTerm},model:{value:e.validityLongTermVal,callback:function(i){e.validityLongTermVal=i},expression:"validityLongTermVal"}},[e._v("长期\n ")])],1),e._v(" "),t("el-form-item",{attrs:{label:"法人证件电子版:",prop:"idcard_front"}},[t("div",{staticStyle:{width:"100%",height:"100%",display:"flex","flex-direction":"row","justify-content":"normal"}},[t("div",{staticStyle:{"padding-right":"6px"}},[t("el-upload",{staticClass:"uploadData",attrs:{"list-type":"picture-card",action:"#",limit:2,"on-exceed":e.showTip,"before-upload":e.beforeUpImg,"http-request":e.uploadIdcardImages,"on-preview":e.handlePictureCardPreview2,"on-remove":e.handleRemove2,"file-list":e.idcardImgFileList}},[t("i",{staticClass:"el-icon-plus"})]),e._v(" "),t("el-dialog",{attrs:{visible:e.dialogVisible2},on:{"update:visible":function(i){e.dialogVisible2=i}}},[t("img",{attrs:{width:"100%",src:e.dialogImageUrl2,alt:""}})])],1),e._v(" "),t("div",[t("span",{staticClass:"tips-text"},[t("i",{staticClass:"el-icon-warning h-warning"})])]),e._v(" "),t("div",{staticStyle:{width:"380px","line-height":"24px","padding-top":"6px"}},[t("span",{staticClass:"tips-text"},[e._v("请按顺序分别上传正面(照片面)和反面(国徽面)电子版图片,文件大小在 2MB以内,支持png,jpg格式,最多可上传2张")])])])]),e._v(" "),t("el-form-item",{staticStyle:{"padding-top":"20px"}},[t("el-button",{staticStyle:{"margin-right":"40px"},attrs:{type:"primary"},on:{click:e.back}},[e._v("上一步")]),e._v(" "),t("el-button",{attrs:{type:"primary"},on:{click:function(i){return e.next("mainForm")}}},[e._v("下一步")])],1)],1)],1)])],1)},r=[function(){var e=this,i=e.$createElement,a=e._self._c||i;return a("div",{staticClass:"logo-bg"},[a("img",{attrs:{src:t("85ee"),alt:""}})])}],n=(t("fc02"),t("6b1f")),l={name:"FillMainInf",data:function(){var e=this,i=function(i,t,a){e.licenseImgFileList.length>0?a():0===e.licenseImgFileList.length&&a(new Error("营业执照图片至少上传一张"))},t=function(i,t,a){e.idcardImgFileList.length>0?a():0===e.idcardImgFileList.length&&a(new Error("法人证件照图片至少上传一张"))},a=function(e,i,t){var a=/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;a.test(i)?t():t(new Error("法人证件号格式有误"))},r=function(i,t,a){null===e.periodConcreteTime&&!1===e.periodLongTermVal?a(new Error("营业期限具体时间和长期必须填写其中一个")):a()},n=function(i,t,a){null===e.validityConcreteTime&&!1===e.validityLongTermVal?a(new Error("有效期具体时间和长期必须填写其中一个")):a()};return{licenseImgFileList:[],idcardImgFileList:[],dialogImageUrl:"",dialogVisible:!1,dialogImageUrl2:"",dialogVisible2:!1,zzOptions:[{label:"多证合一营业执照(统一社会信用代码)",value:1},{label:"多证合一营业执照(非统一社会信用代码)",value:2}],idcardTypeOptions:[{label:"大陆身份证",value:1},{label:"护照",value:2},{label:"港奥台居民通行证",value:3},{label:"台湾居民通行证",value:4}],periodConcreteTime:null,periodLongTermVal:!1,validityConcreteTime:null,validityLongTermVal:!1,isConcretePeriod:!1,isPeriodDisabled:!1,isValidity:!0,mainForm:{organization_type:2,license_type:"",license:"",organization_name:"",organization_address:"",license_expires_time:"",idcard_type:"",real_name:"",idcard_number:"",idcard_expires_time:"",idcard_front:"",idcardback:"jiazhuangwshifanmian"},hasLicense:!1,mainRules:{license_type:[{required:!0,message:"营业执照类型不能为空",trigger:"change"}],license:[{required:!0,message:"请上传营业执照电子版",validator:i}],organization_name:[{required:!0,message:"企业名称不能为空",trigger:"blur"}],organization_address:[{required:!0,message:"营业执照地址不能为空",trigger:"blur"}],idcard_type:[{required:!0,message:"证件类型不能为空",trigger:"change"}],real_name:[{required:!0,message:"法人姓名不能为空",trigger:"blur"}],idcard_number:[{required:!0,message:"法人证件号不能为空",trigger:"blur"},{required:!0,message:"法人证件号码格式有误",validator:a,trigger:"blur"}],idcard_front:[{required:!0,message:"请上传法人证件电子版图片",validator:t}],license_expires_time:[{validator:r,required:!0,trigger:"change"}],idcard_expires_time:[{validator:n,required:!0,trigger:"change"}]}}},created:function(){this.getMain()},mounted:function(){},methods:{periodConcrete:function(){this.periodConcreteTime&&(this.periodLongTermVal=!1)},periodLongTerm:function(){this.periodLongTermVal&&(this.periodConcreteTime=null)},validityConcrete:function(){this.validityConcreteTime&&(this.validityLongTermVal=!1)},validityLongTerm:function(){this.validityLongTermVal&&(this.validityConcreteTime=null)},beforeUpImg:function(e){var i=e.size/1024/1024>2;return"image/png"!==e.type&&"image/jpg"!==e.type&&"image/jpeg"!=e.type?(this.$message({message:"上传图片格式只支持png/png格式",type:"warning"}),!1):i?(this.$message({message:"上传图片大小不能超过2M",type:"warning"}),!1):void 0},uploadLicenseImages:function(e){var i=this;this.getBase64(e.file).then((function(e){var t=e.split(",");i.Base64img=t[1];var a={image:i.Base64img};Object(n["i"])(a).then((function(e){e&&1==e.data.code&&(i.licenseImgFileList.push({url:e.data.data.imageUrl}),i.$message("上传成功"),i.$refs.mainForm.clearValidate("license"))}))}))},handlePictureCardPreview:function(e){this.dialogImageUrl=e.url,this.dialogVisible=!0},handleRemove:function(e,i){for(var t=0;t<this.licenseImgFileList.length;t++)e.uid===this.licenseImgFileList[t].uid&&this.licenseImgFileList.splice(t,1)},uploadIdcardImages:function(e){var i=this;this.getBase64(e.file).then((function(e){var t=e.split(",");i.Base64img=t[1];var a={image:i.Base64img};Object(n["i"])(a).then((function(e){e&&1==e.data.code&&(i.idcardImgFileList.push({url:e.data.data.imageUrl}),i.$message("上传成功"),i.$refs.mainForm.clearValidate("idcard_front"))}))}))},handlePictureCardPreview2:function(e){this.dialogImageUrl2=e.url,this.dialogVisible2=!0},handleRemove2:function(e,i){for(var t=0;t<this.idcardImgFileList.length;t++)e.uid===this.idcardImgFileList[t].uid&&this.idcardImgFileList.splice(t,1)},getMain:function(){var e=this;Object(n["f"])().then((function(i){if(console.log("获取主体数据:",i),1===i.code){e.resetForm("mainForm"),e.mainForm=i.data,e.mainForm.idcardback="jzwsfm";var t={},a=[];if(e.mainForm.license.indexOf(",")>0){a=e.mainForm.license.split(",");for(var r=0;r<a.length;r++)t={},t.url=a[r],e.licenseImgFileList.push(t)}else t.url=e.mainForm.license,e.licenseImgFileList=[],e.licenseImgFileList.push(t);var n={},l=[];if(e.mainForm.idcard_front.indexOf(",")>0){l=e.mainForm.idcard_front.split(",");for(var s=0;s<l.length;s++)n={},n.url=l[s],e.idcardImgFileList.push(n)}else n.url=e.mainForm.idcard_front,e.idcardImgFileList=[],e.idcardImgFileList.push(n);0===e.mainForm.idcard_expires_time?e.validityLongTermVal=!0:e.validityConcreteTime=e.toStandTime(e.mainForm.idcard_expires_time),0===e.mainForm.license_expires_time?e.periodLongTermVal=!0:e.periodConcreteTime=e.toStandTime(e.mainForm.license_expires_time)}}))},resetForm:function(e){this.$refs[e].resetFields()},getBase64:function(e){return new Promise((function(i,t){var a=new FileReader,r="";a.readAsDataURL(e),a.onload=function(){r=a.result},a.onerror=function(e){t(e)},a.onloadend=function(){i(r)}}))},toStandTime:function(e){var i=new Date(1e3*e),t=i.getFullYear()+"-",a=(i.getMonth()+1<10?"0"+(i.getMonth()+1):i.getMonth()+1)+"-",r=(i.getDate()<10?"0"+i.getDate():i.getDate())+" ",n=(i.getHours()<10?"0"+i.getHours():i.getHours())+":",l=(i.getMinutes()<10?"0"+i.getMinutes():i.getMinutes())+":",s=i.getSeconds()<10?"0"+i.getSeconds():i.getSeconds();return t+a+r+n+l+s},showTip:function(e,i){this.$message({message:"最多上传2张图片",type:"warning"})},back:function(){this.$router.push("/agreement")},next:function(e){var i=this;if(this.periodLongTermVal?this.mainForm.license_expires_time=this.periodLongTermVal-0-1:!1===this.periodLongTermVal&&this.periodConcreteTime?this.mainForm.license_expires_time=new Date(this.periodConcreteTime).getTime()/1e3:this.mainForm.license_expires_time="",this.validityLongTermVal?this.mainForm.idcard_expires_time=this.validityLongTermVal-0-1:!1===this.validityLongTermVal&&this.validityConcreteTime?this.mainForm.idcard_expires_time=new Date(this.validityConcreteTime).getTime()/1e3:this.mainForm.idcard_expires_time="",this.licenseImgFileList.length>0){console.log(445,this.licenseImgFileList);for(var t=0;t<this.licenseImgFileList.length;t++)0===t?this.mainForm.license=this.licenseImgFileList[t].url:this.mainForm.license+=","+this.licenseImgFileList[t].url}if(this.idcardImgFileList.length>0)for(var a=0;a<this.idcardImgFileList.length;a++)0===a?this.mainForm.idcard_front=this.idcardImgFileList[a].url:this.mainForm.idcard_front+=","+this.idcardImgFileList[a].url;this.$refs[e].validate((function(e){e&&Object(n["b"])(i.mainForm).then((function(e){i.$router.push("/fillBrandInf")}))}))}}},s=l,o=(t("a2f2"),t("4ac2")),d=Object(o["a"])(s,a,r,!1,null,"5fa248a3",null);i["default"]=d.exports},"6b1f":function(e,i,t){"use strict";t.d(i,"f",(function(){return r})),t.d(i,"b",(function(){return n})),t.d(i,"d",(function(){return l})),t.d(i,"a",(function(){return s})),t.d(i,"h",(function(){return o})),t.d(i,"g",(function(){return d})),t.d(i,"c",(function(){return c})),t.d(i,"i",(function(){return m})),t.d(i,"e",(function(){return g}));var a=t("b775");function r(e){return Object(a["a"])({url:"/local/getOrganization",method:"get",params:e})}function n(e){return Object(a["a"])({url:"/local/organization",method:"post",data:e})}function l(e){return Object(a["a"])({url:"/local/shopbrand",method:"get",params:e})}function s(e){return Object(a["a"])({url:"/local/brands",method:"post",data:e})}function o(e){return Object(a["a"])({url:"/local/upbrands",method:"post",data:e})}function d(e){return Object(a["a"])({url:"/local/getShopInfo",method:"get",params:e})}function c(e){return Object(a["a"])({url:"/local/addShopInfo",method:"post",data:e})}function m(e){return Object(a["a"])({url:"/system/goods/uploadImg",method:"post",data:e})}function g(e){return Object(a["a"])({url:"/local/cate",method:"get",params:e})}},"85ee":function(e,i,t){e.exports=t.p+"static/img/logo_white_sm.9191b2e1.png"},a2f2:function(e,i,t){"use strict";t("fab9")},fab9:function(e,i,t){}}]);
\ No newline at end of file
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-291b4570"],{3746:function(e,i,t){"use strict";t.r(i);var a=function(){var e=this,i=e.$createElement,t=e._self._c||i;return t("div",{staticClass:"fill-store-inf"},[e._m(0),e._v(" "),t("el-card",{staticClass:"box-card"},[t("div",{staticClass:"clearfix steps",attrs:{slot:"header"},slot:"header"},[t("el-steps",{attrs:{active:1,"align-center":"","finish-status":"success"}},[t("el-step",{attrs:{title:"签署入驻协议"}}),e._v(" "),t("el-step",{attrs:{title:"填写主体信息"}}),e._v(" "),t("el-step",{attrs:{title:"填写品牌信息"}}),e._v(" "),t("el-step",{attrs:{title:"填写店铺信息"}}),e._v(" "),t("el-step",{attrs:{title:"提交入驻审核"}})],1)],1),e._v(" "),t("div",{staticClass:"main-con"},[t("el-form",{ref:"mainForm",attrs:{model:e.mainForm,rules:e.mainRules,"label-width":"180px"}},[t("el-form-item",{attrs:{label:"主体类型:"}},[t("el-radio-group",{model:{value:e.mainForm.organization_type,callback:function(i){e.$set(e.mainForm,"organization_type",i)},expression:"mainForm.organization_type"}},[t("el-radio",{attrs:{label:1}},[e._v("企业/公司")]),e._v(" "),t("el-radio",{attrs:{label:2}},[e._v("个体工商户")])],1)],1),e._v(" "),t("el-form-item",{attrs:{label:"执照类型:",prop:"license_type"}},[t("el-select",{staticStyle:{width:"400px"},attrs:{placeholder:"请选择..."},model:{value:e.mainForm.license_type,callback:function(i){e.$set(e.mainForm,"license_type",i)},expression:"mainForm.license_type"}},e._l(e.zzOptions,(function(e){return t("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1)],1),e._v(" "),t("el-form-item",{attrs:{label:"营业执照电子版:",prop:"license"}},[t("div",{staticStyle:{width:"100%",height:"100%",display:"flex","flex-direction":"row","justify-content":"normal"}},[t("div",{staticStyle:{"padding-right":"6px"}},[t("el-upload",{staticClass:"uploadData",attrs:{action:"#","list-type":"picture-card","http-request":e.uploadLicenseImages,limit:2,"on-exceed":e.showTip,"before-upload":e.beforeUpImg,"on-preview":e.handlePictureCardPreview,"on-remove":e.handleRemove,"file-list":e.licenseImgFileList}},[t("i",{staticClass:"el-icon-plus"})]),e._v(" "),t("el-dialog",{attrs:{visible:e.dialogVisible},on:{"update:visible":function(i){e.dialogVisible=i}}},[t("img",{attrs:{width:"100%",src:e.dialogImageUrl,alt:""}})])],1),e._v(" "),t("div",[t("span",{staticClass:"tips-text"},[t("i",{staticClass:"el-icon-warning h-warning"})])]),e._v(" "),t("div",{staticStyle:{width:"380px","line-height":"24px","padding-top":"6px"}},[t("span",{staticClass:"tips-text"},[e._v("图片大小在2MB以内,支持png,jpg格式,最多可上传2张")])])])]),e._v(" "),t("el-form-item",{attrs:{label:"企业名称:",prop:"organization_name","inline-message":"true"}},[t("el-input",{staticStyle:{width:"400px"},model:{value:e.mainForm.organization_name,callback:function(i){e.$set(e.mainForm,"organization_name",i)},expression:"mainForm.organization_name"}}),e._v(" "),t("span",{staticClass:"tips-text"},[t("i",{staticClass:"el-icon-warning h-warning"}),e._v("请按照营业执照上登记的完整名称填写")])],1),e._v(" "),t("el-form-item",{attrs:{label:"营业执照详细地址:",prop:"organization_address"}},[t("el-input",{staticStyle:{width:"400px"},model:{value:e.mainForm.organization_address,callback:function(i){e.$set(e.mainForm,"organization_address",i)},expression:"mainForm.organization_address"}}),e._v(" "),t("span",{staticClass:"tips-text"},[t("i",{staticClass:"el-icon-warning h-warning"}),e._v("请按照营业执照上的详细地址填写")])],1),e._v(" "),t("el-form-item",{attrs:{gutter:20,label:"营业期限:",prop:"license_expires_time"}},[t("el-date-picker",{staticStyle:{width:"300px"},attrs:{type:"date",placeholder:"选择日期",disabled:e.isConcretePeriod},on:{change:e.periodConcrete},model:{value:e.periodConcreteTime,callback:function(i){e.periodConcreteTime=i},expression:"periodConcreteTime"}}),e._v(" "),t("el-checkbox",{staticStyle:{"padding-left":"15px"},attrs:{disabled:e.isPeriodDisabled},on:{change:e.periodLongTerm},model:{value:e.periodLongTermVal,callback:function(i){e.periodLongTermVal=i},expression:"periodLongTermVal"}},[e._v("长期\n ")]),e._v(" "),t("span",{staticClass:"tips-text"},[t("i",{staticClass:"el-icon-warning h-warning"}),e._v("具体时间和长期,二者必填一个")])],1),e._v(" "),t("el-form-item",{attrs:{label:"法定代表人证件类型:",prop:"idcard_type"}},[t("el-select",{staticStyle:{width:"400px"},attrs:{placeholder:"请选择..."},model:{value:e.mainForm.idcard_type,callback:function(i){e.$set(e.mainForm,"idcard_type",i)},expression:"mainForm.idcard_type"}},e._l(e.idcardTypeOptions,(function(e){return t("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1)],1),e._v(" "),t("el-form-item",{attrs:{label:"法定代表人姓名:",prop:"real_name"}},[t("el-input",{staticStyle:{width:"400px"},model:{value:e.mainForm.real_name,callback:function(i){e.$set(e.mainForm,"real_name",i)},expression:"mainForm.real_name"}}),e._v(" "),t("span",{staticClass:"tips-text"},[t("i",{staticClass:"el-icon-warning h-warning"}),e._v("请按照营业执照上登记的法人填写")])],1),e._v(" "),t("el-form-item",{attrs:{label:"法定代表人证件号:",prop:"idcard_number"}},[t("el-input",{staticStyle:{width:"400px"},model:{value:e.mainForm.idcard_number,callback:function(i){e.$set(e.mainForm,"idcard_number",i)},expression:"mainForm.idcard_number"}})],1),e._v(" "),t("el-form-item",{attrs:{label:"有效期至:",prop:"idcard_expires_time"}},[t("el-date-picker",{staticStyle:{width:"300px"},attrs:{type:"date",placeholder:"选择日期"},on:{change:e.validityConcrete},model:{value:e.validityConcreteTime,callback:function(i){e.validityConcreteTime=i},expression:"validityConcreteTime"}}),e._v(" "),t("el-checkbox",{staticStyle:{"padding-left":"15px"},on:{change:e.validityLongTerm},model:{value:e.validityLongTermVal,callback:function(i){e.validityLongTermVal=i},expression:"validityLongTermVal"}},[e._v("长期\n ")])],1),e._v(" "),t("el-form-item",{attrs:{label:"法人证件电子版:",prop:"idcard_front"}},[t("div",{staticStyle:{width:"100%",height:"100%",display:"flex","flex-direction":"row","justify-content":"normal"}},[t("div",{staticStyle:{"padding-right":"6px"}},[t("el-upload",{staticClass:"uploadData",attrs:{"list-type":"picture-card",action:"#",limit:2,"on-exceed":e.showTip,"before-upload":e.beforeUpImg,"http-request":e.uploadIdcardImages,"on-preview":e.handlePictureCardPreview2,"on-remove":e.handleRemove2,"file-list":e.idcardImgFileList}},[t("i",{staticClass:"el-icon-plus"})]),e._v(" "),t("el-dialog",{attrs:{visible:e.dialogVisible2},on:{"update:visible":function(i){e.dialogVisible2=i}}},[t("img",{attrs:{width:"100%",src:e.dialogImageUrl2,alt:""}})])],1),e._v(" "),t("div",[t("span",{staticClass:"tips-text"},[t("i",{staticClass:"el-icon-warning h-warning"})])]),e._v(" "),t("div",{staticStyle:{width:"380px","line-height":"24px","padding-top":"6px"}},[t("span",{staticClass:"tips-text"},[e._v("请按顺序分别上传正面(照片面)和反面(国徽面)电子版图片,文件大小在 2MB以内,支持png,jpg格式,最多可上传2张")])])])]),e._v(" "),t("el-form-item",{staticStyle:{"padding-top":"20px"}},[t("el-button",{staticStyle:{"margin-right":"40px"},attrs:{type:"primary"},on:{click:e.back}},[e._v("上一步")]),e._v(" "),t("el-button",{attrs:{type:"primary"},on:{click:function(i){return e.next("mainForm")}}},[e._v("下一步")])],1)],1)],1)])],1)},r=[function(){var e=this,i=e.$createElement,a=e._self._c||i;return a("div",{staticClass:"logo-bg"},[a("img",{attrs:{src:t("85ee"),alt:""}})])}],n=(t("fc02"),t("6b1f")),l={name:"FillMainInf",data:function(){var e=this,i=function(i,t,a){e.licenseImgFileList.length>0?a():0===e.licenseImgFileList.length&&a(new Error("营业执照图片至少上传一张"))},t=function(i,t,a){e.idcardImgFileList.length>0?a():0===e.idcardImgFileList.length&&a(new Error("法人证件照图片至少上传一张"))},a=function(e,i,t){var a=/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;a.test(i)?t():t(new Error("法人证件号格式有误"))},r=function(i,t,a){null===e.periodConcreteTime&&!1===e.periodLongTermVal?a(new Error("营业期限具体时间和长期必须填写其中一个")):a()},n=function(i,t,a){null===e.validityConcreteTime&&!1===e.validityLongTermVal?a(new Error("有效期具体时间和长期必须填写其中一个")):a()};return{licenseImgFileList:[],idcardImgFileList:[],dialogImageUrl:"",dialogVisible:!1,dialogImageUrl2:"",dialogVisible2:!1,zzOptions:[{label:"多证合一营业执照(统一社会信用代码)",value:1},{label:"多证合一营业执照(非统一社会信用代码)",value:2}],idcardTypeOptions:[{label:"大陆身份证",value:1},{label:"护照",value:2},{label:"港奥台居民通行证",value:3},{label:"台湾居民通行证",value:4}],periodConcreteTime:null,periodLongTermVal:!1,validityConcreteTime:null,validityLongTermVal:!1,isConcretePeriod:!1,isPeriodDisabled:!1,isValidity:!0,mainForm:{organization_type:2,license_type:"",license:"",organization_name:"",organization_address:"",license_expires_time:"",idcard_type:"",real_name:"",idcard_number:"",idcard_expires_time:"",idcard_front:"",idcardback:"jiazhuangwshifanmian"},hasLicense:!1,mainRules:{license_type:[{required:!0,message:"营业执照类型不能为空",trigger:"change"}],license:[{required:!0,message:"请上传营业执照电子版",validator:i}],organization_name:[{required:!0,message:"企业名称不能为空",trigger:"blur"}],organization_address:[{required:!0,message:"营业执照地址不能为空",trigger:"blur"}],idcard_type:[{required:!0,message:"证件类型不能为空",trigger:"change"}],real_name:[{required:!0,message:"法人姓名不能为空",trigger:"blur"}],idcard_number:[{required:!0,message:"法人证件号不能为空",trigger:"blur"},{required:!0,message:"法人证件号码格式有误",validator:a,trigger:"blur"}],idcard_front:[{required:!0,message:"请上传法人证件电子版图片",validator:t}],license_expires_time:[{validator:r,required:!0,trigger:"change"}],idcard_expires_time:[{validator:n,required:!0,trigger:"change"}]}}},created:function(){this.getMain()},mounted:function(){},methods:{periodConcrete:function(){this.periodConcreteTime&&(this.periodLongTermVal=!1)},periodLongTerm:function(){this.periodLongTermVal&&(this.periodConcreteTime=null)},validityConcrete:function(){this.validityConcreteTime&&(this.validityLongTermVal=!1)},validityLongTerm:function(){this.validityLongTermVal&&(this.validityConcreteTime=null)},beforeUpImg:function(e){var i=e.size/1024/1024>2;return"image/png"!==e.type&&"image/jpg"!==e.type&&"image/jpeg"!=e.type?(this.$message({message:"上传图片格式只支持png/png格式",type:"warning"}),!1):i?(this.$message({message:"上传图片大小不能超过2M",type:"warning"}),!1):void 0},uploadLicenseImages:function(e){var i=this;this.getBase64(e.file).then((function(e){var t=e.split(",");i.Base64img=t[1];var a={image:i.Base64img};Object(n["i"])(a).then((function(e){e&&1==e.data.code&&(i.licenseImgFileList.push({url:e.data.data.imageUrl}),i.$message({type:"success",message:"上传成功"}),i.$refs.mainForm.clearValidate("license"))}))}))},handlePictureCardPreview:function(e){this.dialogImageUrl=e.url,this.dialogVisible=!0},handleRemove:function(e,i){for(var t=0;t<this.licenseImgFileList.length;t++)e.uid===this.licenseImgFileList[t].uid&&this.licenseImgFileList.splice(t,1)},uploadIdcardImages:function(e){var i=this;this.getBase64(e.file).then((function(e){var t=e.split(",");i.Base64img=t[1];var a={image:i.Base64img};Object(n["i"])(a).then((function(e){e&&1==e.data.code&&(i.idcardImgFileList.push({url:e.data.data.imageUrl}),i.$message("上传成功"),i.$refs.mainForm.clearValidate("idcard_front"))}))}))},handlePictureCardPreview2:function(e){this.dialogImageUrl2=e.url,this.dialogVisible2=!0},handleRemove2:function(e,i){for(var t=0;t<this.idcardImgFileList.length;t++)e.uid===this.idcardImgFileList[t].uid&&this.idcardImgFileList.splice(t,1)},getMain:function(){var e=this;Object(n["f"])().then((function(i){if(console.log("获取主体数据:",i),1===i.code){e.resetForm("mainForm"),e.mainForm=i.data,e.mainForm.idcardback="jzwsfm";var t={},a=[];if(e.mainForm.license.indexOf(",")>0){a=e.mainForm.license.split(",");for(var r=0;r<a.length;r++)t={},t.url=a[r],e.licenseImgFileList.push(t)}else t.url=e.mainForm.license,e.licenseImgFileList=[],e.licenseImgFileList.push(t);var n={},l=[];if(e.mainForm.idcard_front.indexOf(",")>0){l=e.mainForm.idcard_front.split(",");for(var s=0;s<l.length;s++)n={},n.url=l[s],e.idcardImgFileList.push(n)}else n.url=e.mainForm.idcard_front,e.idcardImgFileList=[],e.idcardImgFileList.push(n);0===e.mainForm.idcard_expires_time?e.validityLongTermVal=!0:e.validityConcreteTime=e.toStandTime(e.mainForm.idcard_expires_time),0===e.mainForm.license_expires_time?e.periodLongTermVal=!0:e.periodConcreteTime=e.toStandTime(e.mainForm.license_expires_time)}}))},resetForm:function(e){this.$refs[e].resetFields()},getBase64:function(e){return new Promise((function(i,t){var a=new FileReader,r="";a.readAsDataURL(e),a.onload=function(){r=a.result},a.onerror=function(e){t(e)},a.onloadend=function(){i(r)}}))},toStandTime:function(e){var i=new Date(1e3*e),t=i.getFullYear()+"-",a=(i.getMonth()+1<10?"0"+(i.getMonth()+1):i.getMonth()+1)+"-",r=(i.getDate()<10?"0"+i.getDate():i.getDate())+" ",n=(i.getHours()<10?"0"+i.getHours():i.getHours())+":",l=(i.getMinutes()<10?"0"+i.getMinutes():i.getMinutes())+":",s=i.getSeconds()<10?"0"+i.getSeconds():i.getSeconds();return t+a+r+n+l+s},showTip:function(e,i){this.$message({message:"最多上传2张图片",type:"warning"})},back:function(){this.$router.push("/agreement")},next:function(e){var i=this;if(this.periodLongTermVal?this.mainForm.license_expires_time=this.periodLongTermVal-0-1:!1===this.periodLongTermVal&&this.periodConcreteTime?this.mainForm.license_expires_time=new Date(this.periodConcreteTime).getTime()/1e3:this.mainForm.license_expires_time="",this.validityLongTermVal?this.mainForm.idcard_expires_time=this.validityLongTermVal-0-1:!1===this.validityLongTermVal&&this.validityConcreteTime?this.mainForm.idcard_expires_time=new Date(this.validityConcreteTime).getTime()/1e3:this.mainForm.idcard_expires_time="",this.licenseImgFileList.length>0){console.log(445,this.licenseImgFileList);for(var t=0;t<this.licenseImgFileList.length;t++)0===t?this.mainForm.license=this.licenseImgFileList[t].url:this.mainForm.license+=","+this.licenseImgFileList[t].url}if(this.idcardImgFileList.length>0)for(var a=0;a<this.idcardImgFileList.length;a++)0===a?this.mainForm.idcard_front=this.idcardImgFileList[a].url:this.mainForm.idcard_front+=","+this.idcardImgFileList[a].url;this.$refs[e].validate((function(e){e&&Object(n["b"])(i.mainForm).then((function(e){i.$router.push("/fillBrandInf")}))}))}}},s=l,o=(t("8f29"),t("4ac2")),d=Object(o["a"])(s,a,r,!1,null,"db67e44a",null);i["default"]=d.exports},43603:function(e,i,t){},"6b1f":function(e,i,t){"use strict";t.d(i,"f",(function(){return r})),t.d(i,"b",(function(){return n})),t.d(i,"d",(function(){return l})),t.d(i,"a",(function(){return s})),t.d(i,"h",(function(){return o})),t.d(i,"g",(function(){return d})),t.d(i,"c",(function(){return c})),t.d(i,"i",(function(){return m})),t.d(i,"e",(function(){return g}));var a=t("b775");function r(e){return Object(a["a"])({url:"/local/getOrganization",method:"get",params:e})}function n(e){return Object(a["a"])({url:"/local/organization",method:"post",data:e})}function l(e){return Object(a["a"])({url:"/local/shopbrand",method:"get",params:e})}function s(e){return Object(a["a"])({url:"/local/brands",method:"post",data:e})}function o(e){return Object(a["a"])({url:"/local/upbrands",method:"post",data:e})}function d(e){return Object(a["a"])({url:"/local/getShopInfo",method:"get",params:e})}function c(e){return Object(a["a"])({url:"/local/addShopInfo",method:"post",data:e})}function m(e){return Object(a["a"])({url:"/system/goods/uploadImg",method:"post",data:e})}function g(e){return Object(a["a"])({url:"/local/cate",method:"get",params:e})}},"85ee":function(e,i,t){e.exports=t.p+"static/img/logo_white_sm.9191b2e1.png"},"8f29":function(e,i,t){"use strict";t("43603")}}]);
\ No newline at end of file
<template>
<div class="goods-info">
<el-form :model="goodsInfoForm" :rules="goodsInfoRules" ref="goodsInfoForm" label-width="150px" class="demo-goodsInfoForm" size="small">
<el-form-item label="商品分类:" prop="categoryStr">
<el-input style="width:400px;" v-model="goodsInfoForm.categoryStr" :disabled="true"></el-input>
<!-- <span class="type-text-span">{{ goodsInfoForm.categoryStr }}</span>-->
<el-link class="edit-type-span el-icon-edit" type="primary" :underline="false" @click="editType">修改所在类目</el-link>
<span class="tip-span">该商品所在类目须支持七天无理由退货</span>
</el-form-item>
<el-form-item label='商品标题:' prop="goodsName">
<el-input v-model="goodsInfoForm.goodsName" placeholder="请输入商品标题" style="width:400px;"></el-input>
<span class="tip-span ml20">商品名称限制在30字以内,不要填写与商品无关的词</span>
</el-form-item>
<el-form-item label="商品产地:" prop="producingArea">
<el-select v-model="goodsInfoForm.producingArea" placeholder="请选择商品产地" style="width: 400px;">
<el-option
v-for="item in areaOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="商品发货地:" prop="fhd">
<el-select v-model="goodsInfoForm.fhd" placeholder="请选择商品发货地" style="width: 400px;">
<el-option
v-for="item in areaOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="所属品牌:" prop="goodsBrand">
<el-select v-model="goodsInfoForm.goodsBrand" placeholder="请选择商品品牌" style="width: 400px;">
<el-option
v-for="item in brandOptions"
:key="item.id"
:label="item.brand_cn"
:value="item.id"
></el-option>
</el-select>
<el-link class="edit-type-span el-icon-plus" type="primary" :underline="false" @click="toBrand">新增品牌</el-link>
</el-form-item>
<el-form-item label='市场参考价链接:'>
<el-input v-model="goodsInfoForm.lj" placeholder="请输入京东或者淘宝的商品链接" style="width:400px;"></el-input>
</el-form-item>
<el-form-item label='商品编码:'>
<el-input v-model="goodsInfoForm.spbm" placeholder="请输入商品编码(非必须)" style="width:400px;"></el-input>
</el-form-item>
<el-form-item label="商品图片:" prop="sptp">
<span class="tip-span" style="display: block;line-height: 34px;">商品图片最多上传9张,默认第一张为主图 <span>单张图片需限制在2M以内,可上传png、jpg格式,尺寸要求为正方形</span></span>
<el-upload
class="upload-img"
list-type="picture-card"
action="#"
:limit="1"
:on-exceed="limitImg9"
:http-request="uploadGoodsImg"
:on-preview="handlePictureCardPreview"
:on-remove="handleRemove"
:file-list="goodsImgFileList"
><i class="el-icon-plus" />
</el-upload>
<el-dialog :visible.sync="goodsImgVisible">
<img width="100%" :src="goodsImgUrlDialog" alt="">
</el-dialog>
</el-form-item>
</el-form>
<!-- 修改 商品分类目录 -->
<el-dialog
v-loading="loadingSSQ"
class="add-workorder-dialog"
title="修改商品分类"
:visible.sync="editGoodsTypeDialog"
:destroy-on-close="true"
:before-close="cancelType"
width="60%"
center
>
<!-- <p>当前所选类目:<span></span></p>-->
<el-cascader-panel v-show="editGoodsTypeDialog" v-model="SSQGoodsList" :props='goodsprops' @change="SSQGoodsChange" ref="ssqGoodsCascader"></el-cascader-panel>
<span slot="footer" class="dialog-footer">
<el-button @click="cancelType" size="mini">取 消</el-button>
<el-button type="primary" @click="saveType" size="mini">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { GetCategory, GetFreight, UploadImg } from '@/api/module/goods'
import { getAreaList } from '@/api/module/retreat/address';
import { getBrandsInf } from '@/api/module/brand/brand'
export default {
name: 'goods',
props: {
goodsinfodata: {
type: Object,
required: true
}
},
data() {
let categoryIdCheck = (rule, value, callback) => {
if (this.goodsImgFileList.length < 1) {
callback(new Error("请上传商品图片"));
} else {
callback();
}
};
return {
//loading: false,
// categoryStr: '',
goodsInfoDataClone: {},
areaOptions: [], // 地址 省
brandOptions: [], // 商品品牌
goodsInfoForm: {
categoryStr: '', // 商品分类 地址拼接
categoryList: [],
goodsName: '',
producingArea: [], // 产地
fhd: [], // 发货地
goodsBrand: [], // 品牌
sptp: '' // 商品图片
},
goodsInfoRules: {
categoryStr: [{required: true, message: '商品分类不能为空', trigger: 'blur'},],
goodsName: [
{required: true, message: '请输入商品名称', trigger: 'blur'},
{min: 3, max: 30, message: '商品标题限制在30字以内', trigger: 'blur'}
],
producingArea:[{required: true, message: '请选择商品产地', trigger: 'change'}],
fhd: [{required: true, message: '请选择商品发货地', trigger: 'change'}],
goodsBrand: [{required: true, message: '请选择商品品牌', trigger: 'change'}],
sptp: [{required: true, message: '请上传商品图片', validator: categoryIdCheck}]
},
goodsImgFileList: [], // 商品图片地址 集合list
goodsImgVisible: false, // 图片能否预览
goodsImgUrlDialog: '',
/* 修改 商品分类 */
loadingSSQ: false,
editGoodsTypeDialog: false,
SSQGoodsList: [], // 省市区 子组件goods的
goodsprops: {
expandTrigger: 'click',
lazy: true,
lazyLoad: this.lazyLoad,
value: "id",
label: 'name',
leaf: 'leaf'
},
} // return end
},
components: {},
watch: {
// serviceagsTags: {
// handler(val, oldVal) {
// this.$set(this.goodsInfoForm, 'serviceagsTags', val)
// },
// deep: true
// },
},
created() {
// 深拷贝一份最开始的数据,为初始化准备
this.goodsInfoDataClone = this.deepClone(this.goodsinfodata);
this.goodsInfoForm = this.goodsinfodata
// console.log("父组件传过来的",this.goodsinfodata)
// console.log("1111",this.goodsInfoForm)
// 获取 省
this.getArea();
// 获取 商品品牌
this.getBrands();
},
mounted() {
// this.getCategory();
// this.getFreight();
// this.getBrands();
},
methods: {
// 获取 省
getArea() {
let limboNode = {
pid: 0
};
getAreaList(limboNode).then( res=> {
if(res.data) {
this.areaOptions = res.data;
}else {
this.areaOptions = [];
}
});
},
// 获取 商品品牌
getBrands() {
getBrandsInf().then( res => {
if(res.data) {
this.brandOptions = res.data.data;
}else {
this.brandOptions = [];
}
});
},
/* 修改 商品分类 类目 */
editType() {
this.SSQGoodsList = [];
this.editGoodsTypeDialog = true;
this.SSQGoodsList = this.goodsInfoForm.categoryList
console.log(222,this.SSQGoodsList);
},
lazyLoad(node, resolve) {
this.getSSQArea(node, resolve);
},
getSSQArea(node, resolve) {
const level = node.level;
let limboNode = {};
if(level === 0) {
//debugger
limboNode = {pid: 0}
}
if(level === 1) {
//debugger
limboNode = { pid: node.value };
}
if(level === 2) {
limboNode = { pid: node.value };
}
//this.loadingSSQ = true;
getAreaList(limboNode).then(res => {
let result = {};
if (level === 0) {
result = res.data
result.forEach(item => {
item.value = item.id;
item.label = item.name;
item.children=[];
item.leaf = 0; // 可以控制 是否有下级 值为true都不行,必须等于0
})
}
if (level === 1) {
result = res.data
result.forEach(item => {
item.value = item.id;
item.label = item.name
item.children=[];
//这句代码表示当点击最后一级的时候 label后面不会转圈圈 并把相关值赋值到选择器上
item.leaf = 0
})
}
if (level === 2) {
result = res.data
result.forEach(item => {
item.value = item.id;
item.label = item.name
item.leaf = 1;
})
}
resolve(result)
//this.loadingSSQ = false;
});
},
SSQGoodsChange(value) {
//this.SSQGoodsList = value;
},
// 确认 修改 商品分类
saveType() {
},
// 取消 修改 商品分类
cancelType() {
this.editGoodsTypeDialog = false;
},
// 上传 商品图片,限制 9 张
limitImg9() {
this.$message({ message: '最多上传9张图片', type: 'warning' })
},
// 上传 商品图片
uploadGoodsImg(param) {
this.getBase64(param.file).then( res => {
let result = res.split(",");
this.Base64img = result[1];
let data = {"image":this.Base64img};
//console.log(213,data);
UploadImg(data).then( res=> {
console.log(217,res);
let urlObj = {'url': ''};
if(res.data) {
urlObj.url = res.data.data.imageUrl;
this.goodsImgFileList.push(urlObj);
this.$message({type:'success',message:'图片上传成功'});
// 只清除一次,不浪费哦
if(this.goodsImgFileList.length === 1) {
this.$refs.goodsInfoForm.clearValidate('sptp');
}
}
});
});
},
// 商品信息 子组件 form表单校验, 在父组件中被调用
validateGoodsInfoForm () {
let flag = null
this.$refs['goodsInfoForm'].validate(valid => {
if (valid) {
flag = true
} else {
flag = false
}
})
return flag
},
// 商品图片 预览
handlePictureCardPreview(file) {
this.goodsImgUrlDialog = file.url;
this.goodsImgVisible = true;
},
// 删除 商品图片
handleRemove(file) {
for (let i = 0; i < this.goodsImgFileList.length; i++) {
if (file.uid === this.goodsImgFileList[i].uid) {
this.goodsImgFileList.splice(i, 1)
}
}
if(this.goodsImgFileList.length === 0) {
this.$refs.goodsInfoForm.validateField('sptp')
}else {
this.$refs.goodsInfoForm.clearValidate('sptp');
}
},
// 维护品牌
toBrand() {
this.$router.push({path: '/system/shop/brand'});
},
// 通用 方法
// 图片转换为 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);
};
});
},
} // methods end
}
</script>
<style scoped>
ul {
padding: 0;
}
.goods-info {
padding: 15px 0px;
margin-top: 18px;
}
.type-text-span {
display: inline-block;
width: 400px;
/*margin: 0 20px 0;*/
}
.edit-type-span {
display: inline-block;
cursor: pointer;
margin: 0 20px;
}
/* 一般提示性文字 */
.tip-span {
color: #909399;
font-size: 12px;
}
/deep/.el-form-item {
margin-bottom: 20px;
}
</style>
<template>
<div class="app-container">
<!-- 选择商品类目 start -->
<el-card class="box-card" v-if="!isShowGoodsDetails">
<div slot="header" class="clearfix">
<p class="card-header-title"><span class="blue-block-goods"></span>确认商品所在目录</p>
</div>
<div>
<div>
<p class="goods-type-tip">为商品设置正确的类目,能让商品快速的被搜索到</p>
</div>
<div class="goods-type-options" v-loading="loading">
<el-cascader-panel v-model="SSQList" :props='props' @change="SSQChange" ref="ssqCascader"></el-cascader-panel>
</div>
<el-button type="primary" class="next-step" :disabled="isNextStep" @click="nextStep">下一步</el-button>
</div>
</el-card>
<!-- 选择商品类目 end -->
<!-- 添加商品 start -->
<el-card class="box-card good-details-body" v-if="isShowGoodsDetails">
<div class="floor-nav" id="floorNavList">
<ul class="nav-list">
<li class="nav-list-item" :class="{'floor-item-active': isFIActive === index}" v-for="(item, index) in floorNav" :key="item.id" @click="setFloorNavMountClick(index)">{{ item.name }}</li>
</ul>
</div>
<div class="floor-cont" ref="scrollview">
<div class="floor-item">
<div class="floor-item-box">
<p class="card-header-title floor-item-box-title"><span class="blue-block-goods blue-block-goods-title"></span>商品信息</p>
<Goodsinfomation ref="goodsInfo" :goodsinfodata='goodsinfodata'/>
</div>
</div>
<div class="floor-item">
<div class="floor-item-box">
<p class="card-header-title floor-item-box-title"><span class="blue-block-goods blue-block-goods-title"></span>商品规格</p>
</div>
</div>
<div class="floor-item">
<div class="floor-item-box">
<p class="card-header-title floor-item-box-title"><span class="blue-block-goods blue-block-goods-title"></span>商品售价</p>
</div>
</div>
<div class="floor-item">
<div class="floor-item-box">
<p class="card-header-title floor-item-box-title"><span class="blue-block-goods blue-block-goods-title"></span>商品详情</p>
</div>
</div>
<div class="floor-item">
<div class="floor-item-box">
<p class="card-header-title floor-item-box-title"><span class="blue-block-goods blue-block-goods-title"></span>售后及服务</p>
<Goodsaftersale ref="goodsaftersale" :goodsaftersale="goodsaftersale" />
<div class="submit-type-con">
<el-radio-group v-model="submitType" size="small">
<el-radio :label="1" border>放入仓库</el-radio>
<el-radio :label="2" border>立即上架</el-radio>
</el-radio-group>
</div>
</div>
</div>
</div>
<div class="submit-cont">
<el-button type="primary" style="padding: 10px 30px;" @click="save">提 交</el-button>
</div>
</el-card>
<!-- 添加商品 end -->
</div>
</template>
<script>
import { getAreaList } from '@/api/module/retreat/address';
import Goodsinfomation from './components/goodsinfomation'
import Goodsaftersale from './components/goodsaftersale'
// let TIMER = null;
export default {
data() {
return {
loading: false,
SSQList: [], // 省市区
SSQStr: '', // 省市区 拼接
props: {
expandTrigger: 'click',
lazy: true,
lazyLoad: this.lazyLoad,
value: "id",
label: 'name',
leaf: 'leaf'
},
isNextStep: true,
isShowGoodsDetails: false,
isFIActive: 0,
/**/
floorNav: [
{ id: 1, name: '商品信息' },
{ id: 2, name: '商品规格' },
{ id: 3, name: '商品售价' },
{ id: 4, name: '商品详情' },
{ id: 5, name: '售后及服务' },
],
/* 商品信息 */
goodsinfodata: {
categoryList: [],
categoryStr: ''
},
/* 售后及服务 */
goodsaftersale: {
},
submitType: 1,
TIMER: null,
} // return end
},
components: {
Goodsinfomation,
Goodsaftersale
},
created() {
},
mounted() {
},
methods: {
// 只有点击完最后一级,才会有值
SSQChange() {
if(this.SSQList && this.SSQList.length > 0) {
this.isNextStep = false
}else {
this.SSQList = []
this.isNextStep = true
}
},
lazyLoad(node, resolve) {
this.SSQList = [];
this.SSQStr = '';
this.getArea(node, resolve);
if(this.SSQList && this.SSQList.length > 0) {
this.isNextStep = false
}else {
this.isNextStep = true
}
},
getArea(node, resolve) {
const level = node.level;
let limboNode = {};
if(level === 0) {
limboNode = {pid: 0}
}
if(level === 1) {
limboNode = { pid: node.value };
}
if(level === 2) {
limboNode = { pid: node.value };
}
this.loading = true;
getAreaList(limboNode).then(res => {
let result = {};
// debugger
if (level === 0) {
result = res.data
result.forEach(item => {
item.value = item.id;
item.label = item.name;
item.children=[];
item.leaf = 0; // 可以控制 是否有下级 值为true都不行,必须等于0
})
}
if (level === 1) {
result = res.data
result.forEach(item => {
item.value = item.id;
item.label = item.name
item.children=[];
//这句代码表示当点击最后一级的时候 label后面不会转圈圈 并把相关值赋值到选择器上
item.leaf = 0
})
}
if (level === 2) {
result = res.data
result.forEach(item => {
item.value = item.id;
item.label = item.name
item.leaf = 1;
})
}
// result = []
resolve(result)
this.loading = false;
});
},
// 添加商品后,下一步 操作
nextStep() {
// 注意数据格式 [1,2,3] 数组,且里面是数字类型
let ssqLabelList = this.$refs['ssqCascader'].getCheckedNodes()[0].pathLabels;
this.goodsinfodata.categoryList = this.SSQList;
this.goodsinfodata.categoryStr = ssqLabelList[0] + '/' + ssqLabelList[1] + '/' + ssqLabelList[2];
this.isShowGoodsDetails = true;
},
//
// getGoodsAfterSaleData(data) {
// console.log("售后子组件给的:",data);
// },
//
save() {
// 此处变量 有顺序 校验时,电梯至某处
// 商品信息 是否填写完整
let isGoodsInfoMsg = this.$refs['goodsInfo'].validateGoodsInfoForm();
// 售后服务 是否填写完整
let isGoodsAfterSaleMsg = this.$refs['goodsaftersale'].validateGoodsAfterSaleForm();
//console.log(212,this.$refs.goodsaftersale.goodsAfterSaleForm) // 主动获取子组件数据
//console.log(2222,isGoodsAfterSaleMsg,isGoodsInfoMsg);
if(!isGoodsInfoMsg) {
this.$message({type:'error',message:'商品信息未填写完整'});
this.setFloorNavMountClick(0);
return
}
if(!isGoodsAfterSaleMsg) {
this.$message({type:'error',message:'售后及服务未填写完整'});
this.setFloorNavMountClick(4);
return
}
},
/* 添加商品详细 */
/* 设置楼层导航事件驱动方法* @params Number index 楼层下标 */
setFloorNavMountClick(index) {
let _this = this
_this.isFIActive = index;
//debugger
clearInterval(_this.TIMER)
let floor_item = document.getElementsByClassName('floor-item'),
floor_offsetTop = floor_item[index].offsetTop - floor_item[0].offsetTop,
window_scrollTop = _this.$refs.scrollview.scrollTop,
timer = { step: 45, times: 20, FLOOR_OFFSETTOP: floor_offsetTop };
console.log(3333,floor_item[0].offsetTop,floor_item[1].offsetTop,floor_item[2].offsetTop,floor_item[3].offsetTop,floor_item[4].offsetTop,document.body.scrollTop,document.documentElement.scrollTop);
//debugger
if (window_scrollTop > floor_offsetTop) {
_this.setFloorScrollArrowUp(timer)
} else if (window_scrollTop === floor_offsetTop) {
return false
} else {
_this.setFloorScrollArrowDown(timer)
}
},
/* 设置楼层向上滚动* @params Object timer 定时器配置 */
setFloorScrollArrowUp(timer) {
//debugger
let _this = this
clearInterval(_this.TIMER)
_this.TIMER = setInterval(() => {
const window_scrollTop = _this.$refs.scrollview.scrollTop
if (window_scrollTop <= timer.FLOOR_OFFSETTOP) {
_this.$refs.scrollview.scrollTop = timer.FLOOR_OFFSETTOP
clearInterval(_this.TIMER)
} else {
_this.$refs.scrollview.scrollTop = window_scrollTop - timer.step
}
}, timer.times)
},
/* 设置楼层向下滚动@params Object timer 定时器配置 */
setFloorScrollArrowDown(timer) {
let floor_item = document.getElementsByClassName('floor-cont');
let fuck = 0;
let _this = this
clearInterval(_this.TIMER)
fuck = timer.FLOOR_OFFSETTOP
/**/
// if(_this.isFIActive === 4) {
// console.log(280,_this.$refs.scrollview.scrollTop);
// timer.FLOOR_OFFSETTOP = timer.FLOOR_OFFSETTOP - 333;
// }
console.log(999,floor_item[0].offsetHeight); //offsetHeight
/**/
_this.TIMER = setInterval(() => {
const window_scrollTop = _this.$refs.scrollview.scrollTop
if (window_scrollTop >= timer.FLOOR_OFFSETTOP) {
_this.$refs.scrollview.scrollTop = timer.FLOOR_OFFSETTOP
clearInterval(_this.TIMER)
} else {
_this.$refs.scrollview.scrollTop = window_scrollTop + timer.step
}
}, timer.times)
},
} // methods end
}
</script>
<style scoped lang="scss" type="text/css">
p {
margin: 0;
padding: 0;
}
/* el-card title hxz 样式统一 */
.card-header-title {
display: flex;
flex-direction: row;
justify-content: start;
align-items: center;
font-size: 18px;
color: #333;
font-weight: 400;
height: 24px;
}
.blue-block-goods {
width: 5px;
height: 24px;
background: #3A84FF;
margin: 0 7px 0 0;
border-radius: 2px;
}
/* el-card title hxz 样式统一 end */
.goods-type-tip {
width: 100%;
background: #F1F7FD;
border: 1px solid #3A84FF;
font-size: 14px;
font-weight: 400;
color: #3A84FF;
line-height: 1em;
padding: 14px 15px;
}
.goods-type-options {
margin: 25px 0;
}
/*------------ 联级面板样式重置 start ------------*/
/deep/.el-cascader-panel.is-bordered {
border: none;
}
/deep/.el-cascader-menu {
min-width: 280px;
border: none;
box-shadow: 0px 4px 9px 1px rgba(51, 51, 51, 0.09);
border-radius: 2px;
overflow: hidden;
}
/deep/.el-cascader-menu__wrap {
width: 280px;
height: 500px;
overflow: auto;
margin: 5px 0!important;
}
/* 很重要,不要问我为什么 */
/deep/.el-scrollbar:hover>.el-scrollbar__bar, /deep/.el-scrollbar:active>.el-scrollbar__bar, /deep/.el-scrollbar:focus>.el-scrollbar__bar {
opacity: 0;
}
/*------------ 联级面板样式重置 end ---------------*/
.next-step {
padding: 10px 25px;
margin: 0 auto;
display: block;
}
/* 电梯效果 样式 */
.floor-nav {
width: 100%;
}
.floor-nav .nav-list {
padding: 0;
margin:0;
display: flex;
justify-content: start;
flex-direction: row;
border-bottom:1px solid #eee;
}
.floor-nav .nav-list .nav-list-item {
font-size: 18px;
font-weight: 400;
color: #333333;
padding: 0 25px 15px;
list-style: none;
vertical-align: middle;
align-self: center;
border-bottom: 2px solid #fff;
cursor: pointer;
}
.floor-nav .nav-list .floor-item-active,
.floor-nav .nav-list .nav-list-item:hover {
color: #3A84FF;
font-weight: bold;
border-bottom: 2px solid #3A84FF;
}
.floor-item-box-title {
background: #F1F1F6;
height: 45px;
}
.blue-block-goods-title {
margin: 0 20px 0 0;
}
/deep/.good-details-body .el-card__body {
height: 100%;
padding: 15px 20px 0px 20px;
overflow: hidden;
}
.floor-cont{
height: calc(100% - 98px);
overflow: auto;
}
.floor-item {
padding: 0 20px 0 0;
margin: 15px auto;
min-height: 300px;
color: #333;
}
.submit-type-con {
width: 236px;
margin: 0 auto 20px;
}
.submit-cont {
width: calc(100% + 40px);
padding: 12px 0 8px;
margin-left: -20px;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
/*align-content: center;*/
box-shadow: 0px -8px 9px 1px rgba(51, 51, 51, 0.06);
}
</style>
<template>
<div class="app-container">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
<el-row>
<el-col :span="12">
<el-form-item label="商品名称" prop="goodsName">
<el-input v-model="ruleForm.goodsName" style="width:400px;"></el-input>
<el-popover
placement="top-start" width="300" trigger="hover" content="最多允许输入30个汉字(60字符),建议标题内包含与商品相关的关键词">
<i style="color: #e3c300;font-size:16px" class="el-icon-question" slot="reference"></i>
</el-popover>
</el-form-item>
<el-form-item label="商品分类" prop="categoryId">
<el-cascader v-model="ruleForm.categoryId" :props='propsaddress' :options="options1" @change="handleChange"
style="width:400px;"></el-cascader>
</el-form-item>
<el-form-item label="市场原价" prop="scPrice">
<el-input v-model="ruleForm.scPrice" style="width:400px;"></el-input>
<el-popover
placement="top-start" width="300" trigger="hover" content="市场原价起到参考的作用">
<i style="color: #e3c300;font-size:16px" class="el-icon-question" slot="reference"></i>
</el-popover>
</el-form-item>
<el-form-item label="指导售价" prop="price">
<el-input v-model="ruleForm.price" style="width:400px;"></el-input>
<el-popover
placement="top-start" width="300" trigger="hover" content="您建议下游商家售卖的价格">
<i style="color: #e3c300;font-size:16px" class="el-icon-question" slot="reference"></i>
</el-popover>
</el-form-item>
<el-form-item label="结算价格" prop="jsPrice">
<el-input v-model="ruleForm.jsPrice" style="width:400px;"></el-input>
<el-popover
placement="top-start" width="300" trigger="hover" content="您与云仓平台最终结算的价格">
<i style="color: #e3c300;font-size:16px" class="el-icon-question" slot="reference"></i>
</el-popover>
</el-form-item>
<el-form-item label="运费模板" prop="freightId">
<el-radio-group v-model="ruleForm.resource" @change="freightIdTypeChange">
<el-radio label='1'>运费模板</el-radio>
<el-radio label='0'>单独运费</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="统一运费" v-if="ruleForm.resource==0" prop="wlPrice">
<el-input v-model="ruleForm.wlPrice" style="width:400px;"></el-input>
</el-form-item>
<el-form-item label="运费模板" v-if="ruleForm.resource==1">
<el-select v-model="ruleForm.freightId" placeholder="请选择运费模板" style="width:400px;" @change="selectTm">
<el-option v-for="item in freightList" :key="item.Id" :label="item.Name" :value="item.Id"
style="text-align:center;"></el-option>
</el-select>
</el-form-item>
<el-form-item label="发货时效" prop="Delayompensate">
<el-select v-model="ruleForm.Delayompensate" style="width:400px;" placeholder="请选择发货时效">
<el-option label="24小时" value="24" ></el-option>
<el-option label="48小时" value="48" ></el-option>
<el-option label="72小时" value="72" ></el-option>
</el-select>
</el-form-item>
<el-form-item label="售后时长" prop="aftersaleTime">
<el-select v-model="ruleForm.aftersaleTime" style="width:400px;" placeholder="请选择售后时长">
<el-option label="7天" value="7" style="text-align:center;"></el-option>
<el-option label="15天" value="15" style="text-align:center;"></el-option>
<el-option label="30天" value="30" style="text-align:center;"></el-option>
</el-select>
</el-form-item>
</el-col>
<!-- right -->
<el-col :span="12">
<el-form-item label="商品库存" prop="goodsNowStock">
<el-input v-model.number="ruleForm.goodsNowStock" style="width:400px;"></el-input>
</el-form-item>
<el-form-item label="商品产地" prop="producingArea">
<el-input v-model="ruleForm.producingArea " style="width:400px;"></el-input>
</el-form-item>
<el-form-item label="商品重量" prop="weight">
<el-input v-model="ruleForm.weight" style="width:400px;"></el-input>
克(g)
</el-form-item>
<el-form-item label="商品单位" prop="unit">
<el-input v-model="ruleForm.unit" style="width:400px;"></el-input>
</el-form-item>
<el-form-item label="商品品牌" prop="goodsBrand">
<el-select v-model="ruleForm.goodsBrand" style="width:400px;" filterable @change="goodsBrandChange" placeholder="请选择品牌">
<el-option
v-for="item in brandOtions"
:key="item.id"
:label="item.brand_cn"
:value="item.id">
</el-option>
</el-select>
<el-link type="primary" @click="toBrand" :underline="false">添加品牌</el-link>
</el-form-item>
<el-form-item label="三方编号" prop="outGoodsId">
<el-input v-model="ruleForm.outGoodsId" style="width:400px;"></el-input>
</el-form-item>
<el-form-item label="附加运费" prop="pywlPrice" v-if="ruleForm.resource==0">
<el-input v-model="ruleForm.pywlPrice" style="width:400px;" placeholder="偏远地区六省"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="商品备注" prop="mark">
<el-input type="textarea" v-model="ruleForm.mark"></el-input>
</el-form-item>
<el-form-item label="服务标签" prop="serviceagsTags">
<el-checkbox-group v-model="serviceagsTags">
<el-checkbox v-for="item in tags" :label="item.id" true-label :key="item.id" :disabled="item.isdc" @change="serviceSingleChange(item.id)">{{item.tag}}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="详情描述" style="height:550px;" prop="description" v-loading="quillUpdateImg">
<el-upload
class="avatar-uploader2"
action="#"
auto-upload
:http-request="uploadSectionFile"
name="file"
multiple
:show-file-list="false"
:file-list="ruleFormdialogImageUrl"
:before-upload="beforeUploadEdit">
</el-upload>
<input class="uploadImg" style="display: none;" type="file" ref="file" accept="image/*" @change="fileChange($event)" name="file" multiple id="file">
<quill-editor ref="myTextEditor" v-model="content" :options="editorOption" @change="onEditorChange" style="height:500px;margin-top:-30px;"></quill-editor>
</el-form-item>
<el-form-item style="margin-bottom: 0;">
<el-button @click="resetGoodsInfForm('ruleForm')">重 置</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
// 工具栏配置
const toolbarOptions = [
['bold', 'italic', 'underline', 'strike'], // toggled buttons
['blockquote', 'code-block'],
[{'header': 1}, {'header': 2}], // custom button values
[{'list': 'ordered'}, {'list': 'bullet'}],
[{'script': 'sub'}, {'script': 'super'}], // superscript/subscript
[{'indent': '-1'}, {'indent': '+1'}], // outdent/indent
[{'direction': 'rtl'}], // text direction
// [{'size': ['small', false, 'large', 'huge']}], // custom dropdown
// [{'header': [1, 2, 3, 4, 5, 6, false]}],
// [{'color': []}, {'background': []}], // dropdown with defaults from theme
// [{'font': []}],
// [{'align': []}],
['image', 'video'],
['clean'] // remove formatting button
]
import {
GetCategory,
GetFreight,
UploadImg
} from '@/api/module/goods'
import {getBrandsInf} from '@/api/module/brand/brand'
export default {
name: 'goods',
props: {
infomationdatas: {
type: Object,
required: true
}
},
data() {
let categoryIdCheck = (rule, value, callback) => {
if (this.ruleForm.categoryId == 0 || !this.ruleForm.categoryId) {
callback(new Error("请选择商品分类"));
} else {
callback();
}
};
return {
tags: [
{id: 2, tag: "假一赔十", isdc: false},
{id: 3, tag: "7天退换", isdc: false},
{id: 4, tag: "不可退还", isdc: false},
{id: 5, tag: "厂家直供", isdc: false},
{id: 6, tag: "售后无忧", isdc: false}
],
propsaddress: {
label: 'label',
value: 'id',
},
content: '',
// editorOption: {
// placeholder: '编辑内容'
// },
brandOtions: [],
serviceagsTags: [],
ruleForm: {
outGoodsId: '',
value: [],
goodsId: 0,
goodsName: '',
scPrice: '',
price: "", //市场价 单位分
goodsNowStock: "",
producingArea: '',
weight: '',
unit: '', //单位
goodsBrand: '', //品牌
resource: '1',
categoryId: 0,
freightId: 310, //运费模板ID
wlPrice: '',
pywlPrice: '',
jsPrice: '', //协议价
Delayompensate: "",
aftersaleTime: '7',
mark: '',
serviceagsTags: [],
description: ''
},
rules: {
goodsName: [
{required: true, message: '请输入商品名称', trigger: 'blur'},
{min: 3, max: 50, message: '长度在 3 到 50 个字符', trigger: 'blur'}
],
categoryId: [{required: true, message: '请选择商品分类', validator: categoryIdCheck}],
price: [{required: true, message: '请填写指导售价', trigger: 'blur'}],
jsPrice: [{required: true, message: '请填写结算售价', trigger: 'blur'}],
scPrice: [{required: true, message: '请填写市场原价', trigger: 'blur'}],
goodsNowStock: [
{required: true, message: '商品库存不能为空', trigger: 'blur'},
{type: 'number', message: '商品库存要填写数字'},
],
unit: [{required: true, message: '商品单位不能为空', trigger: 'blur'}],
goodsBrand: [{required: true, message: '商品品牌不能为空', trigger: 'change'}]
},
// 运费模板列表
freightList: [],
options1: [],
/*8888888888888*/
index:0,
indexall:0,
editorOption: {
placeholder: '',
theme: 'snow', // or 'bubble'
modules: {
toolbar: {
container: toolbarOptions, // 工具栏
handlers: {
'image': function (value) {
if (value) {
// 触发input框选择图片文件
document.querySelector('#file').click()
} else {
this.quill.format('image', false);
}
}
}
}
}
},
quillUpdateImg:false,
ruleFormdialogImageUrl:[]
}
},
components: {},
watch: {
serviceagsTags: {
handler(val, oldVal) {
this.$set(this.ruleForm, 'serviceagsTags', val)
},
deep: true
},
content: {
handler(val, oldVal) {
this.$set(this.ruleForm, 'description', val)
},
deep: true
},
ruleForm: {
handler(val, oldVal) {
val.description = this.content;
val.serviceagsTags = this.serviceagsTags;
this.$emit('infomationclick', val);
},
deep: true
},
infomationdatas(curVal, oldVal) {
console.log("商品信息子组件:",curVal);
if (curVal) {
this.ruleForm = curVal;
if(curVal.freightId == 0) {
this.ruleForm.resource = '0';
}else {
this.ruleForm.resource = '1';
}
this.content = this.ruleForm.description;
// 初始化
this.serviceagsTags = [];
if(this.ruleForm.serviceagsTags) {
this.ruleForm.serviceagsTags.forEach((val) => {
if (val) {
let nid = parseInt(val);
this.serviceagsTags.push(nid);
}
})
}
}
}
},
created() {
},
mounted() {
this.getCategory();
this.getFreight();
this.getBrands();
},
methods: {
fileChange(e){
const list = this.$refs.file.files;
console.log(list)
this.indexall = list.length
this.uplonds()
},
uplonds(){
this.getBase64(this.$refs.file.files[this.index]).then((res) => {
let result = res.split(",");
this.Base64img = result[1];
let data = {"image": this.Base64img}
this.quillUpdateImg = true;
UploadImg(data).then(res => {
if (res && res.data.code == 1) {
this.index++
this.ruleFormdialogImageUrl.push({'url': res.data.data.imageUrl});
this.$message({ message:'上传成功',type:'success'});
// 获取富文本组件实例
let quill = this.$refs.myTextEditor.quill;
let length = quill.getSelection().index;
// 插入图片 res.data.url为服务器返回的图片地址
quill.insertEmbed(length, 'image', res.data.data.imageUrl)
// 调整光标到最后
quill.setSelection(length + 1)
if(this.index<this.indexall){
this.uplonds()
}else{
this.index = 0
this.quillUpdateImg = false;
}
}else {
this.$message({ message:'上传失败,请重新上传',type:'error'});
this.quillUpdateImg = false;
}
})
});
},
/*************************/
// 上传图片前
beforeUploadEdit(res, file) {
// 显示loading动画
this.quillUpdateImg = true
},
// 上传图片成功
uploadSectionFile(param, file, fileList) {
this.getBase64(param.file).then((res) => {
let result = res.split(",");
this.Base64img = result[1];
let data = {"image": this.Base64img}
this.quillUpdateImg = true;
UploadImg(data).then(res => {
if (res && res.data.code == 1) {
this.ruleFormdialogImageUrl.push({'url': res.data.data.imageUrl});
this.$message({ message:'上传成功',type:'success'});
// 获取富文本组件实例
let quill = this.$refs.myTextEditor.quill;
let length = quill.getSelection().index;
// 插入图片 res.data.url为服务器返回的图片地址
quill.insertEmbed(length, 'image', res.data.data.imageUrl)
// 调整光标到最后
quill.setSelection(length + 1)
}else {
this.$message({ message:'上传失败,请重新上传',type:'error'});
}
this.quillUpdateImg = false;
})
});
/*-----*/
},
// 图片转换为 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);
};
});
},
/*************************/
// 服务标签 中,7天退换和不可退换只能2选一
serviceSingleChange(id) {
let index4 = this.serviceagsTags.indexOf(4);
let index3 = this.serviceagsTags.indexOf(3);
if(id == 3) {
if( index4 > -1) {
this.serviceagsTags.splice(index4,1)
}
}
if(id == 4) {
if( index3 > -1) {
this.serviceagsTags.splice(index3,1)
}
}
},
// 运费模板类型,change事件
freightIdTypeChange(val) {
// 0 单独运费 1 是运费模板
if(val === '1') {
if(this.ruleForm.freightId == 0) {
this.ruleForm.freightId = "全国包邮通用模板";
}
}
},
// 获取品牌信息
getBrands() {
getBrandsInf().then(res => {
if (res.data.data) {
this.brandOtions = res.data.data;
}
});
},
// 获取 商品分类 信息
getCategory() {
GetCategory({}).then(response => {
this.options1 = response.data.data;
});
},
// 运费模板
getFreight() {
GetFreight(this.queryParams).then(response => {
this.freightList = response.data
});
},
handleChange(value) {
this.ruleForm.categoryId = value[value.length - 1]
},
setTreeData(arr) {
// 删除所有 children,以防止多次调用
arr.forEach(function (item) {
delete item.children;
});
let map = {}; // 构建map
arr.forEach(i => {
map[i.third_id] = i; // 构建以third_id为键 当前数据为值
});
let treeData = [];
arr.forEach(child => {
const mapItem = map[child.parent_id]; // 判断当前数据的parent_id是否存在map中
if (mapItem) { // 存在则表示当前数据不是最顶层数据
// 注意: 这里的map中的数据是引用了arr的它的指向还是arr,当mapItem改变时arr也会改变,踩坑点
(mapItem.children || (mapItem.children = [])).push(child); // 这里判断mapItem中是否存在children, 存在则插入当前数据, 不存在则赋值children为[]然后再插入当前数据
} else { // 不存在则是组顶层数据
treeData.push(child);
}
});
return treeData;
},
onEditorChange({editor, html, text}) {
this.content = html;
//console.log(315,this.content);
},
// 商品品牌 向后台传入 name
goodsBrandChange(indexId) {
let obj = {};
obj = this.brandOtions.find((item)=>{//这里的userList就是上面遍历的数据源
return item.id === indexId;//筛选出匹配数据
});
this.ruleForm.goodsBrand = obj.brand_cn;
},
// 维护品牌
toBrand() {
this.$router.push({path: '/system/shop/brand'});
},
resetGoodsInfForm(formName) {
this.$refs[formName].resetFields();
// 详情描述,重置
this.content = '';
// 服务标签
this.serviceagsTags = [];
//console.log("重置后的数据:",this.ruleForm);
},
// 商品信息 子组件 form表单校验
validateGoodsInfForm () {
let flag = null
this.$refs['ruleForm'].validate(valid => {
if (valid) {
flag = true
} else {
flag = false
}
})
return flag
},
selectTm(indexId) {
},
}
}
</script>
<style scoped>
ul, li {
list-style: none;
/*margin: 0;*/
/*padding: 0;*/
}
.el-input-group {
width: calc(100% - 60px);
}
</style>
<template>
<div class="app-container goods" v-loading="loading">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span style="font-size: 18px; float:left;margin-top: 4px;">{{title}}</span>
<el-button style="float: right; margin: 0 10px 0 20px;" size="mini" type="info" plain @click="submitForm(0)">保 存 草 稿
</el-button>
<el-button style="float: right;" size="mini" type="primary" @click="submitForm(1)">提 交 上 架
</el-button>
</div>
<el-tabs type="border-card">
<el-tab-pane label="商品信息">
<Goodsinfomation ref="childGoodsInf" :infomationdatas='infomationdata' @infomationclick='infomationclick'/>
</el-tab-pane>
<el-tab-pane label="商品图片">
<Goodsimg :imgdata='imgdate' @imgclicks='imgclick'/>
</el-tab-pane>
<el-tab-pane label="商品规格">
<Guide :guidedata='guidedate' @guideclicks='guideclick'/>
</el-tab-pane>
<el-tab-pane label="商品参数">
<Goodsparameter :parameterdata='parameterdata' @parameterclicks='parameterclick'/>
</el-tab-pane>
</el-tabs>
</el-card>
</div>
</template>
<script>
import {getGoods,GetFreight} from '@/api/module/goods'
import descartes from "@/utils/dikaerjs.js";
import Guide from './components/guide'
import Goodsinfomation from './components/goodsinfomation'
import Goodsimg from './components/goodsimg'
import Goodsparameter from './components/goodsparameter'
import {addGoods} from '@/api/module/goods'
export default {
name: 'goods',
data() {
return {
infomationdata: {},
parameterdata: {},
goodsOnsale: 0,
loading: false,
applyStatus: '',
title: "添加新商品",
imgdate: {},
guidedate: {},
parameterdate: {},
params: {
applyStatus: 0
},
expressTemplateIdList: [], //'原来绑定的运费模板已经被删除',
expressTemplateList: [],
}
},
components: {
Guide,
Goodsinfomation,
Goodsimg,
Goodsparameter
},
created() {
this.getFreight();//运费模板数据,回显匹配专用
this.getParams();
},
methods: {
// 运费模板
getFreight() {
GetFreight(this.queryParams).then(res => {
this.expressTemplateList = res.data;
this.expressTemplateIdList = this.expressTemplateList.filter(function(item) {
return item.Id;
})
});
},
getParams() {
let goodsId = this.$route.query.goodsId;
if (goodsId > 0) {
this.title = "编辑商品信息";
this.genGoodsInfo(goodsId);
}
},
// 获取商品详情
genGoodsInfo(goodsId) {
this.loading = true;
const goods_id = goodsId;
getGoods(goods_id).then(res => {
console.log(9999,res);
if(res.code === 1 && res.data) {
this.goodsOnsale = res.data.isOnsale;
// 对发货时效单独处理
if(res.data.Delayompensate == 0) {
res.data.Delayompensate = '';
}
//res.data.freightId 返回的值类型有 0(string/number)|| ‘全国包邮通用模板’(string)|| 310(number)
let resourceType = '1'; // 为了单元框正常显示,先给一个默认值,// 字符串 ‘0’,代表 数据为单独运费
let serviceagsTagsVal = [];
if(res.data.ServiceagsTags) {
serviceagsTagsVal = JSON.parse(res.data.ServiceagsTags);
}
// 库存,后台返回字段更换,提前处理 specOption
if( res.data.goodsSpecs.specOption && res.data.goodsSpecs.specOption.length > 0) {
res.data.goodsSpecs.specOption.forEach(function(item){
if(item.stock) {
item['goodsNowStock'] = item.stock;
}
});
}
this.infomationdata = {
goodsId: res.data.goodsId,
goodsName: res.data.goodsName,
categoryId: res.data.categoryId,
scPrice: res.data.scPrice / 100,
price: res.data.price / 100,
jsPrice: res.data.jsPrice / 100,
goodsNowStock: res.data.goodsNowStock,
producingArea: res.data.producingArea,
weight: res.data.weight,
unit: res.data.unit,
goodsBrand: res.data.goodsBrand,
wlPrice: res.data.wlPrice,
pywlPrice: res.data.pywlPrice,
resource: resourceType,
Delayompensate: res.data.Delayompensate,
aftersaleTime: res.data.aftersaleTime,
mark: res.data.mark,
serviceagsTags: serviceagsTagsVal,
description: res.data.description,
freightId: res.data.freightId,
outGoodsId: res.data.outGoodsId,
};
this.guidedate = res.data.goodsSpecs;
this.guidedate["goodsSpec"] = res.data.goodsSpec;
this.parameterdata = res.data.Params ? res.data.Params : {};
this.imgdate = {
"ruleFormdialogImageUrl": res.data.image,
"ruleFormdialogImageUrlplus": res.data.defaultImage
};
}else if(res.code === 0) {
if(res.msg) {
this.$message({type:'error',message: res.msg});
}else {
this.$message({type:'error',message: '数据出错啦'});
}
}
this.loading = false;
});
},
info() {
addgoods(this.listQuery).then(res => {
this.list = res.data.items
this.total = res.data.total
this.listLoading = false
})
},
//商品信息
infomationclick(type) {
Object.assign(this.params, type);
},
//商品图片
imgclick(type) {
let img = [];
type.ruleFormdialogImageUrl.forEach((res, index) => {
img.push(res.url)
})
this.params["imgs"] = img;
this.params["defaultImg"] = ''
if(type.ruleFormdialogImageUrlplus.length > 0) {
this.params["defaultImg"] = type.ruleFormdialogImageUrlplus[0].url;
}
},
//规格
guideclick(type, specsGroup) {
this.params["specs"] = type;
this.params["specsGroup"] = specsGroup;
// 浮点处理
if(this.params.specs && this.params.specs.length > 0) {
for(let i = 0; i < this.params.specs.length; i++) {
if(this.params.specs[i].jsPrice ) {
this.params.specs[i].jsPrice = parseInt(this.params.specs[i].jsPrice * 100);
}
if(this.params.specs[i].price ) {
this.params.specs[i].price = parseInt(this.params.specs[i].price * 100);
}
if(this.params.specs[i].scPrice ) {
this.params.specs[i].scPrice = parseInt(this.params.specs[i].scPrice * 100);
}
}
}
},
//参数
parameterclick(type) {
this.params["goodsPram"] = type;
},
/** 确定按钮 */
submitForm(status) {
this.params.applyStatus = 0;
this.params.isOnsale = this.goodsOnsale;
if(status === 1) {
this.params.applyStatus = 1;
}
if(this.params.resource == 0) {
this.params.freightId = 0;
}else if(this.params.resource == 1) {
this.params.wlPrice = 0;
this.params.pywlPrice = 0;
// 运费模板字段单独处理,兼容老数据
if(this.params.freightId === '全国包邮通用模板' || this.params.freightId == 0) {
this.params.freightId = 310;
}
}
console.log("gogogogog",this.params);
//return ;
// 商品信息 表单字段校验
let isGoodInfMsg = this.$refs['childGoodsInf'].validateGoodsInfForm();
// 商品图片 校验
let isGoodSImgMsg = 'defaultImg' in this.params;
if(!isGoodInfMsg) {
if(!('goodsName' in this.params)) {
this.$message({type: 'error',message: '[ 商品信息 ] 未填写完整!'});
return;
}
if('goodsName' in this.params) {
if(this.params.goodsName === '') {
this.$message({type: 'error',message: '[ 商品信息 ] 中 商品名称未填写!'});
return;
}
if(this.params.categoryId === 0) {
this.$message({type: 'error',message: '[ 商品信息 ] 中 商品分类未填写!'});
return;
}
if(this.params.scPrice === '') {
this.$message({type: 'error',message: '[ 商品信息 ] 中 市场原价未填写!'});
return;
}
if(this.params.price === '') {
this.$message({type: 'error',message: '[ 商品信息 ] 中 指导售价未填写!'});
return;
}
if(this.params.jsPrice === '') {
this.$message({type: 'error',message: '[ 商品信息 ] 中 结算价格未填写!'});
return;
}
if(this.params.goodsNowStock === '') {
this.$message({type: 'error',message: '[ 商品信息 ] 中 商品库存未填写!'});
return;
}
if(this.params.unit === '') {
this.$message({type: 'error',message: '[ 商品信息 ] 中 商品单位未填写!'});
return;
}
if(this.params.goodsBrand === '') {
this.$message({type: 'error',message: '[ 商品信息 ] 中 商品名称未填写!'});
return;
}
}
}
if(!isGoodSImgMsg) {
this.$message({type: 'error',message: '[ 商品图片 ] 未上传图片!'});
return;
}else {
if('defaultImg' in this.params) {
if(this.params.defaultImg === '') {
this.$message({type: 'error',message: '[ 商品图片 ] 中 商品主图未上传!'});
return;
}
if(this.params.imgs.length === 0) {
this.$message({type: 'error',message: '[ 商品图片 ] 中 商品轮播图未上传!'});
return;
}
}
}
this.loading = true;
addGoods(this.params).then(res => {
if (res.code === 1) {
this.$message({
message: res.msg,
type: 'success'
});
this.$emit('closeDialog',false);
if (this.goodsOnsale) {
var redUrl = '/system/goods/onsale';
} else {
var redUrl = '/system/goods/offsale';
}
this.$router.push({
path: redUrl
});
} else if(res.code === 0) {
if(res.msg) {
this.$message.error(res.msg);
}else {
this.$message.error("操作失败!");
}
}
this.loading = false;
});
},
//------ 通用方法 -----
verifiesForm(type,fieldName,obj) {
// 先判断类型,字符串类型type === text, 下拉形式字段 select
if(type === 'text') {
// 没有这个属性,肯定没有填写,抛出提示
if(!(fieldName in obj)) {
return 1;
}
}
if(type === 'select') {
}
// 如果有这个属性,那么进一步判断,这个必填值是否填写
// if(fieldName in obj && !obj[fieldName]) {
// return 2
// }
}
}
}
</script>
<style scoped lang="scss" type="text/stylus">
ul, li {
list-style: none;
margin: 0;
padding: 0;
}
.ullist {
border: 1px solid #e7eaec;
padding: 10px;
margin-bottom: 10px;
}
.el-input-group {
width: calc(100% - 60px);
}
.addbtn {
background-color: #5bc0de !important;
color: #fff !important;
border-radius: 0 4px 4px 0;
}
/deep/.el-card__body {
height: calc(100% - 50px);
overflow: hidden;
}
.el-tabs {
height: 100%;
overflow: hidden;
/deep/.el-tabs__content {
height: calc(100% - 50px);
overflow-y: scroll;
}
}
.eldelbtn {
height: 30px;
padding: 5px 20px !important;
margin-left: -3px;
}
.childlist {
margin-top: 10px;
}
.el-button--medium {
padding: 10px 12px;
}
.dfbtn {
position: relative;
}
.goods .el-tabs__content {
height: 100%;
overflow-y: scroll;
}
</style>
<template>
<div class="goods-info">
<el-form :model="goodsInfoForm" :rules="goodsInfoRules" ref="goodsInfoForm" label-width="150px" class="demo-goodsInfoForm" size="small">
<el-form-item label="商品分类:" prop="categoryStr">
<el-input style="width:400px;" v-model="goodsInfoForm.categoryStr" :disabled="true"></el-input>
<!-- <span class="type-text-span">{{ goodsInfoForm.categoryStr }}</span>-->
<el-link class="edit-type-span el-icon-edit" type="primary" :underline="false" @click="editType">修改所在类目</el-link>
<span class="tip-span">该商品所在类目须支持七天无理由退货</span>
<div class="app-container">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
<el-row>
<el-col :span="12">
<el-form-item label="商品名称" prop="goodsName">
<el-input v-model="ruleForm.goodsName" style="width:400px;"></el-input>
<el-popover
placement="top-start" width="300" trigger="hover" content="最多允许输入30个汉字(60字符),建议标题内包含与商品相关的关键词">
<i style="color: #e3c300;font-size:16px" class="el-icon-question" slot="reference"></i>
</el-popover>
</el-form-item>
<el-form-item label='商品标题:' prop="goodsName">
<el-input v-model="goodsInfoForm.goodsName" placeholder="请输入商品标题" style="width:400px;"></el-input>
<span class="tip-span ml20">商品名称限制在30字以内,不要填写与商品无关的词</span>
<el-form-item label="商品分类" prop="categoryId">
<el-cascader v-model="ruleForm.categoryId" :props='propsaddress' :options="options1" @change="handleChange"
style="width:400px;"></el-cascader>
</el-form-item>
<el-form-item label="商品产地:" prop="producingArea">
<el-select v-model="goodsInfoForm.producingArea" placeholder="请选择商品产地" style="width: 400px;">
<el-option
v-for="item in areaOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
<el-form-item label="市场原价" prop="scPrice">
<el-input v-model="ruleForm.scPrice" style="width:400px;"></el-input>
<el-popover
placement="top-start" width="300" trigger="hover" content="市场原价起到参考的作用">
<i style="color: #e3c300;font-size:16px" class="el-icon-question" slot="reference"></i>
</el-popover>
</el-form-item>
<el-form-item label="指导售价" prop="price">
<el-input v-model="ruleForm.price" style="width:400px;"></el-input>
<el-popover
placement="top-start" width="300" trigger="hover" content="您建议下游商家售卖的价格">
<i style="color: #e3c300;font-size:16px" class="el-icon-question" slot="reference"></i>
</el-popover>
</el-form-item>
<el-form-item label="结算价格" prop="jsPrice">
<el-input v-model="ruleForm.jsPrice" style="width:400px;"></el-input>
<el-popover
placement="top-start" width="300" trigger="hover" content="您与云仓平台最终结算的价格">
<i style="color: #e3c300;font-size:16px" class="el-icon-question" slot="reference"></i>
</el-popover>
</el-form-item>
<el-form-item label="运费模板" prop="freightId">
<el-radio-group v-model="ruleForm.resource" @change="freightIdTypeChange">
<el-radio label='1'>运费模板</el-radio>
<el-radio label='0'>单独运费</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="统一运费" v-if="ruleForm.resource==0" prop="wlPrice">
<el-input v-model="ruleForm.wlPrice" style="width:400px;"></el-input>
</el-form-item>
<el-form-item label="运费模板" v-if="ruleForm.resource==1">
<el-select v-model="ruleForm.freightId" placeholder="请选择运费模板" style="width:400px;" @change="selectTm">
<el-option v-for="item in freightList" :key="item.Id" :label="item.Name" :value="item.Id"
style="text-align:center;"></el-option>
</el-select>
</el-form-item>
<el-form-item label="商品发货地:" prop="fhd">
<el-select v-model="goodsInfoForm.fhd" placeholder="请选择商品发货地" style="width: 400px;">
<el-option
v-for="item in areaOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
<el-form-item label="发货时效" prop="Delayompensate">
<el-select v-model="ruleForm.Delayompensate" style="width:400px;" placeholder="请选择发货时效">
<el-option label="24小时" value="24" ></el-option>
<el-option label="48小时" value="48" ></el-option>
<el-option label="72小时" value="72" ></el-option>
</el-select>
</el-form-item>
<el-form-item label="所属品牌:" prop="goodsBrand">
<el-select v-model="goodsInfoForm.goodsBrand" placeholder="请选择商品品牌" style="width: 400px;">
<el-form-item label="售后时长" prop="aftersaleTime">
<el-select v-model="ruleForm.aftersaleTime" style="width:400px;" placeholder="请选择售后时长">
<el-option label="7天" value="7" style="text-align:center;"></el-option>
<el-option label="15天" value="15" style="text-align:center;"></el-option>
<el-option label="30天" value="30" style="text-align:center;"></el-option>
</el-select>
</el-form-item>
</el-col>
<!-- right -->
<el-col :span="12">
<el-form-item label="商品库存" prop="goodsNowStock">
<el-input v-model.number="ruleForm.goodsNowStock" style="width:400px;"></el-input>
</el-form-item>
<el-form-item label="商品产地" prop="producingArea">
<el-input v-model="ruleForm.producingArea " style="width:400px;"></el-input>
</el-form-item>
<el-form-item label="商品重量" prop="weight">
<el-input v-model="ruleForm.weight" style="width:400px;"></el-input>
克(g)
</el-form-item>
<el-form-item label="商品单位" prop="unit">
<el-input v-model="ruleForm.unit" style="width:400px;"></el-input>
</el-form-item>
<el-form-item label="商品品牌" prop="goodsBrand">
<el-select v-model="ruleForm.goodsBrand" style="width:400px;" filterable @change="goodsBrandChange" placeholder="请选择品牌">
<el-option
v-for="item in brandOptions"
v-for="item in brandOtions"
:key="item.id"
:label="item.brand_cn"
:value="item.id"
></el-option>
:value="item.id">
</el-option>
</el-select>
<el-link class="edit-type-span el-icon-plus" type="primary" :underline="false" @click="toBrand">新增品牌</el-link>
<el-link type="primary" @click="toBrand" :underline="false">添加品牌</el-link>
</el-form-item>
<el-form-item label='市场参考价链接:'>
<el-input v-model="goodsInfoForm.lj" placeholder="请输入京东或者淘宝的商品链接" style="width:400px;"></el-input>
<el-form-item label="三方编号" prop="outGoodsId">
<el-input v-model="ruleForm.outGoodsId" style="width:400px;"></el-input>
</el-form-item>
<el-form-item label='商品编码:'>
<el-input v-model="goodsInfoForm.spbm" placeholder="请输入商品编码(非必须)" style="width:400px;"></el-input>
<el-form-item label="附加运费" prop="pywlPrice" v-if="ruleForm.resource==0">
<el-input v-model="ruleForm.pywlPrice" style="width:400px;" placeholder="偏远地区六省"></el-input>
</el-form-item>
<el-form-item label="商品图片:" prop="sptp">
<span class="tip-span" style="display: block;line-height: 34px;">商品图片最多上传9张,默认第一张为主图 <span>单张图片需限制在2M以内,可上传png、jpg格式,尺寸要求为正方形</span></span>
</el-col>
</el-row>
<el-form-item label="商品备注" prop="mark">
<el-input type="textarea" v-model="ruleForm.mark"></el-input>
</el-form-item>
<el-form-item label="服务标签" prop="serviceagsTags">
<el-checkbox-group v-model="serviceagsTags">
<el-checkbox v-for="item in tags" :label="item.id" true-label :key="item.id" :disabled="item.isdc" @change="serviceSingleChange(item.id)">{{item.tag}}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="详情描述" style="height:550px;" prop="description" v-loading="quillUpdateImg">
<el-upload
class="upload-img"
list-type="picture-card"
class="avatar-uploader2"
action="#"
:limit="1"
:on-exceed="limitImg9"
:http-request="uploadGoodsImg"
:on-preview="handlePictureCardPreview"
:on-remove="handleRemove"
:file-list="goodsImgFileList"
><i class="el-icon-plus" />
auto-upload
:http-request="uploadSectionFile"
name="file"
multiple
:show-file-list="false"
:file-list="ruleFormdialogImageUrl"
:before-upload="beforeUploadEdit">
</el-upload>
<el-dialog :visible.sync="goodsImgVisible">
<img width="100%" :src="goodsImgUrlDialog" alt="">
</el-dialog>
<input class="uploadImg" style="display: none;" type="file" ref="file" accept="image/*" @change="fileChange($event)" name="file" multiple id="file">
<quill-editor ref="myTextEditor" v-model="content" :options="editorOption" @change="onEditorChange" style="height:500px;margin-top:-30px;"></quill-editor>
</el-form-item>
<el-form-item style="margin-bottom: 0;">
<el-button @click="resetGoodsInfForm('ruleForm')">重 置</el-button>
</el-form-item>
</el-form>
<!-- 修改 商品分类目录 -->
<el-dialog
v-loading="loadingSSQ"
class="add-workorder-dialog"
title="修改商品分类"
:visible.sync="editGoodsTypeDialog"
:destroy-on-close="true"
:before-close="cancelType"
width="60%"
center
>
<!-- <p>当前所选类目:<span></span></p>-->
<el-cascader-panel v-show="editGoodsTypeDialog" v-model="SSQGoodsList" :props='goodsprops' @change="SSQGoodsChange" ref="ssqGoodsCascader"></el-cascader-panel>
<span slot="footer" class="dialog-footer">
<el-button @click="cancelType" size="mini">取 消</el-button>
<el-button type="primary" @click="saveType" size="mini">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { GetCategory, GetFreight, UploadImg } from '@/api/module/goods'
import { getAreaList } from '@/api/module/retreat/address';
import { getBrandsInf } from '@/api/module/brand/brand'
// 工具栏配置
const toolbarOptions = [
['bold', 'italic', 'underline', 'strike'], // toggled buttons
['blockquote', 'code-block'],
[{'header': 1}, {'header': 2}], // custom button values
[{'list': 'ordered'}, {'list': 'bullet'}],
[{'script': 'sub'}, {'script': 'super'}], // superscript/subscript
[{'indent': '-1'}, {'indent': '+1'}], // outdent/indent
[{'direction': 'rtl'}], // text direction
// [{'size': ['small', false, 'large', 'huge']}], // custom dropdown
// [{'header': [1, 2, 3, 4, 5, 6, false]}],
// [{'color': []}, {'background': []}], // dropdown with defaults from theme
// [{'font': []}],
// [{'align': []}],
['image', 'video'],
['clean'] // remove formatting button
]
import {
GetCategory,
GetFreight,
UploadImg
} from '@/api/module/goods'
import {getBrandsInf} from '@/api/module/brand/brand'
export default {
name: 'goods',
props: {
goodsinfodata: {
infomationdatas: {
type: Object,
required: true
}
},
data() {
let categoryIdCheck = (rule, value, callback) => {
if (this.goodsImgFileList.length < 1) {
callback(new Error("请上传商品图片"));
if (this.ruleForm.categoryId == 0 || !this.ruleForm.categoryId) {
callback(new Error("请选择商品分类"));
} else {
callback();
}
};
return {
//loading: false,
// categoryStr: '',
goodsInfoDataClone: {},
areaOptions: [], // 地址 省
brandOptions: [], // 商品品牌
goodsInfoForm: {
categoryStr: '', // 商品分类 地址拼接
categoryList: [],
tags: [
{id: 2, tag: "假一赔十", isdc: false},
{id: 3, tag: "7天退换", isdc: false},
{id: 4, tag: "不可退还", isdc: false},
{id: 5, tag: "厂家直供", isdc: false},
{id: 6, tag: "售后无忧", isdc: false}
],
propsaddress: {
label: 'label',
value: 'id',
},
content: '',
// editorOption: {
// placeholder: '编辑内容'
// },
brandOtions: [],
serviceagsTags: [],
ruleForm: {
outGoodsId: '',
value: [],
goodsId: 0,
goodsName: '',
producingArea: [], // 产地
fhd: [], // 发货地
goodsBrand: [], // 品牌
sptp: '' // 商品图片
scPrice: '',
price: "", //市场价 单位分
goodsNowStock: "",
producingArea: '',
weight: '',
unit: '', //单位
goodsBrand: '', //品牌
resource: '1',
categoryId: 0,
freightId: 310, //运费模板ID
wlPrice: '',
pywlPrice: '',
jsPrice: '', //协议价
Delayompensate: "",
aftersaleTime: '7',
mark: '',
serviceagsTags: [],
description: ''
},
goodsInfoRules: {
categoryStr: [{required: true, message: '商品分类不能为空', trigger: 'blur'},],
rules: {
goodsName: [
{required: true, message: '请输入商品名称', trigger: 'blur'},
{min: 3, max: 30, message: '商品标题限制在30字以内', trigger: 'blur'}
{min: 3, max: 50, message: '长度在 3 到 50 个字符', trigger: 'blur'}
],
producingArea:[{required: true, message: '请选择商品产地', trigger: 'change'}],
fhd: [{required: true, message: '请选择商品发货地', trigger: 'change'}],
goodsBrand: [{required: true, message: '请选择商品品牌', trigger: 'change'}],
sptp: [{required: true, message: '请上传商品图片', validator: categoryIdCheck}]
},
goodsImgFileList: [], // 商品图片地址 集合list
goodsImgVisible: false, // 图片能否预览
goodsImgUrlDialog: '',
/* 修改 商品分类 */
loadingSSQ: false,
editGoodsTypeDialog: false,
SSQGoodsList: [], // 省市区 子组件goods的
goodsprops: {
expandTrigger: 'click',
lazy: true,
lazyLoad: this.lazyLoad,
value: "id",
label: 'name',
leaf: 'leaf'
categoryId: [{required: true, message: '请选择商品分类', validator: categoryIdCheck}],
price: [{required: true, message: '请填写指导售价', trigger: 'blur'}],
jsPrice: [{required: true, message: '请填写结算售价', trigger: 'blur'}],
scPrice: [{required: true, message: '请填写市场原价', trigger: 'blur'}],
goodsNowStock: [
{required: true, message: '商品库存不能为空', trigger: 'blur'},
{type: 'number', message: '商品库存要填写数字'},
],
unit: [{required: true, message: '商品单位不能为空', trigger: 'blur'}],
goodsBrand: [{required: true, message: '商品品牌不能为空', trigger: 'change'}]
},
} // return end
// 运费模板列表
freightList: [],
options1: [],
/*8888888888888*/
index:0,
indexall:0,
editorOption: {
placeholder: '',
theme: 'snow', // or 'bubble'
modules: {
toolbar: {
container: toolbarOptions, // 工具栏
handlers: {
'image': function (value) {
if (value) {
// 触发input框选择图片文件
document.querySelector('#file').click()
} else {
this.quill.format('image', false);
}
}
}
}
}
},
quillUpdateImg:false,
ruleFormdialogImageUrl:[]
}
},
components: {},
watch: {
// serviceagsTags: {
// handler(val, oldVal) {
// this.$set(this.goodsInfoForm, 'serviceagsTags', val)
// },
// deep: true
// },
serviceagsTags: {
handler(val, oldVal) {
this.$set(this.ruleForm, 'serviceagsTags', val)
},
created() {
// 深拷贝一份最开始的数据,为初始化准备
this.goodsInfoDataClone = this.deepClone(this.goodsinfodata);
this.goodsInfoForm = this.goodsinfodata
// console.log("父组件传过来的",this.goodsinfodata)
// console.log("1111",this.goodsInfoForm)
// 获取 省
this.getArea();
// 获取 商品品牌
this.getBrands();
deep: true
},
mounted() {
// this.getCategory();
// this.getFreight();
// this.getBrands();
content: {
handler(val, oldVal) {
this.$set(this.ruleForm, 'description', val)
},
methods: {
// 获取 省
getArea() {
let limboNode = {
pid: 0
};
getAreaList(limboNode).then( res=> {
if(res.data) {
this.areaOptions = res.data;
}else {
this.areaOptions = [];
}
});
deep: true
},
// 获取 商品品牌
getBrands() {
getBrandsInf().then( res => {
if(res.data) {
this.brandOptions = res.data.data;
}else {
this.brandOptions = [];
}
});
ruleForm: {
handler(val, oldVal) {
val.description = this.content;
val.serviceagsTags = this.serviceagsTags;
this.$emit('infomationclick', val);
},
/* 修改 商品分类 类目 */
editType() {
this.SSQGoodsList = [];
this.editGoodsTypeDialog = true;
this.SSQGoodsList = this.goodsInfoForm.categoryList
console.log(222,this.SSQGoodsList);
},
lazyLoad(node, resolve) {
this.getSSQArea(node, resolve);
},
getSSQArea(node, resolve) {
const level = node.level;
let limboNode = {};
if(level === 0) {
//debugger
limboNode = {pid: 0}
}
if(level === 1) {
//debugger
limboNode = { pid: node.value };
deep: true
},
infomationdatas(curVal, oldVal) {
console.log("商品信息子组件:",curVal);
if (curVal) {
this.ruleForm = curVal;
if(curVal.freightId == 0) {
this.ruleForm.resource = '0';
}else {
this.ruleForm.resource = '1';
}
if(level === 2) {
limboNode = { pid: node.value };
this.content = this.ruleForm.description;
// 初始化
this.serviceagsTags = [];
if(this.ruleForm.serviceagsTags) {
this.ruleForm.serviceagsTags.forEach((val) => {
if (val) {
let nid = parseInt(val);
this.serviceagsTags.push(nid);
}
//this.loadingSSQ = true;
getAreaList(limboNode).then(res => {
let result = {};
if (level === 0) {
result = res.data
result.forEach(item => {
item.value = item.id;
item.label = item.name;
item.children=[];
item.leaf = 0; // 可以控制 是否有下级 值为true都不行,必须等于0
})
}
if (level === 1) {
result = res.data
result.forEach(item => {
item.value = item.id;
item.label = item.name
item.children=[];
//这句代码表示当点击最后一级的时候 label后面不会转圈圈 并把相关值赋值到选择器上
item.leaf = 0
})
}
if (level === 2) {
result = res.data
result.forEach(item => {
item.value = item.id;
item.label = item.name
item.leaf = 1;
})
}
resolve(result)
//this.loadingSSQ = false;
});
},
SSQGoodsChange(value) {
//this.SSQGoodsList = value;
},
// 确认 修改 商品分类
saveType() {
created() {
},
// 取消 修改 商品分类
cancelType() {
this.editGoodsTypeDialog = false;
mounted() {
this.getCategory();
this.getFreight();
this.getBrands();
},
// 上传 商品图片,限制 9 张
limitImg9() {
this.$message({ message: '最多上传9张图片', type: 'warning' })
methods: {
fileChange(e){
const list = this.$refs.file.files;
console.log(list)
this.indexall = list.length
this.uplonds()
},
// 上传 商品图片
uploadGoodsImg(param) {
this.getBase64(param.file).then( res => {
uplonds(){
this.getBase64(this.$refs.file.files[this.index]).then((res) => {
let result = res.split(",");
this.Base64img = result[1];
let data = {"image":this.Base64img};
//console.log(213,data);
UploadImg(data).then( res=> {
console.log(217,res);
let urlObj = {'url': ''};
if(res.data) {
urlObj.url = res.data.data.imageUrl;
this.goodsImgFileList.push(urlObj);
this.$message({type:'success',message:'图片上传成功'});
// 只清除一次,不浪费哦
if(this.goodsImgFileList.length === 1) {
this.$refs.goodsInfoForm.clearValidate('sptp');
}
let data = {"image": this.Base64img}
this.quillUpdateImg = true;
UploadImg(data).then(res => {
if (res && res.data.code == 1) {
this.index++
this.ruleFormdialogImageUrl.push({'url': res.data.data.imageUrl});
this.$message({ message:'上传成功',type:'success'});
// 获取富文本组件实例
let quill = this.$refs.myTextEditor.quill;
let length = quill.getSelection().index;
// 插入图片 res.data.url为服务器返回的图片地址
quill.insertEmbed(length, 'image', res.data.data.imageUrl)
// 调整光标到最后
quill.setSelection(length + 1)
if(this.index<this.indexall){
this.uplonds()
}else{
this.index = 0
this.quillUpdateImg = false;
}
});
});
},
// 商品信息 子组件 form表单校验, 在父组件中被调用
validateGoodsInfoForm () {
let flag = null
this.$refs['goodsInfoForm'].validate(valid => {
if (valid) {
flag = true
} else {
flag = false
}else {
this.$message({ message:'上传失败,请重新上传',type:'error'});
this.quillUpdateImg = false;
}
})
return flag
});
},
// 商品图片 预览
handlePictureCardPreview(file) {
this.goodsImgUrlDialog = file.url;
this.goodsImgVisible = true;
/*************************/
// 上传图片前
beforeUploadEdit(res, file) {
// 显示loading动画
this.quillUpdateImg = true
},
// 删除 商品图片
handleRemove(file) {
for (let i = 0; i < this.goodsImgFileList.length; i++) {
if (file.uid === this.goodsImgFileList[i].uid) {
this.goodsImgFileList.splice(i, 1)
}
}
if(this.goodsImgFileList.length === 0) {
this.$refs.goodsInfoForm.validateField('sptp')
// 上传图片成功
uploadSectionFile(param, file, fileList) {
this.getBase64(param.file).then((res) => {
let result = res.split(",");
this.Base64img = result[1];
let data = {"image": this.Base64img}
this.quillUpdateImg = true;
UploadImg(data).then(res => {
if (res && res.data.code == 1) {
this.ruleFormdialogImageUrl.push({'url': res.data.data.imageUrl});
this.$message({ message:'上传成功',type:'success'});
// 获取富文本组件实例
let quill = this.$refs.myTextEditor.quill;
let length = quill.getSelection().index;
// 插入图片 res.data.url为服务器返回的图片地址
quill.insertEmbed(length, 'image', res.data.data.imageUrl)
// 调整光标到最后
quill.setSelection(length + 1)
}else {
this.$refs.goodsInfoForm.clearValidate('sptp');
this.$message({ message:'上传失败,请重新上传',type:'error'});
}
this.quillUpdateImg = false;
})
});
/*-----*/
},
// 维护品牌
toBrand() {
this.$router.push({path: '/system/shop/brand'});
},
// 通用 方法
// 图片转换为 base64
getBase64(file) {
return new Promise(function (resolve, reject) {
......@@ -365,36 +419,129 @@
};
});
},
/*************************/
// 服务标签 中,7天退换和不可退换只能2选一
serviceSingleChange(id) {
let index4 = this.serviceagsTags.indexOf(4);
let index3 = this.serviceagsTags.indexOf(3);
if(id == 3) {
if( index4 > -1) {
this.serviceagsTags.splice(index4,1)
}
}
if(id == 4) {
if( index3 > -1) {
this.serviceagsTags.splice(index3,1)
}
}
},
// 运费模板类型,change事件
freightIdTypeChange(val) {
// 0 单独运费 1 是运费模板
if(val === '1') {
if(this.ruleForm.freightId == 0) {
this.ruleForm.freightId = "全国包邮通用模板";
}
}
},
// 获取品牌信息
getBrands() {
getBrandsInf().then(res => {
if (res.data.data) {
this.brandOtions = res.data.data;
}
});
},
// 获取 商品分类 信息
getCategory() {
GetCategory({}).then(response => {
this.options1 = response.data.data;
});
},
// 运费模板
getFreight() {
GetFreight(this.queryParams).then(response => {
this.freightList = response.data
});
},
handleChange(value) {
this.ruleForm.categoryId = value[value.length - 1]
},
setTreeData(arr) {
// 删除所有 children,以防止多次调用
arr.forEach(function (item) {
delete item.children;
});
let map = {}; // 构建map
arr.forEach(i => {
map[i.third_id] = i; // 构建以third_id为键 当前数据为值
});
let treeData = [];
arr.forEach(child => {
const mapItem = map[child.parent_id]; // 判断当前数据的parent_id是否存在map中
if (mapItem) { // 存在则表示当前数据不是最顶层数据
// 注意: 这里的map中的数据是引用了arr的它的指向还是arr,当mapItem改变时arr也会改变,踩坑点
(mapItem.children || (mapItem.children = [])).push(child); // 这里判断mapItem中是否存在children, 存在则插入当前数据, 不存在则赋值children为[]然后再插入当前数据
} else { // 不存在则是组顶层数据
treeData.push(child);
}
});
return treeData;
},
onEditorChange({editor, html, text}) {
this.content = html;
//console.log(315,this.content);
},
// 商品品牌 向后台传入 name
goodsBrandChange(indexId) {
let obj = {};
obj = this.brandOtions.find((item)=>{//这里的userList就是上面遍历的数据源
return item.id === indexId;//筛选出匹配数据
});
this.ruleForm.goodsBrand = obj.brand_cn;
},
// 维护品牌
toBrand() {
this.$router.push({path: '/system/shop/brand'});
},
resetGoodsInfForm(formName) {
this.$refs[formName].resetFields();
// 详情描述,重置
this.content = '';
// 服务标签
this.serviceagsTags = [];
//console.log("重置后的数据:",this.ruleForm);
},
// 商品信息 子组件 form表单校验
validateGoodsInfForm () {
let flag = null
this.$refs['ruleForm'].validate(valid => {
if (valid) {
flag = true
} else {
flag = false
}
})
return flag
},
selectTm(indexId) {
},
} // methods end
}
}
</script>
<style scoped>
ul {
padding: 0;
}
.goods-info {
padding: 15px 0px;
margin-top: 18px;
ul, li {
list-style: none;
/*margin: 0;*/
/*padding: 0;*/
}
.type-text-span {
display: inline-block;
width: 400px;
/*margin: 0 20px 0;*/
}
.edit-type-span {
display: inline-block;
cursor: pointer;
margin: 0 20px;
}
/* 一般提示性文字 */
.tip-span {
color: #909399;
font-size: 12px;
}
/deep/.el-form-item {
margin-bottom: 20px;
.el-input-group {
width: calc(100% - 60px);
}
</style>
<template>
<div class="app-container">
<!-- 选择商品类目 start -->
<el-card class="box-card" v-if="!isShowGoodsDetails">
<div class="app-container goods" v-loading="loading">
<el-card class="box-card">
<div slot="header" class="clearfix">
<p class="card-header-title"><span class="blue-block-goods"></span>确认商品所在目录</p>
</div>
<div>
<div>
<p class="goods-type-tip">为商品设置正确的类目,能让商品快速的被搜索到</p>
</div>
<div class="goods-type-options" v-loading="loading">
<el-cascader-panel v-model="SSQList" :props='props' @change="SSQChange" ref="ssqCascader"></el-cascader-panel>
</div>
<el-button type="primary" class="next-step" :disabled="isNextStep" @click="nextStep">下一步</el-button>
<span style="font-size: 18px; float:left;margin-top: 4px;">{{title}}</span>
<el-button style="float: right; margin: 0 10px 0 20px;" size="mini" type="info" plain @click="submitForm(0)">保 存 草 稿
</el-button>
<el-button style="float: right;" size="mini" type="primary" @click="submitForm(1)">提 交 上 架
</el-button>
</div>
<el-tabs type="border-card">
<el-tab-pane label="商品信息">
<Goodsinfomation ref="childGoodsInf" :infomationdatas='infomationdata' @infomationclick='infomationclick'/>
</el-tab-pane>
<el-tab-pane label="商品图片">
<Goodsimg :imgdata='imgdate' @imgclicks='imgclick'/>
</el-tab-pane>
<el-tab-pane label="商品规格">
<Guide :guidedata='guidedate' @guideclicks='guideclick'/>
</el-tab-pane>
<el-tab-pane label="商品参数">
<Goodsparameter :parameterdata='parameterdata' @parameterclicks='parameterclick'/>
</el-tab-pane>
</el-tabs>
</el-card>
<!-- 选择商品类目 end -->
<!-- 添加商品 start -->
<el-card class="box-card good-details-body" v-if="isShowGoodsDetails">
<div class="floor-nav" id="floorNavList">
<ul class="nav-list">
<li class="nav-list-item" :class="{'floor-item-active': isFIActive === index}" v-for="(item, index) in floorNav" :key="item.id" @click="setFloorNavMountClick(index)">{{ item.name }}</li>
</ul>
</div>
<div class="floor-cont" ref="scrollview">
<div class="floor-item">
<div class="floor-item-box">
<p class="card-header-title floor-item-box-title"><span class="blue-block-goods blue-block-goods-title"></span>商品信息</p>
<Goodsinfomation ref="goodsInfo" :goodsinfodata='goodsinfodata'/>
</div>
</div>
<div class="floor-item">
<div class="floor-item-box">
<p class="card-header-title floor-item-box-title"><span class="blue-block-goods blue-block-goods-title"></span>商品规格</p>
</div>
</div>
<div class="floor-item">
<div class="floor-item-box">
<p class="card-header-title floor-item-box-title"><span class="blue-block-goods blue-block-goods-title"></span>商品售价</p>
</div>
</div>
<div class="floor-item">
<div class="floor-item-box">
<p class="card-header-title floor-item-box-title"><span class="blue-block-goods blue-block-goods-title"></span>商品详情</p>
</div>
</div>
<div class="floor-item">
<div class="floor-item-box">
<p class="card-header-title floor-item-box-title"><span class="blue-block-goods blue-block-goods-title"></span>售后及服务</p>
<Goodsaftersale ref="goodsaftersale" :goodsaftersale="goodsaftersale" />
<div class="submit-type-con">
<el-radio-group v-model="submitType" size="small">
<el-radio :label="1" border>放入仓库</el-radio>
<el-radio :label="2" border>立即上架</el-radio>
</el-radio-group>
</div>
</div>
</div>
</div>
<div class="submit-cont">
<el-button type="primary" style="padding: 10px 30px;" @click="save">提 交</el-button>
</div>
</el-card>
<!-- 添加商品 end -->
</div>
</template>
<script>
import { getAreaList } from '@/api/module/retreat/address';
import {getGoods,GetFreight} from '@/api/module/goods'
import descartes from "@/utils/dikaerjs.js";
import Guide from './components/guide'
import Goodsinfomation from './components/goodsinfomation'
import Goodsaftersale from './components/goodsaftersale'
// let TIMER = null;
import Goodsimg from './components/goodsimg'
import Goodsparameter from './components/goodsparameter'
import {addGoods} from '@/api/module/goods'
export default {
name: 'goods',
data() {
return {
infomationdata: {},
parameterdata: {},
goodsOnsale: 0,
loading: false,
SSQList: [], // 省市区
SSQStr: '', // 省市区 拼接
props: {
expandTrigger: 'click',
lazy: true,
lazyLoad: this.lazyLoad,
value: "id",
label: 'name',
leaf: 'leaf'
},
isNextStep: true,
isShowGoodsDetails: false,
isFIActive: 0,
/**/
floorNav: [
{ id: 1, name: '商品信息' },
{ id: 2, name: '商品规格' },
{ id: 3, name: '商品售价' },
{ id: 4, name: '商品详情' },
{ id: 5, name: '售后及服务' },
],
/* 商品信息 */
goodsinfodata: {
categoryList: [],
categoryStr: ''
},
/* 售后及服务 */
goodsaftersale: {
applyStatus: '',
title: "添加新商品",
imgdate: {},
guidedate: {},
parameterdate: {},
params: {
applyStatus: 0
},
submitType: 1,
TIMER: null,
} // return end
expressTemplateIdList: [], //'原来绑定的运费模板已经被删除',
expressTemplateList: [],
}
},
components: {
Guide,
Goodsinfomation,
Goodsaftersale
Goodsimg,
Goodsparameter
},
created() {
this.getFreight();//运费模板数据,回显匹配专用
this.getParams();
},
mounted() {
methods: {
// 运费模板
getFreight() {
GetFreight(this.queryParams).then(res => {
this.expressTemplateList = res.data;
this.expressTemplateIdList = this.expressTemplateList.filter(function(item) {
return item.Id;
})
});
},
getParams() {
let goodsId = this.$route.query.goodsId;
if (goodsId > 0) {
this.title = "编辑商品信息";
this.genGoodsInfo(goodsId);
}
},
// 获取商品详情
genGoodsInfo(goodsId) {
this.loading = true;
const goods_id = goodsId;
getGoods(goods_id).then(res => {
console.log(9999,res);
if(res.code === 1 && res.data) {
this.goodsOnsale = res.data.isOnsale;
// 对发货时效单独处理
if(res.data.Delayompensate == 0) {
res.data.Delayompensate = '';
}
//res.data.freightId 返回的值类型有 0(string/number)|| ‘全国包邮通用模板’(string)|| 310(number)
let resourceType = '1'; // 为了单元框正常显示,先给一个默认值,// 字符串 ‘0’,代表 数据为单独运费
let serviceagsTagsVal = [];
if(res.data.ServiceagsTags) {
serviceagsTagsVal = JSON.parse(res.data.ServiceagsTags);
}
methods: {
// 只有点击完最后一级,才会有值
SSQChange() {
if(this.SSQList && this.SSQList.length > 0) {
this.isNextStep = false
// 库存,后台返回字段更换,提前处理 specOption
if( res.data.goodsSpecs.specOption && res.data.goodsSpecs.specOption.length > 0) {
res.data.goodsSpecs.specOption.forEach(function(item){
if(item.stock) {
item['goodsNowStock'] = item.stock;
}
});
}
this.infomationdata = {
goodsId: res.data.goodsId,
goodsName: res.data.goodsName,
categoryId: res.data.categoryId,
scPrice: res.data.scPrice / 100,
price: res.data.price / 100,
jsPrice: res.data.jsPrice / 100,
goodsNowStock: res.data.goodsNowStock,
producingArea: res.data.producingArea,
weight: res.data.weight,
unit: res.data.unit,
goodsBrand: res.data.goodsBrand,
wlPrice: res.data.wlPrice,
pywlPrice: res.data.pywlPrice,
resource: resourceType,
Delayompensate: res.data.Delayompensate,
aftersaleTime: res.data.aftersaleTime,
mark: res.data.mark,
serviceagsTags: serviceagsTagsVal,
description: res.data.description,
freightId: res.data.freightId,
outGoodsId: res.data.outGoodsId,
};
this.guidedate = res.data.goodsSpecs;
this.guidedate["goodsSpec"] = res.data.goodsSpec;
this.parameterdata = res.data.Params ? res.data.Params : {};
this.imgdate = {
"ruleFormdialogImageUrl": res.data.image,
"ruleFormdialogImageUrlplus": res.data.defaultImage
};
}else if(res.code === 0) {
if(res.msg) {
this.$message({type:'error',message: res.msg});
}else {
this.SSQList = []
this.isNextStep = true
this.$message({type:'error',message: '数据出错啦'});
}
}
this.loading = false;
});
},
lazyLoad(node, resolve) {
this.SSQList = [];
this.SSQStr = '';
this.getArea(node, resolve);
if(this.SSQList && this.SSQList.length > 0) {
this.isNextStep = false
}else {
this.isNextStep = true
info() {
addgoods(this.listQuery).then(res => {
this.list = res.data.items
this.total = res.data.total
this.listLoading = false
})
},
//商品信息
infomationclick(type) {
Object.assign(this.params, type);
},
//商品图片
imgclick(type) {
let img = [];
type.ruleFormdialogImageUrl.forEach((res, index) => {
img.push(res.url)
})
this.params["imgs"] = img;
this.params["defaultImg"] = ''
if(type.ruleFormdialogImageUrlplus.length > 0) {
this.params["defaultImg"] = type.ruleFormdialogImageUrlplus[0].url;
}
},
getArea(node, resolve) {
const level = node.level;
let limboNode = {};
if(level === 0) {
limboNode = {pid: 0}
//规格
guideclick(type, specsGroup) {
this.params["specs"] = type;
this.params["specsGroup"] = specsGroup;
// 浮点处理
if(this.params.specs && this.params.specs.length > 0) {
for(let i = 0; i < this.params.specs.length; i++) {
if(this.params.specs[i].jsPrice ) {
this.params.specs[i].jsPrice = parseInt(this.params.specs[i].jsPrice * 100);
}
if(level === 1) {
limboNode = { pid: node.value };
if(this.params.specs[i].price ) {
this.params.specs[i].price = parseInt(this.params.specs[i].price * 100);
}
if(level === 2) {
limboNode = { pid: node.value };
if(this.params.specs[i].scPrice ) {
this.params.specs[i].scPrice = parseInt(this.params.specs[i].scPrice * 100);
}
this.loading = true;
getAreaList(limboNode).then(res => {
let result = {};
// debugger
if (level === 0) {
result = res.data
result.forEach(item => {
item.value = item.id;
item.label = item.name;
item.children=[];
item.leaf = 0; // 可以控制 是否有下级 值为true都不行,必须等于0
})
}
}
},
//参数
parameterclick(type) {
this.params["goodsPram"] = type;
},
if (level === 1) {
result = res.data
result.forEach(item => {
item.value = item.id;
item.label = item.name
item.children=[];
//这句代码表示当点击最后一级的时候 label后面不会转圈圈 并把相关值赋值到选择器上
item.leaf = 0
})
/** 确定按钮 */
submitForm(status) {
this.params.applyStatus = 0;
this.params.isOnsale = this.goodsOnsale;
if(status === 1) {
this.params.applyStatus = 1;
}
if (level === 2) {
result = res.data
result.forEach(item => {
item.value = item.id;
item.label = item.name
item.leaf = 1;
})
if(this.params.resource == 0) {
this.params.freightId = 0;
}else if(this.params.resource == 1) {
this.params.wlPrice = 0;
this.params.pywlPrice = 0;
// 运费模板字段单独处理,兼容老数据
if(this.params.freightId === '全国包邮通用模板' || this.params.freightId == 0) {
this.params.freightId = 310;
}
}
// result = []
resolve(result)
this.loading = false;
});
},
// 添加商品后,下一步 操作
nextStep() {
// 注意数据格式 [1,2,3] 数组,且里面是数字类型
let ssqLabelList = this.$refs['ssqCascader'].getCheckedNodes()[0].pathLabels;
this.goodsinfodata.categoryList = this.SSQList;
this.goodsinfodata.categoryStr = ssqLabelList[0] + '/' + ssqLabelList[1] + '/' + ssqLabelList[2];
this.isShowGoodsDetails = true;
},
console.log("gogogogog",this.params);
//return ;
// 商品信息 表单字段校验
let isGoodInfMsg = this.$refs['childGoodsInf'].validateGoodsInfForm();
// 商品图片 校验
let isGoodSImgMsg = 'defaultImg' in this.params;
//
// getGoodsAfterSaleData(data) {
// console.log("售后子组件给的:",data);
// },
//
save() {
// 此处变量 有顺序 校验时,电梯至某处
// 商品信息 是否填写完整
let isGoodsInfoMsg = this.$refs['goodsInfo'].validateGoodsInfoForm();
// 售后服务 是否填写完整
let isGoodsAfterSaleMsg = this.$refs['goodsaftersale'].validateGoodsAfterSaleForm();
//console.log(212,this.$refs.goodsaftersale.goodsAfterSaleForm) // 主动获取子组件数据
//console.log(2222,isGoodsAfterSaleMsg,isGoodsInfoMsg);
if(!isGoodsInfoMsg) {
this.$message({type:'error',message:'商品信息未填写完整'});
this.setFloorNavMountClick(0);
return
}
if(!isGoodsAfterSaleMsg) {
this.$message({type:'error',message:'售后及服务未填写完整'});
this.setFloorNavMountClick(4);
return
if(!isGoodInfMsg) {
if(!('goodsName' in this.params)) {
this.$message({type: 'error',message: '[ 商品信息 ] 未填写完整!'});
return;
}
},
/* 添加商品详细 */
/* 设置楼层导航事件驱动方法* @params Number index 楼层下标 */
setFloorNavMountClick(index) {
let _this = this
_this.isFIActive = index;
//debugger
clearInterval(_this.TIMER)
let floor_item = document.getElementsByClassName('floor-item'),
floor_offsetTop = floor_item[index].offsetTop - floor_item[0].offsetTop,
window_scrollTop = _this.$refs.scrollview.scrollTop,
timer = { step: 45, times: 20, FLOOR_OFFSETTOP: floor_offsetTop };
console.log(3333,floor_item[0].offsetTop,floor_item[1].offsetTop,floor_item[2].offsetTop,floor_item[3].offsetTop,floor_item[4].offsetTop,document.body.scrollTop,document.documentElement.scrollTop);
//debugger
if (window_scrollTop > floor_offsetTop) {
_this.setFloorScrollArrowUp(timer)
} else if (window_scrollTop === floor_offsetTop) {
return false
} else {
_this.setFloorScrollArrowDown(timer)
if('goodsName' in this.params) {
if(this.params.goodsName === '') {
this.$message({type: 'error',message: '[ 商品信息 ] 中 商品名称未填写!'});
return;
}
},
/* 设置楼层向上滚动* @params Object timer 定时器配置 */
setFloorScrollArrowUp(timer) {
//debugger
let _this = this
clearInterval(_this.TIMER)
_this.TIMER = setInterval(() => {
const window_scrollTop = _this.$refs.scrollview.scrollTop
if (window_scrollTop <= timer.FLOOR_OFFSETTOP) {
_this.$refs.scrollview.scrollTop = timer.FLOOR_OFFSETTOP
clearInterval(_this.TIMER)
} else {
_this.$refs.scrollview.scrollTop = window_scrollTop - timer.step
if(this.params.categoryId === 0) {
this.$message({type: 'error',message: '[ 商品信息 ] 中 商品分类未填写!'});
return;
}
}, timer.times)
},
/* 设置楼层向下滚动@params Object timer 定时器配置 */
setFloorScrollArrowDown(timer) {
let floor_item = document.getElementsByClassName('floor-cont');
let fuck = 0;
let _this = this
clearInterval(_this.TIMER)
fuck = timer.FLOOR_OFFSETTOP
/**/
// if(_this.isFIActive === 4) {
// console.log(280,_this.$refs.scrollview.scrollTop);
// timer.FLOOR_OFFSETTOP = timer.FLOOR_OFFSETTOP - 333;
// }
console.log(999,floor_item[0].offsetHeight); //offsetHeight
/**/
_this.TIMER = setInterval(() => {
const window_scrollTop = _this.$refs.scrollview.scrollTop
if (window_scrollTop >= timer.FLOOR_OFFSETTOP) {
_this.$refs.scrollview.scrollTop = timer.FLOOR_OFFSETTOP
clearInterval(_this.TIMER)
} else {
_this.$refs.scrollview.scrollTop = window_scrollTop + timer.step
if(this.params.scPrice === '') {
this.$message({type: 'error',message: '[ 商品信息 ] 中 市场原价未填写!'});
return;
}
}, timer.times)
},
} // methods end
if(this.params.price === '') {
this.$message({type: 'error',message: '[ 商品信息 ] 中 指导售价未填写!'});
return;
}
</script>
<style scoped lang="scss" type="text/css">
p {
margin: 0;
padding: 0;
if(this.params.jsPrice === '') {
this.$message({type: 'error',message: '[ 商品信息 ] 中 结算价格未填写!'});
return;
}
/* el-card title hxz 样式统一 */
.card-header-title {
display: flex;
flex-direction: row;
justify-content: start;
align-items: center;
font-size: 18px;
color: #333;
font-weight: 400;
height: 24px;
}
.blue-block-goods {
width: 5px;
height: 24px;
background: #3A84FF;
margin: 0 7px 0 0;
border-radius: 2px;
}
/* el-card title hxz 样式统一 end */
.goods-type-tip {
width: 100%;
background: #F1F7FD;
border: 1px solid #3A84FF;
font-size: 14px;
font-weight: 400;
color: #3A84FF;
line-height: 1em;
padding: 14px 15px;
}
.goods-type-options {
margin: 25px 0;
}
/*------------ 联级面板样式重置 start ------------*/
/deep/.el-cascader-panel.is-bordered {
border: none;
}
/deep/.el-cascader-menu {
min-width: 280px;
border: none;
box-shadow: 0px 4px 9px 1px rgba(51, 51, 51, 0.09);
border-radius: 2px;
overflow: hidden;
if(this.params.goodsNowStock === '') {
this.$message({type: 'error',message: '[ 商品信息 ] 中 商品库存未填写!'});
return;
}
/deep/.el-cascader-menu__wrap {
width: 280px;
height: 500px;
overflow: auto;
margin: 5px 0!important;
if(this.params.unit === '') {
this.$message({type: 'error',message: '[ 商品信息 ] 中 商品单位未填写!'});
return;
}
if(this.params.goodsBrand === '') {
this.$message({type: 'error',message: '[ 商品信息 ] 中 商品名称未填写!'});
return;
}
/* 很重要,不要问我为什么 */
/deep/.el-scrollbar:hover>.el-scrollbar__bar, /deep/.el-scrollbar:active>.el-scrollbar__bar, /deep/.el-scrollbar:focus>.el-scrollbar__bar {
opacity: 0;
}
/*------------ 联级面板样式重置 end ---------------*/
.next-step {
padding: 10px 25px;
margin: 0 auto;
display: block;
}
/* 电梯效果 样式 */
.floor-nav {
width: 100%;
if(!isGoodSImgMsg) {
this.$message({type: 'error',message: '[ 商品图片 ] 未上传图片!'});
return;
}else {
if('defaultImg' in this.params) {
if(this.params.defaultImg === '') {
this.$message({type: 'error',message: '[ 商品图片 ] 中 商品主图未上传!'});
return;
}
.floor-nav .nav-list {
padding: 0;
margin:0;
display: flex;
justify-content: start;
flex-direction: row;
border-bottom:1px solid #eee;
}
.floor-nav .nav-list .nav-list-item {
font-size: 18px;
font-weight: 400;
color: #333333;
padding: 0 25px 15px;
if(this.params.imgs.length === 0) {
this.$message({type: 'error',message: '[ 商品图片 ] 中 商品轮播图未上传!'});
return;
}
}
}
this.loading = true;
addGoods(this.params).then(res => {
if (res.code === 1) {
this.$message({
message: res.msg,
type: 'success'
});
this.$emit('closeDialog',false);
if (this.goodsOnsale) {
var redUrl = '/system/goods/onsale';
} else {
var redUrl = '/system/goods/offsale';
}
this.$router.push({
path: redUrl
});
} else if(res.code === 0) {
if(res.msg) {
this.$message.error(res.msg);
}else {
this.$message.error("操作失败!");
}
}
this.loading = false;
});
},
//------ 通用方法 -----
verifiesForm(type,fieldName,obj) {
// 先判断类型,字符串类型type === text, 下拉形式字段 select
if(type === 'text') {
// 没有这个属性,肯定没有填写,抛出提示
if(!(fieldName in obj)) {
return 1;
}
}
if(type === 'select') {
}
// 如果有这个属性,那么进一步判断,这个必填值是否填写
// if(fieldName in obj && !obj[fieldName]) {
// return 2
// }
}
}
}
</script>
<style scoped lang="scss" type="text/stylus">
ul, li {
list-style: none;
vertical-align: middle;
align-self: center;
border-bottom: 2px solid #fff;
cursor: pointer;
margin: 0;
padding: 0;
}
.ullist {
border: 1px solid #e7eaec;
padding: 10px;
margin-bottom: 10px;
}
.floor-nav .nav-list .floor-item-active,
.floor-nav .nav-list .nav-list-item:hover {
color: #3A84FF;
font-weight: bold;
border-bottom: 2px solid #3A84FF;
.el-input-group {
width: calc(100% - 60px);
}
.floor-item-box-title {
background: #F1F1F6;
height: 45px;
.addbtn {
background-color: #5bc0de !important;
color: #fff !important;
border-radius: 0 4px 4px 0;
}
.blue-block-goods-title {
margin: 0 20px 0 0;
/deep/.el-card__body {
height: calc(100% - 50px);
overflow: hidden;
}
/deep/.good-details-body .el-card__body {
.el-tabs {
height: 100%;
padding: 15px 20px 0px 20px;
overflow: hidden;
/deep/.el-tabs__content {
height: calc(100% - 50px);
overflow-y: scroll;
}
}
.eldelbtn {
height: 30px;
padding: 5px 20px !important;
margin-left: -3px;
}
.floor-cont{
height: calc(100% - 98px);
overflow: auto;
.childlist {
margin-top: 10px;
}
.floor-item {
padding: 0 20px 0 0;
margin: 15px auto;
min-height: 300px;
color: #333;
.el-button--medium {
padding: 10px 12px;
}
.submit-type-con {
width: 236px;
margin: 0 auto 20px;
.dfbtn {
position: relative;
}
.submit-cont {
width: calc(100% + 40px);
padding: 12px 0 8px;
margin-left: -20px;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
/*align-content: center;*/
box-shadow: 0px -8px 9px 1px rgba(51, 51, 51, 0.06);
.goods .el-tabs__content {
height: 100%;
overflow-y: scroll;
}
</style>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论