Skip to content

Commit

Permalink
添加搭建教程
Browse files Browse the repository at this point in the history
  • Loading branch information
mengfandong committed Feb 12, 2023
1 parent 50f0c4e commit b43cb5d
Show file tree
Hide file tree
Showing 29 changed files with 226 additions and 28 deletions.
86 changes: 85 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,89 @@

- [云开发文档](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/getting-started.html)

# shuguo
# supermarket_applet

# 搭建步骤
1 开通 云开发
![img.png](img.png)

2上 传所有云函数

![img_1.png](img_1.png)

timingSendGold定时更新果币信息。需要上传触发器

![img_2.png](img_2.png)

3 配置数据库表
helpQuestion 帮助问题相关
swiper 轮播图相关
category 商品分类相关
goodsList 商品信息列表
order 商品订单数据
address 收获地址
deliveryTime 配送时间
opinion 意见表
applyService 订单售后信息表
shareRelation 分享的相关数据
userInfo 用户信息
management 管理员信息

直接点击添加以上表名即可
![img_3.png](img_3.png)

4.完善代码内配置(全量搜索 'TODO 配置' 我在需要配置的地方加上了注解)
app.js
![img_4.png](img_4.png)
![img_5.png](img_5.png)

完成以上配置后,随便点点。除了一些静态资源找不到的报错, 控制台就没有报错信息了
![img_6.png](img_6.png)
![img_7.png](img_7.png)

5.下面开始完善一些基础数据。(记得修改表对应的数据权限,详见踩坑记录,可以直接用数据库json文件导入到对应表格内)
swiper 轮播图相关
category 商品分类相关
deliveryTime 配送时间
![img_11.png](img_11.png)

6.我的->设置->商品管理-> 右下角+号 添加商品信息
![img_10.png](img_10.png)

7. 添加完成后你会发现商品列表并没有商品。说明你的商品表的的数据权限没有打开。目前就这些工作。


# 搭建踩坑记录
1.数据库表里明明有数据,但是查询是返回结果为空?
答:保证表名及数据无误的情况下。查看该表的权限。基础数据可设置成 第一个
![img_8.png](img_8.png)

2.显示支付成功,但是在后台查不到?
答:方便测试代码内已经把支付功能给注解掉了。默认支付成功。生产逻辑是在 payCallBack这个云函数内接收支付回调信息后修改状态
所以在没有支付功能的资质下只能手动更改订单状态
0 取消
1 下单 待支付
2 支付成功,待商家接单
3 打包中
4 打包完成,待配送
5 配送中
6 订单已签收
7 售后(已经申请售后)
![img_12.png](img_12.png)

## 如果以上对您有帮助,您也可以通过以下方式支持我。让我们在力所能及的范围内互帮互助✌️
1. 时光伴侣 是我全职开发的一款受柳比歇夫时间统计法影响诞生的一个时间统计app,
可的话捧个场,试用下,推荐给身边需要的同学,ios端的同学劳烦给个好评(让苹果爸爸给我点自然流量)!!
安卓(暂时没有上应用市场)感兴趣的话可以扫码下载
![img_13.png](img_13.png) ![img_14.png](img_14.png) ![img_15.png](img_15.png)

2.直接投喂(1元2元不嫌少,8元9元不嫌多)
![img_16.png](img_16.png) ![img_17.png](img_17.png)

3.给个小星星✨✨✨

### 联系方式
B站: 时光伴侣App
邮箱: [email protected]

Binary file added img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img_10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img_11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img_12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img_13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img_14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img_15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img_16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img_17.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img_5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img_6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img_7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img_8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img_9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions miniprogram/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ App({
GOODS_LIST: "goodsList",
CATEGORY: "category",
SWIPER: "swiper",
// TODO 配置
APP_ID: ".......",
APP_SECRET: ".......",
GRANT_TYPE: "authorization_code"
Expand All @@ -22,6 +23,7 @@ App({
// 此处请填入环境 ID, 环境 ID 可打开云控制台查看
// 如不填则使用默认环境(第一个创建的环境)
// env: '.......',// 测试
// TODO 配置
env: '.......',// 生产
traceUser: true,
})
Expand Down
4 changes: 2 additions & 2 deletions miniprogram/pages/addAddress/addAddress.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Page({
data: {
userName: "",
showPopup: false,
columns: ['田陈生活区', '田陈步行街', '田陈铁运处小区',
'滕南小区', '尹洼村', '蒋庄生活区','蒋庄步行街','蒋庄建行小区'
columns: ['地址一', '地址二', '地址三',
'地址四', '地址五', '地址六','地址七','地址八'
],
address: "",
userPhone: "",
Expand Down
26 changes: 19 additions & 7 deletions miniprogram/pages/seting/seting.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,25 @@ Page({
if (token && token.phone) {
const result = await queryMgmt(token.phone)
console.log("查询管理员信息结果->", result)
if (result.length > 0) {
wx.setStorageSync("mgmt", result[0]);
this.setData({
isMgmt: true,
level: result[0].level
})
}
// 方便演示 放开后门

wx.setStorageSync("mgmt", result[0]);
this.setData({
isMgmt: true,
level: 7
})
// 需要校验可以把 100-104 行代码删除 打开下面代码的注解
// this.setData({
// isMgmt: true,
// level: result[0].level
// })
// if (result.length > 0) {
// wx.setStorageSync("mgmt", result[0]);
// this.setData({
// isMgmt: true,
// level: result[0].level
// })
// }
}
},

Expand Down
2 changes: 1 addition & 1 deletion miniprogram/pages/submitOrder/submitOrder.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ Page({
// 日期
var today = date.getDate();
let columns = [];
// 当天所在数据库的索引
// 当天所在数据库的索引(没记错的话这里周天是0)
var index = timeList.findIndex(v => v.day === d);
console.log("当天所在的索引", index, timeList[index].day, d)
// 获取3个可选的配送时间
Expand Down
7 changes: 4 additions & 3 deletions miniprogram/pages/user/user.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
<view class="user">
<block wx:if="{{isLogin}}">
<view class="img">
<van-image height="150rpx" width="150rpx" round src="cloud://test-9gk2a9v0ee0aa199.7465-test-9gk2a9v0ee0aa199-1304152447/suguoxiansheng.png" />
<van-image height="150rpx" width="150rpx" round src="https://7465-test-1grlfkhpfaea9d5d-1304152447.tcb.qcloud.la/logo.jpg?sign=a58a68fabd82bc117b8b29f6066c4295&t=1676110894" />
</view>
<view class="user-info">
<view class="user-name">蔬果_{{userName}}</view>
<view class="user-phone">
<van-icon name="phone-o" size="30rpx" />
<view class="phone">{{userPhone}}</view>
<!-- <view class="phone">{{userPhone}}</view> -->
<view class="phone">******</view>
</view>
</view>
</block>
Expand Down Expand Up @@ -114,4 +115,4 @@
</van-grid>
</view>
</view>
</view>
</view>
26 changes: 14 additions & 12 deletions miniprogram/utils/commonUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,18 +201,20 @@ export const toPayPage = async (orderNo, attach, payPrice) => {
wx.hideLoading();
console.log("toPayPage payResult", payResult)
return new Promise((resolve, reject) => {
const payment = payResult.result.payment
wx.requestPayment({
...payment,
async success(res) {
console.log('pay success', res)
resolve(true)
},
fail(res) {
console.error('pay fail', res)
reject(false)
}
})
resolve(true)
// TODO 方便演示 以下支付代码注解需要的可以打开
// const payment = payResult.result.payment
// wx.requestPayment({
// ...payment,
// async success(res) {
// console.log('pay success', res)
// resolve(true)
// },
// fail(res) {
// console.error('pay fail', res)
// reject(false)
// }
// })
})

}
Expand Down
7 changes: 5 additions & 2 deletions project.private.config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"setting": {},
"setting": {
"compileHotReLoad": true
},
"condition": {
"plugin": {
"list": [
Expand Down Expand Up @@ -190,5 +192,6 @@
]
}
},
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html"
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "supermarket_applet"
}
85 changes: 85 additions & 0 deletions 数据库json/category.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"_id": "1",
"categoryId": "1",
"num": 1,
"imgUrl": "cloud://test-1grlfkhpfaea9d5d.7465-test-1grlfkhpfaea9d5d-1304152447/logo.jpg",
"categoryName": ""
}
{
"_id": "2",
"categoryId": "2",
"num": 2,
"imgUrl": "cloud://test-1grlfkhpfaea9d5d.7465-test-1grlfkhpfaea9d5d-1304152447/logo.jpg",
"categoryName": ""
}
{
"_id": "3",
"categoryId": "3",
"num": 3,
"imgUrl": "cloud://test-1grlfkhpfaea9d5d.7465-test-1grlfkhpfaea9d5d-1304152447/logo.jpg",
"categoryName": ""
}
{
"_id": "4",
"categoryId": "4",
"num": 4,
"imgUrl": "cloud://test-1grlfkhpfaea9d5d.7465-test-1grlfkhpfaea9d5d-1304152447/logo.jpg",
"categoryName": ""
}
{
"_id": "5",
"categoryId": "5",
"num": 5,
"imgUrl": "cloud://test-1grlfkhpfaea9d5d.7465-test-1grlfkhpfaea9d5d-1304152447/logo.jpg",
"categoryName": ""
}
{
"_id": "6",
"categoryId": "6",
"num": 6,
"imgUrl": "cloud://test-1grlfkhpfaea9d5d.7465-test-1grlfkhpfaea9d5d-1304152447/logo.jpg",
"categoryName": ""
}
{
"_id": "7",
"categoryId": "7",
"num": 7,
"imgUrl": "cloud://test-1grlfkhpfaea9d5d.7465-test-1grlfkhpfaea9d5d-1304152447/logo.jpg",
"categoryName": ""
}
{
"_id": "8",
"categoryId": "8",
"num": 8,
"imgUrl": "cloud://test-1grlfkhpfaea9d5d.7465-test-1grlfkhpfaea9d5d-1304152447/logo.jpg",
"categoryName": ""
}
{
"_id": "9",
"categoryId": "9",
"num": 9,
"imgUrl": "cloud://test-1grlfkhpfaea9d5d.7465-test-1grlfkhpfaea9d5d-1304152447/logo.jpg",
"categoryName": ""
}
{
"_id": "10",
"categoryId": "10",
"num": 10,
"imgUrl": "cloud://test-1grlfkhpfaea9d5d.7465-test-1grlfkhpfaea9d5d-1304152447/logo.jpg",
"categoryName": ""
}
{
"_id": "11",
"categoryId": "11",
"num": 11,
"imgUrl": "cloud://test-1grlfkhpfaea9d5d.7465-test-1grlfkhpfaea9d5d-1304152447/logo.jpg",
"categoryName": ""
}
{
"_id": "12",
"categoryId": "12",
"num": 12,
"imgUrl": "cloud://test-1grlfkhpfaea9d5d.7465-test-1grlfkhpfaea9d5d-1304152447/logo.jpg",
"categoryName": ""
}

8 changes: 8 additions & 0 deletions 数据库json/deliveryTime.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{"_id":"4f1d421c63e77209026d2b64469eb081","hour":"15","min":"00","day":0}
{"_id":"4f1d421c63e77209026d2b64469eb080","hour":"15","min":"00","day":1}
{"_id":"4f1d421c63e77209026d2b64469eb082","hour":"15","min":"00","day":2}
{"_id":"4f1d421c63e77209026d2b64469eb083","hour":"15","min":"00","day":3}
{"_id":"4f1d421c63e77209026d2b64469eb084","hour":"15","min":"00","day":4}
{"_id":"4f1d421c63e77209026d2b64469eb085","hour":"15","min":"00","day":5}
{"_id":"4f1d421c63e77209026d2b64469eb086","hour":"15","min":"00","day":6}
{"_id":"4f1d421c63e77209026d2b64469eb087","hour":"15","min":"00","day":7}
1 change: 1 addition & 0 deletions 数据库json/swiper.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"_id":"1","url":"https://7465-test-1grlfkhpfaea9d5d-1304152447.tcb.qcloud.la/logo.jpg?sign=c7dfbfeb3411b550d3f38819e3ade5fa&t=1676107500","navigateTo":"/pages/customerService/customerService"}

0 comments on commit b43cb5d

Please sign in to comment.