|
@@ -0,0 +1,870 @@
|
|
|
+/**
|
|
|
+ *Created by ZHJY on 2020/7/14.
|
|
|
+ */
|
|
|
+var payContainer = new Vue({
|
|
|
+ el:"#payContainer",
|
|
|
+ data: {
|
|
|
+ isSubMitStatus:false,
|
|
|
+ payInfo:{
|
|
|
+ payBankNum: 'ICBC_B2B', //支付类型
|
|
|
+ payOrderId: '', //订单ID
|
|
|
+ payUnpaidaMount: '', //待支付金额
|
|
|
+ payAmount: 0,//本次支付金额
|
|
|
+ payMobileUrl: '',//二维码生成链接
|
|
|
+ payData:{}, //支付数据
|
|
|
+ payUserType:'ENTERPRISE',
|
|
|
+ payType:'',
|
|
|
+ },
|
|
|
+ iframe:'',
|
|
|
+ couponInfo:{},
|
|
|
+ bankListData:[],
|
|
|
+ methodTab:['线上支付','转账支付'],
|
|
|
+ mobileData:[
|
|
|
+ {imgUrl:'/img/pay/iconbank-ali@2x.png',bankName:'支付宝支付',bankNum:'ALIPAY'},
|
|
|
+ {imgUrl:'/img/pay/iconbank-wx@2x.png',bankName:'微信支付',bankNum:'WEIXIN'},
|
|
|
+ {imgUrl:'/img/pay/iconbank-B2Bbank@2x.png',bankName:'网银支付',bankNum:'ICBC_B2B'},
|
|
|
+ {imgUrl:'/img/pay/iconbank-B2Cbank@2x.png',bankName:'个人网银',bankNum:'ICBC_B2C'}
|
|
|
+ ],
|
|
|
+ pageType:'',//页面跳转类型 1 二手支付
|
|
|
+ paidAmount:'',//订单待付金额
|
|
|
+ payableAmount:'',//应付金额
|
|
|
+ receiptAmount:'',//已支付金额
|
|
|
+ balanceAmount:'',//应付剩余金额
|
|
|
+ payAmount:'',//本次支付金额
|
|
|
+ paymentIimit:5000,
|
|
|
+ paymentIimitText:'',
|
|
|
+ discernReceiptList:[],//支付记录列表
|
|
|
+ tabIndex:0,//支付方式 0 移动支付 1网银支付 2线下转账
|
|
|
+ mbOrderId:'',//支付订单ID
|
|
|
+ bigPayInfo:{},// 银联转账信息
|
|
|
+ BankUserType:1,
|
|
|
+ mobileTabIndex:null,
|
|
|
+ bankTabIndex:0,
|
|
|
+ isRequest:false,
|
|
|
+ isPayAlert:false,
|
|
|
+ isPayBigAlert:false,
|
|
|
+ isPaySwitch:false,
|
|
|
+ paySuccessCounter:'',
|
|
|
+ bankPayLink_url:'',
|
|
|
+ orderIdentificationId:'',//订单标识
|
|
|
+ receiptStatus:'',
|
|
|
+ invoiceStatus:false,
|
|
|
+ isReceiptStatus:false,
|
|
|
+ onlinePay:'',
|
|
|
+ payStatusText:'使用任何一种线上支付方式支付全部金额后,供应商会在24小时后发货(周末、节假日顺延)。若着急发货,可以选择使用线下转账进行付款。',
|
|
|
+ productID:'',//发布商品的ID
|
|
|
+ is_Wechat_bowcr:false,
|
|
|
+ comboInfo: null, //选中的svip套餐信息
|
|
|
+ vipRecordId: undefined,
|
|
|
+ couponRecordId:undefined,
|
|
|
+ couponId:undefined,
|
|
|
+ userId:0
|
|
|
+ },
|
|
|
+ filters: {
|
|
|
+ NumFormat:function(value) {
|
|
|
+ if(!value) return '0.00';
|
|
|
+ var intPart = Number(value) - Number(value)%1; //获取整数部分(这里是windy93的方法)
|
|
|
+ var intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,'); //将整数部分逢三一断
|
|
|
+ var floatPart = ".00"; //预定义小数部分
|
|
|
+ var value2Array = value.toString().split(".");
|
|
|
+ if(value2Array.length == 2) { //=2表示数据有小数位
|
|
|
+ floatPart = value2Array[1].toString(); //拿到小数部分
|
|
|
+ if(floatPart.length == 1) { //补0,实际上用不着
|
|
|
+ return intPartFormat + "." + floatPart + '0';
|
|
|
+ } else {
|
|
|
+ return intPartFormat + "." + floatPart;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return intPartFormat + floatPart;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ initCouponDetail:function (couponId) {//初始化优惠券数据
|
|
|
+ var _self = this;
|
|
|
+ ProductApi.QueryCouponDetail({ couponId: couponId },function (response) {
|
|
|
+ if(response.code == 0){
|
|
|
+ _self.couponInfo = response.data
|
|
|
+ if(globalUserData){
|
|
|
+ _self.userId = globalUserData.userId;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ CAIMEI.Alert(response.msg, '确定', false);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ infoPayOrderCheckoutCounter:function(){//初始化订单数据
|
|
|
+ var _self = this;
|
|
|
+ PayApi.PayOrderCheckoutCounter({orderId:_self.payInfo.payOrderId},function(response){
|
|
|
+ if(response.code == 0){
|
|
|
+ // console.log(response);
|
|
|
+ var data = response.data; //金额初始化
|
|
|
+ _self.payInfo.payUnpaidaMount = (data.order.payableAmount - data.order.receiptAmount).toFixed(2);
|
|
|
+ _self.payInfo.payAmount = (data.order.payableAmount-data.order.receiptAmount).toFixed(2);
|
|
|
+ _self.discernReceiptList = data.discernReceipt;
|
|
|
+ _self.paidAmount = (data.order.payableAmount-data.order.receiptAmount).toFixed(2);
|
|
|
+ _self.receiptAmount = data.order.receiptAmount;
|
|
|
+ _self.payableAmount= data.order.payableAmount;
|
|
|
+ _self.balanceAmount = ( _self.payableAmount - _self.receiptAmount).toFixed(2) - _self.payInfo.payAmount;
|
|
|
+ _self.payAmount = (_self.payableAmount - _self.receiptAmount).toFixed(2);//本次支付金额
|
|
|
+ _self.paySuccessCounter = data.order.paySuccessCounter;
|
|
|
+ _self.receiptStatus = data.order.receiptStatus;
|
|
|
+ _self.onlinePay = data.onlinePay;
|
|
|
+ if(_self.receiptAmount>0){
|
|
|
+ _self.payStatusText = '使用任何一种线上支付方式支付全部金额后,供应商会在24小时后发货(周末、节假日顺延)。若着急发货,可以选择使用线下转账进行付款。';
|
|
|
+ _self.isReceiptStatus = false;
|
|
|
+ }else{
|
|
|
+ _self.payStatusText = '使用任何一种线上支付方式支付全部金额后,供应商会在24小时后发货(周末、节假日顺延)。若着急发货,可以选择使用线下转账进行付款。';
|
|
|
+ _self.isReceiptStatus = true;
|
|
|
+ }
|
|
|
+ _self.isRequest = true;
|
|
|
+ _self.PayOrderOnLineSwitch();
|
|
|
+ }else{
|
|
|
+ CAIMEI.Alert(response.msg,'确定',false);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getBankList:function () {// 获取网银支付银行列表
|
|
|
+ var _self = this;
|
|
|
+ PayApi.PayGetBankCode({},function(response){
|
|
|
+ if(response.code == 0){
|
|
|
+ _self.bankListData = response.data.list;
|
|
|
+ }else{
|
|
|
+ console.log('获取网银支付银行列表异常')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ PayOrderOnLineSwitch:function(){//获取是否可以先上支付
|
|
|
+ var _self = this;
|
|
|
+ PayApi.PayOrderOnLineSwitch({},function(response){
|
|
|
+ if(response.code == 0){
|
|
|
+ if(response.data === 0){
|
|
|
+ _self.isPaySwitch = true;
|
|
|
+ if (_self.pageType === '2') {
|
|
|
+ CAIMEI.dialog('支付系统遇到点小问题,请稍后重试', false);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ CAIMEI.Alert('线上支付功能正在维护中,请前往订单详情页面查看线下转账方式后进行付款','确定',true,function(){
|
|
|
+ window.location.href='/user/order/detail.html?orderId='+_self.payInfo.payOrderId;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ CAIMEI.Alert(response.msg,'确定',false);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ PayMobileSubmitFn:function(){//点击移动支付方式
|
|
|
+ var _self = this;
|
|
|
+ if(_self.isPaySwitch && _self.pageType === '2'){
|
|
|
+ CAIMEI.dialog('支付系统遇到点小问题,请稍后重试', false);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(_self.pageType === '3'){// 移动支付优惠券
|
|
|
+ _self.PayCouponMiniPayFn();
|
|
|
+ }else{
|
|
|
+ if(_self.onlinePay == 2){
|
|
|
+ _self.layerConfirm();
|
|
|
+ }else{
|
|
|
+ if(_self.payInfo.payBankNum == ''){
|
|
|
+ CAIMEI.dialog('请选择支付方式');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(_self.payAmount == ''){
|
|
|
+ CAIMEI.dialog('请输入本次支付金额');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(_self.payAmount == 0){
|
|
|
+ CAIMEI.dialog('本次支付金额不能为0');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(_self.payAmount*100 < 2){
|
|
|
+ CAIMEI.dialog('本次支付金额必须大于¥0.02');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(_self.payAmount > _self.paymentIimit){
|
|
|
+ switch (_self.payInfo.payBankNum) {
|
|
|
+ case 'WEIXIN':
|
|
|
+ _self.paymentIimitText = '本次支付金额已超出微信支付限额,请输入小于5千的金额进行支付';
|
|
|
+ break;
|
|
|
+ case 'ALIPAY':
|
|
|
+ _self.paymentIimitText = '本次支付金额已超出支付宝限额,请输入小于5千的金额进行支付';
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ CAIMEI.Alert(_self.paymentIimitText,'知道了');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(_self.payInfo.payBankNum == "WEIXIN"){// 微信
|
|
|
+ if(_self.pageType === '1'){ // 二手
|
|
|
+ _self.PaySecondMiniWxPay();
|
|
|
+ }else if(_self.pageType === '2'){ // 会员
|
|
|
+ _self.payVipMiniWxPay();
|
|
|
+ }else{ // 正常订单
|
|
|
+ _self.PayOrderMiniWxPay();
|
|
|
+ }
|
|
|
+ }else if(_self.payInfo.payBankNum == "ALIPAY"){// 支付宝
|
|
|
+ if(_self.pageType === '1'){// 二手
|
|
|
+ _self.PayOrdersecondScanAliPay();
|
|
|
+ }else if(_self.pageType === '2'){ // 会员
|
|
|
+ _self.PayVipScanAliPay();
|
|
|
+ }else{// 正常订单
|
|
|
+ _self.PayOrderPcScanAliPay();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ PaySubmitFn:function(){//点击网银支付方式
|
|
|
+ var _self = this;
|
|
|
+ if(_self.isPaySwitch && _self.pageType === '2'){
|
|
|
+ CAIMEI.dialog('支付系统遇到点小问题,请稍后重试', false);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(_self.pageType === '3'){// 网银支付优惠券
|
|
|
+ _self.PayCouponUnionPayFn();
|
|
|
+ }else{
|
|
|
+ if(_self.onlinePay == 2){
|
|
|
+ _self.layerConfirm();
|
|
|
+ }else{
|
|
|
+ if(_self.payInfo.payBankNum == ''){
|
|
|
+ CAIMEI.dialog('请选择银行!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(_self.payAmount <= 10){
|
|
|
+ CAIMEI.dialog('网银支付的金额必须大于¥10.00');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(_self.pageType === '1'){// 二手
|
|
|
+ _self.PayOrdersecondUnion();
|
|
|
+ } else if (_self.pageType === '2') { // 会员
|
|
|
+ _self.payVipPcMallPay();
|
|
|
+ } else {// 正常订单
|
|
|
+ _self.PayOrderPcMallPay();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ PayOrderMiniWxPay:function (){// 正常订单微信支付通道
|
|
|
+ var _self = this;
|
|
|
+ if(!isPC){
|
|
|
+ var orderInfo = {//正常订单微信二维码参数
|
|
|
+ pageType:0,
|
|
|
+ orderID:_self.payInfo.payOrderId,
|
|
|
+ payAmount:_self.payAmount
|
|
|
+ };
|
|
|
+ _self.payInfo.payMobileUrl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxea43a0f9ebce9e66&redirect_uri=https://www.caimei365.com/pay/wechatpay.html&response_type=code&scope=snsapi_base&state="+JSON.stringify(orderInfo)+"#wechat_redirect";
|
|
|
+ location.href = _self.payInfo.payMobileUrl;
|
|
|
+ }else{
|
|
|
+ _self.payInfo.payData = {//正常订单
|
|
|
+ type:_self.payInfo.payBankNum,
|
|
|
+ orderid:_self.payInfo.payOrderId,
|
|
|
+ amount:_self.payAmount,
|
|
|
+ url:_self.payInfo.payMobileUrl
|
|
|
+ };
|
|
|
+ CAIMEI.Storage.setItem('payData',JSON.stringify(_self.payInfo.payData));
|
|
|
+ window.open("/pay/caimei-paymobile.html?pageType=0");
|
|
|
+ _self.isPayAlert = true;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ PayOrderPcScanAliPay:function (){// 正常订单支付宝通道
|
|
|
+ var _self = this;
|
|
|
+ var params = {//正常订单
|
|
|
+ payType:'ZFBEWM',
|
|
|
+ payAmount:_self.payAmount,
|
|
|
+ returnUrl:'https://www.caimei365.com/',
|
|
|
+ orderId:_self.payInfo.payOrderId
|
|
|
+ };
|
|
|
+ _self.isSubMitStatus=true;
|
|
|
+ PayApi.PayOrderPcScanAliPay(params,function(response){
|
|
|
+ if(response.code == 0){
|
|
|
+ console.log('data',response.data)
|
|
|
+ _self.isPayAlert = true;
|
|
|
+ _self.isSubMitStatus=false;
|
|
|
+ _self.mbOrderId = response.data.rt5_orderId;
|
|
|
+ _self.payInfo.payMobileUrl = response.data.rt8_qrcode;
|
|
|
+ _self.payInfo.payData = {
|
|
|
+ mbOrderId:_self.mbOrderId,
|
|
|
+ type:_self.payInfo.payBankNum,
|
|
|
+ orderid:_self.payInfo.payOrderId,
|
|
|
+ amount:_self.payAmount,
|
|
|
+ url:_self.payInfo.payMobileUrl
|
|
|
+ };
|
|
|
+ CAIMEI.Storage.setItem('payData',JSON.stringify(_self.payInfo.payData));
|
|
|
+ if(!isPC){
|
|
|
+ location.href = _self.payInfo.payMobileUrl;
|
|
|
+ }else{
|
|
|
+ window.open("/pay/caimei-paymobile.html?pageType=1");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ CAIMEI.Alert(response.msg,'确定',false);
|
|
|
+ _self.isSubMitStatus=false;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ PayOrderPcMallPay:function(){// 正常订单网银支付通道
|
|
|
+ var _self = this;
|
|
|
+ var params = {//正常订单
|
|
|
+ payType:'YL',
|
|
|
+ payAmount:_self.payAmount,
|
|
|
+ bankCode:_self.payInfo.payBankNum,
|
|
|
+ returnUrl:'https://www.caimei365.com/pay/success.html?pageType=www&type=success&payAmount='+_self.payAmount,
|
|
|
+ orderId:_self.payInfo.payOrderId,
|
|
|
+ userType:_self.payInfo.payUserType
|
|
|
+ };
|
|
|
+ _self.isSubMitStatus=true;
|
|
|
+ PayApi.PayOrderPcMallPay(params,function(response){
|
|
|
+ if(response.code == 0){
|
|
|
+ // _self.isPayAlert = true;
|
|
|
+ _self.iframe = response.data
|
|
|
+ setTimeout(function () {
|
|
|
+ var onlineForm = document.getElementById('onlineForm');
|
|
|
+ _self.isSubMitStatus=false;
|
|
|
+ onlineForm.submit();
|
|
|
+ },2000)
|
|
|
+ }else{
|
|
|
+ _self.isSubMitStatus=false;
|
|
|
+ CAIMEI.Alert(response.msg,'确定',false);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ PaySecondMiniWxPay:function (){//二手发布微信支付通道
|
|
|
+ var _self = this;
|
|
|
+ if(!isPC){// h5跳 H5支付页
|
|
|
+ var orderInfo = {//二手微信二维码参数
|
|
|
+ pageType:1,
|
|
|
+ productId:_self.productID,
|
|
|
+ payAmount:_self.payAmount
|
|
|
+ };
|
|
|
+ _self.payInfo.payMobileUrl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxea43a0f9ebce9e66&redirect_uri=https://www.caimei365.com/pay/wechatpay.html&response_type=code&scope=snsapi_base&state="+JSON.stringify(orderInfo)+"#wechat_redirect";
|
|
|
+ location.href = _self.payInfo.payMobileUrl;
|
|
|
+ }else{// PC 跳扫码支付页
|
|
|
+ _self.payInfo.payData = {//二手
|
|
|
+ type:_self.payInfo.payBankNum,
|
|
|
+ productId:_self.productID,
|
|
|
+ amount:_self.payAmount,
|
|
|
+ url:_self.payInfo.payMobileUrl
|
|
|
+ };
|
|
|
+ CAIMEI.Storage.setItem('payData',JSON.stringify(_self.payInfo.payData));
|
|
|
+ window.open("/pay/caimei-paymobile.html?pageType=1");
|
|
|
+ _self.isPayAlert = true;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ PayOrdersecondScanAliPay:function (){// 二手发布支付宝通道
|
|
|
+ var _self = this;
|
|
|
+ var params = {//二手
|
|
|
+ payType:'ZFBEWM',
|
|
|
+ returnUrl:'https://www.caimei365.com/',
|
|
|
+ productId:_self.productID,
|
|
|
+ };
|
|
|
+ _self.isSubMitStatus=true;
|
|
|
+ PayApi.PayOrdersecondScanAliPay(params,function(response){
|
|
|
+ if(response.code == 0){
|
|
|
+ _self.isPayAlert = true;
|
|
|
+ _self.isSubMitStatus=false;
|
|
|
+ _self.mbOrderId = response.data.rt5_orderId;
|
|
|
+ _self.payInfo.payMobileUrl = response.data.rt8_qrcode;
|
|
|
+ _self.payInfo.payData = {
|
|
|
+ mbOrderId:_self.mbOrderId,
|
|
|
+ type:_self.payInfo.payBankNum,
|
|
|
+ productId:_self.productID,
|
|
|
+ amount:_self.payAmount,
|
|
|
+ url:_self.payInfo.payMobileUrl
|
|
|
+ };
|
|
|
+ CAIMEI.Storage.setItem('payData',JSON.stringify(_self.payInfo.payData));
|
|
|
+ window.open("/pay/caimei-paymobile.html?pageType=1");
|
|
|
+ }else{
|
|
|
+ CAIMEI.Alert(response.msg,'确定',false);
|
|
|
+ _self.isSubMitStatus=false;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ PayOrdersecondUnion:function (){// 二手发布网银支付通道
|
|
|
+ var _self = this;
|
|
|
+ var params = {//二手
|
|
|
+ payType:'YL',
|
|
|
+ bankCode:_self.payInfo.payBankNum,
|
|
|
+ returnUrl:'https://www.caimei365.com/pay/success.html?pageType=second&type=success&payAmount='+_self.payAmount,
|
|
|
+ productId:_self.productID,
|
|
|
+ userType:_self.payInfo.payUserType,
|
|
|
+ };
|
|
|
+ _self.isSubMitStatus=true;
|
|
|
+ PayApi.PayOrdersecondUnion(params,function(response){
|
|
|
+ if(response.code == 0){
|
|
|
+ _self.iframe = response.data
|
|
|
+ setTimeout(function () {
|
|
|
+ var onlineForm = document.getElementById('onlineForm');
|
|
|
+ _self.isSubMitStatus=false;
|
|
|
+ onlineForm.submit();
|
|
|
+ },2000)
|
|
|
+ }else{
|
|
|
+ CAIMEI.Alert(response.msg,'确定',false);
|
|
|
+ _self.isSubMitStatus=false;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ payVipMiniWxPay: function(){ // 超级会员微信支付通道
|
|
|
+ var _self = this;
|
|
|
+ if (!isPC) {
|
|
|
+ var orderInfo = {//普通订单微信二维码参数
|
|
|
+ pageType: 2,
|
|
|
+ vipId: _self.comboInfo.id,
|
|
|
+ vipRecordId: _self.vipRecordId,
|
|
|
+ payAmount: _self.payAmount
|
|
|
+ };
|
|
|
+ _self.payInfo.payMobileUrl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxea43a0f9ebce9e66&redirect_uri=https://www.caimei365.com/pay/wechatpay.html&response_type=code&scope=snsapi_base&state=" + JSON.stringify(orderInfo) + "#wechat_redirect";
|
|
|
+ location.href = _self.payInfo.payMobileUrl;
|
|
|
+ } else {
|
|
|
+ _self.payInfo.payData = {
|
|
|
+ type: _self.payInfo.payBankNum,
|
|
|
+ vipId: _self.comboInfo.id,
|
|
|
+ vipRecordId: _self.vipRecordId,
|
|
|
+ amount: _self.payAmount,
|
|
|
+ duration: _self.comboInfo.duration,
|
|
|
+ };
|
|
|
+ CAIMEI.Storage.setItem('payData', JSON.stringify(_self.payInfo.payData));
|
|
|
+ window.open("/pay/caimei-paymobile.html?pageType=2");
|
|
|
+ _self.isPayAlert = true;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ PayVipScanAliPay: function(){ // 超级会员支付宝通道
|
|
|
+ var _self = this;
|
|
|
+ var params = {
|
|
|
+ bankCode: _self.payInfo.payBankNum,
|
|
|
+ returnUrl: 'https://www.caimei365.com/',
|
|
|
+ userType: _self.payInfo.payUserType,
|
|
|
+ vipRecordId: _self.vipRecordId
|
|
|
+ };
|
|
|
+ _self.isSubMitStatus = true;
|
|
|
+ PayApi.PayVipScanAliPay(params, function(response){
|
|
|
+ console.log(response);
|
|
|
+ if (response.code === 0) {
|
|
|
+ _self.isPayAlert = true;
|
|
|
+ _self.isSubMitStatus = false;
|
|
|
+ _self.mbOrderId = response.data.data.mbOrderId;
|
|
|
+ _self.payInfo.payMobileUrl = response.data.data.payUrl;
|
|
|
+ _self.payInfo.payData = {
|
|
|
+ mbOrderId: _self.mbOrderId,
|
|
|
+ type: _self.payInfo.payBankNum,
|
|
|
+ amount: _self.payAmount,
|
|
|
+ url: _self.payInfo.payMobileUrl,
|
|
|
+ };
|
|
|
+ CAIMEI.Storage.setItem('payData', JSON.stringify(_self.payInfo.payData));
|
|
|
+ if (!isPC) {
|
|
|
+ location.href = _self.payInfo.payMobileUrl;
|
|
|
+ } else {
|
|
|
+ window.open("/pay/caimei-paymobile.html?pageType=2&duration=" + _self.comboInfo.duration);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ CAIMEI.Alert(response.msg, '确定', false);
|
|
|
+ _self.isSubMitStatus = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ payVipPcMallPay: function(){// 超级会员网银支付通道
|
|
|
+ var _self = this;
|
|
|
+ var params = {
|
|
|
+ payType:'YL',
|
|
|
+ bankCode: this.payInfo.payBankNum,
|
|
|
+ returnUrl: 'https://www.caimei365.com/pay/success.html?pageType=vip&type=success&payAmount='+_self.payAmount,
|
|
|
+ userType: _self.payInfo.payUserType,
|
|
|
+ vipRecordId: _self.vipRecordId
|
|
|
+ };
|
|
|
+ _self.isSubMitStatus=true;
|
|
|
+ PayApi.PayVipPcMallPay(params, function (response) {
|
|
|
+ if (response.code == 0) {
|
|
|
+ _self.iframe = response.data
|
|
|
+ setTimeout(function () {
|
|
|
+ var onlineForm = document.getElementById('onlineForm');
|
|
|
+ _self.isSubMitStatus=false;
|
|
|
+ onlineForm.submit();
|
|
|
+ },2000)
|
|
|
+ } else {
|
|
|
+ _self.isSubMitStatus = false;
|
|
|
+ CAIMEI.Alert(response.msg, '确定', false);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ PayCouponUnionPayFn:function () { // 网银支付购买优惠券
|
|
|
+ console.log('网银支付购买优惠券');
|
|
|
+ var _self = this;
|
|
|
+ var params = {
|
|
|
+ bankCode: this.payInfo.payBankNum,
|
|
|
+ returnUrl: 'https://www.caimei365.com/pay/success.html?pageType=www&type=success&payAmount='+_self.couponInfo.moneyCouponPrice,
|
|
|
+ userType: _self.payInfo.payUserType,
|
|
|
+ couponId: _self.couponId,
|
|
|
+ couponRecordId:_self.couponRecordId,
|
|
|
+ userId:_self.userId,
|
|
|
+ source:2 //支付来源 1 小程序 2 WWW
|
|
|
+ };
|
|
|
+ PayApi.PayCouponUnionPay(params, function (response) {
|
|
|
+ if (response.code == 0) {
|
|
|
+ _self.isPayAlert = true;
|
|
|
+ _self.isSubMitStatus = false;
|
|
|
+ _self.mbOrderId = response.data.data.mbOrderId;
|
|
|
+ window.open(response.data.data.payUrl);
|
|
|
+ } else {
|
|
|
+ _self.isSubMitStatus = false;
|
|
|
+ CAIMEI.Alert(response.msg, '确定', false);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ PayCouponMiniPayFn:function () { // 移动支付购买优惠券
|
|
|
+ var _self = this;
|
|
|
+ if(_self.payInfo.payBankNum == "WEIXIN"){
|
|
|
+ _self.payCouponMiniWxPay();
|
|
|
+ }else if(_self.payInfo.payBankNum == "ALIPAY"){//支付宝支付
|
|
|
+ _self.payCouponAliPay();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ payCouponMiniWxPay: function(){ // 微信支付优惠券
|
|
|
+ console.log('微信支付优惠券');
|
|
|
+ if (!isPC) {
|
|
|
+ var orderInfo = {//普通订单微信二维码参数
|
|
|
+ pageType: 3,
|
|
|
+ payAmount: this.couponInfo.moneyCouponPrice,
|
|
|
+ couponRecordId:this.couponRecordId,
|
|
|
+ couponId: this.couponId,
|
|
|
+ userId : this.userId
|
|
|
+ };
|
|
|
+ this.payInfo.payMobileUrl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx91c4152b60ca91a3&redirect_uri=https://www.caimei365.com/pay/wechatpay.html&response_type=code&scope=snsapi_base&state=" + JSON.stringify(orderInfo) + "#wechat_redirect";
|
|
|
+ location.href = this.payInfo.payMobileUrl;
|
|
|
+ } else {
|
|
|
+ this.payInfo.payData = {
|
|
|
+ type: this.payInfo.payBankNum,
|
|
|
+ amount: this.couponInfo.moneyCouponPrice,
|
|
|
+ url: this.payInfo.payMobileUrl,
|
|
|
+ couponId:this.couponId,
|
|
|
+ couponRecordId:this.couponRecordId,
|
|
|
+ userId:this.userId
|
|
|
+ };
|
|
|
+ CAIMEI.Storage.setItem('payData', JSON.stringify(this.payInfo.payData));
|
|
|
+ window.open("/pay/caimei-paymobile.html?pageType=3");
|
|
|
+ this.isPayAlert = true;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ payCouponAliPay: function(){ // 支付宝支付优惠券
|
|
|
+ var _self = this;
|
|
|
+ console.log('支付宝支付优惠券');
|
|
|
+ var params = {
|
|
|
+ returnUrl: 'https://www.caimei365.com/',
|
|
|
+ couponId: _self.couponInfo.couponId,
|
|
|
+ userId:_self.userId,
|
|
|
+ couponRecordId:_self.couponRecordId,
|
|
|
+ source:2 //支付来源 1 小程序 2 WWW
|
|
|
+ };
|
|
|
+ PayApi.PayCouponMiniAliPay(params, function(response){
|
|
|
+ console.log(response);
|
|
|
+ if (response.code === 0) {
|
|
|
+ _self.isPayAlert = true;
|
|
|
+ _self.mbOrderId = response.data.data.mbOrderId;
|
|
|
+ _self.payInfo.payMobileUrl = response.data.data.payUrl;
|
|
|
+ _self.payInfo.payData = {
|
|
|
+ type: _self.payInfo.payBankNum,
|
|
|
+ mbOrderId: _self.mbOrderId,
|
|
|
+ amount: _self.couponInfo.moneyCouponPrice,
|
|
|
+ url: _self.payInfo.payMobileUrl,
|
|
|
+ couponId:_self.couponId,
|
|
|
+ userId:_self.userId
|
|
|
+ };
|
|
|
+ CAIMEI.Storage.setItem('payData', JSON.stringify(_self.payInfo.payData));
|
|
|
+ if (!isPC) {
|
|
|
+ location.href = _self.payInfo.payMobileUrl;
|
|
|
+ } else {
|
|
|
+ window.open("/pay/caimei-paymobile.html?pageType=3");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ CAIMEI.Alert(response.msg, '确定', false);
|
|
|
+ _self.isSubMitStatus = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ changePayAmount:function(event){//输入支付金额控制
|
|
|
+ var _self = this;
|
|
|
+ var value = event.target.value;
|
|
|
+ if(value == "" || value <0 ){//判断是否等于0 或者为空
|
|
|
+ _self.payAmount = '';
|
|
|
+ _self.payInfo.payAmount = _self.payInfo.payUnpaidaMount;
|
|
|
+ _self.balanceAmount = _self.toFixedFn(_self.payInfo.payUnpaidaMount);
|
|
|
+ return;
|
|
|
+ }else if(Number(value) > _self.payInfo.payUnpaidaMount){//判断大于应付金额
|
|
|
+ _self.payAmount = _self.payInfo.payUnpaidaMount;
|
|
|
+ _self.payInfo.payAmount = _self.payAmount;
|
|
|
+ _self.balanceAmount = _self.toFixedFn(_self.payInfo.payUnpaidaMount-_self.payInfo.payAmount);
|
|
|
+ }else{
|
|
|
+ _self.payAmount = value;
|
|
|
+ _self.payInfo.payAmount = _self.payAmount;
|
|
|
+ _self.balanceAmount = _self.toFixedFn(_self.payInfo.payUnpaidaMount-_self.payInfo.payAmount);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ changePayAmountBlur:function(event){//失去焦点设置金额
|
|
|
+ var _self = this;
|
|
|
+ _self.payAmount = _self.toFixedFn(event.target.value);
|
|
|
+ _self.payInfo.payAmount = _self.payAmount;
|
|
|
+ },
|
|
|
+ changeTab:function(index,item){//选择支付方式切换
|
|
|
+ this.tabIndex = index;
|
|
|
+ switch (this.tabIndex) {
|
|
|
+ case 0:
|
|
|
+ this.payInfo.payBankNum = 'ALIPAY';
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ this.payInfo.payBankNum = '';
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ checkMobilePay:function(index,bankNum){//选择移动支付方式
|
|
|
+ var _self = this;
|
|
|
+ _self.mobileTabIndex = index;
|
|
|
+ _self.payInfo.payBankNum = bankNum;
|
|
|
+ switch (index) {
|
|
|
+ case 2:// 企业网银
|
|
|
+ _self.bankTabIndex = 0
|
|
|
+ _self.payInfo.payType = '1';
|
|
|
+ _self.payInfo.payUserType = 'ENTERPRISE';
|
|
|
+ break;
|
|
|
+ case 3:// 个人网银
|
|
|
+ _self.bankTabIndex = 0
|
|
|
+ _self.payInfo.payType = '2';
|
|
|
+ _self.payInfo.payUserType = 'USER';
|
|
|
+ break;
|
|
|
+ case 4:// 大额网银
|
|
|
+ _self.bankTabIndex = 0
|
|
|
+ _self.payInfo.payType = '2';
|
|
|
+ _self.payInfo.payUserType = 'USER';
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ checkBankPay:function(index,item){//选择网银支付方式-选择银行
|
|
|
+ var _self = this;
|
|
|
+ _self.bankTabIndex = index;
|
|
|
+ switch (_self.mobileTabIndex) {
|
|
|
+ case 2:// 企业网银
|
|
|
+ _self.payInfo.payBankNum = item.b2B;
|
|
|
+ break;
|
|
|
+ case 3:// 个人网银
|
|
|
+ _self.payInfo.payBankNum = item.b2C;
|
|
|
+ break;
|
|
|
+ case 4:// 大额网银
|
|
|
+ _self.bankTabIndex = 0
|
|
|
+ _self.payInfo.payType = '2';
|
|
|
+ _self.payInfo.payUserType = 'USER';
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ copyLinkPaySubmitFn:function(){//复制网银支付链接
|
|
|
+ var _self = this;
|
|
|
+ if(_self.isPaySwitch && _self.pageType === '2'){
|
|
|
+ CAIMEI.dialog('支付系统遇到点小问题,请稍后重试', false);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(_self.onlinePay == 2){
|
|
|
+ _self.layerConfirm();
|
|
|
+ }else{
|
|
|
+ if(_self.payAmount == ''){
|
|
|
+ CAIMEI.dialog('请输入本次支付金额');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(_self.payAmount == 0){
|
|
|
+ CAIMEI.dialog('本次支付金额不能为0');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(_self.payAmount <= 10){
|
|
|
+ CAIMEI.dialog('网银支付的金额必须大于¥12.00');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ var params = {};
|
|
|
+
|
|
|
+ if(_self.pageType == 2){
|
|
|
+ params = {
|
|
|
+ unpaidAmount:_self.payAmount,
|
|
|
+ vipRecordId: _self.vipRecordId,
|
|
|
+ payType:_self.payInfo.payType,
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ params = {
|
|
|
+ unpaidAmount:_self.payAmount,
|
|
|
+ orderId:_self.payInfo.payOrderId,
|
|
|
+ payType:_self.payInfo.payType
|
|
|
+ }
|
|
|
+ }
|
|
|
+ PayApi.PayOrderPayLink(params,function(response){
|
|
|
+ _self.bankPayLink_url = response.data;
|
|
|
+ var oInput = document.createElement("textarea");
|
|
|
+ oInput.value = _self.bankPayLink_url;
|
|
|
+ document.body.appendChild(oInput);
|
|
|
+ oInput.select(); // 选择对象
|
|
|
+ document.execCommand("Copy"); // 执行浏览器复制命令
|
|
|
+ document.body.removeChild(oInput);
|
|
|
+ CAIMEI.dialog('复制成功');
|
|
|
+ }
|
|
|
+ )
|
|
|
+ }
|
|
|
+ },
|
|
|
+ copyOrderBtnSubmitFn:function(){//复制订单标识
|
|
|
+ var _self = this;
|
|
|
+ var oInput = document.createElement("textarea");
|
|
|
+ oInput.value = _self.orderIdentificationId;
|
|
|
+ document.body.appendChild(oInput);
|
|
|
+ oInput.select(); // 选择对象
|
|
|
+ document.execCommand("Copy"); // 执行浏览器复制命令
|
|
|
+ document.body.removeChild(oInput);
|
|
|
+ CAIMEI.dialog('复制成功');
|
|
|
+ },
|
|
|
+ hidePayAlert:function(){//隐藏已支付弹窗
|
|
|
+ var _self = this;
|
|
|
+ _self.isPayAlert = false;
|
|
|
+ },
|
|
|
+ RefreshBody:function(){//刷新页面
|
|
|
+ var _self = this;
|
|
|
+ if(_self.payInfo.payBankNum == 'WEIXIN'){
|
|
|
+ if( _self.pageType == '2' ){ // 验证支付(支付会员)
|
|
|
+ PayApi.PayOrderPayVipCheck({recordId : _self.vipRecordId},function(response){
|
|
|
+ // console.log(response);
|
|
|
+ if(response.code === 0){
|
|
|
+ _self.windowLocationHref('success');
|
|
|
+ }else{
|
|
|
+ _self.windowLocationHref('error');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }else if(_self.pageType == '3'){ // 验证支付(优惠券)
|
|
|
+ PayApi.PayOrderPayCouponCheck({ couponRecordId: _self.couponRecordId },function(response){
|
|
|
+ // console.log(response);
|
|
|
+ if(response.code === 0){
|
|
|
+ _self.windowLocationHref('success');
|
|
|
+ }else{
|
|
|
+ _self.windowLocationHref('error');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ PayApi.PayOrderPayWhetherSuccess({orderId: _self.payInfo.payOrderId, paySuccessCounter:_self.paySuccessCounter},function(response){
|
|
|
+ _self.isPayAlert = false;
|
|
|
+ if(response.code === 0){
|
|
|
+ _self.windowLocationHref('success');
|
|
|
+ }else{
|
|
|
+ _self.windowLocationHref('error');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ PayApi.PayOrderFindOrderStatus({mbOrderId:_self.mbOrderId},function(response){
|
|
|
+ _self.isPayAlert = false;
|
|
|
+ var data = response.data.data;
|
|
|
+ if(data.status === '1'){
|
|
|
+ _self.windowLocationHref('success');
|
|
|
+ }else{
|
|
|
+ _self.windowLocationHref('error');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ RefreshBigBody:function () {// 校验是否完成银联支付
|
|
|
+ var _self = this;
|
|
|
+ PayApi.PayOrderFindOrderStatus({mbOrderId:_self.mbOrderId},function(response){
|
|
|
+ _self.isPayBigAlert = false;
|
|
|
+ var data = response.data.data;
|
|
|
+ if(data.status === '1'){
|
|
|
+ setTimeout(()=>{
|
|
|
+ window.location.href = '/pay/success.html?pageType=www&type=success&payAmount='+_self.payAmount;
|
|
|
+ },1000)
|
|
|
+ }else{
|
|
|
+ setTimeout(()=>{
|
|
|
+ window.location.href = '/pay/success.html?pageType=unionPay&type=error&payAmount='+_self.payAmount+'&orderId='+_self.payInfo.payOrderId;
|
|
|
+ },1000)
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ windowLocationHref:function(state){
|
|
|
+ var _self = this;
|
|
|
+ if( _self.pageType === '1'){
|
|
|
+ window.location.href = '/pay/success.html?pageType=second&type='+state+'&payAmount='+_self.payAmount;
|
|
|
+ }else if(_self.pageType === '2'){
|
|
|
+ window.location.href = '/pay/success.html?pageType=vip&type='+state+'&payAmount='+_self.payAmount;
|
|
|
+ }else if(_self.pageType === '3') {
|
|
|
+ window.location.href = '/pay/success.html?pageType=coupon&type=' + state + '&payAmount=' + _self.couponInfo.moneyCouponPrice;
|
|
|
+ }else{
|
|
|
+ window.location.href = '/pay/success.html?pageType=www&type='+state+'&payAmount='+_self.payAmount;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ payTypeText:function(state){//处理支付记录文字
|
|
|
+ var stateText = '',
|
|
|
+ stateTextObject={
|
|
|
+ 12:'网银',
|
|
|
+ 13:'微信支付',
|
|
|
+ 14:'支付宝',
|
|
|
+ 15:'微信支付',
|
|
|
+ 16:'余额抵扣',
|
|
|
+ 20:'大额银联转账',
|
|
|
+ };
|
|
|
+ Object.keys(stateTextObject).forEach(function(key) {
|
|
|
+ if(key == state){
|
|
|
+ stateText = stateTextObject[key]
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return stateText;
|
|
|
+ },
|
|
|
+ toFixedFn:function(text){//处理小数点后两位数
|
|
|
+ return Number(text).toFixed(2);
|
|
|
+ },
|
|
|
+ layerConfirm:function(){
|
|
|
+ var _self = this;
|
|
|
+ CAIMEI.Alert('本次交易暂不支持线上支付,请使用线下转账方式付款。','知道了',true,function () {
|
|
|
+ _self.payStatusText = '使用任何一种线上支付方式支付全部金额后,供应商会在24小时后发货(周末、节假日顺延)。若着急发货,可以选择使用线下转账进行付款。';
|
|
|
+ _self.isReceiptStatus = true;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ closeBigAlert:function () {
|
|
|
+ this.isPayBigAlert = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted: function () {
|
|
|
+ var _self = this;
|
|
|
+ // 判断当前支付是订单支付
|
|
|
+ this.pageType = CAIMEI.getUrlParam('pageType');
|
|
|
+ if (this.pageType === '1') {//二手
|
|
|
+ this.productID = CAIMEI.getUrlParam('productID');
|
|
|
+ this.payAmount = _self.toFixedFn(100);
|
|
|
+ this.isRequest = true;
|
|
|
+ this.payStatusText = '';
|
|
|
+ } else if (this.pageType === '2') { // 支付会员
|
|
|
+ this.vipRecordId = parseInt(CAIMEI.getUrlParam('vipRecordId'));
|
|
|
+ this.PayOrderOnLineSwitch();
|
|
|
+ // 从本地获取选中的svip套餐信息后删除本地信息
|
|
|
+ this.comboInfo = JSON.parse(CAIMEI.Storage.getItem('comboInfo'));
|
|
|
+ // CAIMEI.Storage.removeItem('comboInfo');
|
|
|
+ // 设置支付金额
|
|
|
+ this.payAmount = this.toFixedFn(this.comboInfo.price);
|
|
|
+ // 获取银行列表
|
|
|
+ this.getBankList();
|
|
|
+ } else if(this.pageType === '3') {// 支付优惠券
|
|
|
+ this.couponId = parseInt(CAIMEI.getUrlParam('couponId'));
|
|
|
+ this.couponRecordId = parseInt(CAIMEI.getUrlParam('couponRecordId'));
|
|
|
+ this.initCouponDetail(this.couponId);
|
|
|
+ this.PayOrderOnLineSwitch();
|
|
|
+ this.getBankList();
|
|
|
+ }else{
|
|
|
+ var HrefType = CAIMEI.getUrlParam('type');
|
|
|
+ if (HrefType == 'payfirm') {
|
|
|
+ this.payInfo.payOrderId = CAIMEI.getUrlParam('orderId');
|
|
|
+ this.orderIdentificationId = '#' + this.payInfo.payOrderId + '#';
|
|
|
+ } else {
|
|
|
+ var data = JSON.parse(localStorage.getItem("confirmOrderInfo"));
|
|
|
+ this.payInfo.payOrderId = data.data.orderId;
|
|
|
+ this.orderIdentificationId = '#' + this.payInfo.payOrderId + '#';
|
|
|
+ }
|
|
|
+ // 获取银行列表
|
|
|
+ this.getBankList();
|
|
|
+ //正常订单初始化
|
|
|
+ this.infoPayOrderCheckoutCounter();
|
|
|
+ }
|
|
|
+ var viewer = window.navigator.userAgent.toLowerCase();
|
|
|
+ if(viewer.match(/MicroMessenger/i) == 'micromessenger'){
|
|
|
+ this.is_Wechat_bowcr = true;
|
|
|
+ this.payInfo.payBankNum = 'WEIXIN';
|
|
|
+ this.mobileTabIndex = 1;
|
|
|
+ }else{
|
|
|
+ this.is_Wechat_bowcr = false;
|
|
|
+ this.payInfo.payBankNum = 'ALIPAY';
|
|
|
+ this.mobileTabIndex = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+});
|