inquiryOrderList.vue 10 KB

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