commodity.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <view class="commodity-container">
  3. <JHeader title="推广商品" width="50" height="50" style="padding: 24upx 0 0;"></JHeader>
  4. <view>
  5. <view v-if="productList && productList.length">
  6. <view
  7. v-for="(item, index) in productList" :key="index"
  8. class="goodsDetails-box flex-display flex-column mar-left-30"
  9. @click="go(`/another-tf/another-serve/goodsDetails/index?shopId=${queryInfo.shopId}&productId=${item.productId}&skuId=${item.skuId}`)"
  10. >
  11. <view class="goodsDetails flex-items-plus flex-row mar-top-30">
  12. <image class="goodsImg" :src="common.seamingImgUrl(item.image)"></image>
  13. <view class="mar-left-30">
  14. <view class="goodsName-box overflowNoDot">
  15. <label class="goodsName fs26 mar-left-20">{{ item.productName }}</label>
  16. </view>
  17. <view class="priceBuyNum-box mar-top-20">
  18. <label class="fs24 font-color-C5AA7B">¥</label>
  19. <label class="fs36 font-color-C5AA7B mar-left-10">{{ item.price }}</label>
  20. <label v-if="item.users" class="fs24 font-color-999 mar-left-20">{{ item.users }}人付款</label>
  21. <label v-else class="fs24 font-color-999 mar-left-20">0人付款</label>
  22. </view>
  23. <view class="fenxiang" @click.stop="fenxiang(item)">
  24. 分享
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. <view style="padding-bottom: 45upx;">
  31. <LoadingMore
  32. :status="!isEmpty && !productList.length
  33. ? 'loading' : !isEmpty && productList.length && (productList.length >= productTotal) ? 'no-more' : ''"
  34. >
  35. </LoadingMore>
  36. <tui-no-data v-if="isEmpty" :fixed="false" style="margin-top: 60upx;">暂无数据</tui-no-data>
  37. </view>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. import { getExtensionProductDistributorApi, getProductSharePicApi } from '../../../api/anotherTFInterface'
  43. export default {
  44. name: 'Commodity',
  45. data() {
  46. return {
  47. distributorId: 0,
  48. isEmpty: false,
  49. productList: [],
  50. productTotal: 0,
  51. queryInfo: {
  52. page: 1,
  53. pageSize: 20,
  54. shopId: 0
  55. }
  56. }
  57. },
  58. onLoad(options) {
  59. this.queryInfo.shopId = options.shopId
  60. this.distributorId = options.distributorId
  61. this.getStoreProductDataList()
  62. },
  63. methods: {
  64. getStoreProductDataList(isLoadmore) {
  65. uni.showLoading()
  66. getExtensionProductDistributorApi(this.queryInfo).then((res) => {
  67. this.productTotal = res.data.total
  68. if (isLoadmore) {
  69. this.productList.push(...res.data.list)
  70. } else {
  71. this.productList = res.data.list
  72. }
  73. this.isEmpty = this.productList.length === 0
  74. uni.hideLoading()
  75. })
  76. .catch((e) => {
  77. uni.hideLoading()
  78. })
  79. },
  80. fenxiang(item) {
  81. let system
  82. // #ifdef APP
  83. system = 1
  84. // #endif
  85. // #ifdef H5
  86. system = 3
  87. // #endif
  88. // #ifdef MP-WEIXIN
  89. system = 2
  90. // #endif
  91. // #ifdef MP-ALIPAY
  92. system = 4
  93. // #endif
  94. uni.showLoading()
  95. getProductSharePicApi({
  96. productId: item.productId,
  97. shopId: item.shopId,
  98. skuId: item.skuId,
  99. terminal: system
  100. }).then((res) => {
  101. uni.hideLoading()
  102. // 推广商品
  103. uni.navigateTo({
  104. url: `/another-tf/another-serve/distributionModule/shareProduct?shareType=2&shopId=${item.shopId}&productId=${item.productId}&skuId=${item.skuId}&shareImg=${res.data}&salesId=${this.distributorId}`
  105. })
  106. })
  107. .catch((res) => {
  108. uni.hideLoading()
  109. })
  110. }
  111. },
  112. onReachBottom() {
  113. if (this.productList.length < this.productTotal) {
  114. ++this.queryInfo.page
  115. this.getStoreProductDataList(true)
  116. }
  117. }
  118. }
  119. </script>
  120. <style lang="less" scoped>
  121. .commodity-container {
  122. min-height: 100%;
  123. box-sizing: border-box;
  124. .goodsDetails-box {
  125. width: 690upx;
  126. .goodsDetails {
  127. position: relative;
  128. border-bottom: 1upx solid #EDEDED;
  129. padding-bottom: 30upx;
  130. .goodsName-box {
  131. width: 389upx;
  132. height: 85upx;
  133. }
  134. .goodsImg {
  135. width: 260upx;
  136. height: 260upx;
  137. }
  138. }
  139. }
  140. .fenxiang {
  141. height: 50upx;
  142. line-height: 50upx;
  143. width: 120upx;
  144. color: #FFEBC4;
  145. text-align: center;
  146. position: absolute;
  147. background-color: #333333;
  148. right: 10upx;
  149. }
  150. }
  151. </style>