my_appointment.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <template>
  2. <view class="main bg-white">
  3. <u-dropdown>
  4. <u-dropdown-item v-model="value1" :title="textcontent" @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. <view class="margin-lr-sm bg-white">
  9. <view class="margin-top-sm" @click="gotoinfo(item)" v-for="(item,index) in ordersList" :key="index" style="border-radius: 16rpx;box-shadow: 0 0 50rpx 0 rgba(0, 0, 0, 0.1);">
  10. <view class="flex justify-between align-center bg-white" style="padding: 28rpx;border-radius: 16rpx;">
  11. <view class="jinxing">
  12. <text style="display: inline-block;width: 12rpx;height: 12rpx;border-radius: 50%;background-color:#EEAA3F;margin-right: 8rpx;"></text>
  13. <text v-if="item.order_status==3">进行中</text>
  14. <text v-else-if="item.order_status==1">未支付</text>
  15. <text v-else-if="item.order_status==2">待接单</text>
  16. <text v-else-if="item.order_status==4">已完成</text>
  17. <text v-else-if="item.order_status==5">已取消</text>
  18. <text v-else-if="item.order_status==6">已超时</text>
  19. <text v-else-if="item.order_status==7">已预约</text>
  20. </view>
  21. <text class="phonezi" v-if="item.product_type==3">门诊预约</text>
  22. <text class="phonezi" v-else-if="item.product_type==4">计免预约</text>
  23. <text class="phonezi" v-else>儿保预约</text>
  24. </view>
  25. <view class="" style="background: #FBFBFB;padding: 28rpx; border-radius: 16rpx;">
  26. <view class="nametaile flex align-center">
  27. <!-- <u-avatar v-if="item.product_type==3" :src="item.docter.avatar" mode="circle"></u-avatar> -->
  28. <!-- <u-avatar v-else :src="item.organization.docter[0].avatar" mode="circle"></u-avatar> -->
  29. <text v-if="item.product_type==3" class="">预约地址:{{item.organization.address}}</text>
  30. <text v-else class="">预约地址:{{item.organization.address}}</text>
  31. <!-- <text class="text_style" v-for="(itm,idx) in item.docter.label_texts" :key="index">{{itm.label_name}}</text> -->
  32. </view>
  33. <!-- <view class="textstyle margin-top-xs flex align-center justify-between">
  34. <text style="color: #333333;" v-if="item.product_type==3">科室:{{item.docter.office.name||'暂无'}}
  35. {{item.docter.qualification.name||'暂无'}}</text>
  36. </view> -->
  37. <view class="textstyle margin-top-xs flex align-center justify-between" v-if="item.product_type == 3">
  38. <text style="color: #333333;">预约医生:{{item.docter.name}}</text>
  39. </view>
  40. <view class="textstyle margin-top-xs flex align-center justify-between" v-else-if="item.product_type == 4">
  41. <text style="color: #333333;">预约疫苗:{{item.order_vaccine.vaccine_name}}</text>
  42. </view>
  43. <view class="textstyle margin-top-xs flex align-center" v-else-if="item.product_type == 5">
  44. <text style="color: #333333;">儿保项目:</text>
  45. <view class="">
  46. <view class="" v-for="(itm,idx) in item.order_nurse" :key="idx">
  47. {{itm.nurse_name}}
  48. </view>
  49. </view>
  50. </view>
  51. <view class="textstyle margin-top-xs">
  52. <text style="color: #333333;">预约时间:{{format(item.order_patient.appoint_start_time*1000)+'至'+format(item.order_patient.appoint_end_time*1000)}}</text>
  53. </view>
  54. <view class="cu-bar bg-white tabbar" v-if="item.order_status==1||item.order_status==2||item.order_status==7" style="width: 100%;display: flex;justify-content: flex-end;">
  55. <u-button shape="circle" size="mini" @click="cancelOrder(item,index)" :ripple="true">取消订单</u-button>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. <u-empty text="暂无数据" mode="order" :show="show" margin-top="250"></u-empty>
  61. <view class="cu-tabbar-height"></view>
  62. <view class="cu-tabbar-height"></view>
  63. </view>
  64. </template>
  65. <script>
  66. export default {
  67. onLoad(options) {
  68. if (this.value1 == 0) {
  69. this.textcontent = "全部预约"
  70. }
  71. },
  72. mounted() {
  73. this.getordersList()
  74. console.log(this.value1)
  75. },
  76. data() {
  77. return {
  78. value1: 0, //全部类型
  79. value2: 0, //全部状态
  80. value3: 1, //时间正序
  81. options1: [{
  82. value: 0,
  83. label: "全部预约"
  84. },
  85. {
  86. value: 3,
  87. label: "门诊预约"
  88. },
  89. {
  90. value: 4,
  91. label: "计免预约"
  92. },
  93. {
  94. value: 5,
  95. label: "儿保预约"
  96. },
  97. ],
  98. options2: [{
  99. value: 0,
  100. label: "全部状态"
  101. },
  102. {
  103. value: 1,
  104. label: "未支付"
  105. },
  106. {
  107. value: 2,
  108. label: "待接单"
  109. },
  110. {
  111. value: 3,
  112. label: "进行中"
  113. },
  114. {
  115. value: 4,
  116. label: "已完成"
  117. },
  118. {
  119. value: 5,
  120. label: "已取消"
  121. },
  122. ],
  123. options3: [{
  124. value: 0,
  125. label: "时间正序"
  126. },
  127. {
  128. value: 1,
  129. label: "时间倒序"
  130. },
  131. ],
  132. ordersList: [],
  133. pageindex: 1,
  134. show: false,
  135. textcontent: ""
  136. }
  137. },
  138. onPullDownRefresh() {
  139. this.pageindex = 1
  140. this.ordersList = []
  141. this.getordersList()
  142. uni.stopPullDownRefresh()
  143. },
  144. methods: {
  145. cancelOrder: async function(item, index) {
  146. let res = await this.$request.post("/api/v1/order/orderCancel", {
  147. order_id: item.id
  148. })
  149. if (res.status == 0) {
  150. uni.showToast({
  151. title: "取消成功",
  152. icon: "none"
  153. })
  154. this.ordersList.splice(index, 1)
  155. }else{
  156. uni.showModal({
  157. title:"提示",
  158. content:res.message,
  159. showCancel:false,
  160. success: (res) => {
  161. }
  162. })
  163. }
  164. },
  165. gotoinfo(item) {
  166. uni.navigateTo({
  167. url: "appointmentInfo?id=" + item.id
  168. })
  169. },
  170. format(t) {
  171. let time = new Date(t);
  172. let str = time.getMonth() < 9 ? ('0' + (time.getMonth() + 1)) : (time.getMonth() + 1);
  173. str += '-';
  174. str += time.getDate() < 10 ? ('0' + time.getDate()) : time.getDate();
  175. str += ' ';
  176. str += time.getHours();
  177. str += ':';
  178. str += time.getMinutes() < 10 ? ('0' + time.getMinutes()) : time.getMinutes();
  179. return str;
  180. },
  181. typechange(value) {
  182. this.value1 = value
  183. if (value == 3) {
  184. this.textcontent = "门诊预约"
  185. } else if (value == 4) {
  186. this.textcontent = "计免预约"
  187. } else if (value == 5) {
  188. this.textcontent = "儿保预约"
  189. } else {
  190. this.textcontent = "全部预约"
  191. }
  192. this.pageindex = 1
  193. this.ordersList = []
  194. this.getordersList()
  195. },
  196. paychange(value) {
  197. this.value2 = value
  198. this.pageindex = 1
  199. this.ordersList = []
  200. this.getordersList()
  201. },
  202. timechange(value) {
  203. this.value3 = value
  204. this.pageindex = 1
  205. this.ordersList = []
  206. this.getordersList()
  207. },
  208. getordersList: async function() {
  209. let res = await this.$request.post("/api/v1/order/orderList", {
  210. page: this.pageindex,
  211. list_type: 2,
  212. product_type: this.value1,
  213. order_status: this.value2,
  214. time_sort: this.value3
  215. })
  216. console.log(this.value1)
  217. if (res.status == 0) {
  218. if (this.pageindex > res.data.last_page) {
  219. uni.showToast({
  220. title: "没有更多了",
  221. icon: "none"
  222. })
  223. } else {
  224. this.ordersList = this.ordersList.concat(res.data.data)
  225. this.pageindex++
  226. }
  227. }
  228. console.log(this.ordersList)
  229. if (this.ordersList.length == 0) {
  230. this.show = true
  231. } else {
  232. this.show = false
  233. }
  234. }
  235. }
  236. };
  237. </script>
  238. <style lang="scss">
  239. page {
  240. background-color: #fff;
  241. }
  242. .main {}
  243. .text_style {
  244. font-weight: 400;
  245. margin-left: 15rpx;
  246. background-color: #E5F5FF;
  247. color: #0B73B9;
  248. width: 100rpx;
  249. height: 28rpx;
  250. font-size: 20rpx;
  251. border-radius: 10rpx;
  252. text-align: center;
  253. align-items: center;
  254. }
  255. .nametaile {
  256. font-size: 30rpx;
  257. font-weight: 500;
  258. color: #333333;
  259. }
  260. .textstyle {
  261. font-size: 26rpx;
  262. color: #666666;
  263. font-weight: 400;
  264. }
  265. .phonezi {
  266. width: 160rpx;
  267. height: 54rpx;
  268. background: #F6F6F6;
  269. border-radius: 27rpx;
  270. font-size: 28rpx;
  271. font-family: PingFangSC-Regular, PingFang SC;
  272. font-weight: 400;
  273. color: #666666;
  274. display: flex;
  275. align-items: center;
  276. justify-content: center;
  277. }
  278. .jinxing {
  279. height: 30rpx;
  280. font-size: 30rpx;
  281. font-family: PingFangSC-Medium, PingFang SC;
  282. font-weight: 500;
  283. color: #EEAA3F;
  284. display: flex;
  285. align-items: center;
  286. }
  287. </style>