index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="120px">
  4. <el-form-item label="订单号 患者姓名" prop="orderSn">
  5. <el-input
  6. v-model="queryParams.keyword"
  7. placeholder="请输入订单号 患者姓名"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="公司名称" prop="companyId" >
  14. <el-select v-model="queryParams.companyId" placeholder="请选择所属公司" clearable filterable size="small">
  15. <el-option v-for="(option, index) in companyList" :key="index" :value="option.dictValue" :label="option.dictLabel"></el-option>
  16. </el-select>
  17. </el-form-item>
  18. <el-form-item label="员工" prop="companyUserNickName">
  19. <el-input v-model="queryParams.companyUserNickName" placeholder="请输入员工名称" clearable size="small" @keyup.enter.native="handleQuery"/>
  20. </el-form-item>
  21. <el-form-item label="病人电话" prop="phone">
  22. <el-input v-model="queryParams.phone" placeholder="请输入病人电话" clearable size="small" @keyup.enter.native="handleQuery"/>
  23. </el-form-item>
  24. <el-form-item label="问诊开始时间" prop="startTime">
  25. <el-date-picker v-model="startTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="change"></el-date-picker>
  26. </el-form-item>
  27. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  28. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  29. </el-form-item>
  30. </el-form>
  31. <el-tabs type="card" v-model="actName" @tab-click="handleClickX">
  32. <el-tab-pane label="全部订单" name="10"></el-tab-pane>
  33. <el-tab-pane v-for="(item,index) in inquiryStatusOptions" :label="item.dictLabel" :name="item.dictValue"></el-tab-pane>
  34. </el-tabs>
  35. <el-table v-loading="loading" border :data="inquiryOrderList" @selection-change="handleSelectionChange" >
  36. <el-table-column type="selection" width="55" align="center" />
  37. <el-table-column label="订单编号" align="center" prop="orderSn" />
  38. <el-table-column label="患者姓名" align="center" width="120" >
  39. <template slot-scope="scope">
  40. <span>{{ JSON.parse(scope.row.patientJson).patientName }}</span>
  41. </template>
  42. </el-table-column>
  43. <el-table-column label="患者电话" align="center" width="120" >
  44. <template slot-scope="scope">
  45. <span>{{ JSON.parse(scope.row.patientJson).mobile }}</span>
  46. </template>
  47. </el-table-column>
  48. <el-table-column label="患者性别" align="center" width="80" >
  49. <template slot-scope="scope">
  50. <span>{{ JSON.parse(scope.row.patientJson).sex==1?'男':'女' }}</span>
  51. </template>
  52. </el-table-column>
  53. <el-table-column label="患者年龄" align="center" width="80" >
  54. <template slot-scope="scope">
  55. <span>{{ JSON.parse(scope.row.patientJson).age }}</span>
  56. </template>
  57. </el-table-column>
  58. <el-table-column label="状态" align="center" prop="status" width="80" >
  59. <template slot-scope="scope">
  60. <dict-tag :options="inquiryStatusOptions" :value="scope.row.status" />
  61. </template>
  62. </el-table-column>
  63. <el-table-column label="订单类型" align="center" width="150" >
  64. <template slot-scope="scope">
  65. <div style="display: flex; align-items: center;">
  66. <dict-tag :options="inquiryTypeOptions" :value="scope.row.inquiryType" />
  67. <span style="margin: 0 5px;"></span>
  68. <dict-tag :options="inquiryOrderOptions" :value="scope.row.orderType" />
  69. </div>
  70. </template>
  71. </el-table-column>
  72. <el-table-column label="订单子类型" align="center" prop="inquirySubType" width="120">
  73. <template slot-scope="scope">
  74. <dict-tag :options="inquirySubTypeOptions" :value="scope.row.inquirySubType" />
  75. </template>
  76. </el-table-column>
  77. <el-table-column label="病情描述" align="center" prop="title" show-overflow-tooltip width="200" />
  78. <el-table-column label="公司" align="center" prop="companyName" />
  79. <el-table-column label="员工" align="center" prop="nickName" />
  80. <el-table-column label="问诊开始时间" align="center" prop="startTime" width="180" />
  81. <el-table-column label="结束时间" align="center" prop="finishTime" width="180" />
  82. <el-table-column label="创建时间" align="center" prop="createTime" />
  83. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="180px">
  84. <template slot-scope="scope">
  85. <el-button
  86. v-if="scope.row.status == 2"
  87. type="success"
  88. plain
  89. round
  90. size="medium"
  91. @click="handleReceiveOrder(scope.row)"
  92. >接单</el-button>
  93. <el-button
  94. v-if="scope.row.status == 2"
  95. type="danger"
  96. plain
  97. round
  98. size="medium"
  99. @click="handleRefuseOrder(scope.row)"
  100. >拒单</el-button>
  101. <el-button
  102. size="mini"
  103. type="text"
  104. @click="handledetails(scope.row)"
  105. icon="el-icon-share"
  106. >详情
  107. </el-button>
  108. <el-button
  109. v-if="scope.row.status==3"
  110. size="mini"
  111. type="text"
  112. @click="handleContinue(scope.row)"
  113. icon="el-icon-share"
  114. >继续问诊
  115. </el-button>
  116. <el-button
  117. v-if="scope.row.status==1"
  118. size="mini"
  119. type="text"
  120. @click="handleCloseOrder(scope.row)"
  121. icon="el-icon-share"
  122. >关闭订单
  123. </el-button>
  124. <el-button
  125. size="mini"
  126. type="text"
  127. @click="followMsg(scope.row)"
  128. >聊天记录</el-button>
  129. </template>
  130. </el-table-column>
  131. </el-table>
  132. <pagination
  133. v-show="total>0"
  134. :total="total"
  135. :page.sync="queryParams.pageNum"
  136. :limit.sync="queryParams.pageSize"
  137. @pagination="getList"
  138. />
  139. <el-drawer :with-header="false" size="75%" :title="show.title" :visible.sync="show.open">
  140. <inquiryOrderDetails ref="Details" @closeDetails="closeDetails"/>
  141. </el-drawer>
  142. <el-dialog title="聊天记录" :visible.sync="msgDialog.open" width="80%" >
  143. <msgDetails ref="msgDetails" :msgDialogClose="msgDialogClose" /><strong></strong>
  144. <span slot="footer" class="dialog-footer">
  145. <el-button @click="msgDialog.open=false">取 消</el-button>
  146. <el-button type="primary" @click="msgDialog.open=false">确 定</el-button>
  147. </span>
  148. </el-dialog>
  149. </div>
  150. </template>
  151. <script>
  152. import { getOrderUserPhone,getCompanyList,getInquiryOrderList,receiveOrder,refuseOrder,closeOrder } from "@/api/inquiryOrder";
  153. import inquiryOrderDetails from '../../components/order/inquiryOrderDetails.vue';
  154. import msgDetails from '@/views/components/msg/followMsgDetails.vue';
  155. import way from '@/utils/way.js';
  156. export default {
  157. name: "inquiryOrder",
  158. components: { inquiryOrderDetails ,msgDetails},
  159. data() {
  160. return {
  161. show:{
  162. title:"问诊详情",
  163. open:false,
  164. },
  165. companyList:[],
  166. startTime:null,
  167. msgDialog:{
  168. open:false,
  169. title:"聊天记录"
  170. },
  171. // 遮罩层
  172. loading: true,
  173. actName:"10",
  174. // 导出遮罩层
  175. exportLoading: false,
  176. // 选中数组
  177. ids: [],
  178. // 非单个禁用
  179. single: true,
  180. inquirySubTypeOptions:[],
  181. createTimeRange:[],
  182. payTimeRange:[],
  183. // 非多个禁用
  184. multiple: true,
  185. // 显示搜索条件
  186. showSearch: true,
  187. // 总条数
  188. total: 0,
  189. // 问诊订单表格数据
  190. inquiryOrderList: [],
  191. // 弹出层标题
  192. title: "",
  193. // 是否显示弹出层
  194. open: false,
  195. // 查询参数
  196. queryParams: {
  197. pageNum: 1,
  198. pageSize: 10,
  199. orderSn: null,
  200. title: null,
  201. imgs: null,
  202. userId: null,
  203. patientId: null,
  204. orderType: null,
  205. money: null,
  206. payMoney: null,
  207. payType: null,
  208. isPay: null,
  209. doctorId: null,
  210. payTime: null,
  211. status: null,
  212. startTime: null,
  213. sTime:null,
  214. eTime:null,
  215. finishTime: null,
  216. isPing: null,
  217. pingStar: null,
  218. pingContent: null,
  219. departmentId: null,
  220. doctorName:null,
  221. patientName:null,
  222. sendName:null,
  223. },
  224. // 表单参数
  225. form: {},
  226. receiveOrderForm:{},
  227. refuseOrderForm:{},
  228. // 表单校验
  229. rules: {
  230. },
  231. inquiryStatusOptions:[
  232. { dictValue: "2", dictLabel: '待接诊' },
  233. { dictValue: "3", dictLabel: '问诊中' },
  234. { dictValue: "4", dictLabel: '已结束' },
  235. { dictValue: "1", dictLabel: '待支付' },
  236. { dictValue: "-1", dictLabel: '已取消' },
  237. ],
  238. inquiryTypeOptions:[],
  239. inquiryPayOptions:[],
  240. inquiryOrderOptions:[],
  241. orOptions:[],
  242. };
  243. },
  244. created() {
  245. this.getDicts("sys_inquiry_type").then(response => {
  246. this.inquiryTypeOptions = response.data;
  247. });
  248. this.getDicts("sys_inquiry_pay").then(response => {
  249. this.inquiryPayOptions = response.data;
  250. });
  251. this.getDicts("sys_inquiry_order_type").then(response => {
  252. this.inquiryOrderOptions = response.data;
  253. });
  254. this.getDicts("sys_company_or").then(response => {
  255. this.orOptions = response.data;
  256. });
  257. this.getDicts("sys_inquiry_sub_type").then(response => {
  258. this.inquirySubTypeOptions = response.data;
  259. });
  260. getCompanyList().then(response => {
  261. this.companyList = response.list;
  262. });
  263. this.getList();
  264. },
  265. methods: {
  266. closeDetails(){
  267. this.show.open=false;
  268. },
  269. handleContinue(){
  270. way.$emit('open',1);
  271. },
  272. handleCloseOrder(row){
  273. console.log(row)
  274. closeOrder(row.orderId).then(response => {
  275. this.$message({
  276. message: "关闭成功",
  277. type: "success"
  278. });
  279. this.getList();
  280. })
  281. },
  282. followMsg(row){
  283. const userId = row.userId;
  284. const followDoctorId =row.doctorId;
  285. const doctorName = row.doctorName;
  286. const patientName = row.patientName;
  287. setTimeout(() => {
  288. this.$refs.msgDetails.getDetails(userId,followDoctorId,doctorName,patientName);
  289. }, 500);
  290. this.msgDialog.open = true;
  291. },
  292. msgDialogClose(){
  293. this.dialogVisible = false;
  294. },
  295. getMappedValue(key, options) {
  296. return options[key];
  297. },
  298. change(){
  299. if(this.startTime!=null){
  300. this.queryParams.sTime=this.startTime[0];
  301. this.queryParams.eTime=this.startTime[1];
  302. }else{
  303. this.queryParams.sTime=null;
  304. this.queryParams.eTime=null;
  305. }
  306. },
  307. handleReceiveOrder(row){
  308. const orderId = row.orderId
  309. this.receiveOrderForm.orderId = orderId;
  310. console.log(this.receiveOrderForm)
  311. this.$confirm('确认接单吗?', "提示", {
  312. confirmButtonText: "确定",
  313. cancelButtonText: "取消",
  314. type: "warning"
  315. }).then(() => {
  316. return receiveOrder(this.receiveOrderForm);
  317. }).then(() => {
  318. this.getList();
  319. this.msgSuccess("接单成功");
  320. }).catch(() => {});
  321. },
  322. handleRefuseOrder(row){
  323. const orderId = row.orderId
  324. this.refuseOrderForm.orderId = orderId;
  325. this.$confirm('确认拒单吗?', "提示", {
  326. confirmButtonText: "确定",
  327. cancelButtonText: "取消",
  328. type: "warning"
  329. }).then(() => {
  330. return refuseOrder(this.refuseOrderForm);
  331. }).then(() => {
  332. this.getList();
  333. this.msgSuccess("拒单成功");
  334. }).catch(() => {});
  335. },
  336. handledetails(row){
  337. this.show.open=true;
  338. setTimeout(() => {
  339. this.$refs.Details.getDetails(row.orderId);
  340. }, 1);
  341. },
  342. /** 查询问诊订单列表 */
  343. getList() {
  344. this.loading = true;
  345. this.queryParams.isReceive = 1;
  346. getInquiryOrderList(this.queryParams).then(response => {
  347. this.inquiryOrderList = response.data.list;
  348. console.log(this.inquiryOrderList)
  349. this.total = response.data.total;
  350. this.loading = false;
  351. });
  352. },
  353. // 取消按钮
  354. cancel() {
  355. this.open = false;
  356. this.reset();
  357. },
  358. // 表单重置
  359. reset() {
  360. this.form = {
  361. orderId: null,
  362. orderSn: null,
  363. title: null,
  364. imgs: null,
  365. userId: null,
  366. patientId: null,
  367. orderType: null,
  368. money: null,
  369. payMoney: null,
  370. payType: null,
  371. isPay: null,
  372. doctorId: null,
  373. createTime: null,
  374. payTime: null,
  375. status: null,
  376. startTime: null,
  377. finishTime: null,
  378. remark: null,
  379. isPing: null,
  380. pingStar: null,
  381. pingContent: null,
  382. departmentId: null,
  383. inquiryType: 1,
  384. doctorName:null,
  385. patientName:null,
  386. sTime:null,
  387. eTime:null,
  388. };
  389. this.resetForm("form");
  390. },
  391. /** 搜索按钮操作 */
  392. handleQuery() {
  393. this.queryParams.pageNum = 1;
  394. this.getList();
  395. },
  396. /** 重置按钮操作 */
  397. resetQuery() {
  398. this.resetForm("queryForm");
  399. this.createTimeRange=null;
  400. this.payTimeRange=null;
  401. this.startTime=null;
  402. this.queryParams.keyword=null;
  403. this.queryParams.sTime=null;
  404. this.queryParams.eTime=null;
  405. this.handleQuery();
  406. },
  407. // 多选框选中数据
  408. handleSelectionChange(selection) {
  409. this.ids = selection.map(item => item.orderId)
  410. this.single = selection.length!==1
  411. this.multiple = !selection.length
  412. },
  413. /** 新增按钮操作 */
  414. handleAdd() {
  415. this.reset();
  416. this.open = true;
  417. this.title = "添加问诊订单";
  418. },
  419. /** 修改按钮操作 */
  420. handleUpdate(row) {
  421. this.reset();
  422. const orderId = row.orderId || this.ids
  423. getinquiryOrder(orderId).then(response => {
  424. this.form = response.data;
  425. this.open = true;
  426. this.title = "修改问诊订单";
  427. });
  428. },
  429. handleClickX(tab, event) {
  430. if(tab.name=="10"){
  431. this.queryParams.status=null;
  432. }else{
  433. this.queryParams.status=tab.name;
  434. }
  435. this.handleQuery();
  436. },
  437. /** 提交按钮 */
  438. submitForm() {
  439. this.$refs["form"].validate(valid => {
  440. if (valid) {
  441. if (this.form.orderId != null) {
  442. updateinquiryOrder(this.form).then(response => {
  443. this.msgSuccess("修改成功");
  444. this.open = false;
  445. this.getList();
  446. });
  447. } else {
  448. addinquiryOrder(this.form).then(response => {
  449. this.msgSuccess("新增成功");
  450. this.open = false;
  451. this.getList();
  452. });
  453. }
  454. }
  455. });
  456. },
  457. /** 删除按钮操作 */
  458. handleDelete(row) {
  459. const orderIds = row.orderId || this.ids;
  460. this.$confirm('是否确认删除问诊订单编号为"' + orderIds + '"的数据项?', "警告", {
  461. confirmButtonText: "确定",
  462. cancelButtonText: "取消",
  463. type: "warning"
  464. }).then(function() {
  465. return delinquiryOrder(orderIds);
  466. }).then(() => {
  467. this.getList();
  468. this.msgSuccess("删除成功");
  469. }).catch(() => {});
  470. },
  471. }
  472. };
  473. </script>