You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
10 KiB
1 lines
10 KiB
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/index/index"],{1668:function(t,n,e){"use strict";e.r(n);var i=e("7977"),o=e.n(i);for(var a in i)"default"!==a&&function(t){e.d(n,t,(function(){return i[t]}))}(a);n["default"]=o.a},"32ce":function(t,n,e){"use strict";e.r(n);var i=e("96a1"),o=e("1668");for(var a in o)"default"!==a&&function(t){e.d(n,t,(function(){return o[t]}))}(a);e("f89d");var r,c=e("f0c5"),s=Object(c["a"])(o["default"],i["b"],i["c"],!1,null,null,null,!1,i["a"],r);n["default"]=s.exports},"53f9":function(t,n,e){"use strict";(function(t){e("8d0c");i(e("66fd"));var n=i(e("32ce"));function i(t){return t&&t.__esModule?t:{default:t}}wx.__webpack_require_UNI_MP_PLUGIN__=e,t(n.default)}).call(this,e("543d")["createPage"])},7977:function(t,n,e){"use strict";(function(t){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var i=o(e("a34a"));function o(t){return t&&t.__esModule?t:{default:t}}function a(t,n,e,i,o,a,r){try{var c=t[a](r),s=c.value}catch(u){return void e(u)}c.done?n(s):Promise.resolve(s).then(i,o)}function r(t){return function(){var n=this,e=arguments;return new Promise((function(i,o){var r=t.apply(n,e);function c(t){a(r,i,o,c,s,"next",t)}function s(t){a(r,i,o,c,s,"throw",t)}c(void 0)}))}}var c=function(){e.e("components/struggler-uniapp-add-tip/struggler-uniapp-add-tip").then(function(){return resolve(e("a7cb"))}.bind(null,e)).catch(e.oe)},s=function(){e.e("components/drag-button/drag-button").then(function(){return resolve(e("75f4"))}.bind(null,e)).catch(e.oe)},u=function(){e.e("components/uni-notice-bar/uni-notice-bar").then(function(){return resolve(e("94af"))}.bind(null,e)).catch(e.oe)},d={components:{addtip:c,dragButton:s,uniNoticeBar:u},data:function(){return{bttext:"客服",tip:"点击「添加小程序」,下次访问更便捷",duration:5,banner:[],cardCur:0,typeList:[{id:3,name:"粮油类",sort:2,icon:"http://m2.chinause.cn:8888/8img/mini/liangyou.png"}],pcdesc:[],productList:[],tjproductList:[],loadingText:"正在加载...",miaosstyle:"miaos",goodsList:[],text:"欢迎进入中龙小程序商城",backcolor:"#E8E8E8",color:"#F23E05",gg_zezhao:"none",gg_model:"none"}},methods:{baseinfo:function(t){var n=this;return r(i.default.mark((function e(){var o;return i.default.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,n.$api.baseinfo({action:"baseinfo",key:t});case 2:o=e.sent,"gscolor"==t?n.color=o.data.info:"gsbgcolor"==t&&(n.backcolor=o.data.info);case 4:case"end":return e.stop()}}),e)})))()},btnClick:function(){console.log("btnClick")},btnTouchstart:function(){console.log("btnTouchstart")},btnTouchend:function(){console.log("btnTouchend")},cardSwiper:function(t){this.cardCur=t.detail.current},toSearch:function(){t.showLoading({title:"加载中..."}),t.navigateTo({url:"/pages/search/search"}),t.hideLoading()},topcate:function(n){if("#"!=n&&void 0!=n){console.log(n);var e=n.split("?");console.log(e[1],"tourl[1]");var i=e[1].split("&"),o=i[0],a=i[1];console.log("xflid="+a+"===dflid="+o),getApp().globalData.dflid=o,getApp().globalData.xflid=a,getApp().globalData.tid=1,console.log(getApp().globalData.xflid,"保存好的id"),t.switchTab({url:e[0]})}},addcollection:function(n,e,o){var a=this;return r(i.default.mark((function r(){var c,s,u;return i.default.wrap((function(i){while(1)switch(i.prev=i.next){case 0:if(c=t.getStorageSync("userinfo"),s=0==o?!a.tjproductList[e].iscollect:!a.productList[e].iscollect,!c){i.next=10;break}return i.next=5,a.$api.addcollection({action:"addcollection",type:s,uid:c.uid,id:n});case 5:u=i.sent,t.showToast({title:u.msg,icon:"none"}),1==u.code&&(0==o?a.tjproductList[e].iscollect=!a.tjproductList[e].iscollect:a.productList[e].iscollect=!a.productList[e].iscollect),i.next=11;break;case 10:t.navigateTo({url:"/pages/user/login"});case 11:case"end":return i.stop()}}),r)})))()},toFavorite:function(t,n,e){this.addcollection(t,n,e)},getgoodlist:function(){var n=this;return r(i.default.mark((function e(){var o,a;return i.default.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return o=t.getStorageSync("userinfo"),e.next=3,n.$api.getgoodlist({action:"goodlist2",type:1,uid:o.uid});case 3:a=e.sent,n.productList=a.data.map((function(t,n){return t.checked=!1,t.shownum=0,t.miaosstyle="miaos",t})),n.checkshownum();case 6:case"end":return e.stop()}}),e)})))()},gettjgoodlist:function(){var n=this;return r(i.default.mark((function e(){var o,a;return i.default.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return o=t.getStorageSync("userinfo"),e.next=3,n.$api.getgoodlist({action:"goodlist2",type:2,uid:o.uid});case 3:a=e.sent,n.tjproductList=a.data.map((function(t,n){return t.checked=!1,t.shownum=0,t.miaosstyle="miaos",t})),n.checkshownum();case 6:case"end":return e.stop()}}),e)})))()},getbanner:function(){var t=this;return r(i.default.mark((function n(){var e;return i.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return n.next=2,t.$api.getbanner({action:"banner"});case 2:e=n.sent,t.banner=e.data;case 4:case"end":return n.stop()}}),n)})))()},getnotice:function(){var t=this;return r(i.default.mark((function n(){var e;return i.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return n.next=2,t.$api.notice({action:"notice"});case 2:e=n.sent,t.text=e.data[0].info;case 4:case"end":return n.stop()}}),n)})))()},getMore:function(n){t.showModal({title:"",content:this.text,showCancel:!1,buttonText:"确定",success:function(t){t.confirm}})},getitem:function(){var t=this;return r(i.default.mark((function n(){var e;return i.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return n.next=2,t.$api.getitem({action:"item1"});case 2:e=n.sent,t.typeList=e.data;case 4:case"end":return n.stop()}}),n)})))()},getcpdesc:function(){var t=this;return r(i.default.mark((function n(){var e;return i.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return n.next=2,t.$api.getcpdesc({action:"cpdesc"});case 2:e=n.sent,t.pcdesc=e.data;case 4:case"end":return n.stop()}}),n)})))()},toGoods:function(n){t.navigateTo({url:"../product/detail?gid="+n.id+"&price="+n.price})},toCategory:function(n){getApp().globalData.dflid=n,getApp().globalData.xflid=0,t.switchTab({url:"/pages/category/category"})},todetail:function(n){t.navigateTo({url:"/pages/advdetail/advdetail?id="+n})},changemiaosstyle:function(t){var n=this.productList[t];n.checked=!n.checked,"miaos"==n.miaosstyle?n.miaosstyle="miaosshow":n.miaosstyle="miaos",this.$set(this.productList,t,n)},sub:function(n){for(var e=t.getStorageSync("cartlist"),i=this.findidfromstor(n),o=0;o<e.length;o++)if(i.id==e[o].id){if(e[o].num--,e[o].num<=0){console.log(o,"i=="),e.splice(o,1),t.setStorageSync("cartlist",e);break}e[o].total=parseFloat(e[o].num*e[o].price*100)/100,t.setStorageSync("cartlist",e);break}this.checkshownum()},add:function(n,e){var i=t.getStorageSync("cartlist");if(""==i)this.goodsList=[],1==e?this.goodsList.push(this.findarrbyid(n)):this.goodsList.push(this.findarrbyid_tj(n)),console.log(this.goodsList,"当前商品"),this.goodsList.map((function(t,n){t.total=parseFloat(t.price*t.num*100)/100})),t.setStorageSync("cartlist",this.goodsList);else{var o=this.findidfromstor(n);if(o){for(var a=0;a<i.length;a++)if(o.id==i[a].id){if(i[a].num++,i[a].num>i[a].kcnum){t.showToast({title:"库存不足!",icon:"none"});break}i[a].total=parseFloat(i[a].num*i[a].price*100)/100,t.setStorageSync("cartlist",i);break}}else{1==e?i.push(this.findarrbyid(n)):i.push(this.findarrbyid_tj(n));for(var r=0;r<i.length;r++)n==i[r].id&&(i[r].total=parseFloat(i[r].num*i[r].price*100)/100);t.setStorageSync("cartlist",i)}}this.checkshownum()},inputchange:function(n,e,i){if(n>0){var o=t.getStorageSync("cartlist");if(n>i)return void t.showToast({title:"库存不足",icon:"none"});for(var a=0;a<o.length;a++)if(e==o[a].id){o[a].num=n,o[a].total=parseFloat(o[a].num*o[a].price*100)/100,t.setStorageSync("cartlist",o);break}this.checkshownum()}},checkshownum:function(){for(var n=t.getStorageSync("cartlist"),e=[],i=0;i<n.length;i++)e[n[i]["id"]]=n[i]["num"];for(var o=0;o<this.productList.length;o++)e[this.productList[o]["id"]]?this.$set(this.productList[o],"inputnum",e[this.productList[o]["id"]]):this.$set(this.productList[o],"inputnum",0);for(var a=0;a<this.tjproductList.length;a++)e[this.tjproductList[a]["id"]]?this.$set(this.tjproductList[a],"inputnum",e[this.tjproductList[a]["id"]]):this.$set(this.tjproductList[a],"inputnum",0)},findarrbyid:function(t){for(var n=this.productList,e=0;e<n.length;e++)if(n[e]["id"]==t)return n[e]},findarrbyid_tj:function(t){for(var n=this.tjproductList,e=0;e<n.length;e++)if(n[e]["id"]==t)return n[e]},findidfromstor:function(n){for(var e=t.getStorageSync("cartlist"),i=0;i<e.length;i++)if(e[i]["id"]==n)return e[i]},discard:function(){},mainrequst:function(){var t=this;return r(i.default.mark((function n(){var e;return i.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return n.next=2,t.$api.getitem({action:"mainrequst"});case 2:e=n.sent,t.banner=e.data[0],t.typeList=e.data[1],t.text=e.data[2][0].info,t.pcdesc=e.data[3],t.color=e.data[4].info,t.backcolor=e.data[5].info;case 9:case"end":return n.stop()}}),n)})))()},getColor:function(){var t=this;return r(i.default.mark((function n(){var e;return i.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return n.next=2,t.$api.getitem({action:"baseinfocolor"});case 2:e=n.sent,t.color=e.data[0].info,t.backcolor=e.data[1].info;case 5:case"end":return n.stop()}}),n)})))()},init:function(){this.mainrequst()}},onShow:function(){this.getgoodlist(),this.gettjgoodlist(),this.checkshownum()},onLoad:function(n){this.init(),t.showShareMenu({complete:function(){}}),console.log(this.typeList,"返回")}};n.default=d}).call(this,e("543d")["default"])},"96a1":function(t,n,e){"use strict";e.d(n,"b",(function(){return o})),e.d(n,"c",(function(){return a})),e.d(n,"a",(function(){return i}));var i={cjlIcon:function(){return e.e("components/cjl-icon/cjl-icon").then(e.bind(null,"a430"))},hypImage:function(){return e.e("components/hyp-image/hyp-image").then(e.bind(null,"3e01"))},uniNoticeBar:function(){return e.e("components/uni-notice-bar/uni-notice-bar").then(e.bind(null,"94af"))}},o=function(){var t=this,n=t.$createElement;t._self._c},a=[]},f488:function(t,n,e){},f89d:function(t,n,e){"use strict";var i=e("f488"),o=e.n(i);o.a}},[["53f9","common/runtime","common/vendor"]]]);
|