|
@@ -13,6 +13,8 @@ import {
|
|
|
} from 'vue'
|
|
|
import styles from './index.module.less'
|
|
|
import { useRoute, useRouter } from 'vue-router'
|
|
|
+import { state as baseState } from '@/state'
|
|
|
+import { orderStatus } from '@/views/order-detail/orderStatus'
|
|
|
import {
|
|
|
listenerMessage,
|
|
|
postMessage,
|
|
@@ -43,7 +45,9 @@ export default defineComponent({
|
|
|
list: [] as any,
|
|
|
isDownloading: false // 是否在下载资源
|
|
|
})
|
|
|
-
|
|
|
+ const apiSuffix = ref(
|
|
|
+ baseState.platformType === 'STUDENT' ? '/api-student' : '/api-teacher'
|
|
|
+ )
|
|
|
/** 获取课件详情 */
|
|
|
const getDetail = async () => {
|
|
|
try {
|
|
@@ -130,7 +134,11 @@ export default defineComponent({
|
|
|
|
|
|
const handleClick = async (item: any) => {
|
|
|
if (!data.detail?.play) {
|
|
|
- gotoPlay(item)
|
|
|
+ if (!browser().isApp) {
|
|
|
+ onDownloadApp()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ onSubmit()
|
|
|
return
|
|
|
}
|
|
|
if (!item.knowledgePointList) {
|
|
@@ -268,6 +276,101 @@ export default defineComponent({
|
|
|
document.documentElement.scrollTop
|
|
|
data.titleOpacity = height > 100 ? 1 : height / 100
|
|
|
})
|
|
|
+ // 购买
|
|
|
+ const onSubmit = async () => {
|
|
|
+ const url =
|
|
|
+ apiSuffix.value +
|
|
|
+ '/tenantGroupAlbum/buyAlbumInfo?tenantGroupAlbumId=' +
|
|
|
+ (route.query.taId || '')
|
|
|
+ // if (state.albumId) {
|
|
|
+ // url = url + '?albumId=' + state.albumId
|
|
|
+ // }
|
|
|
+ const { data } = await request.get(url)
|
|
|
+ const details = data[0]
|
|
|
+ orderStatus.orderObject.orderType = 'TENANT_ALBUM'
|
|
|
+ orderStatus.orderObject.orderName = details.name
|
|
|
+ orderStatus.orderObject.orderDesc = details.name
|
|
|
+ orderStatus.orderObject.actualPrice = details.actualPrice
|
|
|
+ // orderStatus.orderObject.recomUserId = route.query.recomUserId || 0
|
|
|
+ // orderStatus.orderObject.activityId = route.query.activityId || 0
|
|
|
+ orderStatus.orderObject.orderNo = ''
|
|
|
+ orderStatus.orderObject.orderList = [
|
|
|
+ {
|
|
|
+ orderType: 'TENANT_ALBUM',
|
|
|
+ goodsName: details.name,
|
|
|
+ actualPrice: details.actualPrice,
|
|
|
+ price: details.actualPrice,
|
|
|
+ ...details
|
|
|
+ }
|
|
|
+ ]
|
|
|
+
|
|
|
+ const res = await request.post('/api-student/userOrder/getPendingOrder', {
|
|
|
+ data: {
|
|
|
+ goodType: 'TENANT_ALBUM',
|
|
|
+ bizId: details.id
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ const result = res.data
|
|
|
+ if (result) {
|
|
|
+ Dialog.confirm({
|
|
|
+ title: '提示',
|
|
|
+ message: '您有一个未支付的订单,是否继续支付?',
|
|
|
+ theme: 'round-button',
|
|
|
+ className: 'confirm-button-group',
|
|
|
+ cancelButtonText: '取消订单',
|
|
|
+ confirmButtonText: '继续支付'
|
|
|
+ })
|
|
|
+ .then(async () => {
|
|
|
+ orderStatus.orderObject.orderNo = result.orderNo
|
|
|
+ orderStatus.orderObject.actualPrice = result.actualPrice
|
|
|
+ orderStatus.orderObject.discountPrice = result.discountPrice
|
|
|
+ orderStatus.orderObject.paymentConfig = {
|
|
|
+ ...result.paymentConfig,
|
|
|
+ paymentVendor: result.paymentVendor,
|
|
|
+ paymentVersion: result.paymentVersion
|
|
|
+ }
|
|
|
+
|
|
|
+ routerToALBUM(details.id)
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ Dialog.close()
|
|
|
+ // 只用取消订单,不用做其它处理
|
|
|
+ cancelPaymentALBUM(result.orderNo)
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ routerToALBUM(details.id)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const cancelPaymentALBUM = async (orderNo: string) => {
|
|
|
+ try {
|
|
|
+ await request.post('/api-student/userOrder/orderCancel/v2', {
|
|
|
+ data: {
|
|
|
+ orderNo
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } catch {
|
|
|
+ //
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const routerToALBUM = (id: string) => {
|
|
|
+ router.push({
|
|
|
+ path: '/orderDetail',
|
|
|
+ query: {
|
|
|
+ orderType: 'ALBUM',
|
|
|
+ album: id
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ const onDownloadApp = () => {
|
|
|
+ Dialog.alert({
|
|
|
+ title: '提示',
|
|
|
+ message: '请在酷乐秀APP中使用',
|
|
|
+ confirmButtonColor: '#2dc7aa'
|
|
|
+ }).then(() => {
|
|
|
+ window.location.href = location.origin + '/student/#/download'
|
|
|
+ })
|
|
|
+ }
|
|
|
return () => (
|
|
|
<div class={styles.courseList}>
|
|
|
<TheSticky position="top">
|
|
@@ -396,7 +499,7 @@ export default defineComponent({
|
|
|
<ColResult tips="暂无内容" classImgSize="SMALL" btnStatus={false} />
|
|
|
)}
|
|
|
<TheSticky position="bottom">
|
|
|
- {!data.detail.play && (
|
|
|
+ {data.detail.id && !data.detail.play && (
|
|
|
<div class={styles.footers}>
|
|
|
<Button
|
|
|
round
|
|
@@ -404,7 +507,11 @@ export default defineComponent({
|
|
|
type="primary"
|
|
|
color="linear-gradient(270deg, #FF3C81 0%, #FF76A6 100%)"
|
|
|
onClick={() => {
|
|
|
- //
|
|
|
+ if (!browser().isApp) {
|
|
|
+ onDownloadApp()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ onSubmit()
|
|
|
}}
|
|
|
>
|
|
|
开通训练教程
|