| | |
| | | export const queryShopByShopId = (params, config = {}) => http.get(URL + |
| | | '/payfour-merchant/v1/web/aggregatePayAllin/queryShopByShopId', params, config) |
| | | |
| | | /* 根据订单id */ |
| | | export const getOnlineId = (params, config = {}) => http.get(URL + |
| | | '/payfour-merchant/v1/web/aggregatePayAllin/getOnlineId', params, config) |
| | | |
| | | /*统一授权*/ |
| | | export const userLogin = (params, config = {}) => { |
| | | let path = '/payfour-merchant/v1/web/aggregatePayAllin/getOpenId' //微信授权 |
| | |
| | | baseURL: '/dev-api', |
| | | // baseURL: 'http://172.16.2.117:8080', |
| | | wx_appid: 'wx4c146dba764dcb05', |
| | | ali_appid: '2021004149689887' |
| | | ali_appid: '2021004193639959' |
| | | } |
| | | // 测试 |
| | | const test = { |
| | | webURL: 'https://sfzf.cpbtsoft.cn', |
| | | baseURL: 'https://sfzf.cpbtsoft.cn/dev-api', |
| | | baseURL: 'https://sfzf.cpbtsoft.cn/prod-api', |
| | | wx_appid: 'wx4c146dba764dcb05', |
| | | ali_appid: '2021004149689887' |
| | | ali_appid: '2021004193639959' |
| | | } |
| | | // 正式 |
| | | const prod = { |
| | |
| | | import App from './App' |
| | | import Vue from 'vue' |
| | | |
| | | import Vconsole from 'vconsole'; |
| | | new Vconsole(); |
| | | import uView from '@/uni_modules/uview-ui' |
| | | Vue.use(uView) |
| | | |
| | |
| | | {{ $utils.accMul(couponInfo.discount, 10) }}折券 |
| | | </view> |
| | | </block> |
| | | |
| | | <view v-else class="u-font-28 lh-1 u-tips-color">请选择</view> |
| | | <u-icon class="u-m-l-10" name="arrow-right" color="#999" size="16"></u-icon> |
| | | </view> |
| | |
| | | import { |
| | | queryShopByCid, |
| | | queryShopByShopId, |
| | | getOnlineId, |
| | | userLogin, |
| | | queryUseSweepPayCoupon, |
| | | getWechatConfigInfo, |
| | |
| | | buyerNote: '', |
| | | showRemark: false, |
| | | UNIONID: null, |
| | | payWay: this.$utils.getPlat(), //2 维信 5支付宝 15云闪付 |
| | | payWay: this.$utils.getPlat(), //2 微信 5支付宝 15云闪付 |
| | | cid: '', //码牌id C扫B静态码时有 |
| | | activityQrcodeId: '', //动态收款码 C扫B动态码时有 |
| | | shopId: '', //商户id C扫B动态码时有 |
| | | bordShow: false, // 显示键盘 |
| | | orderId: '', |
| | | orderId: '', //冀优邮线上订单id |
| | | shopInfo: { |
| | | cusid: '', |
| | | shopName: '', |
| | |
| | | onLoad(opt) { |
| | | uni.setStorageSync('CID', opt.cid) |
| | | uni.setStorageSync('SHOPID', opt.shopId) |
| | | uni.setStorageSync('ORDERID', opt.orderId) |
| | | uni.setStorageSync('SMONEY', opt.smoney) |
| | | uni.setStorageSync('AQCI', opt.activityQrcodeId) |
| | | this.UNIONID = uni.getStorageSync('UNIONID') || null |
| | |
| | | } else { |
| | | this.bordShow = true |
| | | } |
| | | if (opt.orderId) { |
| | | this.orderId = opt.orderId |
| | | this.init() |
| | | } |
| | | if (opt.activityQrcodeId) { |
| | | this.activityQrcodeId = opt.activityQrcodeId |
| | | // this.getOrderInfo() |
| | | } |
| | | if (opt.shopId) { |
| | | this.shopId = opt.shopId |
| | |
| | | shopId: this.shopId |
| | | } |
| | | } |
| | | if (this.orderId) { |
| | | api = getOnlineId |
| | | params = { |
| | | onlineId: this.orderId |
| | | } |
| | | } |
| | | //获取商铺信息 |
| | | api({ |
| | | params |
| | |
| | | res.logoImage = config.baseURL + res.logoImage |
| | | } |
| | | this.shopInfo = res |
| | | if(this.orderId){ |
| | | this.money = res.totaPrice |
| | | if(res.couponId){ |
| | | this.couponInfo = { |
| | | id: res.couponId, |
| | | thresholdValue: res.thresholdValue, |
| | | discount: res.discount, |
| | | discountType: res.discountType, |
| | | } |
| | | } |
| | | } |
| | | }).catch((err) => { |
| | | clearTimeout(timer) |
| | | this.shopInfo.scanFlag = 0 |
| | |
| | | wx.ready( ()=> { |
| | | wx.hideAllNonBaseMenuItem(); |
| | | if(CHECK_LOCATION){ |
| | | this.wxGetLocation() |
| | | this.wxGetLocation(null) |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | if(this.payWay == 5){ |
| | | ap.hideOptionButton(); |
| | | this.apGetLocation(null) |
| | | } |
| | | }, |
| | | apGetLocation(callback){ |
| | | ap.getLocation((res)=> { |
| | | console.log('apGetLocation',res) |
| | | if(res.latitude){ |
| | | this.lat = parseFloat(res.latitude).toFixed(6); // 纬度,浮点数,范围为90 ~ -90 |
| | | this.lng = parseFloat(res.longitude).toFixed(6); // 经度,浮点数,范围为180 ~ -180。 |
| | | if(callback) callback() |
| | | }else{ |
| | | uni.showModal({ |
| | | title: '提示', |
| | | content: "获取地理位置失败,无法进行支付!", |
| | | confirmText: '重新授权', |
| | | cancelText: '退出', |
| | | success: ret=>{ |
| | | if(ret.confirm){ |
| | | this.apGetLocation(callback) |
| | | }else{ |
| | | this.clickDone() |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | wxGetLocation(callback){ |
| | | wx.getLocation({ |
| | |
| | | cancelText: '退出', |
| | | success: ret=>{ |
| | | if(ret.confirm){ |
| | | this.wxGetLocation() |
| | | this.wxGetLocation(callback) |
| | | }else{ |
| | | this.clickDone() |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | } |
| | | }); |
| | | }, |
| | | // 获取会员相关信息 |
| | | showCoupon() { |
| | | if(this.orderId){ |
| | | return |
| | | } |
| | | if (this.UNIONID||this.payWay==5) { |
| | | if (uni.$u.test.isEmpty(this.money)) { |
| | | uni.$u.toast('请输入金额!') |
| | |
| | | }, |
| | | //获取用户优惠券 |
| | | queryUseSweepPayCoupon() { |
| | | //2 微信 5支付宝 15云闪付 |
| | | const applyPayWayStr = { |
| | | 2: 1, |
| | | 5: 2, |
| | |
| | | return |
| | | } |
| | | if(!this.lat){ |
| | | this.wxGetLocation(this.pay) |
| | | if(this.payWay == 2){ |
| | | this.wxGetLocation(this.pay) |
| | | } |
| | | if(this.payWay == 5){ |
| | | this.apGetLocation(this.pay) |
| | | } |
| | | }else{ |
| | | this.pay() |
| | | } |
| | |
| | | this.bordShow = false |
| | | // 金额 this.money |
| | | uni.showLoading() |
| | | const params = { |
| | | let params = { |
| | | money: this.$utils.accMul(this.money,100), |
| | | shopId: this.shopInfo.id, |
| | | payWay: this.payWay, |
| | |
| | | if (this.cid) { |
| | | params.cid = this.cid |
| | | } |
| | | if (this.orderId) { |
| | | params = {onlineId: this.onlineId} |
| | | } |
| | | //生成订单 |
| | | saveOrder(params).then(res => { |
| | | uni.hideLoading() |