| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- import PageContainerBehavior from "../../../../core/behavior/page-container.behavior";
- import tickleBehavior, { getTickleContext } from "../../../../core/behavior/tickle.behavior";
- import { getOrderDetailMethod, orderConfirmMethod } from "../../request";
- // module/diet/pages/delivery-address/delivery-address.ts
- Page({
- behaviors: [
- PageContainerBehavior,
- tickleBehavior,
- ],
- async onLoad(options:any) {
- console.log("onLoad",options)
- if(options.orderId){
- this.setData({ id: options.orderId });
- await this.load(options.orderId);
- }
-
- },
- properties: {
- },
- data: {
- id: '',
- goodsList: []
- },
- async load(id:string) {
- wx.showLoading({ title: '加载中' });
- try {
- const res = await getOrderDetailMethod(id);
- console.log("res",res)
- if(res && res.data && res.data.items && res.data.items.length > 0){
- this.setData({ goodsList: res.data.items });
- }else{
- this.setData({ goodsList: [] });
- }
- console.log("goodsList",this.data.goodsList)
- } catch (error:any) {
- getTickleContext.call(this).showWarnMessage(error.errMsg);
- }
- wx.hideLoading();
- },
- copyExpressNo(e:any) {
- wx.setClipboardData({
- data: e.currentTarget.dataset.no,
- success: () => wx.showToast({ title: '已复制', icon: 'none' })
- });
- },
- onCancel() {
- // 关闭弹窗或返回
- wx.navigateBack();
- },
- // 确认收货逻辑
- async onConfirmReceiving() {
- let that = this;
- wx.showModal({
- title: '提示',
- content: '确认收货后,订单将无法修改,请确认无误后再进行操作',
- success: (res) => {
- if (res.confirm) {
- that.confirmReceiving();
- }
- }
- });
- },
- async confirmReceiving() {
- try {
- await orderConfirmMethod(this.data.id);
- // wx.showToast({ title: '确认收货成功', icon: 'success' });
- wx.navigateTo({
- url: "/module/article/pages/success-page/success-page?title=确认收货成功",
- });
- } catch (error:any) {
- getTickleContext.call(this).showWarnMessage(error.errMsg);
- }
- }
- })
|