From 1ac4d505690313d3a73ec4966dee85b2c1bbca01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AA=86=E8=B6=85?= <> Date: Mon, 3 Apr 2023 16:28:17 +0800 Subject: [PATCH] =?UTF-8?q?g7=E5=8A=A0=E6=B2=B9=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/g7.js | 6 +- api/oli-site.js | 8 ++ .../station-info/scan-camera/scan-camera.vue | 4 +- pages/stationDetail/ZYSite.vue | 92 ++++++++++++++++++- utils/request.js | 4 +- 5 files changed, 104 insertions(+), 10 deletions(-) diff --git a/api/g7.js b/api/g7.js index 528889d..85c8364 100644 --- a/api/g7.js +++ b/api/g7.js @@ -1,11 +1,11 @@ import request from '@/utils/request' -const service_name = "cloud-site-service" -const group_name = "tbOilOrder" +const service_name = "oil-site" +const group_name = "g7" export default { // G7订单支付状态 getPayStatus(id) { return request({ - url: `/${service_name}/${group_name}/get/${id} `, + url: `/${service_name}/${group_name}/getOrderStatus/${id} `, method: 'get', }) } diff --git a/api/oli-site.js b/api/oli-site.js index 5750ba9..83f4859 100644 --- a/api/oli-site.js +++ b/api/oli-site.js @@ -52,6 +52,14 @@ export default{ data: data }) }, + // G7下单接口 + G7Pay(data) { + return request({ + url: `/${service_name}/g7/qrCodePay`, + method: 'post', + data: data + }) + }, // 则一下单接口 zeyiPay(data) { return request({ diff --git a/pages/station-info/scan-camera/scan-camera.vue b/pages/station-info/scan-camera/scan-camera.vue index 93cddf7..a24a8f4 100644 --- a/pages/station-info/scan-camera/scan-camera.vue +++ b/pages/station-info/scan-camera/scan-camera.vue @@ -120,7 +120,9 @@ if (res.indexOf('fykc') != -1 ){ url = '/pages/stationDetail/ZYSite?type=fykc' console.log('这里是测试福佑' ,res.substring(0,7)) - }else if (tag == "XM" || tag == "HT" || tag == "G7") { + }else if (tag == "SP") { + url = '/pages/stationDetail/ZYSite?type=G7' + } else if (tag == "XM" || tag == "HT" || tag == "G7") { url = '/pages/stationDetail/stationDetail?type=G7' } else if (res.indexOf('ZEYI') != -1 ){ console.log('这里是测试则一sss' ,res.substring(0,7)) diff --git a/pages/stationDetail/ZYSite.vue b/pages/stationDetail/ZYSite.vue index c0df495..090785f 100644 --- a/pages/stationDetail/ZYSite.vue +++ b/pages/stationDetail/ZYSite.vue @@ -403,7 +403,7 @@ // this.type = 'fykc' //根据option.type 进行本地赋值 // } if (this.qrCode) { - if (this.qrCode.substr(0, 2) == 'HT' || this.qrCode.substr(0, 2) == 'G7') { + if (this.qrCode.substr(0, 2) == 'HT' || this.qrCode.substr(0, 2) == 'G7'|| this.type === 'G7') { this.isG7 = true console.log('G7加油站') } @@ -650,6 +650,10 @@ this.SfOrder() return } + if (this.type === 'G7') { + this.G7Order() + return + } if (this.type == 'fykc') { this.FyOrder() return @@ -851,6 +855,87 @@ url: '/pages/stationDetail/OrderStatus?item=' + item }) }, + // g7 + G7Order() { + const g7OrderInfo = { + qr_code: uni.getStorageSync('qrCode'), //类型:String 必有字段 二维码 qrcode + station_id: this.siteData.siteId, //类型:String 必有字段 油站id siteId + oilPriceId: this.insertResult.priceId, //类型:String 必有字段 油价id priceId + driver_phone: this.siteData.customerPhone, //类型:String 必有字段 油价id priceId + companyId: this.siteData.companyId, //类型:String 必有字段 企业id companyId + customerId: this.siteData.customerId, //类型:String 必有字段 司机id customerId + truck_no: this.carNumber, + gun_money: this.insertResult.vol, //类型:String 必有字段 备注:加油升数 + gun_number: this.insertResult.bar, //类型:String 必有字段 备注:加油升数 + deduction_mode: 1, + } + console.log("加油信息===================",this.insertResult) + console.log(g7OrderInfo) + if (!g7OrderInfo.qr_code) { + uni.showToast({ + title: 'qr_code为空', + icon: 'none' + }); + this.shake=null + return false + } + if (!g7OrderInfo.station_id) { + uni.showToast({ + title: '请选择油站id', + icon: 'none' + }); + this.shake=null + return false + } + if (!g7OrderInfo.companyId) { + uni.showToast({ + title: '请选择企业id', + icon: 'none' + }); + this.shake=null + return false + } + if (!g7OrderInfo.customerId) { + uni.showToast({ + title: '请选择司机id', + icon: 'none' + }); + this.shake=null + return false + } + if (!g7OrderInfo.gun_money) { + uni.showToast({ + title: '请输入加油金额', + icon: 'none' + }); + this.shake=null + return false + } + oliSiteApi.G7Pay(g7OrderInfo).then(res => { + if (res.code === 20000) { + uni.showToast({ + title: '下单成功!' + }); + uni.setStorageSync('orderSource', 'mpxoil') + console.log("是否是g7================",this.isG7) + if (!this.isG7) { + setTimeout(() => { + this.toDetails(res.data.orderId) + }, 400) + } else { + this.beforePay = false + setTimeout(() => { + this.orderId = res.data.orderId + console.log("queryTimer",this.orderId) + this.queryTimer() + console.log("getPayStatus",this.orderId) + this.getPayStatus(this.orderId) + }, 400) + } + this.shake=null + } + }) + }, //日日顺 RrsOrder() { const data6 = { @@ -970,8 +1055,6 @@ companyId: this.siteData.companyId, //类型:String 必有字段 备注:企业id oilsBar: this.insertResult.bar, oilsCode: this.insertResult.oilProductCode, - version: 1, - xoilAmountGun: this.insertResult.vol, orderMethod: "SITE_SCAN", //类型:String 必有字段 备注:订单产生方式 suppleMark: 0, orderType: "REAL_ORDER", //类型:String 必有字段 备注:订单类型 ( REAL_ORDER:真实订单 VIRTUAL_ORDER:虚拟订单) @@ -1225,11 +1308,12 @@ } if (res.data.payState == 1) { clearInterval(this.timer) - this.toDetails(res.data.payOrderId) + this.toDetails(id) } } }) }, + toDetails(id) { uni.setStorageSync('orderId', id) console.log('id', id) diff --git a/utils/request.js b/utils/request.js index 4987c1c..f14d4ad 100644 --- a/utils/request.js +++ b/utils/request.js @@ -2,12 +2,12 @@ import axios from 'axios' import utils from '@/utils/encode' // const env = 'test' /* */ -// const env = 'test'// 仅用于测试、 + // const env = 'test'// 仅用于测试、 const env = 'production' //42 洛超 /29 孙志华 /40 阿浩 // 测试日日顺时需要连阿浩 -const testUrl = 'http://192.168.54:38080' +const testUrl = 'http://192.168.0.26:38080' // const productionUrl = 'https://www.51xingka.net/oilApp' // 生产,加密 old // const productionUrl = 'https://www.xingoil.com/adminapi' // 生产,加密 new // const productionUrl = 'https://www.xingoil.com/adminapi' // 生产,加密 new