|
@@ -43,6 +43,7 @@ import OrderTennatAlbum from './order-tennat-album'
|
|
import { orderType } from '@/constant'
|
|
import { orderType } from '@/constant'
|
|
import OrderDiscount from './order-discount'
|
|
import OrderDiscount from './order-discount'
|
|
import OrderVipCourse from './order-vip-course'
|
|
import OrderVipCourse from './order-vip-course'
|
|
|
|
+import AddDiscount from './add-discount'
|
|
|
|
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
name: 'order-detail',
|
|
name: 'order-detail',
|
|
@@ -50,7 +51,7 @@ export default defineComponent({
|
|
const query = this.$route.query
|
|
const query = this.$route.query
|
|
return {
|
|
return {
|
|
loading: false, // 是否加载中,为了处理0元订单()
|
|
loading: false, // 是否加载中,为了处理0元订单()
|
|
- dialogVisiable: false,
|
|
|
|
|
|
+ dialogVisible: false,
|
|
dialogContent: '',
|
|
dialogContent: '',
|
|
dialogBtnText: '确定',
|
|
dialogBtnText: '确定',
|
|
dialogType: 'back' as 'back' | 'refresh',
|
|
dialogType: 'back' as 'back' | 'refresh',
|
|
@@ -73,6 +74,7 @@ export default defineComponent({
|
|
showQrcode: false,
|
|
showQrcode: false,
|
|
orderTimer: null as any,
|
|
orderTimer: null as any,
|
|
qrCodeUrl: '',
|
|
qrCodeUrl: '',
|
|
|
|
+ selectGoods: [] as any, // 用于先中的其它商品
|
|
pay_channel: '',
|
|
pay_channel: '',
|
|
orderInfo: {} as any,
|
|
orderInfo: {} as any,
|
|
config: {} as any, // 支付信息
|
|
config: {} as any, // 支付信息
|
|
@@ -104,6 +106,10 @@ export default defineComponent({
|
|
}
|
|
}
|
|
})
|
|
})
|
|
return num
|
|
return num
|
|
|
|
+ },
|
|
|
|
+ countDiscountPrice() {
|
|
|
|
+ const orderObject = orderStatus.orderObject
|
|
|
|
+ return orderObject.couponAmount || orderObject.couponDiscountPrice + orderObject.discountCardPrice
|
|
}
|
|
}
|
|
},
|
|
},
|
|
async mounted() {
|
|
async mounted() {
|
|
@@ -156,12 +162,12 @@ export default defineComponent({
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
// paymentButton
|
|
// paymentButton
|
|
// 处理超过一屏显示
|
|
// 处理超过一屏显示
|
|
- const { height } = useRect((this as any).$refs.paymentButtom)
|
|
|
|
|
|
+ const { height } = useRect((this as any).$refs.paymentButton)
|
|
this.bottomHeight = height + 10
|
|
this.bottomHeight = height + 10
|
|
})
|
|
})
|
|
|
|
|
|
if (!orderStatus.orderObject.orderType) {
|
|
if (!orderStatus.orderObject.orderType) {
|
|
- this.dialogVisiable = true
|
|
|
|
|
|
+ this.dialogVisible = true
|
|
this.dialogContent = '产品信息已更新,请重新选择'
|
|
this.dialogContent = '产品信息已更新,请重新选择'
|
|
this.dialogBtnText = '确定'
|
|
this.dialogBtnText = '确定'
|
|
this.dialogType = 'back'
|
|
this.dialogType = 'back'
|
|
@@ -307,7 +313,7 @@ export default defineComponent({
|
|
})
|
|
})
|
|
const result = res.data || {}
|
|
const result = res.data || {}
|
|
if (res.code === 998 || res.code === 999) {
|
|
if (res.code === 998 || res.code === 999) {
|
|
- this.dialogVisiable = true
|
|
|
|
|
|
+ this.dialogVisible = true
|
|
this.dialogContent = res.msg
|
|
this.dialogContent = res.msg
|
|
this.dialogBtnText = '刷新'
|
|
this.dialogBtnText = '刷新'
|
|
this.dialogType = 'back'
|
|
this.dialogType = 'back'
|
|
@@ -331,11 +337,17 @@ export default defineComponent({
|
|
state.platformType === 'TEACHER'
|
|
state.platformType === 'TEACHER'
|
|
? '/api-teacher/userOrder/executeOrder/v2'
|
|
? '/api-teacher/userOrder/executeOrder/v2'
|
|
: '/api-student/userOrder/executeOrder/v2'
|
|
: '/api-student/userOrder/executeOrder/v2'
|
|
|
|
+
|
|
|
|
+ const goods: any = orderTenantInfos()
|
|
|
|
+ if(this.selectGoods && this.selectGoods.length > 0) {
|
|
|
|
+ goods.push(...orderTenantInfos(this.selectGoods))
|
|
|
|
+ }
|
|
|
|
+
|
|
const res = await request.post(url, {
|
|
const res = await request.post(url, {
|
|
data: {
|
|
data: {
|
|
activityId: orderObject.activityId || null,
|
|
activityId: orderObject.activityId || null,
|
|
couponIds: orderObject.couponId,
|
|
couponIds: orderObject.couponId,
|
|
- goodsInfos: [...orderTenantInfos()],
|
|
|
|
|
|
+ goodsInfos: goods,
|
|
orderDesc: orderObject.orderDesc,
|
|
orderDesc: orderObject.orderDesc,
|
|
orderName: orderObject.orderName,
|
|
orderName: orderObject.orderName,
|
|
orderType: orderObject.orderType,
|
|
orderType: orderObject.orderType,
|
|
@@ -347,7 +359,7 @@ export default defineComponent({
|
|
const result = res.data || {}
|
|
const result = res.data || {}
|
|
// 支付成功
|
|
// 支付成功
|
|
if (res.code === 999 || res.code === 998) {
|
|
if (res.code === 999 || res.code === 998) {
|
|
- this.dialogVisiable = true
|
|
|
|
|
|
+ this.dialogVisible = true
|
|
this.dialogContent = res.msg
|
|
this.dialogContent = res.msg
|
|
this.dialogBtnText = '确定'
|
|
this.dialogBtnText = '确定'
|
|
this.dialogType = 'back'
|
|
this.dialogType = 'back'
|
|
@@ -362,12 +374,14 @@ export default defineComponent({
|
|
})
|
|
})
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- orderStatus.orderObject.paymentConfig = res.data || {}
|
|
|
|
- orderStatus.orderObject.orderNo = res.data?.orderNo
|
|
|
|
|
|
+ orderStatus.orderObject.paymentConfig = result.paymentConfig || {}
|
|
|
|
+ // orderStatus.orderObject.paymentConfig.actualPrice = result.paymentConfig.price
|
|
|
|
+ orderStatus.orderObject.actualPrice = result.paymentConfig.price
|
|
|
|
+ orderStatus.orderObject.orderNo = result?.orderNo
|
|
this.orderInfo = result
|
|
this.orderInfo = result
|
|
this.orderNo = result.orderNo
|
|
this.orderNo = result.orderNo
|
|
}
|
|
}
|
|
- console.log(orderStatus.orderObject, '111')
|
|
|
|
|
|
+ // console.log(orderStatus.orderObject, orderStatus.orderObject.paymentConfig, '111')
|
|
this.paymentStatus = true
|
|
this.paymentStatus = true
|
|
} catch {
|
|
} catch {
|
|
this.loading = false
|
|
this.loading = false
|
|
@@ -382,7 +396,7 @@ export default defineComponent({
|
|
}
|
|
}
|
|
},
|
|
},
|
|
async onDialogConfirm() {
|
|
async onDialogConfirm() {
|
|
- this.dialogVisiable = false
|
|
|
|
|
|
+ this.dialogVisible = false
|
|
if (this.dialogType === 'back') {
|
|
if (this.dialogType === 'back') {
|
|
this.$router.back()
|
|
this.$router.back()
|
|
} else if (this.dialogType === 'refresh') {
|
|
} else if (this.dialogType === 'refresh') {
|
|
@@ -411,7 +425,11 @@ export default defineComponent({
|
|
})
|
|
})
|
|
|
|
|
|
const lastAmount = Number(
|
|
const lastAmount = Number(
|
|
- (Number(this.orderAmount) - Number(discountCount)).toFixed(2)
|
|
|
|
|
|
+ (
|
|
|
|
+ Number(this.orderAmount) -
|
|
|
|
+ orderStatus.orderObject.discountCardPrice -
|
|
|
|
+ Number(discountCount)
|
|
|
|
+ ).toFixed(2)
|
|
)
|
|
)
|
|
this.orderPrice = lastAmount >= 0 ? lastAmount : 0
|
|
this.orderPrice = lastAmount >= 0 ? lastAmount : 0
|
|
// 设置优惠券编号
|
|
// 设置优惠券编号
|
|
@@ -551,6 +569,7 @@ export default defineComponent({
|
|
} else if (item.orderType === 'DISCOUNT') {
|
|
} else if (item.orderType === 'DISCOUNT') {
|
|
return (
|
|
return (
|
|
<OrderDiscount
|
|
<OrderDiscount
|
|
|
|
+ disabled={this.disabledCoupon}
|
|
item={item}
|
|
item={item}
|
|
onPriceChange={(price: number) => {
|
|
onPriceChange={(price: number) => {
|
|
// 重置金额
|
|
// 重置金额
|
|
@@ -568,18 +587,78 @@ export default defineComponent({
|
|
}
|
|
}
|
|
})}
|
|
})}
|
|
|
|
|
|
|
|
+ {/* 畅学卡 - 目前只有学生端支持 */}
|
|
|
|
+ {state.platformType === 'STUDENT' &&
|
|
|
|
+ !this.dataLoading &&
|
|
|
|
+ !this.disabledCoupon ? (
|
|
|
|
+ <AddDiscount
|
|
|
|
+ actualPrice={this.orderAmount}
|
|
|
|
+ orderType={this.orderType}
|
|
|
|
+ onConfirm={(item: {
|
|
|
|
+ checked: boolean
|
|
|
|
+ id: number | null
|
|
|
|
+ salePrice: number
|
|
|
|
+ discountRate: number
|
|
|
|
+ discountPrice: number | string
|
|
|
|
+ vipType: string
|
|
|
|
+ }) => {
|
|
|
|
+ // 畅学卡变更状态时需要重新选择优惠券
|
|
|
|
+ orderStatus.orderObject.couponId = ''
|
|
|
|
+ orderStatus.orderObject.couponDiscountPrice = 0
|
|
|
|
+ // 是否选中畅学卡
|
|
|
|
+ const index = this.selectGoods?.findIndex(
|
|
|
|
+ (child: any) => child.id === item.id
|
|
|
|
+ )
|
|
|
|
+ if (item.checked) {
|
|
|
|
+ orderStatus.orderObject.discountCardPrice = Number(
|
|
|
|
+ item.discountPrice
|
|
|
|
+ )
|
|
|
|
+ if (index === -1) {
|
|
|
|
+ this.orderAmount = this.orderAmount + item.salePrice
|
|
|
|
+ this.selectGoods.push({
|
|
|
|
+ orderType: item.vipType,
|
|
|
|
+ goodsName: '畅学卡',
|
|
|
|
+ num: 1,
|
|
|
|
+ id: item.id
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ orderStatus.orderObject.discountCardPrice = 0
|
|
|
|
+ if (index !== -1) {
|
|
|
|
+ this.selectGoods.splice(index, 1)
|
|
|
|
+ this.orderAmount = this.orderAmount - item.salePrice
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ console.log(orderStatus.orderObject, 'orderObject-----')
|
|
|
|
+
|
|
|
|
+ this.orderPrice = Number(
|
|
|
|
+ (
|
|
|
|
+ Number(this.orderAmount) -
|
|
|
|
+ Number(item.discountPrice) -
|
|
|
|
+ Number(orderStatus.orderObject.couponDiscountPrice)
|
|
|
|
+ ).toFixed(2)
|
|
|
|
+ )
|
|
|
|
+ }}
|
|
|
|
+ />
|
|
|
|
+ ) : (
|
|
|
|
+ ''
|
|
|
|
+ )}
|
|
|
|
+
|
|
{/* 优惠券使用 */}
|
|
{/* 优惠券使用 */}
|
|
{!this.dataLoading && (
|
|
{!this.dataLoading && (
|
|
<UseCoupon
|
|
<UseCoupon
|
|
|
|
+ couponId={orderStatus.orderObject.couponId}
|
|
discountPrice={orderStatus.orderObject.discountPrice}
|
|
discountPrice={orderStatus.orderObject.discountPrice}
|
|
orderType={this.orderType}
|
|
orderType={this.orderType}
|
|
- orderAmount={this.orderAmount}
|
|
|
|
|
|
+ orderAmount={
|
|
|
|
+ this.orderAmount - orderStatus.orderObject.discountCardPrice
|
|
|
|
+ }
|
|
onCouponSelect={this.onCouponSelect}
|
|
onCouponSelect={this.onCouponSelect}
|
|
disabled={this.disabledCoupon}
|
|
disabled={this.disabledCoupon}
|
|
/>
|
|
/>
|
|
)}
|
|
)}
|
|
|
|
|
|
- <div class={styles.paymentInfo} ref="paymentButtom">
|
|
|
|
|
|
+ <div class={styles.paymentInfo} ref="paymentButton">
|
|
{this.orderPrice > 0 && (
|
|
{this.orderPrice > 0 && (
|
|
<div
|
|
<div
|
|
class={[
|
|
class={[
|
|
@@ -598,12 +677,17 @@ export default defineComponent({
|
|
<div class={styles.btnGroup}>
|
|
<div class={styles.btnGroup}>
|
|
<div class={styles.priceSection}>
|
|
<div class={styles.priceSection}>
|
|
<span class={styles.goodsNum}>共{this.goodsNum || 1}件</span>
|
|
<span class={styles.goodsNum}>共{this.goodsNum || 1}件</span>
|
|
- 合计:
|
|
|
|
- <div class={styles.price}>
|
|
|
|
- <span class={styles.priceUnit}>¥</span>
|
|
|
|
- <span class={styles.priceNum}>
|
|
|
|
- {moneyFormat(this.orderPrice)}
|
|
|
|
- </span>
|
|
|
|
|
|
+ <div>
|
|
|
|
+ <div>
|
|
|
|
+ 合计:
|
|
|
|
+ <div class={styles.price}>
|
|
|
|
+ <span class={styles.priceUnit}>¥</span>
|
|
|
|
+ <span class={styles.priceNum}>
|
|
|
|
+ {moneyFormat(this.orderPrice)}
|
|
|
|
+ </span>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class={styles.isDiscountPrice}>已优惠 ¥{moneyFormat(this.countDiscountPrice)}</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<Button
|
|
<Button
|
|
@@ -677,7 +761,7 @@ export default defineComponent({
|
|
</Popup>
|
|
</Popup>
|
|
|
|
|
|
<Popup
|
|
<Popup
|
|
- v-model:show={this.dialogVisiable}
|
|
|
|
|
|
+ v-model:show={this.dialogVisible}
|
|
style={{ background: 'transparent' }}
|
|
style={{ background: 'transparent' }}
|
|
closeOnClickOverlay={false}
|
|
closeOnClickOverlay={false}
|
|
>
|
|
>
|