From a75b9e79649b91ee1566f166becb2a1d0426a457 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=90=E6=98=8E=E6=98=8E?= <970899069@qq.com> Date: Fri, 7 Jan 2022 16:28:29 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=95=86=E5=9F=8E=E4=B8=8B=E5=8D=95?= =?UTF-8?q?=E8=B4=AD=E4=B9=B0=EF=BC=8C=E5=93=81=E7=B1=BB=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=EF=BC=8C=E9=92=B1=E5=8C=85=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apis/interfaces/store.js | 34 ++- package-lock.json | 181 +++++++++++++++ pages.json | 16 +- pages/address/index.vue | 9 +- pages/store/buy.vue | 103 +++++++-- pages/store/goods.vue | 15 +- pages/store/index.vue | 7 +- pages/store/list.vue | 53 ++++- pages/store/meals.vue | 74 ++++++ router/index.js | 2 +- store/index.js | 18 +- .../components/oct-address/oct-address.vue | 11 +- uni_modules/uni-number-box/changelog.md | 25 +++ .../uni-number-box/uni-number-box.vue | 211 ++++++++++++++++++ uni_modules/uni-number-box/package.json | 85 +++++++ uni_modules/uni-number-box/readme.md | 13 ++ wallet/Wallet.js | 126 +++++++++++ wallet/_test.js | 29 +++ wallet/index.js | 24 ++ wallet/networks.js | 209 +++++++++++++++++ 20 files changed, 1176 insertions(+), 69 deletions(-) create mode 100644 pages/store/meals.vue create mode 100644 uni_modules/uni-number-box/changelog.md create mode 100644 uni_modules/uni-number-box/components/uni-number-box/uni-number-box.vue create mode 100644 uni_modules/uni-number-box/package.json create mode 100644 uni_modules/uni-number-box/readme.md create mode 100644 wallet/Wallet.js create mode 100644 wallet/_test.js create mode 100644 wallet/index.js create mode 100644 wallet/networks.js diff --git a/apis/interfaces/store.js b/apis/interfaces/store.js index c34249d..e3c2a24 100644 --- a/apis/interfaces/store.js +++ b/apis/interfaces/store.js @@ -15,21 +15,49 @@ const mall = () =>{ } // 商品详情 -const goods = (id) => { +const goods = id => { return request({ url: 'mall/goods/' + id }) } // 套餐列表 -const meals = (id) => { +const meals = id => { return request({ url: 'mall/meals/' + id }) } +// 商品列表 +const lists = data => { + return request({ + url: 'mall/goods', + data + }) +} + +// 确认订单 +const buy = data => { + return request({ + url: 'mall/buy/goods', + data + }) +} + +// 商品下单 +const verify = data => { + return request({ + url: 'mall/buy/goods', + method: 'POST', + data + }) +} + export { mall, goods, - meals + meals, + lists, + buy, + verify } diff --git a/package-lock.json b/package-lock.json index 25e690b..c791e07 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2,6 +2,182 @@ "requires": true, "lockfileVersion": 1, "dependencies": { + "base-x": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", + "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "bech32": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/bech32/-/bech32-2.0.0.tgz", + "integrity": "sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg==" + }, + "bigi": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/bigi/-/bigi-1.4.2.tgz", + "integrity": "sha1-nGZalfiLiwj8Bc/XMfVhhZ1yWCU=" + }, + "bip-schnorr": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/bip-schnorr/-/bip-schnorr-0.6.4.tgz", + "integrity": "sha512-dNKw7Lea8B0wMIN4OjEmOk/Z5qUGqoPDY0P2QttLqGk1hmDPytLWW8PR5Pb6Vxy6CprcdEgfJpOjUu+ONQveyg==", + "requires": { + "bigi": "^1.4.2", + "ecurve": "^1.0.6", + "js-sha256": "^0.9.0", + "randombytes": "^2.1.0", + "safe-buffer": "^5.2.1" + } + }, + "bitcore-lib": { + "version": "8.25.25", + "resolved": "https://registry.npmjs.org/bitcore-lib/-/bitcore-lib-8.25.25.tgz", + "integrity": "sha512-H6qNCVl4M8/MglXhvc04mmeus1d6nrmqTJGQ+xezJLvL7hs7R3dyBPtOqSP3YSw0iq/GWspMd8f5OOlyXVipJQ==", + "requires": { + "bech32": "=2.0.0", + "bip-schnorr": "=0.6.4", + "bn.js": "=4.11.8", + "bs58": "^4.0.1", + "buffer-compare": "=1.1.1", + "elliptic": "^6.5.3", + "inherits": "=2.0.1", + "lodash": "^4.17.20" + } + }, + "bitcore-mnemonic": { + "version": "8.25.25", + "resolved": "https://registry.npmjs.org/bitcore-mnemonic/-/bitcore-mnemonic-8.25.25.tgz", + "integrity": "sha512-7HvRxHrmd+Rh0Ohl0SEDMKQBAM+FoevXbCFnxGju6H+uZjtWMOToHA8vUg0+B91pfEMjdt9mQVB/wSA8GMqnCA==", + "requires": { + "bitcore-lib": "^8.25.25", + "unorm": "^1.4.1" + } + }, + "bn.js": { + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", + "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" + }, + "bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha1-vhYedsNU9veIrkBx9j806MTwpCo=", + "requires": { + "base-x": "^3.0.2" + } + }, + "buffer-compare": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-compare/-/buffer-compare-1.1.1.tgz", + "integrity": "sha1-W+e+hTr4kZjR9N3AkNHWakiu9ZY=" + }, + "ecurve": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/ecurve/-/ecurve-1.0.6.tgz", + "integrity": "sha512-/BzEjNfiSuB7jIWKcS/z8FK9jNjmEWvUV2YZ4RLSmcDtP7Lq0m6FvDuSnJpBlDpGRpfRQeTLGLBI8H+kEv0r+w==", + "requires": { + "bigi": "^1.1.0", + "safe-buffer": "^5.0.1" + } + }, + "elliptic": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", + "requires": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + }, + "dependencies": { + "bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + } + } + }, + "hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + }, + "dependencies": { + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + } + } + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "inherits": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", + "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=" + }, + "js-sha256": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/js-sha256/-/js-sha256-0.9.0.tgz", + "integrity": "sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA==" + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" + }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + }, "uni-read-pages": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/uni-read-pages/-/uni-read-pages-1.0.5.tgz", @@ -12,6 +188,11 @@ "resolved": "https://registry.npmjs.org/uni-simple-router/-/uni-simple-router-2.0.7.tgz", "integrity": "sha512-8FKv5dw7Eoonm0gkO8udprrxzin0fNUI0+AvIphFkFRH5ZmP5ZWJ2pvnWzb2NiiqQSECTSU5VSB7HhvOSwD5eA==" }, + "unorm": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/unorm/-/unorm-1.6.0.tgz", + "integrity": "sha512-b2/KCUlYZUeA7JFUuRJZPUtr4gZvBh7tavtv4fvk4+KV9pfGiR6CQAQAWl49ZpR3ts2dk4FYkP7EIgDJoiOLDA==" + }, "uview-ui": { "version": "2.0.19", "resolved": "https://registry.npmjs.org/uview-ui/-/uview-ui-2.0.19.tgz", diff --git a/pages.json b/pages.json index fcdfb4c..0729602 100644 --- a/pages.json +++ b/pages.json @@ -95,7 +95,7 @@ "path": "pages/address/index", "name": "Address", "style": { - "navigationBarTitleText": "地址" + "navigationBarTitleText": "收货地址" } }, { "path": "pages/address/edit", @@ -105,17 +105,25 @@ "enablePullDownRefresh": false } }, { - "path": "pages/pay/pay", + "path": "pages/pay/pay", "name": "Pay", "style": { "navigationBarTitleText": "收银台", "navigationBarBackgroundColor": "#FFFFFF" } }, { - "path": "pages/store/list", + "path": "pages/store/list", "name": "StoreList", "style": { - "navigationBarTitleText": "列表", + "navigationBarTitleText": "商品", + "navigationBarBackgroundColor": "#FFFFFF", + "enablePullDownRefresh": true + } + }, { + "path": "pages/store/meals", + "name": "StoreMeals", + "style": { + "navigationBarTitleText": "套餐", "navigationBarBackgroundColor": "#FFFFFF", "enablePullDownRefresh": true } diff --git a/pages/address/index.vue b/pages/address/index.vue index 2f13d2f..73da631 100644 --- a/pages/address/index.vue +++ b/pages/address/index.vue @@ -1,15 +1,15 @@ @@ -73,7 +73,8 @@ export default { }, methods: { onInfo(val){ - console.log(val) + this.$store.commit('setAddress', val) + this.$Router.back() }, add(){ console.log("新增地址") diff --git a/pages/store/buy.vue b/pages/store/buy.vue index ed136ab..37b140e 100644 --- a/pages/store/buy.vue +++ b/pages/store/buy.vue @@ -1,52 +1,97 @@ @@ -99,6 +144,18 @@ } } } + .address-new{ + padding: $padding; + text-align: center; + height: 90rpx; + line-height: 90rpx; + color: $main-color; + .icon{ + vertical-align: middle; + margin-bottom: 8rpx; + margin-right: 10rpx; + } + } // 订单列表 .goods-item{ display: flex; @@ -130,8 +187,8 @@ } } .order-sum{ - font-size: 26rpx; - color: #777; + font-size: $title-size-sm; + color: $text-gray; } } } diff --git a/pages/store/goods.vue b/pages/store/goods.vue index d0638d9..5b828aa 100644 --- a/pages/store/goods.vue +++ b/pages/store/goods.vue @@ -23,11 +23,13 @@ 销量{{goods.sales}} - + - + + + @@ -65,7 +67,12 @@ }) }, buy(){ - console.log(buy) + this.$Router.push({ + name: 'StoreBuy', + params: { + skuId: this.goods.skus[0].sku_id + } + }) } } } diff --git a/pages/store/index.vue b/pages/store/index.vue index 3c9f739..df84975 100644 --- a/pages/store/index.vue +++ b/pages/store/index.vue @@ -17,7 +17,7 @@ - + {{item.name}} @@ -40,7 +40,7 @@ - + {{item.title}} {{item.subtitle}} @@ -78,15 +78,12 @@ methods:{ getMall(){ mall().then(res => { - console.log(res) this.banners = res.banners this.goodsArr = res.goods this.newGood = res.news this.goodTabs = res.categories this.meals = res.meals uni.stopPullDownRefresh() - }).catch(err => { - console.log(err) }) } }, diff --git a/pages/store/list.vue b/pages/store/list.vue index 52df698..6f76550 100644 --- a/pages/store/list.vue +++ b/pages/store/list.vue @@ -1,5 +1,10 @@