toDoorService.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>上门服务代预约</title>
  7. <link rel="stylesheet" type="text/css" href="../../../css/bootstrap.min.css" />
  8. <link rel="stylesheet" type="text/css" href="../../../css/style.min.css" />
  9. <link rel="stylesheet" type="text/css" href="../../../css/cross.css" />
  10. <link rel="stylesheet" href="../../../plugins/toastr/toastr.min.css" />
  11. <link rel="stylesheet" href="../../../plugins/element-ui/element-ui.css" />
  12. <link rel="stylesheet" type="text/css" href="../css/date.css" />
  13. <link rel="stylesheet" href="../css/common.css" />
  14. <style>
  15. #app {
  16. font-size: 14px;
  17. }
  18. .form-box {
  19. padding: 16px 20px 20px;
  20. }
  21. .form-item {
  22. border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  23. padding: 4px 0;
  24. display: flex;
  25. justify-content: space-between;
  26. align-items: center;
  27. height: 44px;
  28. }
  29. .form-label {
  30. }
  31. .service-box {
  32. padding: 4px 0;
  33. border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  34. }
  35. .service-item {
  36. margin-left: 20px;
  37. margin-right: 10px;
  38. height: 24px;
  39. }
  40. .address-box {
  41. padding: 4px 0;
  42. border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  43. }
  44. .flex {
  45. display: flex;
  46. justify-content: space-between;
  47. align-items: center;
  48. }
  49. .reservation-btn {
  50. display: block;
  51. width: 300px;
  52. margin: 20px auto;
  53. }
  54. .no-service {
  55. text-align: center;
  56. line-height: 40px;
  57. }
  58. .required-icon{
  59. position: relative;
  60. }
  61. .required-icon::after{
  62. content: "*";
  63. position: absolute;
  64. left: -10px;
  65. color: #ed2d2d;
  66. top: 50%;
  67. transform: translateY(-50%);
  68. }
  69. </style>
  70. </head>
  71. <body>
  72. <div id="app" v-cloak>
  73. <div class="form-box">
  74. <div class="service-box">
  75. <div class="flex">
  76. <div class="form-label">本次预定的服务</div>
  77. <div class="form-value" style="cursor: pointer" @click="toSelectService">
  78. (已造
  79. <span style="color: #11b7f5">{{serviceList.length}}</span>
  80. 项)
  81. <i class="el-icon-arrow-right"></i>
  82. </div>
  83. </div>
  84. <div class="service-list">
  85. <div class="service-item flex" v-for="item in serviceList">
  86. <div style="width: 300px">{{item.title}}</div>
  87. <div style="padding-left: 20px">x{{item.num}}</div>
  88. <div style="color: #ed2d2d">¥{{item.expense}}</div>
  89. </div>
  90. <div v-if="serviceList.length == 0" class="no-service">暂未选择服务</div>
  91. </div>
  92. </div>
  93. <div class="form-item">
  94. <div class="form-label">服务对象</div>
  95. <div class="form-value">{{patientInfo.name}}</div>
  96. </div>
  97. <div class="form-item">
  98. <div class="form-label">签约地区</div>
  99. <div class="form-value">{{patientInfo.townName}}</div>
  100. </div>
  101. <div class="form-item">
  102. <div class="form-label">联系方式</div>
  103. <div class="form-value">{{patientInfo.mobile}}</div>
  104. </div>
  105. <div class="address-box ">
  106. <div class="flex required-icon">
  107. <div>上门地址</div>
  108. <el-input v-model="serveAddress" placeholder="请输入上门地址" size="small" style="width: 200px" @change="getAddressPoint"></el-input>
  109. </div>
  110. <div id="map2" style="height: 200px; margin: 10px"></div>
  111. </div>
  112. <div class="service-box">
  113. <div class="form-label" style="height: 32px; line-height: 32px">请说明居民需要什么服务?</div>
  114. <el-input v-model="serveDesc" placeholder="请简要描述居民的病情..." type="textarea" :maxlength="100" :rows="3" resize="none"></el-input>
  115. </div>
  116. <div class="form-item">
  117. <div class="form-label required-icon">希望服务时间</div>
  118. <div class="form-value">
  119. <el-date-picker v-model="time" type="datetime" size="small" value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择日期时间"></el-date-picker>
  120. </div>
  121. </div>
  122. <div class="form-item">
  123. <div class="form-label required-icon">服务医生</div>
  124. <div class="form-value" style="width: 200px; text-align: right; cursor: pointer" @click="toSelectDoctor">
  125. {{doctor.name}}
  126. <i class="el-icon-arrow-right"></i>
  127. </div>
  128. </div>
  129. </div>
  130. <el-button type="primary" class="reservation-btn" @click="reservationFn">提交预约</el-button>
  131. </div>
  132. <!-- <script type="text/javascript" src="https://api.map.baidu.com/api?v=3.0&ak=d2GXayjVT86kMvm5FRKvGgY0EjlXdRNx"></script> -->
  133. <script type="text/javascript" src="../../../js/api-map-baidu.lite.js"></script>
  134. <script type="text/javascript" src="../../../js/vue.js"></script>
  135. <script type="text/javascript" src="../../../js/jquery-2.2.4.js"></script>
  136. <script type="text/javascript" src="../../../js/es6-promise.js" charset="utf-8"></script>
  137. <script type="text/javascript" src="../../../plugins/toastr/toastr.min.js"></script>
  138. <script type="text/javascript" src="../../../plugins/element-ui/element-ui.js"></script>
  139. <script type="text/javascript" src="../../../api/http-request.js"></script>
  140. <script type="text/javascript" src="../../../plugins/layer/layer.min.js"></script>
  141. <script type="text/javascript" src="../../../api/rehabilitation-api.js"></script>
  142. <script type="text/javascript" src="../../../api/recover_api.js"></script>
  143. <script type="text/javascript" src="../../../js/underscore-1.9.1.js"></script>
  144. <script type="text/javascript" src="../../../js/util.js" charset="utf-8"></script>
  145. <script>
  146. new Vue({
  147. el: '#app',
  148. data() {
  149. return {
  150. patient: null,
  151. patientInfo: {},
  152. serveDesc: '',
  153. time: null,
  154. serviceList: [],
  155. bmap: null,
  156. serveAddress: null,
  157. marker: null,
  158. doctor: { name: '' },
  159. detailId: null,
  160. docInfo: null,
  161. serveLat: null,
  162. serveLon: null
  163. }
  164. },
  165. mounted() {
  166. this.patient = GetRequest().patient
  167. this.detailId = GetRequest().detailId
  168. this.docInfo = JSON.parse(localStorage.getItem('docInfo'))
  169. this.getPatientInfo()
  170. this.initMap()
  171. },
  172. methods: {
  173. toSelectService() {
  174. const vm = this
  175. // this.$message.warning('暂无可供选择的服务,请在下方直接描述您所需的服务')
  176. sessionStorage.setItem('serviceList', JSON.stringify(this.serviceList))
  177. top.layer.open({
  178. type: 2,
  179. area: ['600px', '800px'],
  180. shade: 0.5,
  181. title: '选择服务',
  182. fixed: true, //不固定
  183. maxmin: true,
  184. closeBtn: 1,
  185. // shift: 5,
  186. shadeClose: false, //点击遮罩关闭层
  187. content: `../../rehabilitation/html/serviceDialog.html`,
  188. end: function () {
  189. const val = sessionStorage.getItem('serviceList')
  190. if (val) {
  191. sessionStorage.removeItem('serviceList')
  192. vm.serviceList = JSON.parse(val)
  193. }
  194. }
  195. })
  196. },
  197. getPatientInfo() {
  198. const vm = this
  199. httpRequest.post('doctor/patient_label_info/patient', { data: { patient: this.patient } }).then(function (res) {
  200. vm.patientInfo = res.data
  201. })
  202. },
  203. initMap() {
  204. var vm = this
  205. // 初始化地图, 设置中心点坐标和地图级别
  206. vm.bmap = new BMap.Map('map2')
  207. const point = new BMap.Point(116.404, 39.915) // 创建点坐标
  208. vm.bmap.centerAndZoom(point, 15) // 初始化地图,设置中心点坐标和缩放级别
  209. // 添加缩放控件
  210. // var zoomCtrl = new BMap.ZoomControl({
  211. // anchor: BMAP_ANCHOR_BOTTOM_RIGHT
  212. // })
  213. // vm.bmap.addControl(zoomCtrl)
  214. vm.marker = new BMap.Marker(point)
  215. vm.bmap.addOverlay(vm.marker)
  216. // vm.bmap.enableScrollWheelZoom()
  217. vm.bmap.addEventListener('click', function (e) {
  218. console.log(2)
  219. return
  220. vm.getAddress(e.point)
  221. vm.bmap.clearOverlays()
  222. vm.marker = new BMap.Marker(e.point) //中心点坐标红点
  223. vm.bmap.addOverlay(vm.marker) // 增加中心点坐标红点
  224. vm.bmap.centerAndZoom(new BMap.Point(e.point.lng, e.point.lat)) // 设置地图中心
  225. })
  226. },
  227. getAddress(center) {
  228. var vm = this
  229. var params = {
  230. ak: 'd2GXayjVT86kMvm5FRKvGgY0EjlXdRNx',
  231. output: 'json',
  232. coordtype: 'bd09ll',
  233. location: center.lat + ',' + center.lng
  234. }
  235. httpRequest.get('https://api.map.baidu.com/reverse_geocoding/v3/', { data: params }, function (res) {
  236. if (res.status == 0) {
  237. vm.serveAddress = res.result.formatted_address
  238. } else {
  239. vm.$message.warning('获取地址失败')
  240. }
  241. })
  242. },
  243. getAddressPoint() {
  244. var vm = this
  245. var params = {
  246. ak: 'd2GXayjVT86kMvm5FRKvGgY0EjlXdRNx',
  247. output: 'json',
  248. address: vm.serveAddress,
  249. city: '厦门市'
  250. }
  251. httpRequest.get('third/door/findAreaMap', { data: params }).then(function (res) {
  252. if (res.status == 200) {
  253. res = JSON.parse(res.data)
  254. if (res.status == 0) {
  255. if (res.result.location) {
  256. vm.bmap.clearOverlays()
  257. vm.serveLat = res.result.location.lat
  258. vm.serveLon = res.result.location.lng
  259. vm.marker = new BMap.Marker(res.result.location) //中心点坐标红点
  260. vm.bmap.addOverlay(vm.marker)
  261. vm.bmap.centerAndZoom(new BMap.Point(res.result.location.lng, res.result.location.lat), 15) // 设置地图中心
  262. }
  263. } else {
  264. vm.$message.warning('获取坐标失败')
  265. }
  266. }
  267. })
  268. },
  269. toSelectDoctor() {
  270. const vm = this
  271. top.layer.open({
  272. type: 2,
  273. area: ['500px', '700px'],
  274. shade: 0.5,
  275. title: '选择服务',
  276. fixed: true, //不固定
  277. maxmin: true,
  278. closeBtn: 1,
  279. // shift: 5,
  280. shadeClose: false, //点击遮罩关闭层
  281. content: `../../rehabilitation/html/selectDoctor.html?patient=${this.patient}`,
  282. end: function () {
  283. const val = sessionStorage.getItem('selectDoctor')
  284. if (val) {
  285. sessionStorage.removeItem('selectDoctor')
  286. vm.doctor = JSON.parse(val)
  287. }
  288. }
  289. })
  290. },
  291. reservationFn() {
  292. const nowDate = new Date().getTime()
  293. const serviceDate = new Date(this.time).getTime()
  294. const vm = this
  295. if (!vm.serveAddress) {
  296. vm.$message.warning('请输入上门地址')
  297. return
  298. }
  299. if (!vm.time) {
  300. vm.$message.warning('请输入希望服务时间')
  301. return
  302. }
  303. if (!vm.doctor.name) {
  304. vm.$message.warning('请选择服务医生')
  305. return
  306. }
  307. if (nowDate >= serviceDate) {
  308. this.$message.warning('服务时间不能早于当前时间')
  309. return
  310. }
  311. const params = {
  312. dataJson: JSON.stringify({
  313. rehabilitationDetailId: this.detailId,
  314. patientCode: this.patient,
  315. patientName: this.patientInfo.name,
  316. doctorCode: vm.docInfo.code,
  317. doctorName: vm.docInfo.name,
  318. relationRecordType: 4,
  319. relationRecordCode: '',
  320. status: 0,
  321. node: '',
  322. relationRecordImg: ''
  323. })
  324. }
  325. const packageItemArr = []
  326. this.serviceList.forEach(function (item) {
  327. packageItemArr.push({
  328. type: 1,
  329. code: item.code,
  330. name: item.title,
  331. fee: item.expense,
  332. feeDiscount: 0,
  333. number: item.num,
  334. status: 1
  335. })
  336. })
  337. var param = {
  338. jsonData: JSON.stringify({
  339. order: {
  340. proxyPatient: vm.docInfo.patient,
  341. proxyPatientName: vm.docInfo.name,
  342. proxyPatientPhone: vm.docInfo.mobile,
  343. patient: vm.patient,
  344. patientName: vm.patientInfo.name,
  345. patientPhone: vm.patientInfo.mobile,
  346. patientExpectedServeTime: vm.time,
  347. serveDesc: vm.serveDesc,
  348. serveTown: vm.patientInfo.townName,
  349. serveAddress: vm.serveAddress,
  350. serveLat: vm.serveLat,
  351. serveLon: vm.serveLon,
  352. doctor: vm.docInfo.doctor,
  353. doctorName: vm.docInfo.name,
  354. doctorType: vm.docInfo.jobName,
  355. id: null, //重新派单增加orderId
  356. relationCode: vm.detailId
  357. },
  358. deleteItemArr: [], ////重新派单编辑服务项需传原来服务项id
  359. packageItemArr: packageItemArr, //提交的服务项
  360. hospital: {
  361. code: vm.docInfo.hospital
  362. }
  363. })
  364. }
  365. this.saveRehabilitationOperateRecord(params, param)
  366. },
  367. saveRehabilitationOperateRecord(params, param) {
  368. const vm = this
  369. var url = 'doctor/specialist/rehabilitation/saveRehabilitationOperateRecord'
  370. httpRequest.post(url, { data: params }).then(function (res) {
  371. if (res.status == 200) {
  372. var jsonData = JSON.parse(param.jsonData)
  373. jsonData.order.relationCode = res.data.id
  374. param.jsonData = JSON.stringify(jsonData)
  375. vm.createSend(param)
  376. } else {
  377. vm.$message.error(res.msg || '服务记录失败')
  378. }
  379. })
  380. },
  381. createSend(param) {
  382. const vm = this
  383. var url = 'doctor/serviceOrder/proxyCreate'
  384. httpRequest.post(url, { data: param }).then(function (res) {
  385. if (res.status == 200) {
  386. vm.$message.success('预约成功!')
  387. } else {
  388. vm.$message.error(res.msg)
  389. }
  390. })
  391. }
  392. }
  393. })
  394. </script>
  395. </body>
  396. </html>