Explorar o código

完成订单评价功能

Nivek %!s(int64=2) %!d(string=hai) anos
pai
achega
d7fa53d0bd

+ 1 - 0
components.d.ts

@@ -35,6 +35,7 @@ declare module 'vue' {
     ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
     ElTag: typeof import('element-plus/es')['ElTag']
     ElTextarea: typeof import('element-plus/es')['ElTextarea']
+    ElUpload: typeof import('element-plus/es')['ElUpload']
     Footer: typeof import('./src/components/Footer.vue')['default']
     Header: typeof import('./src/components/Header.vue')['default']
     Login: typeof import('./src/components/Login.vue')['default']

+ 1 - 2
src/api/order.ts

@@ -52,8 +52,7 @@ export const getOrder = orderId => {
 
 // 评价订单
 export const commentOrder = payload => {
-    return axios.post(`${ORDER_MODULE}/comment`, payload,
-        {headers: {'Content-Type': 'application/json'}})
+    return axios.post(`${ORDER_MODULE}/comment`, null, {params: payload})
         .then(res => {
             return res;
         })

+ 2 - 0
src/components/Header.vue

@@ -108,6 +108,8 @@ function search() {
   color:white;
   font-size: x-large;
   min-width: max-content;
+  margin-top: 15px;
+  margin-bottom: 15px;
 }
 
 .header-icon {

+ 20 - 5
src/views/common/OrderItem.vue

@@ -152,14 +152,26 @@ function handleComment() {
 function handleSendComment() {
 
   const payload = {
-
+    orderId: props.orderId,
+    comment: content.value,
+    rating: rating.value
   }
 
   commentOrder(payload).then(res => {
     if (res.code === '000') {
-
+        ElMessage({
+          message: '评价!',
+          type: 'success',
+          center: true,
+        })
+        getOrderDetail()
+        commentDialogVisible.value = false
     } else {
-
+      ElMessage({
+        message: res.msg,
+        type: 'error',
+        center: true,
+      })
     }
   })
 }
@@ -184,7 +196,7 @@ function switchButtonFunction() {
       <template #header>
         <div class="card-header">
           <div>
-            <span> 商品 {{productId}}</span>
+            <span> 订单号 {{props.orderId}}</span>
             <el-tag style="margin-left: 8px"> {{statusText}} </el-tag>
           </div>
           <el-button @click="switchButtonFunction" v-if="!(status==='DONE')" class="status-change-button" size="small" type="primary">
@@ -196,6 +208,9 @@ function switchButtonFunction() {
       <el-descriptions
           :column="1"
       >
+        <el-descriptions-item style="font-size: 15px" label="商品">
+          {{ productId }}
+        </el-descriptions-item>
         <el-descriptions-item style="font-size: 15px" label="数量">
           {{ amount }} 件
         </el-descriptions-item>
@@ -275,7 +290,7 @@ function switchButtonFunction() {
         </el-form-item>
 
         <el-form-item>
-          <el-button type="primary" @click="handleComment">评价</el-button>
+          <el-button type="primary" @click="handleSendComment">评价</el-button>
           <el-button @click="commentDialogVisible = false">取消</el-button>
         </el-form-item>
       </el-form>

+ 0 - 4
src/views/staff/CreateProduct.vue

@@ -100,10 +100,6 @@ function handleCreateProduct() {
 <template>
   <div class="flex flex-col items-center justify-center px-6 py-6 space-y-10">
 
-    <span class="flex items-center text-2xl font-semibold text-gray-900">
-      Blue Whale Shopping Online
-    </span>
-
     <el-card class="w-full bg-white rounded-lg shadow-md md:mt-0 sm:max-w-md xl:p-0">
 
       <div class="p-6 space-y-4 md:space-y-6 sm:p-8">