Przeglądaj źródła

小程序异常修改与欠费补缴支付宝支付

yxb
skx 1 rok temu
rodzic
commit
a6fa91a5e6

+ 4
- 1
components/nav-bar/nav-bar.vue Wyświetl plik

@@ -2,7 +2,7 @@
<view class="nav-bar" :style="{height:navHeight+'px'}">
<view class="title"
: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"
:style="{height:searchHeight+'px',width:searchHeight+'px'}" class="back" @click="back"></image>
</block>
@@ -22,8 +22,11 @@
const searchMarginTop = ref(null)
const searchHeight = ref(32)
const searchWidth = ref(32)
const isAlipay = ref(false)
onMounted(() => {
const menuButtonInfo = uni.getMenuButtonBoundingClientRect()
const type = uni.getSystemInfoSync().uniPlatform
isAlipay.value = type === 'mp-alipay'
const {
top,
width,

+ 2
- 1
pages.json Wyświetl plik

@@ -40,7 +40,8 @@
"navigationStyle": "custom",
"mp-alipay": { //在支付宝小程序中如果不生效 就加上这两行代码 就会生效啦
"transparentTitle": "always",
"titlePenetrate": "YES"
"titlePenetrate": "YES",
"defaultTitle": "" // 将导航栏默认的 title 置空
}
}
},

+ 1
- 1
subpackage/after-sale/account-recharge/login.vue Wyświetl plik

@@ -49,7 +49,7 @@
//调用方式
request(accountLogin, options).then((res) => {
let data = stringToJson(res.bizContent)
let data = JSON.parse(res.bizContent);
console.log(data, "#################");
navTo(`/subpackage/after-sale/account-recharge/index?name=state.name`);
})

+ 95
- 37
subpackage/after-sale/arrears/arrears.vue Wyświetl plik

@@ -154,7 +154,9 @@
CardBillQuery,
CardBillPlaceOrder,
CardBillPayStatus,
wechatPayConfigId
wechatPayConfigId,
aliPayConfigId,
obtainUserId
} from "@/utils/network/api.js";
import {
request
@@ -281,44 +283,100 @@

//掉起微信支付
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("未勾选补缴订单!")
}
};



+ 2
- 0
utils/network/api.js Wyświetl plik

@@ -22,6 +22,7 @@ export const envs = {
export const appId = "52030131"; //应用appid 综合业务支撑平台使用
export const loginTime = 86400; //登录有效时间(单位s) 1天
export const wechatPayConfigId = "6a9a54bc01f6443faea7ffe132b19f6"; //支付配置编号 微信小程序支付:6a9a54bc01f6443faea7ffe132b19f6
export const aliPayConfigId = "6a9a54bc01f6443123452b1234"; //支付配置编号 支付宝小程序支付:6a9a54bc01f6443123452b1234
export const wechatAppID = "wx8fba957179c1329a"; //九州小程序APPid:wx008c60533388527a
export const wechatSecret = "699c10826113ddb350fbe58a96e2b015"; //九州小程序AppSecret:95197718b43b497f02732bd9f8011080
// export const sm4Key = "5dc11f854ceca1473e1a5075ed16eb226b4543a9a05fe50f7fba40f898099ce34abba69a07a20509f315f94d808a4d0e988935588858f65a";
@@ -42,6 +43,7 @@ export const resetPwd = "1009"; //会员平台个人账号修改密码手机号
export const getToken = "1006"; //统一会员平台登录确认接口(用于换取openId和token)
export const checkCode = "966"; //校验验证码
export const register = "52de4029940f4e03b18c3a0b8d64c2db";//USER-无感注册登录(个人/企业)
export const obtainUserId = "58760acb637245729e971597a1fb92c4";//获取第三方用户标识
/*地址管理*/
export const addressQuery = "27"; //地址管理查询

Ładowanie…
Anuluj
Zapisz