order.js 12 KB

1
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["plugins/advance/order/order"],{"1c57":function(t,e,r){},6147:function(t,e,r){"use strict";var a,n=function(){var t=this,e=t.$createElement,r=(t._self._c,t.__map(t.order_list,(function(e,r){var a=t.set_time(e.pay_limit,e.end_prepayment_at);return{$orig:t.__get_orig(e),m0:a}})));t._isMounted||(t.e0=function(e){t.active=!0},t.e1=function(e){e.stopPropagation(),t.active=!1}),t.$mp.data=Object.assign({},{$root:{l0:r}})},i=[];r.d(e,"b",(function(){return n})),r.d(e,"c",(function(){return i})),r.d(e,"a",(function(){return a}))},"9c9a":function(t,e,r){"use strict";(function(t){r("8748");a(r("66fd"));var e=a(r("ebb5"));function a(t){return t&&t.__esModule?t:{default:t}}t(e.default)}).call(this,r("543d")["createPage"])},cfaf:function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var a=n(r("4795"));function n(t){return t&&t.__esModule?t:{default:t}}function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,a)}return r}function o(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach((function(e){s(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function s(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function c(t){return _(t)||u(t)||l(t)||d()}function d(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(t,e){if(t){if("string"===typeof t)return h(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?h(t,e):void 0}}function u(t){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}function _(t){if(Array.isArray(t))return h(t)}function h(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,a=new Array(e);r<e;r++)a[r]=t[r];return a}function f(t,e,r,a,n,i,o){try{var s=t[i](o),c=s.value}catch(d){return void r(d)}s.done?e(c):Promise.resolve(c).then(a,n)}function g(t){return function(){var e=this,r=arguments;return new Promise((function(a,n){var i=t.apply(e,r);function o(t){f(i,a,n,o,s,"next",t)}function s(t){f(i,a,n,o,s,"throw",t)}o(void 0)}))}}var p={name:"order",data:function(){return{active:!1,active_item:"全部预定",select_list:[{id:-1,active:!0,text:"全部预定"},{id:1,active:!1,text:"定金待支付"},{id:2,active:!1,text:"尾款支付未开始"},{id:3,active:!1,text:"尾款待支付"},{id:4,active:!1,text:"购买成功"},{id:5,active:!1,text:"购买失败"}],order_list:[],page:1,keyword:-1,over:!1,interval:null,search:!1,search_text:"",oldOrder:[],template_message:[]}},onShow:function(){var t=this;this.order_list=[],this.page=1,this.request(this.keyword).then((function(){t.get_time()}))},onHide:function(){clearInterval(this.interval)},onUnload:function(){clearInterval(this.interval)},methods:{empyt_search:function(){this.search=!1,this.search_text="",this.set_active({id:-1}),this.active_item="全部预定"},set_active:function(t){var e=this;clearInterval(this.interval),this.order_list=[],this.keyword=t.id,this.over=!1,this.page=1,this.request().then((function(){1!==t.id&&-1!==t.id&&3!==t.id||e.get_time()}));for(var r=0;r<this.select_list.length;r++)this.select_list[r].id===t.id?this.select_list[r].active=!0:this.select_list[r].active=!1;this.active=!1,this.active_item=t.text},route_go:function(e){4==e.status_num&&t.navigateTo({url:"/pages/order/order-detail/order-detail?id=".concat(e.order_id,"&sign=advance")})},payFinalPayment:function(t){var e=[{mch_id:t.goods.mch_id,goods_list:[{id:t.goods_id,attr:JSON.parse(t.goods_info).attr_list,num:t.goods_num,cat_id:0,goods_attr_id:t.goodsAttr.id,advance_id:t.id}]}];this.$jump({open_type:"navigate",url:"/pages/order-submit/order-submit?mch_list=".concat(JSON.stringify(e),"&preview_url=").concat(encodeURIComponent(this.$api.advance.order_preview),"&submit_url=").concat(encodeURIComponent(this.$api.advance.order_sub),"&order_page_url=/plugins/advance/order/order&plugin=advance&total_title=尾款")})},payPayment:function(t,e){var r=this;this.$request({url:this.$api.order.list_pay_data,data:{id:t.order_id},method:"get"}).then((function(t){0===t.code&&r.$payment.pay(t.data.id).then((function(){-1===r.keyword?r.order_list[e].status_num="4":r.$delete(r.order_list,e)})).catch((function(){}))}))},payDeposit:function(t,e){var r=this;this.$subscribe(this.template_message).then((function(){r.submit(t,e)})).catch((function(){r.submit(t,e)}))},submit:function(e,r){var a=this,n={id:e.id,goods_id:e.goods_id,goods_num:e.goods_num,goods_attr_id:e.goodsAttr.id};this.get_submit(n).then((function(n){a.$payment.pay(n.data.id).then((function(n){a.$request({url:a.$api.advance.order,method:"get",data:{id:e.id}}).then((function(e){if(0===e.code){a.$set(a.order_list,r,e.data.list[0]);for(var i="",o=JSON.parse(a.order_list[r].goods_info),s=0;s<o.attr_list.length;s++)i+=" ".concat(o.attr_list[s].attr_group_name,":").concat(o.attr_list[s].attr_name);a.$set(a.order_list[r],"attr_name",i)}else 1===e.code&&t.showModal({title:"提示",content:n.msg,success:function(e){e.cancel?t.navigateBack():e.confirm&&t.navigateBack()}})}))})).catch((function(){}))}))},addDate:function(t,e){void 0!=e&&""!=e||(e=1);var r=new Date(t.replace(/-/g,"/"));r.setDate(r.getDate()+e);var a=r.getMonth()+1,n=r.getDate(),i="'"+a+"'",o="'"+n+"'";3==i.length&&(a="0"+a),3==o.length&&(n="0"+n);var s=r.getHours(),c=r.getMinutes(),d=r.getSeconds();return 0===d?(d=59,0===c?(c=59,0===s?(s=23,n="0"+Number(n)-1):s-=1):c-=1):d-=1,d="".concat(d),c="".concat(c),s="".concat(s),1===s.length&&(s="0".concat(s)),1===c.length&&(c="0".concat(c)),1===d.length&&(d="0".concat(d)),r.getFullYear()+"."+a+"."+n+" "+s+":"+c+":"+d},getDate:function(t){var e=new Date(t.replace(/-/g,"/"));e.setDate(e.getDate());var r=e.getMonth()+1,a=e.getDate(),n="'"+r+"'",i="'"+a+"'";3==n.length&&(r="0"+r),3==i.length&&(a="0"+a);var o=e.getHours(),s=e.getMinutes(),c=e.getSeconds();return c="".concat(c),s="".concat(s),o="".concat(o),1===o.length&&(o="0".concat(o)),1===s.length&&(s="0".concat(s)),1===c.length&&(c="0".concat(c)),e.getFullYear()+"."+r+"."+a+" "+o+":"+s+":"+c},request:function(){var e=this;return g(a.default.mark((function r(){var n,i,o,s,d;return a.default.wrap((function(r){while(1)switch(r.prev=r.next){case 0:return t.showLoading({title:"加载中"}),r.prev=1,r.next=4,e.$request({url:e.$api.advance.order,method:"get",data:{keyword:e.keyword,page:e.page,name:e.search_text}});case 4:if(n=r.sent,t.hideLoading(),0===n.code)for(e.order_list=[].concat(c(e.order_list),c(n.data.list)),e.template_message=n.data.template_message,i=0;i<e.order_list.length;i++){for(o="",s=JSON.parse(e.order_list[i].goods_info),d=0;d<s.attr_list.length;d++)o+=" ".concat(s.attr_list[d].attr_group_name,":").concat(s.attr_list[d].attr_name);e.$set(e.order_list[i],"attr_name",o)}r.next=13;break;case 9:r.prev=9,r.t0=r["catch"](1),t.hideLoading(),t.navigateTo({url:"/plugins/advance/index/index"});case 13:case"end":return r.stop()}}),r,null,[[1,9]])})))()},set_time:function(t,e){return-1==t?"".concat(this.getDate(e)," ~ 无期限"):"".concat(this.getDate(e)," ~ ").concat(this.addDate(e,Number(t)))},get_submit:function(e){var r=this;return g(a.default.mark((function n(){var i;return a.default.wrap((function(a){while(1)switch(a.prev=a.next){case 0:return a.next=2,r.$request({url:r.$api.advance.order_submit,method:"post",data:o({},e)});case 2:if(i=a.sent,0!==i.code){a.next=7;break}return a.abrupt("return",i);case 7:1===i.code&&t.showModal({title:"提示",content:i.msg,success:function(e){e.cancel?t.navigateBack():e.confirm&&t.navigateBack()}});case 8:case"end":return a.stop()}}),n)})))()},get_time:function(){var t=this;clearInterval(this.interval);for(var e=(new Date).getTime(),r=0;r<this.order_list.length;r++)if(1==this.order_list[r].status_num){var a=new Date(this.order_list[r].end_prepayment_at.replace(/-/g,"/")).getTime(),n=a-e;if(n>0){var i=parseInt(n/1e3/60/60/24%30),o=parseInt(n/1e3/60/60%24),s=parseInt(n/1e3/60%60),c=parseInt(n/1e3%60);i>0?this.$set(this.order_list[r],"html",i+"天"+o+":"+(s<10?"0"+s:s)+":"+(c<10?"0"+c:c)):this.$set(this.order_list[r],"html",o+":"+(s<10?"0"+s:s)+":"+(c<10?"0"+c:c))}}else if(3==this.order_list[r].status_num)if(-1==this.order_list[r].pay_limit)this.$set(this.order_list[r],"html","不显示");else{var d=new Date(this.order_list[r].end_prepayment_at.replace(/-/g,"/")),l=d.setDate(d.getDate()+Number(this.order_list[r].pay_limit)),u=new Date(l).getTime()-e;if(u>0){var _=parseInt(u/1e3/60/60/24%30),h=parseInt(u/1e3/60/60%24),f=parseInt(u/1e3/60%60),g=parseInt(u/1e3%60);_>0?this.$set(this.order_list[r],"html",_+"天"+h+":"+(f<10?"0"+f:f)+":"+(g<10?"0"+g:g)):this.$set(this.order_list[r],"html",h+":"+(f<10?"0"+f:f)+":"+(g<10?"0"+g:g))}}this.interval=setInterval((function(){var e=(new Date).getTime();0===t.order_list.length&&clearInterval(t.interval);for(var r=0;r<t.order_list.length;r++)if(1==t.order_list[r].status_num){var a=new Date(t.order_list[r].end_prepayment_at.replace(/-/g,"/")).getTime(),n=a-e;if(n>0){var i=parseInt(n/1e3/60/60/24%30),o=parseInt(n/1e3/60/60%24),s=parseInt(n/1e3/60%60),c=parseInt(n/1e3%60);i>0?t.$set(t.order_list[r],"html",i+"天"+o+":"+(s<10?"0"+s:s)+":"+(c<10?"0"+c:c)):t.$set(t.order_list[r],"html",o+":"+(s<10?"0"+s:s)+":"+(c<10?"0"+c:c))}}else if(3==t.order_list[r].status_num)if(-1==t.order_list[r].pay_limit)t.$set(t.order_list[r],"html","不显示");else{var d=new Date(t.order_list[r].end_prepayment_at.replace(/-/g,"/")),l=d.setDate(d.getDate()+Number(t.order_list[r].pay_limit)),u=new Date(l).getTime()-e;if(u>0){var _=parseInt(u/1e3/60/60/24%30),h=parseInt(u/1e3/60/60%24),f=parseInt(u/1e3/60%60),g=parseInt(u/1e3%60);_>0?t.$set(t.order_list[r],"html",_+"天"+h+":"+(f<10?"0"+f:f)+":"+(g<10?"0"+g:g)):t.$set(t.order_list[r],"html",h+":"+(f<10?"0"+f:f)+":"+(g<10?"0"+g:g))}}}),1e3)},set_search:function(){var e=this;return g(a.default.mark((function r(){var n,i,o,s,c;return a.default.wrap((function(r){while(1)switch(r.prev=r.next){case 0:return e.page=1,e.keyword=-1,t.showLoading({title:"加载中"}),r.next=5,e.$request({url:e.$api.advance.order,method:"get",data:{keyword:e.keyword,page:e.page,name:e.search_text}});case 5:if(n=r.sent,0===n.code)for(e.order_list=n.data.list,i=0;i<e.order_list.length;i++){for(o="",s=JSON.parse(e.order_list[i].goods_info),c=0;c<s.attr_list.length;c++)o+=" ".concat(s.attr_list[c].attr_group_name,":").concat(s.attr_list[c].attr_name);e.$set(e.order_list[i],"attr_name",o)}t.hideLoading(),e.get_time();case 9:case"end":return r.stop()}}),r)})))()},blur_request:function(){},go_search:function(){this.search=!0,this.active=!1,this.oldOrder=this.order_list,this.order_list=[]}},onReachBottom:function(){var t=this;this.over||(this.page+=1,this.$request({url:this.$api.advance.order,method:"get",data:{keyword:this.keyword,page:this.page,name:this.search_text}}).then((function(e){if(0===e.code)if(e.data.list.length>0){t.order_list=[].concat(c(t.order_list),c(e.data.list));for(var r=0;r<t.order_list.length;r++){for(var a="",n=JSON.parse(t.order_list[r].goods_info),i=0;i<n.attr_list.length;i++)a+=" ".concat(n.attr_list[i].attr_group_name,":").concat(n.attr_list[i].attr_name);t.$set(t.order_list[r],"attr_name",a)}t.get_time()}else t.over=!0})))}};e.default=p}).call(this,r("543d")["default"])},e02c:function(t,e,r){"use strict";r.r(e);var a=r("cfaf"),n=r.n(a);for(var i in a)"default"!==i&&function(t){r.d(e,t,(function(){return a[t]}))}(i);e["default"]=n.a},ebb5:function(t,e,r){"use strict";r.r(e);var a=r("6147"),n=r("e02c");for(var i in n)"default"!==i&&function(t){r.d(e,t,(function(){return n[t]}))}(i);r("f976");var o,s=r("f0c5"),c=Object(s["a"])(n["default"],a["b"],a["c"],!1,null,"423fbdd2",null,!1,a["a"],o);e["default"]=c.exports},f976:function(t,e,r){"use strict";var a=r("1c57"),n=r.n(a);n.a}},[["9c9a","common/runtime","common/vendor"]]]);