bargain.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <template>
  2. <view>
  3. <view class="default" v-if="isIframe && !bargList.length">
  4. <text>{{$t(`砍价模块,暂无数据`)}}</text>
  5. </view>
  6. <view class="combination index-wrapper" v-if="bargList.length&&isShow&&!isIframe">
  7. <view class='title acea-row row-between-wrapper index-wrapper'>
  8. <view class='text'>
  9. <view class='name line1'>{{$t(`砍价活动`)}}</view>
  10. <view class='line1'>{{$t(`呼朋唤友来砍价`)}}</view>
  11. </view>
  12. <navigator class='more' url="/pages/activity/goods_combination/index" hover-class="none">{{$t(`更多`)}}<text class='iconfont icon-jiantou'></text></navigator>
  13. </view>
  14. <view class="conter">
  15. <scroll-view scroll-x="true" style="white-space: nowrap; vertical-align: middle;" show-scrollbar="false">
  16. <view class="itemCon" v-for="(item, index) in bargList" :key="index" @click="bargDetail(item)">
  17. <view class="item">
  18. <view class="pictrue">
  19. <image :src="item.image"></image>
  20. </view>
  21. <view class="name line1">{{item.title}}</view>
  22. <view class="money">
  23. <view class="x_money">{{$t(`¥`)}}<text class="num">{{item.min_price}}</text></view>
  24. <view class="y_money">{{$t(`¥`)}}{{item.ot_price}}</view>
  25. </view>
  26. </view>
  27. </view>
  28. </scroll-view>
  29. </view>
  30. </view>
  31. <view class="combination index-wrapper" v-if="bargList.length&&isIframe">
  32. <view class='title acea-row row-between-wrapper index-wrapper'>
  33. <view class='text'>
  34. <view class='name line1'>{{$t(`砍价活动`)}}</view>
  35. <view class='line1'>{{$t(`呼朋唤友来砍价`)}}</view>
  36. </view>
  37. <navigator class='more'>{{$t(`更多`)}}<text class='iconfont icon-jiantou'></text></navigator>
  38. </view>
  39. <view class="conter">
  40. <scroll-view scroll-x="true" style="white-space: nowrap; vertical-align: middle;" show-scrollbar="false">
  41. <view class="itemCon" v-for="(item, index) in bargList" :key="index" @click="bargDetail(item)">
  42. <view class="item">
  43. <view class="pictrue">
  44. <image :src="item.image"></image>
  45. </view>
  46. <view class="name line1">{{item.title}}</view>
  47. <view class="money">
  48. <view class="x_money">¥<text class="num">{{item.min_price}}</text></view>
  49. <view class="y_money">¥{{item.ot_price}}</view>
  50. </view>
  51. </view>
  52. </view>
  53. </scroll-view>
  54. </view>
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. let app = getApp();
  60. import {
  61. toLogin
  62. } from '@/libs/login.js';
  63. import { mapGetters } from 'vuex';
  64. import {
  65. goPage
  66. } from '@/libs/order.js';
  67. import { getHomeProducts } from '@/api/store.js';
  68. export default {
  69. name: 'bargain',
  70. props: {
  71. dataConfig: {
  72. type: Object,
  73. default: () => {}
  74. }
  75. },
  76. computed: {
  77. ...mapGetters(['isLogin','uid'])
  78. },
  79. watch: {
  80. dataConfig: {
  81. immediate: true,
  82. handler(nVal, oVal) {
  83. if(nVal){
  84. this.isShow = nVal.isShow.val;
  85. this.selectType = nVal.tabConfig.tabVal;
  86. this.$set(this, 'selectId', nVal.selectConfig.activeValue || '');
  87. this.$set(this, 'type', nVal.titleInfo.type);
  88. this.salesOrder = nVal.goodsSort.type == 1 ? 'desc' : '';
  89. this.newsOrder = nVal.goodsSort.type == 2 ? 'news' : '';
  90. this.ids = nVal.ids?nVal.ids.join(','):'';
  91. this.numConfig = nVal.numConfig.val;
  92. this.productslist();
  93. }
  94. }
  95. }
  96. },
  97. data() {
  98. return {
  99. bargList: [],
  100. name:this.$options.name,//component组件固定写法获取当前name;
  101. isIframe:app.globalData.isIframe,//判断是前台还是后台;
  102. isShow:true,//判断此模块是否显示;
  103. selectType:0,
  104. selectId: '',
  105. salesOrder:'',
  106. newsOrder:'',
  107. ids:'',
  108. page: 1,
  109. limit: this.$config.LIMIT,
  110. type: '',
  111. numConfig:0
  112. };
  113. },
  114. created() {
  115. },
  116. mounted() {
  117. },
  118. methods: {
  119. // 产品列表
  120. productslist: function() {
  121. let that = this;
  122. let data = {};
  123. if (that.selectType) {
  124. data = {
  125. page: that.page,
  126. limit: that.limit,
  127. type: that.type,
  128. ids: that.ids,
  129. selectType: that.selectType
  130. }
  131. } else {
  132. data = {
  133. page: that.page,
  134. limit: that.numConfig<=that.limit?that.numConfig:that.limit,
  135. type: that.type,
  136. newsOrder: that.newsOrder,
  137. salesOrder: that.salesOrder,
  138. selectId: that.selectId,
  139. selectType: that.selectType
  140. }
  141. }
  142. getHomeProducts(data).then(res => {
  143. that.bargList = res.data.list;
  144. }).catch(err => {
  145. that.$util.Tips({ title: err });
  146. });
  147. },
  148. bargDetail(item){
  149. goPage(item).then(res=>{
  150. if (!this.isLogin) {
  151. toLogin();
  152. } else {
  153. uni.navigateTo({
  154. url: `/pages/activity/goods_bargain_details/index?id=${item.id}&bargain=${this.uid}`
  155. });
  156. }
  157. })
  158. }
  159. }
  160. }
  161. </script>
  162. <style lang="scss">
  163. .default{
  164. width: 690rpx;
  165. height: 300rpx;
  166. border-radius: 14rpx;
  167. margin: 26rpx auto 0 auto;
  168. background-color: #ccc;
  169. text-align: center;
  170. line-height: 300rpx;
  171. .iconfont{
  172. font-size: 50rpx;
  173. }
  174. }
  175. .combination{
  176. width: 100%;
  177. // height: 288rpx;
  178. background-color: $uni-bg-color;
  179. border-radius: 14rpx;
  180. .conter {
  181. width: 690rpx;
  182. height: 320rpx;
  183. background-color: #FFFFFF;
  184. border-radius: 12px;
  185. margin: 26rpx auto 0 auto;
  186. .itemCon {
  187. display: inline-block;
  188. width: 174rpx;
  189. margin-right: 24rpx;
  190. .item {
  191. width: 100%;
  192. .pictrue {
  193. width: 100%;
  194. height: 174rpx;
  195. border-radius: 6rpx;
  196. image {
  197. width: 100%;
  198. height: 100%;
  199. border-radius: 6rpx;
  200. }
  201. }
  202. .name {
  203. font-size: 24rpx;
  204. color: #333333;
  205. margin-top: 10rpx;
  206. }
  207. .money {
  208. .y_money {
  209. font-size: 20rpx;
  210. color: #999999;
  211. text-decoration: line-through;
  212. }
  213. .x_money {
  214. color: #FD502F;
  215. font-size: 24rpx;
  216. font-weight: bold;
  217. margin-top: 3rpx;
  218. .num {
  219. font-size: 28rpx;
  220. }
  221. }
  222. }
  223. }
  224. }
  225. }
  226. }
  227. </style>