|
@@ -1,5 +1,16 @@
|
|
|
import OSticky from '@/components/o-sticky'
|
|
|
-import { Button, Cell, CellGroup, Checkbox, CheckboxGroup, Icon, Image, showToast, Tag } from 'vant'
|
|
|
+import {
|
|
|
+ Button,
|
|
|
+ Cell,
|
|
|
+ CellGroup,
|
|
|
+ Checkbox,
|
|
|
+ CheckboxGroup,
|
|
|
+ Icon,
|
|
|
+ Image,
|
|
|
+ showConfirmDialog,
|
|
|
+ showToast,
|
|
|
+ Tag
|
|
|
+} from 'vant'
|
|
|
import { defineComponent, nextTick, onMounted, reactive, ref } from 'vue'
|
|
|
import styles from '../index.module.less'
|
|
|
import radioCheck from '@/common/images/icon-radio-check.png'
|
|
@@ -30,6 +41,41 @@ export default defineComponent({
|
|
|
}
|
|
|
})
|
|
|
|
|
|
+ // 查询未支付订单
|
|
|
+ const paymentOrderUnpaid = async () => {
|
|
|
+ try {
|
|
|
+ const { data } = await request.get('/api-student/userPaymentOrder/unpaid')
|
|
|
+ console.log(data, 'data')
|
|
|
+ // 判断是否有待支付订单
|
|
|
+ if (data.id) {
|
|
|
+ showConfirmDialog({
|
|
|
+ message: '您有待支付的订单,是否继续支付',
|
|
|
+ cancelButtonText: '取消订单',
|
|
|
+ confirmButtonText: '继续支付'
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ const paymentConfig = data.paymentConfig
|
|
|
+ router.push({
|
|
|
+ path: '/orderDetail',
|
|
|
+ query: {
|
|
|
+ config: JSON.stringify(paymentConfig.paymentConfig),
|
|
|
+ orderNo: paymentConfig.orderNo
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ .catch(async () => {
|
|
|
+ try {
|
|
|
+ await request.post('/api-student/userPaymentOrder/cancelPayment/' + data.orderNo)
|
|
|
+ } catch {
|
|
|
+ //
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } catch {
|
|
|
+ //
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 获取商品信息
|
|
|
const registerGoods = async () => {
|
|
|
try {
|
|
@@ -37,8 +83,14 @@ export default defineComponent({
|
|
|
'/api-student/orchestraRegister/registerGoods/' + route.query.id
|
|
|
)
|
|
|
|
|
|
- const details = data.details || []
|
|
|
+ // 获取已经购买商品信息
|
|
|
+ const paymentOrderDetails = data.paymentOrderDetails || []
|
|
|
+ paymentOrderDetails.forEach((item: any) => {
|
|
|
+ state.paymentOrderDetails.push(item.goodsType)
|
|
|
+ })
|
|
|
|
|
|
+ // 初始化数据商品数据
|
|
|
+ const details = data.details || []
|
|
|
details.forEach((item: any) => {
|
|
|
if (item.goodsType === 'INSTRUMENTS') {
|
|
|
const img = item.goodsUrl ? item.goodsUrl.split(',')[0] : ''
|
|
@@ -54,9 +106,10 @@ export default defineComponent({
|
|
|
state.details = details
|
|
|
|
|
|
// 默认选中所有的
|
|
|
- state.check.push(item.goodsId)
|
|
|
+ if (!state.paymentOrderDetails.includes(item.goodsType)) {
|
|
|
+ state.check.push(item.goodsId)
|
|
|
+ }
|
|
|
})
|
|
|
- state.paymentOrderDetails = data.paymentOrderDetails || []
|
|
|
|
|
|
calcPrice()
|
|
|
} catch {
|
|
@@ -80,7 +133,10 @@ export default defineComponent({
|
|
|
}
|
|
|
details.forEach((item: any) => {
|
|
|
// 是否选中
|
|
|
- if (state.check.includes(item.goodsId)) {
|
|
|
+ if (
|
|
|
+ state.check.includes(item.goodsId) &&
|
|
|
+ !state.paymentOrderDetails.includes(item.goodsType)
|
|
|
+ ) {
|
|
|
tempPrice.needPrice += parseFloat(item.currentPrice)
|
|
|
tempPrice.originalPrice += parseFloat(item.originalPrice)
|
|
|
}
|
|
@@ -138,7 +194,10 @@ export default defineComponent({
|
|
|
const details = state.details
|
|
|
details.forEach((item: any) => {
|
|
|
// 是否选中
|
|
|
- if (state.check.includes(item.goodsId)) {
|
|
|
+ if (
|
|
|
+ state.check.includes(item.goodsId) &&
|
|
|
+ !state.paymentOrderDetails.includes(item.goodsType)
|
|
|
+ ) {
|
|
|
params.push({
|
|
|
goodsId: item.goodsId,
|
|
|
goodsNum: 1,
|
|
@@ -173,8 +232,7 @@ export default defineComponent({
|
|
|
path: '/orderDetail',
|
|
|
query: {
|
|
|
config: JSON.stringify(data.paymentConfig),
|
|
|
- orderNo: data.orderNo,
|
|
|
- id: route.query.id
|
|
|
+ orderNo: data.orderNo
|
|
|
}
|
|
|
})
|
|
|
} catch (e: any) {
|
|
@@ -185,6 +243,8 @@ export default defineComponent({
|
|
|
}
|
|
|
|
|
|
onMounted(() => {
|
|
|
+ // 查询未支付订单
|
|
|
+ paymentOrderUnpaid()
|
|
|
registerGoods()
|
|
|
})
|
|
|
return () => (
|
|
@@ -204,179 +264,193 @@ export default defineComponent({
|
|
|
calcPrice()
|
|
|
}}
|
|
|
>
|
|
|
- <div class={styles.applyTitle}>乐器</div>
|
|
|
- <CellGroup
|
|
|
- inset
|
|
|
- class={[styles.mlr13, styles.sectionCell]}
|
|
|
- onClick={() => onSelect(state.goodsInfo.goodsId)}
|
|
|
- >
|
|
|
- <Cell border={false}>
|
|
|
- {{
|
|
|
- icon: () => (
|
|
|
- <Checkbox
|
|
|
- name={state.goodsInfo.goodsId}
|
|
|
- class={styles.checkbox}
|
|
|
- ref={(el: any) => (state.checkboxRefs[state.goodsInfo.goodsId] = el)}
|
|
|
- v-slots={{
|
|
|
- icon: (props: any) => (
|
|
|
- <Icon
|
|
|
- class={styles.iconChecked}
|
|
|
- name={props.checked ? radioCheck : radioDefault}
|
|
|
- />
|
|
|
- )
|
|
|
- }}
|
|
|
- />
|
|
|
- ),
|
|
|
- title: () => (
|
|
|
- <div class={styles.section}>
|
|
|
- <Image class={styles.img} src={state.goodsInfo.goodsUrl} />
|
|
|
- <div class={styles.sectionContent}>
|
|
|
- <h2>{state.goodsInfo.goodsName}</h2>
|
|
|
- <Tag type="primary">{state.goodsInfo.brandName}</Tag>
|
|
|
- <p class={styles.model}>{state.goodsInfo.desciption}</p>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- )
|
|
|
- }}
|
|
|
- </Cell>
|
|
|
- <Cell>
|
|
|
- {{
|
|
|
- title: () => (
|
|
|
- <div class={styles.extra}>
|
|
|
- <div class={styles.sectionPrice}>
|
|
|
- <p class={styles.price}>
|
|
|
- 新团特惠:<span>¥{moneyFormat(state.goodsInfo.currentPrice)}</span>
|
|
|
- </p>
|
|
|
- <p class={styles.originPrice}>
|
|
|
- 原价:<del>¥{moneyFormat(state.goodsInfo.originalPrice)}</del>
|
|
|
- </p>
|
|
|
- </div>
|
|
|
- <div class={styles.sectionTips}>
|
|
|
- 赠价值{state.repaireInfo.originalPrice}元乐器维保服务一年
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- )
|
|
|
- }}
|
|
|
- </Cell>
|
|
|
- </CellGroup>
|
|
|
+ {/* 判断是否已经购买乐器 */}
|
|
|
+ {!state.paymentOrderDetails.includes('INSTRUMENTS') && (
|
|
|
+ <>
|
|
|
+ <div class={styles.applyTitle}>乐器</div>
|
|
|
+ <CellGroup
|
|
|
+ inset
|
|
|
+ class={[styles.mlr13, styles.sectionCell]}
|
|
|
+ onClick={() => onSelect(state.goodsInfo.goodsId)}
|
|
|
+ >
|
|
|
+ <Cell border={false}>
|
|
|
+ {{
|
|
|
+ icon: () => (
|
|
|
+ <Checkbox
|
|
|
+ name={state.goodsInfo.goodsId}
|
|
|
+ class={styles.checkbox}
|
|
|
+ ref={(el: any) => (state.checkboxRefs[state.goodsInfo.goodsId] = el)}
|
|
|
+ v-slots={{
|
|
|
+ icon: (props: any) => (
|
|
|
+ <Icon
|
|
|
+ class={styles.iconChecked}
|
|
|
+ name={props.checked ? radioCheck : radioDefault}
|
|
|
+ />
|
|
|
+ )
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ ),
|
|
|
+ title: () => (
|
|
|
+ <div class={styles.section}>
|
|
|
+ <Image class={styles.img} src={state.goodsInfo.goodsUrl} />
|
|
|
+ <div class={styles.sectionContent}>
|
|
|
+ <h2>{state.goodsInfo.goodsName}</h2>
|
|
|
+ <Tag type="primary">{state.goodsInfo.brandName}</Tag>
|
|
|
+ <p class={styles.model}>{state.goodsInfo.desciption}</p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }}
|
|
|
+ </Cell>
|
|
|
+ <Cell>
|
|
|
+ {{
|
|
|
+ title: () => (
|
|
|
+ <div class={styles.extra}>
|
|
|
+ <div class={styles.sectionPrice}>
|
|
|
+ <p class={styles.price}>
|
|
|
+ 新团特惠:<span>¥{moneyFormat(state.goodsInfo.currentPrice)}</span>
|
|
|
+ </p>
|
|
|
+ <p class={styles.originPrice}>
|
|
|
+ 原价:<del>¥{moneyFormat(state.goodsInfo.originalPrice)}</del>
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ <div class={styles.sectionTips}>
|
|
|
+ 赠价值{state.repaireInfo.originalPrice}元乐器维保服务一年
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }}
|
|
|
+ </Cell>
|
|
|
+ </CellGroup>
|
|
|
+ </>
|
|
|
+ )}
|
|
|
|
|
|
- <div class={styles.applyTitle}>教材</div>
|
|
|
- <CellGroup
|
|
|
- inset
|
|
|
- class={[styles.mlr13, styles.sectionCell]}
|
|
|
- onClick={() => {
|
|
|
- return
|
|
|
- // onSelect(state.textBookInfo.goodsId)
|
|
|
- }}
|
|
|
- >
|
|
|
- <Cell border={false}>
|
|
|
- {{
|
|
|
- icon: () => (
|
|
|
- <Checkbox
|
|
|
- name={state.textBookInfo.goodsId}
|
|
|
- disabled
|
|
|
- class={styles.checkbox}
|
|
|
- ref={(el: any) => (state.checkboxRefs[state.textBookInfo.goodsId] = el)}
|
|
|
- v-slots={{
|
|
|
- icon: (props: any) => (
|
|
|
- <Icon
|
|
|
- class={styles.iconChecked}
|
|
|
- name={props.checked ? radioCheck : radioDefault}
|
|
|
- />
|
|
|
- )
|
|
|
- }}
|
|
|
- />
|
|
|
- ),
|
|
|
- title: () => (
|
|
|
- <div class={styles.section}>
|
|
|
- <Image class={styles.img} src={state.textBookInfo.goodsUrl} />
|
|
|
- <div class={styles.sectionContent}>
|
|
|
- <h2>{state.textBookInfo.goodsName}</h2>
|
|
|
- <Tag type="primary">{state.textBookInfo.brandName}</Tag>
|
|
|
- <p class={styles.model}>{state.textBookInfo.description}</p>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- )
|
|
|
- }}
|
|
|
- </Cell>
|
|
|
- <Cell>
|
|
|
- {{
|
|
|
- title: () => (
|
|
|
- <div class={styles.extra}>
|
|
|
- <div class={styles.sectionPrice}>
|
|
|
- <p class={styles.price}>
|
|
|
- 新团特惠:
|
|
|
- <span class={styles.free}>
|
|
|
- {state.textBookInfo.currentPrice > 0
|
|
|
- ? moneyFormat(state.textBookInfo.currentPrice)
|
|
|
- : '免费赠送'}
|
|
|
- </span>
|
|
|
- </p>
|
|
|
- <p class={styles.originPrice}>
|
|
|
- 原价:<del>¥{moneyFormat(state.textBookInfo.originalPrice)}</del>
|
|
|
- </p>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- )
|
|
|
- }}
|
|
|
- </Cell>
|
|
|
- </CellGroup>
|
|
|
+ {/* 判断是否已经购买教材 */}
|
|
|
+ {!state.paymentOrderDetails.includes('TEXTBOOK') && (
|
|
|
+ <>
|
|
|
+ <div class={styles.applyTitle}>教材</div>
|
|
|
+ <CellGroup
|
|
|
+ inset
|
|
|
+ class={[styles.mlr13, styles.sectionCell]}
|
|
|
+ onClick={() => {
|
|
|
+ return
|
|
|
+ // onSelect(state.textBookInfo.goodsId)
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <Cell border={false}>
|
|
|
+ {{
|
|
|
+ icon: () => (
|
|
|
+ <Checkbox
|
|
|
+ name={state.textBookInfo.goodsId}
|
|
|
+ disabled
|
|
|
+ class={styles.checkbox}
|
|
|
+ ref={(el: any) => (state.checkboxRefs[state.textBookInfo.goodsId] = el)}
|
|
|
+ v-slots={{
|
|
|
+ icon: (props: any) => (
|
|
|
+ <Icon
|
|
|
+ class={styles.iconChecked}
|
|
|
+ name={props.checked ? radioCheck : radioDefault}
|
|
|
+ />
|
|
|
+ )
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ ),
|
|
|
+ title: () => (
|
|
|
+ <div class={styles.section}>
|
|
|
+ <Image class={styles.img} src={state.textBookInfo.goodsUrl} />
|
|
|
+ <div class={styles.sectionContent}>
|
|
|
+ <h2>{state.textBookInfo.goodsName}</h2>
|
|
|
+ <Tag type="primary">{state.textBookInfo.brandName}</Tag>
|
|
|
+ <p class={styles.model}>{state.textBookInfo.description}</p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }}
|
|
|
+ </Cell>
|
|
|
+ <Cell>
|
|
|
+ {{
|
|
|
+ title: () => (
|
|
|
+ <div class={styles.extra}>
|
|
|
+ <div class={styles.sectionPrice}>
|
|
|
+ <p class={styles.price}>
|
|
|
+ 新团特惠:
|
|
|
+ <span class={styles.free}>
|
|
|
+ {state.textBookInfo.currentPrice > 0
|
|
|
+ ? moneyFormat(state.textBookInfo.currentPrice)
|
|
|
+ : '免费赠送'}
|
|
|
+ </span>
|
|
|
+ </p>
|
|
|
+ <p class={styles.originPrice}>
|
|
|
+ 原价:<del>¥{moneyFormat(state.textBookInfo.originalPrice)}</del>
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }}
|
|
|
+ </Cell>
|
|
|
+ </CellGroup>
|
|
|
+ </>
|
|
|
+ )}
|
|
|
|
|
|
- <div class={styles.applyTitle}>乐团学习系统</div>
|
|
|
- <CellGroup
|
|
|
- inset
|
|
|
- class={[styles.mlr13, styles.sectionCell]}
|
|
|
- onClick={() => onSelect(state.vipInfo.goodsId)}
|
|
|
- >
|
|
|
- <Cell border={false}>
|
|
|
- {{
|
|
|
- icon: () => (
|
|
|
- <Checkbox
|
|
|
- name={state.vipInfo.goodsId}
|
|
|
- class={styles.checkbox}
|
|
|
- ref={(el: any) => (state.checkboxRefs[state.vipInfo.goodsId] = el)}
|
|
|
- onClick={(e: Event) => {
|
|
|
- e.stopPropagation()
|
|
|
- }}
|
|
|
- v-slots={{
|
|
|
- icon: (props: any) => (
|
|
|
- <Icon
|
|
|
- class={styles.iconChecked}
|
|
|
- name={props.checked ? radioCheck : radioDefault}
|
|
|
- />
|
|
|
- )
|
|
|
- }}
|
|
|
- />
|
|
|
- ),
|
|
|
- title: () => (
|
|
|
- <div class={styles.section}>
|
|
|
- <Image class={styles.img} src={state.vipInfo.goodsUrl} />
|
|
|
- <div class={styles.sectionContent}>
|
|
|
- <h2>{state.vipInfo.goodsName}</h2>
|
|
|
- <Tag type="primary">6个月</Tag>
|
|
|
- <p class={styles.model}>{state.vipInfo.description}</p>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- )
|
|
|
- }}
|
|
|
- </Cell>
|
|
|
- <Cell>
|
|
|
- {{
|
|
|
- title: () => (
|
|
|
- <div class={styles.extra}>
|
|
|
- <div class={styles.sectionPrice}>
|
|
|
- <p class={styles.price}>
|
|
|
- 新团特惠:<span>¥{moneyFormat(state.vipInfo.currentPrice)}</span>
|
|
|
- </p>
|
|
|
- <p class={styles.originPrice}>
|
|
|
- 原价:<del>¥{moneyFormat(state.vipInfo.originalPrice)}</del>
|
|
|
- </p>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- )
|
|
|
- }}
|
|
|
- </Cell>
|
|
|
- </CellGroup>
|
|
|
+ {!state.paymentOrderDetails.includes('VIP') && (
|
|
|
+ <>
|
|
|
+ <div class={styles.applyTitle}>乐团学习系统</div>
|
|
|
+ <CellGroup
|
|
|
+ inset
|
|
|
+ class={[styles.mlr13, styles.sectionCell]}
|
|
|
+ onClick={() => onSelect(state.vipInfo.goodsId)}
|
|
|
+ >
|
|
|
+ <Cell border={false}>
|
|
|
+ {{
|
|
|
+ icon: () => (
|
|
|
+ <Checkbox
|
|
|
+ name={state.vipInfo.goodsId}
|
|
|
+ class={styles.checkbox}
|
|
|
+ ref={(el: any) => (state.checkboxRefs[state.vipInfo.goodsId] = el)}
|
|
|
+ onClick={(e: Event) => {
|
|
|
+ e.stopPropagation()
|
|
|
+ }}
|
|
|
+ v-slots={{
|
|
|
+ icon: (props: any) => (
|
|
|
+ <Icon
|
|
|
+ class={styles.iconChecked}
|
|
|
+ name={props.checked ? radioCheck : radioDefault}
|
|
|
+ />
|
|
|
+ )
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ ),
|
|
|
+ title: () => (
|
|
|
+ <div class={styles.section}>
|
|
|
+ <Image class={styles.img} src={state.vipInfo.goodsUrl} />
|
|
|
+ <div class={styles.sectionContent}>
|
|
|
+ <h2>{state.vipInfo.goodsName}</h2>
|
|
|
+ <Tag type="primary">6个月</Tag>
|
|
|
+ <p class={styles.model}>{state.vipInfo.description}</p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }}
|
|
|
+ </Cell>
|
|
|
+ <Cell>
|
|
|
+ {{
|
|
|
+ title: () => (
|
|
|
+ <div class={styles.extra}>
|
|
|
+ <div class={styles.sectionPrice}>
|
|
|
+ <p class={styles.price}>
|
|
|
+ 新团特惠:<span>¥{moneyFormat(state.vipInfo.currentPrice)}</span>
|
|
|
+ </p>
|
|
|
+ <p class={styles.originPrice}>
|
|
|
+ 原价:<del>¥{moneyFormat(state.vipInfo.originalPrice)}</del>
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }}
|
|
|
+ </Cell>
|
|
|
+ </CellGroup>
|
|
|
+ </>
|
|
|
+ )}
|
|
|
</CheckboxGroup>
|
|
|
|
|
|
<OSticky position="bottom" background="white">
|