order.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. <!-- order -->
  2. <template>
  3. <view class="order">
  4. <view class="header-warp">
  5. <view class="header-search">
  6. <view class="search">
  7. <input
  8. type="text"
  9. placeholder-style="color:#a3a8a8;font-size:10px;"
  10. placeholder="请输入订单号或手机号"
  11. class="cellphone"
  12. v-model="params.buyPhone"
  13. />
  14. <text class="txt" @tap="orderByNum">搜索</text>
  15. </view>
  16. </view>
  17. <view class="uni-list-cell">
  18. <view class="uni-list-cell-db">
  19. <picker
  20. style="width: 100%; height: 100%;"
  21. @change="bindPickerChange"
  22. :value="index"
  23. :range="shopArray"
  24. range-key="name"
  25. >
  26. <view class="uni-input">{{ shopArray[index].name }}</view>
  27. </picker>
  28. <view class="icon-warp">
  29. <image
  30. src="../../static/images/moreicon.png"
  31. class="iconRight"
  32. ></image>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="btn-time">
  37. <uni-calendar
  38. ref="calendar"
  39. :insert="false"
  40. :range="true"
  41. :startDate="'2020-01-01'"
  42. :endDate="date"
  43. @confirm="confirm"
  44. />
  45. <view class="opentime" @tap="openTime">
  46. <view class="start">{{ startdate ? startdate : date }}</view>
  47. <text class="guo">至</text>
  48. <view class="end">{{ enddate ? enddate : date }}</view>
  49. <text class="sundate">共:{{ sunday }}天</text>
  50. </view>
  51. <view style="width: 19upx;">
  52. <image
  53. src="../../static/images/moreicon.png"
  54. class="iconRight"
  55. ></image>
  56. </view>
  57. </view>
  58. <view class="header-bar">
  59. <view
  60. class="item"
  61. @tap="changeTab(1, 'pay')"
  62. :class="{ active: isactive === 1 }"
  63. >
  64. <view class="ordertype">已付款</view>
  65. <view class="heng"></view>
  66. </view>
  67. <view
  68. class="item"
  69. @tap="changeTab(2, 'accomplish')"
  70. :class="{ active: isactive === 2 }"
  71. >
  72. <view class="ordertype">已完成</view>
  73. <view class="heng"></view>
  74. </view>
  75. <view
  76. class="item"
  77. @tap="changeTab(3, 'refundorder')"
  78. :class="{ active: isactive === 3 }"
  79. >
  80. <view class="ordertype">退款</view>
  81. <view class="heng"></view>
  82. </view>
  83. <view class="line"></view>
  84. </view>
  85. </view>
  86. <view style="height: 352upx;"></view>
  87. <view class="order-content" v-if="isactive === 1">
  88. <view
  89. class="order-list"
  90. @tap="todetail(item.ordersNo)"
  91. v-for="(item, index) in orderList"
  92. :key="index"
  93. >
  94. <view class="order-title">
  95. <text class="ordernum"
  96. >订单号:<text class="num">{{ item.ordersNo }}</text></text
  97. >
  98. <text class="ordertime">{{ item.orderTime.substring(11) }}</text>
  99. </view>
  100. <view class="order-detail">
  101. <view class="name">{{ item.shopName }}</view>
  102. <view class="door"
  103. >门店:<text class="message">{{ item.goodsName }}</text></view
  104. >
  105. <view class="num"
  106. >数量:<text class="message">{{ item.num }}</text></view
  107. >
  108. <view class="status"
  109. >状态:<text class="message">{{ item.statusName }}</text></view
  110. >
  111. <view class="playtime"
  112. >游玩时间:<text class="message">{{ item.palyTime.substring(0,11) }} {{ item.timePart ?item.timePart : ''}}</text></view
  113. >
  114. </view>
  115. </view>
  116. </view>
  117. <view class="order-content" v-if="isactive === 2">
  118. <view
  119. class="order-list"
  120. @tap="todetail(item.ordersNo)"
  121. v-for="(item, index) in orderList"
  122. :key="index"
  123. >
  124. <view class="order-title">
  125. <text class="ordernum"
  126. >订单号:<text class="num">{{ item.ordersNo }}</text></text
  127. >
  128. <text class="ordertime">{{ item.orderTime.substring(11) }}</text>
  129. </view>
  130. <view class="order-detail">
  131. <view class="name">{{ item.shopName }}</view>
  132. <view class="door"
  133. >门店:<text class="message">{{ item.goodsName }}</text></view
  134. >
  135. <view class="num"
  136. >数量:<text class="message">{{ item.num }}</text></view
  137. >
  138. <view class="status"
  139. >状态:<text class="message">{{ item.statusName }}</text></view
  140. >
  141. <view class="playtime"
  142. >游玩时间:<text class="message">{{ item.palyTime.substring(0,11) }} {{ item.timePart ?item.timePart : ''}}</text></view
  143. >
  144. </view>
  145. </view>
  146. </view>
  147. <view class="order-content" v-if="isactive === 3">
  148. <view
  149. class="order-list"
  150. @tap="todetail(item.ordersNo)"
  151. v-for="(item, index) in orderList"
  152. :key="index"
  153. >
  154. <view class="order-title">
  155. <text class="ordernum"
  156. >订单号:<text class="num">{{ item.ordersNo }}</text></text
  157. >
  158. <text class="ordertime">{{ item.orderTime.substring(11) }}</text>
  159. </view>
  160. <view class="order-detail">
  161. <view class="name">{{ item.shopName }}</view>
  162. <view class="door"
  163. >门店:<text class="message">{{ item.goodsName }}</text></view
  164. >
  165. <view class="num"
  166. >数量:<text class="message">{{ item.num }}</text></view
  167. >
  168. <view class="status"
  169. >状态:<text class="message">{{ item.statusName }}</text></view
  170. >
  171. <view class="playtime"
  172. >游玩时间:<text class="message">{{ item.palyTime.substring(0,11) }} {{ item.timePart ?item.timePart : ''}}</text></view
  173. >
  174. </view>
  175. </view>
  176. </view>
  177. <uni-load-more :status="more"> </uni-load-more>
  178. <!-- <rf-loading v-if="loading"></rf-loading> -->
  179. <view style="height: 250upx;"></view>
  180. </view>
  181. </template>
  182. <script>
  183. import moment from '@/common/moment';
  184. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  185. import uniCalendar from '@/components/uni-calendar/uni-calendar.vue';
  186. export default {
  187. name: 'order',
  188. components: { uniLoadMore, uniCalendar },
  189. data() {
  190. //这里存放数据
  191. return {
  192. // loading: false,
  193. shopArray: [{ name: '全部', id: '' }],
  194. index: 0,
  195. shopID: 0,
  196. isactive: 1,
  197. more: 'loading', // more loading noMore
  198. date: moment().format('YYYY-MM-DD'),
  199. yesdate: moment().subtract(1, 'day').format('YYYY-MM-DD'),
  200. dateArr: [],
  201. // startdate: moment().subtract(1, 'day').format('YYYY-MM-DD'),
  202. startdate: '',
  203. enddate: '',
  204. sunday: 1,
  205. orderFlag: 'pay', // pay accomplish refundorder
  206. soleStatus: 1, // 触底状态
  207. orderList: [],
  208. params: {
  209. orderFlag: 'pay', // pay accomplish refundorder
  210. pageNum: 1,
  211. pageSize: 10,
  212. ordersNo: '',
  213. buyPhone: '',
  214. shopId: '',
  215. overTimeArray: [moment().format('YYYY-MM-DD'),moment().format('YYYY-MM-DD')],
  216. },
  217. };
  218. },
  219. // 下拉刷新page.json中要配置
  220. onPullDownRefresh() {
  221. this.startdate = '';
  222. this.enddate = '';
  223. this.sunday = 1;
  224. this.dateArr = [];
  225. this.params.pageNum = 1;
  226. this.params.overTimeArray = [moment().format('YYYY-MM-DD'),moment().format('YYYY-MM-DD')];
  227. this.orderbynumber = '';
  228. this.getOrderList();
  229. },
  230. // 页面触底加载
  231. onReachBottom() {
  232. if (this.soleStatus === 1) {
  233. if (this.more === 'noMore') {
  234. return;
  235. }
  236. this.loadMoreList();
  237. }
  238. },
  239. onLoad() {
  240. this.getShopList();
  241. this.getOrderList();
  242. },
  243. //方法集合
  244. methods: {
  245. // 打开日历
  246. openTime() {
  247. this.$refs.calendar.open();
  248. },
  249. // 确认时间后
  250. confirm(e) {
  251. console.log(e);
  252. this.more = 'loading';
  253. this.startdate = e.range.before;
  254. this.enddate = e.range.after;
  255. this.sunday = e.range.data.length;
  256. this.params.overTimeArray = [this.startdate, this.enddate];
  257. this.getOrderList();
  258. },
  259. // 根据订单号或者手机号查询
  260. orderByNum() {
  261. this.more = 'loading';
  262. let num = '';
  263. num = this.params.buyPhone;
  264. const pattern = /^1[345678]\d{9}$/;
  265. if (pattern.test(this.params.buyPhone)) {
  266. this.params.buyPhone = num;
  267. this.params.ordersNo = '';
  268. } else {
  269. this.params.buyPhone = '';
  270. this.params.ordersNo = num
  271. }
  272. this.getOrderList()
  273. },
  274. // 商铺选择
  275. bindPickerChange(e) {
  276. this.more = 'loading';
  277. this.index = e.detail.value;
  278. this.params.shopId = this.shopArray[this.index].id;
  279. this.getOrderList();
  280. },
  281. // tab
  282. changeTab(type, falg) {
  283. this.more = 'loading';
  284. this.params.pageNum = 1;
  285. this.isactive = type;
  286. this.params.orderFlag = falg;
  287. this.getOrderList();
  288. },
  289. // 跳转详情
  290. todetail(num) {
  291. uni.setStorageSync('order', num);
  292. this.$mRouter.push({ route: '/pages/order/orderdetail' });
  293. },
  294. // 获取店铺列表
  295. async getShopList() {
  296. await this.$http.get('/homePage/getShopByMerId').then((res) => {
  297. if (res.data && res.code === 200) {
  298. let newarr = [{ name: '全部', id: '' }];
  299. this.shopArray = newarr.concat(res.data);
  300. }
  301. });
  302. },
  303. // 订单列表
  304. async getOrderList() {
  305. this.soleStatus = 1;
  306. this.orderList = [];
  307. await this.$http
  308. .post('/orders/proList', this.params)
  309. .then(async (res) => {
  310. console.log(res);
  311. if (res.data.list.length > 0) {
  312. this.orderList = res.data.list;
  313. if (res.data.nextPage === 0) {
  314. this.more = 'noMore';
  315. }
  316. } else {
  317. this.more = 'noMore';
  318. }
  319. });
  320. uni.stopPullDownRefresh();
  321. },
  322. // 上拉加载
  323. async loadMoreList() {
  324. this.params.pageNum++;
  325. await this.$http
  326. .post('/orders/proList', this.params)
  327. .then(async (res) => {
  328. if (res.data.list.length > 0) {
  329. this.orderList = this.orderList.concat(res.data.list);
  330. if (res.data.nextPage === 0) {
  331. this.more = 'noMore';
  332. }
  333. } else {
  334. this.more = 'noMore';
  335. return;
  336. }
  337. });
  338. },
  339. },
  340. };
  341. </script>
  342. <style lang="scss" scoped>
  343. .order {
  344. background-color: #f4f4f4;
  345. .header-warp {
  346. width: 100%;
  347. background-color: #fff;
  348. padding: 15upx 33upx 0;
  349. position: fixed;
  350. .header-search {
  351. display: flex;
  352. align-items: center;
  353. .search {
  354. width: 100%;
  355. display: flex;
  356. align-items: center;
  357. height: 80upx;
  358. margin-left: 20upx;
  359. background-color: #f7f7f7;
  360. border-radius: 10upx;
  361. .cellphone {
  362. flex: 1;
  363. height: 100%;
  364. color: $titleColor;
  365. padding-left: 20upx;
  366. }
  367. .search-holder {
  368. color: #f00;
  369. }
  370. .txt {
  371. height: 72upx;
  372. width: 90upx;
  373. text-align: center;
  374. line-height: 72upx;
  375. color: #a95cff;
  376. font-size: 28upx;
  377. }
  378. }
  379. }
  380. .uni-list-cell {
  381. padding: 0 20upx;
  382. border-bottom: 1px solid #f4f4f4;
  383. .uni-list-cell-db {
  384. height: 80upx;
  385. font-size: 28upx;
  386. display: flex;
  387. justify-content: space-between;
  388. align-items: center;
  389. background-color: #fff;
  390. color: #8f8f8f;
  391. font-size: 30upx;
  392. }
  393. .uni-input {
  394. height: 100%;
  395. line-height: 80upx;
  396. }
  397. .icon-warp {
  398. width: 19upx;
  399. .iconRight {
  400. width: 19upx;
  401. height: 27upx;
  402. }
  403. }
  404. }
  405. .btn-time {
  406. width: 100%;
  407. height: 80upx;
  408. display: flex;
  409. justify-content: center;
  410. align-items: center;
  411. border-bottom: 1px solid #f4f4f4;
  412. padding: 0 20upx;
  413. .opentime {
  414. flex: 1;
  415. display: flex;
  416. align-items: center;
  417. color: #8f8f8f;
  418. .start {
  419. font-size: 30upx;
  420. }
  421. .guo {
  422. padding: 0 45upx;
  423. font-size: 32upx;
  424. }
  425. .end {
  426. font-size: 30upx;
  427. }
  428. .sundate {
  429. font-size: 28upx;
  430. padding-left: 80upx;
  431. }
  432. }
  433. .iconRight {
  434. width: 19upx;
  435. height: 27upx;
  436. }
  437. }
  438. .header-bar {
  439. display: flex;
  440. justify-content: center;
  441. align-items: center;
  442. position: relative;
  443. .item {
  444. position: relative;
  445. width: 33.33%;
  446. height: 99upx;
  447. display: flex;
  448. justify-content: center;
  449. align-items: center;
  450. flex-direction: column;
  451. .ordertype {
  452. position: relative;
  453. font-size: 30upx;
  454. letter-spacing: 3upx;
  455. color: #7a7c7c;
  456. }
  457. .heng {
  458. position: absolute;
  459. display: none;
  460. bottom: 0;
  461. width: 40upx;
  462. height: 6upx;
  463. border-radius: 4upx;
  464. background-color: #a95cff;
  465. }
  466. }
  467. .active .ordertype {
  468. color: #a95cff;
  469. }
  470. .active .heng {
  471. display: block;
  472. }
  473. }
  474. }
  475. .order-content {
  476. padding: 24upx 32upx 0;
  477. .order-list {
  478. background-color: #fff;
  479. border-radius: 10upx;
  480. padding: 30upx 24upx 33upx;
  481. margin-bottom: 24upx;
  482. .order-title {
  483. border-bottom: 1px solid $bordrColor;
  484. display: flex;
  485. justify-content: space-between;
  486. align-items: center;
  487. padding-bottom: 22upx;
  488. .ordernum {
  489. font-size: 30upx;
  490. color: #232828;
  491. .num {
  492. margin-left: 10upx;
  493. }
  494. }
  495. .ordertime {
  496. color: #a3a8a8;
  497. }
  498. }
  499. .order-detail {
  500. margin-top: 24upx;
  501. .name {
  502. font-size: 34upx;
  503. }
  504. .door,
  505. .num,
  506. .status,
  507. .playtime {
  508. font-size: 26upx;
  509. color: #7a7c7c;
  510. margin-top: 14upx;
  511. }
  512. .message {
  513. margin-left: 10upx;
  514. }
  515. }
  516. }
  517. }
  518. }
  519. </style>