// pages/order_details/order_details.js Page({ /** * 页面的初始数据 */ data: { tuikuan: '退 款', yipeisong: false, peisongren :"" }, async onClickRefund(e) { if (this.data.tuikuan == "已退款") { return } let res = await wx.showModal({ title: '确认退款', }) console.log(res) if (res.cancel) return; wx.showToast({ title: '退款成功', icon: 'success' }) this.setData({ tuikuan: '已退款' }) }, changValue() { if (onClickRefund(e)) { this.setData({ tuikuan: '已退款' }) } }, // // // }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { // 后期接口出来如果直接调用接口 if 已经配送 那么 yipeisong = true // 默认不显示 false wx.request({ url: 'https://www.fastmock.site/mock/f528b4a479c72409aace9493f1c0e880/waimai/getWaiMaiName', method: 'GET', header: { 'content-type': 'application/json' // 默认值 }, success: (res => { console.log(res); res.data.isPei = true if (res.data.isPei == true) { this.setData({ yipeisong :true, peisongren : res.data.peisongName }) } }), }) wx.setNavigationBarTitle({ title: '订单详情' }) }, /** * 生命周期函数--监听页面初次渲染完 成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, })