storeData.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  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. real_name: ''
  79. };
  80. },
  81. components: {
  82. empty,
  83. uniLoadMore
  84. },
  85. onReady(res) {
  86. var _this = this;
  87. uni.getSystemInfo({
  88. success: resu => {
  89. const query = uni.createSelectorQuery();
  90. query.select('.list-wrapper').boundingClientRect();
  91. query.exec(function(res) {
  92. console.log(res, 'ddddddddddddd');
  93. _this.height = resu.windowHeight - res[0].top + 'px';
  94. console.log('打印页面的剩余高度', _this.height);
  95. });
  96. },
  97. fail: res => {}
  98. });
  99. },
  100. onLoad() {
  101. this.loadData()
  102. },
  103. methods: {
  104. change(e){
  105. console.log(e)
  106. this.now_date = e.startDate + ' - ' + e.endDate;
  107. console.log(this.now_date);
  108. this.loadingType = 'more';
  109. this.page = 1;
  110. this.dataList = []
  111. this.loadData();
  112. },
  113. showInput() {
  114. this.is_show = true;
  115. },
  116. search() {
  117. console.log('search');
  118. this.real_name = this.keyword
  119. this.dataList = []
  120. this.page = 1
  121. this.loadingType = 'more'
  122. this.loadData()
  123. },
  124. loadData() {
  125. let obj = this;
  126. console.log('加载数据');
  127. if (obj.loadingType == 'noMore' || obj.loadingType == 'loading') {
  128. return;
  129. }
  130. obj.loadingType = 'loading'
  131. console.log(obj.now_date)
  132. merchantList({ page: obj.page, limit: obj.limit,data:obj.now_date,real_name: obj.real_name }).then(({ data }) => {
  133. console.log(data)
  134. obj.num = data.count;
  135. obj.dataList = obj.dataList.concat(data.data);
  136. obj.page ++
  137. if (data.data.length == obj.limit) {
  138. obj.loadingType = 'more';
  139. } else {
  140. obj.loadingType = 'noMore';
  141. }
  142. });
  143. },
  144. bindDateChange(e) {
  145. console.log(e.detail, 'dddddddddddd');
  146. this.now_date = e.detail.value;
  147. }
  148. }
  149. };
  150. </script>
  151. <style lang="scss" scoped>
  152. page {
  153. background-color: #f5f5f5;
  154. }
  155. .headr {
  156. height: 357rpx;
  157. background-color: #72e3b4;
  158. position: relative;
  159. .time {
  160. width: 100%;
  161. color: #ffffff;
  162. padding-left: 30rpx;
  163. font-size: 28rpx;
  164. }
  165. .month {
  166. position: absolute;
  167. top: 0;
  168. bottom: 0;
  169. left: 0;
  170. right: 0;
  171. margin: auto;
  172. height: 275rpx;
  173. width: 275rpx;
  174. image {
  175. width: 100%;
  176. height: 100%;
  177. }
  178. .store-data {
  179. position: absolute;
  180. height: 275rpx;
  181. width: 275rpx;
  182. text-align: center;
  183. color: #fff;
  184. top: 0;
  185. display: flex;
  186. flex-direction: column;
  187. align-items: center;
  188. justify-content: center;
  189. .data {
  190. font-size: 50rpx;
  191. font-family: PingFang SC;
  192. font-weight: bold;
  193. color: #ffffff;
  194. padding-bottom: 20rpx;
  195. }
  196. .tit {
  197. font-size: 30rpx;
  198. font-family: PingFang SC;
  199. font-weight: 500;
  200. color: #ffffff;
  201. }
  202. }
  203. }
  204. }
  205. .search-wrapper {
  206. width: 702rpx;
  207. height: 66rpx;
  208. background: #ffffff;
  209. box-shadow: 0px 0px 20px 0px rgba(50, 50, 52, 0.06);
  210. border-radius: 33px;
  211. margin: 20rpx auto;
  212. display: flex;
  213. justify-content: center;
  214. align-items: center;
  215. font-size: 28rpx;
  216. font-family: PingFang SC;
  217. font-weight: 500;
  218. color: #999999;
  219. // line-height: 35px;
  220. image {
  221. height: 33rpx;
  222. width: 33rpx;
  223. margin-right: 22rpx;
  224. }
  225. input {
  226. width: auto;
  227. flex-grow: 1;
  228. padding-left: 30rpx;
  229. }
  230. .btn {
  231. width: 150rpx;
  232. text-align: center;
  233. //background-color: red;
  234. color: #72e3b4;
  235. }
  236. }
  237. .list-wrapper {
  238. .swiper-box {
  239. // background-color: #bfa;
  240. .item {
  241. width: 702rpx;
  242. height: 304rpx;
  243. padding: 0 28rpx;
  244. background: #ffffff;
  245. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  246. border-radius: 10rpx;
  247. margin: 0 auto 15rpx;
  248. &:last-of-type {
  249. margin: 0 auto;
  250. }
  251. .item-top {
  252. line-height: 83rpx;
  253. max-height: 83rpx;
  254. .user-name {
  255. flex-grow: 1;
  256. height: 83rpx;
  257. font-size: 24rpx;
  258. font-family: PingFang SC;
  259. font-weight: 400;
  260. color: #666666;
  261. padding-right: 30rpx;
  262. }
  263. .top-status {
  264. width: 100rpx;
  265. flex-shrink: 0;
  266. font-size: 28rpx;
  267. font-family: PingFang SC;
  268. font-weight: 500;
  269. color: #52c696;
  270. }
  271. }
  272. .item-body {
  273. justify-content: flex-start;
  274. image {
  275. width: 160rpx;
  276. height: 160rpx;
  277. border-radius: 15rpx;
  278. background-color: #eee;
  279. flex-shrink: 0;
  280. margin-right: 9rpx;
  281. }
  282. .goods-info {
  283. width: 100%;
  284. height: 160rpx;
  285. position: relative;
  286. .good-name {
  287. width: 311rpx;
  288. line-height: 37rpx;
  289. font-size: 26rpx;
  290. font-family: PingFang SC;
  291. font-weight: 500;
  292. color: #3f454b;
  293. }
  294. .good-id {
  295. // width: 273px;
  296. line-height: 40rpx;
  297. font-size: 24rpx;
  298. font-family: PingFang SC;
  299. font-weight: 400;
  300. color: #666666;
  301. }
  302. .tag {
  303. margin-top: 6rpx;
  304. width: 102rpx;
  305. line-height: 34rpx;
  306. background: #dbf3e9;
  307. border-radius: 5rpx;
  308. text-align: center;
  309. font-size: 20rpx;
  310. font-family: PingFang SC;
  311. font-weight: 500;
  312. color: #52c696;
  313. }
  314. .good-price,
  315. .good-num {
  316. position: absolute;
  317. top: 0;
  318. right: 0;
  319. line-height: 1.5;
  320. text-align: right;
  321. font-size: 26rpx;
  322. font-family: PingFang SC;
  323. font-weight: 500;
  324. color: #333333;
  325. }
  326. .good-num {
  327. color: #666666;
  328. top: 39rpx;
  329. }
  330. }
  331. }
  332. .item-btm {
  333. text-align: right;
  334. font-size: 26rpx;
  335. font-family: PingFang SC;
  336. font-weight: 500;
  337. color: #333333;
  338. }
  339. }
  340. }
  341. }
  342. .choose-time {
  343. line-height: 1.5;
  344. padding-left: 30rpx;
  345. font-size: 28rpx;
  346. font-family: PingFang SC;
  347. font-weight: 500;
  348. color: #ffffff;
  349. width: 230rpx;
  350. }
  351. </style>