inquiryOrderList.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. <template>
  2. <view class="content">
  3. <view class="top-fixed">
  4. <u-tabs
  5. :scrollable="false"
  6. :list="tabs"
  7. lineColor="#FF5C03"
  8. @change="inquiryTypeChange">
  9. </u-tabs>
  10. </view>
  11. <mescroll-body top="88rpx" bottom="0" ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback" @up="upCallback">
  12. <view class="order-list">
  13. <view class="order-item" v-for="(item) in dataList" @click="navTo('./inquiryOrderDetails?orderId='+item.orderId)">
  14. <view class="order-top" >
  15. <view class="left" v-if="item.doctorId!=null">
  16. <image class="head" mode="aspectFill" :src="item.avatar"></image>
  17. <view class="name">
  18. {{item.doctorName}}
  19. </view>
  20. <view class="dept">
  21. {{item.deptName}}
  22. </view>
  23. </view>
  24. <view class="left" v-if="item.inquiryType==2">
  25. <view class="title" v-if="item.status==1">
  26. 支付后为您安排医生接诊
  27. </view>
  28. <view class="title" v-if="item.status==2">
  29. 正在为您安排医生接诊
  30. </view>
  31. <view class="title" v-if="item.status==-1">
  32. 订单已取消
  33. </view>
  34. <view class="title" v-if="item.status==-2">
  35. 订单已退款
  36. </view>
  37. <view class="title" v-if="item.status==-3">
  38. 医生已拒单
  39. </view>
  40. </view>
  41. <view class="status red" v-if="item.status==1">
  42. {{$getDictLabelName(orderStatusOptions,item.status)}}
  43. </view>
  44. <view class="status red" v-if="item.status==2">
  45. {{$getDictLabelName(orderStatusOptions,item.status)}}
  46. </view>
  47. <view class="status green" v-if="item.status==3">
  48. {{$getDictLabelName(orderStatusOptions,item.status)}}
  49. </view>
  50. <view class="status green" v-if="item.status==4">
  51. {{$getDictLabelName(orderStatusOptions,item.status)}}
  52. </view>
  53. <view class="status gray" v-if="item.status<0">
  54. {{$getDictLabelName(orderStatusOptions,item.status)}}
  55. </view>
  56. </view>
  57. <view class="order-cont">
  58. <view class="order-type" >
  59. 订单类型:
  60. <text>{{$getDictLabelName(inquiryTypeOptions,item.inquiryType)}}</text>
  61. <text>-{{$getDictLabelName(orderTypeOptions,item.orderType)}}</text>
  62. </view>
  63. <view class="order-desc">病情描述:{{item.title}}</view>
  64. <view class="order-time-box">
  65. <view class="order-time">
  66. {{item.createTime}}
  67. </view>
  68. <view class="right">
  69. <view class="btn" v-if="item.status==1" @click.stop="pay(item)">去支付</view>
  70. <view class="btn" v-if="item.status==2" @click.stop="cancel(item)">取消订单</view>
  71. <view class="btn" v-if="item.status==4&&item.isPing==0" @click.stop="ping(item)">去评价</view>
  72. <view class="btn" v-if="item.status==3" @click.stop="toIM(item)">去咨询</view>
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. </mescroll-body>
  79. </view>
  80. </template>
  81. <script>
  82. import store from "@/store";
  83. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  84. import {cancel,getMyInquiryOrderList} from '@/api/inquiryOrder.js'
  85. import {getDictByKey} from '@/api/common.js'
  86. export default {
  87. mixins: [MescrollMixin], // 使用mixin
  88. data() {
  89. return {
  90. orderStatusOptions:[],
  91. orderTypeOptions:[],
  92. inquiryTypeOptions:[],
  93. tabs:[
  94. {
  95. id:2,
  96. name:'快速问诊'
  97. },
  98. {
  99. id:1,
  100. name:'专家问诊'
  101. },
  102. {
  103. id:3,
  104. name:'开药问诊'
  105. }
  106. ],
  107. inquiryType:2,
  108. mescroll:null,
  109. downOption: { //下拉刷新
  110. use:true,
  111. auto: false // 不自动加载 (mixin已处理第一个tab触发downCallback)
  112. },
  113. upOption: {
  114. onScroll:false,
  115. use: true, // 是否启用上拉加载; 默认true
  116. page: {
  117. pae: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  118. size: 10 // 每页数据的数量,默认10
  119. },
  120. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  121. textNoMore:"已经到底了",
  122. empty: {
  123. icon:'https://cos.his.cdwjyyh.com/fs/20240423/cf4a86b913a04341bb44e34bb4d37aa2.png',
  124. tip: '暂无数据'
  125. }
  126. },
  127. dataList: []
  128. }
  129. },
  130. onLoad() {
  131. this.getDictByKey("sys_inquiry_order_type");
  132. this.getDictByKey("sys_inquiry_type");
  133. this.getDictByKey("sys_inquiry_status");
  134. var that=this;
  135. uni.$on('refreshInquiryOrder', () => {
  136. that.mescroll.resetUpScroll()
  137. })
  138. },
  139. onShow() {
  140. },
  141. methods: {
  142. cancel(item){
  143. var that=this;
  144. uni.showModal({
  145. title:"提示",
  146. content:"确认取消订单吗?",
  147. showCancel:true,
  148. cancelText:'取消',
  149. confirmText:'确定',
  150. success:res=>{
  151. if(res.confirm){
  152. // 用户点击确定
  153. var data={orderId:item.orderId}
  154. cancel(data).then(
  155. res => {
  156. if(res.code==200){
  157. this.mescroll.resetUpScroll()
  158. uni.showToast({
  159. icon:'success',
  160. title: "操作成功",
  161. });
  162. }else{
  163. uni.showToast({
  164. icon:'none',
  165. title: res.msg,
  166. });
  167. }
  168. },
  169. rej => {}
  170. );
  171. }else{
  172. // 否则点击了取消
  173. }
  174. }
  175. })
  176. },
  177. ping(item){
  178. uni.navigateTo({
  179. url: "/pages/store/pingOrder?orderId="+item.orderId
  180. })
  181. },
  182. pay(item){
  183. uni.navigateTo({
  184. url: "/pages/store/inquiryPay?orderId="+item.orderId
  185. })
  186. },
  187. toIM(item){
  188. var that=this;
  189. var id="C2CD-"+item.doctorId;
  190. store.commit("timStore/setType","startInquiry");
  191. store.commit("timStore/setOrderType",item.orderType);
  192. store.commit("timStore/setImType", 1);
  193. store.commit("timStore/setFollowId", 0);
  194. store.commit("timStore/setOrderId",item.orderId);
  195. store.commit("timStore/setConversationID", id);
  196. //uni.$TUIKit.TUIChatServer.updateStore(conversationId)
  197. uni.$TUIKit.TUIConversationServer.setMessageRead(id);
  198. uni.$TUIKit.TUIConversationServer.getConversationProfile(id)
  199. .then((res) => {
  200. //通知 TUIChat 关闭当前会话
  201. const { conversation } = res.data;
  202. store.commit("timStore/setConversation", conversation);
  203. let url = "/pages/TUIKit/TUIPages/TUIChat/index";
  204. const { nick: name } = conversation.userProfile;
  205. url = `${url}?conversationName=${
  206. conversation.userProfile.nick ||
  207. conversation.userProfile.userID
  208. }&orderId=`+item.orderId;
  209. uni.redirectTo({ url });
  210. })
  211. .catch((err) => {
  212. console.warn("获取 group profile 异常 = ", err);
  213. });
  214. },
  215. getDictByKey(key){
  216. var data={key:key}
  217. getDictByKey(data).then(
  218. res => {
  219. if(res.code==200){
  220. if(key=="sys_inquiry_order_type"){
  221. this.orderTypeOptions=res.data;
  222. }
  223. if(key=="sys_inquiry_type"){
  224. this.inquiryTypeOptions=res.data;
  225. }
  226. if(key=="sys_inquiry_status"){
  227. this.orderStatusOptions=res.data;
  228. }
  229. }
  230. },
  231. err => {
  232. }
  233. );
  234. },
  235. inquiryTypeChange(item){
  236. this.inquiryType=item.id
  237. console.log(item)
  238. this.mescroll.resetUpScroll()
  239. },
  240. navTo(url){
  241. uni.navigateTo({
  242. url: url
  243. })
  244. },
  245. mescrollInit(mescroll) {
  246. this.mescroll = mescroll;
  247. },
  248. /*下拉刷新的回调 */
  249. downCallback() {
  250. this.mescroll.resetUpScroll()
  251. },
  252. /*上拉加载的回调*/
  253. upCallback(page) {
  254. //联网加载数据
  255. var that = this;
  256. var data = {
  257. inquiryType:this.inquiryType,
  258. pageNum: page.num,
  259. pageSize: page.size
  260. };
  261. getMyInquiryOrderList(data).then(res => {
  262. if(res.code==200){
  263. if (page.num == 1) {
  264. that.dataList = res.data.list;
  265. } else {
  266. that.dataList = that.dataList.concat(res.data.list);
  267. }
  268. that.mescroll.endBySize(res.data.list.length, res.data.total);
  269. }else{
  270. uni.showToast({
  271. icon:'none',
  272. title: "请求失败",
  273. });
  274. that.dataList = null;
  275. that.mescroll.endErr();
  276. }
  277. });
  278. },
  279. }
  280. }
  281. </script>
  282. <style lang="scss">
  283. page{
  284. height: 100%;
  285. background: #f6f6f6;
  286. }
  287. </style>
  288. <style scoped lang="scss">
  289. .content{
  290. height: 100%;
  291. .top-fixed{
  292. width: 100%;
  293. position: absolute;
  294. top: 0;
  295. left: 0;
  296. z-index: 10;
  297. height: 88upx;
  298. background-color: #fff;
  299. }
  300. .order-list{
  301. width: 100%;
  302. padding: 15rpx;
  303. display: flex;
  304. flex-direction: column;
  305. align-items: flex-start;
  306. justify-content: flex-start;
  307. .order-item{
  308. margin-bottom: 15rpx;
  309. width: 100%;
  310. padding: 15rpx;
  311. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  312. background-color: #fff;
  313. border-radius: 15rpx;
  314. display: flex;
  315. flex-direction: column;
  316. align-items: flex-start;
  317. justify-content: flex-start;
  318. .order-top{
  319. display: flex;
  320. align-items: center;
  321. justify-content: space-between;
  322. width: 100%;
  323. padding-bottom: 15rpx;
  324. border-bottom: 1px solid #efefef;
  325. .left{
  326. display: flex;
  327. align-items: center;
  328. justify-content: flex-start;
  329. image{
  330. width:80rpx;
  331. height:80rpx;
  332. border-radius: 50%;
  333. }
  334. .title{
  335. font-size: 32upx;
  336. font-family: PingFang SC;
  337. font-weight: bold;
  338. color: #111111;
  339. }
  340. .name{
  341. margin-left: 20rpx;
  342. font-size: 32upx;
  343. font-family: PingFang SC;
  344. font-weight: bold;
  345. color: #111111;
  346. }
  347. .dept{
  348. margin-left: 15rpx;
  349. font-size: 28upx;
  350. font-family: PingFang SC;
  351. color: #9a9a9c;
  352. }
  353. }
  354. .status{
  355. font-size: 28upx;
  356. font-family: PingFang SC;
  357. }
  358. .red{
  359. color: #db5053;
  360. }
  361. .green{
  362. color: #FF5C03;
  363. }
  364. .gray{
  365. color: #9c9c9c;
  366. }
  367. }
  368. .order-cont{
  369. width: 100%;
  370. margin-top: 15rpx;
  371. .order-type{
  372. font-size: 32upx;
  373. font-family: PingFang SC;
  374. // font-weight: bold;
  375. color: #111111;
  376. }
  377. .order-desc{
  378. margin-top: 15rpx;
  379. font-size: 28upx;
  380. font-family: PingFang SC;
  381. // font-weight: bold;
  382. color: #111111;
  383. }
  384. .order-time-box{
  385. width: 100%;
  386. margin-top: 15rpx;
  387. display: flex;
  388. align-items: center;
  389. justify-content: space-between;
  390. .order-time{
  391. font-size: 32upx;
  392. font-family: PingFang SC;
  393. color: #9a9a9c;
  394. }
  395. .right{
  396. .btn{
  397. padding: 10rpx 30rpx;
  398. border: 1rpx solid #FF5C03;
  399. color: #FF5C03;
  400. font-size: 28rpx;
  401. border-radius: 30rpx;
  402. }
  403. }
  404. }
  405. }
  406. }
  407. }
  408. }
  409. </style>