shop.js 7.6 KB

1
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/index/shop"],{"07c4":function(t,e,s){"use strict";(function(t){s("0bef"),s("921b");o(s("66fd"));var e=o(s("dafc"));function o(t){return t&&t.__esModule?t:{default:t}}t(e.default)}).call(this,s("543d")["createPage"])},6784:function(t,e,s){"use strict";var o,i=function(){var t=this,e=t.$createElement;t._self._c},n=[];s.d(e,"b",(function(){return i})),s.d(e,"c",(function(){return n})),s.d(e,"a",(function(){return o}))},ae95:function(t,e,s){},bd83:function(t,e,s){"use strict";s.r(e);var o=s("f669"),i=s.n(o);for(var n in o)"default"!==n&&function(t){s.d(e,t,(function(){return o[t]}))}(n);e["default"]=i.a},c382:function(t,e,s){"use strict";var o=s("ae95"),i=s.n(o);i.a},dafc:function(t,e,s){"use strict";s.r(e);var o=s("6784"),i=s("bd83");for(var n in i)"default"!==n&&function(t){s.d(e,t,(function(){return i[t]}))}(n);s("c382");var a,c=s("f0c5"),r=Object(c["a"])(i["default"],o["b"],o["c"],!1,null,null,null,!1,o["a"],a);e["default"]=r.exports},f669:function(t,e,s){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var o=n(s("a34a")),i=s("2f62");function n(t){return t&&t.__esModule?t:{default:t}}function a(t,e,s,o,i,n,a){try{var c=t[n](a),r=c.value}catch(l){return void s(l)}c.done?e(r):Promise.resolve(r).then(o,i)}function c(t){return function(){var e=this,s=arguments;return new Promise((function(o,i){var n=t.apply(e,s);function c(t){a(n,o,i,c,r,"next",t)}function r(t){a(n,o,i,c,r,"throw",t)}c(void 0)}))}}function r(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),s.push.apply(s,o)}return s}function l(t){for(var e=1;e<arguments.length;e++){var s=null!=arguments[e]?arguments[e]:{};e%2?r(Object(s),!0).forEach((function(e){d(t,e,s[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):r(Object(s)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(s,e))}))}return t}function d(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}var u=function(){s.e("component/loginDialog").then(function(){return resolve(s("3478"))}.bind(null,s)).catch(s.oe)},h=function(){s.e("component/uinNumber").then(function(){return resolve(s("31a6"))}.bind(null,s)).catch(s.oe)},f=function(){s.e("component/assess").then(function(){return resolve(s("553f"))}.bind(null,s)).catch(s.oe)},g=function(){s.e("component/uni-icon/uni-icon").then(function(){return resolve(s("d4ee"))}.bind(null,s)).catch(s.oe)},p={components:{uniIcon:g,assess:f,uninumberbox:h,logionDialog:u},data:function(){return{arrayId:[],scopemapId:0,showdialog:!1,has_collected:!1,cartnumber:0,changnumber:100,ismax:!1,goods_storage:"",nuberImg:"",shopnumber:1,pictureUrl:this.pictureUrl,datalist:{},store_id:0,goodId:0,goods_id:0,windowHeight:0,iScrolltop:1,active:0,scrollTop:0,old:{scrollTop:0},specClass:"none",specSelected:[],favorite:!0,shareList:[],imgList:[],desc:"\n \t\t\t\t\t\n \t\t\t\t",specList:[]}},onLaunch:function(){this.active=1},computed:l({},(0,i.mapState)(["hasLogin","userInfo"])),onShow:function(){var e=this;t.getSystemInfo({success:function(t){e.windowHeight=t.screenHeight}})},onLoad:function(){var t=c(o.default.mark((function t(e){return o.default.wrap((function(t){while(1)switch(t.prev=t.next){case 0:this.goodId=e.id,this.store_id=e.store_id,this.getshopdetail();case 3:case"end":return t.stop()}}),t,this)})));function e(e){return t.apply(this,arguments)}return e}(),methods:{goIndex:function(){t.switchTab({url:"./index"})},changestorage:function(t){this.shopnumber=t},getshopdetail:function(){var t=this,e={};e.goods_commonid=this.goodId,e.store_id=this.store_id,this.request({url:"/v2/goods/detail",method:"POST",data:e,success:function(e){var s=e.data.data;t.cartnumber=s.cart,t.has_collected=s.has_collected;var o=s;0==o.spec_list.length?(t.datalist=s,t.goods_id=s.goods_list[0].goods_id,t.goods_storage=s.goods_storage):(o.spec_list[0].value_list.forEach((function(t,e){t.goods_storage=s.goods_list[e].goods_storage})),t.datalist=o)}})},shopDetail:function(){var e=this.goodId,s=this.store_id;t.navigateTo({url:"/pages/index/commemt?goodId=".concat(e,"&store_id=").concat(s)})},onChange:function(t){this.active=t.detail.name,console.log(this.active)},toggleSpec:function(){this.specClass="show"},cancelDiaolog:function(){this.showdialog=!1},confirmDiaolog:function(){this.showdialog=!1,t.navigateTo({url:"../myCenter/information"})},openCar:function(){if(this.hasLogin){var e=this.store_id;t.navigateTo({url:"/pages/index/cart?store_id=".concat(e)})}else this.showdialog=!0},buynow:function(){var e=this;if(this.hasLogin){if(1==this.datalist.store_id||1!=this.datalist.goods_state||this.datalist.goods_storage<1)return void this.$msg("商品已下架");if(0==this.specSelected.length&&0!=this.datalist.spec_list.length)return this.$msg("请选择规格数量"),void(this.specClass="show");if(0==this.specSelected.length&&0==this.datalist.spec_list.length)return this.specClass="show",void(this.specSelected=this.datalist.goods_list);console.log(this.datalist);var s=[];s.push({}),s[0].goods_id=this.goods_id,s[0].buy_num=this.shopnumber;var o=this.datalist.goods_price*this.shopnumber;this.request({url:"/v1/order/save_og",method:"post",data:{store_id:this.store_id,goods:JSON.stringify(s)},success:function(s){console.log(s);var i=e.store_id,n=s.data.data.order_id;t.navigateTo({url:"/pages/index/sureBuy?store=".concat(i,"&prices=").concat(o,"&order_id=").concat(n)})}})}else this.showdialog=!0},addCar:function(){var t=this;if(this.hasLogin){if(1==this.datalist.store_id||1!=this.datalist.goods_state||this.datalist.goods_storage<1)return void this.$msg("商品已下架");if(0==this.specSelected.length&&0==this.datalist.spec_list.length)return this.specClass="show",void(this.specSelected=this.datalist.goods_list);if(0==this.specSelected.length&&0!=this.datalist.spec_list.length)return this.specClass="show",void this.$msg("请选择规格数量");this.request({url:"/v2/order/add_cart",method:"POST",data:{goods_id:this.goods_id,goods_num:this.shopnumber},success:function(){t.$msg("商品添加成功"),t.specClass="none",t.getshopdetail()}})}else this.showdialog=!0},closeCar:function(){this.specClass="none"},selectSpec:function(t,e,s,o){var i=this;if(this.specSelected=[],0!=o){this.datalist.spec_list[t].value_list;this.datalist.spec_list[t].value_list.forEach((function(t){t.value_id===e?i.$set(t,"selected",!0):i.$set(t,"selected",!1)}));for(var n=[],a=0;a<this.datalist.spec_list.length;a++)for(var c=0;c<this.datalist.spec_list[a].value_list.length;c++)this.datalist.spec_list[a].value_list[c].selected&&n.push(this.datalist.spec_list[a].value_list[c].value_id);if(this.arrayId=n,this.arrayId.length==this.datalist.spec_list.length){this.scopemapId=n.join("_");var r=this.datalist.spec_map[this.scopemapId],l=this.datalist.goods_list[r];l.value_name=s,this.nuberImg=l.spec_img,this.specSelected.push(l),this.goods_storage=l.goods_storage,this.goods_id=l.goods_id}}},upper:function(t){console.log(t),console.log("顶部")},lower:function(t){console.log("底部")},scroll:function(t){this.old.scrollTop=t.detail.scrollTop,t.detail.scrollTop>this.windowHeight?this.iScrolltop=2:this.iScrolltop=1},toFavorite:function(){var t=this;this.hasLogin?this.request({url:"/v1/favorites/collect",method:"post",data:{type:"goods",fav_id:this.goodId},success:function(){t.getshopdetail()}}):this.showdialog=!0},buy:function(){t.navigateTo({url:"./sureBuy"})},stopPrevent:function(){}}};e.default=p}).call(this,s("543d")["default"])}},[["07c4","common/runtime","common/vendor"]]]);