|
@@ -1,5 +1,5 @@
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
-import {deliverOrder, getOrder, getOrderById, payOrder, commentOrder} from "../api/order.ts";
|
|
|
|
|
|
|
+import {deliverOrder, getOrder, getOrderById, payOrder, commentOrder, calculateOrder} from "../api/order.ts";
|
|
|
import {ref, computed} from "vue";
|
|
import {ref, computed} from "vue";
|
|
|
import {getAvailableCouponsByStoreId} from "../api/coupon.ts";
|
|
import {getAvailableCouponsByStoreId} from "../api/coupon.ts";
|
|
|
import {ElTable} from "element-plus";
|
|
import {ElTable} from "element-plus";
|
|
@@ -20,7 +20,6 @@ const userId = ref(0)
|
|
|
const productId = ref(0)
|
|
const productId = ref(0)
|
|
|
const productName = ref('')
|
|
const productName = ref('')
|
|
|
const price = ref(0)
|
|
const price = ref(0)
|
|
|
-const totalPrice = ref(0)
|
|
|
|
|
const amount = ref(0)
|
|
const amount = ref(0)
|
|
|
const paid = ref(0)
|
|
const paid = ref(0)
|
|
|
const type = ref('')
|
|
const type = ref('')
|
|
@@ -31,6 +30,9 @@ const createTime = ref('')
|
|
|
const finishTime = ref('')
|
|
const finishTime = ref('')
|
|
|
const storeId = ref(0)
|
|
const storeId = ref(0)
|
|
|
|
|
|
|
|
|
|
+const totalPrice = ref(0)
|
|
|
|
|
+const discountPrice = ref(0)
|
|
|
|
|
+
|
|
|
const couponId = ref(0)
|
|
const couponId = ref(0)
|
|
|
|
|
|
|
|
getOrderDetail()
|
|
getOrderDetail()
|
|
@@ -52,6 +54,7 @@ function getOrderDetail() {
|
|
|
storeId.value = res.result.storeId
|
|
storeId.value = res.result.storeId
|
|
|
|
|
|
|
|
totalPrice.value = amount.value * price.value
|
|
totalPrice.value = amount.value * price.value
|
|
|
|
|
+ discountPrice.value = totalPrice.value
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -231,6 +234,9 @@ const handleCurrentChange = (val: Coupon | undefined) => {
|
|
|
couponId.value = 0
|
|
couponId.value = 0
|
|
|
}
|
|
}
|
|
|
currentRow.value = val
|
|
currentRow.value = val
|
|
|
|
|
+ calculateOrder(props.orderId, couponId.value).then(res => {
|
|
|
|
|
+ discountPrice.value = res.result
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const setCurrent = (row?: User) => {
|
|
const setCurrent = (row?: User) => {
|
|
@@ -346,19 +352,19 @@ function parseOrderType(type) {
|
|
|
<div>
|
|
<div>
|
|
|
<el-form>
|
|
<el-form>
|
|
|
<el-form-item>
|
|
<el-form-item>
|
|
|
- <label for="amount">购买数量:</label>
|
|
|
|
|
|
|
+ <label>购买数量:</label>
|
|
|
{{ amount }} 件
|
|
{{ amount }} 件
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
<el-form-item>
|
|
|
- <label for="discountPrice">折扣前总价:</label>
|
|
|
|
|
|
|
+ <label>折扣前总价:</label>
|
|
|
{{ totalPrice }} 元
|
|
{{ totalPrice }} 元
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
<el-form-item>
|
|
|
- <label for="type">提货方式:</label>
|
|
|
|
|
|
|
+ <label>提货方式:</label>
|
|
|
{{ parseOrderType(type) }}
|
|
{{ parseOrderType(type) }}
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
<el-form-item>
|
|
|
- <label for="type">优惠券:</label>
|
|
|
|
|
|
|
+ <label>优惠券:</label>
|
|
|
<el-button @click="setCurrent()">不使用优惠券</el-button>
|
|
<el-button @click="setCurrent()">不使用优惠券</el-button>
|
|
|
<el-table
|
|
<el-table
|
|
|
ref="singleTableRef"
|
|
ref="singleTableRef"
|
|
@@ -377,6 +383,10 @@ function parseOrderType(type) {
|
|
|
<el-table-column prop="minus" label="减(元)" width="180"/>
|
|
<el-table-column prop="minus" label="减(元)" width="180"/>
|
|
|
</el-table>
|
|
</el-table>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
+ <el-form-item>
|
|
|
|
|
+ <label>折扣后金额:</label>
|
|
|
|
|
+ {{ discountPrice }} 元
|
|
|
|
|
+ </el-form-item>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
<el-button @click="handleConfirmOrder" type="primary" plain>
|
|
<el-button @click="handleConfirmOrder" type="primary" plain>
|
|
|
确认支付
|
|
确认支付
|