|
|
@@ -54,7 +54,7 @@ import wexinPay from '@/utils/pay/wxPay'
|
|
|
import ModalModule from '@/components/plugin/modal'
|
|
|
import AppCouponSel from '@/components/app-coupon-sel'
|
|
|
import { share } from '@/mixins'
|
|
|
-import { rechargeBalance } from '@/api/recharge'
|
|
|
+import { rechargeFn } from '@/api/recharge'
|
|
|
import { postWxCode } from '@/api/mini'
|
|
|
import { getHdInfo } from '@/api/hd'
|
|
|
import { getMemberWeal } from '@/api/member'
|
|
|
@@ -122,7 +122,38 @@ export default {
|
|
|
this.beginInit();
|
|
|
},
|
|
|
beginInit() {
|
|
|
- getHdInfo().then(res=>{
|
|
|
+
|
|
|
+ let that = this
|
|
|
+ let id = 0
|
|
|
+ let salt = ''
|
|
|
+ if(this.option.id && this.option.salt){
|
|
|
+ id = this.option.id?this.option.id:0
|
|
|
+ salt = this.option.salt?this.option.salt:''
|
|
|
+ }else{
|
|
|
+ if(this.option.q){
|
|
|
+ let currentUrl = decodeURIComponent(this.option.q)
|
|
|
+ let str = currentUrl.substring(currentUrl.lastIndexOf("?") + 1)
|
|
|
+ var sceneItem = str.split("&");
|
|
|
+ var arr, name, value;
|
|
|
+ var sceneArray = new Array();
|
|
|
+ for (var i = 0, l = sceneItem.length; i < l; i++) {
|
|
|
+ arr = sceneItem[i].split("=");
|
|
|
+ name = arr[0];
|
|
|
+ value = arr[1];
|
|
|
+ sceneArray[name] = value;
|
|
|
+ }
|
|
|
+ if(sceneArray.id){
|
|
|
+ id =sceneArray.id
|
|
|
+ }
|
|
|
+ if(sceneArray.salt){
|
|
|
+ salt = sceneArray.salt
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.id = id
|
|
|
+ this.salt = salt
|
|
|
+
|
|
|
+ getHdInfo({id:this.id}).then(res=>{
|
|
|
let that = this
|
|
|
if(res.code == 1){
|
|
|
that.hdInfo = res.data.hd ? res.data.hd : []
|
|
|
@@ -148,11 +179,11 @@ export default {
|
|
|
actPrice: this.amount,
|
|
|
payWay: this.payWay,
|
|
|
}
|
|
|
- let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
|
|
|
+ let currentMiniOpenId = uni.getStorageSync('miniOpenId')
|
|
|
params.currentMiniOpenId = currentMiniOpenId
|
|
|
- params.ghsId = this.id
|
|
|
+ params.hdId = this.id
|
|
|
params.salt = this.salt
|
|
|
- rechargeBalance(params).then(res => {
|
|
|
+ rechargeFn(params).then(res => {
|
|
|
this.payCallData = res.data
|
|
|
//错误返回判断
|
|
|
if(res.code == 0){
|
|
|
@@ -195,20 +226,20 @@ export default {
|
|
|
|
|
|
this.payWay = 0
|
|
|
let that = this
|
|
|
- let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
|
|
|
+ let currentMiniOpenId = uni.getStorageSync('miniOpenId')
|
|
|
if (this.$util.isEmpty(currentMiniOpenId)){
|
|
|
uni.showLoading({mask:true})
|
|
|
uni.login({
|
|
|
provider: 'weixin',
|
|
|
success: res => {
|
|
|
- postWxCode({ code: res.code }).then(subRes => {
|
|
|
- uni.hideLoading()
|
|
|
- if(subRes.data.currentMiniOpenId){
|
|
|
- let thisMiniOpenId = subRes.data.currentMiniOpenId
|
|
|
- uni.setStorageSync('currentMiniOpenId',thisMiniOpenId)
|
|
|
- that.toPay()
|
|
|
- }
|
|
|
- })
|
|
|
+ postWxCode({ code: res.code }).then(subRes => {
|
|
|
+ uni.hideLoading()
|
|
|
+ if(subRes.data.currentMiniOpenId){
|
|
|
+ let thisMiniOpenId = subRes.data.currentMiniOpenId
|
|
|
+ uni.setStorageSync('miniOpenId',thisMiniOpenId)
|
|
|
+ that.toPay()
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
}else{
|