order.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <template>
  2. <view class="center">
  3. <view class="input-box flex">
  4. <view class=" input-content flex">
  5. <view class="iconfont iconsearch"></view>
  6. <view class="input"><input type="text" disabled placeholder="输入关键字" /></view>
  7. </view>
  8. </view>
  9. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData" :style="{ height: maxheight + 'px' }">
  10. <view class="main" v-for="(item, index) in list" :key="index" @click="goToOrderDetail(item)">
  11. <view class="top flex">
  12. <view class="userinfo clamp">订单编号ID:{{ item.order_id }}</view>
  13. <view class="type">{{ item.status_name }}</view>
  14. </view>
  15. <view class="mainbox" v-for="(ls, ind) in item._info">
  16. <view class="bg"><image :src="ls.cart_info.productInfo.image" mode=""></image></view>
  17. <view class="main-info flex">
  18. <view class="main-left">
  19. <view class="name clamp2">{{ ls.cart_info.productInfo.store_name }}</view>
  20. </view>
  21. <view class="main-right">
  22. <view class="price">¥{{ ls.cart_info.productInfo.ot_price }}</view>
  23. <view class="num">x{{ ls.cart_info.cart_num}}</view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="item-btm">共{{ item.total_num }}件商品 合计:¥{{ item.total_price }}</view>
  28. </view>
  29. <uni-load-more :status="loadType"></uni-load-more>
  30. </scroll-view>
  31. </view>
  32. </template>
  33. <script>
  34. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  35. import empty from '@/components/empty';
  36. import { merchantList } from '@/api/merchant.js';
  37. export default {
  38. components: {
  39. empty,
  40. uniLoadMore
  41. },
  42. onReady() {
  43. let obj = this;
  44. // 初始化获取页面高度
  45. uni.createSelectorQuery()
  46. .select('.center')
  47. .fields(
  48. {
  49. size: true
  50. },
  51. data => {
  52. // 初始化获取头部高度
  53. uni.createSelectorQuery()
  54. .select('.input-box')
  55. .fields(
  56. {
  57. size: true
  58. },
  59. es => {
  60. console.log(data,es)
  61. // 保存头部高度
  62. obj.maxheight = data.height - es.height;
  63. }
  64. )
  65. .exec();
  66. }
  67. )
  68. .exec();
  69. },
  70. data() {
  71. return {
  72. page: 1,
  73. limit: 10,
  74. loadType: 'more',
  75. list: [],
  76. maxheight:''
  77. };
  78. },
  79. onPullDownRefresh() {
  80. this.loadData();
  81. },
  82. onLoad() {
  83. this.loadData();
  84. },
  85. methods: {
  86. loadData() {
  87. const obj = this;
  88. if (obj.loadType == 'loading' || obj.loadType == 'nomore') {
  89. return;
  90. }
  91. obj.loadType = 'loading';
  92. merchantList({ page: obj.page, limit: obj.limit }).then(({ data }) => {
  93. obj.list = obj.list.concat(data);
  94. obj.page ++
  95. if (data.length == obj.limit) {
  96. obj.loadType = 'more';
  97. } else {
  98. obj.loadType = 'nomore';
  99. }
  100. });
  101. },
  102. goToOrderDetail(e) {
  103. uni.navigateTo({
  104. url: '/pages/merchant/orderDetail?id=' + e.order_id
  105. });
  106. },
  107. }
  108. };
  109. </script>
  110. <style lang="scss">
  111. page,.center {
  112. height: 100%;
  113. background: #f6f4f4;
  114. }
  115. .input-box {
  116. width: 100%;
  117. padding: 25rpx;
  118. background-color: #52c696;
  119. z-index: 999;
  120. height: 60px;
  121. .iconsearch {
  122. padding-left: 30%;
  123. font-size: 50rpx;
  124. color: #9f9f9f;
  125. }
  126. .input-content {
  127. border-radius: 99rpx;
  128. color: #9f9f9f;
  129. flex-grow: 1;
  130. padding: 10rpx 30rpx;
  131. background-color: #ffffff;
  132. .input {
  133. flex-grow: 1;
  134. input {
  135. font-size: $font-lg;
  136. }
  137. }
  138. }
  139. .input-button {
  140. padding-left: 20rpx;
  141. font-size: $font-lg;
  142. height: 100%;
  143. }
  144. }
  145. .main {
  146. padding: 30rpx 30rpx 60rpx 30rpx;
  147. width: 700rpx;
  148. margin: 20rpx auto 0;
  149. background: #ffffff;
  150. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  151. border-radius: 10rpx;
  152. .top {
  153. align-items: center;
  154. .userinfo {
  155. max-width: 70%;
  156. font-size: 24rpx;
  157. font-family: PingFang SC;
  158. font-weight: 400;
  159. color: #666666;
  160. }
  161. .type {
  162. font-size: 28rpx;
  163. font-family: PingFang SC;
  164. font-weight: 500;
  165. color: #52c696;
  166. }
  167. }
  168. .mainbox {
  169. display: flex;
  170. flex-direction: row;
  171. justify-content: flex-start;
  172. margin-top: 30rpx;
  173. align-items: flex-start;
  174. .bg {
  175. flex-shrink: 0;
  176. width: 160rpx;
  177. height: 160rpx;
  178. background: #4cd964;
  179. image {
  180. width: 100%;
  181. height: 100%;
  182. }
  183. }
  184. .main-info {
  185. justify-content: space-between;
  186. align-items: flex-start;
  187. width: 100%;
  188. .main-left {
  189. padding-left: 10rpx;
  190. .name {
  191. max-width: 338rpx;
  192. font-size: 26rpx;
  193. font-family: PingFang SC;
  194. font-weight: 500;
  195. color: #3f454b;
  196. }
  197. .order {
  198. margin-top: 10rpx;
  199. font-size: 24rpx;
  200. font-family: PingFang SC;
  201. font-weight: 400;
  202. color: #666666;
  203. }
  204. .ordertype {
  205. width: 120rpx;
  206. margin-top: 10rpx;
  207. background: #ffeae5;
  208. border-radius: 5rpx;
  209. font-size: 20rpx;
  210. font-family: PingFang SC;
  211. font-weight: 500;
  212. color: #ff6f0f;
  213. text-align: center;
  214. }
  215. }
  216. .main-right {
  217. text-align: right;
  218. padding-top: 6rpx;
  219. .price {
  220. font-size: 26rpx;
  221. font-family: PingFang SC;
  222. font-weight: 500;
  223. color: #333333;
  224. }
  225. .num {
  226. font-size: 26rpx;
  227. font-family: PingFang SC;
  228. font-weight: 500;
  229. color: #666666;
  230. }
  231. }
  232. }
  233. }
  234. .item-btm {
  235. text-align: right;
  236. font-size: 26rpx;
  237. font-family: PingFang SC;
  238. font-weight: 500;
  239. color: #333333;
  240. }
  241. }
  242. </style>