From 03dac6b1ee773fc7586d11ff36eadc3c3cae93bd Mon Sep 17 00:00:00 2001 From: woniudiancang <2557188530@qq.com> Date: Tue, 23 Nov 2021 11:37:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=95=86=E5=93=81=E5=8C=BA?= =?UTF-8?q?=E5=88=86=E9=97=A8=E5=BA=97=E6=98=BE=E7=A4=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 24 ++++++++++++++++++++++++ app.js | 2 +- config.js | 4 ++-- pages/index/index.js | 26 +++++++++++++++++++------- pages/shop/select.js | 1 + project.config.json | 8 +++++--- 6 files changed, 52 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index bd977b9..96f8618 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,25 @@ APPID 务必要改成你自己的小程序的 APPID 重新进入小程序以后,就可以看见 “扫码核销” 的菜单了 +# 配置说明 + +## 如何修改小程序首页标题 + +登录后台,左侧菜单 “系统设置” --> “系统参数” ,添加一个文本类型的参数: mallName (注意大小写),小程序即可显示你后台填的名称 + +## 根据选择的不同门店,区分显示商品(只显示当前门店的商品) + +登录后台,左侧菜单 “系统设置” --> “系统参数” ,添加一个开关类型的参数: shop_goods_split,开启为区分,关闭为不区分 + +## 如何显示销量 + +商品列表接口、商品详情接口,都会返回商品的销量数据,分别是 numberOrders 和 numberSells 两个字段,你可以在界面上任何希望显示销量的地方,进行展示即可 + +- numberOrders 订单数量 +- numberSells 商品数量 + +假如说用户下了一个订单一次性购买10份这个商品,那么 numberOrders = 1 ,numberSells = 10 + # 常见问题 ## 无法登陆 / 无法获取 openid @@ -137,3 +156,8 @@ APPID 务必要改成你自己的小程序的 APPID - 点击你的小程序开发工具 右上角 的“详情” --> “基本信息” 中的 appid - 登录你的 api工厂 后台(https://admin.it120.cc),左侧菜单微信设置中的 appid +## 获取手机号码失败,提示没权限 + +https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getPhoneNumber.html + +官方文档有说明,获取手机号码的前提条件是:非个人开发者,且完成了认证的小程序开放(不包含海外主体) \ No newline at end of file diff --git a/app.js b/app.js index 281f95c..f283fb3 100644 --- a/app.js +++ b/app.js @@ -53,7 +53,7 @@ App({ wx.hideToast() } }) - WXAPI.queryConfigBatch('mallName,myBg,mapPos,order_hx_uids,subscribe_ids,share_profile,zxdz,admin_uids').then(res => { + WXAPI.queryConfigBatch('mallName,myBg,mapPos,order_hx_uids,subscribe_ids,share_profile,zxdz,admin_uids,shop_goods_split').then(res => { if (res.code == 0) { res.data.forEach(config => { wx.setStorageSync(config.key, config.value); diff --git a/config.js b/config.js index e640f4b..ad1236a 100644 --- a/config.js +++ b/config.js @@ -1,5 +1,5 @@ module.exports = { - version: "3.10.0", - note: '扫码点餐bug', + version: "3.11.0", + note: '增加商品区分门店显示功能', subDomain: "beeorder", // 根据教程 https://www.it120.cc/help/qr6l4m.html 查看并设置你自己的 subDomain } \ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js index 06bf2dc..2fff9c5 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -146,6 +146,12 @@ Page({ shopIsOpened: this.checkIsOpened(res.data[0].openingHours) }) wx.setStorageSync('shopInfo', res.data[0]) + const shop_goods_split = wx.getStorageSync('shop_goods_split') + if (shop_goods_split == '1') { + // 商品需要区分门店 + wx.setStorageSync('shopIds', res.data[0].id) // 当前选择的门店 + this.getGoodsList() + } } }, async _showCouponPop() { @@ -191,9 +197,20 @@ Page({ categories: res.data, categorySelected: res.data[0] }) - this.getGoodsList() + const shop_goods_split = wx.getStorageSync('shop_goods_split') + if (shop_goods_split != '1') { + this.getGoodsList() + } }, async getGoodsList() { + const shop_goods_split = wx.getStorageSync('shop_goods_split') + if (shop_goods_split == '1') { + // 商品需要区分门店 + const shopIds = wx.getStorageSync('shopIds') // 当前选择的门店 + if (!shopIds) { + return + } + } wx.showLoading({ title: '', }) @@ -237,12 +254,7 @@ Page({ }, async shippingCarInfo() { const res = await WXAPI.shippingCarInfo(wx.getStorageSync('token')) - if (res.code == 700) { - this.setData({ - shippingCarInfo: null, - showCartPop: false - }) - } else if (res.code == 0) { + if (res.code == 0) { this.setData({ shippingCarInfo: res.data }) diff --git a/pages/shop/select.js b/pages/shop/select.js index 9af60df..819d4ae 100644 --- a/pages/shop/select.js +++ b/pages/shop/select.js @@ -67,6 +67,7 @@ Page({ goShop(e){ const idx = e.currentTarget.dataset.idx wx.setStorageSync('shopInfo', this.data.shops[idx]) + wx.setStorageSync('shopIds', this.data.shops[idx].id) // 当前选择的门店 if (this.data.type == 'pay') { wx.navigateBack() } else { diff --git a/project.config.json b/project.config.json index 01d915b..ee80b6e 100644 --- a/project.config.json +++ b/project.config.json @@ -21,8 +21,8 @@ "checkSiteMap": true, "uploadWithSourceMap": true, "compileHotReLoad": true, - "useMultiFrameRuntime": true, - "useApiHook": true, + "useMultiFrameRuntime": false, + "useApiHook": false, "useApiHostProcess": false, "babelSetting": { "ignore": [], @@ -35,8 +35,10 @@ "packNpmManually": false, "packNpmRelationList": [], "minifyWXSS": true, + "disableUseStrict": false, + "minifyWXML": true, "showES6CompileOption": false, - "minifyWXML": true + "useCompilerPlugins": false }, "compileType": "miniprogram", "libVersion": "2.19.5",