appointmentHistory.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <template>
  2. <div class="historyListBody">
  3. <div class="historyItem" v-for="item in historyList">
  4. <div class="tags">{{item.resourceTypeStr}}</div>
  5. <div class="historyItemTitle">{{item.subject}}</div>
  6. <div class="historyItemInfo">使用日期:{{item.useTime}}</div>
  7. <div class="historyItemInfo">资源名称:{{item.resourceName}}</div>
  8. <div class="historyItemInfo">位置:{{item.position}}</div>
  9. <div class="historyItemInfo">预约时间:{{item.appointTime}}</div>
  10. <div class="historyItemBottom">
  11. <span class="typeInfo" :class="item.stateStr==='已通过'?'tgType':item.stateStr==='已取消'?'qxType':''">{{item.stateStr}}</span>
  12. <button @tap="toAdd(item)" class="btn" :class="item.stateStr==='暂存'?'zcBtn':''" v-if="item.stateStr !=='已取消'">{{item.stateStr==='暂存'?'编辑':'取消'}}</button>
  13. </div>
  14. <div v-if="item.stateStr==='已取消'" class="historyItemInfo">{{item.cancelReason}}</div>
  15. </div>
  16. <van-dialog
  17. use-slot
  18. title="取消预约"
  19. :show="show"
  20. show-cancel-button
  21. confirm-button-open-type="getUserInfo"
  22. @confirm="confirm"
  23. @cancel="show=false"
  24. >
  25. <div class="dialogBox">
  26. <van-field
  27. :value="content"
  28. autosize
  29. type="textarea"
  30. placeholder="请输入取消原因"
  31. class="myField2"
  32. maxlength="800"
  33. show-word-limit
  34. @change="changeMsg"
  35. />
  36. </div>
  37. </van-dialog>
  38. </div>
  39. </template>
  40. <script>
  41. import {getByCodes, getMeetingAppointListApp, getUserLocalStorageInfo, cancelAppoint} from "@/js_sdk/http";
  42. export default {
  43. name: "appointmentHistory",
  44. data(){
  45. return{
  46. content:'',
  47. show:false,
  48. getUserLocalStorageInfo: getUserLocalStorageInfo(),
  49. historyList:[
  50. {stateStr:'审核中'},
  51. {stateStr:'已通过'},
  52. {stateStr:'已取消'},
  53. {stateStr:'暂存'},
  54. ],
  55. id: ''
  56. }
  57. },
  58. created() {
  59. this.getList()
  60. },
  61. onShow() {
  62. this.getList()
  63. },
  64. onLoad(options) {
  65. this.getList()
  66. },
  67. methods:{
  68. changeMsg(e){
  69. this.content = e.detail
  70. },
  71. getList() {
  72. const _this = this
  73. _this.historyList = []
  74. const data = {
  75. pageNum : 1,
  76. pageSize : 100,
  77. createdId : getUserLocalStorageInfo().userId,
  78. states: '1,5,6,7'
  79. }
  80. getMeetingAppointListApp(data).then(res => {
  81. if (res.data) {
  82. res.data.forEach(function (item) {
  83. const jsonMap = _this.getItemJson(item)
  84. _this.historyList.push(jsonMap)
  85. })
  86. }
  87. })
  88. },
  89. getItemJson(item) {
  90. return item
  91. },
  92. toAdd(data) {
  93. if(data.stateStr == '暂存'){
  94. uni.navigateTo({
  95. url: '/pages/subPackages/resourceReservation_manage/edit?id=' + data.id
  96. })
  97. }else if(data.stateStr == '审核中'){
  98. this.show = true
  99. this.id = data.id
  100. }
  101. },
  102. confirm(e){
  103. console.log(this.content)
  104. const data = {
  105. id: this.id,
  106. cancelReason: this.content
  107. }
  108. cancelAppoint(data).then(res => {
  109. if (res.code == '200') {
  110. this.getList()
  111. }
  112. }).catch(err=>{
  113. this.$showToast(err);
  114. })
  115. }
  116. }
  117. }
  118. </script>
  119. <style lang="scss">
  120. .historyListBody{
  121. margin-top: 24rpx;
  122. display: flex;
  123. flex-direction: column;
  124. align-items: center;
  125. padding-bottom: 100rpx;
  126. .historyItem{
  127. width: 686rpx;
  128. padding: 24rpx 0;
  129. background: white;
  130. box-sizing: border-box;
  131. position: relative;
  132. border-radius: 16rpx;
  133. margin-bottom: 24rpx;
  134. .tags{
  135. width: 148rpx;
  136. height: 56rpx;
  137. position: absolute;
  138. top: 0;
  139. right: 0;
  140. display: flex;
  141. align-items: center;
  142. justify-content: center;
  143. font-size: 26rpx;
  144. color: rgba(3, 101, 249, 1);
  145. background: url('https://www.idea-sf.com/gardenProduct/image/bj04.png') no-repeat;
  146. background-size: 100%;
  147. }
  148. .historyItemTitle{
  149. padding: 8rpx 32rpx;
  150. width: 480rpx;
  151. color: rgba(34, 34, 34, 1);
  152. font-size: 32rpx;
  153. line-height: 40rpx;
  154. font-weight: 500;
  155. }
  156. .historyItemInfo{
  157. color: rgba(102, 102, 102, 1);
  158. font-size: 28rpx;
  159. padding: 10rpx 32rpx;
  160. }
  161. .historyItemBottom{
  162. display: flex;
  163. justify-content: space-between;
  164. align-items: center;
  165. padding: 28rpx 32rpx 0 32rpx;
  166. border-top: 1px solid rgba(232, 237, 245, 1);
  167. margin-top: 22rpx;
  168. .typeInfo{
  169. font-size: 28rpx;
  170. color: rgba(226, 81, 0, 1);
  171. }
  172. .tgType{
  173. color: rgba(3, 101, 249, 1);
  174. }
  175. .qxType{
  176. color:rgba(242, 25, 18, 1);
  177. }
  178. .btn{
  179. display: flex;
  180. align-items: center;
  181. justify-content: center;
  182. font-size: 28rpx;
  183. width: 160rpx;
  184. height: 60rpx;
  185. border-radius: 32rpx;
  186. border: 2rpx solid rgba(255, 107, 24, 1);
  187. color:rgba(255, 107, 24, 1);
  188. &::after{
  189. border: none;
  190. }
  191. }
  192. .zcBtn{
  193. background: linear-gradient( 316deg, #84AAFF 0%, #0365F9 100%);
  194. color: white;
  195. border: none;
  196. }
  197. }
  198. }
  199. }
  200. .dialogBox{
  201. padding: 32rpx;
  202. }
  203. .myField2 {
  204. .van-cell{
  205. background: #F5F7FA !important;
  206. border-radius: 8rpx;
  207. font-size: 28rpx;
  208. }
  209. }
  210. </style>