|
- const extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {}
- let appVersion = extConfig.appVersion;
- var app = getApp();
- const config = require('../../config/config.js')
- const Http = require('../../utils/HttpBasics.js')
-
- Page({
- data: {
- cashOutOpenHeadImg: "", //用户头像
- cashOutOpenNickName: "", //用户名
- cashOutCount: "", //当日已提现次数
- cashOutNumber: "", // 可提现余额
- cashOutSupport: "", // 1 - 支持提现 0-不支持提现
- cashOutLimit: "", // 当日提现次数限制
- city: '',
- userInfo: {},
- flag: 'hidden',
- isSet: false,
- haveData: false,
- organizationType: -1,
- payVersion: '',
- mchType: ''
- },
- toDetail() {
- wx.navigateTo({
- url: `./signInDetail/signInDetail?userInfo=${this.data.userInfo}`
- })
- },
- phone(e) {
- wx.makePhoneCall({
- phoneNumber: e.currentTarget.dataset.phone
- })
- },
- toExit() {
- console.log(1)
- wx.reLaunch({
- url: '/pages/index/index',
- })
- },
- showVersion: function () {
- /**
- * 长按显示版本号
- */
- let that = this;
- if (that.data.flag == 'hidden') {
- that.setData({
- flag: 'show'
- });
- }
- console.log(that.data.flag)
- },
-
- //获取支付配置
- getPayAccount() {
- Http.post({
- url: config.api.getPayAccount,
- data: {
- appId: config.weapp.appId,
- }
- }).then(res => {
- console.log(res, "res")
- this.setData({
- payVersion: res.data.payVersion,
- mchType: res.data.mchType
- })
-
- }).catch(err => {
- wx.showToast({
- title: err.message,
- icon: "none",
- duration: 2000
- })
- })
- },
-
- //获取提现信息
- getTx() {
- Http.get({
- url: config.api.balance
- }).then(res => {
- console.log(111)
- this.setData({
- cashOutCount: res.data.cashOutCount, //当日已提现次数
- cashOutNumber: res.data.cashOutNumber, // 可提现余额
- cashOutSupport: res.data.cashOutSupport, // 1 - 支持提现 0-不支持提现
- cashOutLimit: res.data.cashOutLimit, // 当日提现次数限制
- withdrawNun: res.data.cashOutLimit - res.data.cashOutCount,
- cashOutOpenHeadImg: res.data.cashOutOpenHeadImg,
- cashOutOpenNickName: res.data.cashOutOpenNickName
-
- })
- }).catch(err => {
- wx.showToast({
- title: err.message,
- icon: "none",
- duration: 2000
- })
- })
- },
- onLoad() {
- this.findJurisdiction()
- },
- onShow() {
- // this.getPayAccount()
- this.getTx()
- app.globalData.userInfo().then(res => {
- this.setData({
- userInfo: res
- })
- console.log(this.data.userInfo)
- if (this.data.userInfo.merchant_id) {
- this.findAccountById(this.data.userInfo.merchant_id);
- }
- })
- this.setData({
- appVersion: appVersion
- })
- },
- //提现按钮
- withdraw() {
- console.log(this.data.cashOutOpenNickName)
- wx.navigateTo({
- url: `/pages/withdraw/withdraw?money=${this.data.cashOutNumber}&userTop=${this.data.cashOutOpenHeadImg}&userName=${this.data.cashOutOpenNickName}`,
- })
- },
- /**
- * 查询是否有修改账户权限
- */
- findJurisdiction() {
- Http.get({
- url: config.api.permitModifiy,
- }).then(res => {
- console.log(res)
- /**
- * data:true
- * 如有:显示
- * 没有;不显示
- */
- if (res && res.data == true) {
- this.setData({
- haveData: true,
- })
- } else {
- this.setData({
- haveData: false,
- })
- }
- }).catch(error => {
- console.log(error)
- })
- },
-
- /**
- * 查询收款账户状态
- */
- findAccountById(merchant_id) {
- Http.get({
- url: config.api.findAccountById,
- data: {
- id: merchant_id
- }
- }).then(res => {
- console.log(res)
- /**
- * receiverAccount
- * 如有:已设置收款账户
- * 没有;未设置收款账户
- */
- this.setData({
- mchType: res.data.mchType
- })
- if (res && res.data && res.data.receiver) {
- this.setData({
- isSet: true,
- receiverAccount: res.data.receiver.receiverAccount,
- receiverComments: res.data.receiver.receiverComments,
- receiverType: res.data.receiver.receiverType,
- })
- } else {
- this.setData({
- isSet: false
- })
- }
- }).catch(error => {
- console.log(error)
- })
- }
- })
|