jxs.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <template>
  2. <view class="jxs-page">
  3. <view class="header-info">
  4. 进货总金额:{{jxsInfo.total_purchase}}
  5. </view>
  6. <view class="stock-list">
  7. <view class="stock-card" v-for="item in jxsInfo.stock_list" @click="goItem(item)">
  8. <view class="product-image-wrapper">
  9. <image class="product-image" :src="item.product_image" mode="aspectFill"></image>
  10. </view>
  11. <view class="product-info">
  12. <view class="product-name">{{item.product_name}}</view>
  13. <view class="product-stock">
  14. 库存:{{item.remaining_quantity}}
  15. </view>
  16. <view class="product-spec">
  17. 规格:{{item.suk}}
  18. </view>
  19. </view>
  20. <view class="promo-btn">
  21. <view class="promo-btn-text" @click.stop="showCode(item)">推广码</view>
  22. </view>
  23. </view>
  24. </view>
  25. <uni-popup type="center" ref="code">
  26. <view class="code-popup">
  27. <view class="code-title">推广码</view>
  28. <ikun-qrcode width="300" height="300" unit="rpx" :data="code" />
  29. <view class="code-close" @click="closeCode">关闭</view>
  30. </view>
  31. </uni-popup>
  32. </view>
  33. </template>
  34. <script>
  35. import {
  36. getJxsInfo
  37. } from '@/api/user.js'
  38. import {
  39. mapState
  40. } from 'vuex'
  41. export default {
  42. data() {
  43. return {
  44. code: '',
  45. jxsInfo: {
  46. dealer_level_grade: 0,
  47. dealer_level_name: '',
  48. dealer_name: '',
  49. stock_list: [],
  50. total_purchase: ''
  51. }
  52. }
  53. },
  54. computed: {
  55. ...mapState(['baseURL']),
  56. ...mapState('user', ['userInfo'])
  57. },
  58. methods: {
  59. goItem(item) {
  60. uni.navigateTo({
  61. url:'/pages/product/product?id=' + item.product_id + '&suk=' + item.suk + '&stock=' + item.remaining_quantity + '&attr=' + item.attr_unique
  62. })
  63. },
  64. getJxsInfo() {
  65. getJxsInfo().then(res => {
  66. this.jxsInfo = res.data
  67. })
  68. },
  69. showCode(item) {
  70. this.code = this.baseURL + '/index/#/pages/product/product?id=' + item.product_id + '&uid=' + this.userInfo
  71. .uid
  72. this.$refs.code.open()
  73. },
  74. closeCode() {
  75. this.$refs.code.close()
  76. }
  77. },
  78. onLoad() {
  79. this.getJxsInfo()
  80. }
  81. }
  82. </script>
  83. <style scoped>
  84. .jxs-page {
  85. background-color: #f5f5f5;
  86. padding: 20rpx;
  87. box-sizing: border-box;
  88. }
  89. .header-info {
  90. background-color: #fff;
  91. padding: 30rpx;
  92. border-radius: 16rpx;
  93. font-size: 32rpx;
  94. color: #333;
  95. margin-bottom: 20rpx;
  96. }
  97. .stock-list {
  98. display: flex;
  99. flex-wrap: wrap;
  100. gap: 20rpx;
  101. }
  102. .stock-card {
  103. width: calc(50% - 10rpx);
  104. background-color: #fff;
  105. border-radius: 16rpx;
  106. overflow: hidden;
  107. display: flex;
  108. flex-direction: column;
  109. }
  110. .product-image-wrapper {
  111. position: relative;
  112. width: 100%;
  113. padding-bottom: 100%;
  114. }
  115. .product-image {
  116. position: absolute;
  117. top: 0;
  118. left: 0;
  119. width: 100%;
  120. height: 100%;
  121. }
  122. .product-info {
  123. padding: 20rpx;
  124. flex: 1;
  125. display: flex;
  126. flex-direction: column;
  127. gap: 12rpx;
  128. }
  129. .product-name {
  130. font-size: 28rpx;
  131. color: #333;
  132. font-weight: 500;
  133. display: -webkit-box;
  134. -webkit-box-orient: vertical;
  135. -webkit-line-clamp: 2;
  136. overflow: hidden;
  137. }
  138. .product-stock {
  139. font-size: 24rpx;
  140. color: #999;
  141. }
  142. .product-spec {
  143. font-size: 24rpx;
  144. color: #999;
  145. }
  146. .promo-btn {
  147. background-color: #FF6B6B;
  148. padding: 20rpx;
  149. text-align: center;
  150. margin-top: auto;
  151. }
  152. .promo-btn-text {
  153. font-size: 28rpx;
  154. color: #fff;
  155. font-weight: 500;
  156. }
  157. .code-popup {
  158. background-color: #ffffff;
  159. border-radius: 24rpx;
  160. padding: 50rpx 60rpx;
  161. display: flex;
  162. flex-direction: column;
  163. align-items: center;
  164. gap: 40rpx;
  165. width: 520rpx;
  166. box-shadow: 0 10rpx 40rpx rgba(0, 0, 0, 0.15);
  167. }
  168. .code-title {
  169. font-size: 36rpx;
  170. color: #333333;
  171. font-weight: 600;
  172. }
  173. .code-close {
  174. font-size: 28rpx;
  175. color: #999999;
  176. margin-top: 10rpx;
  177. padding: 20rpx 80rpx;
  178. border: 1rpx solid #e5e5e5;
  179. border-radius: 40rpx;
  180. }
  181. </style>