msGoodsList.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <template>
  2. <view class="app-page">
  3. <CommercePartMs :data="mList"></CommercePartMs>
  4. </view>
  5. </template>
  6. <script>
  7. import Empty from "@/components/Empty/index.vue"
  8. import CommercePartMs from '@/components/CommercePartMs'
  9. import {
  10. getMsGoodsList
  11. } from "@/common/api/good.js";
  12. export default {
  13. components: {
  14. Empty,
  15. CommercePartMs
  16. },
  17. data() {
  18. return {
  19. topData: {
  20. top: 0,
  21. height: 0
  22. },
  23. pageParams: {
  24. page: 1,
  25. pageSize: 8
  26. },
  27. total: 0,
  28. mList: []
  29. }
  30. },
  31. computed: {},
  32. onLoad(options) {
  33. this.getList(true)
  34. },
  35. onReachBottom() {
  36. this.getList()
  37. },
  38. onShareAppMessage(res) {
  39. if (res.from === 'button') { // 来自页面内分享按钮
  40. console.log(res.target)
  41. }
  42. let userInfo = uni.getStorageSync('userInfo')
  43. userInfo = userInfo && JSON.parse(userInfo) || {}
  44. let params = {}
  45. if (userInfo.id) {
  46. params = {
  47. id: userInfo.id
  48. }
  49. }
  50. let configs = uni.getStorageSync('configs') || {}
  51. return {
  52. title: configs.shop_share_title,
  53. path: `/subPages/msGoodsList/msGoodsList${this.$stringPageOptions(params)}`
  54. }
  55. },
  56. onShareTimeline() {
  57. if (res.from === 'button') { // 来自页面内分享按钮
  58. console.log(res.target)
  59. }
  60. let userInfo = uni.getStorageSync('userInfo')
  61. userInfo = userInfo && JSON.parse(userInfo) || {}
  62. let params = {}
  63. if (userInfo.id) {
  64. params = {
  65. id: userInfo.id
  66. }
  67. }
  68. let configs = uni.getStorageSync('configs') || {}
  69. return {
  70. title: configs.shop_share_title,
  71. path: `/subPages/msGoodsList/msGoodsList${this.$stringPageOptions(params)}`
  72. }
  73. },
  74. methods: {
  75. toBack() {
  76. uni.navigateBack()
  77. },
  78. toDetails(item) {
  79. uni.navigateTo({
  80. url: `/subPages/goodsDetail/goodsDetail?code=${item.code}&type=common`
  81. })
  82. },
  83. getList(initFlag) {
  84. if (!initFlag) {
  85. if (this.pageParams.page * this.pageParams.pageSize < this.total) {
  86. this.pageParams.page++
  87. } else {
  88. return
  89. }
  90. } else {
  91. this.pageParams.page = 1
  92. this.total = 0
  93. this.mList = []
  94. }
  95. let sendData = {
  96. ...this.pageParams
  97. }
  98. getMsGoodsList()
  99. .then((res) => {
  100. this.mList = this.mList.concat(res.data.list)
  101. this.total = res.data.page.total
  102. })
  103. },
  104. }
  105. }
  106. </script>
  107. <style lang="scss" scoped>
  108. .app-page {
  109. width: 100vw;
  110. display: flex;
  111. height: 100vh;
  112. // background-color: #fff;
  113. align-items: center;
  114. flex-direction: column;
  115. box-sizing: border-box;
  116. padding: 40rpx;
  117. }
  118. .top-view {
  119. display: flex;
  120. width: 100%;
  121. flex-direction: row;
  122. align-items: flex-end;
  123. }
  124. .top-view image {
  125. height: 60rpx;
  126. margin-left: 30rpx;
  127. width: 80rpx;
  128. }
  129. .top-view text {
  130. font-size: 26rpx;
  131. margin-bottom: 10rpx;
  132. margin-left: 10rpx;
  133. }
  134. .good-list {
  135. background: white;
  136. display: flex;
  137. flex-basis: 0;
  138. flex-direction: column;
  139. width: 100%;
  140. box-sizing: border-box;
  141. padding: 40rpx;
  142. align-items: center;
  143. }
  144. .good-item {
  145. width: calc(100% - 40rpx);
  146. display: flex;
  147. flex-direction: row;
  148. align-items: center;
  149. }
  150. .good-item-content {
  151. // flex: 1;
  152. // margin-left: 20rpx;
  153. // display: flex;
  154. // flex-direction: column;
  155. }
  156. .good-name-box {
  157. display: flex;
  158. margin-top: 28rpx;
  159. flex-direction: row;
  160. align-items: center;
  161. image {
  162. width: 30rpx;
  163. height: 30rpx;
  164. display: block;
  165. }
  166. text {
  167. font-size: 32rpx;
  168. font-family: PingFang SC-Bold, PingFang SC;
  169. font-weight: bold;
  170. color: #1D161F;
  171. // margin-left: 10rpx;
  172. overflow: hidden;
  173. text-overflow: ellipsis;
  174. -webkit-line-clamp: 1;
  175. display: -webkit-box;
  176. -webkit-box-orient: vertical;
  177. }
  178. }
  179. .good-desc {
  180. font-size: 22rpx;
  181. font-family: PingFang SC-Medium, PingFang SC;
  182. font-weight: 500;
  183. color: #2C2C2C;
  184. margin-top: 8rpx;
  185. }
  186. .good-tags {
  187. display: flex;
  188. flex-direction: row;
  189. margin-top: 15rpx;
  190. align-items: center;
  191. .good-tag1 {
  192. font-size: 22rpx;
  193. font-family: PingFang SC-Medium, PingFang SC;
  194. font-weight: 500;
  195. margin-right: 10rpx;
  196. color: #765AEE;
  197. padding: 3rpx 12rpx;
  198. background: #F3F1FF;
  199. border-radius: 5rpx 5rpx 5rpx 5rpx;
  200. opacity: 1;
  201. }
  202. .good-tag2 {
  203. font-size: 22rpx;
  204. font-family: PingFang SC-Medium, PingFang SC;
  205. font-weight: 500;
  206. color: #5E5E5E;
  207. margin-right: 10rpx;
  208. padding: 3rpx 12rpx;
  209. background: #F8F8F8;
  210. border-radius: 5rpx 5rpx 5rpx 5rpx;
  211. opacity: 1;
  212. }
  213. }
  214. .good-bottom {
  215. display: flex;
  216. flex-direction: row;
  217. align-items: center;
  218. margin-top: 32rpx;
  219. justify-content: space-between;
  220. .good-time {
  221. font-size: 22rpx;
  222. font-family: PingFang SC-Medium, PingFang SC;
  223. font-weight: 500;
  224. color: #B7B7B7;
  225. }
  226. .good-view-box {
  227. display: flex;
  228. flex-direction: row;
  229. align-items: center;
  230. image {
  231. height: 16rpx;
  232. width: 22rpx;
  233. display: block;
  234. }
  235. text {
  236. font-size: 22rpx;
  237. font-family: PingFang SC-Medium, PingFang SC;
  238. font-weight: 500;
  239. color: #B7B7B7;
  240. margin-left: 6rpx;
  241. }
  242. }
  243. }
  244. </style>