diff --git a/README.md b/README.md index 6b311ce..f792b92 100644 --- a/README.md +++ b/README.md @@ -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 + 邮箱: sgbl2022@163.com + diff --git a/img.png b/img.png new file mode 100644 index 0000000..e3f5bb0 Binary files /dev/null and b/img.png differ diff --git a/img_1.png b/img_1.png new file mode 100644 index 0000000..6977d7c Binary files /dev/null and b/img_1.png differ diff --git a/img_10.png b/img_10.png new file mode 100644 index 0000000..4b6a3ac Binary files /dev/null and b/img_10.png differ diff --git a/img_11.png b/img_11.png new file mode 100644 index 0000000..8892f01 Binary files /dev/null and b/img_11.png differ diff --git a/img_12.png b/img_12.png new file mode 100644 index 0000000..23f670b Binary files /dev/null and b/img_12.png differ diff --git a/img_13.png b/img_13.png new file mode 100644 index 0000000..c5f58c3 Binary files /dev/null and b/img_13.png differ diff --git a/img_14.png b/img_14.png new file mode 100644 index 0000000..ba41366 Binary files /dev/null and b/img_14.png differ diff --git a/img_15.png b/img_15.png new file mode 100644 index 0000000..851c08d Binary files /dev/null and b/img_15.png differ diff --git a/img_16.png b/img_16.png new file mode 100644 index 0000000..6e05ad9 Binary files /dev/null and b/img_16.png differ diff --git a/img_17.png b/img_17.png new file mode 100644 index 0000000..b5cfc1a Binary files /dev/null and b/img_17.png differ diff --git a/img_2.png b/img_2.png new file mode 100644 index 0000000..d7c74af Binary files /dev/null and b/img_2.png differ diff --git a/img_3.png b/img_3.png new file mode 100644 index 0000000..dec2cf6 Binary files /dev/null and b/img_3.png differ diff --git a/img_4.png b/img_4.png new file mode 100644 index 0000000..a409528 Binary files /dev/null and b/img_4.png differ diff --git a/img_5.png b/img_5.png new file mode 100644 index 0000000..b19e2d9 Binary files /dev/null and b/img_5.png differ diff --git a/img_6.png b/img_6.png new file mode 100644 index 0000000..5bd8854 Binary files /dev/null and b/img_6.png differ diff --git a/img_7.png b/img_7.png new file mode 100644 index 0000000..5bd8854 Binary files /dev/null and b/img_7.png differ diff --git a/img_8.png b/img_8.png new file mode 100644 index 0000000..04d4d63 Binary files /dev/null and b/img_8.png differ diff --git a/img_9.png b/img_9.png new file mode 100644 index 0000000..a90ffd6 Binary files /dev/null and b/img_9.png differ diff --git a/miniprogram/app.js b/miniprogram/app.js index ab92456..a065ec7 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -6,6 +6,7 @@ App({ GOODS_LIST: "goodsList", CATEGORY: "category", SWIPER: "swiper", + // TODO 配置 APP_ID: ".......", APP_SECRET: ".......", GRANT_TYPE: "authorization_code" @@ -22,6 +23,7 @@ App({ // 此处请填入环境 ID, 环境 ID 可打开云控制台查看 // 如不填则使用默认环境(第一个创建的环境) // env: '.......',// 测试 + // TODO 配置 env: '.......',// 生产 traceUser: true, }) diff --git a/miniprogram/pages/addAddress/addAddress.js b/miniprogram/pages/addAddress/addAddress.js index 35cd8e7..cb1a4ab 100644 --- a/miniprogram/pages/addAddress/addAddress.js +++ b/miniprogram/pages/addAddress/addAddress.js @@ -9,8 +9,8 @@ Page({ data: { userName: "", showPopup: false, - columns: ['田陈生活区', '田陈步行街', '田陈铁运处小区', - '滕南小区', '尹洼村', '蒋庄生活区','蒋庄步行街','蒋庄建行小区' + columns: ['地址一', '地址二', '地址三', + '地址四', '地址五', '地址六','地址七','地址八' ], address: "", userPhone: "", diff --git a/miniprogram/pages/seting/seting.js b/miniprogram/pages/seting/seting.js index 57fc02b..8cdc1fd 100644 --- a/miniprogram/pages/seting/seting.js +++ b/miniprogram/pages/seting/seting.js @@ -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 + // }) + // } } }, diff --git a/miniprogram/pages/submitOrder/submitOrder.js b/miniprogram/pages/submitOrder/submitOrder.js index c0b0500..e702710 100644 --- a/miniprogram/pages/submitOrder/submitOrder.js +++ b/miniprogram/pages/submitOrder/submitOrder.js @@ -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个可选的配送时间 diff --git a/miniprogram/pages/user/user.wxml b/miniprogram/pages/user/user.wxml index 3e8f193..4ad229e 100644 --- a/miniprogram/pages/user/user.wxml +++ b/miniprogram/pages/user/user.wxml @@ -3,13 +3,14 @@ - + @@ -114,4 +115,4 @@ - \ No newline at end of file + diff --git a/miniprogram/utils/commonUtil.js b/miniprogram/utils/commonUtil.js index 7e6db12..1983153 100644 --- a/miniprogram/utils/commonUtil.js +++ b/miniprogram/utils/commonUtil.js @@ -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) + // } + // }) }) } diff --git a/project.private.config.json b/project.private.config.json index 932ba72..d041c68 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -1,5 +1,7 @@ { - "setting": {}, + "setting": { + "compileHotReLoad": true + }, "condition": { "plugin": { "list": [ @@ -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" } \ No newline at end of file diff --git "a/\346\225\260\346\215\256\345\272\223json/category.json" "b/\346\225\260\346\215\256\345\272\223json/category.json" new file mode 100644 index 0000000..790ce3d --- /dev/null +++ "b/\346\225\260\346\215\256\345\272\223json/category.json" @@ -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": "哼" +} + diff --git "a/\346\225\260\346\215\256\345\272\223json/deliveryTime.json" "b/\346\225\260\346\215\256\345\272\223json/deliveryTime.json" new file mode 100644 index 0000000..e230140 --- /dev/null +++ "b/\346\225\260\346\215\256\345\272\223json/deliveryTime.json" @@ -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} diff --git "a/\346\225\260\346\215\256\345\272\223json/swiper.json" "b/\346\225\260\346\215\256\345\272\223json/swiper.json" new file mode 100644 index 0000000..414eadb --- /dev/null +++ "b/\346\225\260\346\215\256\345\272\223json/swiper.json" @@ -0,0 +1 @@ +{"_id":"1","url":"https://7465-test-1grlfkhpfaea9d5d-1304152447.tcb.qcloud.la/logo.jpg?sign=c7dfbfeb3411b550d3f38819e3ade5fa&t=1676107500","navigateTo":"/pages/customerService/customerService"}