hlb_payMixin.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  1. 'use strict';
  2. var hlbPayMixin = function () {// 合利宝支付渠道
  3. return {
  4. methods: {
  5. hlb_PayOrderPcMallPay(){// 正常订单网银支付通道
  6. const _this = this;
  7. const params = {//正常订单
  8. payType: 'YL',
  9. payAmount: _this.payAmount,
  10. bankCode: _this.payInfo.payBankNum,
  11. returnUrl: 'https://www.caimei365.com/pay/success.html?pageType=www&type=success&payAmount=' + _this.payAmount,
  12. shopOrderId: _this.payInfo.shopOrderId,
  13. userType: _this.payInfo.payUserType
  14. };
  15. _this.isSubMitStatus=true;
  16. console.log('正常订单合利宝网银支付通道',params)
  17. PayApi.PayOrderPcMallPay(params,function(response){
  18. if(response.code === 0){
  19. _this.iframe = response.data
  20. _this.isIframe = true
  21. _this.$nextTick(() => {
  22. const onlineForm = document.getElementById('onlineForm');
  23. onlineForm.setAttribute('target', '_blank')
  24. _this.mbOrderId = onlineForm.P2_orderId.value
  25. console.log('mbOrderId',_this.mbOrderId)
  26. _this.isSubMitStatus=false;
  27. $('input[type="submit"]').on('click', function(e) {
  28. _this.isPayAlert = true;
  29. _this.isIframe = false
  30. onlineForm.submit();
  31. document.getElementById('onlineForm').remove();
  32. })
  33. })
  34. }else{
  35. _this.isSubMitStatus=false;
  36. CAIMEI.Alert(response.msg,'确定',false);
  37. }
  38. })
  39. },
  40. hlb_PayOrderPcScanAliPay (){// 正常订单支付宝通道
  41. var _this = this;
  42. var params = {//正常订单
  43. payType:'ZFBEWM',
  44. payAmount:_this.payAmount,
  45. returnUrl:'https://www.caimei365.com/',
  46. shopOrderId:_this.payInfo.shopOrderId
  47. };
  48. _this.isSubMitStatus=true;
  49. console.log('正常订单支付宝通道',params)
  50. PayApi.PayOrderPcScanAliPay(params,function(response){
  51. if(response.code == 0){
  52. console.log('data',response.data)
  53. _this.isPayAlert = true;
  54. _this.isSubMitStatus=false;
  55. _this.mbOrderId = response.data.rt5_orderId;
  56. _this.payInfo.payMobileUrl = response.data.rt8_qrcode;
  57. _this.payInfo.payData = {
  58. mbOrderId:_this.mbOrderId,
  59. type:_this.payInfo.payBankNum,
  60. shopOrderId:_this.payInfo.shopOrderId,
  61. amount:_this.payAmount,
  62. url:_this.payInfo.payMobileUrl
  63. };
  64. CAIMEI.Storage.setItem('payData',JSON.stringify(_this.payInfo.payData));
  65. if(!isPC){
  66. location.href = _this.payInfo.payMobileUrl;
  67. }else{
  68. window.open("/pay/caimei-paymobile.html?pageType=0");
  69. }
  70. }else{
  71. CAIMEI.Alert(response.msg,'确定',false);
  72. _this.isSubMitStatus=false;
  73. }
  74. })
  75. },
  76. hlb_PayOrderMiniWxPay (){// 正常订单微信支付通道
  77. console.log('正常订单微信支付通道')
  78. var _this = this;
  79. if(!isPC){
  80. var orderInfo = {//正常订单微信二维码参数
  81. pageType:0,
  82. shopOrderId:_this.payInfo.shopOrderId,
  83. payAmount:_this.payAmount
  84. };
  85. _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";
  86. location.href = _this.payInfo.payMobileUrl;
  87. }else{
  88. _this.payInfo.payData = {//正常订单
  89. type:_this.payInfo.payBankNum,
  90. shopOrderId:_this.payInfo.shopOrderId,
  91. amount:_this.payAmount,
  92. url:_this.payInfo.payMobileUrl
  93. };
  94. CAIMEI.Storage.setItem('payData',JSON.stringify(_this.payInfo.payData));
  95. window.open("/pay/caimei-paymobile.html?pageType=0");
  96. _this.isPayAlert = true;
  97. }
  98. },
  99. hlb_PayCouponUnionPayFn () { // 网银支付购买优惠券
  100. console.log('网银支付购买优惠券');
  101. var _this = this;
  102. var params = {
  103. source:2, //支付来源 1 小程序 2 WWW
  104. payType:'YL',
  105. userId:_this.userId,
  106. couponId: _this.couponId,
  107. couponRecordId:_this.couponRecordId,
  108. bankCode: this.payInfo.payBankNum,
  109. returnUrl: 'https://www.caimei365.com/pay/success.html?pageType=www&type=success&payAmount='+_this.couponInfo.moneyCouponPrice,
  110. userType: _this.payInfo.payUserType,
  111. };
  112. PayApi.PayCouponUnionPay(params, function (response) {
  113. if (response.code == 0) {
  114. _this.isPayAlert = true;
  115. _this.iframe = response.data
  116. _this.$nextTick(() => {
  117. var onlineForm = document.getElementById('onlineForm');
  118. onlineForm.setAttribute('target', '_blank')
  119. _this.mbOrderId = onlineForm.P2_orderId.value
  120. console.log('mbOrderId',_this.mbOrderId)
  121. _this.isSubMitStatus=false;
  122. onlineForm.submit();
  123. })
  124. } else {
  125. _this.isSubMitStatus = false;
  126. CAIMEI.Alert(response.msg, '确定', false);
  127. }
  128. });
  129. },
  130. hlb_PayCouponMiniWxPay(){ // 微信支付优惠券
  131. console.log('微信支付优惠券');
  132. if (!isPC) {
  133. var orderInfo = {//普通订单微信二维码参数
  134. pageType: 3,
  135. payAmount: this.couponInfo.moneyCouponPrice,
  136. couponRecordId:this.couponRecordId,
  137. couponId: this.couponId,
  138. userId : this.userId
  139. };
  140. 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";
  141. location.href = this.payInfo.payMobileUrl;
  142. } else {
  143. this.payInfo.payData = {
  144. type: this.payInfo.payBankNum,
  145. amount: this.couponInfo.moneyCouponPrice,
  146. url: this.payInfo.payMobileUrl,
  147. couponId:this.couponId,
  148. couponRecordId:this.couponRecordId,
  149. userId:this.userId
  150. };
  151. CAIMEI.Storage.setItem('payData', JSON.stringify(this.payInfo.payData));
  152. window.open("/pay/caimei-paymobile.html?pageType=3");
  153. this.isPayAlert = true;
  154. }
  155. },
  156. hlb_PayCouponAliPay(){ // 支付宝支付优惠券
  157. var _this = this;
  158. console.log('支付宝支付优惠券');
  159. var params = {
  160. source:2, //支付来源 1 小程序 2 WWW
  161. payType:'ZFBEWM',
  162. userId:_this.userId,
  163. couponId: _this.couponInfo.couponId,
  164. couponRecordId:_this.couponRecordId,
  165. returnUrl: 'https://www.caimei365.com/',
  166. };
  167. PayApi.PayCouponMiniScanAliPay(params, function(response){
  168. console.log(response);
  169. if (response.code === 0) {
  170. _this.isPayAlert = true;
  171. _this.mbOrderId = response.data.rt5_orderId;
  172. _this.payInfo.payMobileUrl = response.data.rt8_qrcode;
  173. _this.payInfo.payData = {
  174. type: _this.payInfo.payBankNum,
  175. mbOrderId: _this.mbOrderId,
  176. amount: _this.couponInfo.moneyCouponPrice,
  177. url: _this.payInfo.payMobileUrl,
  178. couponId:_this.couponId,
  179. userId:_this.userId
  180. };
  181. CAIMEI.Storage.setItem('payData', JSON.stringify(_this.payInfo.payData));
  182. if (!isPC) {
  183. location.href = _this.payInfo.payMobileUrl;
  184. } else {
  185. window.open("/pay/caimei-paymobile.html?pageType=3");
  186. }
  187. } else {
  188. CAIMEI.Alert(response.msg, '确定', false);
  189. _this.isSubMitStatus = false;
  190. }
  191. });
  192. },
  193. hlb_PayVipPcMallPay(){// 超级会员网银支付通道
  194. var _this = this;
  195. var params = {
  196. payType:'YL',
  197. bankCode: this.payInfo.payBankNum,
  198. returnUrl: 'https://www.caimei365.com/pay/success.html?pageType=vip&type=success&payAmount='+_this.payAmount,
  199. userType: _this.payInfo.payUserType,
  200. vipRecordId: _this.vipRecordId
  201. };
  202. _this.isSubMitStatus=true;
  203. PayApi.PayVipPcMallPay(params, function (response) {
  204. if (response.code == 0) {
  205. _this.isPayAlert = true;
  206. _this.iframe = response.data;
  207. _this.$nextTick(() => {
  208. var onlineForm = document.getElementById('onlineForm');
  209. onlineForm.setAttribute('target', '_blank')
  210. _this.mbOrderId = onlineForm.P2_orderId.value
  211. console.log('mbOrderId',_this.mbOrderId)
  212. _this.isSubMitStatus=false;
  213. onlineForm.submit();
  214. })
  215. } else {
  216. _this.isSubMitStatus = false;
  217. CAIMEI.Alert(response.msg, '确定', false);
  218. }
  219. });
  220. },
  221. hlb_PayVipScanAliPay(){ // 超级会员支付宝通道
  222. var _this = this;
  223. var params = {
  224. payType:'ZFBEWM',
  225. vipRecordId: _this.vipRecordId,
  226. bankCode: _this.payInfo.payBankNum,
  227. userType: _this.payInfo.payUserType,
  228. returnUrl: 'https://www.caimei365.com/',
  229. };
  230. _this.isSubMitStatus = true;
  231. PayApi.PayVipScanAliPay(params, function(response){
  232. console.log(response);
  233. if (response.code === 0) {
  234. _this.isPayAlert = true;
  235. _this.isSubMitStatus = false;
  236. _this.mbOrderId = response.data.rt5_orderId;
  237. _this.payInfo.payMobileUrl = response.data.rt8_qrcode;
  238. _this.payInfo.payData = {
  239. mbOrderId: _this.mbOrderId,
  240. type: _this.payInfo.payBankNum,
  241. amount: _this.payAmount,
  242. url: _this.payInfo.payMobileUrl,
  243. };
  244. CAIMEI.Storage.setItem('payData', JSON.stringify(_this.payInfo.payData));
  245. if (!isPC) {
  246. location.href = _this.payInfo.payMobileUrl;
  247. } else {
  248. window.open("/pay/caimei-paymobile.html?pageType=2&duration=" + _this.comboInfo.duration);
  249. }
  250. } else {
  251. CAIMEI.Alert(response.msg, '确定', false);
  252. _this.isSubMitStatus = false;
  253. }
  254. });
  255. },
  256. hlb_PayVipMiniWxPay(){ // 超级会员微信支付通道
  257. var _this = this;
  258. if (!isPC) {
  259. var orderInfo = {//普通订单微信二维码参数
  260. pageType: 2,
  261. vipId: _this.comboInfo.id,
  262. vipRecordId: _this.vipRecordId,
  263. payAmount: _this.payAmount
  264. };
  265. _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";
  266. location.href = _this.payInfo.payMobileUrl;
  267. } else {
  268. _this.payInfo.payData = {
  269. type: _this.payInfo.payBankNum,
  270. vipId: _this.comboInfo.id,
  271. vipRecordId: _this.vipRecordId,
  272. amount: _this.payAmount,
  273. duration: _this.comboInfo.duration,
  274. };
  275. CAIMEI.Storage.setItem('payData', JSON.stringify(_this.payInfo.payData));
  276. window.open("/pay/caimei-paymobile.html?pageType=2");
  277. _this.isPayAlert = true;
  278. }
  279. },
  280. hlb_PayOrdersecondUnion (){// 二手发布网银支付通道
  281. var _this = this;
  282. var params = {//二手
  283. payType:'YL',
  284. bankCode:_this.payInfo.payBankNum,
  285. returnUrl:'https://www.caimei365.com/pay/success.html?pageType=second&type=success&payAmount='+_this.payAmount,
  286. productId:_this.productID,
  287. userType:_this.payInfo.payUserType,
  288. };
  289. _this.isSubMitStatus=true;
  290. PayApi.PayOrdersecondUnion(params,function(response){
  291. if(response.code == 0){
  292. _this.isPayAlert = true;
  293. _this.iframe = response.data
  294. _this.$nextTick(() => {
  295. var onlineForm = document.getElementById('onlineForm');
  296. onlineForm.setAttribute('target', '_blank')
  297. _this.mbOrderId = onlineForm.P2_orderId.value
  298. console.log('mbOrderId',_this.mbOrderId)
  299. _this.isSubMitStatus=false;
  300. onlineForm.submit();
  301. })
  302. }else{
  303. CAIMEI.Alert(response.msg,'确定',false);
  304. _this.isSubMitStatus=false;
  305. }
  306. })
  307. },
  308. hlb_PayOrdersecondScanAliPay (){// 二手发布支付宝通道
  309. var _this = this;
  310. var params = {//二手
  311. payType:'ZFBEWM',
  312. returnUrl:'https://www.caimei365.com/',
  313. productId:_this.productID,
  314. };
  315. _this.isSubMitStatus=true;
  316. PayApi.PayOrdersecondScanAliPay(params,function(response){
  317. if(response.code == 0){
  318. _this.isPayAlert = true;
  319. _this.isSubMitStatus=false;
  320. _this.mbOrderId = response.data.rt5_orderId;
  321. _this.payInfo.payMobileUrl = response.data.rt8_qrcode;
  322. _this.payInfo.payData = {
  323. mbOrderId:_this.mbOrderId,
  324. type:_this.payInfo.payBankNum,
  325. productId:_this.productID,
  326. amount:_this.payAmount,
  327. url:_this.payInfo.payMobileUrl
  328. };
  329. CAIMEI.Storage.setItem('payData',JSON.stringify(_this.payInfo.payData));
  330. window.open("/pay/caimei-paymobile.html?pageType=1");
  331. }else{
  332. CAIMEI.Alert(response.msg,'确定',false);
  333. _this.isSubMitStatus=false;
  334. }
  335. })
  336. },
  337. hlb_PaySecondMiniWxPay (){// 二手发布微信支付通道
  338. var _this = this;
  339. if(!isPC){// h5跳 H5支付页
  340. var orderInfo = {//二手微信二维码参数
  341. pageType:1,
  342. productId:_this.productID,
  343. payAmount:_this.payAmount
  344. };
  345. _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";
  346. location.href = _this.payInfo.payMobileUrl;
  347. }else{// PC 跳扫码支付页
  348. _this.payInfo.payData = {//二手
  349. type:_this.payInfo.payBankNum,
  350. productId:_this.productID,
  351. amount:_this.payAmount,
  352. url:_this.payInfo.payMobileUrl
  353. };
  354. CAIMEI.Storage.setItem('payData',JSON.stringify(_this.payInfo.payData));
  355. window.open("/pay/caimei-paymobile.html?pageType=1");
  356. _this.isPayAlert = true;
  357. }
  358. },
  359. hlb_CopyLinkPaySubmitFn (params) {
  360. var _this = this;
  361. console.log('合利宝支付链接');
  362. PayApi.PayOrderPayLink(params,function(response){
  363. _this.bankPayLink_url = response.data;
  364. var oInput = document.createElement("textarea");
  365. oInput.value = _this.bankPayLink_url;
  366. document.body.appendChild(oInput);
  367. oInput.select(); // 选择对象
  368. document.execCommand("Copy"); // 执行浏览器复制命令
  369. document.body.removeChild(oInput);
  370. CAIMEI.dialog('复制成功');
  371. }
  372. )
  373. },
  374. }
  375. };
  376. }();