|
|
require('../common/vendor.js');(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/goods/match_pay/index","components/productWindow/index"],{"00b7":function(t,e,i){"use strict";i.d(e,"b",(function(){return r})),i.d(e,"c",(function(){return s})),i.d(e,"a",(function(){}));var r=function(){var t=this,e=t.$createElement,i=(t._self._c,t.isDelivery?t.attr.deliveryType.includes("1"):null),r=t.isDelivery?t.attr.deliveryType.includes("3")&&t.storeList.length:null,s=2==t.flag&&t.isDelivery?t.attr.deliveryType.includes("1"):null;t.$mp.data=Object.assign({},{$root:{g0:i,g1:r,g2:s}})},s=[]},"00bc":function(t,e,i){"use strict";var r=i("5f63"),s=i.n(r);s.a},"1c75":function(t,e,i){"use strict";i.r(e);var r=i("c581"),s=i("c71c");for(var n in s)["default"].indexOf(n)<0&&function(t){i.d(e,t,(function(){return s[t]}))}(n);i("00bc");var a=i("828b"),o=Object(a["a"])(s["default"],r["b"],r["c"],!1,null,null,null,!1,r["a"],void 0);e["default"]=o.exports},"2bda":function(t,e,i){"use strict";i.r(e);var r=i("3612"),s=i.n(r);for(var n in r)["default"].indexOf(n)<0&&function(t){i.d(e,t,(function(){return r[t]}))}(n);e["default"]=s.a},3612:function(t,e,i){"use strict";(function(t){var r=i("47a9");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var s=r(i("7ca3")),n=i("77d7"),a=i("ce7e"),o=i("8f59");function u(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,r)}return i}function c(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?u(Object(i),!0).forEach((function(e){(0,s.default)(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):u(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}var d=2*(t.getSystemInfoSync().windowHeight*(3/4)-238),l={computed:c(c(c({},(0,o.mapState)({nearbyStore:function(t){return t.app.nearbyStore}})),(0,o.mapGetters)(["isLogin"])),{},{selfPickup:function(){var t=this.attr.deliveryType.includes("2")&&this.selfStoreList.length;return t},deliveryType:function(){var t="";return t=this.attr.deliveryType.includes("1")&&this.selfPickup?"on2":!this.attr.deliveryType.includes("1")&&this.selfPickup||this.attr.deliveryType.includes("1")&&!this.selfPickup?"on3":"on1",t}}),components:{addressWindow:function(){Promise.all([i.e("common/vendor"),i.e("components/addressWindow/index")]).then(function(){return resolve(i("472e"))}.bind(null,i)).catch(i.oe)}},props:{isStoreBuy:{type:Number,value:0},productId:{type:Number|String,value:0},attr:{type:Object,default:function(){}},storeInfo:{type:Object,default:function(){}},limitNum:{type:Number,value:0},isShow:{type:Number,value:0},iSbnt:{type:Number,value:0},iSplus:{type:Number,value:0},iScart:{type:Number,value:0},is_vip:{type:Number,value:0},type:{type:[Number,String],default:0},fangda:{type:Boolean,default:!0},isExtends:{type:Boolean,default:!1},storeId:{type:Number|String,value:0}},data:function(){return{flag:1,nameInfo:"",addressInfo:"",deliveryName:"",distance:"",deliveryAddress:"",address:{address:!1},pagesUrl:"",user_latitude:0,user_longitude:0,isDelivery:!1,storeList:[],deliveryStoreList:[],selfStoreList:[],active:0,isStore:!1,windowHeight:d,isAddress:!1}},watch:{"attr.deliveryType":function(t,e){if(JSON.stringify(t)!=JSON.stringify(e)&&t.length){this.active<1&&this.getList();var i=1;i=1==t[0]&&this.isStoreBuy?t[1]:t[0],this.flag=i,this.$emit("deliveryFun",i)}},storeId:function(){this.defaultStore(),this.$emit("onstoreId",this.storeList[this.active],this.flag)}},mounted:function(){var e=this;try{this.user_latitude=t.getStorageSync("user_latitude"),this.user_longitude=t.getStorageSync("user_longitude")}catch(i){}t.$off("activeAddress"),t.$on("activeAddress",(function(t){e.getAddressDefault()}))},methods:{closeStore:function(){this.isStore=!1},openStore:function(){1!=this.attr.isType&&(this.isStore=!0)},tapStore:function(t,e){this.active=t,this.deliveryName=e.name,this.deliveryAddress=e.detailed_address+" ",this.distance="距您"+e.range+"km",this.isStore=!1,this.$emit("onstoreId",e,this.flag)},OnChangeAddress:function(t,e){this.address.address=!1,this.nameInfo=e.real_name+" "+e.phone,this.addressInfo=e.province+"省"+e.city+e.district+e.street+e.detail,this.$emit("onAddressId",e)},openAddress:function(){var e="/pages/users/user_address/index?fromType=1";this.isAddress?t.navigateTo({url:e}):(this.$refs.addressWindow.getAddressList(),this.address.address=!0,this.pagesUrl=e)},changeClose:function(){this.$set(this.address,"address",!1)},getAddressDefault:function(){var t=this;(0,n.getAddressDefault)().then((function(e){var i=e.data;t.isAddress=Array.isArray(i),Array.isArray(i)?t.addressInfo="点击添加地址":(t.nameInfo=i.real_name+" "+i.phone,t.addressInfo=i.province+"省"+i.city+i.district+i.street+i.detail,t.$emit("onAddressId",i))})).catch((function(e){t.$util.Tips({title:e})}))},selfLocation:function(){var e=this,i=this;t.getLocation({type:"wgs84",success:function(r){try{e.user_latitude=r.latitude,e.user_longitude=r.longitude,t.setStorageSync("user_latitude",r.latitude),t.setStorageSync("user_longitude",r.longitude)}catch(s){}i.getList()},fail:function(e){t.getSetting({success:function(e){"undefined"==typeof e.authSetting["scope.userLocation"]||e.authSetting["scope.userLocation"]||t.setStorageSync("refuseLocation",!0)}})}})},getList:function(t){var e=this,i={latitude:this.user_latitude||"",longitude:this.user_longitude||"",page:1,limit:100,product_id:this.productId,is_store:"",type:1==this.type?1:0};(0,a.storeListApi)(i).then((function(i){var r=i.data.list.list;t||!r.length||!e.attr||-1==e.attr.deliveryType.indexOf("2")&&-1==e.attr.deliveryType.indexOf("3")||(e.isDelivery=!0,e.$store.getters.isLogin&&e.getAddressDefault());var s=[];r.forEach((function(t,e){1===t.is_store&&s.push(t)})),e.storeList=2==e.flag?s:r,e.selfStoreList=s,e.deliveryStoreList=r,e.defaultStore(),e.$emit("onstoreId",e.storeList[e.active],e.flag)})).catch((function(t){e.$util.Tips({title:t})}))},defaultStore:function(){var t=this.storeId?this.storeId:this.nearbyStore,e=0;this.storeList.forEach((function(i,r){i.id==t&&(e=r)})),this.active=e,this.deliveryName=this.storeList[e].name,this.deliveryAddress=this.storeList[e].detailed_address+" ",this.distance="距您"+this.storeList[e].range+"km"},getstoreInfo:function(e){if(1==e&&this.isStoreBuy)return!1;"2"!==e&&"3"!==e||this.user_latitude&&this.user_longitude||t.getStorageSync("refuseLocation")||this.selfLocation(),"2"===e&&(this.storeList=this.selfStoreList),"3"===e&&(this.storeList=this.deliveryStoreList),this.flag=e,this.defaultStore(),this.$emit("deliveryFun",e),this.$emit("onstoreId",this.storeList[this.active],e)},showLocation:function(){this.user_latitude&&this.user_longitude||t.getStorageSync("refuseLocation")||this.selfLocation()},moveHandle:function(){},goCat:function(){this.$emit("goCat")},bindCode:function(t){this.$emit("iptCartNum",this.attr.productSelect.cart_num)},closeAttr:function(){this.$emit("myevent")},CartNumDes:function(){this.$emit("ChangeCartNum",!1)},CartNumAdd:function(){this.$emit("ChangeCartNum",!0)},tapAttr:function(t,e){this.$emit("attrVal",{indexw:t,indexn:e}),this.$set(this.attr.productAttr[t],"index",this.attr.productAttr[t].attr_values[e]);var i=this.getCheckedValue().join(",");this.$emit("ChangeAttr",i)},getCheckedValue:function(){for(var t=this.attr.productAttr,e=[],i=0;i<t.length;i++)for(var r=0;r<t[i].attr_values.length;r++)t[i].index===t[i].attr_values[r]&&e.push(t[i].attr_values[r]);return e},showImg:function(){this.$emit("getImg")},cartConfirm:function(){this.$emit("onConfirm")}}};e.default=l}).call(this,i("df3c")["default"])},"3ffb":function(t,e,i){"use strict";i.r(e);var r=i("00b7"),s=i("2bda");for(var n in s)["default"].indexOf(n)<0&&function(t){i.d(e,t,(function(){return s[t]}))}(n);i("9d6e");var a=i("828b"),o=Object(a["a"])(s["default"],r["b"],r["c"],!1,null,"9cb82a4a",null,!1,r["a"],void 0);e["default"]=o.exports},"466b":function(t,e,i){"use strict";(function(t,e){var r=i("47a9");i("7561");r(i("3240"));var s=r(i("1c75"));t.__webpack_require_UNI_MP_PLUGIN__=i,e(s.default)}).call(this,i("3223")["default"],i("df3c")["createPage"])},"5f63":function(t,e,i){},"9d6e":function(t,e,i){"use strict";var r=i("d5a4"),s=i.n(r);s.a},c581:function(t,e,i){"use strict";i.d(e,"b",(function(){return r})),i.d(e,"c",(function(){return s})),i.d(e,"a",(function(){}));var r=function(){var t=this.$createElement;this._self._c},s=[]},c71c:function(t,e,i){"use strict";i.r(e);var r=i("e28c"),s=i.n(r);for(var n in r)["default"].indexOf(n)<0&&function(t){i.d(e,t,(function(){return r[t]}))}(n);e["default"]=s.a},d5a4:function(t,e,i){},e28c:function(t,e,i){"use strict";(function(t){var r=i("47a9");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var s=i("ce7e"),n=r(i("cef6")),a=(r(i("3ffb")),t.getSystemInfoSync().statusBarHeight),o={data:function(){return{statusBarHeight:a,id:0,params:{page:1,limit:10},discountsData:[],selectValue:[],selectAttr:[],loading:!1,attr:{cartAttr:!1,productAttr:[],productSelect:{}},productValue:[],index:0,indexn:0,visible:!1}},components:{baseDrawer:function(){i.e("components/tui-drawer/tui-drawer").then(function(){return resolve(i("01c9"))}.bind(null,i)).catch(i.oe)}},mixins:[n.default],onLoad:function(t){this.id=t.id?t.id:0,this.getList()},methods:{getList:function(){var e=this;this.loading||(this.loading=!0,(0,s.matchPayListApi)(this.id,this.params).then((function(i){if(e.loading=!1,!i.data.length)return t.navigateBack({delta:1});i.data.map((function(t,i){e.$set(t,"totalPrice",0),t.products.map((function(i,r){var s=e.DefaultSelect(i);Object.assign(i,s),t.type?(e.$set(i,"select",0==r),e.$set(t,"totalPrice",Number(t.products[0].price))):(e.$set(i,"select",!0),t.totalPrice+=Number(i.price))}))})),e.discountsData=e.discountsData.concat(i.data),e.params.page=e.params.page+1})).catch((function(t){e.$util.Tips({title:t})})))},backPage:function(){t.navigateBack()},checkPro:function(t,e,i){if(!i.type)return this.$util.Tips({title:"本套餐为固定套餐,不可更改"});if(i.type&&0==e)return this.$util.Tips({title:"套餐主商品不可取消"});if(t.select=!t.select,t.select)i.totalPrice=(Number(i.totalPrice)+Number(t.price)).toFixed(2);else{i.totalPrice=(Number(i.totalPrice)-Number(t.price)).toFixed(2);this.selectValue.findIndex((function(e){return e==t.id}))}},tapAttr:function(t,e){var i=this;this.$set(this.attr.productAttr[t],"index",this.attr.productAttr[t].attr_values[e]);var r=this.getCheckedValue().join(","),s={price:this.productValue[r].price,unique:this.productValue[r].unique||"",suk:this.productValue[r].suk||"默认"};this.attr.productSelect={price:this.productValue[r].price,image:this.productValue[r].image,stock:this.productValue[r].stock},this.$nextTick((function(){Object.assign(i.discountsData[i.index].products[i.indexn],s);for(var t=0,e=0;e<i.discountsData[i.index].products.length;e++)t+=parseFloat(i.discountsData[i.index].products[e].price);i.$set(i.discountsData[i.index],"totalPrice",t)}))},getCheckedValue:function(){for(var t=this.attr.productAttr,e=[],i=0;i<t.length;i++)for(var r=0;r<t[i].attr_values.length;r++)t[i].index===t[i].attr_values[r]&&e.push(t[i].attr_values[r]);return e},DefaultSelect:function(t){t.productAttr;var e=[],i=[];for(var r in t.productValue)i.push(t.productValue[r].price);var s=Math.min.apply(null,i);for(var r in t.productValue)if(t.productValue[r].product_stock>0&&t.productValue[r].price==s){e=t.productAttr.length?r.split(","):[];break}for(var n=0;n<t.productAttr.length;n++)this.$set(t.productAttr[n],"index",e[n]);var a=t.productValue[e.join(",")],o={price:a.price,unique:a.unique||"",suk:a.suk||"默认",stock:a.stock};return o},closeDrawer:function(){this.visible=!1},selecAttr:function(t,e,i){this.index=e,this.indexn=i,this.productValue=t.productValue,this.attr={productAttr:t.productAttr,productSelect:{price:t.price,image:t.image,stock:t.stock}},this.visible=!0},subData:function(e){var i=this,r={new:1,discountId:e.id,discountInfos:[]},n=0;if(e.products.forEach((function(t,e){t.select&&(n++,r.discountInfos.push({id:t.id,unique:t.unique,product_id:t.product_id}))})),n<2)return this.$util.Tips({title:"请先选择套餐商品"});(0,s.postCartAdd)(r).then((function(e){t.navigateTo({url:"/pages/goods/order_confirm/index?new=1&noCoupon=1&cartId="+e.data.cartId.join(",")})})).catch((function(t){return i.$util.Tips({title:t})}))}}};e.default=o}).call(this,i("df3c")["default"])}},[["466b","common/runtime","common/vendor"]]]); |