patient1.vue 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339
  1. <template>
  2. <view class="content">
  3. <view class="type-item">
  4. <view class="item-title" v-if="userInfo.type == 1">咨询预约</view>
  5. <view class="item-title" v-if="userInfo.type == 2">我的病人</view>
  6. <view class="item-title" v-if="userInfo.type == 3">预约管理</view>
  7. <!-- <view class="record" v-if="userInfo.type == 3" @click="ToMyorder">预约记录</view> -->
  8. <view class="navbar flex">
  9. <view v-for="(item, index) in navList" :key="index" class="nav-item"
  10. :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
  11. </view>
  12. <swiper :current="tabCurrentIndex" class="swiper-box" duration="300" @change="changeTab">
  13. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  14. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
  15. <!-- 空白页 -->
  16. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
  17. <!-- 订单列表 -->
  18. <view v-for="(item, index) in tabItem.orderList" :key="index" class="order-item">
  19. <view class="i-top flex_item">
  20. <image src="/static/img/img021.png"></image>
  21. <view class="time">
  22. 发起时间:
  23. <text>{{ item.add_time }}</text>
  24. </view>
  25. <view v-if="userInfo.type == 1 || userInfo.type == 3">
  26. <view class="state" v-if="item.refund == 0">
  27. {{
  28. item.status == 0
  29. ? '未支付'
  30. : item.status == 1
  31. ? '已支付'
  32. : item.status == 2
  33. ? '已预约'
  34. : item.status == 3
  35. ? '待确认'
  36. : item.status == 4
  37. ? '已确认'
  38. : item.status == 5
  39. ? '已完成'
  40. : '已评价'
  41. }}
  42. </view>
  43. <view class="state" v-if="item.refund != 0">
  44. {{ item.refund == 1 ? '退款中' : item.status == 2 ? '退款完成' : '退款失败' }}
  45. </view>
  46. </view>
  47. <view v-if="userInfo.type == 2">
  48. <view class="state" v-if="item.refund == 0">
  49. {{
  50. item.status == 0
  51. ? '未支付'
  52. : item.status == 1
  53. ? '已支付'
  54. : item.status == 2
  55. ? '已预约'
  56. : item.status == 3
  57. ? '已确认'
  58. : item.status == 4
  59. ? '待确认'
  60. : item.status == 5
  61. ? '已完成'
  62. : '已评价'
  63. }}
  64. </view>
  65. <view class="state" v-if="item.refund != 0">
  66. {{ item.refund == 1 ? '退款中' : item.status == 2 ? '退款完成' : '退款失败' }}
  67. </view>
  68. </view>
  69. </view>
  70. <view class="goods-box-single flex_item" @click="ToChat(item)">
  71. <view class="img-box">
  72. <view v-if="item.status == 1 || item.status == 2">
  73. <view class="corner" v-if="item.no_read > 0 && item.refund == 0">
  74. <text>{{ item.no_read }}</text>
  75. </view>
  76. </view>
  77. <image v-if="userInfo.type != 2" class="goods-img"
  78. :src="item.doctor_avatar || '/static/error/missing-face.png'" mode="aspectFill">
  79. </image>
  80. <image v-if="userInfo.type == 2" class="goods-img"
  81. :src="item.patient_avatar || '/static/error/missing-face.png'"
  82. mode="aspectFill"></image>
  83. </view>
  84. <view class="right">
  85. <text class="title clamp" v-if="userInfo.type != 2">
  86. {{ item.doctor_name }}({{
  87. item.doctor_level == 1 ? '初级' : item.doctor_level == 2 ? '中级' : item.doctor_level == 3 ? '副高级' : '正高级'
  88. }})
  89. </text>
  90. <view v-if="userInfo.type == 2">
  91. <text class="title clamp"
  92. v-if="item.type == 1 || item.type == 2">{{ item.patient_name }}</text>
  93. <text class="title clamp" v-if="item.type == 3">{{ item.organ_name }}</text>
  94. </view>
  95. <view class="title clamp font-da">
  96. {{ item.type == 1 ? '咨询' : item.type == 2 ? '预约麻醉' : '多点执业' }}
  97. </view>
  98. <view class="title red" v-if="userInfo.type != 2 && item.refund == 1">
  99. 您申请的退款将在平台审核后,退回您的账户,感谢您使用麻醉服务平台。</view>
  100. </view>
  101. <view class="appointment"
  102. v-if="userInfo.type == 2 && item.refund == 0 && item.status != 0">回复详情</view>
  103. <view class="appointment"
  104. v-if="userInfo.type != 2 && item.refund == 0 && item.status != 0">立即咨询</view>
  105. <!-- 0未支付 1病人已支付 2已预约时间 3医生确认完成 4病人已完成 5已完成 6已评价 -->
  106. </view>
  107. <view class="action-box b-t" v-if="userInfo.type != 2">
  108. <view class="action-btn" v-if="item.status == 0" @click="ConfirmPay(item)">去支付</view>
  109. <view class="action-btn" v-if="item.status == 0" @click="Cancel(item.order_id)">取消订单
  110. </view>
  111. <view class="action-btn"
  112. v-if="(item.refund == 0 && item.status == 2) || item.status == 3"
  113. @click="Completion(item.order_id)">确认完成</view>
  114. <view class="action-btn" v-if="item.status == 4 || item.status == 5"
  115. @click="ToEvaluate(item.order_id)">去评价</view>
  116. <view class="action-btn"
  117. v-if="item.status == 4 || item.status == 5 || item.status == 6 || item.status == 7"
  118. @click="open(item.order_id)">
  119. 打赏医生
  120. </view>
  121. <view class="action-btn" v-if="item.refund == 0 && item.status == 2"
  122. @click="open1(item)">退款</view>
  123. <!-- <view class="action-btn" v-if="item.refund == 1" @click="cancel(item.order_id)">取消退款</view> -->
  124. <view class="action-btn"
  125. v-if="item.status == 4 || item.status == 5 || item.status == 6 || item.status == 7"
  126. @click="ToZixu(item)">再次咨询</view>
  127. <!-- <view class="action-btn" v-if="item.status == 6" @click="del(item)">删除订单</view> -->
  128. </view>
  129. <view class="action-box b-t" v-if="userInfo.type == 2">
  130. <view class="action-btn"
  131. v-if="(item.refund == 0 && item.status == 2) || item.status == 4 || item.status == 7"
  132. @click="Completion(item.order_id)">
  133. 确认完成
  134. </view>
  135. <view class="action-btn" v-if="item.refund == 0 && item.status == 2"
  136. @click="open1(item)">退款</view>
  137. </view>
  138. </view>
  139. <uni-load-more :status="tabItem.loadingType"></uni-load-more>
  140. </scroll-view>
  141. </swiper-item>
  142. </swiper>
  143. </view>
  144. <!-- 申请退款弹窗 -->
  145. <uni-popup ref="popup1" type="center">
  146. <view class="popup">
  147. <view class="row">
  148. <view class="row-1">申请退款</view>
  149. <input class="row-2" type="text" v-model="reason" placeholder="请输入退款理由" />
  150. <button class="row-3 flex" @click="refund">申请退款</button>
  151. </view>
  152. </view>
  153. <view class="close_icon" @click="close1">
  154. <image src="../../static/img/img016.png"></image>
  155. </view>
  156. </uni-popup>
  157. <!-- 打赏金额弹出层 -->
  158. <uni-popup ref="popup" type="center">
  159. <view class="popup">
  160. <!-- <image class="img" mode="widthFix" src="../../static/img/img022.png"></image> -->
  161. <view class="row">
  162. <view class="row-1">打赏金额</view>
  163. <input class="row-2" type="number" v-model="money" placeholder="请输入打赏金额" />
  164. <button class="row-3 flex" @click="Reward">立即打赏</button>
  165. </view>
  166. </view>
  167. <view class="close_icon" @click="close">
  168. <image src="../../static/img/img016.png"></image>
  169. </view>
  170. </uni-popup>
  171. <!-- 支付弹窗 -->
  172. <uni-popup ref="popup2" style="z-index: 999;" type="bottom">
  173. <view class="payment">
  174. <view class="first flex " @click="payclose()">
  175. <text class="word">选择支付方式</text>
  176. <image src="../../static/img/img25.png"></image>
  177. </view>
  178. <view class="pay-type-list">
  179. <view class="type-item b-b" @click="changePayType(1)">
  180. <view class="img">
  181. <image class="yue" src="../../static/img/img26.png"></image>
  182. </view>
  183. <view class="con"><text class="tit">微信支付</text></view>
  184. <label class="radio">
  185. <radio value="" color="#FC4141" :checked="payType == 1"></radio>
  186. </label>
  187. </view>
  188. <view class="type-item flex_item" @click="changePayType(2)">
  189. <view class="img">
  190. <image class="yue" src="../../static/img/img017.png"></image>
  191. </view>
  192. <view class="con"><text class="tit">余额支付</text></view>
  193. <label class="radio">
  194. <radio value="" color="#FC4141" :checked="payType == 2"></radio>
  195. </label>
  196. </view>
  197. </view>
  198. <view class="one"></view>
  199. <view class="Third flex">
  200. <view class="two1">
  201. <text class="two1-1 ">合计:</text>
  202. <text class="two1-2">¥</text>
  203. <text class="two1-2 size">{{ money }}</text>
  204. </view>
  205. <view class="two2" :class="{ clickbg: payLoding }" @click.stop="!payLoding ? confirm() : ''">
  206. <text>立即支付</text>
  207. </view>
  208. </view>
  209. </view>
  210. </uni-popup>
  211. </view>
  212. </template>
  213. <script>
  214. import {
  215. mapState,
  216. mapMutations
  217. } from 'vuex';
  218. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  219. import DatetimePicker from '@/components/datetime-picker/datetime-picker.vue';
  220. import empty from '@/components/empty';
  221. import {
  222. getTime
  223. } from '@/utils/rocessor.js';
  224. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  225. import {
  226. orderList,
  227. go_pay,
  228. cancel,
  229. setTime,
  230. patientFinish,
  231. doctorFinish,
  232. refund,
  233. cancelRefund,
  234. reward
  235. } from '@/api/patient.js';
  236. // #ifdef H5
  237. import weixinObj from '@/libs/jweixin-module/index.js';
  238. import {
  239. weixindata
  240. } from '@/utils/wxAuthorized';
  241. // #endif
  242. export default {
  243. components: {
  244. uniLoadMore,
  245. empty,
  246. uniPopup,
  247. DatetimePicker
  248. },
  249. data() {
  250. return {
  251. tabCurrentIndex: 0,
  252. time: '', //预定时间
  253. rewardId: '', //打赏的订单id
  254. refundId: '', //申请退款的id
  255. money: '', //打赏金额
  256. reason: '', //退款理由
  257. payType: 1, //支付类型
  258. payLoding: false, //判断是否支付中
  259. // #ifdef H5
  260. froms: '', //当前是否为微信浏览器
  261. // #endif
  262. type: '', //判断是否从订单中进入
  263. navList: [{
  264. state: 0,
  265. text: '全部',
  266. loadingType: 'more',
  267. orderList: [],
  268. page: 1, //当前页数
  269. limit: 10 //每次信息条数
  270. },
  271. {
  272. state: 1,
  273. text: '进行中 ',
  274. loadingType: 'more',
  275. orderList: [],
  276. page: 1, //当前页数
  277. limit: 10 //每次信息条数
  278. },
  279. {
  280. state: 2,
  281. text: '待评价',
  282. loadingType: 'more',
  283. orderList: [],
  284. page: 1, //当前页数
  285. limit: 10 //每次信息条数
  286. }
  287. ]
  288. };
  289. },
  290. computed: {
  291. ...mapState(['userInfo'])
  292. },
  293. onShow() {
  294. console.log(this.userInfo, 'patient');
  295. // this.tabCurrentIndex = 0;
  296. this.loadData('Refresh');
  297. // 1是病人 2是医生 3是机构
  298. if (this.userInfo.type == 2) {
  299. uni.setTabBarItem({
  300. index: 0,
  301. text: '首页',
  302. iconPath: 'static/tabBar/tab-home.png',
  303. selectedIconPath: 'static/tabBar/tab-home-current.png'
  304. });
  305. uni.setTabBarItem({
  306. index: 1,
  307. text: '我的病人',
  308. iconPath: 'static/tabBar/tab-cate.png',
  309. selectedIconPath: 'static/tabBar/tab-cate-current.png',
  310. visible: true
  311. });
  312. uni.setTabBarItem({
  313. index: 2,
  314. text: '科普学习',
  315. iconPath: 'static/tabBar/tab-study.png',
  316. selectedIconPath: 'static/tabBar/tab-study-current.png',
  317. visible: false
  318. });
  319. uni.setTabBarItem({
  320. index: 3,
  321. text: '接单',
  322. iconPath: 'static/tabBar/jd.png',
  323. selectedIconPath: 'static/tabBar/jd-act.png',
  324. pagePath: '/pages/dd/dd'
  325. })
  326. uni.setTabBarItem({
  327. index: 4,
  328. text: '我的',
  329. iconPath: 'static/tabBar/tab-my.png',
  330. selectedIconPath: 'static/tabBar/tab-my-current.png'
  331. });
  332. }
  333. if (this.userInfo.type == 1) {
  334. uni.setTabBarItem({
  335. index: 0,
  336. text: '首页',
  337. iconPath: 'static/tabBar/tab-home.png',
  338. selectedIconPath: 'static/tabBar/tab-home-current.png'
  339. });
  340. uni.setTabBarItem({
  341. index: 1,
  342. text: '咨询记录',
  343. iconPath: 'static/tabBar/tab-cate.png',
  344. selectedIconPath: 'static/tabBar/tab-cate-current.png',
  345. visible: true
  346. });
  347. uni.setTabBarItem({
  348. index: 2,
  349. text: '科普学习',
  350. iconPath: 'static/tabBar/tab-study.png',
  351. selectedIconPath: 'static/tabBar/tab-study-current.png',
  352. visible: true
  353. });
  354. uni.setTabBarItem({
  355. index: 3,
  356. text: '接单',
  357. iconPath: 'static/tabBar/jd.png',
  358. selectedIconPath: 'static/tabBar/jd-act.png',
  359. visible: false
  360. })
  361. uni.setTabBarItem({
  362. index: 4,
  363. text: '我的',
  364. iconPath: 'static/tabBar/tab-my.png',
  365. selectedIconPath: 'static/tabBar/tab-my-current.png.png'
  366. });
  367. }
  368. if (this.userInfo.type == 3) {
  369. uni.setTabBarItem({
  370. index: 0,
  371. text: '首页',
  372. iconPath: 'static/tabBar/tab-home.png',
  373. selectedIconPath: 'static/tabBar/tab-home-current.png'
  374. });
  375. uni.setTabBarItem({
  376. index: 1,
  377. text: '咨询记录',
  378. iconPath: 'static/tabBar/tab-cate.png',
  379. selectedIconPath: 'static/tabBar/tab-cate-current.png'
  380. });
  381. uni.setTabBarItem({
  382. index: 2,
  383. text: '科普学习',
  384. iconPath: 'static/tabBar/tab-study.png',
  385. selectedIconPath: 'static/tabBar/tab-study-current.png',
  386. visible: false
  387. });
  388. uni.setTabBarItem({
  389. index: 3,
  390. text: '发布订单',
  391. iconPath: 'static/tabBar/jd.png',
  392. selectedIconPath: 'static/tabBar/jd-act.png',
  393. pagePath: '/pages/dd/dd'
  394. })
  395. uni.setTabBarItem({
  396. index: 4,
  397. text: '我的',
  398. iconPath: 'static/tabBar/tab-my.png',
  399. selectedIconPath: 'static/tabBar/tab-my-current.png'
  400. });
  401. }
  402. },
  403. //下拉刷新
  404. onPullDownRefresh() {
  405. let obj = this;
  406. //监听下拉刷新动作的执行方法,每次手动下拉刷新都会执行一次
  407. obj.loadData('Refresh');
  408. // setTimeout(function() {
  409. // obj.loadData("Refresh");
  410. // uni.stopPullDownRefresh(); //停止下拉刷新动画
  411. // }, 1000);
  412. },
  413. methods: {
  414. //修改当前选中的时间下标
  415. // changeTimeIndex(index) {
  416. // this.actionItem = index;
  417. // console.log(this.actionItem,'actionItem')
  418. // },
  419. /**
  420. * 选择日期时间
  421. * @param {Object} date 日期数据
  422. */
  423. //选择时间
  424. // changeDatetimePicker(date) {
  425. // console.log(2222,date.fmt3)
  426. // this.navList[this.tabCurrentIndex].orderList[this.actionItem].time = date.fmt3;
  427. // console.log(this.navList[this.tabCurrentIndex].orderList)
  428. // },
  429. //获取订单列表
  430. loadData(source) {
  431. //这里是将订单挂载到tab列表下
  432. let index = this.tabCurrentIndex;
  433. let navItem = this.navList[index];
  434. let state = navItem.state;
  435. if (source === 'Refresh') {
  436. // 刷新数据
  437. navItem.page = 1;
  438. navItem.loadingType = 'more';
  439. navItem.orderList = [];
  440. }
  441. if (navItem.loadingType === 'loading') {
  442. //防止重复加载
  443. return;
  444. }
  445. if (navItem.loadingType === 'noMore') {
  446. //防止重复加载
  447. return;
  448. }
  449. // 修改当前对象状态为加载中
  450. navItem.loadingType = 'loading';
  451. orderList({
  452. state: state,
  453. keyword: '',
  454. page: navItem.page,
  455. limit: navItem.limit
  456. })
  457. .then(({
  458. data
  459. }) => {
  460. let arr = data.list.map(e => {
  461. e.add_time = getTime(e.add_time);
  462. return e;
  463. });
  464. navItem.orderList = navItem.orderList.concat(arr);
  465. navItem.page++;
  466. if (source == 'Refresh') {
  467. uni.stopPullDownRefresh(); //停止下拉刷新动画
  468. }
  469. if (navItem.limit == arr.length) {
  470. //判断是否还有数据, 有改为 more, 没有改为noMore
  471. navItem.loadingType = 'more';
  472. return;
  473. } else {
  474. //判断是否还有数据, 有改为 more, 没有改为noMore
  475. navItem.loadingType = 'noMore';
  476. }
  477. this.$set(navItem, 'loaded', true);
  478. })
  479. .catch(e => {
  480. console.log(e);
  481. });
  482. },
  483. ConfirmPay(item) {
  484. let obj = this;
  485. uni.showModal({
  486. title: '提示',
  487. content: '确定支付' + item.pay_price + '吗?',
  488. success: function(res) {
  489. if (res.confirm) {
  490. go_pay({
  491. order_id: item.order_id
  492. })
  493. .then(({
  494. data
  495. }) => {
  496. console.log(item, data);
  497. if (item.pay_type == 2) {
  498. obj.payLoding = false;
  499. obj.$api.msg(msg);
  500. obj.loadData('Refresh');
  501. } else {
  502. obj.orderMoneyPay(data);
  503. }
  504. })
  505. .catch(e => {
  506. obj.payLoding = false;
  507. console.log(e.message);
  508. });
  509. } else if (res.cancel) {
  510. obj.payLoding = false;
  511. obj.$api.msg('取消支付');
  512. }
  513. }
  514. });
  515. },
  516. // 微信支付金额
  517. orderMoneyPay(data) {
  518. let obj = this;
  519. let config = data.jsConfig;
  520. weixindata().then(e => {
  521. weixinObj
  522. .chooseWXPay({
  523. timestamp: config.timestamp,
  524. nonceStr: config.nonceStr,
  525. package: config.package,
  526. signType: config.signType,
  527. paySign: config.paySign,
  528. success: function(res) {
  529. console.log(res);
  530. obj.$api.msg(res);
  531. obj.payLoding = false;
  532. },
  533. fail: function(res) {
  534. obj.payLoding = false;
  535. console.log(res, '失败');
  536. console.log(res.errMsg);
  537. }
  538. })
  539. .catch(e => {
  540. obj.payLoding = false;
  541. console.log(e.message);
  542. });
  543. });
  544. },
  545. //再次咨询
  546. ToZixu(item) {
  547. console.log(item);
  548. uni.navigateTo({
  549. url: '/pages/doctor/expert?id=' + item.doctor_id
  550. });
  551. },
  552. //取消订单
  553. Cancel(item) {
  554. let obj = this;
  555. cancel({
  556. order_id: item
  557. })
  558. .then(({
  559. data
  560. }) => {
  561. obj.$api.msg(data.msg);
  562. obj.loadData('Refresh');
  563. })
  564. .catch(e => {
  565. console.log(e.message);
  566. });
  567. },
  568. //确认订单完成
  569. Completion(item) {
  570. let obj = this;
  571. //病人和机构确认完成订单
  572. if (obj.userInfo.type == 1 || obj.userInfo.type == 3) {
  573. patientFinish({
  574. order_id: item
  575. })
  576. .then(data => {
  577. obj.$api.msg(data.msg);
  578. obj.loadData('Refresh');
  579. })
  580. .catch(e => {
  581. console.log(e.message);
  582. });
  583. }
  584. //医生确认完成订单
  585. if (obj.userInfo.type == 2) {
  586. doctorFinish({
  587. order_id: item
  588. })
  589. .then(data => {
  590. obj.$api.msg(data.msg);
  591. obj.loadData('Refresh');
  592. })
  593. .catch(e => {
  594. console.log(e.message);
  595. });
  596. }
  597. },
  598. //选中预约时间
  599. Appointment(item) {
  600. let obj = this;
  601. setTime({
  602. order_id: item.order_id,
  603. time: item.time
  604. })
  605. .then(data => {
  606. obj.$api.msg(data.msg);
  607. obj.loadData('Refresh');
  608. })
  609. .catch(e => {
  610. console.log(e.message);
  611. });
  612. },
  613. //判断时间是否过期
  614. // judgeTime(time) {
  615. // console.log(time, 'time');
  616. // let strtime = time.replace('/-/g', '/'); //时间转换
  617. // console.log(strtime, 'strtime');
  618. // //选择时间
  619. // let date1 = new Date(strtime);
  620. // console.log(date1, 'date1');
  621. // //现在时间
  622. // let date2 = new Date();
  623. // console.log(date2, 'date2');
  624. // //判断时间是否过期
  625. // if (date1 < date2) {
  626. // this.timeOut = false;
  627. // } else {
  628. // this.timeOut = true;
  629. // }
  630. // console.log(this.timeOut);
  631. // },
  632. //评价
  633. ToEvaluate(item) {
  634. uni.navigateTo({
  635. url: '/pages/patient/evaluate?id=' + item
  636. });
  637. },
  638. //申请退款
  639. refund() {
  640. let obj = this;
  641. if (obj.reason == '') {
  642. obj.$api.msg('请输入退款路由');
  643. return;
  644. }
  645. refund({
  646. reason: obj.reason,
  647. order_id: obj.refundId
  648. })
  649. .then(data => {
  650. obj.$api.msg(data.msg);
  651. obj.loadData('Refresh');
  652. obj.close1();
  653. })
  654. .catch(e => {
  655. obj.close1();
  656. obj.loadData('Refresh');
  657. console.log(e.message);
  658. });
  659. },
  660. //取消退款
  661. cancel(item) {
  662. let obj = this;
  663. uni.showModal({
  664. title: '提示',
  665. content: '确定要取消退款?',
  666. success: function(res) {
  667. if (res.confirm) {
  668. cancelRefund({
  669. order_id: item
  670. })
  671. .then(data => {
  672. obj.$api.msg(data.msg);
  673. obj.loadData('Refresh');
  674. })
  675. .catch(e => {
  676. obj.loadData('Refresh');
  677. console.log(e.message);
  678. });
  679. } else if (res.cancel) {
  680. obj.$api.msg('');
  681. }
  682. }
  683. });
  684. },
  685. //跳转咨询界面
  686. ToChat(item) {
  687. if (item.refund == 0) {
  688. //病人
  689. if (this.userInfo.type == 1) {
  690. uni.navigateTo({
  691. url: '/pages/doctor/chat?id=' + item.order_id + '&name=' + item.doctor_name + '&uid=' +
  692. item.doctor_id
  693. });
  694. }
  695. //医生
  696. if (this.userInfo.type == 2) {
  697. if (item.type == 1 || item.type == 2) {
  698. uni.navigateTo({
  699. url: '/pages/doctor/chat?id=' + item.order_id + '&name=' + item.patient_name +
  700. '&uid=' + item.patient_id
  701. });
  702. }
  703. if (item.type == 3) {
  704. uni.navigateTo({
  705. url: '/pages/doctor/chat?id=' + item.order_id + '&name=' + item.organ_name +
  706. '&uid=' + item.patient_id
  707. });
  708. }
  709. }
  710. //机构
  711. if (this.userInfo.type == 3) {
  712. uni.navigateTo({
  713. url: '/pages/doctor/chat?id=' + item.order_id + '&name=' + item.doctor_name + '&uid=' +
  714. item.doctor_id
  715. });
  716. }
  717. }
  718. },
  719. //打开打赏弹窗
  720. open(item) {
  721. this.rewardId = item;
  722. this.$refs.popup.open();
  723. },
  724. //关闭打赏弹窗
  725. close() {
  726. this.$refs.popup.close();
  727. },
  728. //立即打赏
  729. Reward() {
  730. if (this.money == '') {
  731. this.$api.msg('请输入打赏金额');
  732. return;
  733. }
  734. this.$refs.popup.close();
  735. this.payopen();
  736. },
  737. //打开支付弹窗
  738. payopen() {
  739. this.$refs.popup2.onTap();
  740. this.$refs.popup2.open();
  741. },
  742. //关闭支付弹窗
  743. payclose() {
  744. this.$refs.popup2.close();
  745. },
  746. //选择支付方式
  747. changePayType(type) {
  748. this.payType = type;
  749. },
  750. //确认支付
  751. confirm: async function() {
  752. let obj = this;
  753. // 支付中
  754. obj.payLoding = true;
  755. // #ifdef H5
  756. // 获取当前是否为微信浏览器
  757. obj.froms = uni.getStorageSync('weichatBrowser') || '';
  758. // #endif
  759. obj.CreateOrder();
  760. },
  761. //订单创建
  762. CreateOrder() {
  763. let obj = this;
  764. // 生成订单
  765. reward({
  766. order_id: obj.rewardId, //
  767. money: obj.money, //医生类型 1 普通预约 2 私人医生
  768. pay_type: obj.payType //支付类型 1是微信 2是余额
  769. })
  770. .then(data => {
  771. // 判断是否为余额支付
  772. if (obj.payType == 2) {
  773. if (data.code == 200) {
  774. if (data.msg == '余额支付成功') {
  775. obj.$api.msg('打赏成功');
  776. }
  777. obj.payclose();
  778. obj.loadData('Refresh');
  779. obj.payLoding = false;
  780. } else {
  781. obj.payclose();
  782. obj.payLoding = false;
  783. obj.$api.msg(msg);
  784. }
  785. }
  786. if (obj.payType == 1) {
  787. console.log('orderMoneyPay', data);
  788. let item = data.data;
  789. // 立即支付
  790. obj.orderMoneyPay(item);
  791. }
  792. })
  793. .catch(e => {
  794. // 支付完成
  795. console.log(e.message);
  796. obj.payclose();
  797. obj.payLoding = false;
  798. if (e.message == '该订单已支付!') {
  799. // obj.paySuccessTo();
  800. }
  801. });
  802. },
  803. //打开退款弹窗
  804. open1(item) {
  805. this.refundId = item.order_id;
  806. this.$refs.popup1.open();
  807. },
  808. //关闭退款弹窗
  809. close1() {
  810. this.$refs.popup1.close();
  811. },
  812. //预约记录
  813. ToMyorder() {
  814. uni.navigateTo({
  815. url: '/pages/order/myorder'
  816. });
  817. },
  818. //swiper 切换
  819. changeTab(e) {
  820. this.tabCurrentIndex = e.target.current;
  821. this.loadData('tabChange');
  822. },
  823. //顶部tab点击
  824. tabClick(index) {
  825. this.tabCurrentIndex = index;
  826. // 初始化数据列表
  827. this.navList[index].orderList = [];
  828. // 初始化翻页数
  829. this.navList[index].page = 1;
  830. // 初始化数据为未加载状态
  831. this.navList[index].loadingType = 'more';
  832. }
  833. }
  834. };
  835. </script>
  836. <style lang="scss">
  837. page,
  838. .content {
  839. background: $page-color-base;
  840. height: 100%;
  841. .type-item {
  842. height: 100%;
  843. position: relative;
  844. .item-title {
  845. font-weight: bold;
  846. background: #ffffff;
  847. font-size: 36rpx;
  848. color: #333333;
  849. text-align: center;
  850. height: 100rpx;
  851. line-height: 100rpx;
  852. border-bottom: 2rpx solid #eeeeee;
  853. }
  854. .record {
  855. position: absolute;
  856. top: 25rpx;
  857. right: 25rpx;
  858. color: #6786fb;
  859. font-size: 30rpx;
  860. }
  861. }
  862. }
  863. .swiper-box {
  864. height: calc(100% - 80px);
  865. }
  866. .list-scroll-content {
  867. height: 100%;
  868. }
  869. .navbar {
  870. display: flex;
  871. height: 40px;
  872. padding: 0 5px;
  873. background: #fff;
  874. box-shadow: 0 2px 2px rgba(0, 0, 0, 0.06);
  875. position: relative;
  876. z-index: 10;
  877. .nav-item {
  878. flex: 1;
  879. display: flex;
  880. justify-content: center;
  881. align-items: center;
  882. height: 100%;
  883. font-size: 15px;
  884. color: $font-color-dark;
  885. position: relative;
  886. &.current {
  887. color: $base-color;
  888. &:after {
  889. content: '';
  890. position: absolute;
  891. left: 50%;
  892. bottom: 0;
  893. transform: translateX(-50%);
  894. width: 44px;
  895. height: 0;
  896. border-bottom: 2px solid $base-color;
  897. }
  898. }
  899. }
  900. }
  901. .uni-swiper-item {
  902. height: auto;
  903. }
  904. .order-item {
  905. display: flex;
  906. flex-direction: column;
  907. padding-left: 30rpx;
  908. background: #fff;
  909. padding: 28rpx 28rpx;
  910. margin-bottom: 25rpx;
  911. border-radius: 15rpx;
  912. .i-top {
  913. display: flex;
  914. align-items: center;
  915. font-size: 30rpx;
  916. color: #6786fb;
  917. position: relative;
  918. image {
  919. width: 34rpx;
  920. height: 32rpx;
  921. margin-right: 15rpx;
  922. }
  923. .time {
  924. width: 75%;
  925. text {
  926. color: #666666;
  927. }
  928. }
  929. .del-btn {
  930. padding: 10rpx 0 10rpx 36rpx;
  931. font-size: $font-lg;
  932. color: $font-color-light;
  933. position: relative;
  934. &:after {
  935. content: '';
  936. width: 0;
  937. height: 30rpx;
  938. border-left: 1px solid $border-color-dark;
  939. position: absolute;
  940. left: 20rpx;
  941. top: 50%;
  942. transform: translateY(-50%);
  943. }
  944. }
  945. }
  946. .goods-box-single {
  947. padding: 50rpx 0;
  948. .img-box {
  949. position: relative;
  950. .goods-img {
  951. display: block;
  952. width: 140rpx;
  953. height: 140rpx;
  954. border-radius: 25rpx;
  955. }
  956. .corner {
  957. position: absolute;
  958. z-index: 999;
  959. }
  960. }
  961. .right {
  962. flex: 1;
  963. display: flex;
  964. flex-direction: column;
  965. padding: 0 30rpx 0 24rpx;
  966. overflow: hidden;
  967. .title {
  968. font-size: 30rpx;
  969. line-height: 45rpx;
  970. font-weight: 500;
  971. color: $font-color-dark;
  972. line-height: 50rpx;
  973. .price {
  974. color: #fc4141;
  975. }
  976. }
  977. .font-da {
  978. font-size: 35rpx;
  979. font-weight: bold;
  980. }
  981. .red {
  982. color: #fc4141;
  983. }
  984. .attr-box {
  985. font-size: 24rpx;
  986. color: #666666;
  987. .red {
  988. color: #e73932;
  989. }
  990. }
  991. }
  992. .appointment {
  993. font-size: 30rpx;
  994. color: #6786fb;
  995. background: rgba(103, 134, 251, 0.18);
  996. border-radius: 5px;
  997. padding: 15rpx 25rpx;
  998. }
  999. }
  1000. .action-box {
  1001. display: flex;
  1002. justify-content: flex-end;
  1003. align-items: center;
  1004. position: relative;
  1005. padding-top: 28rpx;
  1006. }
  1007. .action-btn {
  1008. width: 160rpx;
  1009. height: 60rpx;
  1010. margin: 0;
  1011. margin-left: 24rpx;
  1012. padding: 0;
  1013. text-align: center;
  1014. line-height: 60rpx;
  1015. font-size: $font-sm + 2rpx;
  1016. color: $font-color-dark;
  1017. background: #fff;
  1018. border-radius: 100px;
  1019. border: 2rpx solid #6786fb;
  1020. color: #6786fb;
  1021. }
  1022. .row {
  1023. display: flex;
  1024. align-items: center;
  1025. font-size: 30upx;
  1026. position: relative;
  1027. }
  1028. }
  1029. //搜索框
  1030. .Search-box {
  1031. overflow: hidden;
  1032. width: 100%;
  1033. padding: 20rpx;
  1034. background-color: #ffffff;
  1035. justify-content: space-around;
  1036. .Search-box {
  1037. width: 89%;
  1038. height: 72rpx;
  1039. border-radius: 36rpx;
  1040. background-color: #f8f6f6;
  1041. justify-content: flex-start;
  1042. padding-left: 54rpx;
  1043. .box-img {
  1044. height: 30rpx;
  1045. width: 30rpx;
  1046. margin-right: 20rpx;
  1047. }
  1048. .box-word {
  1049. font-size: $uni-font-size-base - 2rpx;
  1050. font-weight: 500;
  1051. color: #666666;
  1052. }
  1053. }
  1054. .Search-word {
  1055. width: 11%;
  1056. font-size: $uni-font-size-lg - 2rpx;
  1057. font-weight: 500;
  1058. color: #666666;
  1059. .word {
  1060. float: right;
  1061. }
  1062. }
  1063. }
  1064. .second-part {
  1065. padding: 20rpx;
  1066. .template {
  1067. width: 100%;
  1068. background: #ffffff;
  1069. overflow: hidden;
  1070. padding: 20rpx;
  1071. box-shadow: 0px 5px 5px 0px rgba(35, 24, 21, 0.06);
  1072. margin-bottom: 18rpx;
  1073. border-radius: 12rpx;
  1074. position: relative;
  1075. .left-img {
  1076. width: 140rpx;
  1077. float: left;
  1078. overflow: hidden;
  1079. image {
  1080. width: 140rpx;
  1081. height: 140rpx;
  1082. border-radius: 50%;
  1083. }
  1084. }
  1085. .center-word {
  1086. width: 50%;
  1087. padding-left: 25rpx;
  1088. padding-right: 15rpx;
  1089. .one {
  1090. font-size: $uni-font-size-lg - 2rpx;
  1091. font-weight: 500;
  1092. color: $uni-text-color;
  1093. line-height: 36rpx;
  1094. display: block;
  1095. margin-bottom: 10rpx;
  1096. }
  1097. .two {
  1098. font-size: $uni-font-size-sm;
  1099. font-weight: 500;
  1100. color: #999999;
  1101. line-height: 36rpx;
  1102. display: block;
  1103. }
  1104. }
  1105. .right-label {
  1106. padding: 16rpx;
  1107. border: 1px solid $base-color;
  1108. border-radius: 7rpx;
  1109. font-size: $font-sm - 1rpx;
  1110. font-weight: 500;
  1111. color: $base-color;
  1112. align-items: center;
  1113. image {
  1114. width: 38rpx;
  1115. height: 38rpx;
  1116. margin-right: 8rpx;
  1117. }
  1118. }
  1119. }
  1120. }
  1121. //弹窗
  1122. .popup {
  1123. width: 536rpx;
  1124. .img {
  1125. width: 100%;
  1126. }
  1127. .row {
  1128. background: #ffffff;
  1129. padding: 45rpx 45rpx;
  1130. border-radius: 25rpx;
  1131. .row-1 {
  1132. color: #323333;
  1133. font-size: 36rpx;
  1134. text-align: center;
  1135. width: 100%;
  1136. padding: 30rpx 0rpx;
  1137. padding-bottom: 50rpx !important;
  1138. }
  1139. .row-2 {
  1140. background: #eaeaea;
  1141. padding: 15rpx 25rpx;
  1142. font-size: 26rpx;
  1143. height: 80rpx;
  1144. border-radius: 15rpx;
  1145. }
  1146. .row-3 {
  1147. width: 80%;
  1148. margin: 20rpx auto;
  1149. margin-top: 50rpx;
  1150. background: linear-gradient(0deg, rgba(126, 153, 254, 1), rgba(151, 143, 250, 1));
  1151. border-radius: 34rpx;
  1152. justify-content: center;
  1153. font-size: $uni-font-size-lg + 4rpx;
  1154. font-weight: 500;
  1155. color: #f8f9f9;
  1156. }
  1157. }
  1158. }
  1159. .close_icon {
  1160. width: 52rpx;
  1161. height: 52rpx;
  1162. margin: 88rpx auto 0;
  1163. image {
  1164. width: 100%;
  1165. height: 100%;
  1166. }
  1167. }
  1168. //支付弹窗
  1169. .pay-type-list {
  1170. margin-top: 20upx;
  1171. background-color: #fff;
  1172. padding-left: 40upx;
  1173. .type-item {
  1174. height: 120upx;
  1175. padding: 20upx 0;
  1176. display: flex;
  1177. justify-content: space-between;
  1178. align-items: center;
  1179. padding-right: 60upx;
  1180. font-size: 30upx;
  1181. position: relative;
  1182. }
  1183. .icon {
  1184. width: 100upx;
  1185. font-size: 52upx;
  1186. }
  1187. .img {
  1188. color: #fe8e2e;
  1189. width: 50rpx;
  1190. height: 50rpx;
  1191. image {
  1192. width: 100%;
  1193. height: 100%;
  1194. }
  1195. }
  1196. .tit {
  1197. font-size: $font-lg;
  1198. color: $font-color-dark;
  1199. margin-bottom: 4upx;
  1200. }
  1201. .con {
  1202. flex: 1;
  1203. display: flex;
  1204. flex-direction: column;
  1205. padding-left: 25rpx;
  1206. font-size: $font-sm;
  1207. color: $font-color-light;
  1208. }
  1209. }
  1210. .payment {
  1211. background-color: #ffffff;
  1212. border-radius: 15rpx 15rpx 0rpx 0rpx;
  1213. z-index: 999;
  1214. .first {
  1215. border-bottom: 2rpx solid $border-color-light;
  1216. padding: 38rpx 25rpx;
  1217. .word {
  1218. font-size: $uni-font-size-base;
  1219. font-weight: bold;
  1220. color: $font-color-dark;
  1221. }
  1222. image {
  1223. width: 25rpx;
  1224. height: 25rpx;
  1225. }
  1226. }
  1227. .one {
  1228. height: 20rpx;
  1229. background-color: #f6f6f6;
  1230. }
  1231. .Third {
  1232. .two1 {
  1233. width: 55%;
  1234. background-color: #ffffff;
  1235. padding-left: 25rpx;
  1236. .two1-1 {
  1237. font-size: $uni-font-size-base;
  1238. font-weight: 400;
  1239. color: $font-color-dark;
  1240. }
  1241. .two1-2 {
  1242. font-size: $uni-font-size-sm;
  1243. font-weight: bold;
  1244. color: $color-red1;
  1245. }
  1246. .size {
  1247. font-size: $uni-font-size-lg + 4rpx;
  1248. }
  1249. }
  1250. .two2 {
  1251. width: 45%;
  1252. background: $color-red1;
  1253. color: #ffffff;
  1254. font-size: $uni-font-size-lg;
  1255. font-weight: 550;
  1256. text-align: center;
  1257. padding: 30rpx 0rpx;
  1258. }
  1259. .clickbg {
  1260. background-color: $color-gray !important;
  1261. }
  1262. }
  1263. }
  1264. </style>