yixuan_shang.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <template>
  2. <view class="padding">
  3. <view class="text-white padding bg radius">
  4. <!-- 商品列表 -->
  5. <view style="margin-left: -16px;">
  6. <view v-for="(item,index) in shangList" class="shang_list">
  7. <image class="shang_image" :src="item.goodsPicture.split(',')[0]"></image>
  8. <view class="shang_name">{{item.goodsName}}</view>
  9. <view class="shang_time">{{item.createTime}}</view>
  10. </view>
  11. </view>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. data() {
  18. return {
  19. customStyle: {
  20. backgroundColor: '#FFCC00',
  21. color: '#000000',
  22. border: 0
  23. },
  24. shangList:[],
  25. actShopid:'',
  26. page: 1,
  27. limit: 10,
  28. }
  29. },
  30. onLoad(option) {
  31. this.actShopid=option.actShopid
  32. //已选择的商品
  33. this.selectShang()
  34. },
  35. methods: {
  36. //已选择的商品
  37. selectShang(){
  38. // var shopId=uni.getStorageSync('shopId')
  39. this.$Request.get(`/admin/activity-goods/${this.actShopid}`).then(res => {
  40. if (res.code == 0) {
  41. let returnData = res.data
  42. //活动列表
  43. this.allShang(returnData)
  44. }else{
  45. uni.showModal({
  46. content:res.msg
  47. })
  48. }
  49. });
  50. },
  51. //店铺所有商品
  52. allShang(returnData){
  53. let data = {
  54. page: this.page,
  55. limit: this.limit,
  56. shopId: uni.getStorageSync('shopId'),
  57. }
  58. this.$Request.getA("/admin/goodsShop/selectGoodsByShopId", data).then(res => {
  59. if (res.code == 0) {
  60. var total = res.data.totalCount
  61. let data2 = {
  62. page: this.page,
  63. limit: total,
  64. shopId: uni.getStorageSync('shopId'),
  65. }
  66. this.$Request.getA("/admin/goodsShop/selectGoodsByShopId", data2).then(res => {
  67. if (res.code == 0) {
  68. uni.hideLoading()
  69. let newList = res.data.list
  70. var arr = []
  71. for(var j in returnData){
  72. newList.forEach(item => {
  73. if (item.goodsId === returnData[j]) {
  74. arr.push(item)
  75. }
  76. })
  77. }
  78. this.shangList = arr
  79. }
  80. })
  81. }
  82. uni.stopPullDownRefresh();
  83. uni.hideLoading()
  84. });
  85. },
  86. }
  87. }
  88. </script>
  89. <style>
  90. page {
  91. /* background-color: #F5F5F5; */
  92. }
  93. .padding{
  94. padding-top: 0px;
  95. }
  96. /* 商品列表 */
  97. .shang_list{
  98. width: 711rpx;
  99. height: 160rpx;
  100. margin-top: 20rpx;
  101. opacity: 1;
  102. background: rgba(255, 255, 255, 1);
  103. }
  104. .shang_circle{
  105. position: absolute;
  106. margin: 50rpx 0 0 41rpx;
  107. width: 60rpx;
  108. height: 60rpx;
  109. border-radius: 86rpx;
  110. border: 1rpx solid rgba(166, 166, 166, 1);
  111. }
  112. .shang_circle_select{
  113. position: absolute;
  114. margin: 50rpx 0 0 41rpx;
  115. width: 60rpx;
  116. height: 60rpx;
  117. border-radius: 86rpx;
  118. background-color:rgba(245, 211, 71, 1);
  119. }
  120. .shang_image{
  121. position: absolute;
  122. margin: 31rpx 0 0 41rpx;
  123. width: 100rpx;
  124. height: 100rpx;
  125. border-radius: 6rpx;
  126. /* background: url(https://img.js.design/assets/smartFill/img395164da755928.jpeg), rgba(204, 204, 204, 1); */
  127. }
  128. .shang_name{
  129. position: absolute;
  130. margin: 29rpx 0 0 159rpx;
  131. font-size: 32rpx;
  132. color: rgba(0, 0, 0, 1);
  133. }
  134. .shang_time{
  135. position: absolute;
  136. margin: 90rpx 0 0 159rpx;
  137. font-size: 24rpx;
  138. color: rgba(153, 153, 153, 1);
  139. }
  140. </style>