my-shop.vue 13 KB

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