Commit bcb7531b by 赵月辉

修改购物车金额计算接口

parent 823aee2e
...@@ -92,6 +92,14 @@ export function shoppingEdit (query) { ...@@ -92,6 +92,14 @@ export function shoppingEdit (query) {
}) })
} }
// 计算资源购物车计算金额接口
export function shoppingComputerVo (ids) {
return request({
url: `/api/v1/shoppingComputerVo/${ids}`,
method: 'get'
})
}
// 计算资源购物车删除接口 // 计算资源购物车删除接口
export function shoppingDelete (ids) { export function shoppingDelete (ids) {
return request({ return request({
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
<div class="page-main"> <div class="page-main">
<div class="detail-info"> <div class="detail-info">
<el-table :data="tableData" @selection-change="tableSelectionChange"> <el-table :data="tableData" row-key="id" @selection-change="tableSelectionChange">
<el-table-column type="selection"/> <el-table-column type="selection" reserve-selection/>
<el-table-column label="资源型号" prop="model"/> <el-table-column label="资源型号" prop="model"/>
<el-table-column label="配置详情" width="150px"> <el-table-column label="配置详情" width="150px">
<template #default="{row}"> <template #default="{row}">
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
v-model="row.useNum" v-model="row.useNum"
:min="1" :min="1"
controls-position="right" controls-position="right"
@change="edit(row)" @change="editNum(row)"
style="width: 80px"/> style="width: 80px"/>
</template> </template>
</el-table-column> </el-table-column>
...@@ -95,7 +95,13 @@ ...@@ -95,7 +95,13 @@
</template> </template>
<script name="ConfirmOrder" setup> <script name="ConfirmOrder" setup>
import { shoppingList, shoppingEdit, shoppingDelete, shoppingSubmit } from '@/api/computingResource.js' import {
shoppingList,
shoppingEdit,
shoppingDelete,
shoppingSubmit,
shoppingComputerVo
} from '@/api/computingResource.js'
import { ref, computed } from 'vue' import { ref, computed } from 'vue'
import { ElMessageBox } from 'element-plus' import { ElMessageBox } from 'element-plus'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
...@@ -126,23 +132,38 @@ const ids = ref([]) ...@@ -126,23 +132,38 @@ const ids = ref([])
function tableSelectionChange (value) { function tableSelectionChange (value) {
ids.value = value.map(row => row.id) ids.value = value.map(row => row.id)
shoppingComputer()
} }
const totalPrice = computed(() => { // const totalPrice = computed(() => {
const list = tableData.value.filter(item => { // const list = tableData.value.filter(item => {
return ids.value.includes(item.id) // return ids.value.includes(item.id)
}) // })
let price = 0 // let price = 0
list.forEach(i => price += parseFloat(i.publicTotalPrice)) // list.forEach(i => price += parseFloat(i.publicTotalPrice))
return price // return price
}) // })
function edit (row) { function editNum (row) {
shoppingEdit({id: row.id, useNum: row.useNum}).then(res => { shoppingEdit({id: row.id, useNum: row.useNum}).then(res => {
shoppingComputer()
getList() getList()
}) })
} }
const totalPrice = ref(0)
function shoppingComputer () {
if (!ids.value.length) {
totalPrice.value = 0
return
}
shoppingComputerVo(ids.value).then(res => {
totalPrice.value = res.data.totalPulicPrice
})
}
function confirmDel (row) { function confirmDel (row) {
const idsValue = row?.id ? row.id : ids.value const idsValue = row?.id ? row.id : ids.value
shoppingDelete(idsValue).then(res => { shoppingDelete(idsValue).then(res => {
......
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
<el-button type="primary" @click="$router.push('/console/authentication')">申请认证</el-button> <el-button type="primary" @click="$router.push('/console/authentication')">申请认证</el-button>
</div> </div>
<el-alert v-if="infoData.status === '待审核'" style="width: 300px" class="mb20" show-icon title="您的企业认证已提交,请等待审核" type="info" effect="dark"/> <el-alert v-if="infoData.status === '待审核'" style="width: 300px" class="mb20" show-icon
title="您的企业认证已提交,请等待审核" type="info" effect="dark"/>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
...@@ -20,13 +21,13 @@ ...@@ -20,13 +21,13 @@
</template> </template>
<div class="flex base-info"> <div class="flex base-info">
<div class="left"> <div class="left">
<el-image src="" fit="cover"></el-image> <el-image :src="baseUrl + infoData.avatar" fit="cover"></el-image>
<el-tag v-if="infoData.status === '审核通过'" type="success">已认证</el-tag> <el-tag v-if="infoData.status === '审核通过'" type="success">已认证</el-tag>
<el-tag v-else type="warning">未认证</el-tag> <el-tag v-else type="warning">未认证</el-tag>
</div> </div>
<el-form label-width="110px" label-position="left"> <el-form label-width="110px" label-position="left">
<el-form-item label="账号昵称:"> <el-form-item label="账号昵称:">
<div>{{ infoData.userName }}</div> <div>{{ infoData.nickName }}</div>
<el-icon @click="$router.push('/user/profile')"> <el-icon @click="$router.push('/user/profile')">
<Edit/> <Edit/>
</el-icon> </el-icon>
...@@ -90,7 +91,9 @@ ...@@ -90,7 +91,9 @@
<el-tag v-if="infoData.status === '待审核'" type="primary" class="mr5">待审核</el-tag> <el-tag v-if="infoData.status === '待审核'" type="primary" class="mr5">待审核</el-tag>
<el-tag v-if="infoData.status === '审核通过'" type="primary" class="mr5">审核通过</el-tag> <el-tag v-if="infoData.status === '审核通过'" type="primary" class="mr5">审核通过</el-tag>
<el-button v-if="infoData.status === '驳回'" type="primary" link @click="handleViewReason">查看驳回理由</el-button> <el-button v-if="infoData.status === '驳回'" type="primary" link @click="handleViewReason">
查看驳回理由
</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
...@@ -123,6 +126,8 @@ import { auditInfo } from '@/api/console.js' ...@@ -123,6 +126,8 @@ import { auditInfo } from '@/api/console.js'
import { ref } from 'vue' import { ref } from 'vue'
import { ElMessageBox } from 'element-plus' import { ElMessageBox } from 'element-plus'
const baseUrl = import.meta.env.VITE_APP_BASE_API
const infoData = ref({}) const infoData = ref({})
function getAuditInfo () { function getAuditInfo () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment