patient.vue 33 KB

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