waterUse.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. <template>
  2. <view class="good-list">
  3. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
  4. <!-- 空白页 -->
  5. <!-- #ifdef H5 -->
  6. <empty src="../../static/error/emptyMyCart.png"
  7. v-if="navList[tabCurrentIndex].loaded === true && navList[tabCurrentIndex].orderList.length === 0">
  8. </empty>
  9. <!-- #endif -->
  10. <!-- #ifndef H5 -->
  11. <empty src="../static/error/emptyMyCart.png"
  12. v-if="navList[tabCurrentIndex].loaded === true && navList[tabCurrentIndex].orderList.length === 0">
  13. </empty>
  14. <!-- #endif -->
  15. <view @click="navTo( '/pages/order/orderDetail?id=' + item.order_id )"
  16. v-for="(item, index) in navList[tabCurrentIndex].orderList" :key="index" class="order-item position-relative">
  17. <view class="i-top b-b flex">
  18. <view class="order-code flex">
  19. <view class="no">
  20. 订单编号:
  21. </view>
  22. <view>
  23. {{ item.order_id }}
  24. </view>
  25. </view>
  26. <text class="font-size-sm font-color-gray" >已完成</text>
  27. </view>
  28. <scroll-view class="goods-box" scroll-x>
  29. <view class="goods-item">
  30. <image class="goods-img" :src="item.cart_info.productInfo.image" mode="aspectFill">
  31. </image>
  32. <view class="good-name clamp">
  33. {{item.cart_info.productInfo.attrInfo.suk}}*{{item.cart_info.cart_num}}
  34. </view>
  35. </view>
  36. </scroll-view>
  37. <view class="info-info">
  38. <view class="js">
  39. <!-- 共{{item.cartInfo.length}}件 -->
  40. </view>
  41. <view class="hj">
  42. 合计:{{+item.number}}/张
  43. </view>
  44. </view>
  45. <!-- 底部操作栏 -->
  46. <view class="btm-btn-wrap flex">
  47. <view class="btm-left">
  48. 下单时间:{{item.day}}
  49. </view>
  50. <view class="btm-right flex">
  51. </view>
  52. </view>
  53. </view>
  54. <uni-load-more :status="navList[tabCurrentIndex].loadingType"></uni-load-more>
  55. </scroll-view>
  56. </view>
  57. </template>
  58. <script>
  59. import {
  60. use_certificate
  61. } from '@/api/water.js';
  62. export default {
  63. data() {
  64. return {
  65. tabCurrentIndex: 0,
  66. navList: [{
  67. state: 0,
  68. text: '全部',
  69. loadingType: 'more',
  70. orderList: [],
  71. page: 1, //当前页数
  72. limit: 10 //每次信息条数
  73. }]
  74. };
  75. },
  76. computed: {
  77. allNumber() {
  78. const item = this.navList[0].orderList;
  79. let num = 0;
  80. for (let i = 0; i < item.length; i++) {
  81. num += item[i].certificate_num
  82. }
  83. return num
  84. }
  85. },
  86. onReachBottom() {
  87. this.getGoodList();
  88. },
  89. onLoad: function(option) {
  90. this.getGoodList();
  91. },
  92. methods: {
  93. // 返回退回
  94. back() {
  95. uni.reLaunch({
  96. url: '/pages/home/user'
  97. })
  98. },
  99. // 加载数据
  100. getGoodList(source) {
  101. //这里是将订单挂载到tab列表下
  102. let index = this.tabCurrentIndex;
  103. let navItem = this.navList[index];
  104. let state = navItem.state;
  105. console.log(navItem, '数据');
  106. if (source === 'tabChange' && navItem.loaded === true) {
  107. //tab切换只有第一次需要加载数据
  108. return;
  109. }
  110. if (navItem.loadingType === 'loading') {
  111. //防止重复加载
  112. return;
  113. }
  114. if (navItem.loadingType === 'noMore') {
  115. //防止重复加载
  116. return;
  117. }
  118. // 修改当前对象状态为加载中
  119. navItem.loadingType = 'loading';
  120. use_certificate({
  121. page: navItem.page,
  122. limit: navItem.limit
  123. })
  124. .then(({
  125. data
  126. }) => {
  127. let arr = data.data
  128. console.log(arr,'arr');
  129. navItem.orderList = navItem.orderList.concat(arr);
  130. navItem.page++;
  131. if (navItem.limit == arr.length) {
  132. //判断是否还有数据, 有改为 more, 没有改为noMore
  133. navItem.loadingType = 'more';
  134. return;
  135. } else {
  136. //判断是否还有数据, 有改为 more, 没有改为noMore
  137. navItem.loadingType = 'noMore';
  138. }
  139. uni.hideLoading();
  140. this.$set(navItem, 'loaded', true);
  141. })
  142. .catch(e => {
  143. console.log(e);
  144. });
  145. },
  146. }
  147. };
  148. </script>
  149. <style lang="scss">
  150. .good-list {
  151. width: 750rpx;
  152. height: 100%;
  153. .good {
  154. background: #FFFFFF;
  155. box-shadow: 0px 0px 20px 0px rgba(50, 50, 52, 0.06);
  156. width: 100%;
  157. border-radius: 14rpx;
  158. margin-bottom: 20rpx;
  159. position: relative;
  160. padding: 20rpx;
  161. .good-image {
  162. width: 180rpx;
  163. height: 180rpx;
  164. background-color: #eee;
  165. border-radius: 10rpx;
  166. flex-shrink: 0;
  167. }
  168. .right {
  169. height: 180rpx;
  170. position: relative;
  171. .good-name {
  172. font-size: 28rpx;
  173. font-weight: bold;
  174. color: #333333;
  175. padding-left: 20rpx;
  176. }
  177. .good-key {
  178. font-size: 22rpx;
  179. font-weight: 500;
  180. color: #999999;
  181. padding-left: 20rpx
  182. }
  183. .good-price {
  184. font-size: 28rpx;
  185. font-weight: bold;
  186. position: absolute;
  187. bottom: 0rpx;
  188. padding: 0 20rpx;
  189. left: 0;
  190. right: 0rpx;
  191. .num{
  192. color:$color-red;
  193. }
  194. }
  195. }
  196. }
  197. }
  198. .list-scroll-content {
  199. height: calc(100% - 200px - var(--status-bar-height));
  200. padding: 20rpx;
  201. }
  202. .order-item {
  203. padding-left: 30rpx;
  204. padding-right: 30rpx;
  205. margin: 0 30rpx;
  206. margin-bottom: 30rpx;
  207. border-radius: 30rpx;
  208. background: #fff;
  209. color: #A8ADBF;
  210. .i-top {
  211. height: 80rpx;
  212. .order-code{
  213. font-size: $font-sm;
  214. .no{
  215. padding: 10rpx 10rpx;
  216. background-color: #FFEAE5;
  217. color: #FD5B23;
  218. line-height: 1;
  219. border-top-right-radius: 10rpx;
  220. border-bottom-left-radius: 10rpx;
  221. margin-right: 10rpx;
  222. }
  223. }
  224. .del-btn {
  225. padding: 10rpx 0 10rpx 36rpx;
  226. font-size: $font-lg;
  227. position: relative;
  228. &:after {
  229. content: '';
  230. width: 0;
  231. height: 30rpx;
  232. border-left: 1px solid $border-color-dark;
  233. position: absolute;
  234. left: 20rpx;
  235. top: 50%;
  236. transform: translateY(-50%);
  237. }
  238. }
  239. }
  240. .info-info {
  241. width: 215rpx;
  242. height: 200rpx;
  243. position: absolute;
  244. top: 80rpx;
  245. right: 35rpx;
  246. display: flex;
  247. flex-direction: column;
  248. justify-content: flex-end;
  249. align-items: flex-end;
  250. font-size: 30rpx;
  251. font-weight: 500;
  252. .hj {
  253. padding-top: 40rpx;
  254. color: $font-color-dark;
  255. padding-bottom: 20rpx;
  256. }
  257. }
  258. /* 多条商品 */
  259. .goods-box {
  260. height: 200rpx;
  261. padding: 20rpx 0;
  262. white-space: nowrap;
  263. padding-right: 250rpx;
  264. .goods-item {
  265. width: 120rpx;
  266. height: 180rpx;
  267. display: inline-block;
  268. margin-right: 24rpx;
  269. }
  270. .goods-img {
  271. display: block;
  272. width: 120rpx;
  273. height: 120rpx;
  274. }
  275. .good-name {
  276. font-size: 24rpx;
  277. text-align: center;
  278. width: 120rpx;
  279. padding-top: 10rpx;
  280. margin-right: 0;
  281. color: $font-color-dark;
  282. }
  283. }
  284. .btm-btn-wrap {
  285. height: 90rpx;
  286. width: 100%;
  287. font-size: 24rpx;
  288. font-weight: 500;
  289. color: #A3A8BB;
  290. line-height: 1;
  291. .btm-right {
  292. justify-content: flex-end;
  293. }
  294. .btm-btn {
  295. width: 144rpx;
  296. padding: 10rpx 0;
  297. border: 2px solid #ededed;
  298. border-radius: 28rpx;
  299. font-size: 26rpx;
  300. font-weight: 500;
  301. text-align: center;
  302. margin-left: 10rpx;
  303. color: #999999;
  304. }
  305. .ksps {
  306. border-color: #4589ec;
  307. color: #4589ec;
  308. }
  309. }
  310. }
  311. </style>