inquiryOrderList.vue 12 KB

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