Browse Source

订单管理对接分配相关操作;

郭鹏飞 7 tháng trước cách đây
mục cha
commit
cfccc0b0ab

+ 12 - 4
src/api/system/js.js

@@ -111,7 +111,7 @@ export function getJsData(query) {
   return request({
     url: '/tJsDay/selectAll',
     method: 'get',
-    params:query
+    params: query
   })
 }
 
@@ -120,16 +120,24 @@ export function getJscode(query) {
   return request({
     url: '/weChat/getJSwxQrCodeDh',
     method: 'get',
-    params:query
+    params: query
   })
 }
 
-
 // 技师解绑
 export function unbind(query) {
   return request({
     url: '/api/js/v1/pc/unbind',
     method: 'get',
-    params:query
+    params: query
   })
 }
+
+// 分页查询可服务的真实技师列表
+export function queryRealTechnicians(query) {
+  return request({
+    url: '/api/js/v1/queryRealTechnicians',
+    method: 'get',
+    params: query
+  })
+}

+ 18 - 0
src/api/system/order.js

@@ -71,3 +71,21 @@ export function getjsList(data) {
     params: data
   })
 }
+
+// 订单分配操作记录
+export function getAllocationLogs(query) {
+  return request({
+    url: '/api/order/v1/allocationLogs/page',
+    method: 'get',
+    params: query
+  })
+}
+
+// 订单分配操作记录
+export function netTransferOrder(query) {
+  return request({
+    url: '/api/order/v1/wx/transferOrder',
+    method: 'post',
+    data: query
+  })
+}

+ 50 - 4
src/utils/dict/LocalDicts.js

@@ -2,6 +2,18 @@
  * 本地静态字典数据定义
  */
 export default {
+    // 是否状态
+    local_status: {
+        values: [
+            { label: "否", value: 0 },
+            { label: "是", value: 1 },
+        ],
+    },
+
+    /**
+     * 评论相关
+     * -----------------
+     */
     // 评论审核状态
     local_comment_audit: {
         values: [
@@ -10,13 +22,47 @@ export default {
             { label: "拒绝", value: 2 },
         ],
     },
-    // 是否状态
-    local_status: {
+
+    /**
+     * 技师相关
+     * -----------------
+     */
+    // 技师服务状态
+    local_technician_status: {
         values: [
-            { label: "否", value: 0 },
-            { label: "是", value: 1 },
+            { label: "可服务", value: 0 },
+            { label: "服务中", value: 1 },
+            { label: "不可服务", value: 2 },
+        ],
+    },
+    // 技师上岗状态
+    local_technician_status2: {
+        values: [
+            { label: "已上岗", value: 0 },
+            { label: "已申请", value: 1 },
+            { label: "未上岗", value: -1 },
+        ],
+    },
+
+    /**
+     * 虚拟订单相关
+     * -----------------
+     */
+    // 虚拟订单状态
+    local_voa_status: {
+        values: [
+            { label: "未分配", value: 0 },
+            { label: "已分配", value: 1 },
+        ],
+    },
+    // 虚拟订单分配操作状态
+    local_voa_operation_status: {
+        values: [
+            { label: "分配成功", value: 0 },
+            { label: "已取消", value: 1 },
         ],
     },
+
     // 性别字段,例:映射字段
     local_gender: {
         values: [

+ 0 - 1
src/views/comment/auditModal.vue

@@ -87,7 +87,6 @@ export default {
             if (e) {
                 this.oForm = e;
             }
-            console.log(this.oForm)
             this.$refs.mv.open(this.title);
         },
         // 关闭弹窗

+ 65 - 64
src/views/order/index.vue

@@ -6,7 +6,7 @@
       size="small"
       :inline="true"
       v-show="showSearch"
-      label-width="68px"
+      label-width="100px"
     >
       <el-form-item label="用户姓名" prop="cName">
         <el-input
@@ -63,14 +63,14 @@
           </el-option>
         </el-select>
       </el-form-item>
-      <el-form-item label="虚拟订单状态" prop="status">
+      <el-form-item label="虚拟订单状态" prop="virtualOrderAllocation">
         <el-select
-          v-model="queryParams.status"
+          v-model="queryParams.virtualOrderAllocation"
           placeholder="请选择"
           clearable 
         >
           <el-option
-            v-for="item in orderStatus"
+            v-for="item in dict.type.local_voa_status"
             :key="item.value"
             :label="item.label"
             :value="item.value"
@@ -174,10 +174,11 @@
             </template>
           </el-table-column> -->
         <el-table-column label="时间" align="center" prop="dtCreateTime" />
-        <el-table-column label="虚拟技师订单" width="100" align="center" prop="status">
-          <template slot-scope="scope">
-            <el-tag v-if="scope.row.status == 2">查看记录</el-tag>
-            <el-tag type="warning" v-else @click="onClickRecord">未分配</el-tag>
+        <el-table-column label="虚拟技师订单" width="100" align="center" prop="virtualOrderAllocation">
+          <!-- 虚拟技师订单分配情况(0:真实订单 1:未分配 2:已分配) -->
+          <template slot-scope="scope" v-if="scope.row.virtualOrderFlag == 1">
+            <el-tag v-if="scope.row.virtualOrderAllocation == 2" @click="onClickRecord(scope.row)">查看记录</el-tag>
+            <el-tag type="warning" v-else>未分配</el-tag>
           </template>
         </el-table-column>
         <!-- <el-table-column label="推荐者id" align="center" prop="cTjOpenId" /> -->
@@ -203,7 +204,8 @@
               size="mini"
               type="text"
               icon="el-icon-edit"
-              @click="handleInfo(scope.row)"
+              v-if="scope.row.virtualOrderFlag == 1 && scope.row.virtualOrderAllocation == 1"
+              @click="handleAllocation(scope.row)"
             >分配</el-button>
             <!-- <el-button
               size="mini"
@@ -279,6 +281,7 @@
             type="textarea"
             v-model="form.address"
             placeholder="请输入地址"
+            style="width: 100%"
           />
         </el-form-item>
         <el-form-item label="备注" prop="cNote">
@@ -413,8 +416,10 @@
         <el-button @click="istransfer = false">取 消</el-button>
       </div>
     </el-dialog>
-    <!-- 虚拟订单记录 -->
-    <VOrderRecord ref="vor" />
+    <!-- 订单分配记录 -->
+    <AOrderRecord ref="aor" />
+    <!-- 订单分配 -->
+    <AOrderAction ref="aoa" @close="getList" />
   </div>
 </template>
 
@@ -429,13 +434,15 @@ import {
   exportOrder,
   transferOrder,
 } from "@/api/system/order";
-import VOrderRecord from "./vOrderRecord.vue";
+import AOrderAction from "./orderAllocationAction.vue";
+import AOrderRecord from "./orderAllocationRecord.vue";
 
 export default {
   name: "Order",
-  dicts: ['vOrderStatus', 'sys_job_status'],
+  dicts: ['local_voa_status'],
   components: {
-    VOrderRecord
+    AOrderAction,
+    AOrderRecord
   },
   data() {
     return {
@@ -516,9 +523,6 @@ export default {
   created() {
     this.getList();
   },
-  mounted() {
-    console.log(this.dict, this.$store)
-  },
   methods: {
     //转单
     transferOrder() {
@@ -544,10 +548,12 @@ export default {
       });
     },
     getJsList(deptId) {
-      let data = {};
-      data.deptId = deptId;
-      data.nStatus = 0;
-      getjsList(data).then((res) => {
+      this.jsList = [];
+      let params = {
+        deptId: deptId,
+        nStatus: 0,
+      };
+      getjsList(params).then((res) => {
         res.data.records.forEach((item) => {
           this.jsList.push({
             value: item.id,
@@ -569,9 +575,10 @@ export default {
     /** 查询认领列表 */
     getList() {
       this.loading = true;
-      listOrder(this.queryParams).then((response) => {
-        this.orderList = response.data.records;
-        this.total = response.data.total;
+      listOrder(this.queryParams).then((res) => {
+        this.orderList = res.data.records;
+        this.total = res.data.total;
+      }).finally(() => {
         this.loading = false;
       });
     },
@@ -641,29 +648,45 @@ export default {
       this.depart = "";
       this.arrival = "";
       this.takeOrder = row.nStatus;
-      this.jsList = [];
       this.getJsList(row.deptId);
       // this.reset();
-      const cId = {
-        cId: row.cId || this.ids,
-      };
       this.subShow = false;
       this.open = true;
       this.title = "详情";
-      listOrder(cId).then((response) => {
-        console.log(response.data.records[0]);
-        
-        this.form = response.data.records[0];
-        let Longitude = this.form.arrivalLongitude;
-        let numLatitude = +this.form.arrivalLatitude;
-        let Latitude = numLatitude.toFixed(6);
-        let location = Longitude + `,` + Latitude;
-        let arrival = "arrival"; //到达
-        this.fetchLocation(arrival, location);
-        let depart = "depart"; //出发
-        this.fetchLocation(depart, location);
+      listOrder({ cId: row.cId }).then((response) => {
+        if (response.data.records.length > 0) {
+          this.form = response.data.records[0];
+          let Longitude = this.form.arrivalLongitude;
+          let numLatitude = +this.form.arrivalLatitude;
+          let Latitude = numLatitude.toFixed(6);
+          let location = Longitude + `,` + Latitude;
+          let arrival = "arrival"; //到达
+          this.fetchLocation(arrival, location);
+          let depart = "depart"; //出发
+          this.fetchLocation(depart, location);
+        }
       });
     },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const cIds = {
+        cId: row.cId || this.ids,
+      };
+      this.$modal
+        .confirm('是否确认删除订单编号为"' + row.orderNo + '"的数据项?')
+        .then(function () {
+          return delOrder(cIds);
+        })
+        .then(() => {
+          this.getList();
+          this.$modal.msgSuccess("删除成功");
+        })
+        .catch(() => {});
+    },
+    // 分配操作
+    handleAllocation(row) {
+      this.$refs.aoa.open({ cId: row.cId });
+    },
     /**解析经纬度 */
     async fetchLocation(title, location) {
       const key = "5457092e6c62b83c1b2e45dbe973d858";
@@ -705,25 +728,9 @@ export default {
         }
       });
     },
-    /** 删除按钮操作 */
-    handleDelete(row) {
-      const cIds = {
-        cId: row.cId || this.ids,
-      };
-      this.$modal
-        .confirm('是否确认删除订单编号为"' + row.orderNo + '"的数据项?')
-        .then(function () {
-          return delOrder(cIds);
-        })
-        .then(() => {
-          this.getList();
-          this.$modal.msgSuccess("删除成功");
-        })
-        .catch(() => {});
-    },
     // 虚拟订单记录查看
-    onClickRecord() {
-      this.$refs.vor.open();
+    onClickRecord(row) {
+      this.$refs.aor.open({ orderNo: row.orderNo });
     }
   },
 };
@@ -740,9 +747,6 @@ export default {
   height: 800px;
   overflow-y: auto;
 }
-::v-deep .el-form-item__label {
-  width: 100px !important;
-}
 ::v-deep .el-input__inner {
   color: #333 !important;
 }
@@ -753,9 +757,6 @@ export default {
   float: right;
   padding: 30px 0;
 }
-.orderDetails .el-form-item {
-  margin-bottom: 10px;
-}
 .transferPopup {
   width: 100vw;
   height: 100vh;

+ 168 - 0
src/views/order/orderAllocationAction.vue

@@ -0,0 +1,168 @@
+<template>
+    <ModalView ref="mv" cname="ElDialog" :viewProps="{
+        customClass: 'myModal'
+    }">
+        <div style="flex: 1;">
+            <el-form
+                ref="qForm"
+                size="mini"
+                :inline="true"
+                :model="params"
+            >
+                <el-form-item label="" prop="cName">
+                    <el-input
+                        size="mini"
+                        placeholder="输入技师姓名或编号"
+                        clearable
+                        v-model="params.cName"
+                    />
+                </el-form-item>
+                <el-form-item>
+                    <el-button size="mini" 
+                        type="primary"
+                        icon="el-icon-search"
+                        @click="onQuery"
+                    >搜索</el-button>
+                    <el-button size="mini" 
+                        icon="el-icon-refresh"
+                        @click="onReset('qForm')"
+                    >重置</el-button>
+                </el-form-item>
+            </el-form>
+            <el-table v-loading="loading" :data="dataList">
+                <el-table-column type="index" label="序号" align="center" width="50" />
+                <el-table-column label="技师编号" align="center" prop="id" />
+                <el-table-column label="姓名/昵称" align="center" prop="cNickName">
+                    <template slot-scope="scope">
+                        <span>{{ scope.row.cName }}{{ scope.row.cNickName ? `/${scope.row.cNickName}` : '' }}</span>
+                    </template>
+                </el-table-column>
+                <el-table-column label="电话" align="center" prop="cPhone" />
+                <el-table-column label="上线状态" align="center" prop="nStatus2">
+                    <template slot-scope="scope">
+                        <span>{{ dict.label.local_technician_status2[scope.row.nStatus2] }}</span>
+                    </template>
+                </el-table-column>
+                <el-table-column label="服务状态" align="center" prop="nStatus">
+                    <!-- 服务状态(0 可服务 1 服务中 2:不可服务) -->
+                    <template slot-scope="scope">
+                        <span>{{ dict.label.local_technician_status[scope.row.nStatus] }}</span>
+                    </template>
+                </el-table-column>
+                <el-table-column label="操作" align="center" fixed="right">
+                    <template slot-scope="scope">
+                        <el-button
+                            size="mini"
+                            type="text"
+                            @click="onAllocation(scope.row)"
+                        >分配</el-button>
+                    </template>
+                </el-table-column>
+            </el-table>
+            <pagination
+                :total="total" 
+                :page.sync="params.current"
+                :limit.sync="params.size" 
+                layout="total, prev, pager, next, jumper"
+                @pagination="getList" 
+            />
+        </div>
+        <div slot="footer" class="dialog-footer" v-if="0">
+            <el-button type="primary" @click="">确 定</el-button>
+            <el-button @click="close">取 消</el-button>
+        </div>
+    </ModalView>
+</template>
+
+<script>
+import {
+    queryRealTechnicians
+} from "@/api/system/js";
+import {
+    netTransferOrder
+} from "@/api/system/order";
+import ModalView from '@/components/ZModalView/index.vue';
+export default {
+    dicts: ['local_technician_status', 'local_technician_status2'],
+    components: {
+        ModalView
+    },
+    data() {
+        return {
+            title: '订单分配',
+            total: 0,
+            params: {
+                current: 1,
+                size: 5,
+            },
+            loading: false,
+            dataList: [],
+        }
+    },
+    computed: {
+        
+    },
+    methods: {
+        // 获取数据
+        getList() {
+            this.loading = true;
+            let { cId, ...params } = this.params;
+            queryRealTechnicians(params).then((res) => {
+                this.dataList = res.data.records;
+                this.total = res.data.total;
+            }).finally(() => {
+                this.loading = false;
+            });
+        },
+        // 查询
+        onQuery() {
+            this.params.current = 1;
+            this.getList();
+        },
+        onReset(n) {
+            this.resetForm(n);
+            this.onQuery();
+        },
+        // table操作
+        onAllocation(row) {
+            this.$confirm(`确认将此订单分配给${row.cName}?`, '提示', {
+                type: 'warning',
+                confirmButtonText: '确定',
+                cancelButtonText: '取消',
+            }).then(() => {
+                let params = {
+                    cId: this.params.cId,
+                    cJsId: row.id
+                };
+                netTransferOrder(params).then(res => {
+                    this.$message({
+                        type: res.code === 200 ? 'success' : 'error',
+                        message: res.msg
+                    });
+                    if (res.code === 200) this.close(true);
+                });
+            });
+        },
+        open(e) {
+            if (e) this.params = { ...this.params, ...e };
+            this.getList();
+            this.$refs.mv.open(this.title);
+        },
+        // 关闭弹窗
+        close(f) {
+            if (f) this.$emit('close');
+            this.$refs.mv.close();
+        },
+    }
+};
+</script>
+
+<style lang="scss" scoped>
+::v-deep .myModal {
+    .el-dialog__body {
+        max-height: 70vh;
+        overflow-y: auto;
+        padding: 10px 20px;
+    }
+}
+</style>

+ 22 - 14
src/views/order/vOrderRecord.vue → src/views/order/orderAllocationRecord.vue

@@ -5,19 +5,22 @@
         <div style="flex: 1;">
             <el-table v-loading="loading" :data="dataList">
                 <el-table-column type="index" label="序号" align="center" width="50" />
-                <el-table-column label="技师编号" align="center" prop="dTotalMoney" />
-                <el-table-column label="姓名/昵称" align="center" prop="cName" />
-                <el-table-column label="电话" align="center" prop="cPhone" />
-                <el-table-column label="服务状态" align="center" prop="js.cName" />
-                <el-table-column label="分配时间" align="center" prop="js.cNickName" />
-                <el-table-column label="操作记录" align="center" prop="js.cPhone" />
-                <el-table-column label="订单状态" align="center" prop="status">
+                <el-table-column label="技师编号" align="center" prop="newTechnicianId" />
+                <el-table-column label="姓名/昵称" align="center" prop="newTechnicianName" />
+                <el-table-column label="电话" align="center" prop="newTechnicianPhone" />
+                <el-table-column label="服务状态" align="center" prop="newTechnicianStatusAfter">
+                    <!-- 新技师操作后服务状态(0 可服务 1 服务中 2:不可服务) -->
                     <template slot-scope="scope">
-                        <el-tag v-if="scope.row.status == 2">已分配</el-tag>
-                        <el-tag type="warning" v-else>未分配</el-tag>
+                        <span>{{ dict.label.local_technician_status[scope.row.newTechnicianStatusAfter] }}</span>
+                    </template>
+                </el-table-column>
+                <el-table-column label="分配时间" align="center" prop="createTime" />
+                <el-table-column label="操作记录" align="center" prop="operationResult">
+                    <!-- 操作结果(0:分配成功 1:已取消) -->
+                    <template slot-scope="scope">
+                        <span>{{ dict.label.local_voa_operation_status[scope.row.operationResult] }}</span>
                     </template>
                 </el-table-column>
-                <el-table-column label="时间" align="center" prop="dtCreateTime" />
             </el-table>
             <pagination v-show="total > 0" 
                 :total="total" 
@@ -34,8 +37,12 @@
 </template>
 
 <script>
+import {
+    getAllocationLogs
+} from "@/api/system/order";
 import ModalView from '@/components/ZModalView/index.vue';
 export default {
+    dicts: ['local_technician_status', 'local_voa_operation_status'],
     components: {
         ModalView
     },
@@ -48,7 +55,7 @@ export default {
                 size: 10,
             },
             loading: false,
-            dataList: [{},{},{},{}],
+            dataList: [],
         }
     },
     computed: {
@@ -58,15 +65,16 @@ export default {
         // 获取数据
         getList() {
             this.loading = true;
-            listOrder(this.params).then((res) => {
+            getAllocationLogs(this.params).then((res) => {
                 this.dataList = res.data.records;
                 this.total = res.data.total;
             }).finally(() => {
                 this.loading = false;
             });
         },
-        open(t) {
-            if (t) this.title = t;
+        open(e) {
+            if (e) this.params = { ...this.params, ...e };
+            this.getList();
             this.$refs.mv.open(this.title);
         },
         // 关闭弹窗

+ 1 - 0
src/views/technician/details/details.vue

@@ -174,6 +174,7 @@
                 multiple
                 filterable
                 allow-create
+                collapse-tags
                 value-key="cId"
                 placeholder="请选择项目"
                 style="width: 100%"

+ 1 - 1
src/views/technician/technician/index.vue

@@ -434,7 +434,7 @@ import {
   addJs,
   updateJs,
   getJscode,
-  unbind
+  unbind,
 } from "@/api/system/js";
 import {
   getVirtualAddrByPhone