// packageH/installationSever/installationSeverRefund/installationSeverRefund.js var app = getApp(); Page({ /** * 页面的初始数据 */ data: { status: 1, order_id: 0, detailInfo: {}, }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { if (options.order_id) { this.data.order_id = options.order_id; } if (options.scene) { let scene = decodeURIComponent(options.scene); console.log(scene); if (scene) { var info_arr = []; info_arr = scene.split("&"); for (let i = 0; i < info_arr.length; i++) { let chil_arr = []; chil_arr = info_arr[i].split("="); console.log(chil_arr); if (chil_arr[0] == "order_id") { this.setData({ order_id: chil_arr[1], }); } } } } this.getDetails(); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () {}, /** * 生命周期函数--监听页面显示 */ onShow: function () {}, getDetails() { let { order_id } = this.data; let urlStr = app.getNetAddresss("plugin.live-install.frontend.order.orderDetail"); app._postNetWork({ url: urlStr, data: { order_id }, success: (resdata) => { var res = resdata.data; if (res.result != 1) return app.tips(res.msg); if(res.data.another_name && res.data.another_name.plugin_name){ wx.setNavigationBarTitle({ title: res.data.another_name.plugin_name }); } this.setData({ detailInfo: res.data }); }, }); }, gotoInstallationSeverAfterApply(evt) { let item = evt.currentTarget.dataset.item; let btn = evt.currentTarget.dataset.btn; let order_sn = this.data.detailInfo.order_sn; console.log(item); if (btn.code == "goodsApplyRefund") { wx.navigateTo({ url: "/packageH/installationSever/installationSeverAfterApply/installationSeverAfterApply?install_order_goods_id=" + item.install_order_goods_id + "&order_sn=" + order_sn, }); } }, gotoInstallationSeverAftersale() { let { order_id } = this.data; wx.navigateTo({ url: "/packageH/installationSever/installationSeverAftersale/installationSeverAftersale?order_id=" + order_id, }); }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () {}, bindPhone(e) { var mobile = e.currentTarget.dataset.mobile; wx.showActionSheet({ itemList: ["呼叫", "添加联系人", "复制联系方式"], success: (res) => { console.log("点击电话 res:", res); if (res.tapIndex == 0) { wx.makePhoneCall({ phoneNumber: mobile, }); } else if (res.tapIndex == 1) { //添加联系人 wx.addPhoneContact({ firstName: "", mobilePhoneNumber: mobile, }); } else if (res.tapIndex == 2) { wx.setClipboardData({ data: mobile, }); } }, }); }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () {}, async bindBtnClick(evt) { let btn = evt.currentTarget.dataset.btn; let { detailInfo } = this.data; //有些按钮需要弹窗二次确认 if (btn.code == "orderClose") { let confirmFlag = await app.confirm(`是否确定${btn.name}`); if (confirmFlag == false) return; } if (btn.code == "orderPay") { wx.navigateTo({ url: "/packageD/buy/orderPay/orderPay?order_id=" + detailInfo.order_id + "&status=2", }); } else if (btn.code == "comment") { wx.navigateTo({ url: "/packageD/member/myEvaluation/myEvaluation", }); } else if (btn.code == "orderApplyRefund") { wx.navigateTo({ url: "/packageD/member/myOrder/refund/refund?type=1&refundType=installationSever&order_id=" + detailInfo.order_id, }); } else if (btn.code == "getRefundList") { this.gotoInstallationSeverAftersale(); } else if (btn.code == "orderClose") { this.cancelOrder(); } console.log(btn); //if(btn) }, cancelOrder() { let { order_id } = this.data; let urlStr = app.getNetAddresss("order.operation.close"); app._postNetWork({ url: urlStr, data: { order_id }, success: (resdata) => { var res = resdata.data; if (res.result != 1) return app.tips(res.msg); wx.navigateBack(); }, }); }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () {}, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () {}, /** * 用户点击右上角分享 */ onShareAppMessage: function () { let order_id = this.data.order_id; return { path: "packageH/installationSever/installationSeverRefund/installationSeverRefund?order_id=" + order_id, }; }, });