index.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  1. <template>
  2. <view class="maintainOrder">
  3. <!-- header bar -->
  4. <view class="header">
  5. <view class="bars">
  6. <view :class="orderType == 1?'bar-select':'bar'" style="border-right: 1px solid #E6E6E6;"
  7. @click="changeOrderType(1)">
  8. 进行中
  9. </view>
  10. <image v-if="orderType==1" :src="require('../../../static/sel.png')" alt="">
  11. </view>
  12. <view class="bars">
  13. <view :class="orderType == 0?'bar-select':'bar'" style="border-right: 1px solid #E6E6E6;"
  14. @click="changeOrderType(0)">
  15. 已取消
  16. </view>
  17. <image v-if="orderType==0" :src="require('../../../static/sel.png')" alt="">
  18. </view>
  19. <view class="bars">
  20. <view :class="orderType == 6?'bar-select':'bar'" @click="changeOrderType(6)">
  21. 已完成
  22. </view>
  23. <image v-if="orderType==6" :src="require('../../../static/sel.png')" alt="">
  24. </view>
  25. </view>
  26. <view style="height: 86rpx;"></view>
  27. <!-- 搜索 -->
  28. <view class="search">
  29. <view v-if="!search" @click="search = true">
  30. <image :src="require('../../../static/search.png')" class="searchIcon" alt="">
  31. <view class="search-text">
  32. 搜索订单
  33. </view>
  34. </view>
  35. <input type="text" placeholder="请输入" confirm-type="search" v-model="searchTerm" @confirm="getListData(1)" @blur="noSearch()" focus v-else style="width: 80%;"/>
  36. </view>
  37. <!-- 订单 -->
  38. <view class="order" v-for="(item, index) in dataList" :key="index" @click="toPaths(item)">
  39. <view class="order-header">
  40. <view class="orderId">
  41. 订单号:{{item.number}}
  42. </view>
  43. <view class="orderType" :style="item.status==0?'color: #666666':''">
  44. {{item.status==1?'待服务':item.status==2?'提车中':item.status==3?'作业中':item.status==4 && item.payStatus==2?'作业完成待支付':item.status==4 && item.payStatus==3?'已完成(已挂帐)':item.status==5?'作业完成已支付':item.status==6?'已完成':'已取消'}}
  45. <image :src="require('../../../static/choose.png')" alt="">
  46. </view>
  47. </view>
  48. <view class="carView">
  49. <image :src="baseImagePath+item.carLogo" alt="">
  50. <view class="carBody">
  51. <view class="carTitle">
  52. <image :src="require('../../../static/car.png')" alt="">
  53. <span>{{item.carNumber}}</span>
  54. <view class="border"></view>
  55. <span>{{item.carMadelLevel}}</span>
  56. </view>
  57. <view class="content">
  58. {{item.carTypeName}}
  59. </view>
  60. </view>
  61. </view>
  62. <view class="buttom">
  63. <view class="orderTime">
  64. {{item.time}}
  65. </view>
  66. <view @click.stop="onStatus(item)" class="orderBtn"
  67. :style="item.status==1?'background: #FFFFFF;border: 1px solid #ADADAD;color: #999999;':item.status==5?'background: #FFFFFF;color: #005EFF;border: 1px solid #005EFF;':''"
  68. v-if="item.status!=0 && item.status!=3 && item.isEvaluate == 2">
  69. {{item.status==1?'取消':item.status==2?'提车确认':item.status==3?'作业直播':item.status==4?'支付费用':item.isEvaluate ==2?'评价':''}}
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. </template>
  75. <script>
  76. import {
  77. repairOrderList,
  78. cancelOrder,
  79. orderEvaluate
  80. } from "@/api/maintain.js"
  81. const app = getApp();
  82. export default {
  83. components: {},
  84. data() {
  85. return {
  86. baseImagePath: this.baseImagePath,
  87. orderType: 1,
  88. dataList: [],
  89. searchTerm: "",
  90. pageNo: 1,
  91. pageSize: 20,
  92. search:false
  93. }
  94. },
  95. onShow: function() { //option为object类型,会序列化上个页面传递的参数
  96. this.pageNo = 1
  97. this.getListData(1);
  98. let that = this
  99. uni.$on('maintainEvaluateOver', function(data) {
  100. uni.showToast({
  101. title: data.data,
  102. icon: "none",
  103. duration: 1500
  104. });
  105. console.log(data.data);
  106. })
  107. uni.$on('deliveryOver', function(data) {
  108. uni.showToast({
  109. title: data.data,
  110. icon: "none",
  111. duration: 1500
  112. });
  113. console.log(data.data);
  114. })
  115. },
  116. onLoad(e) {
  117. app.globalData.requestToken = e.token;
  118. uni.setStorageSync('token',e.token)
  119. },
  120. watch: {
  121. orderType(val) {
  122. this.pageNo = 1;
  123. this.getListData(1);
  124. }
  125. },
  126. onReachBottom() {
  127. this.pageNo++
  128. this.getListData()
  129. },
  130. onBackPress(options) {
  131. console.log('11111');
  132. // 这里可以自定义返回逻辑,比如下面跳转其他页面
  133. // #ifdef APP-PLUS
  134. if (plus.os.name.toLowerCase() === 'android') {
  135. plus.runtime.quit();
  136. } else {
  137. plus.runtime.quit();
  138. }
  139. // #endif
  140. // return true 表示禁止默认返回
  141. return true;
  142. },
  143. methods: {
  144. noSearch(){
  145. if(!this.searchTerm){
  146. this.search = false
  147. }
  148. this.getListData(1)
  149. },
  150. changeOrderType(val) {
  151. this.orderType = val;
  152. },
  153. getListData(val) {
  154. let that = this;
  155. if(!this.searchTerm){
  156. this.search = false
  157. }
  158. console.log(this.orderType);
  159. repairOrderList({
  160. pageNo: that.pageNo,
  161. pageSize: that.pageSize,
  162. status: this.orderType,
  163. searchTerm: this.searchTerm
  164. }).then((res) => {
  165. if (val == 1) {
  166. that.dataList = [];
  167. }
  168. that.dataList = that.dataList.concat(res.data.rows)
  169. console.log('dataList参数',this.dataList);
  170. })
  171. },
  172. onStatus(item) {
  173. let that = this;
  174. if (item.status == 2) {
  175. this.$yrouter.push({
  176. path: "/pages/maintenance/maintainOrder/deliveryOfVehicle/index?data=" +
  177. encodeURIComponent(JSON.stringify(item))
  178. });
  179. } else if (item.status == 1) {
  180. cancelOrder({
  181. id: item.id
  182. }).then((res) => {
  183. this.pageNo = 1
  184. that.getListData(1)
  185. })
  186. }else if(item.status == 4){
  187. this.$yrouter.push({
  188. path: "/pages/maintenance/expensesList/expensesList?id=" + item.id
  189. });
  190. } else if (item.status == 5 || item.status == 6) {
  191. this.$yrouter.push({
  192. path: "/pages/preCarWash/washOrder/serviceEvaluation/index?type=" + 1 + "&detailId=" + item
  193. .id
  194. });
  195. }
  196. },
  197. toPaths(item) {
  198. this.$yrouter.push({
  199. path: "/pages/maintenance/maintainOrder/orderDetail/index?data=" + encodeURIComponent(JSON
  200. .stringify(item))
  201. });
  202. }
  203. }
  204. }
  205. </script>
  206. <style lang="less">
  207. page {
  208. background: #F5F5F5;
  209. }
  210. .maintainOrder {
  211. .header {
  212. display: flex;
  213. align-items: center;
  214. width: 100%;
  215. height: 86rpx;
  216. background: #FFFFFF;
  217. position: fixed;
  218. top: 0;
  219. z-index: 999;
  220. .bars {
  221. width: 33%;
  222. display: flex;
  223. flex-direction: column;
  224. align-items: center;
  225. justify-content: center;
  226. background-color: #FFFFFF;
  227. image {
  228. width: 34rpx;
  229. height: 11rpx;
  230. }
  231. .bar-select {
  232. width: 100%;
  233. height: 30rpx;
  234. text-align: center;
  235. font-size: 28rpx;
  236. font-family: PingFang SC;
  237. font-weight: bold;
  238. color: #333333;
  239. line-height: 31rpx;
  240. }
  241. .bar {
  242. width: 100%;
  243. height: 30rpx;
  244. text-align: center;
  245. font-size: 28rpx;
  246. font-family: PingFang SC;
  247. font-weight: 400;
  248. color: #666666;
  249. line-height: 31rpx;
  250. }
  251. }
  252. }
  253. .search {
  254. width: 690rpx;
  255. height: 65rpx;
  256. background: #FFFFFF;
  257. border-radius: 32rpx;
  258. margin: 30rpx;
  259. display: flex;
  260. align-items: center;
  261. justify-content: center;
  262. view{
  263. display: flex;
  264. align-items: center;
  265. justify-content: center;
  266. .searchIcon {
  267. width: 25rpx;
  268. height: 25rpx;
  269. }
  270. .search-text {
  271. padding-left: 15rpx;
  272. font-size: 26rpx;
  273. font-family: PingFang SC;
  274. font-weight: 500;
  275. color: #999999;
  276. }
  277. }
  278. }
  279. .order {
  280. background: #FFFFFF;
  281. border-radius: 10rpx;
  282. margin: 20rpx;
  283. padding: 30rpx;
  284. .order-header {
  285. display: flex;
  286. align-items: center;
  287. justify-content: space-between;
  288. border-bottom: 1px solid #EEEEEE;
  289. padding-bottom: 30rpx;
  290. .orderId {
  291. font-size: 26rpx;
  292. font-family: PingFang SC;
  293. font-weight: 500;
  294. color: #666666;
  295. line-height: 34rpx;
  296. }
  297. .orderType {
  298. font-size: 26rpx;
  299. font-family: PingFang SC;
  300. font-weight: 500;
  301. color: #005BFF;
  302. line-height: 34rpx;
  303. image {
  304. width: 11rpx;
  305. height: 18rpx;
  306. margin-left: 9rpx;
  307. }
  308. }
  309. }
  310. .carView {
  311. display: flex;
  312. border-bottom: 1px solid #EEEEEE;
  313. align-items: center;
  314. justify-content: s;
  315. padding: 20rpx 0;
  316. image {
  317. width: 120rpx;
  318. height: 120rpx;
  319. background: #FFFFFF;
  320. border: 2px solid #F4F4F4;
  321. border-radius: 8rpx;
  322. }
  323. .carBody {
  324. padding: 32rpx;
  325. height: 100%;
  326. display: flex;
  327. align-items: center;
  328. flex-direction: column;
  329. .carTitle {
  330. display: flex;
  331. align-items: center;
  332. margin-bottom: 20rpx;
  333. image {
  334. width: 33rpx;
  335. height: 27rpx;
  336. margin-top: 0rpx;
  337. }
  338. .border {
  339. width: 1px;
  340. height: 20rpx;
  341. background: #DBDBDB;
  342. }
  343. span {
  344. font-size: 30rpx;
  345. font-family: PingFang SC;
  346. font-weight: bold;
  347. color: #333333;
  348. padding: 0 15rpx 0 15rpx;
  349. }
  350. }
  351. .content {
  352. font-size: 26rpx;
  353. font-family: PingFang SC;
  354. font-weight: 500;
  355. color: #666666;
  356. // padding: 20rpx 60rpx 20rpx 0;
  357. }
  358. }
  359. }
  360. .buttom {
  361. padding-top: 30rpx;
  362. display: flex;
  363. justify-content: space-between;
  364. align-items: center;
  365. .orderTime {
  366. font-size: 24rpx;
  367. font-family: PingFang SC;
  368. font-weight: 500;
  369. color: #999999;
  370. line-height: 34rpx;
  371. }
  372. .orderBtn {
  373. width: 156rpx;
  374. height: 56rpx;
  375. text-align: center;
  376. background: linear-gradient(0deg, #008EFF 0%, #0036FF 100%);
  377. border-radius: 28rpx;
  378. font-size: 26rpx;
  379. font-family: PingFang SC;
  380. font-weight: 500;
  381. color: #FFFFFF;
  382. line-height: 56rpx;
  383. }
  384. }
  385. }
  386. }
  387. </style>