storeData.vue 8.2 KB

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