my_consulting.vue 17 KB

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