| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- import { API } from "../../../service/api"
- // pages/order/orderDetail/orderDetail.js
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- prods:[],
- orderDetail:''
- },
- // 获取订单详情
- getOrderDetail(orderId){
- API.getOrderDetail({orderId}).then(res=>{
- // console.log(res);
- this.setData({
- orderDetail:res.orderDTO,
- prods:res.orderDTO.orderDetailDTOS
- })
- })
- },
- // 进入地址管理
- goAddressMange(){
- wx.navigateTo({
- url: '/pages/my/addressManage/addressManage?moldify=true',
- })
- },
- // 修改地址
- editOrderAddress(address){
- let orderId = this.data.orderDetail.orderId;
- API.orderAddressModify({orderId,userAddressId:address.userAddressId}).then(res=>{
- wx.showToast({
- title: '地址修改成功',
- icon:"success"
- })
- this.getOrderDetail(orderId);
- })
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- console.log(options);
- this.getOrderDetail(options.orderId);
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- const pages = getCurrentPages()
- const currentPage = pages[pages.length - 1]
- if (currentPage.data.returnData) {
- let address = currentPage.data.returnData;
- console.log('收到返回参数:', currentPage.data.returnData)
- // 使用参数...
- this.editOrderAddress(address);
- // 清除参数避免重复触发
- currentPage.setData({ returnData: null })
- }
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- }
- })
|