1 |
- (window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-3ae6e99a"],{"02f3":function(t,e,i){},"2fd4":function(t,e,i){"use strict";var o=i("4e9e");i.n(o).a},"4e9e":function(t,e,i){},7624:function(t,e,i){"use strict";e.a=["em-tlj-1","em-tlj-2","em-tlj-3","em-tlj-4","em-tlj-5","em-tlj-6","em-tlj-7","em-tlj-8","em-tlj-9","em-tlj-10","em-tlj-11","em-tlj-12","em-tlj-13","em-tlj-14","em-tlj-15","em-tlj-16","em-tlj-17","em-tlj-18","em-tlj-19","em-tlj-20","em-tlj-21","em-tlj-22","em-tlj-23","em-tlj-24","em-tlj-25","em-tlj-26","em-tlj-27","em-tlj-28","em-tlj-29","em-tlj-30","em-tlj-31","em-tlj-32","em-tlj-33","em-tlj-34","em-tlj-35","em-tlj-36","em-tlj-37","em-tlj-38","em-tlj-39","em-tlj-40","em-tlj-41","em-tlj-42","em-tlj-43","em-tlj-44","em-tlj-45","em-tlj-46","em-tlj-47","em-tlj-48","em-tlj-49","em-tlj-50","em-tlj-51","em-tlj-52","em-tlj-53","em-tlj-54","em-tlj-55","em-tlj-56","em-tlj-57","em-tlj-58","em-tlj-59","em-tlj-60","em-tlj-61","em-tlj-62","em-tlj-63","em-tlj-64","em-tlj-65","em-tlj-66","em-tlj-67","em-tlj-68","em-tlj-69","em-tlj-70","em-tlj-71","em-tlj-72","em-tlj-73","em-tlj-74","em-tlj-75","em-tlj-76","em-tlj-77","em-tlj-78","em-tlj-79","em-tlj-80","em-tlj-81","em-tlj-82","em-tlj-83","em-tlj-84","em-tlj-85","em-tlj-86","em-tlj-87","em-tlj-88","em-tlj-89","em-tlj-90","em-tlj-91","em-tlj-92","em-tlj-93","em-tlj-94","em-tlj-95","em-tlj-96"]},ca50:function(t,e,i){"use strict";var o=i("02f3");i.n(o).a},eea8:function(t,e,i){"use strict";i.r(e),i("f9db");var o=i("7624"),n=i("49ea"),s=i("d708"),a=i("a78e"),r=i.n(a),c=i("42e3"),l={name:"feedback",props:{change:Boolean},data:function(){return{loading:!1,isShow:!1,formItem:{rela_name:"",content:"",phone:""},notice:"",ruleValidate:{rela_name:[{required:!0,message:"请输入您的姓名",trigger:"blur"}],content:[{required:!0,message:"请输入留言内容",trigger:"blur"}],phone:[{required:!0,message:"请填写手机号码",trigger:"change"},{pattern:/^1[3456789]\d{9}$/,message:"手机号码格式不正确",trigger:"blur"}]}}},mounted:function(){this.getNotice()},methods:{handleSubmit:function(t){var e=this;this.loading=!0,this.$refs[t].validate((function(t){t&&Object(c.i)(e.formItem).then((function(t){e.loading=!1,e.isShow=!0})).cache((function(t){e.loading=!1,e.$Message.error(t.msg)}))}))},close:function(){this.$emit("closeChange",!1)},getNotice:function(){var t=this;Object(c.h)().then((function(e){t.notice=e.data.feedback})).cache((function(e){t.$Message.error(e.msg)}))}}},d=(i("ca50"),i("2877"));function u(t){return function(t){if(Array.isArray(t)){for(var e=0,i=new Array(t.length);e<t.length;e++)i[e]=t[e];return i}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var m={name:"ChatRoom",auth:!1,components:{feedBack:Object(d.a)(l,(function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",[i("div",{staticClass:"feedback",class:!0===t.change?"on":""},[i("div",{staticClass:"feedback-header acea-row"},[i("span",{staticClass:"sp1"},[t._v("商城客服已离线")]),i("div",[i("Icon",{attrs:{type:"md-close",color:"#fff",size:"18"},on:{click:t.close}})],1)]),t.isShow?t._e():i("div",[i("div",{staticClass:"feedback-conent mb20"},[i("div",{staticClass:"ft",domProps:{textContent:t._s(t.notice)}})]),i("div",[i("Form",{ref:"formItem",staticClass:"pl15",attrs:{model:t.formItem,rules:t.ruleValidate}},[i("FormItem",{attrs:{prop:"rela_name"}},[i("Input",{attrs:{placeholder:"请输入您的姓名"},model:{value:t.formItem.rela_name,callback:function(e){t.$set(t.formItem,"rela_name",e)},expression:"formItem.rela_name"}})],1),i("FormItem",{attrs:{prop:"phone"}},[i("Input",{attrs:{placeholder:"请输入您的联系电话"},model:{value:t.formItem.phone,callback:function(e){t.$set(t.formItem,"phone",e)},expression:"formItem.phone"}})],1),i("FormItem",{attrs:{prop:"content"}},[i("Input",{staticClass:"mb10",attrs:{type:"textarea",placeholder:"请输入留言内容"},model:{value:t.formItem.content,callback:function(e){t.$set(t.formItem,"content",e)},expression:"formItem.content"}})],1),i("FormItem",[i("Button",{staticClass:"btn-add",attrs:{type:"primary",loading:t.loading},on:{click:function(e){return t.handleSubmit("formItem")}}},[t._v("提交留言")])],1)],1)],1)]),t.isShow?i("div",{staticClass:"sure"},[i("div",{staticClass:"sure-yuan"},[i("Icon",{attrs:{type:"md-checkmark",color:"#fff",size:"30"}})],1),i("div",{staticClass:"sp1 mb10"},[t._v("提交成功")]),i("div",{staticClass:"sp2 mb30"},[t._v("您的信息提交成功,我们会尽快与您取得联系!")]),i("Button",{attrs:{type:"primary"},on:{click:t.close}},[t._v("好的")])],1):t._e()]),i("div",{directives:[{name:"show",rawName:"v-show",value:!0===t.change,expression:"change === true"}],staticClass:"maskModel",on:{touchmove:function(t){t.preventDefault()}}})])}),[],!1,null,"cbc8b94c",null).exports},props:{chatOptions:{type:Object,default:function(){return{show:!1}}}},directives:{drag:{inserted:function(t){var e=0,i=0,o=0,n=0,s=!1;t.onmousedown=function(a){return e=a.clientX,i=a.clientY,o=t.parentNode.offsetLeft,n=t.parentNode.offsetTop,s=!0,t.style.cursor="move",window.onmousemove=function(a){if(0!=s){var r=a.clientX,c=a.clientY,l=r-(e-o),d=c-(i-n);t.parentNode.style.left=l+"px",t.parentNode.style.top=d+"px"}},window.onmouseup=function(){s=!1,t.style.cursor="default",window.onmousemove=null,window.onmouseup=null},!1}}}},data:function(){return{roterPre:s.a.roterPre,locations:"".concat(location.origin),change:!1,emojiGroup:function(t,e){e=1*e||1;var i=[];return t.forEach((function(t,o){o%e==0&&i.push([]),i[i.length-1].push(t)})),i}(o.a,20),emojiList:o.a,emojiShow:!1,recordList:[],limit:20,loading:!1,finished:!1,chatCont:"",service:null,serviceData:{},uploadAction:"",notice:"",audio:null,muted:!1,audioSrc:"",upperId:0,uploadData:{},is_tourist:1,text:"",isLoad:!1,page:1,tourist_avatar:"",tourist_uid:"",toUid:"",kufuToken:"",pageWs:""}},watch:{muted:function(t){this.audio.muted=t}},computed:{records:function(){var t=this;return this.recordList.map((function(e,i){return i&&new Date(e.add_time)-new Date(t.recordList[i-1].add_time)>=3e5?e.show=!0:e.show=!1,e}))}},created:function(){-1!=location.href.indexOf("".concat(s.a.routePreKF))&&(this.uploadAction=s.a.apiBaseURL.replace(/adminapi/,"kefuapi")+"/tourist/upload");var t=r.a.get("auth._token.local1");this.kufuToken=t?t.split("Bearer%20")[1]:""},mounted:function(){var t=this;window.addEventListener("click",(function(){t.emojiShow&&(t.emojiShow=!1)})),this.$wechat._isMobile()&&this.$router.replace("".concat(this.routePreKF,"/mobile_user_chat")),this.getService(),this.pageWs=Object(n.a)(!0,this.kufuToken,this.tourist_uid),this.text=this.replace_em("[em-smiling_imp]"),this.wsStart()},beforeDestroy:function(){this.pageWs.close()},methods:{wsStart:function(){var t=this;this.pageWs.then((function(e){t.kufuToken&&e.send({type:"login",data:t.kufuToken}),t.getService(),e.$on(["reply","chat"],(function(e){1==e.msn_type&&(e.msn=t.replace_em(e.msn)),t.recordList.push(e),setTimeout((function(e){t.$nextTick((function(){this.$refs.record.scrollTop=this.$refs.record.scrollHeight-this.$refs.record.clientHeight}))}),300)})),e.$on("to_transfer",(function(i){t.toUid=i.toUid,e.send({data:{id:t.toUid},type:"to_chat"})})),e.$on("socket_error",(function(){t.$Message.error("连接失败")})),e.$on("err_tip",(function(e){t.$Message.error(e.msg)})),e.$on("success",(function(e){t.is_tourist=0})),e.$on("timeout",(function(e){setTimeout((function(){t.wsRestart()}),2e3)}))})).catch((function(e){setTimeout((function(e){t.wsRestart()}),2e3)}))},wsRestart:function(){this.pageWs=Object(n.a)(!0,this.kufuToken,this.tourist_uid),this.wsStart()},onLook:function(t){window.open("".concat(location.origin,"/home/goods_detail/").concat(t))},closeChange:function(t){this.change=t},sendMsg:function(t,e){var i={type:"chat",data:{msn:t,type:e,is_tourist:this.is_tourist,to_uid:this.toUid,tourist_uid:this.tourist_uid,tourist_avatar:this.tourist_avatar,form_type:this.$wechat.isWeixin()?1:3}};this.pageWs.then((function(t){t.send(i)}))},getService:function(){var t=this;Object(c.O)({token:this.kufuToken||""}).then((function(e){t.serviceData=e.data,t.upperId=0,t.toUid=e.data.uid,t.tourist_uid=e.data.tourist_uid,t.tourist_avatar=e.data.tourist_avatar;var i={data:{id:e.data.uid,tourist_uid:t.tourist_uid},type:"to_chat"};t.pageWs.then((function(t){t.send(i)})),t.kufuToken&&t.getRecordList()})).catch((function(e){t.change=!0}))},roomClick:function(t){},ctrlEnter:function(t){13==t.keyCode&&t.preventDefault(),this.chatCont.trim()&&this.sendMessage()},close:function(){this.$emit("chat-close")},selectEmoji:function(t){this.emojiShow=!1,this.sendMsg("[".concat(t,"]"),1)},replace_em:function(t){return t.replace(/\[em-([\s\S]*?)\]/g,"<span class='em em-$1'/></span>")},onScroll:function(t){t.target.scrollTop<=30&&this.kufuToken&&this.getRecordList()},getRecordList:function(){var t=this;this.loading||this.finished||(this.loading=!0,Object(c.e)({uid:this.serviceData.uid,limit:this.limit,upperId:this.upperId,token:this.kufuToken}).then((function(e){if(0===e.data.length)return t.loading=!1;e.data.forEach((function(e){1==e.msn_type&&(e.msn=t.replace_em(e.msn))}));var i="";i=0==t.upperId?"chat_".concat(e.data[e.data.length-1].id):"chat_".concat(t.recordList[0].id),t.recordList=[].concat(u(e.data),u(t.recordList)),t.upperId=e.data.length>0?e.data[0].id:0,t.loading=!1,t.finished=e.data.length<t.limit,t.$nextTick((function(){this.setPageScrollTo(i)}))})).catch((function(e){t.$Message.error(e.msg)})))},setPageScrollTo:function(t){var e=this;this.$nextTick((function(){if(t)setTimeout((function(){var i=parseFloat(document.getElementById(t).offsetTop)-60;e.$refs.record.scrollTop=i}),0);else{var i=document.querySelector("#chat_scroll");e.$refs.record.scrollTop=i.offsetHeight,setTimeout((function(t){e.$refs.record.scrollTop!=e.$refs.scrollBox.offsetHeight&&(e.$refs.record.scrollTop=document.querySelector("#chat_scroll").offsetHeight)}),300)}}))},emojiSwitch:function(){this.emojiShow=!0},sendMessage:function(){this.sendMsg(this.chatCont,1),this.chatCont=""},chat:function(t){var e=this;t.uid!=this.$auth.user.uid&&this.audio&&this.audio.play(),this.recordList.push(t),this.$nextTick((function(){e.$refs.record.scrollTop=e.$refs.record.scrollHeight-e.$refs.record.clientHeight}))},sendGoods:function(){var t=this;this.chatOptions.goodsId&&this.pageWs.then((function(e){e.send({data:{msn:t.chatOptions.goodsId,type:5,to_uid:t.toUid},type:"to_chat"})}))},sendOrder:function(){var t=this;this.chatOptions.orderId&&this.pageWs.then((function(e){e.send({data:{msn:t.chatOptions.orderId,type:6,to_uid:t.toUid},type:"to_chat"})}))},chatEnd:function(){navigator.userAgent.indexOf("MSIE")>0?navigator.userAgent.indexOf("MSIE 6.0")>0?(window.opener=null,window.close()):(window.open("","_top"),window.top.close()):navigator.userAgent.indexOf("Firefox")>0?window.location.href="about:blank ":(window.opener=null,window.open("","_self",""),window.close())},getNotice:function(){var t=this;Object(c.j)().then((function(e){t.notice=e.data.content}))},beforeUpload:function(t){var e=this;return this.uploadData={filename:t,token:this.kufuToken},new Promise((function(t){e.$nextTick((function(){t(!0)}))}))},handleFormatError:function(t){this.$Message.error("上传图片只能是 jpg、jpg、jpeg、gif 格式!")},uploadSuccess:function(t){this.sendMsg(t.data.url,3)},uploadError:function(t){this.$message.error(t)}}},f=(i("2fd4"),Object(d.a)(m,(function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"chat-room"},[i("div",{staticClass:"room",class:{win:!t.chatOptions.popup},on:{click:t.roomClick}},[i("div",{directives:[{name:"drag",rawName:"v-drag"}],staticClass:"head"},[i("div",{staticClass:"image"},[i("img",{directives:[{name:"lazy",rawName:"v-lazy",value:t.serviceData&&t.serviceData.avatar,expression:"serviceData && serviceData.avatar"}]})]),i("div",{staticClass:"name"},[t._v(t._s(t.serviceData&&t.serviceData.nickname))]),i("div",{class:["iconfont",t.muted?"icon-shengyinjingyinxianxing":"icon-shengyinyinliang"],on:{click:function(e){t.muted=!t.muted}}}),i("div",{staticClass:"iconfont icon-guanbi5",on:{click:t.close}})]),i("div",{staticClass:"main"},[i("div",{staticClass:"chat"},[i("div",{ref:"record",staticClass:"record",on:{scroll:t.onScroll}},[i("Spin",{directives:[{name:"show",rawName:"v-show",value:t.loading,expression:"loading"}]},[i("Icon",{staticClass:"demo-spin-icon-load",attrs:{type:"ios-loading",size:"18"}}),i("div",[t._v("Loading")])],1),i("ul",[t._l(t.records,(function(e){return[i("li",{key:e.id,class:{right:e.to_uid===t.serviceData.uid}},[e.show?i("div",{staticClass:"time-tag"},[t._v("\n "+t._s(e.add_time)+"\n ")]):t._e(),i("div",{staticClass:"avatar"},[i("img",{directives:[{name:"lazy",rawName:"v-lazy",value:e.avatar,expression:"item.avatar"}]})]),i("div",{ref:"chatContent",refInFor:!0,staticClass:"content"},[1===e.msn_type?i("div",{staticClass:"text",domProps:{innerHTML:t._s(e.msn)}}):t._e(),2===e.msn_type?i("div",{staticClass:"image"},[i("div",{staticClass:"text"},[i("i",{class:"em "+e.msn})])]):t._e(),3===e.msn_type?i("div",{directives:[{name:"viewer",rawName:"v-viewer"}],staticClass:"image"},[i("img",{attrs:{src:e.msn}})]):t._e(),5===e.msn_type?i("div",{staticClass:"goods"},[i("div",{staticClass:"thumb"},[i("img",{attrs:{src:e.productInfo.image}})]),i("div",{staticClass:"intro"},[i("div",{staticClass:"name"},[t._v("\n "+t._s(e.productInfo.store_name)+"\n ")]),i("div",{staticClass:"attr"},[i("span",[t._v("库存:"+t._s(e.productInfo.stock))]),i("span",[t._v("销量:"+t._s(e.productInfo.sales))])]),i("div",{staticClass:"group"},[i("div",{staticClass:"money"},[t._v("\n ¥"+t._s(e.productInfo.price)+"\n ")]),i("nuxt-link",{attrs:{target:"_blank",to:{path:"/goods_detail/"+e.productInfo.id}}},[t._v("查看商品 >")])],1)])]):t._e(),6===e.msn_type?t._l(e.orderInfo.cartInfo,(function(o){return i("div",{key:o.id,staticClass:"order"},[i("div",{staticClass:"thumb"},[i("img",{attrs:{src:o.productInfo.image}})]),i("div",{staticClass:"intro"},[i("div",{staticClass:"name"},[t._v("\n 订单ID:"+t._s(e.orderInfo.order_id)+"\n ")]),i("div",{staticClass:"attr"},[t._v("商品数量:"+t._s(o.cart_num))]),i("div",{staticClass:"group"},[i("div",{staticClass:"money"},[t._v("\n ¥"+t._s(o.productInfo.price)+"\n ")]),i("nuxt-link",{attrs:{target:"_blank",to:{path:"/order_detail",query:{orderId:e.orderInfo.order_id}}}},[t._v("查看订单 >")])],1)])])})):t._e()],2)])]}))],2)],1),i("div",{staticClass:"editor"},[i("div",{staticClass:"editor-hd"},[i("div",[i("button",{staticClass:"emoji-btn",attrs:{title:"表情"},on:{click:function(e){return e.stopPropagation(),t.emojiSwitch(e)}}},[i("span",{staticClass:"iconfont iconbiaoqing1"})]),t.kufuToken?i("button",{attrs:{title:"图片"}},[i("Upload",{attrs:{"show-upload-list":!1,action:t.uploadAction,"before-upload":t.beforeUpload,format:["jpg","jpeg","png","gif"],"on-format-error":t.handleFormatError,data:t.uploadData,"on-success":t.uploadSuccess,"on-error":t.uploadError}},[i("span",{staticClass:"iconfont icontupian1"})])],1):t._e()]),t.emojiShow?i("div",{staticClass:"emoji-panel"},t._l(t.emojiList,(function(e,o){return i("i",{key:o,staticClass:"em",class:e,on:{click:function(i){return t.selectEmoji(e)}}})})),0):t._e()]),i("div",{staticClass:"editor-bd"},[i("textarea",{directives:[{name:"model",rawName:"v-model",value:t.chatCont,expression:"chatCont"}],attrs:{placeholder:"请输入文字内容"},domProps:{value:t.chatCont},on:{keydown:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.ctrlEnter(e)},input:function(e){e.target.composing||(t.chatCont=e.target.value)}}})]),i("div",{staticClass:"editor-ft"},[i("button",{attrs:{disabled:!t.chatCont},on:{click:t.sendMessage}},[t._v("发送")])])])]),i("div",{staticClass:"notice"},[t.notice?i("div",{staticClass:"rich",domProps:{innerHTML:t._s(t.notice)}}):t._e(),t._m(0)])]),i("audio",{ref:"audio",attrs:{src:t.audioSrc}})]),t.change?i("feed-back",{attrs:{change:t.change},on:{closeChange:function(e){return t.closeChange(e)}}}):t._e()],1)}),[function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"copy"},[e("a",{attrs:{href:"http://www.crmeb.com/",target:"_blank"}},[this._v("CRMEB提供技术支持")])])}],!1,null,"058384aa",null));e.default=f.exports},f9db:function(t,e,i){}}]);
|