my_consulting.vue 18 KB

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