my_consulting.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  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" :isPaging="false" refreshType="loader" refreshTime="2000"
  9. heightReduce="10" 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" @click.stop="payorder(item.id,item.payment_amount,item.product_type)"
  36. class="text-blue">去支付</text>
  37. <text v-else class="text-blue">查看详情</text>
  38. </view>
  39. <view class="textstyle margin-top-xs flex align-center justify-between">
  40. <text style="color: #333333;">编号:{{item.order_sn}}</text>
  41. <text v-if="item.order_status==4&&item.is_evaluate!=1" @click.stop="evaluate(item,index)" style="width: 130rpx; text-align: right;"
  42. class="text-blue">评价</text>
  43. <text v-else-if="item.order_status==1" class="text-blue">取消</text>
  44. <text v-else-if="item.order_status==4&&item.is_evaluate==1" class="text-blue" @click.stop="gotoeva">查看评价</text>
  45. </view>
  46. <view class="textstyle margin-top-xs">
  47. <text style="color: #333333;">下单时间:{{item.created_at}}</text>
  48. </view>
  49. </view>
  50. <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;">
  51. <u-button shape="circle" size="mini" @click="cancelOrder(item,index)" :ripple="true">取消订单</u-button>
  52. </view>
  53. </view>
  54. <u-empty text="暂无数据" mode="order" :show="show" margin-top="250"></u-empty>
  55. </view>
  56. </load-refresh> -->
  57. <view class="margin-lr-sm bg-white">
  58. <view class="margin-top-sm" v-for="(item,index) in ordersList" @click="goinfoorder" :data-id="item.id" :key="index"
  59. style="border-radius: 16rpx;box-shadow: 0 0 50rpx 0 rgba(0, 0, 0, 0.1);">
  60. <view class="flex justify-between align-center bg-white" style="padding: 28rpx;border-radius: 16rpx;">
  61. <view class="jinxing">
  62. <text style="display: inline-block;width: 12rpx;height: 12rpx;border-radius: 50%;background-color:#EEAA3F;margin-right: 8rpx;"></text>
  63. <text v-if="item.order_status==3">进行中</text>
  64. <text v-else-if="item.order_status==1">未支付</text>
  65. <text v-else-if="item.order_status==2">待接单</text>
  66. <text v-else-if="item.order_status==4">已完成</text>
  67. <text v-else-if="item.order_status==5">已取消</text>
  68. <text v-else-if="item.order_status==6">已超时</text>
  69. </view>
  70. <text class="phonezi" v-if="item.product_type==1">电话咨询</text>
  71. <text class="phonezi" v-else-if="item.product_type==2">图文咨询</text>
  72. </view>
  73. <view class="" style="background: #FBFBFB;padding: 28rpx; border-radius: 16rpx;">
  74. <view class="nametaile flex align-center">
  75. <u-avatar :src="item.docter.avatar" mode="circle"></u-avatar>
  76. <text class="margin-left-sm">{{item.docter.name}}</text>
  77. <text class="text_style" v-for="(itm,idx) in item.docter.label_texts" :key="index">{{itm.label_name}}</text>
  78. </view>
  79. <view class="textstyle margin-top-xs flex align-center justify-between">
  80. <text style="color: #333333;">科室:{{item.docter.office.name||'暂无'}} {{item.docter.qualification.name||'暂无'}}</text>
  81. <text v-if="item.order_status==4&&item.product_type==2" class="text-blue" @click.stop="gosuggest(item)">意见单</text>
  82. <text v-else-if="item.order_status==1" @click.stop="payorder(item.id,item.payment_amount,item.product_type)"
  83. class="text-blue">去支付</text>
  84. <text v-else class="text-blue">查看详情</text>
  85. </view>
  86. <view class="textstyle margin-top-xs flex align-center justify-between">
  87. <text style="color: #333333;">编号:{{item.order_sn}}</text>
  88. <text v-if="item.order_status==4&&item.is_evaluate!=1" @click.stop="evaluate(item,index)" style="width: 130rpx; text-align: right;"
  89. class="text-blue">评价</text>
  90. <!-- <text v-else-if="item.order_status==1" class="text-blue">取消</text> -->
  91. <!-- <text v-else-if="item.order_status==4&&item.is_evaluate==1" class="text-blue" @click.stop="gotoeva">查看评价</text> -->
  92. </view>
  93. <view class="textstyle margin-top-xs">
  94. <text style="color: #333333;">下单时间:{{item.created_at}}</text>
  95. </view>
  96. </view>
  97. </view>
  98. </view>
  99. <u-popup v-model="showpinjia" mode="center" border-radius="14">
  100. <view class="padding-xl flex flex-direction align-center">
  101. <view class="text-xl text-bold text-black text-center">
  102. 填写评价
  103. </view>
  104. <view class="margin-tb-sm">
  105. <u-rate :count="count" size="48" active-color="#EEAA3F" v-model="ratevalue"></u-rate>
  106. </view>
  107. <textarea v-model="content" class="textareastyle"></textarea>
  108. <view class="flex align-center justify-between margin-tb" style="width: 100%;">
  109. <button class="cancel" @click="concelpop">取消</button>
  110. <button class="determine" @click="determinepop">确定</button>
  111. </view>
  112. </view>
  113. </u-popup>
  114. <!-- <view class="cu-tabbar-height"></view>
  115. <view class="cu-tabbar-height"></view> -->
  116. <u-keyboard default="" ref="uKeyboard" mode="number" :mask="true" :mask-close-able="false" :dot-enabled="false"
  117. v-model="showpay" :safe-area-inset-bottom="true" :tooltip="false" @change="onChange" @backspace="onBackspace">
  118. <view>
  119. <view class="u-text-center u-padding-20 money">
  120. <text>{{payment_amount/100}}</text>
  121. <text class="u-font-20 u-padding-left-10">元</text>
  122. <view class="u-padding-10 close" data-flag="false" @tap="showPop(false)">
  123. <u-icon name="close" color="#333333" size="28"></u-icon>
  124. </view>
  125. </view>
  126. <view class="u-flex u-row-center">
  127. <u-message-input mode="box" :maxlength="6" :dot-fill="true" v-model="password" :disabled-keyboard="true" @finish="finish"></u-message-input>
  128. </view>
  129. <view class="u-text-center u-padding-top-10 u-padding-bottom-20 tips">请输入密码</view>
  130. </view>
  131. </u-keyboard>
  132. <view class="cu-tabbar-height"></view>
  133. </view>
  134. </template>
  135. <script>
  136. import loadRefresh from '@/components/load-refresh/load-refresh'
  137. import IMService from "../../../common/goeasyimutil.js"
  138. export default {
  139. components: {
  140. loadRefresh
  141. },
  142. onLoad(options) {
  143. },
  144. onShow() {
  145. console.log(uni.getStorageSync('user').flag, typeof uni.getStorageSync('user').flag)
  146. if (getApp().globalData.imService == null) {
  147. let user = uni.getStorageSync('user')
  148. getApp().globalData.imService = new IMService();
  149. let loginResult = getApp().globalData.imService.login({
  150. flag: user.flag,
  151. nickname: user.nickname,
  152. avatar: user.avatar
  153. });
  154. if (loginResult) {
  155. //连接IM
  156. getApp().globalData.imService.connectIM();
  157. }
  158. }
  159. this.ordersList = []
  160. this.pageindex = 1
  161. this.getordersList()
  162. },
  163. mounted() {
  164. },
  165. data() {
  166. return {
  167. value1: 0, //全部类型
  168. value2: 0, //全部状态
  169. value3: 1, //时间正序
  170. options1: [{
  171. value: 0,
  172. label: "全部类型"
  173. },
  174. {
  175. value: 1,
  176. label: "电话咨询"
  177. },
  178. {
  179. value: 2,
  180. label: "图文咨询"
  181. },
  182. ],
  183. options2: [{
  184. value: 0,
  185. label: "全部状态"
  186. },
  187. {
  188. value: 1,
  189. label: "未支付"
  190. },
  191. {
  192. value: 2,
  193. label: "待接单"
  194. },
  195. {
  196. value: 3,
  197. label: "进行中"
  198. },
  199. {
  200. value: 4,
  201. label: "已完成"
  202. },
  203. {
  204. value: 5,
  205. label: "已取消"
  206. },
  207. ],
  208. options3: [{
  209. value: 0,
  210. label: "时间正序"
  211. },
  212. {
  213. value: 1,
  214. label: "时间倒序"
  215. },
  216. ],
  217. ordersList: [],
  218. pageindex: 1,
  219. show: false,
  220. showpinjia: false,
  221. ratevalue: "",
  222. count: 5,
  223. content: "",
  224. currentorder: "",
  225. evaluateindex: "",
  226. totalPage: "",
  227. showpay: false,
  228. payment_amount: "",
  229. password: "",
  230. payid: "",
  231. paytype: ""
  232. }
  233. },
  234. onReachBottom() {
  235. this.getordersList()
  236. },
  237. onPullDownRefresh() {
  238. this.pageindex = 1
  239. this.ordersList = []
  240. this.getordersList()
  241. uni.stopPullDownRefresh()
  242. },
  243. methods: {
  244. payorder(id, price, type) {
  245. this.showpay = true
  246. this.payment_amount = price
  247. this.payid = id
  248. this.paytype = type
  249. },
  250. showPop(flag = true) {
  251. this.password = '';
  252. this.showpay = flag;
  253. },
  254. onChange(val) {
  255. if (this.password.length < 6) {
  256. this.password += val;
  257. }
  258. if (this.password.length >= 6) {
  259. this.paymoney()
  260. return false
  261. }
  262. },
  263. paymoney: async function() {
  264. uni.showLoading({
  265. title: '支付中'
  266. })
  267. let res = await this.$request.post("/api/v1/order/orderPay", {
  268. order_id: this.payid,
  269. pay_password: this.password
  270. })
  271. if (res.status == 0) {
  272. uni.hideLoading();
  273. this.showpay = false;
  274. this.password = ""
  275. uni.showToast({
  276. icon: 'success',
  277. title: '支付成功',
  278. duration: 1000
  279. })
  280. setTimeout(() => {
  281. uni.navigateTo({
  282. url: "../../order/order?type=" + this.paytype
  283. })
  284. }, 1000)
  285. } else {
  286. uni.hideLoading();
  287. this.password = ""
  288. uni.showModal({
  289. title: "提示",
  290. content: res.message,
  291. confirmText: "确定",
  292. showCancel: false,
  293. success: (rr) => {
  294. if (rr.confirm) {
  295. this.showpay = false;
  296. }
  297. }
  298. })
  299. }
  300. },
  301. onBackspace(e) {
  302. if (this.password.length > 0) {
  303. this.password = this.password.substring(0, this.password.length - 1);
  304. }
  305. },
  306. cancelOrder: async function(item, index) {
  307. uni.showModal({
  308. title: "提示",
  309. content: "确定要取消订单吗?",
  310. success: (res) => {
  311. if (res.confirm) {
  312. uni.requestSubscribeMessage({
  313. tmplIds: ['368_VJaSVZQay3E5-yPelJKJn3R_Hu56dVflxazHiCY'],
  314. success: (res) => {
  315. this.confirmorder(item, index)
  316. },
  317. fail: (err) => {
  318. this.confirmorder(item, index)
  319. }
  320. })
  321. }
  322. }
  323. })
  324. },
  325. confirmorder: async function(item, index) {
  326. let res = await this.$request.post("/api/v1/order/orderCancel", {
  327. order_id: item.id
  328. })
  329. if (res.status == 0) {
  330. uni.showToast({
  331. title: "取消成功",
  332. icon: "none"
  333. })
  334. this.ordersList.splice(index, 1)
  335. } else {
  336. uni.showModal({
  337. title: "提示",
  338. content: res.message,
  339. showCancel: false,
  340. success: (res) => {}
  341. })
  342. }
  343. },
  344. loadMore() {
  345. this.getordersList()
  346. },
  347. refresh() {
  348. this.pageindex = 1
  349. this.ordersList = []
  350. this.getordersList()
  351. },
  352. evaluate(item, index) {
  353. this.showpinjia = true
  354. this.currentorder = item
  355. this.evaluateindex = index
  356. },
  357. determinepop: async function() {
  358. let res = await this.$request.post("/api/v1/evaluate/sumbitEvaluate", {
  359. order_id: this.currentorder.id,
  360. docter_id: this.currentorder.docter_id,
  361. score: this.ratevalue,
  362. content: this.content
  363. })
  364. console.log(res)
  365. if (res.status == 0) {
  366. uni.showToast({
  367. title: "评价成功",
  368. icon: "none",
  369. duration: 500
  370. })
  371. this.ordersList[this.evaluateindex].is_evaluate = 1
  372. setTimeout(() => {
  373. this.showpinjia = false
  374. }, 500)
  375. this.$forceUpdate()
  376. }
  377. },
  378. concelpop() {
  379. this.content = ""
  380. this.showpinjia = false
  381. },
  382. typechange(value) {
  383. this.value1 = value
  384. this.pageindex = 1
  385. this.ordersList = []
  386. this.getordersList()
  387. },
  388. paychange(value) {
  389. this.value2 = value
  390. this.pageindex = 1
  391. this.ordersList = []
  392. this.getordersList()
  393. },
  394. timechange(value) {
  395. this.value3 = value
  396. this.pageindex = 1
  397. this.ordersList = []
  398. this.getordersList()
  399. },
  400. getordersList: async function() {
  401. let res = await this.$request.post("/api/v1/order/orderList", {
  402. page: this.pageindex,
  403. list_type: this.value1,
  404. product_type: this.value1,
  405. order_status: this.value2,
  406. time_sort: this.value3
  407. }, false)
  408. if (res.status == 0) {
  409. // this.$refs.loadRefresh.loadOver()
  410. if (this.pageindex > res.data.last_page) {
  411. uni.showToast({
  412. title: "没有更多了",
  413. icon: "none"
  414. })
  415. } else {
  416. res.data.data.forEach((item, index) => {
  417. if (item.docter === null||item.product_type == 6||item.product_type == 5||item.product_type == 3) {
  418. res.data.data.splice(index, 1)
  419. }
  420. })
  421. // res.data.data.forEach((item, index) => {
  422. // if () {
  423. // res.data.data.splice(index, 1)
  424. // }
  425. // })
  426. // res.data.data.forEach((item, index) => {
  427. // if () {
  428. // res.data.data.splice(index, 1)
  429. // }
  430. // })
  431. res.data.data.forEach((item, index) => {
  432. if (item.product_type != 1 && item.product_type != 2) {
  433. res.data.data.splice(index, 1)
  434. }
  435. })
  436. // res.data.data.forEach((item, index) => {
  437. // if () {
  438. // res.data.data.splice(index, 1)
  439. // }
  440. // })
  441. console.log(res.data.data)
  442. this.pageindex++
  443. this.ordersList = this.ordersList.concat(res.data.data)
  444. // this.totalPage = res.data.last_page
  445. }
  446. }
  447. if (this.ordersList.length == 0) {
  448. this.show = true
  449. } else {
  450. this.show = false
  451. }
  452. },
  453. pinjia() {
  454. },
  455. goinfoorder(e) {
  456. uni.navigateTo({
  457. url: "consultingInfo?id=" + e.currentTarget.dataset.id
  458. })
  459. },
  460. gosuggest(item) {
  461. uni.navigateTo({
  462. url: "opinionInfo?id=" + item.suggest.id
  463. })
  464. },
  465. gotoeva() {
  466. uni.navigateTo({
  467. url: "../me_evaluate"
  468. })
  469. }
  470. }
  471. };
  472. </script>
  473. <style lang="scss">
  474. page {
  475. background-color: #fff;
  476. }
  477. .money {
  478. font-size: 80rpx;
  479. color: #fa3534;
  480. position: relative;
  481. .close {
  482. position: absolute;
  483. top: 20rpx;
  484. right: 20rpx;
  485. line-height: 28rpx;
  486. font-size: 28rpx;
  487. }
  488. }
  489. .tips {
  490. color: $u-tips-color;
  491. }
  492. .cancel {
  493. width: 240rpx;
  494. height: 78rpx;
  495. border-radius: 16rpx;
  496. border: 2rpx solid #0B73B9;
  497. color: #0B73B9;
  498. font-size: 32rpx;
  499. }
  500. .determine {
  501. width: 240rpx;
  502. height: 78rpx;
  503. background: #0B73B9;
  504. border-radius: 16rpx;
  505. color: #fff;
  506. font-size: 32rpx;
  507. }
  508. .textareastyle {
  509. width: 560rpx;
  510. height: 269rpx;
  511. padding: 25rpx;
  512. border: 1px solid #C0C0C0;
  513. border-radius: 16rpx;
  514. font-size: 28rpx;
  515. }
  516. .main {}
  517. .text_style {
  518. font-weight: 400;
  519. margin-left: 15rpx;
  520. background-color: #E5F5FF;
  521. color: #0B73B9;
  522. width: 120rpx;
  523. height: 28rpx;
  524. font-size: 20rpx;
  525. border-radius: 10rpx;
  526. text-align: center;
  527. align-items: center;
  528. }
  529. .nametaile {
  530. font-size: 30rpx;
  531. font-weight: 500;
  532. color: #333333;
  533. }
  534. .textstyle {
  535. font-size: 26rpx;
  536. color: #666666;
  537. font-weight: 400;
  538. }
  539. .phonezi {
  540. width: 160rpx;
  541. height: 54rpx;
  542. background: #F6F6F6;
  543. border-radius: 27rpx;
  544. font-size: 28rpx;
  545. font-family: PingFangSC-Regular, PingFang SC;
  546. font-weight: 400;
  547. color: #666666;
  548. display: flex;
  549. align-items: center;
  550. justify-content: center;
  551. }
  552. .jinxing {
  553. height: 30rpx;
  554. font-size: 30rpx;
  555. font-family: PingFangSC-Medium, PingFang SC;
  556. font-weight: 500;
  557. color: #EEAA3F;
  558. display: flex;
  559. align-items: center;
  560. }
  561. </style>