You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
5.7 KiB

(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/index/ship_detail"],{290:function(e,t,n){"use strict";(function(e,t){var i=n(4);n(26);i(n(25));var r=i(n(291));e.__webpack_require_UNI_MP_PLUGIN__=n,t(r.default)}).call(this,n(1)["default"],n(2)["createPage"])},291:function(e,t,n){"use strict";n.r(t);var i=n(292),r=n(294);for(var a in r)["default"].indexOf(a)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(a);n(296);var o,c=n(33),s=Object(c["default"])(r["default"],i["render"],i["staticRenderFns"],!1,null,"bbc5a964",null,!1,i["components"],o);s.options.__file="pages/index/ship_detail.vue",t["default"]=s.exports},292:function(e,t,n){"use strict";n.r(t);var i=n(293);n.d(t,"render",(function(){return i["render"]})),n.d(t,"staticRenderFns",(function(){return i["staticRenderFns"]})),n.d(t,"recyclableRender",(function(){return i["recyclableRender"]})),n.d(t,"components",(function(){return i["components"]}))},293:function(e,t,n){"use strict";var i;n.r(t),n.d(t,"render",(function(){return r})),n.d(t,"staticRenderFns",(function(){return o})),n.d(t,"recyclableRender",(function(){return a})),n.d(t,"components",(function(){return i}));var r=function(){var e=this,t=e.$createElement,n=(e._self._c,e.ship?e.getShipTypeName(e.ship.ship_type):null),i=e.ship?e.getFileUrl(e.ship.picture1):null,r=e.ship?e.getFileUrl(e.ship.picture2):null,a=e.ship?e.getFileUrl(e.ship.picture3):null;e.$mp.data=Object.assign({},{$root:{m0:n,m1:i,m2:r,m3:a}})},a=!1,o=[];r._withStripped=!0},294:function(e,t,n){"use strict";n.r(t);var i=n(295),r=n.n(i);for(var a in i)["default"].indexOf(a)<0&&function(e){n.d(t,e,(function(){return i[e]}))}(a);t["default"]=r.a},295:function(e,t,n){"use strict";(function(e){var i=n(4);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n(44)),a=i(n(5)),o=i(n(46)),c=n(30),s=function(){n.e("components/NavBar").then(function(){return resolve(n(330))}.bind(null,n)).catch(n.oe)},u={name:"ShipDetailPage",components:{NavBar:s},data:function(){return{ship:null,id:null,shipTypeEnum:[],isWeixinBrowser:!1}},onLoad:function(e){if(this.id=e.id,e.item)try{this.ship=JSON.parse(decodeURIComponent(e.item))}catch(t){this.ship=null}},onShow:function(){var e=this;this.fetchShipPropertyEnum().then((function(){e.fetchShipDetail()}))},methods:{getShipTypeName:function(e){if(!Array.isArray(this.shipTypeEnum))return e;var t=this.shipTypeEnum.find((function(t){return t.value===(null===e||void 0===e?void 0:e.toString())}));return t?t.label:e},fetchShipPropertyEnum:function(){var t=this;return(0,o.default)(r.default.mark((function n(){var i,o,s;return r.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:if(i=e.getStorageSync("token"),i){n.next=4;break}return e.showToast({title:"请先登录",icon:"none"}),n.abrupt("return",!1);case 4:return e.showLoading({title:"加载中..."}),n.prev=5,n.next=8,new Promise((function(t,n){e.request({url:c.API.SHIP_PROPERTY_ENUM,method:"GET",data:{token:i},success:t,fail:n})}));case 8:if(o=n.sent,e.hideLoading(),!o.data||0!==o.data.errcode){n.next=16;break}return s=o.data.data.ship_type||{},t.shipTypeEnum=Object.entries(s).map((function(e){var t=(0,a.default)(e,2),n=t[0],i=t[1];return{label:n,value:i.toString()}})),n.abrupt("return",!0);case 16:return e.showToast({title:o.data.errmsg||"获取枚举失败",icon:"none"}),n.abrupt("return",!1);case 18:n.next=25;break;case 20:return n.prev=20,n.t0=n["catch"](5),e.hideLoading(),e.showToast({title:n.t0.message||"网络错误",icon:"none"}),n.abrupt("return",!1);case 25:case"end":return n.stop()}}),n,null,[[5,20]])})))()},fetchShipDetail:function(){var t=this;return(0,o.default)(r.default.mark((function n(){var i,a;return r.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:if(i=e.getStorageSync("token"),i){n.next=4;break}return e.showToast({title:"请先登录",icon:"none"}),n.abrupt("return");case 4:return e.showLoading({title:"加载中..."}),n.prev=5,n.next=8,new Promise((function(n,r){e.request({url:"".concat(c.API.SHIP_DETAIL,"/").concat(t.id),method:"GET",data:{token:i},success:n,fail:r})}));case 8:a=n.sent,e.hideLoading(),a.data&&0===a.data.errcode?t.ship=a.data.data:e.showToast({title:a.data.errmsg||"获取失败",icon:"none"}),n.next=17;break;case 13:n.prev=13,n.t0=n["catch"](5),e.hideLoading(),e.showToast({title:n.t0.message||"网络错误",icon:"none"});case 17:case"end":return n.stop()}}),n,null,[[5,13]])})))()},getFileUrl:function(e){return e?"".concat(c.API.BASE_URL,"/api/customer/upload-file/preview?id=").concat(e):""},onEdit:function(){if(this.ship){var t=encodeURIComponent(JSON.stringify(this.ship));e.navigateTo({url:"/pages/index/ship_add?edit=1&ship=".concat(t)})}},onDelete:function(){var t=this,n=e.getStorageSync("token");n?this.ship&&this.ship.id?e.showModal({title:"提示",content:"确定要删除该船舶吗?",success:function(i){i.confirm&&(e.showLoading({title:"删除中..."}),e.request({url:"".concat(c.API.SHIP_DELETE,"/").concat(t.ship.id,"?token=").concat(n),method:"POST",data:{},header:{"content-type":"application/json"},success:function(t){e.hideLoading(),t.data&&0===t.data.errcode?(e.showToast({title:"删除成功",icon:"success"}),setTimeout((function(){e.navigateBack()}),1e3)):e.showToast({title:t.data.errmsg||"删除失败",icon:"none"})},fail:function(t){e.hideLoading(),e.showToast({title:"网络错误",icon:"none"})}}))}}):e.showToast({title:"无效的船舶信息",icon:"none"}):e.showToast({title:"请先登录",icon:"none"})}}};t.default=u}).call(this,n(2)["default"])},296:function(e,t,n){"use strict";n.r(t);var i=n(297),r=n.n(i);for(var a in i)["default"].indexOf(a)<0&&function(e){n.d(t,e,(function(){return i[e]}))}(a);t["default"]=r.a},297:function(e,t,n){}},[[290,"common/runtime","common/vendor"]]]);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/index/ship_detail.js.map