jufubao-third 1.0.17 → 1.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jufubao-third",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "private": false,
5
5
  "description": "聚福宝业务组件第三方购物平台包",
6
6
  "main": "index.js",
@@ -22,7 +22,7 @@
22
22
  <view class="column-item noBorder">
23
23
  <view v-if="product_total_price" class="column_label text_gray">商品总额</view>
24
24
  <view class="column_value text-gray">
25
- <xd-unit
25
+ <xd-unit
26
26
  :colorNew="isShowIcon ? '': '#999'"
27
27
  :price="product_total_price"
28
28
  :isOld="false"
@@ -63,7 +63,7 @@
63
63
  </view>
64
64
  </view>
65
65
  </view>
66
-
66
+
67
67
  <!-- <view v-if="show_vip_card==='Y'" class="pay_section">
68
68
  <cus-vip-list :list="vipCardList"
69
69
  :vip_card_id="vip_card_id"
@@ -344,6 +344,7 @@
344
344
  import { getContainerPropsValue } from "@/utils/xd.base";
345
345
  import CusVipOpenDialog from "@/components/CusVipOpenDialog/CusVipOpenDialog"
346
346
  import getServiceUrl from "@/common/getServiceUrl"
347
+ import {Base64} from "js-base64";
347
348
  export default {
348
349
  name: "JfbThirdPay",
349
350
  components: {
@@ -497,7 +498,7 @@
497
498
  this.validImageAPIUrl = this.brandInfo['api_host'] + '/common/v1/valid_code/image/show'
498
499
 
499
500
  this.getOrderConfirm();
500
-
501
+
501
502
  },
502
503
  /**
503
504
  * @description 监听事件变化
@@ -551,6 +552,29 @@
551
552
  }
552
553
  }).then(res => {
553
554
 
555
+ // #ifdef H5
556
+
557
+ if(res['pay_url']) {
558
+ let url = res['pay_url'];
559
+
560
+ //判断是否为微信小程序宿主
561
+ if(res['pay_jump_type'] === 'wx_mini' && this.isMpInH5Comp) {
562
+ const {host, deploy_dir} = this.brandInfo;
563
+ //未设置success_url参数时候自己拼接
564
+ if(res['pay_url'].indexOf('success_url') === -1) {
565
+ const success_url = `https://${host}/${deploy_dir}${this.orderSuccessPath}?order_id=${res['order_id']}`;
566
+ if(res['pay_url'].indexOf('?') > -1) url += `&success_url=${Base64.encodeURI(success_url)}`;
567
+ else url += `?success_url=${Base64.encodeURI(success_url)}`;
568
+ }
569
+
570
+ url = `/pages/jumptomp/jumptomp?callback=${Base64.encodeURI(url)}&isThird=1`;
571
+ }
572
+
573
+ this.$xdUniHelper.redirectTo({url}, false, true);
574
+ return;
575
+ }
576
+ //#endif
577
+
554
578
  if(res.pay_status === "Y"){
555
579
  //已支付, 跳转成功页
556
580
  this.$xdUniHelper.redirectTo({
@@ -41,7 +41,13 @@ export default {
41
41
  showOldPay(){
42
42
  if(this.payWallet) return false;
43
43
  return true;
44
- }
44
+ },
45
+
46
+ // #ifdef H5
47
+ isMpInH5Comp(){
48
+ return navigator.userAgent.match(/miniprogram/i)
49
+ },
50
+ //#endif
45
51
  },
46
52
  methods: {
47
53
  //选择元宝
@@ -233,7 +239,7 @@ export default {
233
239
  let isMp = false;
234
240
  // #ifdef H5
235
241
  payPath = this.jfbAuthorize.getMpKey('paySetting');
236
- if(navigator.userAgent.match(/miniprogram/i)) isMp = true;
242
+ if(this.isMpInH5Comp) isMp = true;
237
243
  //#endif
238
244
  if(payPath && isMp) {
239
245
  payPath = Base64.encodeURI(`${this.thirdPayPath}?order_id=${res['pay_order_id']}&main_order_id=${res['order_id']}`);
@@ -250,6 +256,14 @@ export default {
250
256
 
251
257
 
252
258
  createSettleOrder(options, successCb){
259
+ // #ifdef H5
260
+ //(小程序套嵌模式下单时候需要设置支付成功页面地址)
261
+ if(this.isMpInH5Comp) {
262
+ const {host, deploy_dir} = this.brandInfo;
263
+ options['success_url'] = `https://${host}/${deploy_dir}${this.orderSuccessPath}?order_id=@order_id@`;
264
+ }
265
+ //#endif
266
+
253
267
  let postData = {
254
268
  ...options,
255
269
  main_order_id: this.main_order_id,
@@ -270,13 +284,15 @@ export default {
270
284
 
271
285
  // #ifdef H5
272
286
  //判断是否为微信小程序宿主
273
- if(navigator.userAgent.match(/miniprogram/i)
274
- && res['pay_jump_type'] === 'wx_mini'
275
- ) {
287
+ if(this.isMpInH5Comp && res['pay_jump_type'] === 'wx_mini') {
276
288
  const {host, deploy_dir} = this.brandInfo;
277
- const success_url = `https://${host}/${deploy_dir}${this.orderSuccessPath}?order_id=${res['order_id']}`;
278
- if(res['pay_url'].indexOf('?') > -1) url += `&success_url=${Base64.encodeURI(success_url)}&callback_url=${encodeURIComponent(success_url)}`;
279
- else url += `?success_url=${Base64.encodeURI(success_url)}&callback_url=${encodeURIComponent(success_url)}`;
289
+ //未设置success_url参数时候自己拼接
290
+ if(res['pay_url'].indexOf('success_url') === -1) {
291
+ const success_url = `https://${host}/${deploy_dir}${this.orderSuccessPath}?order_id=${res['order_id']}`;
292
+ if(res['pay_url'].indexOf('?') > -1) url += `&success_url=${Base64.encodeURI(success_url)}`;
293
+ else url += `?success_url=${Base64.encodeURI(success_url)}`;
294
+ }
295
+
280
296
  url = `/pages/jumptomp/jumptomp?callback=${Base64.encodeURI(url)}&isThird=1`;
281
297
  }
282
298
  //#endif