goods-detail.js 7.4 KB

12
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/goods-detail/goods-detail"],{172:function(e,n,t){"use strict";(function(e,n){var o=t(4);t(26);o(t(25));var a=o(t(173));e.__webpack_require_UNI_MP_PLUGIN__=t,n(a.default)}).call(this,t(1)["default"],t(2)["createPage"])},173:function(e,n,t){"use strict";t.r(n);var o=t(174),a=t(176);for(var i in a)["default"].indexOf(i)<0&&function(e){t.d(n,e,(function(){return a[e]}))}(i);t(178);var s,c=t(32),r=Object(c["default"])(a["default"],o["render"],o["staticRenderFns"],!1,null,"23714906",null,!1,o["components"],s);r.options.__file="pages/goods-detail/goods-detail.vue",n["default"]=r.exports},174:function(e,n,t){"use strict";t.r(n);var o=t(175);t.d(n,"render",(function(){return o["render"]})),t.d(n,"staticRenderFns",(function(){return o["staticRenderFns"]})),t.d(n,"recyclableRender",(function(){return o["recyclableRender"]})),t.d(n,"components",(function(){return o["components"]}))},175:function(e,n,t){"use strict";var o;t.r(n),t.d(n,"render",(function(){return a})),t.d(n,"staticRenderFns",(function(){return s})),t.d(n,"recyclableRender",(function(){return i})),t.d(n,"components",(function(){return o}));try{o={tkiQrcode:function(){return Promise.all([t.e("common/vendor"),t.e("components/tki-qrcode/tki-qrcode")]).then(t.bind(null,186))}}}catch(c){if(-1===c.message.indexOf("Cannot find module")||-1===c.message.indexOf(".vue"))throw c;console.error(c.message),console.error("1. 排查组件名称拼写是否正确"),console.error("2. 排查组件是否符合 easycom 规范,文档:https://uniapp.dcloud.net.cn/collocation/pages?id=easycom"),console.error("3. 若组件不符合 easycom 规范,需手动引入,并在 components 中注册该组件")}var a=function(){var e=this,n=e.$createElement,t=(e._self._c,Number(e.goods.price)-Number(e.goods.vip_price)||0),o=e._f("formatRichText")(e.goods.content);e._isMounted||(e.e0=function(n){e.shareShow=!1}),e.$mp.data=Object.assign({},{$root:{m0:t,f0:o}})},i=!1,s=[];a._withStripped=!0},176:function(e,n,t){"use strict";t.r(n);var o=t(177),a=t.n(o);for(var i in o)["default"].indexOf(i)<0&&function(e){t.d(n,e,(function(){return o[e]}))}(i);n["default"]=a.a},177:function(e,n,t){"use strict";(function(e,o){var a=t(4);Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var i=t(71),s=(a(t(63)),a(t(93)),t(64),{data:function(){return{goods:"",banner:[],allImg:0,current:0,shareShow:!1,canvasWidth:0,canvasHeight:0,store:"",poster:"",imgPath:"",model:"",isVip:"",code:{val:"",size:200,icon:"",iconsize:25,onval:!0,loadMake:"",showLoading:!0,loadingText:"二维码生成中..."},shareGoods:{},qr_code:"",goods_img:""}},onLoad:function(n){var t=this;n.goods_id&&(this.getDetail(n.goods_id),this.store=e.getStorageSync("store")),o.getSystemInfo({success:function(e){t.model=e.model,t.canvasWidth=e.windowWidth/375,t.canvasHeight=e.windowHeight}})},onShow:function(){this.qr_code=e.getStorageSync("qrCode")},methods:{saveImg:function(){var n=this;e.getSetting({success:function(t){t.authSetting["scope.writePhotosAlbum"]?(e.showLoading({title:"保存中..."}),o.saveImageToPhotosAlbum({filePath:n.poster,success:function(n){e.showModal({content:"图片已保存到相册,赶快分享给好友吧~",showCancel:!1}),e.hideLoading()},fail:function(n){e.hideLoading(),e.showToast({title:"保存失败",icon:"none"})}})):e.authorize({scope:"scope.writePhotosAlbum",success:function(t){e.saveImageToPhotosAlbum({filePath:n.poster,success:function(n){e.showModal({content:"图片已保存到相册,赶快分享给好友吧~",showCancel:!1})},fail:function(n){e.showToast({title:"保存失败",icon:"none"})}})},fail:function(n){e.showModal({title:"提示",content:"需要获取相册访问权限,请到小程序设置页面打开授权",cancelText:"取消",cancelColor:"#999",confirmText:"确定",confirmColor:"#f94218",success:function(n){n.confirm?e.openSetting({success:function(e){console.log(e.authSetting)},fail:function(n){e.showModal({content:"调起设置失败,请手动设置相册权限",showCancel:!1})}}):n.cancel&&e.showModal({content:"您取消了设置相册权限,不能保存图片到相册",showCancel:!1})}})}})}})},copy:function(n){e.setClipboardData({data:n,success:function(n){e.showToast({title:"复制成功"})},fail:function(){e.showToast({title:"复制失败",icon:"none"})}})},shareNow:function(){var n=this;if(!this.qr_code)return e.showModal({content:"为了方便客户加你微信咨询购买,请先上传微信二维码",showCancel:!1,success:function(n){n.confirm&&e.navigateTo({url:"../add-qrcode/add-qrcode"})}}),!1;var t=this.goods;e.getImageInfo({src:t.imgs,success:function(e){n.goods_img=e.path}}),this.shareGoods={price:parseInt(t.price),name:t.main_attr},this.code.val="".concat(this.$config.share_url,"#pages/index/index?store_id=").concat(this.store.id,"&goods_id=").concat(this.goods.id),this.shareShow=!0,this.$refs.qrcode._makeCode()},drawPoster:function(n){var t=this,o=this;e.showLoading({title:"图片生成中..."});var a=o.shareGoods;e.getImageInfo({src:"https://api.wd.cliu.cc/good_poster.png",success:function(i){e.showLoading({title:"图片加载中..."});var s=e.createCanvasContext("canvas"),c=o.store;c.name=c.name.length>7?c.name.slice(0,7)+"...的店铺":c.name+"的店铺";var r=o.canvasWidth;s.drawImage(i.path,0,0,270*r,480*r),s.font="normal bold 14px pingfang",s.textAlign="center",s.fillText(c.name,e.upx2px(270),e.upx2px(210)),s.drawImage(t.goods_img,e.upx2px(110),e.upx2px(270),e.upx2px(130),e.upx2px(103)),s.font="normal bold 14px pingfang",s.fillText(a.name,"纯棉老人版"==a.name?e.upx2px(320):e.upx2px(290),e.upx2px(300)),s.font="normal normal 12px pingfang",s.setFillStyle("#999999"),s.font="normal bold 12px pingfang",s.setFillStyle("#FB231F"),s.fillText("¥",e.upx2px(256),e.upx2px(365)),s.font="normal bold 16px pingfang",s.setFillStyle("#FB231F"),s.fillText(a.price,e.upx2px(300),e.upx2px(365)),s.drawImage(n,e.upx2px(110),e.upx2px(420),e.upx2px(320),e.upx2px(320)),s.font="noraml bold 14px pingfang",s.textAlign="center",s.setFillStyle("#060001"),s.fillText("长按二维码-识别-进店铺",e.upx2px(270),e.upx2px(790)),setTimeout((function(n){s.draw(!1,(function(){e.canvasToTempFilePath({width:270*r,height:480*r,canvasId:"canvas",success:function(n){if(e.hideLoading(),"iPhone"==t.model)t.poster=t.dataURLtoFile(n.tempFilePath).name;else{var o=n.tempFilePath.replace(/\. +/g,"");t.poster=o.replace(/[\r\n]/g,"")}},fail:function(){e.hideLoading()}})}))}),500)}})},getDetail:function(n){var t=this,o=this;e.showLoading({title:"加载中..."}),(0,i.goodsDetail)({goods_id:n}).then((function(n){200==n.code?(t.goods=n.data,n.data.banner&&(o.banner=JSON.parse(n.data.banner),o.allImg=o.banner.length)):e.showModal({content:n.data,showCancel:!1}),e.hideLoading()})).catch((function(n){e.hideLoading()}))},swiperChange:function(e){this.current=e.target.current},dataURLtoFile:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"file",t=e.split(","),o=t[0].match(/:(.*?);/)[1],a=o.split("/")[1],i=atob(t[1]),s=i.length,c=new Uint8Array(s);while(s--)c[s]=i.charCodeAt(s);return new File([c],"".concat(n,".").concat(a),{type:o})}}});n.default=s}).call(this,t(2)["default"],t(1)["default"])},178:function(e,n,t){"use strict";t.r(n);var o=t(179),a=t.n(o);for(var i in o)["default"].indexOf(i)<0&&function(e){t.d(n,e,(function(){return o[e]}))}(i);n["default"]=a.a},179:function(e,n,t){}},[[172,"common/runtime","common/vendor"]]]);
  2. //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/goods-detail/goods-detail.js.map