采购商购买第三方支付

pifa
wangdong 4 months ago
parent d7af75f30a
commit 111d08c902
  1. 4
      components/add-shuiyin/index.vue
  2. 103
      pages/news/caigou/notice6.vue

@ -58,8 +58,8 @@
},
mounted() {
const that = this;
if(uni.getStorageSync("userInfo").user_id){
that.watermarks = uni.getStorageSync("userInfo").user_id
if(uni.getStorageSync("userInfo").mobile){
that.watermarks = uni.getStorageSync("userInfo").mobile
console.log(11,that.watermarks)
that.getstatusBarHeight();

@ -90,7 +90,7 @@
<view class="item" v-for="(a,i) in paymentMethods" @click="tabItem1(i)">
<image v-if="tabIndex == i" src="https://www.amiami.com.cn/static/invoice/select-on.png"></image>
<image v-else src="https://www.amiami.com.cn/static/invoice/select.png"></image>
{{a.method == 'wechat'?'微信支付':'余额支付'}}<text v-if="a.method == 'balance'">余额{{personal.balance}}</text>
{{a.method == 'huifu' ? '银联支付' : (a.method == 'wechat'?'微信支付':'余额支付')}}<text v-if="a.method == 'balance'">余额{{personal.balance}}</text>
</view>
</view>
</view>
@ -105,6 +105,7 @@
<script>
import { Wechat } from '@/core/payment'
import * as CashierApi from '@/api/cashier';
import * as newFunApi from '@/api/newFun'
export default {
data() {
@ -125,9 +126,31 @@
this.orcInfo = uni.getStorageSync("orcInfo");
this.wholesalerPrice();
},
onLoad() {
uni.$on('appShow', this.solveShowMsg);
},
onUnload() {
uni.$off('appShow', this.solveShowMsg);
},
methods: {
solveShowMsg(info) {
console.log(info);
if (this.miniPayRequest && Object.keys(this.miniPayRequest).length > 0 && info.appId === this.miniPayRequest.miniuser) {
this.onTradeQuery(this.miniPayRequest.out_trade_no, this.paymentMethods[this.tabIndex].method);
}
},
//
setDefaultPayType() {
const app = this
const defaultIndex = app.paymentMethods.findIndex(item => item.is_default == true)
defaultIndex > -1 && app.tabItem1(defaultIndex);
},
tabItem1(i){
this.tabIndex = i
if (this.paymentMethods[this.tabIndex].method == "huifu") {
this.huifuPay();
}
},
//
async wholesalerPrice() {
@ -136,6 +159,7 @@
this.info = data.info
this.paymentMethods = data.paymentMethods
this.personal = data.personal
this.setDefaultPayType();
}
},
//
@ -183,6 +207,34 @@
})
}
},
async huifuPay() {
const app = this;
const {status, data } = await newFunApi.wholesalerSubmit({
method: 'huifu',
client: "MP-WEIXIN",
username: this.orcInfo.username,
mobile: this.orcInfo.mobile,
mobile_code: this.orcInfo.mobile_code,
card_front_img_id: this.orcInfo.card_front_img_id,
card_back_img_id: this.orcInfo.card_back_img_id,
license_img_id: this.orcInfo.license_img_id,
card_no: this.orcInfo.card_no,
door_img_id: this.orcInfo.door_img_id,
province_id: this.orcInfo.province_id,
company_name: this.orcInfo.company_name,
city_id: this.orcInfo.city_id,
credit_code: this.orcInfo.credit_code,
business: this.orcInfo.business,
avatar_id: this.orcInfo.avatar_id,
})
if(status == 200) {
const { miniPayRequest, out_trade_no } = data.payment;
app.miniPayRequest = miniPayRequest;
app.miniPayRequest.out_trade_no = out_trade_no;
}
},
//
async toPay() {
@ -242,8 +294,22 @@
}
}else if(this.paymentMethods[this.tabIndex].method == "wechat"){
this.toWechatPay();
} else if(this.paymentMethods[this.tabIndex].method == "huifu"){
this.isClick = true;
if (!this.miniPayRequest || Object.keys(this.miniPayRequest).length === 0) {
this.$toast(`暂无银联支付信息`);
return
}
let appPayRequest = '';
appPayRequest = encodeURIComponent(JSON.stringify({
sign: this.miniPayRequest.sign,
prepayid: this.miniPayRequest.prepayid,
}));
uni.openEmbeddedMiniProgram({
appId: this.miniPayRequest.miniuser,
path: `${this.miniPayRequest.minipath}?appPayRequest=${appPayRequest}`
});
}
},
async openPage1() {
if(this.isClick == false){
@ -286,7 +352,38 @@
title: message
})
}
}
},
// :
onTradeQuery(outTradeNo, method) {
const app = this
//
//
CashierApi.tradeQuery({
outTradeNo,
method,
client: app.platform
})
.then(result => {
if (result.data.isPay) {
uni.showToast({
title: result.message || "支付成功",
icon: 'success'
})
setTimeout(()=>{
uni.removeStorageSync("orcInfo");
uni.redirectTo({
url: "/pages/news/caigou/notice5"
})
},1000)
} else {
uni.showToast({
title: result.message || "支付失败",
icon: 'none'
})
}
})
.finally(() => app.showConfirmModal = false)
},
},

Loading…
Cancel
Save