mh_payMixin.js 13 KB

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