|
|
@@ -27,15 +27,15 @@
|
|
|
<radio :value="1" :checked="payType=='1'" />
|
|
|
</label>
|
|
|
</view>
|
|
|
- <!-- <view class="item" >
|
|
|
+ <view class="item">
|
|
|
<view class="left">
|
|
|
- <image src="https://jnlzjk-1323137866.cos.ap-chongqing.myqcloud.com/shop/images/pay_de.png" mode=""></image>
|
|
|
- <text class="text">物流代收</text>
|
|
|
+ <image src="/static/images/zfb.png" mode=""></image>
|
|
|
+ <text class="text">支付宝</text>
|
|
|
</view>
|
|
|
<label>
|
|
|
- <radio :value="2" :checked="order.payType=='2'" />
|
|
|
+ <radio :value="99" :checked="payType == 99" />
|
|
|
</label>
|
|
|
- </view> -->
|
|
|
+ </view>
|
|
|
</radio-group>
|
|
|
</view>
|
|
|
<!-- 订单详情查看 -->
|
|
|
@@ -92,6 +92,17 @@
|
|
|
orderBindUser,
|
|
|
clearPayType
|
|
|
} from '@/api/storeOrder'
|
|
|
+ import {
|
|
|
+ H5AliPayment,
|
|
|
+ aliPayment,
|
|
|
+ appWxPayment,
|
|
|
+ H5WxPayment,
|
|
|
+ weChatPayment,
|
|
|
+ zfbPayment
|
|
|
+ } from '@/api/pay_new'
|
|
|
+ import {
|
|
|
+ payConfirmReward
|
|
|
+ } from '@/api/liveOrder'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -242,6 +253,7 @@
|
|
|
);
|
|
|
},
|
|
|
payTypeChange(e) {
|
|
|
+ this.payType=e.detail.value
|
|
|
this.editPayType(e.detail.value)
|
|
|
},
|
|
|
copyOrderSn(text) {
|
|
|
@@ -336,28 +348,18 @@
|
|
|
payType: payType
|
|
|
};
|
|
|
this.payParams = data
|
|
|
- var that = this;
|
|
|
uni.showLoading();
|
|
|
-
|
|
|
editPayType(data).then(
|
|
|
res => {
|
|
|
if (res.code == 200) {
|
|
|
console.log(res);
|
|
|
uni.hideLoading();
|
|
|
- that.order = res.order;
|
|
|
+ this.order = res.order;
|
|
|
//this.payType=this.order.payType
|
|
|
- this.payMoney = this.order.payMoney;
|
|
|
+ this.payMoney = this.order.payPrice;
|
|
|
this.payDelivery = this.order.payDelivery;
|
|
|
- if(res.order.status==0){ //0:代付款 1:已支付
|
|
|
- uni.showToast({title: '未支付成功',icon: 'none'});
|
|
|
- }
|
|
|
- else if(res.order.status==1){ //0:代付款 1:已支付
|
|
|
- this.$refs.popTip.close();
|
|
|
- uni.redirectTo({
|
|
|
- url:"./success?order="+JSON.stringify(this.order)
|
|
|
- });
|
|
|
- }
|
|
|
} else {
|
|
|
+ uni.hideLoading();
|
|
|
uni.showToast({
|
|
|
icon: 'none',
|
|
|
title: res.msg,
|
|
|
@@ -373,7 +375,193 @@
|
|
|
url: '/pages_user/user/otherPaymentOrder?orderId=' + this.orderId
|
|
|
})
|
|
|
},
|
|
|
- payOrder() {
|
|
|
+ payOrder() {
|
|
|
+ if (this.type == 'win') {
|
|
|
+ this.toPayConfirmReward()
|
|
|
+ } else {
|
|
|
+ if (this.payType == 1) {
|
|
|
+ this.weixin()
|
|
|
+ } else if (this.payType == 99) {
|
|
|
+ this.aliPayOrder()
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: "暂时无可用支付",
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ toPayConfirmReward() {
|
|
|
+ let data = {
|
|
|
+ orderId: this.order.id,
|
|
|
+ appId:'wxecdaff01852ca309'
|
|
|
+ }
|
|
|
+ payConfirmReward(data).then(
|
|
|
+ res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: res.msg,
|
|
|
+ });
|
|
|
+ uni.redirectTo({
|
|
|
+ url: "./success?order=" + JSON.stringify(this.order)
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: "请求失败",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ rej => {}
|
|
|
+ );
|
|
|
+ },
|
|
|
+ aliPayOrder() {
|
|
|
+ console.log("选了支付宝", this.order)
|
|
|
+ const data = {
|
|
|
+ orderId: this.order.id,
|
|
|
+ appId: 'wxecdaff01852ca309',
|
|
|
+ // type: "live"
|
|
|
+ };
|
|
|
+ if(this.type=="live"){
|
|
|
+ data.type ="live"
|
|
|
+ }
|
|
|
+ const that = this;
|
|
|
+ uni.showLoading();
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ console.log("APP Ali payload", JSON.stringify(data))
|
|
|
+ zfbPayment(data).then(res => {
|
|
|
+ uni.hideLoading();
|
|
|
+ console.log("APP Ali response", JSON.stringify(res))
|
|
|
+ if (res.code == 200) {
|
|
|
+ if (res.type == "tz") {
|
|
|
+ const match = res.data.body.url.match(/[\?&]businessCstNo=([^&]+)/);
|
|
|
+ const businessCstNo = match ? match[1] : null;
|
|
|
+ const tzCashier = uni.requireNativePlugin("TZBank-Cashier");
|
|
|
+ tzCashier.pay({
|
|
|
+ env: 0,
|
|
|
+ wxMiniProgramType: 0,
|
|
|
+ wxAppId: 'wxecdaff01852ca309',
|
|
|
+ wxUniversalLink: "https://yjf.runtzh.com/",
|
|
|
+ orderFlowNo: res.data.body.orderFlowNo,
|
|
|
+ businessCstNo: businessCstNo,
|
|
|
+ platMerCstNo: res.data.body.platMerCstNo
|
|
|
+ }, (ret) => {
|
|
|
+ console.log("APP Ali tzCashier result", JSON.stringify(ret))
|
|
|
+ if (ret && ret.errCode == 0) {
|
|
|
+ that.$refs.popTip.open()
|
|
|
+ // uni.redirectTo({
|
|
|
+ // url: "./success?order=" + JSON.stringify(that.order)
|
|
|
+ // })
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else if (res.type == 'hf') {
|
|
|
+ const qr = res.data.qr_code;
|
|
|
+ let alipayScheme = '';
|
|
|
+ if (uni.getSystemInfoSync().platform == 'android') {
|
|
|
+ alipayScheme = 'alipays://platformapi/startApp?&saId=10000007&qrcode=' + qr;
|
|
|
+ } else {
|
|
|
+ alipayScheme = 'alipay://platformapi/startApp?&saId=10000007&qrcode=' + qr;
|
|
|
+ }
|
|
|
+ setTimeout(() => {
|
|
|
+ that.$refs.popTip.open()
|
|
|
+ }, 2000)
|
|
|
+ console.log("APP Ali openURL", alipayScheme)
|
|
|
+ plus.runtime.openURL(alipayScheme, function() {});
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: res.msg,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ console.log("APP Ali catch error")
|
|
|
+ uni.hideLoading();
|
|
|
+ });
|
|
|
+ // #endif
|
|
|
+ // #ifdef H5
|
|
|
+ console.log("H5 Ali payload", JSON.stringify(data))
|
|
|
+ H5AliPayment(data).then(res => {
|
|
|
+ uni.hideLoading();
|
|
|
+ console.log("H5 Ali response", JSON.stringify(res))
|
|
|
+ if (res.code == 200) {
|
|
|
+ if (res.type == "tz") {
|
|
|
+ console.log("H5 Ali redirect url", res.data.body.url)
|
|
|
+ window.location.href = res.data.body.url;
|
|
|
+ } else if (res.type == 'hf') {
|
|
|
+ const payUrl = res.data.pay_info || res.data.qr_code;
|
|
|
+ console.log("H5 Ali payUrl", payUrl)
|
|
|
+ window.location.href = payUrl;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: res.msg,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ console.log("H5 Ali catch error")
|
|
|
+ uni.hideLoading();
|
|
|
+ });
|
|
|
+ // #endif
|
|
|
+ },
|
|
|
+ doWxPay(){
|
|
|
+ var that=this;
|
|
|
+ var data = {orderId:this.orderId};
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ uni.showLoading();
|
|
|
+ wxPayment(data).then(res => {
|
|
|
+ uni.hideLoading();
|
|
|
+ that.$refs.popPayType.close();
|
|
|
+ that.showPayTips = true;
|
|
|
+ setTimeout(() => {
|
|
|
+ that.$refs.popTip.open();
|
|
|
+ }, 500);
|
|
|
+ if(res.code==200){
|
|
|
+ if(res.type=="tz"){
|
|
|
+ let businessCstNo=this.userInfo.userId;
|
|
|
+ if(!!res.data.body.url){
|
|
|
+ const match = res.data.body.url.match(/[\?&]businessCstNo=([^&]+)/);
|
|
|
+ businessCstNo = match ? match[1] : null;
|
|
|
+ }
|
|
|
+ let payConfig={
|
|
|
+ env:0, //0 生产环境 1-回归 2-测试环境
|
|
|
+ wxAppId:"wxecdaff01852ca309",
|
|
|
+ wxUniversalLink:"https://yjf.runtzh.com/",
|
|
|
+ wxMiniProgramType:0,
|
|
|
+ orderFlowNo:res.data.body.orderFlowNo,
|
|
|
+ businessCstNo:businessCstNo,
|
|
|
+ platMerCstNo:res.data.body.platMerCstNo
|
|
|
+ };
|
|
|
+
|
|
|
+ this.tzCashier.pay({
|
|
|
+ env:0,
|
|
|
+ wxAppId:"wxecdaff01852ca309",
|
|
|
+ wxUniversalLink:"https://yjf.runtzh.com/",
|
|
|
+ wxMiniProgramType:0,
|
|
|
+ orderFlowNo:res.data.body.orderFlowNo,
|
|
|
+ businessCstNo:businessCstNo,
|
|
|
+ platMerCstNo:res.data.body.platMerCstNo
|
|
|
+ },(res)=>{
|
|
|
+ uni.$emit('closePrivilege', {});
|
|
|
+ that.$refs.popTip.open();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else if(res.type=='hf'){
|
|
|
+ uni.$emit('closePrivilege', {});
|
|
|
+ that.$refs.popTip.open();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ uni.showToast({title:res.msg,icon:'none'})
|
|
|
+ }
|
|
|
+ },
|
|
|
+ rej => {}
|
|
|
+ );
|
|
|
+ // #endif
|
|
|
+ },
|
|
|
+ weixin() {
|
|
|
var that=this;
|
|
|
plus.share.getServices(function(res){
|
|
|
var sweixin = null;
|