myproduct.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  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. this.loadData();
  42. },
  43. methods: {
  44. loadData() {
  45. const obj = this;
  46. if (obj.loadingType == 'nomore' || obj.loadingType == 'loading') {
  47. return;
  48. }
  49. obj.loadingType = 'loading';
  50. user_product({
  51. page: obj.page,
  52. limit: obj.limit
  53. }).then(({ data }) => {
  54. console.log(data);
  55. data.forEach(e => {
  56. e.g_time = getTime(e.add_time);
  57. });
  58. obj.list = data;
  59. if (data.length != obj.limit) {
  60. obj.loadingType == 'noMore';
  61. } else {
  62. obj.page++;
  63. obj.loadingType == 'more';
  64. }
  65. });
  66. }
  67. }
  68. };
  69. </script>
  70. <style lang="scss">
  71. .center {
  72. background: #f3f5f4;
  73. }
  74. .order-item {
  75. display: flex;
  76. flex-direction: column;
  77. background: #fff;
  78. margin-top: 20rpx;
  79. .i-top {
  80. display: flex;
  81. align-items: center;
  82. height: 80rpx;
  83. font-size: $font-base;
  84. color: $font-color-dark;
  85. position: relative;
  86. padding: 0 30rpx;
  87. .time {
  88. flex: 1;
  89. }
  90. .state {
  91. color: $base-color;
  92. }
  93. .del-btn {
  94. padding: 10rpx 0 10rpx 36rpx;
  95. font-size: $font-lg;
  96. color: $font-color-light;
  97. position: relative;
  98. &:after {
  99. content: '';
  100. width: 0;
  101. height: 30rpx;
  102. border-left: 1px solid $border-color-dark;
  103. position: absolute;
  104. left: 20rpx;
  105. top: 50%;
  106. transform: translateY(-50%);
  107. }
  108. }
  109. }
  110. /* 多条商品 */
  111. .goods-box {
  112. height: 160rpx;
  113. padding: 20rpx 0;
  114. white-space: nowrap;
  115. .goods-item {
  116. width: 120rpx;
  117. height: 120rpx;
  118. display: inline-block;
  119. margin-right: 24rpx;
  120. }
  121. .goods-img {
  122. display: block;
  123. width: 100%;
  124. height: 100%;
  125. }
  126. }
  127. /* 单条商品 */
  128. .goods-box-single {
  129. display: flex;
  130. padding: 20rpx 30rpx;
  131. background: #ffffff;
  132. .goods-img {
  133. display: block;
  134. width: 160rpx;
  135. height: 160rpx;
  136. }
  137. .right {
  138. flex: 1;
  139. display: flex;
  140. flex-direction: column;
  141. padding: 0 0 0 24rpx;
  142. overflow: hidden;
  143. .price {
  144. margin-top: 30rpx;
  145. display: inline;
  146. font-size: $font-base + 8rpx;
  147. color: #fd3938;
  148. &:before {
  149. content: '¥';
  150. font-size: $font-sm;
  151. }
  152. }
  153. .title {
  154. font-size: $font-base + 6rpx;
  155. color: #4f4f4f;
  156. line-height: 1;
  157. width: 80%;
  158. }
  159. .create-time {
  160. margin-top: 10rpx;
  161. font-size: $font-base;
  162. color: #9d9d9d;
  163. }
  164. }
  165. }
  166. .price-box {
  167. display: flex;
  168. justify-content: flex-end;
  169. align-items: baseline;
  170. padding: 20rpx 30rpx;
  171. font-size: $font-sm + 2rpx;
  172. color: $font-color-light;
  173. .num {
  174. margin: 0 8rpx;
  175. color: $font-color-dark;
  176. }
  177. .price {
  178. font-size: $font-lg;
  179. color: $font-color-dark;
  180. &:before {
  181. content: '¥';
  182. font-size: $font-sm;
  183. margin: 0 2rpx 0 8rpx;
  184. }
  185. }
  186. }
  187. .action-box {
  188. padding: 0 30rpx;
  189. display: flex;
  190. justify-content: flex-end;
  191. align-items: center;
  192. height: 100rpx;
  193. position: relative;
  194. }
  195. .refuse {
  196. margin: 0;
  197. padding: 0;
  198. width: 160rpx;
  199. height: 60rpx;
  200. border: 2rpx solid #ebebeb;
  201. border-radius: 28rpx;
  202. text-align: center;
  203. line-height: 60rpx;
  204. font-size: 26rpx;
  205. font-family: PingFang SC;
  206. font-weight: 500;
  207. color: #999999;
  208. &:after {
  209. border-radius: 100px;
  210. }
  211. &.recom {
  212. color: #999999;
  213. &:after {
  214. border-color: #999999;
  215. }
  216. }
  217. }
  218. .buy-box {
  219. padding: 10rpx 22rpx;
  220. background-color: #ffffff;
  221. .buy-info {
  222. margin-top: 20rpx;
  223. .font {
  224. font-size: 32rpx;
  225. font-family: PingFang SC;
  226. font-weight: 500;
  227. color: #333333;
  228. }
  229. }
  230. }
  231. .action-btn {
  232. width: 160rpx;
  233. height: 60rpx;
  234. margin: 0;
  235. margin-left: 24rpx;
  236. padding: 0;
  237. text-align: center;
  238. line-height: 60rpx;
  239. font-size: $font-sm + 2rpx;
  240. color: $font-color-dark;
  241. background: #fff;
  242. border-radius: 100px;
  243. border: 2rpx solid #fd3b39;
  244. border-radius: 28px;
  245. &:after {
  246. border-radius: 100px;
  247. }
  248. &.recom {
  249. color: $base-color;
  250. &:after {
  251. border-color: $base-color;
  252. }
  253. }
  254. &.evaluate {
  255. color: $color-yellow;
  256. &:after {
  257. border-color: $color-yellow;
  258. }
  259. }
  260. }
  261. }
  262. </style>