myproduct.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. <template>
  2. <view class="center">
  3. <view v-for="(item, index) in list" :key="index" class="order-item">
  4. <view class="goods-box-single">
  5. <image class="goods-img" :src="item.image" mode="scaleToFill"></image>
  6. <view class="right">
  7. <view class="flex-start">
  8. <text class="title clamp1">{{ item.name }}</text>
  9. </view>
  10. <view class="create-time">所属场次:{{ item.nickname }}</view>
  11. <view class="price">{{ item.price }}</view>
  12. </view>
  13. </view>
  14. <view class="buy-box">
  15. <view class="buy-info">
  16. <view class="font">挂售价格:{{ item.hanging_price }}</view>
  17. </view>
  18. <view class="buy-info">
  19. <view class="font">挂售时间:{{ item.update_time }}</view>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. import { user_product } from '@/api/user.js';
  27. import { getTime } from '@/utils/rocessor.js';
  28. export default {
  29. data() {
  30. return {
  31. list: [],
  32. page: 1,
  33. limit: 20,
  34. loadingType: 'more'
  35. };
  36. },
  37. onLoad() {
  38. this.loadData();
  39. },
  40. onReachBottom(){
  41. console.log('22222')
  42. this.loadData();
  43. },
  44. methods: {
  45. loadData() {
  46. const obj = this;
  47. console.log(obj.loadingType,obj.loadingType,'33')
  48. if (obj.loadingType == 'nomore' || obj.loadingType == 'loading') {
  49. return;
  50. }
  51. obj.loadingType = 'loading';
  52. user_product({
  53. page: obj.page,
  54. limit: obj.limit
  55. }).then(({ data }) => {
  56. console.log(data);
  57. data.forEach(e => {
  58. e.g_time = getTime(e.add_time);
  59. });
  60. obj.list = obj.list.concat(data);
  61. // console.log(navItem.orderList);
  62. obj.page++;
  63. if (data.length == obj.limit) {
  64. //判断是否还有数据, 有改为 more, 没有改为noMore
  65. obj.loadingType = 'more';
  66. return;
  67. } else {
  68. //判断是否还有数据, 有改为 more, 没有改为noMore
  69. obj.loadingType = 'nomore';
  70. }
  71. // obj.list = data;
  72. // if (data.length != obj.limit) {
  73. // obj.loadingType == 'noMore';
  74. // } else {
  75. // obj.page++;
  76. // obj.loadingType == 'more';
  77. // }
  78. });
  79. }
  80. }
  81. };
  82. </script>
  83. <style lang="scss">
  84. .center {
  85. background: #f3f5f4;
  86. }
  87. .order-item {
  88. display: flex;
  89. flex-direction: column;
  90. background: #fff;
  91. margin-top: 20rpx;
  92. .i-top {
  93. display: flex;
  94. align-items: center;
  95. height: 80rpx;
  96. font-size: $font-base;
  97. color: $font-color-dark;
  98. position: relative;
  99. padding: 0 30rpx;
  100. .time {
  101. flex: 1;
  102. }
  103. .state {
  104. color: $base-color;
  105. }
  106. .del-btn {
  107. padding: 10rpx 0 10rpx 36rpx;
  108. font-size: $font-lg;
  109. color: $font-color-light;
  110. position: relative;
  111. &:after {
  112. content: '';
  113. width: 0;
  114. height: 30rpx;
  115. border-left: 1px solid $border-color-dark;
  116. position: absolute;
  117. left: 20rpx;
  118. top: 50%;
  119. transform: translateY(-50%);
  120. }
  121. }
  122. }
  123. /* 多条商品 */
  124. .goods-box {
  125. height: 160rpx;
  126. padding: 20rpx 0;
  127. white-space: nowrap;
  128. .goods-item {
  129. width: 120rpx;
  130. height: 120rpx;
  131. display: inline-block;
  132. margin-right: 24rpx;
  133. }
  134. .goods-img {
  135. display: block;
  136. width: 100%;
  137. height: 100%;
  138. }
  139. }
  140. /* 单条商品 */
  141. .goods-box-single {
  142. display: flex;
  143. padding: 20rpx 30rpx;
  144. background: #ffffff;
  145. .goods-img {
  146. display: block;
  147. width: 160rpx;
  148. height: 160rpx;
  149. }
  150. .right {
  151. flex: 1;
  152. display: flex;
  153. flex-direction: column;
  154. padding: 0 0 0 24rpx;
  155. overflow: hidden;
  156. .price {
  157. margin-top: 30rpx;
  158. display: inline;
  159. font-size: $font-base + 8rpx;
  160. color: #fd3938;
  161. &:before {
  162. content: '¥';
  163. font-size: $font-sm;
  164. }
  165. }
  166. .title {
  167. font-size: $font-base + 6rpx;
  168. color: #4f4f4f;
  169. line-height: 1;
  170. width: 80%;
  171. }
  172. .create-time {
  173. margin-top: 10rpx;
  174. font-size: $font-base;
  175. color: #9d9d9d;
  176. }
  177. }
  178. }
  179. .price-box {
  180. display: flex;
  181. justify-content: flex-end;
  182. align-items: baseline;
  183. padding: 20rpx 30rpx;
  184. font-size: $font-sm + 2rpx;
  185. color: $font-color-light;
  186. .num {
  187. margin: 0 8rpx;
  188. color: $font-color-dark;
  189. }
  190. .price {
  191. font-size: $font-lg;
  192. color: $font-color-dark;
  193. &:before {
  194. content: '¥';
  195. font-size: $font-sm;
  196. margin: 0 2rpx 0 8rpx;
  197. }
  198. }
  199. }
  200. .action-box {
  201. padding: 0 30rpx;
  202. display: flex;
  203. justify-content: flex-end;
  204. align-items: center;
  205. height: 100rpx;
  206. position: relative;
  207. }
  208. .refuse {
  209. margin: 0;
  210. padding: 0;
  211. width: 160rpx;
  212. height: 60rpx;
  213. border: 2rpx solid #ebebeb;
  214. border-radius: 28rpx;
  215. text-align: center;
  216. line-height: 60rpx;
  217. font-size: 26rpx;
  218. font-family: PingFang SC;
  219. font-weight: 500;
  220. color: #999999;
  221. &:after {
  222. border-radius: 100px;
  223. }
  224. &.recom {
  225. color: #999999;
  226. &:after {
  227. border-color: #999999;
  228. }
  229. }
  230. }
  231. .buy-box {
  232. padding: 10rpx 22rpx;
  233. background-color: #ffffff;
  234. .buy-info {
  235. margin-top: 20rpx;
  236. .font {
  237. font-size: 32rpx;
  238. font-family: PingFang SC;
  239. font-weight: 500;
  240. color: #333333;
  241. }
  242. }
  243. }
  244. .action-btn {
  245. width: 160rpx;
  246. height: 60rpx;
  247. margin: 0;
  248. margin-left: 24rpx;
  249. padding: 0;
  250. text-align: center;
  251. line-height: 60rpx;
  252. font-size: $font-sm + 2rpx;
  253. color: $font-color-dark;
  254. background: #fff;
  255. border-radius: 100px;
  256. border: 2rpx solid #fd3b39;
  257. border-radius: 28px;
  258. &:after {
  259. border-radius: 100px;
  260. }
  261. &.recom {
  262. color: $base-color;
  263. &:after {
  264. border-color: $base-color;
  265. }
  266. }
  267. &.evaluate {
  268. color: $color-yellow;
  269. &:after {
  270. border-color: $color-yellow;
  271. }
  272. }
  273. }
  274. }
  275. </style>