1 |
- (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["plugins/pick/pond/pond"],{"0f65":function(t,i,e){"use strict";var n;e.d(i,"b",(function(){return r})),e.d(i,"c",(function(){return s})),e.d(i,"a",(function(){return n}));var r=function(){var t=this,i=t.$createElement;t._self._c},s=[]},2361:function(t,i,e){"use strict";(function(t){e("2d0a");n(e("66fd"));var i=n(e("d000"));function n(t){return t&&t.__esModule?t:{default:t}}t(i.default)}).call(this,e("543d")["createPage"])},"5f5b":function(t,i,e){"use strict";var n=e("7611"),r=e.n(n);r.a},7611:function(t,i,e){},8926:function(t,i,e){"use strict";e.r(i);var n=e("c531"),r=e.n(n);for(var s in n)"default"!==s&&function(t){e.d(i,t,(function(){return n[t]}))}(s);i["default"]=r.a},c531:function(t,i,e){"use strict";(function(t){Object.defineProperty(i,"__esModule",{value:!0}),i.default=void 0;var n=s(e("a34a")),r=e("2f62");function s(t){return t&&t.__esModule?t:{default:t}}function a(t,i,e,n,r,s,a){try{var o=t[s](a),c=o.value}catch(u){return void e(u)}o.done?i(c):Promise.resolve(c).then(n,r)}function o(t){return function(){var i=this,e=arguments;return new Promise((function(n,r){var s=t.apply(i,e);function o(t){a(s,n,r,o,c,"next",t)}function c(t){a(s,n,r,o,c,"throw",t)}o(void 0)}))}}function c(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);i&&(n=n.filter((function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable}))),e.push.apply(e,n)}return e}function u(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{};i%2?c(Object(e),!0).forEach((function(i){d(t,i,e[i])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):c(Object(e)).forEach((function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(e,i))}))}return t}function d(t,i,e){return i in t?Object.defineProperty(t,i,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[i]=e,t}var l={name:"pond",data:function(){return{pond:[],step:1,pick_activity_id:0,pay_pond:[],all_price:0,is_active:!1,rule_num:0,edit:!1,stillNeed:0,buy_goods_list:[],all_num:0}},computed:u({},(0,r.mapGetters)("mallConfig",{getTheme:"getTheme"})),onLoad:function(t){this.$commonLoad.onload(t),this.pick_activity_id=t.pick_activity_id,this.rule_num=t.rule_num},onShow:function(){this.getCart()},methods:{changeActive:function(t){t.is_active=!t.is_active},_calcValue:function(t,i){var e=this._getDecimalScale(),n=t.num*e,r=this.step*e;"minus"===i?n-=r:"plus"===i&&(n+=r),n<1||n>t.attrs.stock||(t.num=String(n/e),this.editList())},editInput:function(){this.editList()},_getDecimalScale:function(){var t=1;return~~this.step!==this.step&&(t=Math.pow(10,(this.step+"").split(".")[1].length)),t},selectAll:function(){this.is_active=!this.is_active;for(var t=0;t<this.pond.length;t++)this.pond[t].pick_activity_id!=this.pick_activity_id||this.edit?this.edit&&(this.pond[t].is_active=this.is_active):this.pond[t].is_active=this.is_active},buy:function(){var i=[];this.buy_goods_list=[];var e={mch_id:"0",goods_list:this.buy_goods_list,pick_activity_id:this.pick_activity_id};i.push(e);for(var n=0;n<this.pay_pond.length;n++)this.buy_goods_list.push({id:this.pay_pond[n].goods_id,attr:this.pay_pond[n].attrs.attr,num:this.pay_pond[n].num,cat_id:0,cart_id:this.pay_pond[n].id,goods_attr_id:this.pay_pond[n].attrs.id});if(0===this.stillNeed&&0!==this.buy_goods_list.length){var r="/pages/order-submit/order-submit?mch_list=".concat(JSON.stringify(i),"&preview_url=").concat(encodeURIComponent(this.$api.pick.order_preview),"&submit_url=").concat(encodeURIComponent(this.$api.pick.order_submit));t.navigateTo({url:r})}},setEdit:function(t){for(var i=0;i<this.pond.length;i++)this.pond[i].is_active=!1;this.is_active=!1,this.edit=t},del:function(){var t=this;return o(n.default.mark((function i(){var e,r,s,a;return n.default.wrap((function(i){while(1)switch(i.prev=i.next){case 0:for(e=JSON.parse(JSON.stringify(t.pay_pond)),r=[],s=0;s<e.length;s++)r.push(e[s].id);return i.next=5,t.$request({url:t.$api.pick.delete,method:"post",data:{cart_id_list:JSON.stringify(r)}});case 5:a=i.sent,0===a.code&&(t.is_active=!1,t.getCart());case 7:case"end":return i.stop()}}),i)})))()},getCart:function(){var t=this;return o(n.default.mark((function i(){var e,r,s;return n.default.wrap((function(i){while(1)switch(i.prev=i.next){case 0:return i.next=2,t.$request({url:t.$api.pick.list});case 2:if(e=i.sent,0===e.code){for(r=e.data.list,s=0;s<r.length;s++)r[s].is_active=!1;t.pond=r}case 4:case"end":return i.stop()}}),i)})))()},editList:function(){var t=this;return o(n.default.mark((function i(){var e,r,s;return n.default.wrap((function(i){while(1)switch(i.prev=i.next){case 0:for(e=JSON.parse(JSON.stringify(t.pond)),r=[],s=0;s<e.length;s++)r.push({attr:e[s].attr_id,goods_id:e[s].goods_id,num:e[s].num});return i.next=5,t.$request({url:t.$api.pick.edit,method:"post",data:{list:JSON.stringify(r)}});case 5:i.sent;case 6:case"end":return i.stop()}}),i)})))()}},watch:{pond:{handler:function(t){this.pay_pond=[];var i=0,e=0;this.all_num=0;for(var n=0;n<t.length;n++)t[n].is_active&&(this.pay_pond.push(t[n]),e++,this.all_num+=Number(t[n].num),i+=t[n].num*t[n].attrs.price);e===t.length?(this.is_active=!0,0===t.length&&(this.is_active=!1)):this.is_active=!1,this.all_num%this.rule_num===0?this.stillNeed=0:this.stillNeed=this.rule_num-this.all_num%this.rule_num,this.all_price=i.toFixed(2)},deep:!0}}};i.default=l}).call(this,e("543d")["default"])},d000:function(t,i,e){"use strict";e.r(i);var n=e("0f65"),r=e("8926");for(var s in r)"default"!==s&&function(t){e.d(i,t,(function(){return r[t]}))}(s);e("5f5b");var a,o=e("f0c5"),c=Object(o["a"])(r["default"],n["b"],n["c"],!1,null,"e5c012d0",null,!1,n["a"],a);i["default"]=c.exports}},[["2361","common/runtime","common/vendor"]]]);
|