app-index-wholesale.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <template>
  2. <view class="app-index-wholesale">
  3. <view class="top dir-left-nowrap cross-center" @click="jump(`/plugins/wholesale/index/index`)">
  4. <image class="box-grow-0" src="../../../static/image/icon/wholesale.png"></image>
  5. <view class="box-grow-1">商品批发</view>
  6. <view class="dir-left-nowrap cross-center">
  7. <view class="box-grow-0 more">更多</view>
  8. <image class="box-grow-0 icon" src="../../../static/image/icon/arrow-right.png"></image>
  9. </view>
  10. </view>
  11. <view v-if="style == '1'" class="dir-left-nowrap list">
  12. <block v-for="(item, key) in newData" :key="key">
  13. <app-form-id @click="jump_router(item)">
  14. <view class="item box-grow-0 dir-top-nowrap">
  15. <view class="cover-pic box-grow-0">
  16. <view class="out-dialog" v-if="item.goods_stock == 0 && appSetting.is_show_stock == '1'">
  17. <image :src="appSetting.is_use_stock == '1' ? appImg.plugins_out : appSetting.sell_out_pic"></image>
  18. </view>
  19. <app-image :img-src="item.cover_pic" width="220rpx" height="220rpx"></app-image>
  20. </view>
  21. <view class="title t-omit-two box-grow-0">{{item.name}}</view>
  22. <view class="box-grow-1 dir-top-nowrap main-right">
  23. <view v-if="item.is_level == 1 && item.is_negotiable == 0">
  24. <app-member-price :theme="getTheme" :price="item.level_price"></app-member-price>
  25. </view>
  26. <app-sup-vip :is_vip_card_user="item.vip_card_appoint.is_vip_card_user" margin="4rpx 0 0" v-if="item.vip_card_appoint.discount > 0 && item.is_negotiable == 0" :discount="item.vip_card_appoint.discount"></app-sup-vip>
  27. <view v-if="item.is_negotiable == 1" class="price" :style="{'color': getTheme.color}">价格面议</view>
  28. <view v-if="item.is_negotiable == 0" :style="{'color': getTheme.color}" class="price dir-left-nowrap">
  29. <text class="text" style="font-size: 28rpx;" >¥{{item.price}}</text>
  30. </view>
  31. <view v-if="item.is_negotiable == 0 && isListUnderlinePrice == 1" class="old-price">
  32. ¥{{item.goodsWarehouse.original_price}}
  33. </view>
  34. </view>
  35. <view class="cross-center count">{{item.group_count}}</view>
  36. </view>
  37. </app-form-id>
  38. </block>
  39. </view>
  40. <view v-if="style === '2'">
  41. <u-ordinary-list :showBuyBtn="false" :theme="getTheme" :list-style="2" :list="newData"></u-ordinary-list>
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. import {mapGetters, mapState} from 'vuex';
  47. import uOrdinaryList from '@/components/page-component/u-goods-list/u-ordinary-list.vue';
  48. export default {
  49. name: "app-index-wholesale",
  50. props: {
  51. index: Number,
  52. page_id: Number,
  53. is_required: Boolean
  54. },
  55. data() {
  56. return {
  57. appAttr: {},
  58. selectAttr: null,
  59. wholesaleDiscount: 0,
  60. totalNumber: 0,
  61. totalPrice: '0.00',
  62. newData: {},
  63. style: '1',
  64. goods_num: 20,
  65. attrGoods: {
  66. goods: null,
  67. attrShow: 0
  68. },
  69. show: 0,
  70. attrShow: false
  71. };
  72. },
  73. computed: {
  74. ...mapState({
  75. appImg: state => state.mallConfig.__wxapp_img.mall,
  76. appSetting: state => state.mallConfig.mall.setting,
  77. mall: state => state.mallConfig.mall,
  78. isListUnderlinePrice: state => state.mallConfig.mall.setting.is_list_underline_price
  79. }),
  80. ...mapGetters('mallConfig', {
  81. getTheme: 'getTheme',
  82. }),
  83. ...mapGetters('mallConfig',{
  84. vip: 'getVip'
  85. }),
  86. ...mapGetters('mallConfig', {
  87. getVideo: 'getVideo'
  88. })
  89. },
  90. methods: {
  91. jump(url) {
  92. this.$jump({
  93. url: url,
  94. open_type: 'navigate'
  95. })
  96. },
  97. jump_router(data) {
  98. uni.navigateTo({
  99. url: `/plugins/wholesale/goods/goods?id=${data.id}`
  100. })
  101. },
  102. loadData() {
  103. let para = {
  104. type: this.page_id === 0 ? 'mall' : 'diy',
  105. key: 'wholesale',
  106. page_id: this.page_id,
  107. index: this.index
  108. }
  109. if(this.goods_num) {
  110. para.goods_num = this.goods_num
  111. }
  112. this.$request({
  113. url: this.$api.index.extra,
  114. data: para
  115. }).then(info => {
  116. if (info.code === 0 && info.data) {
  117. this.newData = info.data.list;
  118. if (this.page_id === 0) {
  119. let storage = this.$storage.getStorageSync('INDEX_MALL');
  120. storage.home_pages[this.index].list = this.newData;
  121. this.$storage.setStorageSync('INDEX_MALL', storage);
  122. }
  123. }
  124. })
  125. },
  126. },
  127. components: {
  128. uOrdinaryList
  129. },
  130. mounted() {
  131. let storage = this.$storage.getStorageSync('INDEX_MALL');
  132. this.style = storage.home_pages[this.index].style;
  133. this.goods_num = storage.home_pages[this.index].goods_num;
  134. if (this.is_required) {
  135. this.loadData();
  136. } else {
  137. this.newData = storage.home_pages[this.index].list;
  138. }
  139. },
  140. }
  141. </script>
  142. <style scoped lang="scss">
  143. .text1 {
  144. color: #ff8831;
  145. font-size: $uni-font-size-general-one;
  146. }
  147. .app-index-wholesale {
  148. .top {
  149. padding: #{0 24rpx};
  150. color: #ff4544;
  151. font-size: $uni-font-size-general-one;
  152. height: #{72rpx};
  153. background-color: white;
  154. image {
  155. width: #{46rpx};
  156. height: #{46rpx};
  157. display: block;
  158. margin-right: #{8rpx};
  159. }
  160. .more {
  161. font-size: $uni-font-size-general-two;
  162. margin-right: #{12rpx};
  163. color: $uni-general-color-two;
  164. }
  165. .icon {
  166. width: #{12rpx};
  167. height: #{22rpx};
  168. display: block;
  169. }
  170. }
  171. .list {
  172. margin-top: #{8rpx};
  173. overflow-x: auto;
  174. -webkit-overflow-scrolling: touch;
  175. .item {
  176. background-color: #ffffff;
  177. margin-right: #{8rpx};
  178. padding: #{20rpx 20rpx 24rpx 20rpx};
  179. height: 100%;
  180. border-radius: #{8rpx};
  181. .cover-pic {
  182. width: #{220rpx};
  183. height: #{220rpx};
  184. display: block;
  185. margin-bottom: #{20rpx};
  186. .out-dialog {
  187. width: #{220rpx};
  188. height: #{220rpx};
  189. position: absolute;
  190. top: #{20rpx};
  191. left: #{20rpx};
  192. z-index: 10;
  193. background-color: rgba(0,0,0,.5);
  194. image {
  195. width: #{220rpx};
  196. height: #{220rpx};
  197. }
  198. }
  199. }
  200. .title {
  201. font-size: 26upx;
  202. line-height: #{32upx};
  203. color: $uni-important-color-black;
  204. width: #{220rpx};
  205. }
  206. .price {
  207. .text {
  208. text-overflow: ellipsis;
  209. -webkit-box-orient: vertical;
  210. -webkit-line-clamp: 1;
  211. overflow: hidden;
  212. line-height: 1;
  213. vertical-align: sub;
  214. margin-top: #{10rpx};
  215. }
  216. }
  217. .old-price {
  218. font-size: #{21upx};
  219. line-height: 1;
  220. color: #999999;
  221. text-decoration:line-through;
  222. margin: #{5upx 0 20upx 0};
  223. }
  224. .count {
  225. font-size: $uni-font-size-weak-one;
  226. color: $uni-general-color-two;
  227. }
  228. }
  229. }
  230. }
  231. </style>