caimei-wechatpay.js 3.6 KB

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