inquiryOrderList.vue 12 KB

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