my_appointment.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  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(item, index) {
  146. uni.showModal({
  147. title: "提示",
  148. content: "确定要取消订单吗?",
  149. success: (res) => {
  150. if (res.confirm) {
  151. uni.requestSubscribeMessage({
  152. success: (res) => {
  153. this.confirmorder(item, index)
  154. },
  155. fail: (err) => {
  156. this.confirmorder(item, index)
  157. }
  158. })
  159. }
  160. }
  161. })
  162. },
  163. confirmorder: async function(item, index) {
  164. let res = await this.$request.post("/api/v1/order/orderCancel", {
  165. order_id: item.id
  166. })
  167. if (res.status == 0) {
  168. uni.showToast({
  169. title: "取消成功",
  170. icon: "none"
  171. })
  172. this.ordersList.splice(index, 1)
  173. } else {
  174. uni.showModal({
  175. title: "提示",
  176. content: res.message,
  177. showCancel: false,
  178. success: (res) => {}
  179. })
  180. }
  181. },
  182. gotoinfo(item) {
  183. uni.navigateTo({
  184. url: "appointmentInfo?id=" + item.id
  185. })
  186. },
  187. format(t) {
  188. let time = new Date(t);
  189. let str = time.getMonth() < 9 ? ('0' + (time.getMonth() + 1)) : (time.getMonth() + 1);
  190. str += '-';
  191. str += time.getDate() < 10 ? ('0' + time.getDate()) : time.getDate();
  192. str += ' ';
  193. str += time.getHours();
  194. str += ':';
  195. str += time.getMinutes() < 10 ? ('0' + time.getMinutes()) : time.getMinutes();
  196. return str;
  197. },
  198. typechange(value) {
  199. this.value1 = value
  200. if (value == 3) {
  201. this.textcontent = "门诊预约"
  202. } else if (value == 4) {
  203. this.textcontent = "计免预约"
  204. } else if (value == 5) {
  205. this.textcontent = "儿保预约"
  206. } else {
  207. this.textcontent = "全部预约"
  208. }
  209. this.pageindex = 1
  210. this.ordersList = []
  211. this.getordersList()
  212. },
  213. paychange(value) {
  214. this.value2 = value
  215. this.pageindex = 1
  216. this.ordersList = []
  217. this.getordersList()
  218. },
  219. timechange(value) {
  220. this.value3 = value
  221. this.pageindex = 1
  222. this.ordersList = []
  223. this.getordersList()
  224. },
  225. getordersList: async function() {
  226. let res = await this.$request.post("/api/v1/order/orderList", {
  227. page: this.pageindex,
  228. list_type: 2,
  229. product_type: this.value1,
  230. order_status: this.value2,
  231. time_sort: this.value3
  232. })
  233. console.log(this.value1)
  234. if (res.status == 0) {
  235. if (this.pageindex > res.data.last_page) {
  236. uni.showToast({
  237. title: "没有更多了",
  238. icon: "none"
  239. })
  240. } else {
  241. this.ordersList = this.ordersList.concat(res.data.data)
  242. this.pageindex++
  243. }
  244. }
  245. console.log(this.ordersList)
  246. if (this.ordersList.length == 0) {
  247. this.show = true
  248. } else {
  249. this.show = false
  250. }
  251. }
  252. }
  253. };
  254. </script>
  255. <style lang="scss">
  256. page {
  257. background-color: #fff;
  258. }
  259. .main {}
  260. .text_style {
  261. font-weight: 400;
  262. margin-left: 15rpx;
  263. background-color: #E5F5FF;
  264. color: #0B73B9;
  265. width: 100rpx;
  266. height: 28rpx;
  267. font-size: 20rpx;
  268. border-radius: 10rpx;
  269. text-align: center;
  270. align-items: center;
  271. }
  272. .nametaile {
  273. font-size: 30rpx;
  274. font-weight: 500;
  275. color: #333333;
  276. }
  277. .textstyle {
  278. font-size: 26rpx;
  279. color: #666666;
  280. font-weight: 400;
  281. }
  282. .phonezi {
  283. width: 160rpx;
  284. height: 54rpx;
  285. background: #F6F6F6;
  286. border-radius: 27rpx;
  287. font-size: 28rpx;
  288. font-family: PingFangSC-Regular, PingFang SC;
  289. font-weight: 400;
  290. color: #666666;
  291. display: flex;
  292. align-items: center;
  293. justify-content: center;
  294. }
  295. .jinxing {
  296. height: 30rpx;
  297. font-size: 30rpx;
  298. font-family: PingFangSC-Medium, PingFang SC;
  299. font-weight: 500;
  300. color: #EEAA3F;
  301. display: flex;
  302. align-items: center;
  303. }
  304. </style>