index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. <template>
  2. <view class="container">
  3. <JHeader title="商品列表" width="50" height="50" style="padding: 24upx 0 0;"></JHeader>
  4. <view v-if="goodsList.length > 0" class="listBox">
  5. <view
  6. v-for="(item, index) in goodsList" :key="index" class="goodsDetails-box flex-display flex-column"
  7. @click="goodsDateils(item.shopId, item.productId, item.skuId)"
  8. >
  9. <view v-if="item.activityType === 0" class="goodsDetails flex-items-plus flex-row">
  10. <image class="goodsImg default-img" :src="item.image"></image>
  11. <view class="mar-left-30">
  12. <view class="goodsName-box overflowNoDot">
  13. <label class="goodsName fs26">{{ item.productName }}</label>
  14. </view>
  15. <view class="usersBox">
  16. <label v-if="item.users != null" class="fs24 font-color-C5AA7B">{{ item.users }}人付款</label>
  17. <label v-else class="fs24 font-color-C5AA7B">0人付款</label>
  18. </view>
  19. <view class="priceBuyNum-box flex-items mar-top-20">
  20. <view>
  21. <label class="fs30 font-color-C83732">¥</label>
  22. <label class="fs36 font-color-C83732 mar-left-10">{{ item.price }}</label>
  23. </view>
  24. <view style="margin-left: 20upx; color: #CCCCCC;text-decoration:line-through">
  25. <label class="fs24">¥{{ item.originalPrice }}</label>
  26. </view>
  27. </view>
  28. <view class="flex-display flex-sp-between flex-row mar-top-10 flex-items shopName">
  29. <label class="fs22 font-color-FFEBC4">{{ item.shopName }}</label>
  30. </view>
  31. </view>
  32. </view>
  33. <view v-else class="spikeList goodsDetails">
  34. <view class="listItem">
  35. <view class="itemBox">
  36. <img :src="item.image" class="pic-img default-img">
  37. </view>
  38. <view class="itemInfo mar-top-30">
  39. <p>{{ item.productName }}</p>
  40. <view v-if="item.users != null" class="number">
  41. <view class="numText">{{ item.users }}人付款</view>
  42. </view>
  43. <view class="flex-row-plus flex-item mar-top-30">
  44. <ATFActivityImage :type="item.activityType"></ATFActivityImage>
  45. <view class="font-color-C83732 flex-row-plus">
  46. <b>¥</b>
  47. <label class="fs28">{{ item.price }}</label>
  48. </view>
  49. <view class="mar-left-30 discountsPriceLine font-color-999">¥{{ item.originalPrice }}</view>
  50. </view>
  51. <view class="flex-display flex-sp-between flex-row mar-top-10 flex-items shopName">
  52. <label class="fs22 font-color-FFEBC4">{{ item.shopName }}</label>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. <!-- 搜索为空 -->
  60. <view style="padding-bottom: 45upx;">
  61. <LoadingMore
  62. :status="!isEmpty && !goodsList.length
  63. ? 'loading' : !isEmpty && goodsList.length && (goodsList.length >= goodsTotal) ? 'no-more' : ''"
  64. >
  65. </LoadingMore>
  66. <tui-no-data v-if="isEmpty" :fixed="false" style="margin-top: 60upx;">暂无数据</tui-no-data>
  67. </view>
  68. </view>
  69. </template>
  70. <script>
  71. import { getProducts2CanvasApi } from '../../../api/anotherTFInterface'
  72. export default {
  73. name: 'CanvasGoods',
  74. data() {
  75. return {
  76. isEmpty: false,
  77. goodsList: [],
  78. goodsTotal: 0,
  79. queryInfo: {
  80. page: 1,
  81. pageSize: 20,
  82. ids: [],
  83. classifyId: 0
  84. },
  85. source: 2,
  86. sourceType: ''
  87. }
  88. },
  89. onLoad(option) {
  90. if (option.sourceType) {
  91. this.sourceType = option.sourceType
  92. if (option.sourceType === '1') {
  93. this.queryInfo.ids = option.ids
  94. } else if (option.sourceType === '2') {
  95. this.queryInfo.classifyId = option.classifyId
  96. }
  97. }
  98. this.searchList()
  99. },
  100. methods: {
  101. searchList(isLoadmore) {
  102. var params = {
  103. page: this.queryInfo.page,
  104. pageSize: this.queryInfo.pageSize
  105. }
  106. if (this.sourceType === '1') {
  107. if (this.queryInfo.ids && this.queryInfo.ids.length > 0) {
  108. params.ids = this.queryInfo.ids
  109. }
  110. } else if (this.sourceType === '2') {
  111. if (this.queryInfo.classifyId) {
  112. params.classifyId = this.queryInfo.classifyId
  113. }
  114. }
  115. if (params.ids || params.classifyId) {
  116. uni.showLoading()
  117. getProducts2CanvasApi(params).then((res) => {
  118. this.goodsTotal = res.data.total
  119. if (isLoadmore) {
  120. this.goodsList.push(...res.data.list)
  121. } else {
  122. this.goodsList = res.data.list
  123. }
  124. this.isEmpty = this.goodsList.length === 0
  125. uni.hideLoading()
  126. })
  127. .catch((e) => {
  128. uni.hideLoading()
  129. })
  130. }
  131. },
  132. // 商品详情
  133. goodsDateils(shopId, productId, skuId) {
  134. uni.navigateTo({
  135. url: '/another-tf/another-serve/goodsDetails/index?shopId=' + shopId + '&productId=' + productId + '&skuId=' + skuId
  136. })
  137. }
  138. },
  139. onReachBottom() {
  140. if (this.goodsList.length < this.goodsTotal) {
  141. ++this.queryInfo.page
  142. this.searchList(true)
  143. }
  144. }
  145. }
  146. </script>
  147. <style lang="less" scoped>
  148. input {
  149. padding-left: 80upx;
  150. }
  151. .container {
  152. background-color: #f8f8f8;
  153. min-height: 100vh;
  154. box-sizing: border-box;
  155. .goodsDetails-box {
  156. background: #FFFFFF;
  157. margin-top: 20rpx;
  158. box-sizing: border-box;
  159. .goodsDetails {
  160. border-bottom: 1upx solid #EDEDED;
  161. padding-top: 30rpx;
  162. padding-bottom: 30upx;
  163. position: relative;
  164. .goodsName-box {
  165. width: 389upx;
  166. height: 85upx;
  167. }
  168. .shopName {
  169. position: absolute;
  170. left: 0;
  171. top: 0;
  172. height: 50rpx;
  173. background: #333333;
  174. opacity: 1;
  175. border-radius: 0 20rpx 20rpx 0;
  176. padding: 10rpx 15rpx;
  177. }
  178. .goodsImg {
  179. width: 260upx;
  180. height: 260upx;
  181. }
  182. }
  183. }
  184. .spikeList {
  185. padding-top: 30rpx;
  186. border-bottom: 1upx solid #EDEDED;
  187. .listItem {
  188. display: flex;
  189. // padding-bottom: 10upx;
  190. border-bottom: 1upx solid #EEEEEE;
  191. margin-bottom: 30upx;
  192. &:last-child {
  193. border-bottom: none;
  194. }
  195. .itemBox {
  196. width: 260upx;
  197. height: 260upx;
  198. margin-right: 30upx;
  199. img {
  200. width: 100%;
  201. height: 100%;
  202. }
  203. }
  204. .itemInfo {
  205. flex: 1;
  206. p {
  207. font-size: 26upx;
  208. color: #333333;
  209. line-height: 40upx;
  210. margin-bottom: 20upx;
  211. text-overflow: -o-ellipsis-lastline;
  212. overflow: hidden;
  213. text-overflow: ellipsis;
  214. display: -webkit-box;
  215. -webkit-line-clamp: 2;
  216. line-clamp: 2;
  217. -webkit-box-orient: vertical;
  218. }
  219. .number {
  220. color: #999999;
  221. font-size: 26upx;
  222. display: flex;
  223. align-items: center;
  224. .numText {
  225. padding: 0 10rpx;
  226. height: 40rpx;
  227. line-height: 40rpx;
  228. border: 2rpx solid #E4E5E6;
  229. color: #C5AA7B;
  230. font-size: 20rpx;
  231. margin-right: 10rpx;
  232. }
  233. }
  234. }
  235. }
  236. }
  237. .listBox {
  238. padding: 0 24rpx;
  239. box-sizing: border-box;
  240. .usersBox {
  241. margin-top: 20rpx;
  242. label {
  243. padding: 10rpx;
  244. border: 2rpx solid #E4E5E6;
  245. }
  246. }
  247. }
  248. }
  249. </style>