diff --git a/config/config.js b/config/config.js index 98502ba..1c92e0c 100755 --- a/config/config.js +++ b/config/config.js @@ -1,11 +1,11 @@ var extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {}; var appId = extConfig.appId; var config = { - // url: "https://ciformall.youlane.cn/C/api", + url: "https://ciformall.youlane.cn/C/api", // url:"https://c.malls.iformall.com/C/api", - url:'https://ctest.malls.iformall.com/C/api', + // url:'https://ctest.malls.iformall.com/C/api', // url:'http://10.100.33.68:7000/C/api', - // url: 'http://10.100.30.172:7000/C/api', + // url: 'http://202.165.179.86:4000/C/api', api: { /** * 接口用途:login @@ -195,11 +195,15 @@ var config = { /** * C端扫B端储值卡交易流水列表接口 */ - cardpayList:"/cardPay/list" + cardpayList:"/cardPay/list", + /** + * 根据code查询接口 + */ + findByCode:"/merchant/findByCode" }, weapp: { - AppId: "wx649b3be73c1afe47" + AppId: "wxea71200db93d756b" }, ErrorCode: { diff --git a/pages/cardorder/index/index.js b/pages/cardorder/index/index.js index e081b51..7ee7c27 100644 --- a/pages/cardorder/index/index.js +++ b/pages/cardorder/index/index.js @@ -54,18 +54,34 @@ Page({ let that = this; wx.scanCode({ success: (res) => { - console.log(JSON.parse(res.result).merchant_id) - if (JSON.parse(res.result).merchant_id && e.currentTarget.dataset.cardid && e.currentTarget.dataset.remainingamount) { - wx.navigateTo({ - url: `/pages/scanPay/scanPay?merChant=${res.result}&cardid=${e.currentTarget.dataset.cardid}&remainingAmount=${e.currentTarget.dataset.remainingamount}`, + console.log(res.result) + Http.get({ + url: config.api.findByCode, + data: { + merchantCode: res.result, + } + }) + .then(res => { + console.log(res); + if (res.code == 200) { + let merChantDetail = JSON.stringify(res.data); + if (merChantDetail && e.currentTarget.dataset.cardid && e.currentTarget.dataset.remainingamount) { + wx.navigateTo({ + url: `/pages/scanPay/scanPay?merChant=${merChantDetail}&cardid=${e.currentTarget.dataset.cardid}&remainingAmount=${e.currentTarget.dataset.remainingamount}`, + }) + } else { + wx.showToast({ + title: "未识别到商户二维码", + icon: "none", + mask: false + }) + } + } }) - } else { - wx.showToast({ - title: "未识别到商户二维码", - icon: "none", - mask: false + .catch(err => { + console.log(err) }) - } + }, fail: (res) => { console.log(res); diff --git a/pages/scanPay/scanPay.js b/pages/scanPay/scanPay.js index c5fe9bf..ff03d8e 100644 --- a/pages/scanPay/scanPay.js +++ b/pages/scanPay/scanPay.js @@ -12,7 +12,9 @@ Page({ focus: true, inputValue: '', cardList: [], + arrays:[], showModel: false, + ids:"" }, /** @@ -23,7 +25,9 @@ Page({ that.setData({ merChant: JSON.parse(options.merChant), cardid: options.cardid, - remainingAmount: options.remainingAmount + cardids:options.cardid, + remainingAmount: options.remainingAmount, + remainingAmounts: options.remainingAmount, }) }, bindKeyInput(e) { @@ -43,7 +47,13 @@ Page({ that.gotoPay() }, fail: (err) => { - + wx.hideLoading(); + that.setData({ + showModel:false, + cardid: that.data.cardids, + ids:"", + remainingAmount: that.data.remainingAmounts + }) } }) } @@ -83,11 +93,12 @@ Page({ }, gotoPay: function () { let that = this; + console.log(that.data.cardid) Http.post({ url: config.api.cardPayOrder, data: { cardId: that.data.cardid, - merchantCode: that.data.merChant.merchant_id, + merchantId: that.data.merChant.id, totalFee: that.data.inputValue } }) @@ -109,11 +120,16 @@ Page({ content: err.message, showCancel: false }) + that.setData({ + cardid: that.data.cardids, + ids:"", + remainingAmount: that.data.remainingAmounts + }) }) }, - // 指纹识别 - startAuth(e) { + check:function(e){ let that = this; + console.log(e.currentTarget.dataset.id) if (e) { if (e.currentTarget.dataset.flags == 'check') { that.setData({ @@ -123,6 +139,9 @@ Page({ }) } } + }, + startAuth(e) { + let that = this; if (that.data.inputValue == "" || that.data.inputValue == 0) { wx.showModal({ title: '抱歉', @@ -133,11 +152,16 @@ Page({ that.setData({ showModel: true }) - that.getList('notenogth'); + that.getList(); + console.log("1111") } else if (that.data.inputValue != "" && Number(that.data.remainingAmount) >= Number(that.data.inputValue)) { wx.showLoading({ - title: '付款中', + title: '加载中', }) + console.log("222") + setTimeout(function(){ + wx.hideLoading(); + },1500) that.gotoPayMoney(); } }, @@ -164,16 +188,22 @@ Page({ .then(res => { console.log(res) if (res.code == 200) { + let arrays = []; res.data.list.map(file => { - file.merchantVoList.map(files => { - if (files.id == that.data.merChant.merchant_id) { - file.flag = true - } - }) + if (file.remainingAmount / 100 >= that.data.inputValue){ + file.merchantVoList.map(files => { + if (files.id == that.data.merChant.id) { + file.flag = true; + arrays.push(file); + } + }) + } }) + console.log(arrays) that.setData({ showPage: true, - cardList: res.data.list + cardList: res.data.list, + arrays: arrays }) } }) @@ -187,7 +217,11 @@ Page({ }, showModel: function () { this.setData({ - showModel: false + showModel: false, + cardid: this.data.cardids, + ids:"", + remainingAmount: this.data.remainingAmounts }) + console.log(this.data.cardid) }, }) \ No newline at end of file diff --git a/pages/scanPay/scanPay.wxml b/pages/scanPay/scanPay.wxml index 7e51847..c28bef3 100644 --- a/pages/scanPay/scanPay.wxml +++ b/pages/scanPay/scanPay.wxml @@ -1,7 +1,7 @@ - 付款给{{merChant.merchant_name}} - + 付款给{{merChant.merchantName}} + 金额 @@ -17,7 +17,7 @@ - + @@ -27,15 +27,26 @@ 余额:{{item.remainingAmount/100}}元 - - + + + + + + + {{item.id}} + + + 余额:{{item.remainingAmount/100}}元 + + - + + diff --git a/pages/scanPay/scanPay.wxss b/pages/scanPay/scanPay.wxss index 8f2eba7..66909b0 100644 --- a/pages/scanPay/scanPay.wxss +++ b/pages/scanPay/scanPay.wxss @@ -80,10 +80,10 @@ } .card-top{ position: relative; - height: 75rpx; + height: 85rpx; width: 100%; background: #E67663; - line-height: 75rpx; + line-height: 85rpx; text-align: center; font-size:30rpx; font-weight:500; diff --git a/project.config.json b/project.config.json index 2970aaf..4e30ca0 100644 --- a/project.config.json +++ b/project.config.json @@ -13,7 +13,7 @@ }, "compileType": "miniprogram", "libVersion": "2.0.9", - "appid": "wx649b3be73c1afe47", + "appid": "wxea71200db93d756b", "projectname": "C", "isGameTourist": false, "condition": {