|
@@ -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'
|
|
@@ -24,6 +24,7 @@ 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 = () => {}
|
|
|
|
|
@@ -125,40 +126,53 @@ export default defineComponent({
|
|
|
}
|
|
|
|
|
|
const onBuy = async () => {
|
|
|
- // const member: any = this.selectMember
|
|
|
- // // 判断是否有会员
|
|
|
- // const startTime = this.userInfo.memberRankSettingId
|
|
|
- // ? dayjs(this.userInfo.membershipEndTime).toDate()
|
|
|
- // : new Date()
|
|
|
- // let endTime = new Date()
|
|
|
- // if (member.period === 'MONTH') {
|
|
|
- // endTime = dayjs(startTime).add(1, 'month').toDate()
|
|
|
- // } else if (member.period === 'QUARTERLY') {
|
|
|
- // endTime = dayjs(startTime).add(3, 'month').toDate()
|
|
|
- // } else if (member.period === 'YEAR_HALF') {
|
|
|
- // endTime = dayjs(startTime).add(6, 'month').toDate()
|
|
|
- // } else if (member.period === 'YEAR') {
|
|
|
- // endTime = dayjs(startTime).add(1, 'year').toDate()
|
|
|
- // }
|
|
|
- // orderStatus.orderObject.orderType = 'VIP'
|
|
|
- // orderStatus.orderObject.orderName = '小酷Ai' + member.title
|
|
|
- // orderStatus.orderObject.orderDesc = '小酷Ai' + member.title
|
|
|
- // orderStatus.orderObject.actualPrice = this.calcSalePrice(member)
|
|
|
+ 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: 'VIP',
|
|
|
- // goodsName: '小酷Ai' + member.title,
|
|
|
- // id: member.id,
|
|
|
- // title: member.title,
|
|
|
- // price: this.calcSalePrice(member),
|
|
|
- // startTime: dayjs(startTime).format('YYYY-MM-DD'),
|
|
|
- // endTime: dayjs(endTime).format('YYYY-MM-DD'),
|
|
|
- // recomUserId: this.recomUserId
|
|
|
- // }
|
|
|
- // ]
|
|
|
+ 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: {
|
|
@@ -166,6 +180,26 @@ export default defineComponent({
|
|
|
// }
|
|
|
// })
|
|
|
}
|
|
|
+ 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 (
|
|
@@ -317,7 +351,7 @@ export default defineComponent({
|
|
|
>
|
|
|
购买专辑
|
|
|
</Button>
|
|
|
- {albumDetail.value?.musicPaymentTypes.includes('CHARGE') && (
|
|
|
+ {albumDetail.value?.musicPaymentTypes.includes('VIP') && (
|
|
|
<Button
|
|
|
block
|
|
|
round
|