|
|
@ -122,6 +122,7 @@ |
|
|
|
// if (options.item) { |
|
|
|
// let item = JSON.parse(decodeURIComponent(options.item)); |
|
|
|
// } |
|
|
|
console.log(options.id,"opID"); |
|
|
|
this.item.id = options.id |
|
|
|
}, |
|
|
|
components: { |
|
|
@ -130,6 +131,8 @@ |
|
|
|
data() { |
|
|
|
return { |
|
|
|
upTopList: [], |
|
|
|
payList: [], |
|
|
|
payId: null, |
|
|
|
item: { |
|
|
|
day: 0, |
|
|
|
money: 0, |
|
|
@ -157,6 +160,7 @@ |
|
|
|
id: this.item.id |
|
|
|
}, res => { |
|
|
|
if (res.code == 200) { |
|
|
|
console.log(res.result,"res.result"); |
|
|
|
this.item = res.result |
|
|
|
|
|
|
|
// 计算推广时间加上置顶时间 |
|
|
@ -192,6 +196,7 @@ |
|
|
|
this.$api('indexTopPayList', res => { |
|
|
|
if (res.code == 200) { |
|
|
|
for (var i = 0; i < res.result.length; i++) { |
|
|
|
this.payList = res.result |
|
|
|
this.upTopList.push({ |
|
|
|
name: '置顶' + res.result[i].day + '天' + res.result[i].money + '元' |
|
|
|
}) |
|
|
@ -207,7 +212,13 @@ |
|
|
|
|
|
|
|
// 如果匹配到数字,则输出 |
|
|
|
if (matches && matches.length >= 2) { |
|
|
|
console.log(matches, "matches"); |
|
|
|
// console.log(matches, "matches"); |
|
|
|
for (var i = 0; i < this.payList.length; i++) { |
|
|
|
if (this.payList[i].day == matches[0]) { |
|
|
|
this.payId = this.payList[i].id |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 提取天数和金额 |
|
|
|
this.popupData.day = matches[0]; // 例如,置顶天数 |
|
|
@ -251,41 +262,38 @@ |
|
|
|
payOrder() { |
|
|
|
let self = this |
|
|
|
|
|
|
|
console.log(self.item.id, "self.item.id"); |
|
|
|
let data = { |
|
|
|
id: this.item.id, |
|
|
|
day: this.popupData.day, |
|
|
|
money: this.popupData.money, |
|
|
|
id: self.item.id, |
|
|
|
dayId: self.payId |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.$api('confirmPromotion', data, |
|
|
|
self.$api('confirmPromotion', data, |
|
|
|
res => { |
|
|
|
console.log(res,"res"); |
|
|
|
if (res.code == 200) { |
|
|
|
if (self.form.topId) { |
|
|
|
uni.requestPayment({ |
|
|
|
provider: 'wxpay', // 服务提提供商 |
|
|
|
timeStamp: res.result.timeStamp, // 时间戳 |
|
|
|
nonceStr: res.result.nonceStr, // 随机字符串 |
|
|
|
package: res.result.packageValue, |
|
|
|
signType: res.result.signType, // 签名算法 |
|
|
|
paySign: res.result.paySign, // 签名 |
|
|
|
success: function(res) { |
|
|
|
console.log('支付成功', res); |
|
|
|
self.$refs.confirmationPopupUpload.open() |
|
|
|
// self.$refs.confirmationPopup.close() |
|
|
|
}, |
|
|
|
fail: function(err) { |
|
|
|
console.log('支付失败', err); |
|
|
|
self.$refs.confirmationPopup.close() |
|
|
|
uni.showToast({ |
|
|
|
icon: 'none', |
|
|
|
title: "支付失败" |
|
|
|
}) |
|
|
|
} |
|
|
|
}); |
|
|
|
} else { |
|
|
|
self.$refs.confirmationPopupUpload.open() |
|
|
|
} |
|
|
|
uni.requestPayment({ |
|
|
|
provider: 'wxpay', // 服务提提供商 |
|
|
|
timeStamp: res.result.timeStamp, // 时间戳 |
|
|
|
nonceStr: res.result.nonceStr, // 随机字符串 |
|
|
|
package: res.result.packageValue, |
|
|
|
signType: res.result.signType, // 签名算法 |
|
|
|
paySign: res.result.paySign, // 签名 |
|
|
|
success: function(res) { |
|
|
|
console.log('支付成功', res); |
|
|
|
self.$refs.confirmationPopupUpload.open() |
|
|
|
// self.$refs.confirmationPopup.close() |
|
|
|
}, |
|
|
|
fail: function(err) { |
|
|
|
console.log('支付失败', err); |
|
|
|
self.$refs.confirmationPopup.close() |
|
|
|
uni.showToast({ |
|
|
|
icon: 'none', |
|
|
|
title: "支付失败" |
|
|
|
}) |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|