caregiverDetails.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. <template>
  2. <view class="container">
  3. <view class="item-box">
  4. <u-image :src="infoData.photographUrl" width="196rpx" height="256rpx" :lazy-load="true"></u-image>
  5. <view class="info-box">
  6. <view class=" item-txt">{{infoData.name || '-'}}</view>
  7. <view class="info-item age-box">
  8. <view class="box-l">
  9. <view class="item-txt">{{infoData.sex == '2' ? '女' : '男'}}</view>
  10. <view class="item-txt age">{{infoData.age || '0'}}岁</view>
  11. </view>
  12. </view>
  13. <view class="info-item item-txt">工作年限:{{infoData.workYears || 0}}年</view>
  14. <view class="info-item service-box">
  15. <span class="item-txt">服务中:{{infoData.inProgressCount || 0}}</span>
  16. <span class="item-txt total">服务总数: {{infoData.finishCount || 0}}</span>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="certificate-box"
  21. v-if="infoData.nursingCertificateList && infoData.nursingCertificateList.length > 0">
  22. <view class="title">从业证书</view>
  23. <view class="box-item" v-for="item,index in infoData.nursingCertificateList">
  24. <u-image :src="item.pictureUrl" width="680rpx" height="350rpx" :lazy-load="true"></u-image>
  25. <span class="name">{{item.certificateName}}</span>
  26. </view>
  27. </view>
  28. <view class="btn-box">
  29. <span class="btn btn1" v-if="type == 'guanli'" @click="toEdit">编辑信息</span>
  30. <span class="btn btn2" @click.stop="confirmAndCall(infoData.phoneNumber)">联系护工</span>
  31. <span class="btn btn3" v-if="type == 'fenpei'" @click="confirmFen">确认分配</span>
  32. <span class="btn btn3" v-if="type == 'genghuan'" @click="confirmFen">确认更换</span>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. import {
  38. getNurseDetail,
  39. assignNurse
  40. } from '@/api/hospital.js'
  41. export default {
  42. data() {
  43. return {
  44. infoData: {},
  45. type: '',
  46. orderNo: '',
  47. id: '',
  48. popShow: false,
  49. }
  50. },
  51. onLoad(option) {
  52. if (option.id) {
  53. this.id = option.id
  54. }
  55. if (option.type) {
  56. this.type = option.type
  57. }
  58. if (option.orderNo) {
  59. this.orderNo = option.orderNo
  60. console.log('orderNo', this.orderNo);
  61. }
  62. },
  63. onShow() {
  64. this.getNurseDetail(this.id)
  65. },
  66. methods: {
  67. getNurseDetail(id) {
  68. let that = this;
  69. getNurseDetail(id).then(res => {
  70. if (res.code == 200) {
  71. this.infoData = res.data;
  72. }
  73. })
  74. .catch((err) => {
  75. console.log(err);
  76. })
  77. },
  78. toEdit() {
  79. uni.navigateTo({
  80. url: '/pages/workbench/caregiverForm?id=' + this.infoData.id + '&type=edit'
  81. })
  82. },
  83. confirmAndCall(phoneNumber) {
  84. // 先验证电话号码
  85. if (!this.isValidPhoneNumber(phoneNumber)) {
  86. uni.showToast({
  87. title: '电话号码格式不正确',
  88. icon: 'none'
  89. });
  90. return;
  91. }
  92. // 显示确认对话框
  93. uni.showModal({
  94. title: '确认拨打电话',
  95. content: `确定要拨打 ${phoneNumber} 吗?`,
  96. success: (res) => {
  97. if (res.confirm) {
  98. // 用户点击确定,执行拨打电话
  99. this.makePhoneCall(phoneNumber);
  100. }
  101. }
  102. });
  103. },
  104. isValidPhoneNumber(phoneNumber) {
  105. // 简单的电话号码验证
  106. return /^1[3-9]\d{9}$/.test(phoneNumber);
  107. },
  108. makePhoneCall(phoneNumber) {
  109. uni.makePhoneCall({
  110. phoneNumber: phoneNumber,
  111. success: () => {
  112. console.log('拨打电话成功');
  113. },
  114. fail: (err) => {
  115. console.error('拨打电话失败', err);
  116. uni.showToast({
  117. title: '拨打电话失败',
  118. icon: 'none'
  119. });
  120. }
  121. });
  122. },
  123. confirmFen() {
  124. let that = this;
  125. let txt = '';
  126. switch (this.type) {
  127. case 'fenpei':
  128. txt = '分配';
  129. break;
  130. case 'genghuan':
  131. txt = '更换';
  132. break;
  133. }
  134. //确认是否
  135. uni.showModal({
  136. title: '提示',
  137. content: '确定' + txt + '护工吗?',
  138. success: (res) => {
  139. if (res.confirm) {
  140. console.log('用户点击确定');
  141. let params = {
  142. id: that.orderNo,
  143. workerId: that.infoData.id
  144. };
  145. assignNurse(params).then(res => {
  146. if (res.code == 200) {
  147. uni.showToast({
  148. title: txt + '成功',
  149. icon: 'success'
  150. })
  151. setTimeout(() => {
  152. uni.navigateTo({
  153. url: '/pages/workbench/order/list'
  154. })
  155. }, 1000)
  156. }
  157. })
  158. .catch((err) => {
  159. console.log(err);
  160. })
  161. } else if (res.cancel) {
  162. console.log('用户点击取消');
  163. }
  164. },
  165. })
  166. },
  167. }
  168. }
  169. </script>
  170. <style scoped lang="scss">
  171. .container {
  172. padding: 20rpx 20rpx 200rpx;
  173. .item-box {
  174. display: flex;
  175. align-items: center;
  176. background-color: #fff;
  177. border-radius: 10rpx;
  178. padding: 20rpx;
  179. .info-box {
  180. display: flex;
  181. flex-direction: column;
  182. justify-content: space-between;
  183. margin-left: 20rpx;
  184. flex: 1;
  185. .info-item {
  186. margin-top: 30rpx;
  187. }
  188. .item-txt {
  189. font-size: 28rpx;
  190. color: #1a1a1a;
  191. }
  192. .age-box {
  193. display: flex;
  194. align-items: center;
  195. justify-content: space-between;
  196. .box-l {
  197. display: flex;
  198. align-items: center;
  199. .age {
  200. margin-left: 30rpx;
  201. }
  202. }
  203. .btn {
  204. font-size: 28rpx;
  205. color: #4B91D1;
  206. }
  207. }
  208. .service-box {
  209. display: flex;
  210. align-items: center;
  211. justify-content: space-between;
  212. .total {}
  213. }
  214. }
  215. }
  216. .certificate-box {
  217. display: flex;
  218. flex-direction: column;
  219. padding: 0 20rpx;
  220. margin-top: 20rpx;
  221. background-color: #fff;
  222. border-radius: 10rpx;
  223. .title {
  224. padding: 20rpx 0;
  225. font-size: 32rpx;
  226. font-weight: bold;
  227. }
  228. .box-item {
  229. display: flex;
  230. flex-direction: column;
  231. align-items: center;
  232. ::v-deep .u-image {
  233. background-color: #f3f4f6;
  234. }
  235. .name {
  236. padding: 30rpx;
  237. font-size: 30rpx;
  238. font-weight: bold;
  239. }
  240. }
  241. }
  242. .btn-box {
  243. position: fixed;
  244. bottom: 0;
  245. left: 0;
  246. display: flex;
  247. align-items: center;
  248. justify-content: space-around;
  249. width: 100%;
  250. padding: 40rpx;
  251. box-sizing: border-box;
  252. background-color: #fff;
  253. .btn {
  254. width: 206rpx;
  255. height: 60rpx;
  256. border-radius: 10rpx;
  257. background-color: #4B91D1;
  258. text-align: center;
  259. line-height: 60rpx;
  260. color: #fff;
  261. font-size: 28rpx;
  262. }
  263. }
  264. }
  265. .pop-box {
  266. .pop-title {
  267. font-size: 32rpx;
  268. font-weight: bold;
  269. text-align: center;
  270. padding: 20rpx 0;
  271. }
  272. .pop-content {
  273. display: flex;
  274. flex-direction: column;
  275. align-items: center;
  276. margin-top: 30rpx;
  277. font-size: 28rpx;
  278. color: #6F6F6F;
  279. padding: 0 20rpx;
  280. &>view {
  281. margin-bottom: 20rpx;
  282. &:last-child {
  283. margin-bottom: 0;
  284. }
  285. }
  286. .pop-item {
  287. display: flex;
  288. align-items: center;
  289. justify-content: center;
  290. width: 500rpx;
  291. padding: 20rpx 0;
  292. background-color: #4B91D1;
  293. border-radius: 40rpx;
  294. color: #fff;
  295. .txt {
  296. font-size: 28rpx;
  297. }
  298. }
  299. }
  300. .footer-btn {
  301. display: flex;
  302. flex-direction: column;
  303. align-items: center;
  304. margin-top: 60rpx;
  305. .btn {
  306. width: 500rpx;
  307. padding: 20rpx 0;
  308. border: 1rpx solid #4B91D1;
  309. border-radius: 40rpx;
  310. color: #333;
  311. text-align: center;
  312. }
  313. }
  314. }
  315. </style>