小程序訂單確認(rèn)收貨
用于小程序的訂單確認(rèn)收貨操作
使用步驟
第一步:配置接口地址
在 config.js 文件中找到 config 設(shè)置
第二步:檢查接口定義
搜索 order_receipt 接口是否已經(jīng)存在定義(有的小程序模板已經(jīng)定義)
如果沒有定義,在 config 底部新增以下代碼:
shopOrderReceiptUrl: getApiUrl('order_receipt'),并復(fù)制紅色部分待用。如果已經(jīng)存在,則直接復(fù)制使用即可。
第三步:接口調(diào)用請(qǐng)求
如果定義名稱不同,使用第二步復(fù)制的內(nèi)容替換紅框部分
/**
* 確認(rèn)收貨
* 接收參數(shù)
* order_id:訂單ID
* 接口傳參
* order_id:訂單ID
*/
receipt(e) {
let _this = this;
let order_id = e.currentTarget.dataset.id;
wx.showModal({
title: "友情提示",
content: "確認(rèn)收到" + _this.data.list.data[0]['channel_ntitle'] + "?",
success(o) {
if (o.confirm) {
App._requestPost(_this, App.globalData.config.shopOrderReceiptUrl, {
order_id
}, result => {
_this.getOrderList();
});
}
}
});
},
接口傳值
order_id:訂單ID,必傳
文檔最后更新時(shí)間:2026-01-13 11:52:25
← 小程序訂單取消
小程序訂單提醒發(fā)貨 →
未解決你的問題?請(qǐng)到「問答社區(qū)」反饋你遇到的問題
