!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="147e7786-67c9-48e6-96df-bde028aaffb8",e._sentryDebugIdIdentifier="sentry-dbid-147e7786-67c9-48e6-96df-bde028aaffb8")}catch(e){}}();var _global="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};_global.SENTRY_RELEASE={id:"2b2354c41f21fdc720e088172a22a7ca883e542d"},(window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-93dbbefc"],{"116e":function(e,t,n){"use strict";var a=n("a6c7");n.n(a).a},"2eb9":function(e,t){e.exports=function(e){e.options.__i18n=e.options.__i18n||[],e.options.__i18n.push('{"en":{"cancel_order":{"reason_1":"Selected wrong pick-up address","reason_2":"Selected wrong delivery address","reason_3":"Forget to enter promocode","reason_4":"Incorrect COD","reason_5":"Incorrect recipient\'s info","reason_6":"Long waiting time for driver to accept","reason_7":"Long waiting time for driver to arrive","reason_8":"Driver is too far from pick-up location","reason_9":"Driver asks for cancellation","reason_10":"Unavailabe Package(s)","reason_11":"Cannot contact driver","reason_12":"Think again on price and fees","reason_13":"Others","input_reason":"Input reason","input_message":"Enter at least 6 characters","warning":"User with high cancellation rate will get low priority when booking","cancel":"Cancel","cancel_button":"Submit","confirm_title":"Opps, You\'ve cancelled order too many times","overcancel_request":"cancels today","keep":"Stay","cancel_title":"Do you want to cancel this order?","back":"Back","request_input_reason":"Please choose cancellation reason to confirm this process","require_message":"Please select cancellation reason!","require_other_comment":"Please input your reason!","invalid_status":"Cannot cancel order (Order not in valid status)!","status_change":"Order status is changed, please double-check before you continue!","select_reason_cancel":"Select a reason","select_reason_cancel_des":"Let us know what happened. Your response will help us improve our service next time.","action_note":"Would you like to keep this order details and","action_note_link":"find another driver?","order_note":{"note":"Nhập lí do hủy đơn của bạn."},"continue_wait":"Continue wait","continue_delivery":"Continue delivery","confirm_cancel":"Confirm cancel","confirm_cancel_title":{"finding_driver":"Bạn muốn hủy đơn hàng này?","found_driver":"Tài xế đang đến điểm lấy hàng!"},"confirm_cancel_desc":{"finding_driver":"Bạn chờ thêm chút nhé, chúng tôi đang nỗ lực tìm kiếm tài xế cho bạn","found_driver":"Nếu hủy đơn, bạn sẽ mất nhiều thời gian hơn để tìm tài xế cho những đơn hàng sau."}}},"vi":{"cancel_order":{"reason_1":"Chọn sai điểm lấy hàng","reason_2":"Chọn sai điểm giao hàng","reason_3":"Quên nhập mã khuyến mãi","reason_4":"Nhập sai COD","reason_5":"Sai thông tin người nhận","reason_6":"Chờ tài xế nhận đơn lâu","reason_7":"Chờ tài xế đến lấy hàng lâu","reason_8":"Tài xế ở quá xa vị trí lấy hàng","reason_9":"Tài xế yêu cầu huỷ","reason_10":"Không có hàng","reason_11":"Không thể liên lạc tài xế","reason_12":"Đổi ý vì giá và cước phí","reason_13":"Khác","input_reason":"Nhập lý do","input_message":"Vui lòng nhập tối thiểu 6 ký tự","warning":"Khách hàng với tỉ lệ huỷ cao sẽ không được ưu tiên nhận đơn hàng","cancel":"Hủy","cancel_button":"Gửi","confirm_title":"Opps, Bạn đã huỷ đơn hàng quá nhiều","overcancel_request":"đơn huỷ trong ngày","keep":"Giữ lại đơn","cancel_title":"Bạn muốn huỷ đơn hàng này?","back":"Quay lại","request_input_reason":"Vui lòng chọn lí do huỷ để hoàn tất việc huỷ đơn hàng","require_message":"Vui lòng chọn lí do hủy!","require_other_comment":"Vui lòng nhập lý do huỷ!","invalid_status":"Không thể huỷ đơn vì trạng thái đơn hàng đã thay đổi!","status_change":"Đơn hàng của bạn đã thay đổi, hãy kiểm tra lại trước khi tiếp nhé!","select_reason_cancel":"Chọn lý do hủy đơn","select_reason_cancel_des":"Điều gì đã khiến bạn muốn huỷ đơn? Phản hồi của bạn sẽ giúp chúng tôi cải thiện dịch vụ ở lần sau.","action_note":"Bạn có muốn giữ lại thông tin đơn hàng và","action_note_link":"tìm tài xế mới?","order_note":{"note":"Nhập lí do hủy đơn của bạn."},"continue_wait":"Tiếp tục chờ","continue_delivery":"Tiếp tục giao","confirm_cancel":"Xác nhận hủy đơn","confirm_cancel_title":{"finding_driver":"Bạn muốn hủy đơn hàng này?","found_driver":"Tài xế đang đến điểm lấy hàng!"},"confirm_cancel_desc":{"finding_driver":"Bạn chờ thêm chút nhé, chúng tôi đang nỗ lực tìm kiếm tài xế cho bạn","found_driver":"Nếu hủy đơn, bạn sẽ mất nhiều thời gian hơn để tìm tài xế cho những đơn hàng sau."}}}}'),delete e.options._Ctor}},"6eb4":function(e,t,n){},8600:function(e,t,n){"use strict";var a=n("2eb9"),r=n.n(a);t.default=r.a},a6c7:function(e,t,n){},be70:function(e,t,n){"use strict";var a=n("6eb4");n.n(a).a},d3a9:function(e,t,n){"use strict";n.r(t);var a=(n("d25f"),n("4526")),r=n("04ee").filter,o={props:{orderStatus:{type:String,required:!0},orderId:{type:String,required:!0},ownerId:{type:String,default:""},autoBack:{type:Boolean,default:!1},hiddenButton:{type:Boolean,default:!1},onCancelledOrder:{type:Function},onCancelInvalidStatus:{type:Function},onHideDialog:{type:Function}},data:function(){return{showDialog:!1,issueOptions:{},cancelReasons:[],showOverCancelledOrder:!1,numCancelledOrderToday:0,selectedReason:void 0,comment:"",loading:!1,invalidReasonForm:!1,warningMessage:this.$t("cancel_order.warning")}},computed:{allowStatus:function(){return this.orderStatus===this.$constants.ORDER_STATUS.IDLE||this.orderStatus===this.$constants.ORDER_STATUS.ASSIGNING||this.orderStatus===this.$constants.ORDER_STATUS.ACCEPTED}},methods:{checkValidInputStatus:function(e){var t=this,n={format:"json",order_id:this.orderId};this.isPartnerPage&&this.ownerId&&(n.user_id=this.ownerId),this.loading=!0,Object(a.s)(n).then((function(n){return t.loading=!1,n.status!==t.orderStatus?(t.$store.dispatch("setSnackbar",{visible:!0,title:t.$t("cancel_order.status_change"),color:"primary",timeout:3e3}),e(!1,n)):e(!0)})).catch((function(){return t.loading=!1,t.$store.dispatch("setSnackbar",{visible:!0,title:t.$t("default_error"),color:"error",timeout:3e3}),e(!1)}))},confirmCancelOrder:function(){var e=this;this.checkValidInputStatus((function(t,n){t?(e.$_PAGE===e.$constants.PAGE.PARTNER?e.showDialog=!0:(e.loading=!0,e.countCancelledOrderToday().then((function(t){e.loading=!1,e.getRemoteConfigMessage(),e.showDialog=!0,t>=1&&(e.showOverCancelledOrder=!0,e.numCancelledOrderToday=t)}))),e.$analyticTracking.logEvent(e.$trackingEvents.ACTIONS.CLICK,e.$trackingEvents.EVENTS.ORDER_DETAIL_CANCEL_ORDER_BTN,{order:{status:e.orderStatus,order_id:e.orderId}},void 0,{status:e.orderStatus,order_id:e.orderId})):e.$emit("onCancelInvalidStatus",n)}))},getRemoteConfigMessage:function(){var e=this;return new Promise((function(t,n){var a="".concat(e.$_VUE_APP_REST_API).concat(e.$constants.API.remote_config);e.axios.get(a,{}).then((function(a){var r=a.data;if(r){var o=r["cancel_order_warning_message_".concat(e.$i18n.locale).concat("")]||r["cancel_order_warning_message".concat("")];o&&o.defaultValue&&o.defaultValue.value&&(e.warningMessage=o.defaultValue.value),t()}else n()})).catch((function(){n()}))}))},countCancelledOrderToday:function(){var e=this;return new Promise((function(t){if(e.orderStatus===e.$constants.ORDER_STATUS.ASSIGNING)return t(0);var n="https://api.ahamove.com".concat(e.$constants.API.order.list),a=e.buildParamsGetOrders();e.axios.get(n,{params:a}).then((function(n){var a=n.data;if(a){var o=r(a,(function(t){return!0===t.cancel_by_user&&t.user_id===e.$store.getters.userProfile._id&&t.supplier_id}));t(o.length)}else t(0)})).catch((function(){t(0)}))}))},showReasonSelection:function(){this.showOverCancelledOrder=!1,this.$analyticTracking.logEvent(this.$trackingEvents.ACTIONS.CLICK,this.$trackingEvents.EVENTS.CANCEL_ORDER_FORM_CONFIRM_BTN,{order_id:this.orderId})},keepOrder:function(){this.showDialog=!1,this.$analyticTracking.logEvent(this.$trackingEvents.ACTIONS.CLICK,this.$trackingEvents.EVENTS.ORDER_DETAIL_CANCELLED_ORDER_POPUP_CLOSE_BTN,{order_id:this.orderId})},buildParamsGetOrders:function(){return{token:this.$store.getters.token,count:10,status:this.$constants.ORDER_STATUS.CANCELLED,format:"json",from_time:this.$moment().startOf("date").unix(),to_time:this.$moment().endOf("date").unix()}},getCancelReason:function(){var e;if(this.allowStatus){if(!this.selectedReason)return this.$store.dispatch("setSnackbar",{visible:!0,color:"error",timeout:1500,title:this.$t("cancel_order.require_message")}),!1;if("Others"===this.selectedReason){if(this.comment.length<6)return this.invalidReasonForm=!0,this.$store.dispatch("setSnackbar",{visible:!0,color:"error",timeout:1500,title:this.$t("cancel_order.require_other_comment")}),!1;e="".concat(this.selectedReason," - ").concat(this.comment)}else e=this.selectedReason}return e},cancelOrder:function(){var e=this;this.checkValidInputStatus((function(t,n){if(t){e.$analyticTracking.logEvent(e.$trackingEvents.ACTIONS.CLICK,e.$trackingEvents.EVENTS.ORDER_DETAIL_CANCELLED_ORDER_POPUP_RETRY_BTN,{order_id:e.orderId});var a={token:e.$store.getters.token,order_id:e.orderId,comment:"Cancel by User"},r=e.getCancelReason();if(console.log("reason: ",r),!1===r)return;r&&(a.comment+=" ("+r+")");var o="https://api.ahamove.com".concat(e.$constants.API.order.cancel);e.loading=!0,e.axios.get(o,{params:a}).then((function(){e.loading=!1,e.$emit("onCancelledOrder"),e.showDialog=!1})).catch((function(t){e.loading=!1;var n="";if(t&&t.response){var a=t&&t.response;if(406===a.status&&(e.$emit("onCancelInvalidStatus"),n=e.$t("cancel_order.invalid_status")),!n){var r=a.data;n=r&&(r.title||r.description)}}e.$store.dispatch("setSnackbar",{visible:!0,title:n||e.$t("default_error"),color:"error",timeout:3e3})}))}else e.$emit("onCancelInvalidStatus",n)}))}},beforeMount:function(){this.cancelReasons=[{value:"Selected wrong pick-up address",text:this.$t("cancel_order.reason_1")},{value:"Selected wrong delivery address",text:this.$t("cancel_order.reason_2")},{value:"Forget to enter promocode",text:this.$t("cancel_order.reason_3")},{value:"Incorrect COD",text:this.$t("cancel_order.reason_4")},{value:"Incorrect recipient's info",text:this.$t("cancel_order.reason_5")},{value:"Long waiting time for driver to accept",text:this.$t("cancel_order.reason_6")},{value:"Long waiting time for driver to arrive",text:this.$t("cancel_order.reason_7")},{value:"Driver is too far from pick-up location",text:this.$t("cancel_order.reason_8")},{value:"Driver asks for cancellation",text:this.$t("cancel_order.reason_9")},{value:"Unavailabe Package(s)",text:this.$t("cancel_order.reason_10")},{value:"Cannot contact driver",text:this.$t("cancel_order.reason_11")},{value:"Think again on price and fees",text:this.$t("cancel_order.reason_12")},{value:"Others",text:this.$t("cancel_order.reason_13")}]},watch:{showDialog:function(e){e||this.$emit("onHideDialog")}}},i=(n("be70"),n("116e"),n("2877")),s=n("8600"),c=Object(i.a)(o,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"cancel-order-form-wrapper"},[e.isMobile||e.hiddenButton?e._e():n("v-btn",{staticClass:"mx-0",attrs:{name:"btnCancelOrder",color:"",depressed:"",loading:e.loading},on:{click:e.confirmCancelOrder}},[e._v(e._s(e.$t("record.cancel_order")))]),n("v-dialog",{attrs:{"max-width":"420px","content-class":"cancel-order-form-dialog",transition:e.isMobile?"dialog-bottom-transition":"dialog-transition"},model:{value:e.showDialog,callback:function(t){e.showDialog=t},expression:"showDialog"}},[e.allowStatus?n("v-card",[e.showOverCancelledOrder?n("div",{staticClass:"cancel-order-form__reasons"},[n("v-img",{staticClass:"white--text",attrs:{height:"215px",src:"/assets/images/bg_cancelled@3x.png"}}),n("v-container",{staticClass:"count-order"},[n("v-layout",[n("v-flex",{attrs:{xs12:"","align-center":"","text-xs-center":""}},[n("span",{staticClass:"display-1 font-weight-bold",attrs:{color:"white"}},[e._v("\n                "+e._s(e.numCancelledOrderToday)+"\n              ")]),n("div",{staticClass:"caption grey--text",attrs:{color:"white"}},[e._v("\n                "+e._s(e.$t("cancel_order.overcancel_request"))+"\n              ")])])],1)],1),n("v-card-title",[n("div",{staticClass:"text-xs-left cancel-order-form__reasons__title"},[n("p",{staticClass:"title"},[e._v(e._s(e.$t("cancel_order.confirm_title")))]),n("p",{staticClass:"body-1"},[e._v(e._s(e.warningMessage))])])]),n("v-card-actions",{staticClass:"pa-3 cancel-order-form__actions",attrs:{"text-xs-right":""}},[n("v-spacer"),n("v-btn",{attrs:{flat:""},on:{click:e.showReasonSelection}},[e._v(e._s(e.$t("cancel_order.cancel")))]),n("v-btn",{attrs:{depressed:"",color:"accent"},on:{click:e.keepOrder}},[e._v(e._s(e.$t("cancel_order.keep")))])],1)],1):n("div",{staticClass:"cancel-order-form__reasons"},[n("v-card-title",{staticClass:"pb-0 cancel-order-form__reasons-wrapper"},[n("div",{staticClass:"text-xs-left cancel-order-form__reasons__title"},[n("span",{staticClass:"cancel__reason__title"},[e._v(e._s(e.$t("cancel_order.request_input_reason")))]),n("br")]),n("div",{staticClass:"cancel__reasons"},[n("v-radio-group",{attrs:{column:""},model:{value:e.selectedReason,callback:function(t){e.selectedReason=t},expression:"selectedReason"}},e._l(e.cancelReasons,(function(e,t){return n("v-radio",{key:t,attrs:{label:e.text,value:e.value}})})),1)],1),"Others"===e.selectedReason?n("div",{staticClass:"cancel__reasons__others"},[n("v-textarea",{attrs:{outline:"",autofocus:"",rows:"3",label:e.$t("cancel_order.input_reason")},model:{value:e.comment,callback:function(t){e.comment=t},expression:"comment"}}),n("v-spacer"),e.invalidReasonForm?n("div",{staticClass:"v-messages error--text"},[n("div",{staticClass:"v-messages__wrapper"},[n("div",{staticClass:"v-messages__message"},[e._v(e._s(e.$t("cancel_order.input_message")))])])]):e._e()],1):e._e()]),n("v-card-actions",{staticClass:"px-4 pt-2 pb-4 cancel-order-form__actions",attrs:{"text-xs-right":""}},[n("v-spacer"),n("v-btn",{attrs:{loading:e.loading,flat:""},on:{click:e.cancelOrder}},[e._v(e._s(e.$t("cancel_order.cancel")))]),n("v-btn",{attrs:{disabled:e.loading,depressed:"",color:"accent"},on:{click:e.keepOrder}},[e._v(e._s(e.$t("cancel_order.back")))])],1)],1)]):e._e()],1)],1)}),[],!1,null,null,null);"function"==typeof s.default&&Object(s.default)(c),t.default=c.exports}}]);