import Utils from '@/utils/utils' export default { // 获取菜单列表 getMenuList(id) { return uni.$u.http.get('/weixin/infoByShop', { params:{ shopId: id } }).then(res => { return res; }).catch(err => { uni.showToast({title:'服务器错误',icon:'none'}) }) }, // 获取点单屏幕的订单信息 getScreenShopCar(key) { return uni.$u.http.get('/application/getData', { params:{ key: key } }).then(res => { return res; }).catch(err => { uni.showToast({ title: '服务器错误', icon: 'none' }); return err; }) }, // 下单获取预支付订单 saveReserve(data) { return uni.$u.http.post('/order', data).then(res => { console.log(res,444411111) return res; }).catch(err => { }) }, // saveReserve 为业务接口 requestPayment(data) { const { errno, errmsg, res } = data; // res为调起微信支付所需参数 if (errno === '0') { // 调起微信支付 uni.requestPayment({ provider: 'wxpay', // 服务提提供商微信支付 timeStamp: res.weChatPayData.timestamp, // 时间戳 nonceStr: res.weChatPayData.noncestr, // 随机字符串 package: res.weChatPayData.package, signType: res.weChatPayData.signtype || 'MD5', // 签名算法 paySign: res.weChatPayData.sign, // 签名 success: function (res) { console.log('支付成功', res); // 业务逻辑。。。 }, fail: function (err) { console.log('支付失败', err); } }); } } }