dd.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724
  1. <template>
  2. <view class="content">
  3. <view class="navbar flex">
  4. <view v-for="(item, index) in navList" :key="index" class="nav-item"
  5. :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
  6. </view>
  7. <swiper :current="tabCurrentIndex" class="swiper-box" duration="300" @change="changeTab"
  8. :style="{'height': height}">
  9. <swiper-item v-for="navitem in navList">
  10. <scroll-view scroll-y="true" :style="{'height': height}" class="scoll-box"
  11. :class="{'fbx-scoll': tabCurrentIndex == 0 && userInfo.type == 3}">
  12. <empty v-if="navitem.loaded === true && navitem.orderList.length === 0"></empty>
  13. <view class="dd-wrap" v-for="litem in navitem.orderList">
  14. <view class="dd-top flex">
  15. <image src="../../static/icon/qianger.png" mode=""></image>
  16. <view class="">
  17. 订单信息
  18. </view>
  19. <view class="dd-time">
  20. <text v-if="tabCurrentIndex == 0">发布时间: {{litem.add_time | showTime}}</text><text
  21. v-if="tabCurrentIndex == 1" style="color: #6786FB;">已接单</text>
  22. </view>
  23. </view>
  24. <view class="dd-info">
  25. <view class="flex fs">
  26. <view class="info-name">地区:</view>
  27. <view class="info-val">{{litem.province + ' ' + litem.city + ' ' + litem.district}}
  28. </view>
  29. </view>
  30. <view class="flex fs">
  31. <view class="info-name">机构名称:</view>
  32. <view class="info-val">{{litem.organ_name}}</view>
  33. </view>
  34. <view class="flex fs">
  35. <view class="info-name">服务时间:</view>
  36. <view class="info-val">{{litem.time_area}}</view>
  37. </view>
  38. <view class="flex fs">
  39. <view class="info-name">职称:</view>
  40. <view class="info-val">{{litem.doctor_level | showlevel}}</view>
  41. </view>
  42. <view class="flex fs">
  43. <view class="info-name">专业:</view>
  44. <view class="info-val">{{litem.type}}</view>
  45. </view>
  46. <view class="flex fs">
  47. <view class="info-name">设备说明:</view>
  48. <view class="info-val">{{litem.tags.join('、')}}</view>
  49. </view>
  50. <view class="flex fs">
  51. <view class="info-name">回报金额:</view>
  52. <view class="info-val">{{litem.brokerage}}</view>
  53. </view>
  54. <view class="flex fs">
  55. <view class="info-name">要求:</view>
  56. <view class="info-val">{{litem.content}}</view>
  57. </view>
  58. </view>
  59. <view class="jd-info flex" v-if="litem.doctor">
  60. <view class="">
  61. 姓名:{{litem.doctor.name}}
  62. </view>
  63. <view class="">
  64. 电话:{{litem.doctor.mobile}}
  65. </view>
  66. </view>
  67. <view class="jd-btn" v-if="tabCurrentIndex == 0 && userInfo.type == 2">
  68. <view class="btn" @click="jiedan(litem)">
  69. 确认接单
  70. </view>
  71. </view>
  72. </view>
  73. <uni-load-more :status="navitem.loadingType"></uni-load-more>
  74. <!-- 底部发布新订单 -->
  75. <view class="fb-btn" v-if="tabCurrentIndex == 0 && userInfo.type == 3">
  76. <view class="new-btn" @click.stop="navto('/pages/dd/opendd')">
  77. 发布新订单
  78. </view>
  79. </view>
  80. </scroll-view>
  81. </swiper-item>
  82. </swiper>
  83. </view>
  84. </template>
  85. <script>
  86. import {
  87. mapState,
  88. mapMutations
  89. } from 'vuex';
  90. import {
  91. getUserInfo
  92. } from '@/api/login.js';
  93. import {
  94. ddlist,
  95. acceptMission
  96. } from '@/api/dd.js'
  97. import empty from '@/components/empty';
  98. export default {
  99. components: {
  100. empty
  101. },
  102. data() {
  103. return {
  104. height: '',
  105. tabCurrentIndex: 0,
  106. navList: [{
  107. type: 0,
  108. text: '待接订单',
  109. loadingType: 'more',
  110. orderList: [],
  111. page: 1, //当前页数
  112. limit: 10, //每次信息条数
  113. loaded: false
  114. },
  115. {
  116. type: 1,
  117. text: '已接订单',
  118. loadingType: 'more',
  119. orderList: [],
  120. page: 1, //当前页数
  121. limit: 10, //每次信息条数
  122. loaded: true
  123. }
  124. ]
  125. }
  126. },
  127. onReady(res) {
  128. var obj = this;
  129. uni.getSystemInfo({
  130. success: resu => {
  131. const query = uni.createSelectorQuery();
  132. query.select('.swiper-box').boundingClientRect();
  133. query.exec(function(res) {
  134. obj.height = resu.windowHeight - res[0].top + 'px';
  135. });
  136. },
  137. fail: res => {}
  138. });
  139. },
  140. onShow() {
  141. // 判断是否已经登录
  142. console.log(this.hasLogin, 'user');
  143. this.navList = [{
  144. type: 0,
  145. text: '待接订单',
  146. loadingType: 'more',
  147. orderList: [],
  148. page: 1, //当前页数
  149. limit: 10, //每次信息条数
  150. loaded: false
  151. },
  152. {
  153. type: 1,
  154. text: '已接订单',
  155. loadingType: 'more',
  156. orderList: [],
  157. page: 1, //当前页数
  158. limit: 10, //每次信息条数
  159. loaded: true
  160. }
  161. ]
  162. this.loadBaseData();
  163. let obj = this;
  164. getUserInfo({})
  165. .then(function(e) {
  166. // obj.userInfo = e.data;
  167. obj.setUserInfo(e.data)
  168. uni.setStorageSync('userInfo', e.data);
  169. if (obj.userInfo.type == 2) {
  170. uni.setTabBarItem({
  171. index: 0,
  172. text: '首页',
  173. iconPath: 'static/tabBar/tab-home.png',
  174. selectedIconPath: 'static/tabBar/tab-home-current.png'
  175. });
  176. uni.setTabBarItem({
  177. index: 1,
  178. text: '我的病人',
  179. iconPath: 'static/tabBar/tab-cate.png',
  180. selectedIconPath: 'static/tabBar/tab-cate-current.png',
  181. visible: true
  182. });
  183. uni.setTabBarItem({
  184. index: 2,
  185. text: '科普学习',
  186. iconPath: 'static/tabBar/tab-study.png',
  187. selectedIconPath: 'static/tabBar/tab-study-current.png',
  188. visible: false
  189. });
  190. uni.setTabBarItem({
  191. index: 3,
  192. text: '接单',
  193. iconPath: 'static/tabBar/jd.png',
  194. selectedIconPath: 'static/tabBar/jd-act.png',
  195. visible: true
  196. })
  197. uni.setTabBarItem({
  198. index: 4,
  199. text: '我的',
  200. iconPath: 'static/tabBar/tab-my.png',
  201. selectedIconPath: 'static/tabBar/tab-my-current.png'
  202. });
  203. }
  204. if (obj.userInfo.type == 3) {
  205. uni.setTabBarItem({
  206. index: 0,
  207. text: '首页',
  208. iconPath: 'static/tabBar/tab-home.png',
  209. selectedIconPath: 'static/tabBar/tab-home-current.png'
  210. });
  211. uni.setTabBarItem({
  212. index: 1,
  213. text: '咨询记录',
  214. iconPath: 'static/tabBar/tab-cate.png',
  215. selectedIconPath: 'static/tabBar/tab-cate-current.png',
  216. visible: true
  217. });
  218. uni.setTabBarItem({
  219. index: 2,
  220. text: '科普学习',
  221. iconPath: 'static/tabBar/tab-study.png',
  222. selectedIconPath: 'static/tabBar/tab-study-current.png',
  223. visible: false
  224. });
  225. uni.setTabBarItem({
  226. index: 3,
  227. text: '发布订单',
  228. iconPath: 'static/tabBar/jd.png',
  229. selectedIconPath: 'static/tabBar/jd-act.png',
  230. pagePath: '/pages/dd/dd',
  231. visible: true
  232. })
  233. uni.setTabBarItem({
  234. index: 4,
  235. text: '我的',
  236. iconPath: 'static/tabBar/tab-my.png',
  237. selectedIconPath: 'static/tabBar/tab-my-current.png'
  238. });
  239. }
  240. if (obj.userInfo.type == 1) {
  241. uni.setTabBarItem({
  242. index: 0,
  243. text: '首页',
  244. iconPath: 'static/tabBar/tab-home.png',
  245. selectedIconPath: 'static/tabBar/tab-home-current.png'
  246. });
  247. uni.setTabBarItem({
  248. index: 1,
  249. text: '咨询记录',
  250. iconPath: 'static/tabBar/tab-cate.png',
  251. selectedIconPath: 'static/tabBar/tab-cate-current.png',
  252. visible: true
  253. });
  254. uni.setTabBarItem({
  255. index: 2,
  256. text: '科普学习',
  257. iconPath: 'static/tabBar/tab-study.png',
  258. selectedIconPath: 'static/tabBar/tab-study-current.png',
  259. visible: true
  260. });
  261. uni.setTabBarItem({
  262. index: 3,
  263. text: '接单',
  264. iconPath: 'static/tabBar/jd.png',
  265. selectedIconPath: 'static/tabBar/jd-act.png',
  266. visible: false
  267. })
  268. uni.setTabBarItem({
  269. index: 4,
  270. text: '我的',
  271. iconPath: 'static/tabBar/tab-my.png',
  272. selectedIconPath: 'static/tabBar/tab-my-current.png'
  273. });
  274. }
  275. })
  276. .catch(function(e) {
  277. console.log(e);
  278. });
  279. },
  280. filters: {
  281. showlevel(val) {
  282. let str = '无'
  283. if (val) {
  284. if (val == 1) {
  285. str = '医师'
  286. } else if (val == 2) {
  287. str = '主治医师'
  288. } else if (val == 3) {
  289. str = '副主任医师'
  290. } else if (val == 4) {
  291. str = '主任医师'
  292. }
  293. }
  294. return str
  295. },
  296. showTime(val) {
  297. let str = ''
  298. if (val) {
  299. var time = new Date(val * 1000);
  300. var y = time.getFullYear();
  301. var m = time.getMonth() + 1;
  302. var d = time.getDate();
  303. var h = time.getHours();
  304. var mm = time.getMinutes();
  305. var s = time.getSeconds();
  306. str = y + '-' + m + '-' + d
  307. }
  308. return str
  309. }
  310. },
  311. computed: {
  312. ...mapState(['hasLogin', 'userInfo'])
  313. },
  314. methods: {
  315. ...mapMutations(['setUserInfo', 'setOrderInfo', 'logout']),
  316. //
  317. navto(url) {
  318. uni.navigateTo({
  319. url,
  320. fail() {
  321. uni.switchTab({
  322. url
  323. })
  324. }
  325. })
  326. },
  327. //顶部tab点击
  328. tabClick(index) {
  329. this.tabCurrentIndex = index;
  330. // 初始化数据列表
  331. this.navList[index].orderList = [];
  332. // 初始化翻页数
  333. this.navList[index].page = 1;
  334. // 初始化数据为未加载状态
  335. this.navList[index].loadingType = 'more';
  336. },
  337. //swiper 切换
  338. changeTab(e) {
  339. this.tabCurrentIndex = e.target.current;
  340. this.loadData('tabChange');
  341. },
  342. //获取navlist
  343. loadData(type) {
  344. // if(type == 'tabChange' && )
  345. let obj = this
  346. let index = obj.tabCurrentIndex
  347. let navitem = obj.navList[index]
  348. if (navitem.loadingType == 'loading' || navitem.loadingType == 'noMore') {
  349. return
  350. }
  351. navitem.loadingType = 'loading'
  352. ddlist({
  353. page: navitem.page,
  354. limit: navitem.limit,
  355. type: navitem.type
  356. }).then(res => {
  357. console.log(res)
  358. navitem.orderList = navitem.orderList.concat(res.data.list)
  359. console.log(navitem.orderList, 'navitem.orderList')
  360. navitem.page++
  361. if (res.data.list.length == navitem.limit) {
  362. navitem.loadingType = 'more'
  363. } else {
  364. navitem.loadingType = 'noMore'
  365. }
  366. navitem.loaded = true
  367. })
  368. },
  369. // 接单
  370. jiedan(item) {
  371. let obj = this
  372. console.log(item)
  373. acceptMission({
  374. id: item.id
  375. }).then(res => {
  376. let s = obj.navList[obj.tabCurrentIndex].orderList.indexOf(item)
  377. obj.navList[obj.tabCurrentIndex].orderList.splice(s, 1);
  378. })
  379. },
  380. // 加载初始数据
  381. loadBaseData() {
  382. let obj = this;
  383. getUserInfo({})
  384. .then(({
  385. data
  386. }) => {
  387. obj.setUserInfo(data);
  388. // obj.userInfo = data;
  389. console.log(obj.userInfo);
  390. // let arr = data.map(e => {
  391. // e.createtime = getTime(e.createtime);
  392. // return e;
  393. // });
  394. // this.getDoctor();
  395. this.loadData()
  396. if (data.ext_info.status == 2) {
  397. uni.showModal({
  398. title: '提示',
  399. content: '您的审核未通过: \n ' + data.ext_info.reason + ' \n 是否重新提交审核!',
  400. success: function(res) {
  401. if (res.confirm) {
  402. console.log('用户点击确定');
  403. if (data.type == 2) {
  404. uni.navigateTo({
  405. url: '/pages/public/DocRegister'
  406. });
  407. }
  408. if (data.type == 3) {
  409. uni.navigateTo({
  410. url: '/pages/public/MecRegister'
  411. });
  412. }
  413. } else if (res.cancel) {
  414. console.log('用户点击取消');
  415. }
  416. }
  417. });
  418. }
  419. // 1是病人 2是医生 3是机构
  420. if (obj.userInfo.type == 2) {
  421. uni.setTabBarItem({
  422. index: 0,
  423. text: '首页',
  424. iconPath: 'static/tabBar/tab-home.png',
  425. selectedIconPath: 'static/tabBar/tab-home-current.png'
  426. });
  427. uni.setTabBarItem({
  428. index: 1,
  429. text: '我的病人',
  430. iconPath: 'static/tabBar/tab-cate.png',
  431. selectedIconPath: 'static/tabBar/tab-cate-current.png',
  432. visible: true
  433. });
  434. uni.setTabBarItem({
  435. index: 2,
  436. text: '科普学习',
  437. iconPath: 'static/tabBar/tab-study.png',
  438. selectedIconPath: 'static/tabBar/tab-study-current.png',
  439. visible: false
  440. });
  441. uni.setTabBarItem({
  442. index: 3,
  443. text: '接单',
  444. iconPath: 'static/tabBar/jd.png',
  445. selectedIconPath: 'static/tabBar/jd-act.png',
  446. pagePath: '/pages/dd/dd'
  447. })
  448. uni.setTabBarItem({
  449. index: 4,
  450. text: '我的',
  451. iconPath: 'static/tabBar/tab-my.png',
  452. selectedIconPath: 'static/tabBar/tab-my-current.png'
  453. });
  454. }
  455. if (obj.userInfo.type == 1) {
  456. uni.setTabBarItem({
  457. index: 0,
  458. text: '首页',
  459. iconPath: 'static/tabBar/tab-home.png',
  460. selectedIconPath: 'static/tabBar/tab-home-current.png'
  461. });
  462. uni.setTabBarItem({
  463. index: 1,
  464. text: '咨询记录',
  465. iconPath: 'static/tabBar/tab-cate.png',
  466. selectedIconPath: 'static/tabBar/tab-cate-current.png'
  467. });
  468. uni.setTabBarItem({
  469. index: 2,
  470. text: '科普学习',
  471. iconPath: 'static/tabBar/tab-study.png',
  472. selectedIconPath: 'static/tabBar/tab-study-current.png',
  473. visible: true
  474. });
  475. uni.setTabBarItem({
  476. index: 3,
  477. text: '发布订单',
  478. iconPath: 'static/tabBar/jd.png',
  479. selectedIconPath: 'static/tabBar/jd-act.png',
  480. pagePath: '/pages/dd/dd',
  481. visible: false
  482. })
  483. uni.setTabBarItem({
  484. index: 4,
  485. text: '我的',
  486. iconPath: 'static/tabBar/tab-my.png',
  487. selectedIconPath: 'static/tabBar/tab-my-current.png'
  488. });
  489. }
  490. if (obj.userInfo.type == 3) {
  491. uni.setTabBarItem({
  492. index: 0,
  493. text: '首页',
  494. iconPath: 'static/tabBar/tab-home.png',
  495. selectedIconPath: 'static/tabBar/tab-home-current.png'
  496. });
  497. uni.setTabBarItem({
  498. index: 1,
  499. text: '咨询记录',
  500. iconPath: 'static/tabBar/tab-cate.png',
  501. selectedIconPath: 'static/tabBar/tab-cate-current.png'
  502. });
  503. uni.setTabBarItem({
  504. index: 2,
  505. text: '科普学习',
  506. iconPath: 'static/tabBar/tab-study.png',
  507. selectedIconPath: 'static/tabBar/tab-study-current.png',
  508. visible: false
  509. });
  510. uni.setTabBarItem({
  511. index: 3,
  512. text: '发布订单',
  513. iconPath: 'static/tabBar/jd.png',
  514. selectedIconPath: 'static/tabBar/jd-act.png',
  515. pagePath: '/pages/dd/dd'
  516. })
  517. uni.setTabBarItem({
  518. index: 4,
  519. text: '我的',
  520. iconPath: 'static/tabBar/tab-my.png',
  521. selectedIconPath: 'static/tabBar/tab-my-current.png'
  522. });
  523. }
  524. if (obj.userInfo.type == 2 && obj.userInfo.ext_info.price == '0.00') {
  525. uni.showModal({
  526. title: '提示',
  527. content: '您的用户信息尚未完善,是否前去完善?',
  528. success: function(res) {
  529. if (res.confirm) {
  530. console.log('用户点击确定');
  531. uni.navigateTo({
  532. url: '/pages/userinfo/doctor'
  533. });
  534. } else if (res.cancel) {
  535. console.log('用户点击取消');
  536. }
  537. }
  538. });
  539. }
  540. })
  541. .catch(e => {
  542. if (e.message == '请登录') {
  543. uni.showModal({
  544. title: '提示',
  545. content: '您未登录,是否登录?',
  546. success: function(res) {
  547. if (res.confirm) {
  548. uni.navigateTo({
  549. url: '/pages/public/wxLogin'
  550. });
  551. } else if (res.cancel) {
  552. console.log('用户点击取消');
  553. }
  554. }
  555. });
  556. } else {
  557. console.log(e.message);
  558. }
  559. });
  560. },
  561. }
  562. }
  563. </script>
  564. <style lang="scss" scoped>
  565. .navbar {
  566. display: flex;
  567. height: 40px;
  568. padding: 0 5px;
  569. background: #fff;
  570. box-shadow: 0 2px 2px rgba(0, 0, 0, 0.06);
  571. position: relative;
  572. z-index: 10;
  573. .nav-item {
  574. flex: 1;
  575. display: flex;
  576. justify-content: center;
  577. align-items: center;
  578. height: 100%;
  579. font-size: 15px;
  580. color: $font-color-dark;
  581. position: relative;
  582. &.current {
  583. color: $base-color;
  584. &:after {
  585. content: '';
  586. position: absolute;
  587. left: 50%;
  588. bottom: 0;
  589. transform: translateX(-50%);
  590. width: 44px;
  591. height: 0;
  592. border-bottom: 2px solid $base-color;
  593. }
  594. }
  595. }
  596. }
  597. .scoll-box {
  598. padding-top: 20rpx;
  599. }
  600. .fbx-scoll {
  601. padding-bottom: 145rpx;
  602. }
  603. .fb-btn {
  604. width: 750rpx;
  605. position: fixed;
  606. bottom: 0rpx;
  607. left: 0;
  608. height: 145rpx;
  609. padding-top: 30rpx;
  610. z-index: 9;
  611. .new-btn {
  612. width: 560rpx;
  613. line-height: 80rpx;
  614. background: #6786fb;
  615. box-shadow: 0px 0px 13rpx 3rpx rgba(209, 212, 217, 0.31);
  616. border-radius: 40rpx;
  617. margin: auto;
  618. text-align: center;
  619. font-size: 30rpx;
  620. font-weight: 500;
  621. color: #FFFFFF;
  622. }
  623. }
  624. .dd-wrap {
  625. width: 702rpx;
  626. // height: 524px;
  627. background: #FFFFFF;
  628. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  629. border-radius: 20rpx;
  630. margin: 0 auto 20rpx;
  631. .dd-top {
  632. font-size: 32rpx;
  633. font-weight: 500;
  634. color: #333333;
  635. padding: 24rpx;
  636. image {
  637. width: 30rpx;
  638. height: 35rpx;
  639. margin-right: 13rpx;
  640. }
  641. .dd-time {
  642. flex-grow: 1;
  643. text-align: right;
  644. font-size: 25rpx;
  645. font-weight: 500;
  646. color: #999999;
  647. }
  648. }
  649. .dd-info {
  650. font-size: 28rpx;
  651. font-weight: 500;
  652. color: #333333;
  653. padding: 0 24rpx 20rpx;
  654. .fs {
  655. justify-content: flex-start;
  656. align-items: flex-start;
  657. padding: 5rpx 0;
  658. }
  659. .info-name {
  660. flex-shrink: 0;
  661. }
  662. .info-val {
  663. padding-left: 10rpx;
  664. }
  665. }
  666. .jd-info {
  667. font-size: 28rpx;
  668. font-weight: 500;
  669. color: #333333;
  670. padding: 24rpx 4rpx;
  671. border-top: dashed 1rpx #EAECED;
  672. margin: auto;
  673. width: 662rpx;
  674. }
  675. .jd-btn {
  676. height: 111rpx;
  677. padding-top: 26rpx;
  678. border-top: dashed 1rpx #EAECED;
  679. margin: auto;
  680. width: 662rpx;
  681. .btn {
  682. width: 186rpx;
  683. line-height: 59rpx;
  684. background: #6499FA;
  685. border-radius: 30rpx;
  686. text-align: center;
  687. font-size: 29rpx;
  688. font-weight: 500;
  689. color: #FFFFFF;
  690. margin: auto 18rpx auto auto;
  691. }
  692. }
  693. }
  694. </style>