3 lines
15 KiB
JavaScript
3 lines
15 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-69cc5fb5"],{"1da1":function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));n("d3b7");function o(t,e,n,o,r,i,a){try{var s=t[i](a),c=s.value}catch(d){return void n(d)}s.done?e(c):Promise.resolve(c).then(o,r)}function r(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var a=t.apply(e,n);function s(t){o(a,r,i,s,c,"next",t)}function c(t){o(a,r,i,s,c,"throw",t)}s(void 0)}))}}},"6fb0":function(t,e,n){"use strict";n.r(e);var o=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{attrs:{id:"work-wechat-index"}},[n("div",{staticClass:"top-search"},[n("van-search",{attrs:{placeholder:"请输入商品名称",shape:"round"},on:{search:t.search},model:{value:t.json.search.keyword,callback:function(e){t.$set(t.json.search,"keyword",e)},expression:"json.search.keyword"}})],1),n("div",[n("div",{staticStyle:{padding:"10px","padding-left":"15px","padding-right":"15px"},on:{click:function(e){return t.classificationOfSwitch()}}},[n("van-field",{attrs:{"is-link":"",readonly:"",label:"请选择分类",placeholder:"请选择所在地区"},on:{click:function(e){t.show=!0}},model:{value:t.fieldValue,callback:function(e){t.fieldValue=e},expression:"fieldValue"}})],1)]),t.goodsList.length>0?n("div",{staticClass:"list"},[n("van-list",{attrs:{finished:t.finished,"finished-text":"没有更多了","immediate-check":!1},on:{load:t.loadMore},model:{value:t.loading,callback:function(e){t.loading=e},expression:"loading"}},t._l(t.goodsList,(function(e){return n("div",{key:e.id,staticClass:"goods-item",on:{click:function(n){return n.stopPropagation(),t.toGoodsDetail(e.id)}}},[n("div",{staticClass:"left-img"},[n("img",{attrs:{src:e.thumb,alt:""}})]),n("div",{staticClass:"right-info overflow"},[n("h1",{staticClass:"goods-title overflow"},[t._v(t._s(e.title))]),n("p",{staticClass:"price"},[t._v(t._s(t.$i18n.t("money"))+" "+t._s(e.price))]),n("div",{staticClass:"bottom"},[n("span",{staticClass:"stock"},[t._v("库存"+t._s(e.stock))]),n("div",{staticClass:"bnt-send",on:{click:function(n){return n.stopPropagation(),t.sendGoods(e)}}},[t._v("发送")])])])])})),0)],1):n("van-empty",{attrs:{description:"空空如也"}}),n("div",{staticClass:"classificationPopUps"},[n("van-popup",{attrs:{round:"",position:"bottom"},model:{value:t.popupShow,callback:function(e){t.popupShow=e},expression:"popupShow"}},[n("van-cascader",{attrs:{title:"请选择分类",options:t.options,"field-names":t.fieldNames},on:{close:function(e){t.popupShow=!1},finish:t.onFinish},model:{value:t.cascaderValue,callback:function(e){t.cascaderValue=e},expression:"cascaderValue"}})],1)],1)],1)},r=[],i=n("c7eb"),a=n("5530"),s=n("1da1"),c=(n("46de"),n("a822"));n("a15b"),n("d81d"),n("b0c0"),n("ac1f"),n("841c"),n("e9c4"),n("99af"),n("9911"),n("d3b7"),n("159b");Vue.use(c["a"]);var d={data:function(){return{agentData:{agent_secret:"",agentid:"",corpid:""},strUrl:"plugin.wechat-chat-sidebar.frontend.controller.customer.home-page.index",getConfig:{client:"work",type:17},goodsList:[],json:{page:1,search:{keyword:"",category:""}},loading:!1,finished:!1,sendGoodsData:"",options:[],cascaderValue:"",popupShow:!1,fieldNames:{text:"name",value:"id",children:"has_many_children"},fieldValue:"选择分类"}},activated:function(){this.getAgentConfig(),this.categoricalData()},methods:{classificationOfSwitch:function(){this.popupShow=!this.popupShow},onFinish:function(t){this.popupShow=!1,this.fieldValue=t.selectedOptions.map((function(t){return t.name})).join("/"),this.json.search.category=t.value,this.getData()},getAgentConfig:function(){var t=this,e=this;$http.get("plugin.wechat-chat-sidebar.frontend.controller.index.get-config",{url:"ios"===this.fun.isIosOrAndroid()?window.initUrl:document.location.href},"loading").then((function(n){if(1===n.result){t.agentData=n.data;var o=n.data.get_token,r={debug:!1,beta:!0,jsApiList:["agentConfig"],openTagList:["ww-open-data"],appId:t.agentData.corpid,nonceStr:o.noncestr,timestamp:o.timestamp,signature:o.token};wx.config(r),wx.ready((function(){setTimeout((function(){e.getAgentSign(r,o.app_token)}),500)})),wx.error((function(e){t.$toast("config信息验证失败!"+JSON.stringify(e))}))}else t.$toast(n.msg)})).catch((function(t){}))},getAgentSign:function(t,e){var n=this;wx.agentConfig({corpid:t.appId,agentid:this.agentData.agentid,timestamp:t.timestamp,nonceStr:t.nonceStr,signature:e,jsApiList:["sendChatMessage"],success:function(){n.getData()}})},getData:function(t){var e=this;return Object(s["a"])(Object(i["a"])().mark((function n(){var o;return Object(i["a"])().wrap((function(n){while(1)switch(n.prev=n.next){case 0:if(!e.finished||!e.loading){n.next=2;break}return n.abrupt("return");case 2:return"loadMore"!=t&&(e.json.page=1),""==e.json.search.keyword&&delete e.json.search["keyword"],""==e.json.search.category&&delete e.json.search["category"],n.prev=5,e.loading=!0,e.finished=!1,n.next=10,$http.post(e.strUrl,Object(a["a"])(Object(a["a"])({},e.json),e.getConfig),"loading");case 10:o=n.sent,e.loading=!1,1===o.result?((e.json.page>=o.data.last_page||o.data.data.length<o.data.per_page)&&(e.finished=!0),e.goodsList=e.json.page>1?e.goodsList.concat(o.data.data):o.data.data,e.json.page=++e.json.page):(e.finished=!0,e.$toast(""!=o.msg?o.msg:"暂无数据")),n.next=18;break;case 15:n.prev=15,n.t0=n["catch"](5),e.loading=!1;case 18:case"end":return n.stop()}}),n,null,[[5,15]])})))()},search:function(){this.json.page=1,this.loading=!1,this.finished=!1,this.getData()},loadMore:function(){this.getData("loadMore")},sendGoods:function(t){var e=t;wx.invoke("sendChatMessage",{msgtype:"news",enterChat:!0,news:{link:e.link,title:e.title?e.title:"商品",desc:"",imgUrl:e.thumb}},(function(t){t.err_msg}))},categoricalData:function(){var t=this;$http.get("plugin.wechat-chat-sidebar.frontend.controller.customer.home-page.get-category",this.getConfig,"loading").then((function(e){1===e.result?(t.options=e.data,t.options.forEach((function(e,n){0==e.has_many_children.length&&delete t.options[n]["has_many_children"]}))):t.$toast(e.msg)})).catch((function(t){}))},toGoodsDetail:function(t){this.$router.push(this.fun.getUrl("goods",{id:t}))}},components:{}},l=d,u=(n("bf1f"),n("2877")),f=Object(u["a"])(l,o,r,!1,null,"0d1b4ed5",null);e["default"]=f.exports},"98f8":function(t,e,n){var o=n("24fb");e=o(!1),e.push([t.i,"#work-wechat-index[data-v-0d1b4ed5]{font-size:12px}#work-wechat-index .top-search[data-v-0d1b4ed5]{background-color:#fff;padding:.43rem .96rem}#work-wechat-index .list[data-v-0d1b4ed5]{padding:.43rem .96rem;background-color:#f2f2f2}#work-wechat-index .list .goods-item[data-v-0d1b4ed5]{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;padding:.81rem;background-color:#fff;border-radius:.25rem}#work-wechat-index .list .goods-item .left-img[data-v-0d1b4ed5]{width:4.688rem;height:4.688rem;border-radius:.25rem}#work-wechat-index .list .goods-item .left-img img[data-v-0d1b4ed5]{width:100%;height:100%}#work-wechat-index .list .goods-item .right-info[data-v-0d1b4ed5]{-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;text-align:left;margin-left:.5rem}#work-wechat-index .list .goods-item .right-info .goods-title[data-v-0d1b4ed5]{font-size:14px;color:#202020}#work-wechat-index .list .goods-item .right-info .price[data-v-0d1b4ed5]{margin:.5rem 0;font-size:.75rem;color:#f14e4e}#work-wechat-index .list .goods-item .right-info .bottom[data-v-0d1b4ed5]{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}#work-wechat-index .list .goods-item .right-info .bottom .stock[data-v-0d1b4ed5]{-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;color:#999}#work-wechat-index .list .goods-item .right-info .bottom .bnt-send[data-v-0d1b4ed5]{color:#fff;padding:.25rem 1.125rem;background-color:#f78b00;border-radius:.125rem}",""]),t.exports=e},abcb:function(t,e,n){var o=n("98f8");o.__esModule&&(o=o.default),"string"===typeof o&&(o=[[t.i,o,""]]),o.locals&&(t.exports=o.locals);var r=n("499e").default;r("5fa0d9ae",o,!0,{sourceMap:!1,shadowMode:!1})},bf1f:function(t,e,n){"use strict";n("abcb")},c7eb:function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));n("a4d3"),n("e01a"),n("d3b7"),n("d28b"),n("3ca3"),n("ddb0"),n("b636"),n("944a"),n("0c47"),n("23dc"),n("d9e2"),n("3410"),n("159b"),n("b0c0"),n("131a"),n("fb6a");var o=n("53ca");function r(){
|
||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
||
r=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function d(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{d({},"")}catch(S){d=function(t,e,n){return t[e]=n}}function l(t,e,n,o){var r=e&&e.prototype instanceof h?e:h,i=Object.create(r.prototype),a=new L(o||[]);return i._invoke=function(t,e,n){var o="suspendedStart";return function(r,i){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===r)throw i;return O()}for(n.method=r,n.arg=i;;){var a=n.delegate;if(a){var s=k(a,n);if(s){if(s===f)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===o)throw o="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o="executing";var c=u(t,e,n);if("normal"===c.type){if(o=n.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o="completed",n.method="throw",n.arg=c.arg)}}}(t,n,a),i}function u(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(S){return{type:"throw",arg:S}}}t.wrap=l;var f={};function h(){}function p(){}function g(){}var v={};d(v,a,(function(){return this}));var m=Object.getPrototypeOf,w=m&&m(m(E([])));w&&w!==e&&n.call(w,a)&&(v=w);var b=g.prototype=h.prototype=Object.create(v);function y(t){["next","throw","return"].forEach((function(e){d(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function r(i,a,s,c){var d=u(t[i],t,a);if("throw"!==d.type){var l=d.arg,f=l.value;return f&&"object"==Object(o["a"])(f)&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,s,c)}),(function(t){r("throw",t,s,c)})):e.resolve(f).then((function(t){l.value=t,s(l)}),(function(t){return r("throw",t,s,c)}))}c(d.arg)}var i;this._invoke=function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}}function k(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator["return"]&&(e.method="return",e.arg=void 0,k(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var o=u(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,f;var r=o.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function E(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,r=function e(){for(;++o<t.length;)if(n.call(t,o))return e.value=t[o],e.done=!1,e;return e.value=void 0,e.done=!0,e};return r.next=r}}return{next:O}}function O(){return{value:void 0,done:!0}}return p.prototype=g,d(b,"constructor",g),d(g,"constructor",p),p.displayName=d(g,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,d(t,c,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},y(x.prototype),d(x.prototype,s,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,o,r,i){void 0===i&&(i=Promise);var a=new x(l(e,n,o,r),i);return t.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},y(b),d(b,c,"Generator"),d(b,a,(function(){return this})),d(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var o=e.pop();if(o in t)return n.value=o,n.done=!1,n}return n.done=!0,n}},t.values=E,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(j),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function o(n,o){return a.type="throw",a.arg=t,e.next=n,o&&(e.method="next",e.arg=void 0),!!o}for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],a=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var o=this.tryEntries.length-1;o>=0;--o){var r=this.tryEntries[o];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),j(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var o=n.completion;if("throw"===o.type){var r=o.arg;j(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}}}]); |