Browse Source

feat: debug appointment

wangyuan 2 years ago
parent
commit
b735ecf1eb

+ 19 - 0
ittpc/package-lock.json

@@ -1780,6 +1780,11 @@
       "integrity": "sha512-YbulWHdfP99UfZ73NcUDlNJhEIDgm9Doq9GhpyXbF+7Aegi3CVV7qqMCKTTqJxlvEvnQBp9IA+dxsGN6xK/nSg==",
       "dev": true
     },
+    "china-area-data": {
+      "version": "5.0.1",
+      "resolved": "https://registry.npmmirror.com/china-area-data/-/china-area-data-5.0.1.tgz",
+      "integrity": "sha512-BQDPpiv5Nn+018ekcJK2oSD9PAD+E1bvXB0wgabc//dFVS/KvRqCgg0QOEUt3vBkx9XzB5a9BmkJCEZDBxVjVw=="
+    },
     "chokidar": {
       "version": "3.5.3",
       "resolved": "https://registry.npmmirror.com/chokidar/-/chokidar-3.5.3.tgz",
@@ -3663,6 +3668,15 @@
       "integrity": "sha512-aJeQQ+Hl9Jyyzv4chBqYJwmVRY46N5i2BEX5Cuyk/5gFCUZ5F3i7Hnba6snZftWla7Gglwc5pIgcd+E7cW+rPg==",
       "dev": true
     },
+    "element-china-area-data": {
+      "version": "5.0.2",
+      "resolved": "https://registry.npmmirror.com/element-china-area-data/-/element-china-area-data-5.0.2.tgz",
+      "integrity": "sha512-vLQuvOKJy/uiX7MRHEk3x/j09hipuIl6DJ/C4XFUG7D7Pj3O47sy+Y6aAArM6k9v8cD9UX6e+yz2S4J+IPnZ8g==",
+      "requires": {
+        "china-area-data": "^5.0.1",
+        "lodash-es": "^4.17.15"
+      }
+    },
     "element-ui": {
       "version": "2.15.10",
       "resolved": "https://registry.npmmirror.com/element-ui/-/element-ui-2.15.10.tgz",
@@ -5906,6 +5920,11 @@
       "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
       "dev": true
     },
+    "lodash-es": {
+      "version": "4.17.21",
+      "resolved": "https://registry.npmmirror.com/lodash-es/-/lodash-es-4.17.21.tgz",
+      "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw=="
+    },
     "lodash.camelcase": {
       "version": "4.3.0",
       "resolved": "https://registry.npmmirror.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz",

+ 1 - 0
ittpc/package.json

@@ -11,6 +11,7 @@
   },
   "dependencies": {
     "axios": "^1.1.2",
+    "element-china-area-data": "^5.0.2",
     "element-ui": "^2.15.10",
     "vue": "^2.5.2",
     "vue-router": "^3.0.1",

+ 14 - 0
ittpc/src/request/request.js

@@ -17,6 +17,12 @@ const getWorkerListURL = BASE_API + '/get/worker/list/v1'
 // 工作人员服务记录
 const getWorkerServiceURL = BASE_API + '/get/worker/service/v1'
 
+// 预约记录列表
+const getAppointmentListURL = BASE_API + '/get/appointment/list/v1'
+
+// 取消预约
+const cancelAppointmentURL = BASE_API + '/cancel/appointment/v1'
+
 export const pwdLogin = (data) => {
   return request.post(pwdLoginURL, data)
 }
@@ -35,4 +41,12 @@ export const getWorkerList = (data) => {
 
 export const getWorkerService = (data) => {
   return request.post(getWorkerServiceURL, data)
+}
+
+export const getAppointmentList = (data) => {
+  return request.post(getAppointmentListURL, data)
+}
+
+export const cancelAppointment = (data) => {
+  return request.post(cancelAppointmentURL, data)
 }

+ 126 - 51
ittpc/src/views/modules/appointment/appointment.vue

@@ -2,51 +2,70 @@
   <div class="appointment-page" v-loading="loading" element-loading-text="加载中" element-loading-spinner="el-icon-loading">
     <el-row>
       <el-col :span="24" class="padding20">
-        <el-form :inline="true" :model="searchForm" class="demo-form-inline" size="small">
-          <el-form-item label="预约时间">
+        <el-form :inline="true" :model="searchForm" class="flex-form" size="small">
+          <el-form-item label="联系人姓名">
+            <el-input v-model="searchForm.name" placeholder="请输入姓名(不是昵称)"></el-input>
+          </el-form-item>
+          <el-form-item label="预约申请时间">
             <el-date-picker
-              v-model="date"
+              v-model="appointmentTime"
               type="daterange"
+              value-format="yyyy-MM-dd HH:mm:ss"
               range-separator="至"
               start-placeholder="开始日期"
               end-placeholder="结束日期">
             </el-date-picker>
           </el-form-item>
-          <el-form-item label="预约姓名">
-            <el-input v-model="searchForm.name" placeholder="请输入预约姓名"></el-input>
-          </el-form-item>
+          
           <el-form-item label="状态">
+            <!-- 状态 状态 【1.申请预约  2.撤销预约  3.业务人员撤销预约 4.预约报道成功 5.预约超时  】 -->
             <el-select v-model="searchForm.status" placeholder="请选择">
-              <el-option label="等待服务" value="1"></el-option>
-              <el-option label="已取消" value="0"></el-option>
-              <el-option label="已完成" value="2"></el-option>
+              <el-option label="请选择" value=""></el-option>
+              <el-option label="申请预约" value="1"></el-option>
+              <el-option label="撤销预约" value="2"></el-option>
+              <el-option label="业务人员撤销预约" value="3"></el-option>
+              <el-option label="预约报道成功" value="4"></el-option>
+              <el-option label="预约超时" value="5"></el-option>
             </el-select>
           </el-form-item>
+          <el-form-item label="省/市/区">
+            <el-cascader style="width:230px;"
+              :options="options"
+              v-model="selectedOptions"
+              @change="handleChange">
+            </el-cascader>
+          </el-form-item>
           <el-form-item>
-            <el-button type="primary">查询</el-button>
-            <el-button>重置</el-button>
+            <el-button type="primary" @click="handleQuery">查询</el-button>
+            <el-button @click="handleReset">重置</el-button>
           </el-form-item>
         </el-form>
       </el-col>
     </el-row>
     <el-row>
-      <el-col :span="24" class="padding20">
-        <el-button type="primary" size="small" style="width: 100px">导出</el-button>
-      </el-col>
-    </el-row>
-    <el-row>
-      <el-col :span="24" class="padding20">
+      <el-col :span="24" class="padding20 no-padding-top">
         <el-table :data="tableData" border stripe style="width: 100%" size="small" max-height="700">
-          <el-table-column prop="name" label="账户昵称"></el-table-column>
-          <el-table-column prop="phone" label="用户手机号"></el-table-column>
-          <el-table-column prop="time" label="检测人姓名"></el-table-column>
-          <el-table-column prop="times" label="预约时间"></el-table-column>
-          <el-table-column prop="count" label="状态"></el-table-column>
-          <el-table-column label="操作">
+          <el-table-column type="index" align="center" label="序号"></el-table-column>
+          <el-table-column prop="appointmentId" label="预约记录ID" align="center"></el-table-column>
+          <el-table-column prop="contactName" label="联系人名称" align="center"></el-table-column>
+          <el-table-column prop="contactPhone" label="联系方式" align="center"></el-table-column>
+          <el-table-column prop="nickname" label="预约用户昵称" align="center"></el-table-column>
+          <el-table-column prop="appointmentTime" label="预约时间" align="center"></el-table-column>
+          <el-table-column prop="appointmentDuration" label="时间区间段" align="center"></el-table-column>
+          <el-table-column label="状态" align="center">
             <template slot-scope="scope">
-              <!-- 若产生报告 则显示已完成 -->
-              <el-button type="text" size="small">已完成</el-button>
-              <el-button type="text" size="small" @click="handleCancelAppoint(scope.row)">取消预约</el-button>
+              <!-- 状态 状态 【1.申请预约  2.撤销预约  3.业务人员撤销预约 4.预约报道成功 5.预约超时  】 -->
+              <span v-if="scope.row.status == 1">申请预约</span>
+              <span v-if="scope.row.status == 2">撤销预约</span>
+              <span v-if="scope.row.status == 3">业务人员撤销预约</span>
+              <span v-if="scope.row.status == 4">预约报道成功</span>
+              <span v-if="scope.row.status == 5">预约超时</span>
+            </template>
+          </el-table-column>
+          <el-table-column prop="addTime" label="预约申请时间" align="center"></el-table-column>
+          <el-table-column prop="" label="操作" align="center">
+            <template slot-scope="scope">
+              <el-button type="text" size="mini" :disabled="scope.row.status !== 1" @click="handleCancelAppoint(scope.row)">取消预约</el-button>
             </template>
           </el-table-column>
         </el-table>
@@ -55,13 +74,11 @@
     <el-row>
       <el-col :span="24" class="padding20 flexend" >
         <el-pagination
-          @size-change="handleSizeChange"
           @current-change="handleCurrentChange"
           :current-page="currentPage"
-          :page-sizes="[100, 200, 300, 400]"
-          :page-size="100"
-          layout="total, sizes, prev, pager, next, jumper"
-          :total="400"
+          :page-size="pageSize"
+          layout="total, prev, pager, next"
+          :total="total"
           size="small"
           >
         </el-pagination>
@@ -71,43 +88,98 @@
 </template>
 
 <script>
+import { getAppointmentList, cancelAppointment } from '@/request/request'
+import { regionData, CodeToText } from 'element-china-area-data'
 export default {
   name: 'appointment',
   data() {
     return {
       loading: false,
-      date: '',
+      appointmentTime: '',
       searchForm: {
         name: '',
-        status: ''
+        start: '',
+        end: '',
+        status: '',
+        province: '浙江省',
+        city: '杭州市',
+        county: '上城区'
       },
-      tableData: [
-        {
-          name: '范一岚',
-          phone: '18626576880',
-          time: '1995-12-27',
-          times: 100,
-          count: 227,
-          admin: '是'
-        }
-      ],
-      currentPage: 1
+      tableData: [],
+      currentPage: 1,
+      pageSize: 20,
+      total: 0,
+      options: regionData,
+      selectedOptions: ['330000', '330100', '330102']
     };
   },
   mounted() {
-    console.log('appointment mounted');
+    this.handleQuery()
   },
   methods: {
-    handleSizeChange () {
-
+    handleReset () {
+      this.selectedOptions = ['330000', '330100', '330102']
+      this.searchForm.status = ''
+      this.appointmentTime = ''
+      this.searchForm.name = ''
+    },
+    handleQuery () {
+      if (this.appointmentTime) {
+        this.searchForm.start = this.appointmentTime[0]
+        this.searchForm.end = this.appointmentTime[1]
+      } else {
+        this.searchForm.start = ''
+        this.searchForm.end = ''
+      }
+      this.currentPage = 1
+      this.getAppointmentListFn()
     },
-    handleCurrentChange () {
-      
+    getAppointmentListFn () {
+      let data = {
+        currentPage: this.currentPage,
+        ...this.searchForm
+      }
+      this.loading = true
+      getAppointmentList(data).then(res => {
+        this.loading = false
+        this.total = res.data.total
+        this.pageSize = res.data.pageSize
+        this.tableData = res.data.vos || []
+      }).catch(e => {
+        this.loading = false
+        console.log(e);
+      })
     },
-    handleCancelAppoint () {
+    handleCurrentChange (currentPage) {
+      this.currentPage = currentPage
+      this.getAppointmentListFn()
+    },
+    handleCancelAppoint (row) {
       this.$confirm('确定取消预约吗?').then( _=> {
-        console.log('ok');
+        this.cancelAppointmentFn(row.appointmentId)
       }).catch(_ => {});
+    },
+    cancelAppointmentFn (appointmentId) {
+      let data = {
+        appointmentId: appointmentId
+      }
+      this.loading = true
+      cancelAppointment(data).then(res => {
+        this.loading = false
+        this.$message({
+          message: '取消成功',
+          type: 'success'
+        })
+        this.getAppointmentListFn()
+      }).catch(e => {
+        this.loading = false
+        console.log(e);
+      })
+    },
+    handleChange (value) {
+      this.searchForm.province = CodeToText[value[0]]
+      this.searchForm.city = CodeToText[value[1]]
+      this.searchForm.county = CodeToText[value[2]]
     }
   }
 };
@@ -120,6 +192,9 @@ export default {
   .padding20 {
     padding: 20px;
   }
+  .no-padding-top {
+    padding-top: 0;
+  }
   .flexend {
     display: flex;
     justify-content: flex-end;

+ 4 - 1
ittpc/src/views/modules/manager/manager.vue

@@ -24,7 +24,7 @@
       </el-col>
     </el-row>
     <el-row>
-      <el-col :span="24" class="padding20">
+      <el-col :span="24" class="padding20 no-padding-top">
         <el-table :data="tableData" border stripe style="width: 100%" size="small" max-height="700" v-loading="loading" element-loading-text="加载中" element-loading-spinner="el-icon-loading">
           <el-table-column type="index" align="center" label="序号"></el-table-column>
           <el-table-column prop="operatorId" align="center" label="管理人员ID"></el-table-column>
@@ -132,6 +132,9 @@ export default {
   .padding20 {
     padding: 20px;
   }
+  .no-padding-top {
+    padding-top: 0;
+  }
   .flexend {
     display: flex;
     justify-content: flex-end;

+ 4 - 1
ittpc/src/views/modules/staff/query.vue

@@ -14,7 +14,7 @@
       </el-col>
     </el-row>
     <el-row>
-      <el-col :span="24" class="padding20">
+      <el-col :span="24" class="padding20 no-padding-top">
         <el-table :data="tableData" border stripe style="width: 100%" size="small" max-height="700" v-loading="loading" element-loading-text="加载中" element-loading-spinner="el-icon-loading">
           <el-table-column type="index" align="center" label="序号"></el-table-column>
           <el-table-column prop="workerId" label="工作人员ID" align="center"></el-table-column>
@@ -132,6 +132,9 @@ export default {
   .padding20 {
     padding: 20px;
   }
+  .no-padding-top {
+    padding-top: 0;
+  }
   .flexend {
     display: flex;
     justify-content: flex-end;

+ 4 - 1
ittpc/src/views/modules/user/user.vue

@@ -17,7 +17,7 @@
       </el-col>
     </el-row>
     <el-row>
-      <el-col :span="24" class="padding20">
+      <el-col :span="24" class="padding20 no-padding-top">
         <el-table :data="tableData" border stripe style="width: 100%" size="small" max-height="700" v-loading="loading" element-loading-text="加载中" element-loading-spinner="el-icon-loading">
           <el-table-column type="index" align="center" label="序号"></el-table-column>
           <el-table-column prop="userId" align="center" label="用户ID"></el-table-column>
@@ -114,6 +114,9 @@ export default {
   .padding20 {
     padding: 20px;
   }
+  .no-padding-top {
+    padding-top: 0;
+  }
   .flexend {
     display: flex;
     justify-content: flex-end;