|
|
@@ -1,7 +1,7 @@
|
|
|
<script setup lang="ts">
|
|
|
import {ref, onMounted, computed} from "vue"
|
|
|
import {router} from '../../router'
|
|
|
-import {Back, RefreshRight} from "@element-plus/icons-vue"
|
|
|
+import {Back} from "@element-plus/icons-vue"
|
|
|
import {ElTable} from "element-plus"
|
|
|
import {addStock, getProductById} from "../../api/product.ts"
|
|
|
import {calculateOrder, createOrder, payOrder} from "../../api/order.ts"
|
|
|
@@ -121,10 +121,6 @@ function handleCreateOrder() {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-const showForm = ref(false)
|
|
|
-const isLoading = ref(false)
|
|
|
-const refreshButtonVisible = ref(false)
|
|
|
-
|
|
|
// 确定订单按钮
|
|
|
function handleConfirmOrder() {
|
|
|
payOrder(orderId.value, couponId.value).then(res => {
|
|
|
@@ -134,12 +130,6 @@ function handleConfirmOrder() {
|
|
|
type: 'success',
|
|
|
center: true,
|
|
|
})
|
|
|
- isLoading.value = true
|
|
|
- refreshButtonVisible.value = true
|
|
|
- const paymentWindow = window.open('', '_blank')
|
|
|
- paymentWindow.document.write(res.result)
|
|
|
- paymentWindow.document.forms[0].submit() // 提交表单
|
|
|
- showForm.value = false // 隐藏表单
|
|
|
} else if (res.code === '400') {
|
|
|
ElMessage({
|
|
|
message: res.msg,
|
|
|
@@ -150,15 +140,9 @@ function handleConfirmOrder() {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-function refreshPage() {
|
|
|
- location.reload()
|
|
|
-}
|
|
|
-
|
|
|
function handlePayDialogClose() {
|
|
|
orderDialogVisible.value = false
|
|
|
couponId.value = 0
|
|
|
- isLoading.value = false
|
|
|
- refreshButtonVisible.value = false
|
|
|
}
|
|
|
|
|
|
onMounted(() => {
|
|
|
@@ -358,16 +342,9 @@ function toBackPage() {
|
|
|
<el-dialog v-model="orderDialogVisible" :before-close="handlePayDialogClose">
|
|
|
<el-row>
|
|
|
<span class="pay-dialog-title">订单支付</span>
|
|
|
- <el-button v-if="refreshButtonVisible" @click="refreshPage()"
|
|
|
- type="primary" plain class="pay-dialog-refresh-button">
|
|
|
- 已完成支付,刷新界面
|
|
|
- <el-icon>
|
|
|
- <RefreshRight/>
|
|
|
- </el-icon>
|
|
|
- </el-button>
|
|
|
</el-row>
|
|
|
|
|
|
- <div v-loading="isLoading">
|
|
|
+ <div>
|
|
|
<el-form>
|
|
|
<el-form-item>
|
|
|
<label for="amount">购买数量:</label>
|
|
|
@@ -469,6 +446,7 @@ function toBackPage() {
|
|
|
.buy-form {
|
|
|
margin-top: 20px;
|
|
|
margin-left: 30px;
|
|
|
+ width: 20%;
|
|
|
}
|
|
|
|
|
|
.add-stock-main {
|
|
|
@@ -485,9 +463,4 @@ function toBackPage() {
|
|
|
font-size: 30px;
|
|
|
margin-bottom: 20px;
|
|
|
}
|
|
|
-
|
|
|
-.pay-dialog-refresh-button {
|
|
|
- margin-left: 15px;
|
|
|
- margin-top: 5px;
|
|
|
-}
|
|
|
</style>
|