app-index-wholesale.vue 9.3 KB

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