Ver Fonte

minor fix

Nivek há 2 anos atrás
pai
commit
cf20cb96e0
3 ficheiros alterados com 44 adições e 1 exclusões
  1. 10 0
      src/api/store.ts
  2. 1 0
      src/api/user.ts
  3. 33 1
      src/views/user/Register.vue

+ 10 - 0
src/api/store.ts

@@ -0,0 +1,10 @@
+import {axios} from '../utils/request'
+import {STORE_MODULE} from './_prefix'
+
+// 获取全部商店
+export const getAllStore = () => {
+    return axios.get(`${STORE_MODULE}/`, )
+        .then(res => {
+            return res
+        })
+}

+ 1 - 0
src/api/user.ts

@@ -12,6 +12,7 @@ type RegisterInfo = {
     phone: string,
     password: string,
     address: string,
+    storeId: number | null,
 }
 
 type UpdateInfo = {

+ 33 - 1
src/views/user/Register.vue

@@ -10,6 +10,7 @@ const tel = ref('')
 const address = ref('')
 const password = ref('')
 const confirmPassword = ref('')
+const storeId = ref()
 
 // 电话号码是否为空
 const hasTelInput = computed(() => tel.value != '')
@@ -40,6 +41,7 @@ function handleRegister() {
     phone: tel.value,
     password: password.value,
     address: address.value,
+    storeId: storeId.value
   }).then(res => {
     if (res.data.code === '000') {  //类型守卫,它检查 res.data 对象中是否存在名为 code 的属性
       ElMessage({
@@ -57,6 +59,10 @@ function handleRegister() {
     }
   })
 }
+
+// const storeList = await getAllStore().then(res => res.data.result)
+
+
 </script>
 
 
@@ -116,7 +122,7 @@ function handleRegister() {
 
             <el-col :span="1"></el-col>
 
-            <el-col :span="15">
+            <el-col :span="15" v-if="identity!=='STAFF'">
               <el-form-item>
                 <label for="address">
                   地址
@@ -126,6 +132,32 @@ function handleRegister() {
                           placeholder="请输入地址"/>
               </el-form-item>
             </el-col>
+
+            <el-col :span="7" v-if="identity==='STAFF'">
+              <el-form-item>
+                <label for="address">
+                  地址
+                </label>
+                <el-input id="address"
+                          v-model="address"
+                          placeholder="请输入地址"/>
+              </el-form-item>
+            </el-col>
+
+            <el-col :span="1" v-if="identity==='STAFF'"></el-col>
+
+            <el-col :span="7" v-if="identity==='STAFF'">
+              <el-form-item>
+                <label for="address">
+                  所属商店
+                </label>
+                <el-input id="storeId"
+                          v-model="storeId"
+                          placeholder="请输入商店编号"/>
+              </el-form-item>
+            </el-col>
+
+
           </el-row>
 
           <el-form-item>