|
|
@ -66,8 +66,8 @@ |
|
|
<goods-column></goods-column> |
|
|
<goods-column></goods-column> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
<share-popup :show="showShareBtn" @close="showShareBtn = false" :goods-id="id" :img-url="goodsDetail.image" |
|
|
<share-popup :show="showShareBtn" @close="showShareBtn = false" :goods-id="id" :img-url="resourceDetail.image" |
|
|
:summary="goodsDetail.remark" :share-title="goodsDetail.name"></share-popup> |
|
|
:summary="resourceDetail.intro" :share-title="resourceDetail.title"></share-popup> |
|
|
<!-- 悬浮按钮 --> |
|
|
<!-- 悬浮按钮 --> |
|
|
<float-tab></float-tab> |
|
|
<float-tab></float-tab> |
|
|
|
|
|
|
|
|
@ -77,6 +77,14 @@ |
|
|
team_min_price |
|
|
team_min_price |
|
|
<script> |
|
|
<script> |
|
|
import { |
|
|
import { |
|
|
|
|
|
resourceOrderBuy |
|
|
|
|
|
} from '@/api/order'; |
|
|
|
|
|
import { |
|
|
|
|
|
prepay, |
|
|
|
|
|
getMnpNotice, |
|
|
|
|
|
getPayway |
|
|
|
|
|
} from '@/api/app'; |
|
|
|
|
|
import { |
|
|
getResourceDetail, |
|
|
getResourceDetail, |
|
|
getGoodsDetail, |
|
|
getGoodsDetail, |
|
|
addCart |
|
|
addCart |
|
|
@ -191,20 +199,74 @@ team_min_price |
|
|
|
|
|
|
|
|
//免费下载 |
|
|
//免费下载 |
|
|
if(goodsType == 0){ |
|
|
if(goodsType == 0){ |
|
|
|
|
|
|
|
|
|
|
|
let msg = "下载中..."; |
|
|
|
|
|
this.showLoading = false |
|
|
|
|
|
uni.showLoading({ |
|
|
|
|
|
title: msg |
|
|
|
|
|
}); |
|
|
|
|
|
console.log(this) |
|
|
uni.downloadFile({ |
|
|
uni.downloadFile({ |
|
|
url: this.goodsDetail.path, //仅为示例,并非真实的资源 |
|
|
url: this.resourceDetail.path, //仅为示例,并非真实的资源 |
|
|
success: (res) => { |
|
|
success: (res) => { |
|
|
if (res.statusCode === 200) { |
|
|
if (res.statusCode === 200) { |
|
|
console.log('下载成功'); |
|
|
console.log(res); |
|
|
|
|
|
uni.saveFile({ |
|
|
|
|
|
tempFilePath: res.tempFilePath, |
|
|
|
|
|
success: function (res2) { |
|
|
|
|
|
var savedFilePath = res2.savedFilePath; |
|
|
|
|
|
let msg = "文件存储到"+savedFilePath; |
|
|
|
|
|
uni.showLoading({ |
|
|
|
|
|
title: msg |
|
|
|
|
|
}); |
|
|
|
|
|
setTimeout(function () { |
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
}, 2000); |
|
|
|
|
|
}, |
|
|
|
|
|
fail: function(err) { |
|
|
|
|
|
uni.showLoading({ |
|
|
|
|
|
title: "下载失败" |
|
|
|
|
|
}); |
|
|
|
|
|
setTimeout(function () { |
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
}, 2000); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
// uni.downloadFile({ |
|
|
|
|
|
// url: this.resourceDetail.path,//文件的下载路径 |
|
|
|
|
|
// success(res) { |
|
|
|
|
|
// //保存到本地 |
|
|
|
|
|
// uni.saveFile({ |
|
|
|
|
|
// tempFilePath: res.tempFilePath,//文件的临时路径 |
|
|
|
|
|
// success: function(res) { |
|
|
|
|
|
// const savedFilePath = res.savedFilePath; |
|
|
|
|
|
// // 打开文件 |
|
|
|
|
|
// uni.openDocument({ |
|
|
|
|
|
// filePath: savedFilePath, |
|
|
|
|
|
// success: function(res) { |
|
|
|
|
|
// uni.hideLoading() |
|
|
|
|
|
// }, |
|
|
|
|
|
// fail: function(res) {}, |
|
|
|
|
|
// complete: function(res) { |
|
|
|
|
|
// setTimeout(uni.hideLoading(), 4000) |
|
|
|
|
|
// }, |
|
|
|
|
|
// }); |
|
|
|
|
|
// }, |
|
|
|
|
|
// fail: function(err) { } |
|
|
|
|
|
// }); |
|
|
|
|
|
// }, |
|
|
|
|
|
// fail(res) {} |
|
|
|
|
|
// }) |
|
|
}else if(goodsType == 1){ //vip会员开通页面 |
|
|
}else if(goodsType == 1){ //vip会员开通页面 |
|
|
uni.navigateTo({ |
|
|
uni.navigateTo({ |
|
|
url: '/pages/user/vip' |
|
|
url: '/pages/user/vip' |
|
|
}); |
|
|
}); |
|
|
}else if(goodsType == 2){ //下单购买页面 |
|
|
}else if(goodsType == 2){ //下单购买页面 |
|
|
console.log('购买页') |
|
|
console.log('购买页') |
|
|
|
|
|
this.onSubmitOrder(); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
changeActive(index) { |
|
|
changeActive(index) { |
|
|
@ -287,62 +349,99 @@ team_min_price |
|
|
this.popupType = type; |
|
|
this.popupType = type; |
|
|
this.showSpec = true; |
|
|
this.showSpec = true; |
|
|
}, |
|
|
}, |
|
|
onBuy(e) { |
|
|
|
|
|
if (!this.isLogin) return this.$Router.push('/pages/login/login') |
|
|
getAuthMsg() { |
|
|
const { |
|
|
return new Promise(resolve => { |
|
|
id, |
|
|
getMnpNotice({ |
|
|
goodsNum |
|
|
scene: 1 |
|
|
} = e.detail; |
|
|
}).then(res => { |
|
|
const params = { |
|
|
if (res.code == 1) { |
|
|
goods: [{ |
|
|
uni.requestSubscribeMessage({ |
|
|
item_id: id, |
|
|
tmplIds: res.data, |
|
|
num: goodsNum, |
|
|
|
|
|
goods_id: this.id, |
|
|
fail(res) { |
|
|
shop_id: this.shop.id, |
|
|
console.log(res.errMsg); |
|
|
delivery_type: this.goodsDetail.type |
|
|
}, |
|
|
}], |
|
|
|
|
|
type: 'buy' |
|
|
complete() { |
|
|
}; |
|
|
resolve(); |
|
|
this.showSpec = false |
|
|
} |
|
|
this.goodsType == 2 ? (params.teamId = this.team.id) : ''; |
|
|
|
|
|
this.foundId ? (params.foundId = this.foundId) : ''; |
|
|
}); |
|
|
this.$Router.push({ |
|
|
} else { |
|
|
path: '/pages/confirm_order/confirm_order', |
|
|
resolve(); |
|
|
query: { |
|
|
} |
|
|
data: params |
|
|
}); |
|
|
} |
|
|
}); |
|
|
}) |
|
|
|
|
|
}, |
|
|
}, |
|
|
onConfirm(e) { |
|
|
onSubmitOrder() { |
|
|
const { |
|
|
uni.showModal({ |
|
|
team: { |
|
|
title: '温馨提示', |
|
|
team_id |
|
|
content: '是否确认购买?', |
|
|
} |
|
|
confirmColor: '#FF2C3C', |
|
|
} = this; |
|
|
confirmText:"前往支付", |
|
|
|
|
|
success: async res => { |
|
|
teamCheck({ |
|
|
let { |
|
|
team_id: this.foundId, |
|
|
confirm |
|
|
// found_id: this.foundId, |
|
|
} = res; |
|
|
goods_id: e.detail.goods_id, |
|
|
if (confirm) { |
|
|
item_id: e.detail.id, |
|
|
// #ifdef MP-WEIXIN |
|
|
count: e.detail.goodsNum |
|
|
await this.getAuthMsg(); |
|
|
}).then(res => { |
|
|
//#endif |
|
|
if (res.code == 1) { |
|
|
this.showLoading = true |
|
|
this.onBuy(e); |
|
|
this.orderBuyFun('submit'); |
|
|
} |
|
|
} |
|
|
}); |
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
|
|
|
async orderBuyFun() { |
|
|
|
|
|
const submitObj = { |
|
|
|
|
|
org_id: this.id //当前购买的资料id |
|
|
|
|
|
}; |
|
|
|
|
|
let { |
|
|
|
|
|
data: orderData, |
|
|
|
|
|
code: orderCode, |
|
|
|
|
|
msg: orderMsg |
|
|
|
|
|
} = await resourceOrderBuy(submitObj) |
|
|
|
|
|
|
|
|
|
|
|
if (orderCode !== 1) return this.showLoading = false |
|
|
|
|
|
this.showLoading = false |
|
|
|
|
|
let order_id = orderData.trade_id; |
|
|
|
|
|
|
|
|
|
|
|
uni.$on('payment', params => { |
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
if (params.result) { |
|
|
|
|
|
console.log('Jason', this) |
|
|
|
|
|
this.$Router.replace({ |
|
|
|
|
|
path: '/pages/pay_result/pay_result', |
|
|
|
|
|
query: { |
|
|
|
|
|
id: params.order_id, |
|
|
|
|
|
type:2, |
|
|
|
|
|
org_id:this.id, |
|
|
|
|
|
from: "trade" |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} else { |
|
|
|
|
|
location.reload() |
|
|
|
|
|
} |
|
|
|
|
|
}, 1 * 500) |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
uni.navigateTo({ |
|
|
|
|
|
url: `/pages/payment/payment?from=trade&order_id=${order_id}` |
|
|
|
|
|
}) |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
async onShareAppMessage() { |
|
|
async onShareAppMessage() { |
|
|
const { |
|
|
const { |
|
|
goodsDetail, |
|
|
resourceDetail, |
|
|
inviteCode, |
|
|
inviteCode, |
|
|
team |
|
|
team |
|
|
} = this; |
|
|
} = this; |
|
|
return { |
|
|
return { |
|
|
title: team.share_title || goodsDetail.name, |
|
|
title: resourceDetail.title, |
|
|
imageUrl: goodsDetail.image, |
|
|
imageUrl: resourceDetail.image, |
|
|
path: '/pages/goods_details/goods_details?id=' + this.id + "&invite_code=" + inviteCode |
|
|
path: '/pages/resource_details/resource_details?id=' + this.id |
|
|
}; |
|
|
}; |
|
|
}, |
|
|
}, |
|
|
computed: { |
|
|
computed: { |
|
|
|