index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. <template>
  2. <div class="yy_history">
  3. <van-tabs :active="active" color="rgba(138, 5, 84, 1)" @change="onChange">
  4. <van-tab title="待签到"></van-tab>
  5. <van-tab title="待入厂"></van-tab>
  6. <van-tab title="装卸中"></van-tab>
  7. <van-tab title="已完成"></van-tab>
  8. <van-tab title="已过期"></van-tab>
  9. <van-tab title="已取消"></van-tab>
  10. <van-tab title="全部"></van-tab>
  11. </van-tabs>
  12. <div class="list">
  13. <div class="list-item" v-for="item in list" :key="item.id">
  14. <div class="status qd" v-if="item.status == 0">待签到</div>
  15. <div class="status rc" v-if="item.status == 1">待入厂</div>
  16. <div class="status zx" v-if="item.status == 2">装卸中</div>
  17. <div class="status wc" v-if="item.status == 3">已完成</div>
  18. <div class="status gq" v-if="item.status == 4">已过期</div>
  19. <div class="status qx" v-if="item.status == 5">已取消</div>
  20. <div
  21. class="time"
  22. @click="
  23. jumpPage('/pages/subPackages/sj_history/detail?id=' + item.id)
  24. "
  25. >
  26. {{ item.reservationDate }}
  27. {{ item.timeStart + "~" + item.timeEnd }} {{ item.loadType }}
  28. </div>
  29. <div
  30. @click="
  31. jumpPage('/pages/subPackages/sj_history/detail?id=' + item.id)
  32. "
  33. class="info"
  34. >
  35. {{ item.loadNum }}个托盘
  36. </div>
  37. <div
  38. @click="
  39. jumpPage('/pages/subPackages/sj_history/detail?id=' + item.id)
  40. "
  41. class="info1"
  42. >
  43. 车辆:{{ item.carNo }}/{{ item.carType }}
  44. </div>
  45. <div
  46. @click="
  47. jumpPage('/pages/subPackages/sj_history/detail?id=' + item.id)
  48. "
  49. class="info1"
  50. >
  51. 司机:{{ item.driverName }}
  52. </div>
  53. <div
  54. @click="
  55. jumpPage('/pages/subPackages/sj_history/detail?id=' + item.id)
  56. "
  57. class="info1"
  58. v-if="item.createUser"
  59. >
  60. 预约账号:{{ item.createUser }}
  61. </div>
  62. <div
  63. @click="
  64. jumpPage('/pages/subPackages/sj_history/detail?id=' + item.id)
  65. "
  66. v-if="item.status == 5"
  67. class="info1 qxrq"
  68. >
  69. 取消日期:{{ item.cancelTime }}
  70. </div>
  71. <div class="bottborder"></div>
  72. <div class="foot-btn" v-if="item.status == 0">
  73. <van-button
  74. color="rgba(138, 5, 84, 1)"
  75. plain
  76. type="default"
  77. size="small"
  78. @click="cancelRow(item)"
  79. v-if="nowTimeCheck(item.reservationDate, item.status)"
  80. >取消</van-button
  81. >
  82. <van-button
  83. style="margin-left: 24rpx"
  84. color="rgba(138, 5, 84, 1)"
  85. type="default"
  86. size="small"
  87. v-if="nowTimeCheck(item.reservationDate, item.status)"
  88. @click="
  89. jumpPage('/pages/subPackages/yy_history/edit?id=' + item.id)
  90. "
  91. >修改</van-button
  92. >
  93. <van-button
  94. style="margin-left: 24rpx"
  95. color="rgba(138, 5, 84, 1)"
  96. type="default"
  97. size="small"
  98. @click="
  99. jumpPage('/pages/subPackages/yy_history/code?id=' + item.id)
  100. "
  101. >签到码</van-button
  102. >
  103. </div>
  104. <div class="foot-btn" v-if="item.status == 2">
  105. <van-button
  106. style="margin-left: 24rpx"
  107. color="rgba(138, 5, 84, 1)"
  108. type="default"
  109. size="small"
  110. @click="
  111. jumpPage('/pages/subPackages/yy_history/code?id=' + item.id)
  112. "
  113. >签退码</van-button
  114. >
  115. </div>
  116. </div>
  117. </div>
  118. </div>
  119. </template>
  120. <script>
  121. import { reservationBizListPage, cancelReservation } from "@/js_sdk/sjTools.js";
  122. import { getUserLocalStorageInfo } from "@/js_sdk/localUserInfo.js";
  123. export default {
  124. data() {
  125. return {
  126. searchData: {
  127. pageNum: 1,
  128. pageSize: 10,
  129. status: 0,
  130. },
  131. total: 0,
  132. list: [],
  133. };
  134. },
  135. onLoad() {
  136. // console.log(getUserLocalStorageInfo().user.id);
  137. this.searchData.bizId = getUserLocalStorageInfo().biz.id;
  138. this.reservationBizListPage();
  139. },
  140. onReachBottom() {
  141. // 触底加载更多
  142. this.searchData.pageNum += 1;
  143. this.reservationBizListPage();
  144. },
  145. methods: {
  146. async cancelRow(e) {
  147. let that = this;
  148. console.log(e);
  149. // cancelReservation
  150. wx.showModal({
  151. title: "提示!",
  152. content: "是否取消该预约",
  153. success: async function (res) {
  154. if (res.confirm) {
  155. let data = await cancelReservation({
  156. id: e.id,
  157. userId: getUserLocalStorageInfo().user.id,
  158. });
  159. if (data.errmsg == "成功") {
  160. that.$showToast("取消成功");
  161. that.searchData.pageNum = 1;
  162. that.list = [];
  163. that.reservationBizListPage();
  164. }
  165. }
  166. },
  167. });
  168. },
  169. onChange(e) {
  170. console.log(e);
  171. this.list = [];
  172. let statusList = {
  173. 0: 0,
  174. 1: 1,
  175. 2: 2,
  176. 3: 3,
  177. 4: 4,
  178. 5: 5,
  179. 6: "",
  180. };
  181. this.searchData.status = statusList[e.detail.index];
  182. this.reservationBizListPage();
  183. },
  184. async reservationBizListPage() {
  185. let { data } = await reservationBizListPage(this.searchData);
  186. console.log(data);
  187. if (this.list.length != data.total) {
  188. this.list.push(...data.list);
  189. }
  190. },
  191. nowTimeCheck(yyTime, status) {
  192. const timeString = `${yyTime} 08`.replaceAll("-", "/");
  193. const fullTimeString = `${timeString}:00:00`;
  194. // console.log(fullTimeString);
  195. const date = new Date(fullTimeString);
  196. const timestamp = date.getTime();
  197. // 预约日期的当天八点时间戳
  198. // console.log(Date.now() < timestamp && status == 0);
  199. // console.log(timestamp);
  200. if (Date.now() < timestamp && status == 0) {
  201. return true;
  202. }
  203. },
  204. jumpPage(path) {
  205. console.log(path);
  206. uni.navigateTo({
  207. url: path,
  208. fail: (fail) => {},
  209. });
  210. },
  211. },
  212. };
  213. </script>
  214. <style lang="scss">
  215. .yy_history {
  216. .list {
  217. .list-item {
  218. padding: 24rpx 32rpx;
  219. background: #ffffff;
  220. position: relative;
  221. margin-top: 24rpx;
  222. .foot-btn {
  223. display: flex;
  224. justify-content: flex-end;
  225. padding-top: 16rpx;
  226. .van-button {
  227. border-radius: 30rpx 30rpx 30rpx 30rpx;
  228. }
  229. }
  230. .bottborder {
  231. padding-bottom: 24rpx;
  232. border-bottom: 2rpx solid #e8edf5;
  233. }
  234. .info {
  235. font-weight: 400;
  236. font-size: 28rpx;
  237. color: #333333;
  238. }
  239. .info1 {
  240. margin-top: 8rpx;
  241. font-weight: 400;
  242. font-size: 28rpx;
  243. color: #666666;
  244. }
  245. .qxrq {
  246. color: rgba(142, 139, 228, 1);
  247. }
  248. .time {
  249. font-weight: 400;
  250. font-size: 32rpx;
  251. color: #333333;
  252. margin-bottom: 8rpx;
  253. }
  254. .status {
  255. width: 144rpx;
  256. height: 56rpx;
  257. text-align: center;
  258. line-height: 56rpx;
  259. border-top-right-radius: 5%;
  260. border-bottom-left-radius: 50%;
  261. position: absolute;
  262. top: -1rpx;
  263. right: 0;
  264. font-weight: 400;
  265. font-size: 28rpx;
  266. }
  267. .qd {
  268. background: rgba(3, 101, 249, 0.2);
  269. color: #0365f9;
  270. }
  271. .rc {
  272. background: rgba(255, 184, 0, 0.3);
  273. color: #d99f00;
  274. }
  275. .zx {
  276. background: rgba(138, 5, 84, 0.2);
  277. color: #8a0554;
  278. }
  279. .wc {
  280. background: rgba(34, 181, 101, 0.2);
  281. color: #22b565;
  282. }
  283. .gq {
  284. color: #c7191f;
  285. background: rgba(199, 25, 31, 0.2);
  286. }
  287. .qx {
  288. color: #888888;
  289. background: rgba(136, 136, 136, 0.3);
  290. }
  291. }
  292. }
  293. }
  294. </style>