|
@@ -3,7 +3,7 @@ import { useRoute, useRouter } from 'vue-router'
|
|
|
import request from '@/helpers/request'
|
|
|
import ColHeader from '@/components/col-header'
|
|
|
import { postMessage } from '@/helpers/native-message'
|
|
|
-import { Button, Icon, Image, List, NavBar, Sticky } from 'vant'
|
|
|
+import { Button, Dialog, Icon, Image, List, NavBar, Sticky } from 'vant'
|
|
|
// import classNames from 'classnames'
|
|
|
// import Footer from '../album/footer'
|
|
|
// import FavoriteIcon from '../album/favorite.svg'
|
|
@@ -22,6 +22,9 @@ import Song from '../component/song'
|
|
|
import ColResult from '@/components/col-result'
|
|
|
import MusicGrid from '../component/music-grid'
|
|
|
import { useEventTracking } from '@/helpers/hooks'
|
|
|
+import ColSticky from '@/components/col-sticky'
|
|
|
+import { moneyFormat } from '@/helpers/utils'
|
|
|
+import { orderStatus } from '@/views/order-detail/orderStatus'
|
|
|
|
|
|
const noop = () => {}
|
|
|
|
|
@@ -122,6 +125,82 @@ export default defineComponent({
|
|
|
favoriteLoading.value = false
|
|
|
}
|
|
|
|
|
|
+ const onBuy = async () => {
|
|
|
+ const album = albumDetail.value
|
|
|
+ orderStatus.orderObject.orderType = 'ALBUM'
|
|
|
+ orderStatus.orderObject.orderName = album.albumName
|
|
|
+ orderStatus.orderObject.orderDesc = album.albumName
|
|
|
+ orderStatus.orderObject.actualPrice = album.albumPrice
|
|
|
+ // orderStatus.orderObject.recomUserId = this.recomUserId
|
|
|
+ // orderStatus.orderObject.activityId = this.activityId
|
|
|
+ orderStatus.orderObject.orderNo = ''
|
|
|
+ orderStatus.orderObject.orderList = [
|
|
|
+ {
|
|
|
+ orderType: 'ALBUM',
|
|
|
+ goodsName: album.albumName,
|
|
|
+ price: album.albumPrice,
|
|
|
+ ...album
|
|
|
+ }
|
|
|
+ ]
|
|
|
+
|
|
|
+ const res = await request.post('/api-student/userOrder/getPendingOrder', {
|
|
|
+ data: {
|
|
|
+ goodType: 'ALBUM',
|
|
|
+ bizId: album.id
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ const result = res.data
|
|
|
+ if (result) {
|
|
|
+ Dialog.confirm({
|
|
|
+ title: '提示',
|
|
|
+ message: '您有一个未支付的订单,是否继续支付?',
|
|
|
+ confirmButtonColor: '#269a93',
|
|
|
+ cancelButtonText: '取消订单',
|
|
|
+ confirmButtonText: '继续支付'
|
|
|
+ })
|
|
|
+ .then(async () => {
|
|
|
+ orderStatus.orderObject.orderNo = result.orderNo
|
|
|
+ orderStatus.orderObject.actualPrice = result.actualPrice
|
|
|
+ orderStatus.orderObject.discountPrice = result.discountPrice
|
|
|
+ routerTo()
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ Dialog.close()
|
|
|
+ // 只用取消订单,不用做其它处理
|
|
|
+ cancelPayment(result.orderNo)
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ routerTo()
|
|
|
+ }
|
|
|
+ // this.$router.push({
|
|
|
+ // path: '/orderDetail',
|
|
|
+ // query: {
|
|
|
+ // orderType: 'VIP'
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ }
|
|
|
+ const routerTo = () => {
|
|
|
+ const album = albumDetail.value
|
|
|
+ router.push({
|
|
|
+ path: '/orderDetail',
|
|
|
+ query: {
|
|
|
+ orderType: 'ALBUM',
|
|
|
+ album: album.id
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ const cancelPayment = async (orderNo: string) => {
|
|
|
+ try {
|
|
|
+ await request.post('/api-student/userOrder/orderCancel', {
|
|
|
+ data: {
|
|
|
+ orderNo
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // this.routerTo()
|
|
|
+ } catch {}
|
|
|
+ }
|
|
|
+
|
|
|
return () => {
|
|
|
return (
|
|
|
<div class={styles.detail}>
|
|
@@ -144,6 +223,12 @@ export default defineComponent({
|
|
|
<div class={styles.bg}>
|
|
|
<div class={styles.alumWrap}>
|
|
|
<div class={styles.img}>
|
|
|
+ {albumDetail.value?.paymentType && (
|
|
|
+ <span class={styles.albumType}>
|
|
|
+ {albumDetail.value?.paymentType === 'FREE' && '免费'}
|
|
|
+ {albumDetail.value?.paymentType === 'CHARGE' && '付费'}
|
|
|
+ </span>
|
|
|
+ )}
|
|
|
<Image
|
|
|
class={styles.image}
|
|
|
width="100%"
|
|
@@ -174,14 +259,23 @@ export default defineComponent({
|
|
|
</div>
|
|
|
<div class={styles.alumCollect}>
|
|
|
<img src={IconPan} />
|
|
|
- <span>共{albumDetail.value?.musicSheetCount}首曲目{state.platformType}</span>
|
|
|
+ <span>
|
|
|
+ 共{albumDetail.value?.musicSheetCount}首曲目{state.platformType}
|
|
|
+ </span>
|
|
|
<div
|
|
|
- class={styles.right}
|
|
|
- onClick={() => toggleFavorite(albumDetail.value?.id)}
|
|
|
- >
|
|
|
- <img src={favorited.value ? iStart : oStart} />
|
|
|
- <span>{albumFavoriteCount.value}人收藏</span>
|
|
|
- </div>
|
|
|
+ class={styles.right}
|
|
|
+ onClick={() => toggleFavorite(albumDetail.value?.id)}
|
|
|
+ >
|
|
|
+ <img src={favorited.value ? iStart : oStart} />
|
|
|
+ <span>{albumFavoriteCount.value}人收藏</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class={styles.albumTips}>
|
|
|
+ <span>此专辑为收费类型,购买即可自由练习该专辑</span>
|
|
|
+ <span class={styles.albumPrice}>
|
|
|
+ ¥{moneyFormat(albumDetail.value?.albumPrice)}
|
|
|
+ </span>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class={styles.alumnContainer}>
|
|
@@ -237,6 +331,42 @@ export default defineComponent({
|
|
|
</>
|
|
|
)}
|
|
|
</div>
|
|
|
+
|
|
|
+ {albumDetail.value?.paymentType === 'CHARGE' && (
|
|
|
+ <ColSticky position="bottom" background="white">
|
|
|
+ <div
|
|
|
+ class={[
|
|
|
+ 'btnGroup',
|
|
|
+ albumDetail.value?.musicPaymentTypes.includes('CHARGE') &&
|
|
|
+ 'btnMore'
|
|
|
+ ]}
|
|
|
+ style={{ paddingTop: '12px' }}
|
|
|
+ >
|
|
|
+ <Button
|
|
|
+ block
|
|
|
+ round
|
|
|
+ type="primary"
|
|
|
+ style={{ fontSize: '16px' }}
|
|
|
+ onClick={onBuy}
|
|
|
+ >
|
|
|
+ 购买专辑
|
|
|
+ </Button>
|
|
|
+ {albumDetail.value?.musicPaymentTypes.includes('VIP') && (
|
|
|
+ <Button
|
|
|
+ block
|
|
|
+ round
|
|
|
+ type="primary"
|
|
|
+ style={{ fontSize: '16px' }}
|
|
|
+ onClick={() => {
|
|
|
+ router.push('/memberCenter')
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 开通会员
|
|
|
+ </Button>
|
|
|
+ )}
|
|
|
+ </div>
|
|
|
+ </ColSticky>
|
|
|
+ )}
|
|
|
</div>
|
|
|
)
|
|
|
}
|