index.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. <template>
  2. <view class="order">
  3. <view class="bars">
  4. <view style="display: flex;">
  5. <view :class="orderType == ''?'bar-select':'bar'" @click="changeType('')">
  6. 全部
  7. <image v-if="orderType==''" :src="require('../../../static/sel.png')" alt="">
  8. </view>
  9. </view>
  10. <view style="display: flex;">
  11. <view :class="orderType == '2'?'bar-select':'bar'" @click="changeType('2')">
  12. 待服务
  13. <image v-if="orderType=='2'" :src="require('../../../static/sel.png')" alt="">
  14. </view>
  15. <span v-if="orderNum>0">{{orderNum}}</span>
  16. </view>
  17. <view style="display: flex;">
  18. <view :class="orderType == '4'?'bar-select':'bar'" @click="changeType('4')">
  19. 已取消
  20. <image v-if="orderType=='4'" :src="require('../../../static/sel.png')" alt="">
  21. </view>
  22. </view>
  23. <view style="display: flex;">
  24. <view :class="orderType == '3'?'bar-select':'bar'" @click="changeType('3')">
  25. 已完成
  26. <image v-if="orderType=='3'" :src="require('../../../static/sel.png')" alt="">
  27. </view>
  28. </view>
  29. </view>
  30. <view style="height: 80rpx;"></view>
  31. <view class="body" v-for="(item, index) in orderList" :key="index" @click="toPath(item)">
  32. <view class="header">
  33. <view class="orderId">
  34. 订单编号:{{item.orderNumber}}
  35. </view>
  36. <view class="orderType" :style="item.status==1 || item.status==2?'color: #005BFF;':'color: #666666;'">
  37. {{item.status==1?'待支付':item.status==2?'待服务':item.status==3?'已完成':item.status==4?'已取消':'进行中'}}
  38. <image :src="require('../../../static/choose.png')" alt="">
  39. </view>
  40. </view>
  41. <view class="carView">
  42. <image :src="baseImagePath+item.carLogo" alt="">
  43. <view class="carBody">
  44. <view class="carTitle">
  45. <image :src="require('../../../static/car.png')" alt="">
  46. <span>{{item.carNumber}}</span>
  47. <view class="border"></view>
  48. <span>{{item.carMadelLevel}}</span>
  49. <view class="border"></view>
  50. <span>{{item.carWashType}}</span>
  51. </view>
  52. <view class="content">
  53. {{item.carTypeName}}
  54. </view>
  55. </view>
  56. </view>
  57. <view class="shop">
  58. <image :src="require('../../../static/shop.png')" alt="">
  59. <view style="padding-left: 16rpx;">
  60. 门店:{{item.shopName}}
  61. </view>
  62. </view>
  63. <view class="times" :style="item.orderType==2?'border-bottom: 1px solid #EEEEEE;':''">
  64. <image :src="require('../../../static/time.png')" alt="">
  65. <view style="padding-left: 16rpx;">
  66. 时间:{{item.time}}
  67. </view>
  68. </view>
  69. <view v-if="item.status==3 && item.isEvaluate == 2">
  70. <view class="buttomBtn" @click.stop="toEvaluation(item.id)">
  71. 评价
  72. </view>
  73. </view>
  74. </view>
  75. </view>
  76. </template>
  77. <script>
  78. import {
  79. carwashOrderList
  80. } from "@/api/carWash.js"
  81. const app = getApp();
  82. export default {
  83. components: {},
  84. data: function() {
  85. return {
  86. requestStatus: false,
  87. baseImagePath: this.baseImagePath,
  88. orderNum: null,
  89. orderType: "",
  90. orderList: [],
  91. pageNo: 1,
  92. pageSize: 20,
  93. }
  94. },
  95. onReachBottom() {
  96. let that = this
  97. that.pageNo++
  98. this.getPage()
  99. },
  100. onLoad(e) {
  101. app.globalData.requestToken = e.token;
  102. uni.setStorageSync('token', e.token)
  103. },
  104. onShow() {
  105. this.pageNo = 1
  106. this.getPage(1)
  107. },
  108. onBackPress(options) {
  109. console.log('11111');
  110. // 这里可以自定义返回逻辑,比如下面跳转其他页面
  111. // #ifdef APP-PLUS
  112. if (plus.os.name.toLowerCase() === 'android') {
  113. plus.runtime.quit();
  114. } else {
  115. plus.runtime.quit();
  116. }
  117. // #endif
  118. // return true 表示禁止默认返回
  119. return true;
  120. },
  121. methods: {
  122. changeType(val) {
  123. this.orderType = val;
  124. this.pageNo = 1;
  125. this.getPage(1);
  126. },
  127. getPage(val) {
  128. let data = {
  129. status: this.orderType,
  130. pageNo: this.pageNo,
  131. pageSize: this.pageSize
  132. }
  133. let that = this;
  134. carwashOrderList(data).then((res) => {
  135. console.log(res);
  136. that.orderNum = res.data.beServiceNum;
  137. if (val == 1) {
  138. that.orderList = [];
  139. }
  140. that.orderList = that.orderList.concat(res.data.carWashOrderListVO.rows)
  141. })
  142. },
  143. toPath(item) {
  144. console.log('订单详情', item);
  145. this.$yrouter.push({
  146. path: "/pages/preCarWash/washOrder/orderDetail/index?data=" + encodeURIComponent(JSON
  147. .stringify(item))
  148. });
  149. },
  150. toEvaluation(id) {
  151. if (this.requestStatus) {
  152. // 利用 return 终止函数继续运行
  153. return false;
  154. console.log(1);
  155. }
  156. this.$yrouter.push({
  157. path: "/pages/preCarWash/washOrder/serviceEvaluation/index?type=3&detailId=" + id
  158. });
  159. console.log('按钮点击函数执行');
  160. // 执行函数
  161. this.requestStatus = true;
  162. setTimeout(() => {
  163. // 模拟执行完毕
  164. // 改变 requestStatus
  165. this.requestStatus = false;
  166. }, 1000);
  167. }
  168. }
  169. }
  170. </script>
  171. <style lang="less">
  172. page {
  173. background: #F5F5F5;
  174. }
  175. .order {
  176. .bars {
  177. width: 100%;
  178. height: 80rpx;
  179. background: #FFFFFF;
  180. box-shadow: 0px 1px 0px 0px rgba(55, 55, 55, 0.1);
  181. display: flex;
  182. justify-content: space-around;
  183. align-items: center;
  184. position: fixed;
  185. top: 0;
  186. z-index: 999;
  187. .bar {
  188. display: flex;
  189. flex-direction: column;
  190. align-items: center;
  191. font-size: 28rpx;
  192. font-family: PingFang SC;
  193. font-weight: 500;
  194. color: #666666;
  195. background-color: #FFFFFF;
  196. }
  197. span {
  198. font-size: 22rpx;
  199. font-family: PingFang SC;
  200. font-weight: 500;
  201. color: #005BFF;
  202. padding-left: 12rpx;
  203. }
  204. }
  205. .bar-select {
  206. display: flex;
  207. flex-direction: column;
  208. align-items: center;
  209. font-size: 28rpx;
  210. font-family: PingFang SC;
  211. font-weight: bold;
  212. color: #333333;
  213. image {
  214. width: 34rpx;
  215. height: 11rpx;
  216. }
  217. }
  218. .body {
  219. background: #FFFFFF;
  220. border-radius: 10rpx;
  221. margin: 20rpx;
  222. padding: 30rpx;
  223. .header {
  224. display: flex;
  225. justify-content: space-between;
  226. border-bottom: 1rpx solid #EEEEEE;
  227. padding-bottom: 30rpx;
  228. .orderId {
  229. font-size: 26rpx;
  230. font-family: PingFang SC;
  231. font-weight: 500;
  232. color: #999999;
  233. line-height: 34rpx;
  234. }
  235. .orderType {
  236. display: flex;
  237. align-items: center;
  238. font-size: 26rpx;
  239. font-family: PingFang SC;
  240. font-weight: 500;
  241. line-height: 34rpx;
  242. image {
  243. padding-left: 8rpx;
  244. width: 11rpx;
  245. height: 18rpx;
  246. }
  247. }
  248. }
  249. .carView {
  250. display: flex;
  251. image {
  252. width: 120rpx;
  253. height: 120rpx;
  254. background: #FFFFFF;
  255. border: 2rpx solid #F4F4F4;
  256. border-radius: 8rpx;
  257. margin-top: 32rpx;
  258. }
  259. .carBody {
  260. padding: 32rpx;
  261. .carTitle {
  262. display: flex;
  263. image {
  264. width: 33rpx;
  265. height: 27rpx;
  266. margin-top: 0rpx;
  267. }
  268. .border {
  269. width: 1px;
  270. height: 20rpx;
  271. background: #DBDBDB;
  272. }
  273. span {
  274. font-size: 30rpx;
  275. font-family: PingFang SC;
  276. font-weight: bold;
  277. color: #333333;
  278. line-height: 31rpx;
  279. padding: 0 15rpx 0 15rpx;
  280. white-space: nowrap;
  281. }
  282. }
  283. .content {
  284. font-size: 26rpx;
  285. font-family: PingFang SC;
  286. font-weight: 500;
  287. color: #666666;
  288. line-height: 34rpx;
  289. padding: 20rpx 60rpx 20rpx 0;
  290. }
  291. }
  292. }
  293. .shop {
  294. display: flex;
  295. align-items: center;
  296. font-size: 26rpx;
  297. font-family: PingFang SC;
  298. font-weight: 500;
  299. color: #333333;
  300. line-height: 34rpx;
  301. image {
  302. width: 30rpx;
  303. height: 26rpx;
  304. }
  305. }
  306. .times {
  307. display: flex;
  308. align-items: center;
  309. font-size: 26rpx;
  310. font-family: PingFang SC;
  311. font-weight: 500;
  312. color: #333333;
  313. line-height: 34rpx;
  314. margin-top: 31rpx;
  315. padding-bottom: 30rpx;
  316. image {
  317. width: 30rpx;
  318. height: 26rpx;
  319. }
  320. }
  321. .buttomBtn {
  322. width: 148rpx;
  323. height: 56rpx;
  324. background: #FFFFFF;
  325. border: 1px solid #003EFF;
  326. border-radius: 28rpx;
  327. font-size: 26rpx;
  328. font-family: PingFang SC;
  329. font-weight: 500;
  330. color: #0051FF;
  331. line-height: 56rpx;
  332. text-align: center;
  333. margin: 26rpx 31rpx 0 74%;
  334. }
  335. }
  336. }
  337. </style>