my_consulting.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. <template>
  2. <view class="main bg-white">
  3. <u-dropdown>
  4. <u-dropdown-item v-model="value1" :title="options1[value1].label" @change="typechange" :options="options1"></u-dropdown-item>
  5. <u-dropdown-item v-model="value2" :title="options2[value2].label" @change="paychange" :options="options2"></u-dropdown-item>
  6. <u-dropdown-item v-model="value3" :title="options3[value3].label" @change="timechange" :options="options3"></u-dropdown-item>
  7. </u-dropdown>
  8. <load-refresh ref="loadRefresh" :isRefresh="true" refreshType="loader" refreshTime="2000" heightReduce="10"
  9. backgroundCover="#fff" :pageNo="pageindex" :totalPageNo="totalPage" @loadMore="loadMore" @refresh="refresh">
  10. <view slot="content-list">
  11. <view class="margin-top-sm margin-lr-sm padding-lr-xs" v-for="(item,index) in ordersList" @click="goinfoorder" :data-id="item.id"
  12. :key="index" style="border-radius: 16rpx;box-shadow:0px 0px 10px rgba(0,0,0,.2);">
  13. <view class="flex justify-between align-center bg-white" style="padding: 28rpx;border-radius: 16rpx;">
  14. <view class="jinxing">
  15. <text style="display: inline-block;width: 12rpx;height: 12rpx;border-radius: 50%;background-color:#EEAA3F;margin-right: 8rpx;"></text>
  16. <text v-if="item.order_status==3">进行中</text>
  17. <text v-else-if="item.order_status==1">未支付</text>
  18. <text v-else-if="item.order_status==2">待接单</text>
  19. <text v-else-if="item.order_status==4">已完成</text>
  20. <text v-else-if="item.order_status==5">已取消</text>
  21. <text v-else-if="item.order_status==6">已超时</text>
  22. </view>
  23. <text class="phonezi" v-if="item.product_type==1">电话咨询</text>
  24. <text class="phonezi" v-else-if="item.product_type==2">图文咨询</text>
  25. </view>
  26. <view class="" style="background: #FBFBFB;padding: 28rpx; border-radius: 16rpx;">
  27. <view class="nametaile flex align-center">
  28. <u-avatar :src="item.docter.avatar" mode="circle"></u-avatar>
  29. <text class="margin-left-sm">{{item.docter.name}}</text>
  30. <text class="text_style" v-for="(itm,idx) in item.docter.label_texts" :key="index">{{itm.label_name}}</text>
  31. </view>
  32. <view class="textstyle margin-top-xs flex align-center justify-between">
  33. <text style="color: #333333;">科室:{{item.docter.office.name||'暂无'}} {{item.docter.qualification.name||'暂无'}}</text>
  34. <text v-if="item.order_status==4&&item.product_type==2" class="text-blue" @click.stop="gosuggest(item)">意见单</text>
  35. <text v-else-if="item.order_status==1" class="text-blue">去支付</text>
  36. <text v-else class="text-blue">查看详情</text>
  37. </view>
  38. <view class="textstyle margin-top-xs flex align-center justify-between">
  39. <text style="color: #333333;">编号:{{item.order_sn}}</text>
  40. <text v-if="item.order_status==4&&item.is_evaluate!=1" @click.stop="evaluate(item,index)" style="width: 130rpx; text-align: right;"
  41. class="text-blue">评价</text>
  42. <text v-else-if="item.order_status==1" class="text-blue">取消</text>
  43. <text v-else-if="item.order_status==4&&item.is_evaluate==1" class="text-blue" @click.stop="gotoeva">查看评价</text>
  44. </view>
  45. <view class="textstyle margin-top-xs">
  46. <text style="color: #333333;">下单时间:{{item.created_at}}</text>
  47. </view>
  48. </view>
  49. <view class="cu-bar bg-white tabbar" v-if="item.order_status==1||item.order_status==2" style="width: 100%;display: flex;justify-content: flex-end;">
  50. <u-button shape="circle" size="mini" @click="cancelOrder(item,index)" :ripple="true">取消订单</u-button>
  51. </view>
  52. </view>
  53. </view>
  54. </load-refresh>
  55. <!-- <view class="margin-lr-sm bg-white">
  56. <view class="margin-top-sm" v-for="(item,index) in ordersList" @click="goinfoorder" :data-id="item.id" :key="index"
  57. style="border-radius: 16rpx;box-shadow: 0 0 50rpx 0 rgba(0, 0, 0, 0.1);">
  58. <view class="flex justify-between align-center bg-white" style="padding: 28rpx;border-radius: 16rpx;">
  59. <view class="jinxing">
  60. <text style="display: inline-block;width: 12rpx;height: 12rpx;border-radius: 50%;background-color:#EEAA3F;margin-right: 8rpx;"></text>
  61. <text v-if="item.order_status==3">进行中</text>
  62. <text v-else-if="item.order_status==1">未支付</text>
  63. <text v-else-if="item.order_status==2">待接单</text>
  64. <text v-else-if="item.order_status==4">已完成</text>
  65. <text v-else>已取消</text>
  66. </view>
  67. <text class="phonezi" v-if="item.product_type==1">电话咨询</text>
  68. <text class="phonezi" v-else-if="item.product_type==2">图文咨询</text>
  69. </view>
  70. <view class="" style="background: #FBFBFB;padding: 28rpx; border-radius: 16rpx;">
  71. <view class="nametaile flex align-center">
  72. <u-avatar :src="item.docter.avatar" mode="circle"></u-avatar>
  73. <text class="margin-left-sm">{{item.docter.name}}</text>
  74. <text class="text_style" v-for="(itm,idx) in item.docter.label_texts" :key="index">{{itm.label_name}}</text>
  75. </view>
  76. <view class="textstyle margin-top-xs flex align-center justify-between">
  77. <text style="color: #333333;">科室:{{item.docter.office.name||'暂无'}} {{item.docter.qualification.name||'暂无'}}</text>
  78. <text v-if="item.order_status==4&&item.product_type==2" class="text-blue" @click.stop="gosuggest(item)">意见单</text>
  79. <text v-else-if="item.order_status==1" class="text-blue">去支付</text>
  80. <text v-else class="text-blue">查看详情</text>
  81. </view>
  82. <view class="textstyle margin-top-xs flex align-center justify-between">
  83. <text style="color: #333333;">编号:{{item.order_sn}}</text>
  84. <text v-if="item.order_status==4&&item.is_evaluate!=1" @click.stop="evaluate(item,index)" style="width: 130rpx; text-align: right;"
  85. class="text-blue">评价</text>
  86. <text v-else-if="item.order_status==1" class="text-blue">取消</text>
  87. <text v-else-if="item.order_status==4&&item.is_evaluate==1" class="text-blue" @click.stop="gotoeva">查看评价</text>
  88. </view>
  89. <view class="textstyle margin-top-xs">
  90. <text style="color: #333333;">下单时间:{{item.created_at}}</text>
  91. </view>
  92. </view>
  93. </view>
  94. </view> -->
  95. <u-popup v-model="showpinjia" mode="center" border-radius="14">
  96. <view class="padding-xl flex flex-direction align-center">
  97. <view class="text-xl text-bold text-black text-center">
  98. 填写评价
  99. </view>
  100. <view class="margin-tb-sm">
  101. <u-rate :count="count" size="48" active-color="#EEAA3F" v-model="ratevalue"></u-rate>
  102. </view>
  103. <textarea v-model="content" class="textareastyle"></textarea>
  104. <view class="flex align-center justify-between margin-tb" style="width: 100%;">
  105. <button class="cancel" @click="concelpop">取消</button>
  106. <button class="determine" @click="determinepop">确定</button>
  107. </view>
  108. </view>
  109. </u-popup>
  110. <u-empty text="暂无数据" mode="order" :show="show" margin-top="250"></u-empty>
  111. <!-- <view class="cu-tabbar-height"></view>
  112. <view class="cu-tabbar-height"></view> -->
  113. </view>
  114. </template>
  115. <script>
  116. import loadRefresh from '@/components/load-refresh/load-refresh'
  117. import IMService from "../../../common/goeasyimutil.js"
  118. export default {
  119. components: {
  120. loadRefresh
  121. },
  122. onLoad(options) {
  123. },
  124. onShow() {
  125. console.log(uni.getStorageSync('user').flag, typeof uni.getStorageSync('user').flag)
  126. if (getApp().globalData.imService == null) {
  127. let user = uni.getStorageSync('user')
  128. getApp().globalData.imService = new IMService();
  129. let loginResult = getApp().globalData.imService.login({
  130. flag: user.flag,
  131. nickname: user.nickname,
  132. avatar: user.avatar
  133. });
  134. if (loginResult) {
  135. //连接IM
  136. getApp().globalData.imService.connectIM();
  137. }
  138. }
  139. },
  140. mounted() {
  141. this.getordersList()
  142. },
  143. data() {
  144. return {
  145. value1: 0, //全部类型
  146. value2: 0, //全部状态
  147. value3: 1, //时间正序
  148. options1: [{
  149. value: 0,
  150. label: "全部类型"
  151. },
  152. {
  153. value: 1,
  154. label: "电话咨询"
  155. },
  156. {
  157. value: 2,
  158. label: "图文咨询"
  159. },
  160. ],
  161. options2: [{
  162. value: 0,
  163. label: "全部状态"
  164. },
  165. {
  166. value: 1,
  167. label: "未支付"
  168. },
  169. {
  170. value: 2,
  171. label: "待接单"
  172. },
  173. {
  174. value: 3,
  175. label: "进行中"
  176. },
  177. {
  178. value: 4,
  179. label: "已完成"
  180. },
  181. {
  182. value: 5,
  183. label: "已取消"
  184. },
  185. ],
  186. options3: [{
  187. value: 0,
  188. label: "时间正序"
  189. },
  190. {
  191. value: 1,
  192. label: "时间倒序"
  193. },
  194. ],
  195. ordersList: [],
  196. pageindex: 1,
  197. show: false,
  198. showpinjia: false,
  199. ratevalue: "",
  200. count: 5,
  201. content: "",
  202. currentorder: "",
  203. evaluateindex: "",
  204. totalPage: ""
  205. }
  206. },
  207. // onReachBottom() {
  208. // this.getordersList()
  209. // },
  210. // onPullDownRefresh() {
  211. // this.pageindex = 1
  212. // this.ordersList = []
  213. // this.getordersList()
  214. // uni.stopPullDownRefresh()
  215. // },
  216. methods: {
  217. cancelOrder: async function(item, index) {
  218. let res = await this.$request.post("/api/v1/order/orderCancel", {
  219. order_id: item.id
  220. })
  221. if (res.status == 0) {
  222. uni.showToast({
  223. title: "取消成功",
  224. icon: "none"
  225. })
  226. this.ordersList.splice(index, 1)
  227. }else{
  228. uni.showModal({
  229. title:"提示",
  230. content:res.message,
  231. showCancel:false,
  232. success: (res) => {
  233. }
  234. })
  235. }
  236. },
  237. loadMore() {
  238. this.getordersList()
  239. },
  240. refresh() {
  241. this.pageindex = 1
  242. // this.ordersList = []
  243. this.getordersList()
  244. },
  245. evaluate(item, index) {
  246. this.showpinjia = true
  247. this.currentorder = item
  248. this.evaluateindex = index
  249. },
  250. determinepop: async function() {
  251. let res = await this.$request.post("/api/v1/evaluate/sumbitEvaluate", {
  252. order_id: this.currentorder.id,
  253. docter_id: this.currentorder.docter_id,
  254. score: this.ratevalue,
  255. content: this.content
  256. })
  257. console.log(res)
  258. if (res.status == 0) {
  259. uni.showToast({
  260. title: "评价成功",
  261. icon: "none",
  262. duration: 500
  263. })
  264. this.ordersList[this.evaluateindex].is_evaluate = 1
  265. setTimeout(() => {
  266. this.showpinjia = false
  267. }, 500)
  268. this.$forceUpdate()
  269. }
  270. },
  271. concelpop() {
  272. this.content = ""
  273. this.showpinjia = false
  274. },
  275. typechange(value) {
  276. this.value1 = value
  277. this.pageindex = 1
  278. this.ordersList = []
  279. this.getordersList()
  280. },
  281. paychange(value) {
  282. this.value2 = value
  283. this.pageindex = 1
  284. this.ordersList = []
  285. this.getordersList()
  286. },
  287. timechange(value) {
  288. this.value3 = value
  289. this.pageindex = 1
  290. this.ordersList = []
  291. this.getordersList()
  292. },
  293. getordersList: async function() {
  294. let res = await this.$request.post("/api/v1/order/orderList", {
  295. page: this.pageindex,
  296. list_type: this.value1,
  297. product_type: this.value1,
  298. order_status: this.value2,
  299. time_sort: this.value3
  300. }, false)
  301. if (res.status == 0) {
  302. this.$refs.loadRefresh.loadOver()
  303. if (this.pageindex > res.data.last_page) {
  304. uni.showToast({
  305. title: "没有更多了",
  306. icon: "none"
  307. })
  308. } else {
  309. this.ordersList = this.ordersList.concat(res.data.data)
  310. this.ordersList.forEach((item, index) => {
  311. if (item.docter == null) {
  312. this.ordersList.splice(index, 1)
  313. }
  314. })
  315. this.ordersList.forEach((item, index) => {
  316. if (item.product_type == 6) {
  317. this.ordersList.splice(index, 1)
  318. }
  319. })
  320. this.ordersList.forEach((item, index) => {
  321. if (item.product_type == 5) {
  322. this.ordersList.splice(index, 1)
  323. }
  324. })
  325. this.ordersList.forEach((item, index) => {
  326. if (item.product_type != 1 && item.product_type != 2) {
  327. this.ordersList.splice(index, 1)
  328. }
  329. })
  330. this.ordersList.forEach((item, index) => {
  331. if (item.product_type == 3) {
  332. this.ordersList.splice(index, 1)
  333. }
  334. })
  335. console.log(this.ordersList)
  336. this.pageindex++
  337. this.totalPage = res.data.last_page
  338. }
  339. }
  340. if (this.ordersList.length == 0) {
  341. this.show = true
  342. } else {
  343. this.show = false
  344. }
  345. },
  346. pinjia() {
  347. },
  348. goinfoorder(e) {
  349. uni.navigateTo({
  350. url: "consultingInfo?id=" + e.currentTarget.dataset.id
  351. })
  352. },
  353. gosuggest(item) {
  354. uni.navigateTo({
  355. url: "opinionInfo?id=" + item.suggest.id
  356. })
  357. },
  358. gotoeva() {
  359. uni.navigateTo({
  360. url: "../me_evaluate"
  361. })
  362. }
  363. }
  364. };
  365. </script>
  366. <style lang="scss">
  367. page {
  368. background-color: #fff;
  369. }
  370. .cancel {
  371. width: 240rpx;
  372. height: 78rpx;
  373. border-radius: 16rpx;
  374. border: 2rpx solid #0B73B9;
  375. color: #0B73B9;
  376. font-size: 32rpx;
  377. }
  378. .determine {
  379. width: 240rpx;
  380. height: 78rpx;
  381. background: #0B73B9;
  382. border-radius: 16rpx;
  383. color: #fff;
  384. font-size: 32rpx;
  385. }
  386. .textareastyle {
  387. width: 560rpx;
  388. height: 269rpx;
  389. padding: 25rpx;
  390. border: 1px solid #C0C0C0;
  391. border-radius: 16rpx;
  392. font-size: 28rpx;
  393. }
  394. .main {}
  395. .text_style {
  396. font-weight: 400;
  397. margin-left: 15rpx;
  398. background-color: #E5F5FF;
  399. color: #0B73B9;
  400. width: 100rpx;
  401. height: 28rpx;
  402. font-size: 20rpx;
  403. border-radius: 10rpx;
  404. text-align: center;
  405. align-items: center;
  406. }
  407. .nametaile {
  408. font-size: 30rpx;
  409. font-weight: 500;
  410. color: #333333;
  411. }
  412. .textstyle {
  413. font-size: 26rpx;
  414. color: #666666;
  415. font-weight: 400;
  416. }
  417. .phonezi {
  418. width: 160rpx;
  419. height: 54rpx;
  420. background: #F6F6F6;
  421. border-radius: 27rpx;
  422. font-size: 28rpx;
  423. font-family: PingFangSC-Regular, PingFang SC;
  424. font-weight: 400;
  425. color: #666666;
  426. display: flex;
  427. align-items: center;
  428. justify-content: center;
  429. }
  430. .jinxing {
  431. height: 30rpx;
  432. font-size: 30rpx;
  433. font-family: PingFangSC-Medium, PingFang SC;
  434. font-weight: 500;
  435. color: #EEAA3F;
  436. display: flex;
  437. align-items: center;
  438. }
  439. </style>