chillqi il y a 2 ans
Parent
commit
5b80354f20

+ 0 - 7
components.d.ts

@@ -7,7 +7,6 @@ export {}
 
 declare module 'vue' {
   export interface GlobalComponents {
-    ElAside: typeof import('element-plus/es')['ElAside']
     ElAvatar: typeof import('element-plus/es')['ElAvatar']
     ElButton: typeof import('element-plus/es')['ElButton']
     ElCard: typeof import('element-plus/es')['ElCard']
@@ -25,17 +24,11 @@ declare module 'vue' {
     ElInput: typeof import('element-plus/es')['ElInput']
     ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
     ElMain: typeof import('element-plus/es')['ElMain']
-    ElMenu: typeof import('element-plus/es')['ElMenu']
-    ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
-    ElMenuItemGroup: typeof import('element-plus/es')['ElMenuItemGroup']
     ElOption: typeof import('element-plus/es')['ElOption']
     ElRate: typeof import('element-plus/es')['ElRate']
     ElRow: typeof import('element-plus/es')['ElRow']
     ElSelect: typeof import('element-plus/es')['ElSelect']
-    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']

+ 105 - 106
src/components/Register.vue

@@ -1,81 +1,81 @@
 <script setup lang="ts">
-  import { ref, computed } from 'vue';
-  import {router} from '../router'
-  import {userRegister} from "../api/user.ts";
-
-
-  const name = ref('')
-  const identity = ref('')
-  const tel = ref('')
-  const address = ref('')
-  const password = ref('')
-  const confirmPassword = ref('')
-
-
-  // const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
-  const chinaMobileRegex = /^1(3[0-9]|4[579]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[189])\d{8}$/;
-
-  const hasTelInput = computed(() => tel.value != '');
-  const hasPasswordInput = computed(() => password.value != '');
-  const hasConfirmPasswordInput = computed(() => confirmPassword.value != '');
-  const hasAddressInput = computed(() => address.value != '');
-  const hasIdentityChosen = computed(() => identity.value != '')
-
-
-  const telLegal = computed(() => chinaMobileRegex.test(tel.value));
-  const isPasswordIdentical = computed(() => password.value == confirmPassword.value);
-
-
-  const registerDisabled = computed(() => {
-    return !(telLegal.value && hasPasswordInput.value && isPasswordIdentical.value && hasAddressInput.value && hasIdentityChosen.value)
-  });
-
-
-  async function handleRegister() {
-    const payload = {
-      role: identity.value,
-      name: name.value,
-      phone: tel.value,
-      password: password.value,
-      address: address.value,
-      createTime: new Date().getTime()
-    }
-
-    userRegister(payload)
-        .then(() => {
-          ElMessageBox.alert(
-              `${name.value},感谢您的注册!`,
-              '注册成功',
-              {
-                customClass: "customDialog",
-                confirmButtonText: '跳转到登录',
-                type: "success",
-                showClose: false,
-                roundButton: true,
-                center: true
-              }
-          ).then(() => {
-            // 跳转去登录
-            router.push({ path: "/login" })
-          })
-        })
-        .catch(e => {
-          console.log(e)
-          ElMessageBox.alert(
-              e.message,
-              '错误提示',
-              {
-                customClass: "customDialog",
-                confirmButtonText: '好的',
-                type: "error",
-                showClose: false,
-                roundButton: true,
-                center: true
-              }
-          )
-        })
+import {ref, computed} from 'vue';
+import {router} from '../router'
+import {userRegister} from "../api/user.ts";
+
+
+const name = ref('')
+const identity = ref('')
+const tel = ref('')
+const address = ref('')
+const password = ref('')
+const confirmPassword = ref('')
+
+
+// const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
+const chinaMobileRegex = /^1(3[0-9]|4[579]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[189])\d{8}$/;
+
+const hasTelInput = computed(() => tel.value != '');
+const hasPasswordInput = computed(() => password.value != '');
+const hasConfirmPasswordInput = computed(() => confirmPassword.value != '');
+const hasAddressInput = computed(() => address.value != '');
+const hasIdentityChosen = computed(() => identity.value != '')
+
+
+const telLegal = computed(() => chinaMobileRegex.test(tel.value));
+const isPasswordIdentical = computed(() => password.value == confirmPassword.value);
+
+
+const registerDisabled = computed(() => {
+  return !(telLegal.value && hasPasswordInput.value && isPasswordIdentical.value && hasAddressInput.value && hasIdentityChosen.value)
+});
+
+
+async function handleRegister() {
+  const payload = {
+    role: identity.value,
+    name: name.value,
+    phone: tel.value,
+    password: password.value,
+    address: address.value,
+    createTime: new Date().getTime()
   }
 
+  userRegister(payload)
+      .then(() => {
+        ElMessageBox.alert(
+            `${name.value},感谢您的注册!`,
+            '注册成功',
+            {
+              customClass: "customDialog",
+              confirmButtonText: '跳转到登录',
+              type: "success",
+              showClose: false,
+              roundButton: true,
+              center: true
+            }
+        ).then(() => {
+          // 跳转去登录
+          router.push({path: "/login"})
+        })
+      })
+      .catch(e => {
+        console.log(e)
+        ElMessageBox.alert(
+            e.message,
+            '错误提示',
+            {
+              customClass: "customDialog",
+              confirmButtonText: '好的',
+              type: "error",
+              showClose: false,
+              roundButton: true,
+              center: true
+            }
+        )
+      })
+}
+
 
 </script>
 
@@ -99,8 +99,8 @@
               <el-form-item>
                 <label for="name">昵称</label>
                 <el-input id="name"
-                       v-model="name"
-                       placeholder="请输入昵称" />
+                          v-model="name"
+                          placeholder="请输入昵称"/>
               </el-form-item>
             </el-col>
 
@@ -110,11 +110,11 @@
               <el-form-item>
                 <label for="identity">身份</label>
                 <el-select id="identity"
-                        v-model="identity"
-                   >
-                  <el-option disabled value="" selected>请选择</el-option>
-                  <el-option value="CUSTOMER">顾客</el-option>
-                  <el-option value="STAFF">商家</el-option>
+                           v-model="identity"
+                           placeholder="请选择"
+                >
+                  <el-option value="CUSTOMER" label="顾客"/>
+                  <el-option value="STAFF" label="商家"/>
                 </el-select>
               </el-form-item>
             </el-col>
@@ -136,8 +136,8 @@
                 </label>
 
                 <el-input id="tel"
-                       v-model="tel" :class="{'error-warn-input' :(hasTelInput && !telLegal)}"
-                       placeholder="请输入手机号" />
+                          v-model="tel" :class="{'error-warn-input' :(hasTelInput && !telLegal)}"
+                          placeholder="请输入手机号"/>
               </el-form-item>
             </el-col>
 
@@ -151,21 +151,19 @@
                 </label>
 
                 <el-input id="address"
-                       v-model="address"
-                       placeholder="请输入地址" />
+                          v-model="address"
+                          placeholder="请输入地址"/>
               </el-form-item>
             </el-col>
 
           </el-row>
 
 
-
-
           <el-form-item>
             <label for="password">密码</label>
             <el-input type="password" id="password"
-                   v-model="password"
-                   placeholder="••••••••" />
+                      v-model="password"
+                      placeholder="••••••••"/>
           </el-form-item>
 
           <el-form-item>
@@ -174,31 +172,32 @@
             <label v-else>确认密码</label>
 
             <el-input type="password" id="confirm-password"
-                   v-model="confirmPassword" :class="{'error-warn-input' :(hasConfirmPasswordInput && !isPasswordIdentical)}"
-                   placeholder="••••••••" />
+                      v-model="confirmPassword"
+                      :class="{'error-warn-input' :(hasConfirmPasswordInput && !isPasswordIdentical)}"
+                      placeholder="••••••••"/>
           </el-form-item>
 
-<!--          <el-form-item class="flex items-start">-->
+          <!--          <el-form-item class="flex items-start">-->
 
-<!--            <div class="flex items-center h-5">-->
-<!--              <input id="terms" aria-describedby="terms" type="checkbox" class="w-4 h-4 border border-gray-300 rounded bg-gray-50 focus:ring-3 focus:ring-primary-300"-->
-<!--                     required>-->
-<!--            </div>-->
+          <!--            <div class="flex items-center h-5">-->
+          <!--              <input id="terms" aria-describedby="terms" type="checkbox" class="w-4 h-4 border border-gray-300 rounded bg-gray-50 focus:ring-3 focus:ring-primary-300"-->
+          <!--                     required>-->
+          <!--            </div>-->
 
-<!--            <div class="ml-3 text-sm">-->
-<!--              <label for="terms" class="font-light text-gray-500">-->
-<!--                我接受-->
-<!--                <a class="font-medium text-primary-600 hover:underline dark:text-primary-500" href="#">恶魔的条款</a>-->
-<!--              </label>-->
-<!--            </div>-->
+          <!--            <div class="ml-3 text-sm">-->
+          <!--              <label for="terms" class="font-light text-gray-500">-->
+          <!--                我接受-->
+          <!--                <a class="font-medium text-primary-600 hover:underline dark:text-primary-500" href="#">恶魔的条款</a>-->
+          <!--              </label>-->
+          <!--            </div>-->
 
-<!--          </el-form-item>-->
+          <!--          </el-form-item>-->
 
 
           <span class="button-group">
             <el-button @click.prevent="handleRegister"
-                    :disabled="registerDisabled"
-                    type="primary">
+                       :disabled="registerDisabled"
+                       type="primary">
               创建账户
             </el-button>
 

+ 15 - 11
src/views/common/OrderItem.vue

@@ -14,6 +14,7 @@ const commentDialogVisible = ref(false)
 
 const userId = ref(0)
 const productId = ref(0)
+const productName = ref('')
 const amount = ref(0)
 const paid = ref(0)
 const type = ref('')
@@ -29,6 +30,7 @@ function getOrderDetail() {
   getOrderById(props.orderId).then(res => {
     userId.value = res.result.userId
     productId.value = res.result.productId
+    productName.value = res.result.productName
     amount.value = res.result.amount
     paid.value = res.result.paid
     type.value = res.result.type
@@ -63,7 +65,6 @@ const buttonText = computed(() => {
   }
 })
 
-
 function parseTime(time) {
   if (time === null) {
     return "暂未完成"
@@ -81,7 +82,6 @@ function parseType() {
   }
 }
 
-
 function handlePay() {
   orderDialogVisible.value = true
 }
@@ -198,7 +198,8 @@ function switchButtonFunction() {
         <div class="card-header">
           <div>
             <span> 订单号 {{props.orderId}}</span>
-            <el-tag style="margin-left: 8px"> {{statusText}} </el-tag>
+            <el-tag style="margin-left: 8px" v-if="status!=='DONE'"> {{statusText}} </el-tag>
+            <el-tag style="margin-left: 8px" v-if="status==='DONE'" type="success"> {{statusText}} </el-tag>
           </div>
           <el-button @click="switchButtonFunction" v-if="!(status==='DONE')" class="status-change-button" size="small" type="primary">
               {{ buttonText }}
@@ -210,17 +211,23 @@ function switchButtonFunction() {
           :column="1"
       >
         <el-descriptions-item style="font-size: 15px" label="商品">
-          {{ productId }}
+          {{ productName }}
         </el-descriptions-item>
         <el-descriptions-item style="font-size: 15px" label="数量">
           {{ amount }} 件
         </el-descriptions-item>
         <el-descriptions-item style="font-size: 15px" label="支付金额">
-          {{ paid }}
+          {{ paid }}
         </el-descriptions-item>
         <el-descriptions-item style="font-size: 15px" label="取货类型">
           <el-tag> {{ parseType() }}</el-tag>
         </el-descriptions-item>
+        <el-descriptions-item style="font-size: 15px" label="创建时间">
+          {{ parseTime(createTime) }}
+        </el-descriptions-item>
+        <el-descriptions-item style="font-size: 15px" label="完成时间">
+          {{ parseTime(finishTime) }}
+        </el-descriptions-item>
         <el-descriptions-item style="font-size: 15px" label="评分" v-if="status==='DONE'">
           <el-rate
               v-model="rating"
@@ -231,12 +238,9 @@ function switchButtonFunction() {
               size="small"
           />
         </el-descriptions-item>
-        <el-descriptions-item style="font-size: 15px" label="创建时间">
-          {{ parseTime(createTime) }}
-        </el-descriptions-item>
-        <el-descriptions-item style="font-size: 15px" label="完成时间">
-          {{ parseTime(finishTime) }}
-        </el-descriptions-item>
+        <el-descriptions-item style="font-size: 15px" label="评价内容" v-if="status==='DONE'">
+          {{ content }}
+        </el-descriptions-item >
       </el-descriptions>
 
     </el-card>

+ 9 - 1
src/views/common/ProductItem.vue

@@ -45,7 +45,15 @@ function getProductDetail() {
       评分人数: {{ number }}
     </el-row>
     <el-row style="font-size: 10px">
-      评分: {{ rating }}
+      评分:
+      <el-rate
+          v-model="rating"
+          disabled
+          show-score
+          text-color="#ff9900"
+          score-template="{value} 分"
+          size="small"
+      />
     </el-row>
     <el-row style="font-size: 10px">
       销量: {{ salesAmount }}

+ 2 - 2
src/views/customer/BuyProduct.vue

@@ -114,8 +114,8 @@ function handleConfirmOrder() {
                    v-model="type"
                    placeholder="请选择"
         >
-          <el-option value="DELIVERY">到店自提</el-option>
-          <el-option value="PICKUP">快递到家</el-option>
+          <el-option value="DELIVERY" label="到店自提" />
+          <el-option value="PICKUP" label="快递到家" />
         </el-select>
       </el-form-item>
       <el-form-item>