<view class="nav-bar" :style="{height:navHeight+'px'}"> | <view class="nav-bar" :style="{height:navHeight+'px'}"> | ||||
<view class="title" | <view class="title" | ||||
:style="{paddingTop:searchMarginTop+'px',height:searchHeight+'px',lineHeight:searchHeight+'px'}"> | :style="{paddingTop:searchMarginTop+'px',height:searchHeight+'px',lineHeight:searchHeight+'px'}"> | ||||
<block v-if="isBack"> | |||||
<block v-if="isBack && !isAlipay"> | |||||
<image :src="`/static/image/icon-back.png`" mode="aspectFill" | <image :src="`/static/image/icon-back.png`" mode="aspectFill" | ||||
:style="{height:searchHeight+'px',width:searchHeight+'px'}" class="back" @click="back"></image> | :style="{height:searchHeight+'px',width:searchHeight+'px'}" class="back" @click="back"></image> | ||||
</block> | </block> | ||||
const searchMarginTop = ref(null) | const searchMarginTop = ref(null) | ||||
const searchHeight = ref(32) | const searchHeight = ref(32) | ||||
const searchWidth = ref(32) | const searchWidth = ref(32) | ||||
const isAlipay = ref(false) | |||||
onMounted(() => { | onMounted(() => { | ||||
const menuButtonInfo = uni.getMenuButtonBoundingClientRect() | const menuButtonInfo = uni.getMenuButtonBoundingClientRect() | ||||
const type = uni.getSystemInfoSync().uniPlatform | |||||
isAlipay.value = type === 'mp-alipay' | |||||
const { | const { | ||||
top, | top, | ||||
width, | width, |
"navigationStyle": "custom", | "navigationStyle": "custom", | ||||
"mp-alipay": { //在支付宝小程序中如果不生效 就加上这两行代码 就会生效啦 | "mp-alipay": { //在支付宝小程序中如果不生效 就加上这两行代码 就会生效啦 | ||||
"transparentTitle": "always", | "transparentTitle": "always", | ||||
"titlePenetrate": "YES" | |||||
"titlePenetrate": "YES", | |||||
"defaultTitle": "" // 将导航栏默认的 title 置空 | |||||
} | } | ||||
} | } | ||||
}, | }, |
//调用方式 | //调用方式 | ||||
request(accountLogin, options).then((res) => { | request(accountLogin, options).then((res) => { | ||||
let data = stringToJson(res.bizContent) | |||||
let data = JSON.parse(res.bizContent); | |||||
console.log(data, "#################"); | console.log(data, "#################"); | ||||
navTo(`/subpackage/after-sale/account-recharge/index?name=state.name`); | navTo(`/subpackage/after-sale/account-recharge/index?name=state.name`); | ||||
}) | }) |
CardBillQuery, | CardBillQuery, | ||||
CardBillPlaceOrder, | CardBillPlaceOrder, | ||||
CardBillPayStatus, | CardBillPayStatus, | ||||
wechatPayConfigId | |||||
wechatPayConfigId, | |||||
aliPayConfigId, | |||||
obtainUserId | |||||
} from "@/utils/network/api.js"; | } from "@/utils/network/api.js"; | ||||
import { | import { | ||||
request | request | ||||
//掉起微信支付 | //掉起微信支付 | ||||
const wxPayment = () => { | const wxPayment = () => { | ||||
if (state.suppleNoList.length > 0) { | |||||
// #ifdef MP-WEIXIN | |||||
const options = { | |||||
type: 2, | |||||
data: { | |||||
openid: state.openid, | |||||
suppleNoList: state.suppleNoList, | |||||
totalFee: allPrice.value * 100, | |||||
payConfigId: wechatPayConfigId, | |||||
}, | |||||
method: "POST", | |||||
showLoading: true, | |||||
}; | |||||
request(CardBillPlaceOrder, options).then((res) => { | |||||
const data = stringToJson(res.bizContent); | |||||
state.orderId = data.orderId | |||||
uni.requestPayment({ | |||||
provider: "wxpay", | |||||
orderInfo: "", | |||||
timeStamp: data.timestamp, | |||||
nonceStr: data.noncestr, | |||||
package: data.wxPackage ?data.wxPackage: "", | |||||
signType: data.signType, | |||||
paySign: data.sign, | |||||
success: function(e) { | |||||
console.log("支付成功", e); | |||||
checkOrder(); | |||||
}, | |||||
fail: function(err) { | |||||
confirm(err, () => {}, "支付失败", false); | |||||
if (state.suppleNoList.length > 0) { | |||||
// #ifdef MP-WEIXIN | |||||
const options = { | |||||
type: 2, | |||||
data: { | |||||
openid: state.openid, | |||||
suppleNoList: state.suppleNoList, | |||||
totalFee: allPrice.value * 100, | |||||
payConfigId: wechatPayConfigId, | |||||
}, | }, | ||||
method: "POST", | |||||
showLoading: true, | |||||
}; | |||||
request(CardBillPlaceOrder, options).then((res) => { | |||||
const data = stringToJson(res.bizContent); | |||||
state.orderId = data.orderId | |||||
uni.requestPayment({ | |||||
provider: "wxpay", | |||||
orderInfo: "", | |||||
timeStamp: data.timestamp, | |||||
nonceStr: data.noncestr, | |||||
package: data.wxPackage ?data.wxPackage: "", | |||||
signType: data.signType, | |||||
paySign: data.sign, | |||||
success: function(e) { | |||||
console.log("支付成功", e); | |||||
checkOrder(); | |||||
}, | |||||
fail: function(err) { | |||||
confirm(err, () => {}, "支付失败", false); | |||||
}, | |||||
}); | |||||
}); | }); | ||||
}); | |||||
// #endif | |||||
} else { | |||||
msg("未勾选补缴订单!") | |||||
} | |||||
// #endif | |||||
// #ifdef MP-ALIPAY | |||||
my.getAuthCode({ | |||||
scopes: 'auth_user', | |||||
success: res => { | |||||
const optionsUser = { | |||||
type: 2, | |||||
data: { | |||||
payConfigId: aliPayConfigId, | |||||
code: res.authCode | |||||
}, | |||||
method: "POST", | |||||
showLoading: true, | |||||
}; | |||||
console.log('支付宝用户编号请求:',optionsUser) | |||||
request(obtainUserId, optionsUser).then((res) => { | |||||
console.log('支付宝用户编号返回:',res) | |||||
const data = stringToJson(res.bizContent); | |||||
const optionsali = { | |||||
type: 2, | |||||
data: { | |||||
openid: data.userId, | |||||
suppleNoList: state.suppleNoList, | |||||
totalFee: allPrice.value * 100, | |||||
payConfigId: aliPayConfigId, | |||||
}, | |||||
method: "POST", | |||||
showLoading: true, | |||||
}; | |||||
console.log('支付下单请求:',optionsali) | |||||
request(CardBillPlaceOrder, optionsali).then((res) => { | |||||
console.log('支付下单返回:',res) | |||||
const data = stringToJson(res.bizContent); | |||||
state.orderId = data.orderId | |||||
my.tradePay ({ | |||||
// 调用统一收单交易创建接口(alipay.trade.create),获得返回字段支付宝交易号 trade_no | |||||
tradeNO: data.prepayId, | |||||
success: res => { | |||||
console.log("支付成功", res); | |||||
checkOrder(); | |||||
}, | |||||
fail: res => { | |||||
confirm(res, () => {}, "支付失败", false); | |||||
}, | |||||
}); | |||||
}); | |||||
}); | |||||
}, | |||||
fail: err => { | |||||
console.log('my.getAuthCode 调用失败', err) | |||||
} | |||||
}); | |||||
// #endif | |||||
} else { | |||||
msg("未勾选补缴订单!") | |||||
} | |||||
}; | }; | ||||
export const appId = "52030131"; //应用appid 综合业务支撑平台使用 | export const appId = "52030131"; //应用appid 综合业务支撑平台使用 | ||||
export const loginTime = 86400; //登录有效时间(单位s) 1天 | export const loginTime = 86400; //登录有效时间(单位s) 1天 | ||||
export const wechatPayConfigId = "6a9a54bc01f6443faea7ffe132b19f6"; //支付配置编号 微信小程序支付:6a9a54bc01f6443faea7ffe132b19f6 | export const wechatPayConfigId = "6a9a54bc01f6443faea7ffe132b19f6"; //支付配置编号 微信小程序支付:6a9a54bc01f6443faea7ffe132b19f6 | ||||
export const aliPayConfigId = "6a9a54bc01f6443123452b1234"; //支付配置编号 支付宝小程序支付:6a9a54bc01f6443123452b1234 | |||||
export const wechatAppID = "wx8fba957179c1329a"; //九州小程序APPid:wx008c60533388527a | export const wechatAppID = "wx8fba957179c1329a"; //九州小程序APPid:wx008c60533388527a | ||||
export const wechatSecret = "699c10826113ddb350fbe58a96e2b015"; //九州小程序AppSecret:95197718b43b497f02732bd9f8011080 | export const wechatSecret = "699c10826113ddb350fbe58a96e2b015"; //九州小程序AppSecret:95197718b43b497f02732bd9f8011080 | ||||
// export const sm4Key = "5dc11f854ceca1473e1a5075ed16eb226b4543a9a05fe50f7fba40f898099ce34abba69a07a20509f315f94d808a4d0e988935588858f65a"; | // export const sm4Key = "5dc11f854ceca1473e1a5075ed16eb226b4543a9a05fe50f7fba40f898099ce34abba69a07a20509f315f94d808a4d0e988935588858f65a"; | ||||
export const getToken = "1006"; //统一会员平台登录确认接口(用于换取openId和token) | export const getToken = "1006"; //统一会员平台登录确认接口(用于换取openId和token) | ||||
export const checkCode = "966"; //校验验证码 | export const checkCode = "966"; //校验验证码 | ||||
export const register = "52de4029940f4e03b18c3a0b8d64c2db";//USER-无感注册登录(个人/企业) | export const register = "52de4029940f4e03b18c3a0b8d64c2db";//USER-无感注册登录(个人/企业) | ||||
export const obtainUserId = "58760acb637245729e971597a1fb92c4";//获取第三方用户标识 | |||||
/*地址管理*/ | /*地址管理*/ | ||||
export const addressQuery = "27"; //地址管理查询 | export const addressQuery = "27"; //地址管理查询 |