159 lines
3.6 KiB
JavaScript
159 lines
3.6 KiB
JavaScript
import { imageBasUrl } from '../../utils/config';
|
|
import { storagePaymentBack } from '../../utils/utils';
|
|
var plugin = requirePlugin("myPlugin");
|
|
const { httpRequest } = getApp();
|
|
|
|
Component({
|
|
mixins: [],
|
|
data: {
|
|
imageBasUrl,
|
|
backShow: false,
|
|
backInfo: {},
|
|
payList: [],
|
|
egoldNum: 0,
|
|
payListId: ''
|
|
},
|
|
props: {
|
|
popupShow: true,
|
|
onClosePopup: {
|
|
type: Function,
|
|
value: (mi) => {
|
|
|
|
}
|
|
}
|
|
},
|
|
didMount() {
|
|
const paramenter = {
|
|
path: '/paysetting',
|
|
method: 'GET',
|
|
}
|
|
httpRequest(paramenter).then(res => {
|
|
if (res.status == 1 && Array.isArray(res.data.list)) {
|
|
const payListId = res.data.list[0].id;
|
|
this.setData({
|
|
payList: res.data.list,
|
|
egoldNum: res.data.egoldNum,
|
|
payListId: payListId
|
|
})
|
|
}
|
|
})
|
|
},
|
|
didUpdate() { },
|
|
didUnmount() { },
|
|
methods: {
|
|
closePopup() {
|
|
// const storageData = my.getStorageSync({ key: 'paymentBack' }).data;
|
|
// if (storageData && storageData.paymentBack) {
|
|
// storagePaymentBack(false);
|
|
this.props.onClosePopup({});
|
|
// } else {
|
|
// storagePaymentBack(true);
|
|
// this.http.get('/payback').then(res => {
|
|
// res.isBack = 1;
|
|
// this.backInfo = res;
|
|
// this.payList.unshift(res);
|
|
// });
|
|
// this.setData({
|
|
// backShow: true
|
|
// })
|
|
// }
|
|
},
|
|
|
|
payItem(ev) {
|
|
const item = ev.currentTarget.dataset.item;
|
|
this.setData({
|
|
payListId: item.id
|
|
})
|
|
plugin.tb.virtualTrade({
|
|
itemId: item.item_id,
|
|
complete: (res) => {
|
|
// if (res.resultCode == '9000') {
|
|
const paramenter = {
|
|
path: '/taobaonotify',
|
|
method: 'POST',
|
|
body: {
|
|
orderId: res.orderId,
|
|
id: item.id,
|
|
resultCode: res.resultCode,
|
|
}
|
|
}
|
|
httpRequest(paramenter).then(result => {
|
|
let content = '';
|
|
if (res.resultCode == '9000') {
|
|
content = '支付成功'
|
|
} else {
|
|
content = '支付失败'
|
|
}
|
|
my.showToast({
|
|
type: 'none',
|
|
content: res.memo || content,
|
|
});
|
|
this.props.onClosePopup({ resultCode: res.resultCode });
|
|
})
|
|
// }
|
|
}
|
|
// fail: (err) => {
|
|
// console.log(err, "errerr")
|
|
// if (res.resultCode == '9000') {
|
|
// const paramenter = {
|
|
// path: '/taobaonotify',
|
|
// method: 'POST',
|
|
// body: {
|
|
// orderId: res.orderId,
|
|
// id: item.id,
|
|
// resultCode: res.resultCode,
|
|
// }
|
|
// }
|
|
// httpRequest(paramenter).then(result => {
|
|
// console.log(result, paramenter, "taobaonotify=========")
|
|
// my.showToast({
|
|
// type: 'none',
|
|
// content: '支付成功',
|
|
// });
|
|
// this.props.onClosePopup({ resultCode: res.resultCode });
|
|
// })
|
|
// }
|
|
// },
|
|
// success: (res) => {
|
|
// console.log(res, "[[[[[[res")
|
|
// if (res.resultCode == '9000') {
|
|
// const paramenter = {
|
|
// path: '/taobaonotify',
|
|
// method: 'POST',
|
|
// body: {
|
|
// orderId: res.orderId,
|
|
// id: item.id,
|
|
// resultCode: res.resultCode,
|
|
// }
|
|
// }
|
|
// httpRequest(paramenter).then(result => {
|
|
// console.log(result, paramenter, "taobaonotify=========")
|
|
// my.showToast({
|
|
// type: 'none',
|
|
// content: '支付成功',
|
|
// });
|
|
// this.props.onClosePopup({ resultCode: res.resultCode });
|
|
// })
|
|
// } else {
|
|
// my.showToast({
|
|
// type: 'none',
|
|
// content: res.memo || '支付失败'
|
|
// });
|
|
// }
|
|
// }
|
|
})
|
|
},
|
|
|
|
closeBackShow() {
|
|
this.setData({
|
|
backShow: false
|
|
})
|
|
},
|
|
|
|
toPurchaseNotes() {
|
|
my.navigateTo({
|
|
url: '/pages/purchaseNotes/purchaseNotes'
|
|
})
|
|
}
|
|
},
|
|
}); |