Skip to content

Commit

Permalink
增加达达配送支持
Browse files Browse the repository at this point in the history
  • Loading branch information
woniudiancang committed Nov 19, 2020
1 parent 7735fd8 commit 86549dc
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 6 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,18 @@ https://developers.weixin.qq.com/miniprogram/dev/devtools/download.html

修改 js 文件后,请点击开发工具上的 “编译” 按钮,重新编译一下小程序,即可进行扫码点餐的测试

## 使用达达配送

如果你和我一样,是使用的 “api工厂” 的接口和后台,那么可以很方便的和达达配送进行对接,请先仔细查看“api工厂”的配置教程:

[如何对接达达配送](https://www.it120.cc/help/gxk08t.html)

## 门店关联达达门店编号

“api工厂”后台的门店管理,“商城管理” --> “门店管理”,请填写匹配的达达门店编号,同时“生鲜配送”请填写: dada

设置以后,选择 “外卖配送” ,“api工厂” 将会自动帮你对接达达配送

# 常见问题

## 无法登陆 / 无法获取 openid
Expand Down
4 changes: 2 additions & 2 deletions config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
version: "3.4.0",
note: '签到界面登录逻辑优化',
version: "3.5.0",
note: '增加达达配送支持',
subDomain: "beeorder", // 根据教程 https://www.it120.cc/help/qr6l4m.html 查看并设置你自己的 subDomain
}
33 changes: 29 additions & 4 deletions pages/ad/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,8 @@ Page({
const linkMan = this.data.addressData.linkMan
const address = this.data.addressData.address
const mobile = this.data.addressData.mobile
const latitude = this.data.addressData.latitude
const longitude = this.data.addressData.longitude

if (!linkMan){
wx.showToast({
Expand All @@ -349,6 +351,13 @@ Page({
})
return
}
if (!latitude){
wx.showToast({
title: '请选择定位',
icon: 'none',
})
return
}
if (!address){
wx.showToast({
title: '请填写详细地址',
Expand All @@ -363,6 +372,8 @@ Page({
address: address,
mobile: mobile,
isDefault: 'true',
latitude,
longitude
}

// console.log(this.data.pIndex)
Expand Down Expand Up @@ -460,9 +471,23 @@ Page({
content: '手机号码格式不正确',
showCancel:false
})
}

}
},


chooseLocation() {
wx.chooseLocation({
success: (res) => {
const addressData = this.data.addressData
addressData.address = res.address + res.name
addressData.latitude = res.latitude
addressData.longitude = res.longitude
this.setData({
addressData
})
},
fail: (e) => {
console.error(e)
},
})
}
})

1 change: 1 addition & 0 deletions pages/ad/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
is-link
/>
</picker>
<van-cell title="选择定位" value="{{ addressData.latitude ? (addressData.latitude + ',' + addressData.longitude) : '请选择' }}" is-link bind:click="chooseLocation" />
<van-field
value="{{ addressData.address }}"
label="详细地址"
Expand Down
6 changes: 6 additions & 0 deletions pages/pay/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@ Page({
})
return;
}
// 达达配送
if (this.data.shopInfo.number && this.data.shopInfo.expressType == 'dada') {
postData.dadaShopNo = this.data.shopInfo.number
postData.dadaLat = this.data.curAddressData.latitude
postData.dadaLng = this.data.curAddressData.longitude
}
if (postData.peisongType == 'kd') {
postData.provinceId = that.data.curAddressData.provinceId;
postData.cityId = that.data.curAddressData.cityId;
Expand Down

0 comments on commit 86549dc

Please sign in to comment.