多租户商城-商户小程序端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

448 lines
12 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <view class="header">
  3. <view class="tabs-nav-warp">
  4. <scroll-view class="tabs-nav" scroll-x="true">
  5. <view class="ul">
  6. <view class="li" :class="{'on':activeTab===0}" @click="tabChange(0)"
  7. v-if="componentContent.firstClassify">
  8. {{ componentContent.firstClassify }}
  9. </view>
  10. <view class="li" :class="{'on':activeTab===index+beginIndex}" v-for="(item,index) in classifyData"
  11. :key="index" @click="tabChange(index+beginIndex,item.id)">
  12. {{item.categoryName}}
  13. </view>
  14. </view>
  15. </scroll-view>
  16. </view>
  17. <div class="hom-pro-list" v-if="productData.length>0">
  18. <div class="product-swiper">
  19. <div class="product-swiper-box">
  20. <div class="product-swiper-warp" v-for="(item,index) in productData" :key="index">
  21. <div class=" product-swiper-item" @click="jumpProductDetail(item)">
  22. <div class="product-swiper-img">
  23. <img class="img pic-img default-img" :src="item.image"
  24. onerror="this.src='url(http://36.138.125.206:8081/ceres-local-file/image/default.png) no-repeat center';this.οnerrοr=null">
  25. </div>
  26. <image v-if="item.ifCollect === 1" class="collect-img" src="http://36.138.125.206:8081/ceres-local-file/image/prod_collect_active.png" @click.stop="onCollect(item, 0)"/>
  27. <image v-else class="collect-img" src="http://36.138.125.206:8081/ceres-local-file/image/prod_collect_normal.png" @click.stop="onCollect(item, 1)"/>
  28. <div class="product-swiper-info">
  29. <div class="product-info-content">
  30. <div class="product-name-row">
  31. <label class="product-name">{{item.productName}}</label>
  32. <!-- <image class="product-star"
  33. src="http://36.138.125.206:8081/ceres-local-file/image/icon_star.png">
  34. </image>
  35. <label class="product-star-text">3.5</label>-->
  36. </div>
  37. <div class="product-sku-row" v-if="false">
  38. <label class="product-sku-name">规格</label>
  39. </div>
  40. <div class="product-price-row">
  41. <div class="price-warp">
  42. <!-- #ifdef MP-WEIXIN -->
  43. <img class="iconImg" v-if="item.activityType == 1"
  44. src="../../../static/images/groupBuyIcon.png">
  45. <img class="iconImg" v-if="item.activityType == 2"
  46. src="../../../static/images/spikeIcon.png">
  47. <img class="iconImg" v-if="item.activityType == 4"
  48. src="../../../static/images/spikeIcon.png">
  49. <img class="iconImg" v-if="item.activityType == 3"
  50. src="../../../static/images/discountListIcon.png">
  51. <img class="iconImg" v-if="item.activityType == 5"
  52. src="../../../static/images/discountListIcon.png">
  53. <img class="iconImg" v-if="item.activityType == 9"
  54. src="../../../static/images/memberCenterIcon.png">
  55. <img class="iconImg" v-if="item.activityType == 8"
  56. src="https://zk-cereshop.oss-cn-shenzhen.aliyuncs.com/zkthink/2022-02-15/d0d8d96f28904167b271de4ae924d1a8_sceneMarketing.png">
  57. <!-- #endif -->
  58. <!-- #ifdef H5 || APP-PLUS -->
  59. <image class="iconImg" v-if="item.activityType == 1"
  60. src="../../../static/images/groupBuyIcon.png"></image>
  61. <image class="iconImg" v-if="item.activityType == 2"
  62. src="../../../static/images/spikeIcon.png"></image>
  63. <image class="iconImg" v-if="item.activityType == 4"
  64. src="../../../static/images/spikeIcon.png"></image>
  65. <image class="iconImg" v-if="item.activityType == 3"
  66. src="../../../static/images/discountListIcon.png"></image>
  67. <image class="iconImg" v-if="item.activityType == 5"
  68. src="../../../static/images/discountListIcon.png"></image>
  69. <image class="iconImg" v-if="item.activityType == 9"
  70. src="../../../static/images/memberCenterIcon.png"></image>
  71. <image class="iconImg" v-if="item.activityType == 8"
  72. src="https://zk-cereshop.oss-cn-shenzhen.aliyuncs.com/zkthink/2022-02-15/d0d8d96f28904167b271de4ae924d1a8_sceneMarketing.png">
  73. </image>
  74. <!-- #endif -->
  75. <div class="price">
  76. ¥<span style="margin-left: 5rpx">{{item.price | radixPointBefore}}</span>
  77. <span style="font-size: 20rpx">{{item.price | radixPointAfter}}</span>
  78. </div>
  79. <!-- <div class="original-price">-->
  80. <!-- ¥ {{item.originalPrice}}-->
  81. <!-- </div>-->
  82. </div>
  83. <image class="product-add"
  84. src="http://36.138.125.206:8081/ceres-local-file/image/icon_add.png"></image>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. <div class="pagination new-pagination"></div>
  92. </div>
  93. <button v-show="componentContent.showMore" class="btn-more"
  94. @click="jumpProList(componentContent.productData)">查看全部 <span
  95. class="icon iconfont icon-arrow-right"></span></button>
  96. </div>
  97. </view>
  98. </template>
  99. <script>
  100. const NET = require('../../../../../utils/request')
  101. const API = require('../../../../../config/api')
  102. import {
  103. commonMixin
  104. } from '../mixin'
  105. export default {
  106. mixins: [commonMixin],
  107. data() {
  108. return {
  109. }
  110. },
  111. computed: {
  112. },
  113. methods: {
  114. //state:1收藏,0取消收藏
  115. onCollect(item, state){
  116. let _this = this;
  117. if (state === 1){
  118. NET.request(API.collect, {
  119. productId: parseInt(item.productId)
  120. }, 'POST').then(res => {
  121. // item.ifCollect = 1;
  122. _this.$set(item, 'ifCollect', 1);
  123. uni.showToast({
  124. title: this.$t('common.collectsuccess'),
  125. icon: "success"
  126. })
  127. })
  128. }else {
  129. NET.request(API.cancelCollect, {
  130. ids: [item.productId]
  131. }, 'PUT').then(res => {
  132. // item.ifCollect = 0;
  133. _this.$set(item, 'ifCollect', 0);
  134. uni.showToast({
  135. title: this.$t('common.cancelcollectsuccess'),
  136. icon: "success"
  137. })
  138. })
  139. }
  140. }
  141. }
  142. }
  143. </script>
  144. <style lang="scss" scoped>
  145. .header {
  146. .top-box {
  147. display: flex;
  148. align-items: center;
  149. justify-content: space-between;
  150. padding-left: 30upx;
  151. width: 100%;
  152. .logo {
  153. // width: 280upx;
  154. height: 70upx;
  155. margin-top: 0upx;
  156. }
  157. .search-btn {
  158. height: 66upx;
  159. background: rgba(255, 255, 255, 1);
  160. border-radius: 33upx;
  161. display: flex;
  162. flex-direction: row;
  163. align-items: center;
  164. margin-right: 30upx;
  165. .search-icon {
  166. width: 60upx;
  167. height: 60upx;
  168. }
  169. }
  170. }
  171. }
  172. .tabs-nav-warp {
  173. margin-top: 50upx;
  174. padding: 0 30upx;
  175. overflow: hidden;
  176. .tabs-nav {
  177. height: 90rpx;
  178. .ul {
  179. display: flex;
  180. flex-wrap: nowrap;
  181. justify-content: space-between;
  182. padding-left: 20upx;
  183. padding-right: 20upx;
  184. .li {
  185. flex: 1 0 auto;
  186. margin-left: 5upx;
  187. margin-right: 5upx;
  188. font-size: 30upx;
  189. color: #252744;
  190. position: relative;
  191. padding-bottom: 15upx;
  192. padding-left: 27upx;
  193. padding-right: 27upx;
  194. padding-top: 15upx;
  195. text-align: center;
  196. &:first-child {
  197. margin-left: 0;
  198. }
  199. &.on {
  200. // &:after{
  201. // content: '';
  202. // width: 100%;
  203. // height: 4upx;
  204. // background: #252744;
  205. // position: absolute;
  206. // left: 0;
  207. // bottom: 0;
  208. // }
  209. background: #252744;
  210. box-shadow: 0upx 7upx 30upx 0upx #C5C8ED;
  211. border-radius: 40upx;
  212. color: white;
  213. }
  214. }
  215. }
  216. }
  217. }
  218. .hom-pro-list {
  219. ::v-deep .swiper-wrapper {
  220. position: static;
  221. }
  222. /**横向滑动**/
  223. .product-swiper {
  224. height: auto;
  225. overflow: hidden;
  226. margin: 5upx 34upx;
  227. background-color: #FAFAFA;
  228. &+.btn-more {
  229. margin-top: 20upx;
  230. }
  231. .title {
  232. padding: 22upx 0upx 0 0;
  233. label {
  234. background-image: none;
  235. color: #A56C4C;
  236. font-style: italic;
  237. padding: 0;
  238. }
  239. }
  240. &-box {
  241. margin-top: 18upx;
  242. margin-bottom: 18upx;
  243. margin-left: 18upx;
  244. margin-right: 18upx;
  245. height: 100%;
  246. width: 100%;
  247. display: flex;
  248. overflow-x: auto;
  249. }
  250. &-warp {
  251. height: 575rpx;
  252. width: 386rpx !important;
  253. margin-left: 18upx;
  254. margin-right: 18upx;
  255. }
  256. &-item {
  257. height: 540upx;
  258. width: 386upx !important;
  259. position: relative;
  260. }
  261. .collect-img {
  262. width: 56rpx;
  263. height: 56rpx;
  264. position: absolute;
  265. right: 35rpx;
  266. top: 15rpx;
  267. z-index: 999;
  268. }
  269. &-img {
  270. width: 286upx;
  271. height: 306upx;
  272. margin-left: auto;
  273. margin-right: auto;
  274. background: #F6F6F8;
  275. border: 2upx solid #FFFFFF;
  276. border-radius: 30upx;
  277. position: relative;
  278. padding: 20upx;
  279. z-index: 2;
  280. .img {
  281. width: 100%;
  282. height: 100%;
  283. object-fit: contain;
  284. }
  285. }
  286. &-info {
  287. width: 386upx;
  288. height: 430upx;
  289. position: absolute;
  290. top: 110upx;
  291. background: #FDFDFD;
  292. box-shadow: 0upx 15upx 30upx 0upx #F6F6F6;
  293. border-radius: 30upx;
  294. text-align: center;
  295. .product-info-content {
  296. margin-top: 270upx;
  297. .product-name-row {
  298. width: 100%;
  299. height: 33upx;
  300. line-height: 33upx;
  301. display: flex;
  302. flex-direction: row;
  303. flex-wrap: nowrap;
  304. align-content: center;
  305. justify-content: flex-start;
  306. align-items: center;
  307. .product-name {
  308. width: 100%;
  309. height: auto;
  310. font-size: 28upx;
  311. font-family: Source Han Sans CN;
  312. font-weight: bold;
  313. color: #252744;
  314. display: block;
  315. overflow: hidden;
  316. text-overflow: ellipsis;
  317. white-space: nowrap;
  318. line-height: 28upx;
  319. margin-left: 30upx;
  320. text-align: left;
  321. }
  322. .product-star {
  323. width: 33upx;
  324. height: 33upx;
  325. }
  326. .product-star-text {
  327. width: auto;
  328. height: 28upx;
  329. line-height: 28upx;
  330. font-size: 20upx;
  331. font-family: Source Han Sans CN;
  332. font-weight: bold;
  333. color: #A5A5AD;
  334. margin-right: 30upx;
  335. margin-left: 5upx;
  336. }
  337. }
  338. .product-sku-row {
  339. width: 100%;
  340. height: 28upx;
  341. line-height: 28upx;
  342. margin-top: 15upx;
  343. display: flex;
  344. flex-direction: row;
  345. flex-wrap: nowrap;
  346. align-content: center;
  347. justify-content: flex-start;
  348. align-items: center;
  349. .product-sku-name {
  350. font-size: 24upx;
  351. font-family: Source Han Sans CN;
  352. font-weight: 400;
  353. color: #90919C;
  354. margin-left: 30upx;
  355. }
  356. }
  357. .product-price-row {
  358. width: 100%;
  359. height: 76upx;
  360. line-height: 76upx;
  361. display: flex;
  362. flex-direction: row;
  363. flex-wrap: nowrap;
  364. align-content: center;
  365. justify-content: space-between;
  366. align-items: center;
  367. margin-top: 20upx;
  368. .price-warp {
  369. display: flex;
  370. align-items: center;
  371. line-height: 28upx;
  372. margin-left: 30upx;
  373. justify-content: flex-start;
  374. width: auto;
  375. flex-direction: row;
  376. flex-wrap: nowrap;
  377. .iconImg {
  378. width: 58rpx;
  379. height: 36rpx;
  380. margin-right: 10rpx;
  381. }
  382. .price {
  383. font-size: 28rpx;
  384. font-family: Source Han Sans CN;
  385. font-weight: bold;
  386. color: #252744;
  387. margin-right: 10upx;
  388. }
  389. .original-price {
  390. font-size: 16upx;
  391. color: #ccc;
  392. text-decoration: line-through;
  393. }
  394. }
  395. .product-add {
  396. width: 76upx;
  397. height: 76upx;
  398. margin-right: 30upx;
  399. }
  400. }
  401. }
  402. }
  403. }
  404. }
  405. </style>