order.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454
  1. <template>
  2. <view class="content">
  3. <view class="headr">
  4. <view class="money-box">
  5. <view class="body-title">
  6. <view class="goback-box" @click="toBack"><image class="goback" src="../../static/icon/fanhui.png" mode=""></image></view>
  7. <view class="header">订单数据</view>
  8. </view>
  9. </view>
  10. <!-- <picker mode="date" :value="now_date" @change="bindDateChange" :fields="'month'" :end="date">
  11. <view class="uni-input choose-time">{{ now_date }} ></view>
  12. </picker> -->
  13. <!-- <view class="uni-input choose-time" @click="show = true">{{ now_date }}</view> -->
  14. <view class="month">
  15. <image src="../../static/icon/sdata.png" mode=""></image>
  16. <view class="store-data">
  17. <view class="data">{{ num }}</view>
  18. <view class="tit">本月订单</view>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="search-wrapper" @click="showInput" v-if="!is_show">
  23. <image src="../../static/icon/sousuo.png" mode=""></image>
  24. <view class="">输入关键字</view>
  25. </view>
  26. <view class="search-wrapper" v-if="is_show">
  27. <input type="text" value="" v-model="keyword" focus />
  28. <view class="btn" @click="search">搜索</view>
  29. </view>
  30. <view class="list-wrapper">
  31. <scroll-view scroll-y="true" :style="{ height: height }" class="swiper-box" @scrolltolower="loadData">
  32. <!-- 空白页 -->
  33. <!-- <empty v-if=" loaded && dataList.length == 0"></empty> -->
  34. <view v-for="(item, index) in dataList" class="item">
  35. <view class="item-top flex">
  36. <view class="user-name clamp">订单编号:{{ item.order_id }}</view>
  37. <view class="top-status">{{ item.status_name != '待评价' ? item.status_name : '已完成' }}</view>
  38. </view>
  39. <view class="item-body flex" v-for="(ls, ind) in item._info">
  40. <image :src="ls.cart_info.productInfo.image" mode=""></image>
  41. <view class="goods-info">
  42. <view class="good-name clamp2">{{ ls.cart_info.productInfo.store_name }}</view>
  43. <view class="good-price">¥{{ ls.cart_info.productInfo.ot_price }}</view>
  44. <view class="good-num">x{{ ls.cart_info.cart_num }}</view>
  45. </view>
  46. </view>
  47. <view class="item-btm">共{{ item.total_num }}件商品 合计:¥{{ item.total_price }}</view>
  48. <view class="buy_info">下单人:{{ item.user_for_big_screen.nickname }}</view>
  49. </view>
  50. <uni-load-more :status="loadingType"></uni-load-more>
  51. </scroll-view>
  52. </view>
  53. <u-calendar v-model="show" mode="range" @change="change"></u-calendar>
  54. </view>
  55. </template>
  56. <script>
  57. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  58. import empty from '@/components/empty';
  59. import { order } from '@/api/info.js';
  60. import { mapState, mapMutations } from 'vuex';
  61. export default {
  62. data() {
  63. let start = new Date(new Date().toLocaleDateString()).getTime();
  64. let a = new Date();
  65. let month = a.getMonth() + 1;
  66. let date = a.getDate();
  67. let year = a.getFullYear() + '';
  68. if (month < 10) {
  69. month = '0' + month;
  70. } else {
  71. month = month + '';
  72. }
  73. if (date < 10) {
  74. date = '0' + date;
  75. } else {
  76. date = date + '';
  77. }
  78. return {
  79. show: false, //日历
  80. is_show: false, //搜索是否显示
  81. keyword: '', //搜索关键字
  82. height: '', //滚动区域高度
  83. dataList: [], //月订单
  84. num: 0, //订单总数
  85. loadingType: 'more',
  86. page: 1,
  87. limit: 1000,
  88. now_date: year + '-' + month,
  89. date: year + '-' + month, //选择的日期不能超过今天
  90. real_name: '',
  91. store_id: '',
  92. waiter_id: ''
  93. };
  94. },
  95. components: {
  96. empty,
  97. uniLoadMore
  98. },
  99. computed: {
  100. ...mapState(['userInfo'])
  101. },
  102. onReady(res) {
  103. var _this = this;
  104. uni.getSystemInfo({
  105. success: resu => {
  106. const query = uni.createSelectorQuery();
  107. query.select('.list-wrapper').boundingClientRect();
  108. query.exec(function(res) {
  109. console.log(res, 'ddddddddddddd');
  110. _this.height = resu.windowHeight - res[0].top + 'px';
  111. console.log('打印页面的剩余高度', _this.height);
  112. });
  113. },
  114. fail: res => {}
  115. });
  116. },
  117. onLoad(option) {
  118. if (option.id) {
  119. this.store_id = option.id;
  120. } else {
  121. this.store_id = this.userInfo.store_id;
  122. }
  123. if (option.waiter_id) {
  124. this.waiter_id = option.waiter_id;
  125. }
  126. this.loadData();
  127. },
  128. methods: {
  129. bindDateChange(e) {
  130. console.log(e);
  131. this.now_date = e.detail.value;
  132. this.loadingType = 'more';
  133. this.page = 1;
  134. this.dataList = [];
  135. this.loadData();
  136. },
  137. showInput() {
  138. this.is_show = true;
  139. },
  140. search() {
  141. console.log('search');
  142. this.real_name = this.keyword;
  143. this.dataList = [];
  144. this.page = 1;
  145. this.loadingType = 'more';
  146. this.loadData();
  147. },
  148. loadData() {
  149. let obj = this;
  150. console.log('加载数据');
  151. if (obj.loadingType == 'noMore' || obj.loadingType == 'loading') {
  152. return;
  153. }
  154. obj.loadingType = 'loading';
  155. console.log(obj.now_date);
  156. order({ page: obj.page, limit: obj.limit, data: obj.now_date, store_id: obj.store_id, real_name: obj.real_name, waiter_id: obj.waiter_id }).then(({ data }) => {
  157. console.log(data);
  158. obj.num = data.length;
  159. obj.dataList = obj.dataList.concat(data);
  160. obj.page++;
  161. if (data.length == obj.limit) {
  162. obj.loadingType = 'more';
  163. } else {
  164. obj.loadingType = 'noMore';
  165. }
  166. });
  167. },
  168. toBack() {
  169. uni.navigateBack({});
  170. },
  171. bindDateChange(e) {
  172. console.log(e.detail, 'dddddddddddd');
  173. this.now_date = e.detail.value;
  174. this.dataList = [];
  175. this.page = 1;
  176. this.loadingType = 'more';
  177. this.loadData();
  178. }
  179. }
  180. };
  181. </script>
  182. <style lang="scss" scoped>
  183. page {
  184. background-color: #f5f5f5;
  185. }
  186. .headr {
  187. height: 468rpx;
  188. background: linear-gradient(180deg, #ff4c4c 0%, #ff7474 100%);
  189. position: relative;
  190. .money-box {
  191. padding-top: var(--status-bar-height);
  192. color: #ffffff;
  193. text-align: center;
  194. justify-content: center;
  195. position: relative;
  196. .body-title {
  197. height: 80rpx;
  198. text-align: center;
  199. font-size: 35rpx;
  200. position: relative;
  201. .header {
  202. position: absolute;
  203. left: 0;
  204. top: 0;
  205. width: 100%;
  206. font-size: 36rpx;
  207. font-family: PingFang SC;
  208. font-weight: bold;
  209. color: #fffeff;
  210. height: 80rpx;
  211. font-size: 32rpx;
  212. font-weight: 700;
  213. z-index: 9;
  214. display: flex;
  215. justify-content: center;
  216. align-items: center;
  217. }
  218. .goback-box {
  219. position: absolute;
  220. z-index: 10;
  221. left: 24rpx;
  222. top: 0;
  223. height: 80rpx;
  224. display: flex;
  225. align-items: center;
  226. }
  227. .goback {
  228. width: 30rpx;
  229. height: 36rpx;
  230. }
  231. }
  232. }
  233. .time {
  234. width: 100%;
  235. color: #ffffff;
  236. padding-left: 30rpx;
  237. font-size: 28rpx;
  238. }
  239. .month {
  240. position: absolute;
  241. top: 40rpx;
  242. bottom: 0;
  243. left: 0;
  244. right: 0;
  245. margin: auto;
  246. height: 275rpx;
  247. width: 275rpx;
  248. image {
  249. width: 100%;
  250. height: 100%;
  251. }
  252. .store-data {
  253. position: absolute;
  254. height: 275rpx;
  255. width: 275rpx;
  256. text-align: center;
  257. color: #fff;
  258. top: 0;
  259. display: flex;
  260. flex-direction: column;
  261. align-items: center;
  262. justify-content: center;
  263. .data {
  264. font-size: 50rpx;
  265. font-family: PingFang SC;
  266. font-weight: bold;
  267. color: #ffffff;
  268. padding-bottom: 20rpx;
  269. }
  270. .tit {
  271. font-size: 30rpx;
  272. font-family: PingFang SC;
  273. font-weight: 500;
  274. color: #ffffff;
  275. }
  276. }
  277. }
  278. }
  279. .search-wrapper {
  280. width: 702rpx;
  281. height: 66rpx;
  282. background: #ffffff;
  283. box-shadow: 0px 0px 20px 0px rgba(50, 50, 52, 0.06);
  284. border-radius: 33px;
  285. margin: 20rpx auto;
  286. display: flex;
  287. justify-content: center;
  288. align-items: center;
  289. font-size: 28rpx;
  290. font-family: PingFang SC;
  291. font-weight: 500;
  292. color: #999999;
  293. // line-height: 35px;
  294. image {
  295. height: 33rpx;
  296. width: 33rpx;
  297. margin-right: 22rpx;
  298. }
  299. input {
  300. width: auto;
  301. flex-grow: 1;
  302. padding-left: 30rpx;
  303. }
  304. .btn {
  305. width: 150rpx;
  306. text-align: center;
  307. //background-color: red;
  308. color: #ff4c4c;
  309. }
  310. }
  311. .list-wrapper {
  312. .swiper-box {
  313. // background-color: #bfa;
  314. .item {
  315. width: 702rpx;
  316. padding: 0 28rpx;
  317. background: #ffffff;
  318. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  319. border-radius: 10rpx;
  320. margin: 0 auto 15rpx;
  321. &:last-of-type {
  322. margin: 0 auto;
  323. }
  324. .item-top {
  325. line-height: 83rpx;
  326. max-height: 83rpx;
  327. .user-name {
  328. flex-grow: 1;
  329. height: 83rpx;
  330. font-size: 24rpx;
  331. font-family: PingFang SC;
  332. font-weight: 400;
  333. color: #666666;
  334. padding-right: 30rpx;
  335. }
  336. .top-status {
  337. width: 100rpx;
  338. flex-shrink: 0;
  339. font-size: 28rpx;
  340. font-family: PingFang SC;
  341. font-weight: 500;
  342. color: #ff4c4c;
  343. }
  344. }
  345. .item-body {
  346. justify-content: flex-start;
  347. image {
  348. width: 160rpx;
  349. height: 160rpx;
  350. border-radius: 15rpx;
  351. background-color: #eee;
  352. flex-shrink: 0;
  353. margin-right: 9rpx;
  354. }
  355. .goods-info {
  356. width: 100%;
  357. height: 160rpx;
  358. position: relative;
  359. .good-name {
  360. width: 311rpx;
  361. line-height: 37rpx;
  362. font-size: 26rpx;
  363. font-family: PingFang SC;
  364. font-weight: 500;
  365. color: #3f454b;
  366. }
  367. .good-id {
  368. // width: 273px;
  369. line-height: 40rpx;
  370. font-size: 24rpx;
  371. font-family: PingFang SC;
  372. font-weight: 400;
  373. color: #666666;
  374. }
  375. .tag {
  376. margin-top: 6rpx;
  377. width: 102rpx;
  378. line-height: 34rpx;
  379. background: #dbf3e9;
  380. border-radius: 5rpx;
  381. text-align: center;
  382. font-size: 20rpx;
  383. font-family: PingFang SC;
  384. font-weight: 500;
  385. color: #ff4c4c;
  386. }
  387. .good-price,
  388. .good-num {
  389. position: absolute;
  390. top: 0;
  391. right: 0;
  392. line-height: 1.5;
  393. text-align: right;
  394. font-size: 26rpx;
  395. font-family: PingFang SC;
  396. font-weight: 500;
  397. color: #333333;
  398. }
  399. .good-num {
  400. color: #666666;
  401. top: 39rpx;
  402. }
  403. }
  404. }
  405. .item-btm {
  406. text-align: right;
  407. font-size: 26rpx;
  408. font-family: PingFang SC;
  409. font-weight: 500;
  410. color: #333333;
  411. padding-bottom: 10rpx;
  412. border-bottom: 2px solid #f8f8f8;
  413. }
  414. .buy_info {
  415. padding: 20rpx 10rpx;
  416. }
  417. }
  418. }
  419. }
  420. .choose-time {
  421. line-height: 1.5;
  422. padding-left: 30rpx;
  423. font-size: 28rpx;
  424. font-family: PingFang SC;
  425. font-weight: 500;
  426. color: #ffffff;
  427. width: 230rpx;
  428. }
  429. </style>