my_consulting.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  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"
  12. :data-id="item.id" :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. uni.showModal({
  219. title: "提示",
  220. content: "确定要取消订单吗?",
  221. success: (res) => {
  222. if (res.confirm) {
  223. uni.requestSubscribeMessage({
  224. tmplIds: ['bjZ-r79i8sl7zEtdttAtcCPZLkCgFSYHTNWnNVd1cG0'],
  225. success: (res) => {
  226. this.confirmorder(item, index)
  227. },
  228. fail: (err) => {
  229. this.confirmorder(item, index)
  230. }
  231. })
  232. }
  233. }
  234. })
  235. },
  236. confirmorder: async function(item, index) {
  237. let res = await this.$request.post("/api/v1/order/orderCancel", {
  238. order_id: item.id
  239. })
  240. if (res.status == 0) {
  241. uni.showToast({
  242. title: "取消成功",
  243. icon: "none"
  244. })
  245. this.ordersList.splice(index, 1)
  246. } else {
  247. uni.showModal({
  248. title: "提示",
  249. content: res.message,
  250. showCancel: false,
  251. success: (res) => {}
  252. })
  253. }
  254. },
  255. loadMore() {
  256. this.getordersList()
  257. },
  258. refresh() {
  259. this.pageindex = 1
  260. // this.ordersList = []
  261. this.getordersList()
  262. },
  263. evaluate(item, index) {
  264. this.showpinjia = true
  265. this.currentorder = item
  266. this.evaluateindex = index
  267. },
  268. determinepop: async function() {
  269. let res = await this.$request.post("/api/v1/evaluate/sumbitEvaluate", {
  270. order_id: this.currentorder.id,
  271. docter_id: this.currentorder.docter_id,
  272. score: this.ratevalue,
  273. content: this.content
  274. })
  275. console.log(res)
  276. if (res.status == 0) {
  277. uni.showToast({
  278. title: "评价成功",
  279. icon: "none",
  280. duration: 500
  281. })
  282. this.ordersList[this.evaluateindex].is_evaluate = 1
  283. setTimeout(() => {
  284. this.showpinjia = false
  285. }, 500)
  286. this.$forceUpdate()
  287. }
  288. },
  289. concelpop() {
  290. this.content = ""
  291. this.showpinjia = false
  292. },
  293. typechange(value) {
  294. this.value1 = value
  295. this.pageindex = 1
  296. this.ordersList = []
  297. this.getordersList()
  298. },
  299. paychange(value) {
  300. this.value2 = value
  301. this.pageindex = 1
  302. this.ordersList = []
  303. this.getordersList()
  304. },
  305. timechange(value) {
  306. this.value3 = value
  307. this.pageindex = 1
  308. this.ordersList = []
  309. this.getordersList()
  310. },
  311. getordersList: async function() {
  312. let res = await this.$request.post("/api/v1/order/orderList", {
  313. page: this.pageindex,
  314. list_type: this.value1,
  315. product_type: this.value1,
  316. order_status: this.value2,
  317. time_sort: this.value3
  318. }, false)
  319. if (res.status == 0) {
  320. this.$refs.loadRefresh.loadOver()
  321. if (this.pageindex > res.data.last_page) {
  322. uni.showToast({
  323. title: "没有更多了",
  324. icon: "none"
  325. })
  326. } else {
  327. this.ordersList = this.ordersList.concat(res.data.data)
  328. this.ordersList.forEach((item, index) => {
  329. if (item.docter == null) {
  330. this.ordersList.splice(index, 1)
  331. }
  332. })
  333. this.ordersList.forEach((item, index) => {
  334. if (item.product_type == 6) {
  335. this.ordersList.splice(index, 1)
  336. }
  337. })
  338. this.ordersList.forEach((item, index) => {
  339. if (item.product_type == 5) {
  340. this.ordersList.splice(index, 1)
  341. }
  342. })
  343. this.ordersList.forEach((item, index) => {
  344. if (item.product_type != 1 && item.product_type != 2) {
  345. this.ordersList.splice(index, 1)
  346. }
  347. })
  348. this.ordersList.forEach((item, index) => {
  349. if (item.product_type == 3) {
  350. this.ordersList.splice(index, 1)
  351. }
  352. })
  353. console.log(this.ordersList)
  354. this.pageindex++
  355. this.totalPage = res.data.last_page
  356. }
  357. }
  358. if (this.ordersList.length == 0) {
  359. this.show = true
  360. } else {
  361. this.show = false
  362. }
  363. },
  364. pinjia() {
  365. },
  366. goinfoorder(e) {
  367. uni.navigateTo({
  368. url: "consultingInfo?id=" + e.currentTarget.dataset.id
  369. })
  370. },
  371. gosuggest(item) {
  372. uni.navigateTo({
  373. url: "opinionInfo?id=" + item.suggest.id
  374. })
  375. },
  376. gotoeva() {
  377. uni.navigateTo({
  378. url: "../me_evaluate"
  379. })
  380. }
  381. }
  382. };
  383. </script>
  384. <style lang="scss">
  385. page {
  386. background-color: #fff;
  387. }
  388. .cancel {
  389. width: 240rpx;
  390. height: 78rpx;
  391. border-radius: 16rpx;
  392. border: 2rpx solid #0B73B9;
  393. color: #0B73B9;
  394. font-size: 32rpx;
  395. }
  396. .determine {
  397. width: 240rpx;
  398. height: 78rpx;
  399. background: #0B73B9;
  400. border-radius: 16rpx;
  401. color: #fff;
  402. font-size: 32rpx;
  403. }
  404. .textareastyle {
  405. width: 560rpx;
  406. height: 269rpx;
  407. padding: 25rpx;
  408. border: 1px solid #C0C0C0;
  409. border-radius: 16rpx;
  410. font-size: 28rpx;
  411. }
  412. .main {}
  413. .text_style {
  414. font-weight: 400;
  415. margin-left: 15rpx;
  416. background-color: #E5F5FF;
  417. color: #0B73B9;
  418. width: 100rpx;
  419. height: 28rpx;
  420. font-size: 20rpx;
  421. border-radius: 10rpx;
  422. text-align: center;
  423. align-items: center;
  424. }
  425. .nametaile {
  426. font-size: 30rpx;
  427. font-weight: 500;
  428. color: #333333;
  429. }
  430. .textstyle {
  431. font-size: 26rpx;
  432. color: #666666;
  433. font-weight: 400;
  434. }
  435. .phonezi {
  436. width: 160rpx;
  437. height: 54rpx;
  438. background: #F6F6F6;
  439. border-radius: 27rpx;
  440. font-size: 28rpx;
  441. font-family: PingFangSC-Regular, PingFang SC;
  442. font-weight: 400;
  443. color: #666666;
  444. display: flex;
  445. align-items: center;
  446. justify-content: center;
  447. }
  448. .jinxing {
  449. height: 30rpx;
  450. font-size: 30rpx;
  451. font-family: PingFangSC-Medium, PingFang SC;
  452. font-weight: 500;
  453. color: #EEAA3F;
  454. display: flex;
  455. align-items: center;
  456. }
  457. </style>