index.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  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. onShow() {
  136. // console.log(getUserLocalStorageInfo().user.id);
  137. this.searchData.bizId = getUserLocalStorageInfo().biz.id;
  138. this.list = [];
  139. this.reservationBizListPage();
  140. },
  141. onReachBottom() {
  142. // 触底加载更多
  143. this.searchData.pageNum += 1;
  144. this.reservationBizListPage();
  145. },
  146. methods: {
  147. async cancelRow(e) {
  148. let that = this;
  149. console.log(e);
  150. // cancelReservation
  151. wx.showModal({
  152. title: "提示!",
  153. content: "是否取消该预约",
  154. success: async function (res) {
  155. if (res.confirm) {
  156. let data = await cancelReservation({
  157. id: e.id,
  158. userId: getUserLocalStorageInfo().user.id,
  159. });
  160. if (data.errmsg == "成功") {
  161. that.$showToast("取消成功");
  162. that.searchData.pageNum = 1;
  163. that.list = [];
  164. that.reservationBizListPage();
  165. }
  166. }
  167. },
  168. });
  169. },
  170. onChange(e) {
  171. console.log(e);
  172. this.list = [];
  173. let statusList = {
  174. 0: 0,
  175. 1: 1,
  176. 2: 2,
  177. 3: 3,
  178. 4: 4,
  179. 5: 5,
  180. 6: "",
  181. };
  182. this.searchData.status = statusList[e.detail.index];
  183. this.reservationBizListPage();
  184. },
  185. async reservationBizListPage() {
  186. let { data } = await reservationBizListPage(this.searchData);
  187. console.log(data);
  188. if (this.list.length != data.total) {
  189. this.list.push(...data.list);
  190. }
  191. },
  192. nowTimeCheck(yyTime, status) {
  193. const timeString = `${yyTime} 08`.replaceAll("-", "/");
  194. const fullTimeString = `${timeString}:00:00`;
  195. // console.log(fullTimeString);
  196. const date = new Date(fullTimeString);
  197. const timestamp = date.getTime();
  198. // 预约日期的当天八点时间戳
  199. // console.log(Date.now() < timestamp && status == 0);
  200. // console.log(timestamp);
  201. console.log(Date.now() < timestamp && status == 0)
  202. if (Date.now() < timestamp && status == 0) {
  203. return true;
  204. }
  205. },
  206. jumpPage(path) {
  207. console.log(path);
  208. uni.navigateTo({
  209. url: path,
  210. fail: (fail) => {},
  211. });
  212. },
  213. },
  214. };
  215. </script>
  216. <style lang="scss">
  217. .yy_history {
  218. .list {
  219. .list-item {
  220. padding: 24rpx 32rpx;
  221. background: #ffffff;
  222. position: relative;
  223. margin-top: 24rpx;
  224. .foot-btn {
  225. display: flex;
  226. justify-content: flex-end;
  227. padding-top: 16rpx;
  228. .van-button {
  229. border-radius: 30rpx 30rpx 30rpx 30rpx;
  230. }
  231. }
  232. .bottborder {
  233. padding-bottom: 24rpx;
  234. border-bottom: 2rpx solid #e8edf5;
  235. }
  236. .info {
  237. font-weight: 400;
  238. font-size: 28rpx;
  239. color: #333333;
  240. }
  241. .info1 {
  242. margin-top: 8rpx;
  243. font-weight: 400;
  244. font-size: 28rpx;
  245. color: #666666;
  246. }
  247. .qxrq {
  248. color: rgba(142, 139, 228, 1);
  249. }
  250. .time {
  251. font-weight: 400;
  252. font-size: 32rpx;
  253. color: #333333;
  254. margin-bottom: 8rpx;
  255. }
  256. .status {
  257. width: 144rpx;
  258. height: 56rpx;
  259. text-align: center;
  260. line-height: 56rpx;
  261. border-top-right-radius: 5%;
  262. border-bottom-left-radius: 50%;
  263. position: absolute;
  264. top: -1rpx;
  265. right: 0;
  266. font-weight: 400;
  267. font-size: 28rpx;
  268. }
  269. .qd {
  270. background: rgba(3, 101, 249, 0.2);
  271. color: #0365f9;
  272. }
  273. .rc {
  274. background: rgba(255, 184, 0, 0.3);
  275. color: #d99f00;
  276. }
  277. .zx {
  278. background: rgba(138, 5, 84, 0.2);
  279. color: #8a0554;
  280. }
  281. .wc {
  282. background: rgba(34, 181, 101, 0.2);
  283. color: #22b565;
  284. }
  285. .gq {
  286. color: #c7191f;
  287. background: rgba(199, 25, 31, 0.2);
  288. }
  289. .qx {
  290. color: #888888;
  291. background: rgba(136, 136, 136, 0.3);
  292. }
  293. }
  294. }
  295. }
  296. </style>