// e:\project\dy_video_all\dy_iaa_new_project\pages\pay\pay.ts import { httpRequest } from "../../utils/httpReques"; Page({ data: { currentPrice: 0, userInfo: {}, payList: [], platform: '', otherInfo: {}, iosIm: '', effectiveTime: '' }, onLoad(options) { console.log(options, "options") tt.getSystemInfo({ success: (res: any) => { this.setData({ platform: res.platform, otherInfo: options }) } }) }, onShow() { httpRequest('/user', 'POST').then((res: any) => { if (res.status == 1) { this.setData({ userInfo: res.data.info, }) } }) httpRequest('/paysetting', 'POST').then((res: any) => { if (res.status == 1) { this.setData({ payList: res.data.list, iosIm: res.iosIm, effectiveTime: res.data.time }) } }) }, handelSelectPrice(ev: any) { const idx = ev.currentTarget.dataset.idx; this.setData({ currentPrice: idx }) }, handelRechargeNow() { const platform = this.data.platform; const payList = this.data.payList; const currentPrice = this.data.currentPrice; const payItemInfo: any = payList[currentPrice]; const otherInfo: any = this.data.otherInfo; const iosIm = this.data.iosIm; const launchsite = tt.getStorageSync('launchsite') || 1; if (platform == 'ios') { tt.showToast({ title: '暂不支持ios支付', icon: 'none', duration: 2000 }); } else { console.log(payItemInfo, "payItemInfo") if (tt.canIUse('getOrderPayment') && tt.canIUse('requestOrder')) { const params = { id: payItemInfo.id, isback: payItemInfo?.isback == 1 ? 1 : 0, launchsite, sid: otherInfo.sid || '', jid: otherInfo.id || '' } httpRequest('/Newplaceanorder', 'POST', params).then((res: any) => { console.log(res, "paramsparams") if (res.status == 1) { tt.requestOrder({ data: res.data.data, byteAuthorization: res.data.byteAuthorization, payScene: platform === 'ios' ? 'IM' : '', success: (su: any) => { console.log(su, "susu"); tt.showLoading({ title: '拉起支付中...' }) tt.getOrderPayment({ orderId: su.orderId, imId: platform === 'ios' ? iosIm : '', success: (payRes: any) => { tt.hideLoading({}); if (platform != 'ios') { tt.showToast({ title: '支付成功', duration: 2000 }); if (otherInfo.toStatus == 1) { tt.redirectTo({ url: `/pages/videoDetail/videoDetail?sid=${otherInfo.sid}&id=${otherInfo.id || ''}` }); } else { tt.navigateBack({}); } } }, fail: (payError: any) => { console.log(payError); tt.hideLoading({}); }, complete: (complete: any) => { console.log(complete); }, }) }, fail: (failError: any) => { console.log(failError); } }) } }) } } } })