給餐館開發的一款外賣點餐的小程式,樣式和美團外賣差不多,包含點外賣、加入購物車、訂單支付、查詢訂單、釋出評價、使用紅包、管理派送位址等功能。具體可以參考下面的圖檔:
CSDN下載下傳位址:https://download.csdn.net/download/u010978757/85061680
DATA5U源碼網:https://code.data5u.com/code/detail-614.html
app.js代碼:
//app.js
App({
onLaunch: function() {
//調用API從本地緩存中擷取資料
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
},
getUserInfo: function(cb) {
var that = this
if (this.globalData.userInfo) {
typeof cb == "function" && cb(this.globalData.userInfo)
console.log(this.globalData.userInfo,1)
} else {
//調用登入接口
wx.getUserInfo({
withCredentials: false,
success: function(res) {
that.globalData.userInfo = res.userInfo
typeof cb == "function" && cb(that.globalData.userInfo)
console.log(that.globalData.userInfo, 1)
}
})
}
},
onLoad: function() {
},
globalData: {
userInfo: null,
location: "",
city: '',
address: '',
buycar_num: 0,
totalMoney: 0,
totalSecond: 899
}
})
app.json代碼:
{
"pages":[
"pages/index/index",
"pages/search/search",
"pages/addAddress/addAddress",
"pages/applyRefund/applyRefund",
"pages/test/test",
"pages/orderDetail/orderDetail",
"pages/refundDetail/refundDetail",
"pages/orderMap/orderMap",
"pages/detail/detail",
"pages/editAddress/editAddress",
"pages/address/address",
"pages/submitOrder/submitOrder",
"pages/evaluate/evaluate",
"pages/allEvaluate/allEvaluate",
"pages/myPackage/myPackage"
],
"window":{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#000",
"navigationBarTitleText": "外賣",
"navigationBarTextStyle":"white"
}
}