caimei-wechatpay.js 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /**
  2. *Created by ZHJY on 2020/7/14.
  3. */
  4. var payContainer = new Vue({
  5. el:"#payContainer",
  6. mixins: [mhWechatMixin,hlbWechatMixin],
  7. data: {
  8. paymentChannel:'HLB',
  9. orderID:'',
  10. pageType:0,//页面跳转类型 0:订单 1:二手 2:超级会员 3:优惠券 4:认证通会员
  11. payAmount:0,//本次支付金额
  12. wechatcode:'',//微信code
  13. state:0,//随机数
  14. isRequest:false,
  15. productId:'',//二手商品ID
  16. vipId: null, // vip套餐id
  17. vipRecordId: undefined,
  18. couponId: undefined,//优惠券Id
  19. couponRecordId:undefined,//优惠券记录Id
  20. userId : undefined //购买优惠券的用户Id
  21. },
  22. computed: {
  23. },
  24. methods: {
  25. infoPayOrderCheckoutCounter:function(){//初始化订单数据
  26. var _this = this;
  27. // _this.wechatcode = CAIMEI.getUrlParam('code');
  28. // _this.state = JSON.parse(decodeURIComponent(CAIMEI.getUrlParam('state')));
  29. // _this.payAmount = _this.state.payAmount;
  30. // _this.pageType = _this.state.pageType;
  31. _this.isRequest = true;
  32. if( _this.pageType == 1){
  33. _this.productId = _this.state.productId;
  34. }else if(_this.pageType == 2 || _this.pageType == 4){
  35. _this.vipId = _this.state.vipId;
  36. _this.vipRecordId = _this.state.vipRecordId;
  37. }else if(_this.pageType == 3){
  38. _this.couponId = _this.state.couponId;
  39. _this.couponRecordId = _this.state.couponRecordId;
  40. _this.userId = _this.state.userId;
  41. }else{
  42. _this.orderID = _this.state.orderID;
  43. }
  44. },
  45. WxPaySubmit:function(){
  46. if(this.paymentChannel == 'HLB'){
  47. this.hlbWechatPayFn()
  48. }else{
  49. this.mhWechatPayFn()
  50. }
  51. },
  52. hlbWechatPayFn:function () {// 合利宝
  53. console.log('=========>合利宝')
  54. if (this.pageType == 1) {// 二手
  55. this.hlb_WxRequestsecondHandPay();
  56. } else if (this.pageType == 2) {
  57. this.hlb_WxRequestPaymentVipFn();
  58. } else if (this.pageType == 3) {
  59. this.hlb_WxRequestPaymentCouponFn();
  60. } else if (this.pageType === 4){
  61. this.hlb_WxRequestPaymentAuthVipFn();
  62. } else {
  63. this.hlb_WxRequestPaymentFn();
  64. }
  65. },
  66. mhWechatPayFn:function () {// 米花
  67. console.log('=========>米花')
  68. if (this.pageType == 1) {
  69. this.mh_WxRequestsecondHandPay();
  70. } else if (this.pageType == 2) {
  71. this.mh_WxRequestPaymentVipFn();
  72. } else if (this.pageType == 3) {
  73. this.mh_WxRequestPaymentCouponFn();
  74. } else if (this.pageType === 4){
  75. this.mh_WxRequestPaymentAuthVipFn();
  76. } else {
  77. this.mh_WxRequestPaymentFn();
  78. }
  79. },
  80. rand:function (min,max) {//随机数
  81. return Math.floor(Math.random()*(max-min))+min;
  82. },
  83. toFixedFn:function(text){//处理小数点后两位数
  84. return Number(text).toFixed(2);
  85. },
  86. },
  87. mounted: function () {
  88. var _this = this;
  89. _this.infoPayOrderCheckoutCounter();
  90. }
  91. });