my-shop.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. <template>
  2. <view class="container shop clearfix" :style="{paddingTop:CustomBar+'px'}">
  3. <!-- 主页内容 -->
  4. <view class="container-shop tui-skeleton">
  5. <!-- 轮播 -->
  6. <view class="shop-search">
  7. <text class="iconfont icon-sousuo"></text>
  8. <input class="input" type="text" value="" placeholder="搜索本店铺商品"/>
  9. </view>
  10. <view class="product-supplier" @click="goSupplier">
  11. <view class="logo"><img src="https://img.caimei365.com/group1/M00/03/4B/Cmis210DQ_qAIoyoAAKD15t_iQc959.png" alt=""></view>
  12. <view class="main">
  13. <view class="name">北京恩盛众成国际贸易有限公司</view>
  14. <view class="massgs">
  15. <view class="label">满意度:</view>
  16. <view class="p-stars">
  17. <uni-stars :stars="6" :iconClass="iconClass" :iconColor="iconColor" :fontSize="36" :widthInfo="176"></uni-stars>
  18. </view>
  19. <view class="acount">
  20. <text>50</text>件商品
  21. </view>
  22. </view>
  23. </view>
  24. <view class="right"><text class="iconfont icon-xiayibu"></text></view>
  25. </view>
  26. <banner :list="bannerImageList"></banner>
  27. </view>
  28. <view class="container-section tui-skeleton">
  29. <view class="title">主推商品</view>
  30. <view class="section-product clearfix">
  31. <view class="floor-item" v-for="(item, index) in organizeProducts" :key="index" @click.stop="navToDetailPage(item.productID)">
  32. <image class="tui-skeleton-fillet" :src="item.mainImage" mode="aspectFill"></image>
  33. <view class="floor-item-content">
  34. <view class="title tui-skeleton-rect">
  35. <text class="mclap">{{item.name}}</text>
  36. </view>
  37. <view class="floor-item-act">
  38. <template v-if="item.actStatus==1">
  39. <view class="floor-tags" v-if="PromotionsFormat(item.promotions)">
  40. {{item.promotions.name}}<text v-if="hasLogin && item.price1TextFlag != '1'">:¥{{item.price | NumFormat}}</text>
  41. </view>
  42. <view class="floor-tags" v-else>{{item.promotions.name}}</view>
  43. </template>
  44. <template v-if="item.actStatus ==0 && item.ladderPriceFlag==1">
  45. <view class="floor-tags">阶梯价格</view>
  46. </template>
  47. </view>
  48. <view class="" v-if="hasLogin">
  49. <view v-if="userIdentity == 4">
  50. <view class="title-none" v-show="item.price1TextFlag == '1'">
  51. <text class="p big">¥未公开价格</text>
  52. </view>
  53. <view class="title-none" v-show="item.price1TextFlag == '2'">
  54. <text class="p big">¥价格仅会员可见</text>
  55. </view>
  56. <view class="price tui-skeleton-rect" v-show="item.price1TextFlag == '0'" :class="PromotionsFormat(item.promotions) ? 'none' : ''">
  57. <text class="p sm">¥</text>
  58. <text class="p big">{{ (PromotionsFormat(item.promotions) ? item.originalPrice : item.price ) | NumFormat}}</text>
  59. </view>
  60. </view>
  61. <view v-else>
  62. <view class="title-none" v-if="item.price1TextFlag == '1'">
  63. <text class="p big">未公开价格</text>
  64. </view>
  65. <view class="price tui-skeleton-rect" v-else :class="PromotionsFormat(item.promotions) ? 'none' : ''">
  66. <text class="p sm">¥</text>
  67. <text class="p big">{{ (PromotionsFormat(item.promotions) ? item.originalPrice : item.price ) | NumFormat}}</text>
  68. </view>
  69. </view>
  70. </view>
  71. <view v-else class="no-price">
  72. <view class="p-stars">
  73. <text class="p-no">¥</text>
  74. <uni-stars :stars="parseInt(item.price1Grade)" :fontSize="36" :widthInfo="180"></uni-stars>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. <!-- 侧边 -->
  82. <scroll-top v-if="isScrollTop"></scroll-top>
  83. </view>
  84. </template>
  85. <script>
  86. import { mapState,mapMutations} from 'vuex';
  87. import banner from '@/components/cm-module/supplier/banner.vue'
  88. import uniStars from '@/components/uni-stars/uni-stars.vue'
  89. import authorize from '@/common/config/authorize.js'
  90. export default {
  91. components:{
  92. banner,
  93. uniStars
  94. },
  95. data() {
  96. return {
  97. userID:0,
  98. iconClass:'icon-aixin',
  99. iconColor:'#ff9100',
  100. isScrollTop:false,
  101. bannerImageList:[
  102. {image:'https://m.360buyimg.com/mobilecms/s700x280_jfs/t1/114550/12/7437/102254/5ec3971fE78db18f4/438d4775f9d653ee.jpg!q70.jpg.dpg'},
  103. {image:'https://m.360buyimg.com/mobilecms/s700x280_jfs/t1/126187/19/17323/149042/5fa13ef1E6bc65f5b/8fbecafdbf0e4736.jpg!q70.jpg.dpg'},
  104. {image:'https://m.360buyimg.com/mobilecms/s700x280_jfs/t1/126522/38/16493/151268/5f9940bfE9bf4ce43/b9a09e36102a9667.jpg!q70.jpg.dpg'}
  105. ],
  106. organizeProducts:[]
  107. }
  108. },
  109. onLoad() {
  110. },
  111. filters: {
  112. NumFormat:function(text) {//处理金额
  113. return Number(text).toFixed(2);
  114. },
  115. },
  116. computed: {
  117. ...mapState(['hasLogin','userInfo','isActivity'])
  118. },
  119. methods: {
  120. ...mapMutations(['login','logout']),
  121. getOrganizeProducts(){//获取模块三商品
  122. this.ProductService.queryProductPreferred({userId:this.userID,preferredFlag:100,pageNum:1,pageSize:4}).then(res =>{
  123. this.organizeProducts = res.data.results
  124. this.getProductPrice()
  125. }).catch(error =>{
  126. this.$util.msg(error.msg,2000)
  127. })
  128. },
  129. getProductPrice(){//获取商品或者活动价格
  130. let productIdArr = [];
  131. let productIds ='';
  132. this.organizeProducts.map(item=>{// 0公开价格 1不公开价格 2仅对会员机构公开
  133. productIdArr.push(item.productID)
  134. })
  135. productIds = productIdArr.join(",");
  136. this.ProductService.querySearchProductPrice({userId: this.userID,productIds:productIds}).then(response =>{
  137. this.organizeProducts = this.ReturnNewProducts(this.organizeProducts,response.data);
  138. this.skeletonShow = false;
  139. }).catch(error =>{
  140. this.$util.msg(error.msg,2000)
  141. })
  142. },
  143. ReturnNewProducts(Array,list){
  144. let NewArray = []
  145. Array.map(item=>{
  146. for (let i = 0; i < list.length; i++) {
  147. if( item.productID == list[i].productId ){
  148. NewArray.push(Object.assign(item,list[i]))
  149. }
  150. }
  151. });
  152. return NewArray
  153. },
  154. },
  155. onPageScroll(e){//实时获取到滚动的值
  156. if(e.scrollTop>400){
  157. this.isScrollTop = true
  158. }else{
  159. this.isScrollTop = false
  160. }
  161. },
  162. onPullDownRefresh() {//下拉刷新
  163. this.getHomeInformation()
  164. uni.stopPullDownRefresh()
  165. },
  166. onShow(){
  167. this.getOrganizeProducts()
  168. }
  169. }
  170. </script>
  171. <style lang="scss">
  172. page{
  173. background-color: #F7F7F7;
  174. }
  175. .shop{
  176. width: 100%;
  177. height: auto;
  178. }
  179. .container-shop{
  180. width: 100%;
  181. height: auto;
  182. padding:24rpx;
  183. box-sizing: border-box;
  184. background-color: #FFFFFF;
  185. }
  186. .shop-search{
  187. width: 100%;
  188. height: 66rpx;
  189. border-radius: 33rpx;
  190. background-color: #F7F7F7;
  191. box-sizing: border-box;
  192. padding: 0 20rpx;
  193. .icon-sousuo{
  194. width: 60rpx;
  195. height: 66rpx;
  196. display: block;
  197. float: left;
  198. color: #707070;
  199. line-height: 66rpx;
  200. text-align: center;
  201. font-size: 36rpx;
  202. }
  203. .input{
  204. width: 600rpx;
  205. height: 66rpx;
  206. box-sizing: border-box;
  207. padding: 0 20rpx;
  208. color: #666666;
  209. overflow: hidden;
  210. font-size: $font-size-24;
  211. }
  212. }
  213. .product-supplier{
  214. width: 100%;
  215. height: 140rpx;
  216. padding: 30rpx 0 10rpx 0;
  217. box-sizing: border-box;
  218. background-color: #FFFFFF;
  219. position: relative;
  220. box-sizing: border-box;
  221. .logo{
  222. width: 128rpx;
  223. height: 92rpx;
  224. float: left;
  225. border: 1px solid #efefef;
  226. border-radius: 6rpx;
  227. image{
  228. width: 100%;
  229. height: 100%;
  230. display: block;
  231. border-radius: 6rpx;
  232. }
  233. }
  234. .main{
  235. width: 470rpx;
  236. height: 92rpx;
  237. float: left;
  238. margin-left: 20rpx;
  239. .name{
  240. width: 100%;
  241. line-height: 46rpx;
  242. float: left;
  243. font-size: $font-size-28;
  244. color: $text-color;
  245. float: right;
  246. overflow: hidden;
  247. text-overflow:ellipsis;
  248. white-space: nowrap;
  249. text-align: left;
  250. }
  251. .massgs{
  252. width: 100%;
  253. line-height: 46rpx;
  254. float: left;
  255. font-size: $font-size-24;
  256. color: #999999;
  257. .label{
  258. float: left;
  259. }
  260. .p-stars{
  261. float: left;
  262. margin-left: 20rpx;
  263. }
  264. .acount{
  265. float: right;
  266. text{
  267. color: $color-system;
  268. }
  269. }
  270. }
  271. }
  272. .icon-xiayibu{
  273. line-height: 154rpx;
  274. display: inline-block;
  275. position: absolute;
  276. width: 48rpx;
  277. top: 0;
  278. right: 0;
  279. color: #b2b2b2;
  280. }
  281. }
  282. .container-section{
  283. width: 100%;
  284. height: auto;
  285. background-color: #F7F7F7;
  286. box-sizing: border-box;
  287. padding: 0 24rpx;
  288. .title{
  289. width: 100%;
  290. height: 88rpx;
  291. line-height: 88rpx;
  292. font-size: $font-size-30;
  293. font-weight: bold;
  294. }
  295. .section-product{
  296. width: 100%;
  297. height: auto;
  298. .floor-item{
  299. width: 341rpx;
  300. height: auto;
  301. margin-right: 20rpx;
  302. font-size: $font-size-24;
  303. color: $text-color;
  304. background: #FFFFFF;
  305. line-height: 36rpx;
  306. border-radius: 2rpx;
  307. margin-bottom: 20rpx;
  308. float: left;
  309. box-sizing: border-box;
  310. padding-bottom: 16rpx;
  311. &:nth-child(2n){
  312. margin-right: 0;
  313. }
  314. image{
  315. width: 341rpx;
  316. height: 341rpx;
  317. border-radius: 20rpx 20rpx 0 0;
  318. display: block;
  319. margin-bottom: 20rpx;
  320. }
  321. .floor-item-content{
  322. width: 311rpx;
  323. padding: 0 15rpx;
  324. }
  325. .floor-item-act{
  326. display: block;
  327. width: 100%;
  328. height: 68rpx;
  329. text-align: center;
  330. box-sizing: border-box;
  331. padding: 16rpx 0;
  332. margin-top: 8rpx;
  333. .floor-tags{
  334. float: left;
  335. height: 36rpx;
  336. border-radius: 4rpx;
  337. background-color: rgba(225, 86, 22, 0.1);
  338. line-height: 36rpx;
  339. color: $color-system;
  340. text-align: center;
  341. display: inline-block;
  342. padding:0 16rpx;
  343. font-size: $font-size-20;
  344. }
  345. }
  346. .title-none{
  347. font-size: $font-size-26;
  348. color: #FF2A2A;
  349. line-height: 44rpx;
  350. .btn{
  351. display: inline-block;
  352. float: right;
  353. width: 112rpx;
  354. height: 44rpx;
  355. background: $btn-confirm;
  356. line-height: 44rpx;
  357. font-size: $font-size-24;
  358. color: #FFFFFF;
  359. text-align: center;
  360. border-radius: 22rpx;
  361. margin-top: 17rpx;
  362. }
  363. }
  364. .title{
  365. width: 100%;
  366. height: 72rpx;
  367. display: flex;
  368. flex-direction: column;
  369. .mclap{
  370. width: 100%;
  371. line-height: 36rpx;
  372. text-overflow:ellipsis;
  373. display: -webkit-box;
  374. word-break: break-all;
  375. -webkit-box-orient: vertical;
  376. -webkit-line-clamp: 2;
  377. overflow: hidden;
  378. font-size: 26rpx;
  379. }
  380. }
  381. .no-price{
  382. height: 54rpx;
  383. line-height: 54rpx;
  384. display: flex;
  385. box-sizing: border-box;
  386. .p-no{
  387. font-size: $font-size-30;
  388. color: $text-color;
  389. display: block;
  390. float: left;
  391. }
  392. .p-stars{
  393. width: 230rpx;
  394. float: left;
  395. }
  396. }
  397. .price{
  398. color: #FF2A2A;
  399. line-height: 44rpx;
  400. &.none{
  401. text-decoration: line-through;
  402. color: #999999;
  403. }
  404. .sm{
  405. font-size: $font-size-24;
  406. }
  407. .big{
  408. font-size: $font-size-28;
  409. }
  410. }
  411. }
  412. }
  413. }
  414. </style>