多租户商城-商户小程序端
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.

513 lines
16 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
  1. <template>
  2. <view class="container">
  3. <global-loading />
  4. <!-- 商品列表 -->
  5. <!-- <view class="flex-items-plus flex-row search">-->
  6. <!-- <view class="searchBg">-->
  7. <!-- <view class="searchImg-box flex-items-plus">-->
  8. <!-- <image class="searchImg" src="http://36.138.125.206:8081/ceres-local-file/static/img/searchImg.png"></image>-->
  9. <!-- <input class="search-box" v-model="keyWord" placeholder-class="searchboxPlace" :placeholder="$t('common.searchproduct_hint')" />-->
  10. <!--&lt;!&ndash; <image class="searchClose-icon" @click="searchTextDel" src="http://36.138.125.206:8081/ceres-local-file/static/img/index/searchClose_icon.png"></image>&ndash;&gt;-->
  11. <!-- </view>-->
  12. <!-- <label class="mar-left-40 fs28" @click="searchList(1)">{{$t('page.search')}}</label>-->
  13. <!-- </view>-->
  14. <!-- </view>-->
  15. <!-- <view class="shop-list-nav">-->
  16. <!-- <view class="nav-item-sort" @click="sortTap(1)">-->
  17. <!-- <text class="nav-title" :class="{'active' : sortIndex == 1}">{{$t('common.default')}}</text>-->
  18. <!-- </view>-->
  19. <!-- <view class="nav-item-sort" @click="sortTap(2)">-->
  20. <!-- <text class="nav-title" :class="{'active' : sortIndex == 2}">{{$t('product.price')}}</text>-->
  21. <!-- <view class="r">-->
  22. <!-- <view class="arrowUp" :class="{activeUp: type == 1}"></view>-->
  23. <!-- <view class="arrowDown" :class="{activeDown: type == 2}"></view>-->
  24. <!-- &lt;!&ndash; <image src="http://36.138.125.206:8081/ceres-local-file/static/images/arrowSortUp.png" v-if="type == 1" class="arrow-img padd-t"></image>&ndash;&gt;-->
  25. <!-- &lt;!&ndash; <image src="http://36.138.125.206:8081/ceres-local-file/static/images/arrowSortDown.png" v-if="type == 2" class="arrow-img padd-b"></image>&ndash;&gt;-->
  26. <!-- </view>-->
  27. <!-- </view>-->
  28. <!-- <view class="nav-item-sort" @click="sortTap(3)">-->
  29. <!-- <text class="nav-title" :class="{'active' : sortIndex == 3}">{{$t('common.synthesis')}}</text>-->
  30. <!-- <view class="r">-->
  31. <!-- <view class="arrowUp" :class="{activeUp: volume == 1}"></view>-->
  32. <!-- <view class="arrowDown" :class="{activeDown: volume == 2}"></view>-->
  33. <!-- &lt;!&ndash; <image src="http://36.138.125.206:8081/ceres-local-file/static/images/arrowSortUp.png" v-if="volume == 1" class="arrow-img padd-t"></image>&ndash;&gt;-->
  34. <!-- &lt;!&ndash; <image src="http://36.138.125.206:8081/ceres-local-file/static/images/arrowSortDown.png" v-if="volume == 2" class="arrow-img padd-b"></image>&ndash;&gt;-->
  35. <!-- </view>-->
  36. <!-- </view>-->
  37. <!-- </view>-->
  38. <view v-if="list.length>0" class="listBox">
  39. <view v-for="(item, index) in list" :key="index" class="goodsDetails-box flex-display flex-column" @click="goodsDateils(item.shopId,item.productId,item.skuId)">
  40. <view v-if="item.activityType === 0" class="goodsDetails flex-items-plus flex-row">
  41. <image class="goodsImg default-img" :src="item.image"
  42. onerror="this.src='url(http://36.138.125.206:8081/ceres-local-file/image/default.png) no-repeat center';this.οnerrοr=null"></image>
  43. <view class="mar-left-30">
  44. <view class="goodsName-box overflowNoDot">
  45. <label class="goodsName fs26">{{item.productName}}</label>
  46. </view>
  47. <view class="usersBox">
  48. <label class="fs24 font-color-C5AA7B" v-if="item.users != null">{{item.users}}{{$t('common.payticktip')}}</label>
  49. <label class="fs24 font-color-C5AA7B" v-else>0{{$t('common.payticktip')}}</label>
  50. </view>
  51. <view class="priceBuyNum-box flex-items mar-top-20">
  52. <view>
  53. <label class="fs30 font-color-C83732">¥</label>
  54. <label class="fs36 font-color-C83732 mar-left-10">{{item.price}}</label>
  55. </view>
  56. <view style="margin-left: 20upx; color: #CCCCCC; text-decoration:line-through">
  57. <label class="fs24">¥{{item.originalPrice}}</label>
  58. </view>
  59. </view>
  60. <view class="flex-display flex-sp-between flex-row mar-top-10 flex-items shopName">
  61. <label class="fs22 font-color-FFEBC4">{{item.shopName}}</label>
  62. <!-- <image class="arrowImg" src="http://36.138.125.206:8081/ceres-local-file/static/img/user/arrow.png"></image>-->
  63. </view>
  64. </view>
  65. </view>
  66. <view v-else class="spikeList goodsDetails">
  67. <view class="listItem">
  68. <view class="itemBox">
  69. <img :src="item.image" class="pic-img default-img"
  70. onerror="this.src='url(http://36.138.125.206:8081/ceres-local-file/image/default.png) no-repeat center';this.οnerrοr=null">
  71. </view>
  72. <view class="itemInfo mar-top-30">
  73. <p>{{item.productName}}</p>
  74. <view class="number" v-if="item.users != null">
  75. <view class="numText">{{item.users}}{{$t('common.payticktip')}}</view>
  76. <!-- <view class="numText" v-if="item.total !=0">限量{{item.total}}</view>-->
  77. </view>
  78. <view class="flex-row-plus flex-item mar-top-30">
  79. <image class="iconImg" v-if="item.activityType == 1" src="http://36.138.125.206:8081/ceres-local-file/static/images/groupBuyIcon.png"></image>
  80. <image class="iconImg" v-if="item.activityType == 2" src="http://36.138.125.206:8081/ceres-local-file/static/images/spikeIcon.png"></image>
  81. <image class="iconImg" v-if="item.activityType == 4" src="http://36.138.125.206:8081/ceres-local-file/static/images/spikeIcon.png"></image>
  82. <image class="iconImg" v-if="item.activityType == 3" src="http://36.138.125.206:8081/ceres-local-file/static/images/discountListIcon.png"></image>
  83. <image class="iconImg" v-if="item.activityType == 5" src="http://36.138.125.206:8081/ceres-local-file/static/images/discountListIcon.png"></image>
  84. <image class="iconImg" v-if="item.activityType == 9" src="http://36.138.125.206:8081/ceres-local-file/static/images/memberCenterIcon.png"></image>
  85. <image class="iconImg" v-if="item.activityType == 8" src="https://zk-cereshop.oss-cn-shenzhen.aliyuncs.com/zkthink/2022-02-15/d0d8d96f28904167b271de4ae924d1a8_sceneMarketing.png"></image>
  86. <view class="font-color-C83732 flex-row-plus">
  87. <b></b>
  88. <label class="fs28">{{item.price}}</label>
  89. </view>
  90. <view class="mar-left-30 discountsPriceLine font-color-999">¥{{item.originalPrice}}</view>
  91. </view>
  92. <view class="flex-display flex-sp-between flex-row mar-top-10 flex-items shopName">
  93. <label class="fs22 font-color-FFEBC4">{{item.shopName}}</label>
  94. <!-- <image class="arrowImg" src="http://36.138.125.206:8081/ceres-local-file/static/img/user/arrow.png"></image>-->
  95. </view>
  96. </view>
  97. </view>
  98. </view>
  99. </view>
  100. </view>
  101. <!-- 搜索为空 -->
  102. <view v-if="ifEmpty" class="emptyCart-box flex-items-plus flex-column">
  103. <image class="emptyCart-img" src="http://36.138.125.206:8081/ceres-local-file/static/images/searchEmpty.png"></image>
  104. <label class="font-color-999 fs26 mar-top-30">{{$t('common.searchproductempty_short')}}</label>
  105. <label class="font-color-999 fs26 mar-top-10">{{$t('common.searchemptyswitchword')}}</label>
  106. </view>
  107. </view>
  108. </template>
  109. <script>
  110. const NET = require('../../utils/request')
  111. const API = require('../../config/api')
  112. export default {
  113. data() {
  114. return {
  115. keyWord:'',
  116. category3Id:'',
  117. page: 1,
  118. pageSize: 20,
  119. source:2,
  120. list:[],
  121. loadingType:0,
  122. sortIndex: 0,
  123. ifNew:0,//是否新品
  124. type:1,//价格排序条件
  125. volume:1,//销量排序条件
  126. sourceType: '',
  127. ids: [],
  128. classifyId: 0,
  129. ifEmpty: false
  130. }
  131. },
  132. onLoad(option) {
  133. if(option.sourceType){
  134. this.sourceType = option.sourceType
  135. if(option.sourceType === '1'){
  136. this.ids = option.ids
  137. } else if(option.sourceType === '2'){
  138. this.classifyId = option.classifyId
  139. }
  140. }
  141. this.searchList(1)
  142. },
  143. onReachBottom(){
  144. if(this.loadingType == 1){
  145. uni.stopPullDownRefresh()
  146. }else{
  147. this.page = this.page+1
  148. this.searchList(0)
  149. }
  150. },
  151. methods: {
  152. sortTap(index){
  153. this.page = 1
  154. this.list = []
  155. if(index == 1){
  156. this.type = 1
  157. this.volume = 1
  158. this.sortIndex = index
  159. }else if(index == 2){
  160. this.type = this.type != 1 ? 1:2
  161. this.sortIndex = index
  162. }else if(index == 3){
  163. this.volume = this.volume != 1 ? 1:2
  164. this.sortIndex = index
  165. }
  166. this.searchList()
  167. },
  168. // searchTextDel(){
  169. // this.keyWord = ''
  170. // },
  171. searchList(type){
  172. // uni.showLoading({
  173. // title: '加载中...',
  174. // })
  175. if(type == 1){
  176. this.list = []
  177. this.page = 1
  178. }
  179. var params = {
  180. page: this.page,
  181. pageSize: this.pageSize
  182. }
  183. if (this.sourceType === '1') {
  184. if(this.ids && this.ids.length>0){
  185. params.ids = this.ids
  186. } else {
  187. this.list = []
  188. }
  189. } else if(this.sourceType === '2'){
  190. if(this.classifyId) {
  191. params.classifyId = this.classifyId
  192. } else {
  193. this.list = []
  194. }
  195. }
  196. if(params.ids || params.classifyId){
  197. NET.request(API.getProductsV2, params, 'GET').then(res => {
  198. uni.hideLoading()
  199. this.list = this.list.concat(res.data.list)
  200. if (this.list.length === 0) {
  201. this.ifEmpty = true
  202. }
  203. }).catch(res => {
  204. uni.hideLoading()
  205. })
  206. }
  207. },
  208. //商品详情
  209. goodsDateils(shopId,productId,skuId){
  210. uni.navigateTo({
  211. url: 'goodsDetails?shopId='+shopId + '&productId='+productId +'&skuId='+skuId
  212. })
  213. }
  214. }
  215. }
  216. </script>
  217. <style lang="scss">
  218. page {
  219. background: #f8f8f8;
  220. }
  221. input{padding-left: 80upx;}
  222. .container{
  223. height: 100%;
  224. background: #f8f8f8;
  225. .search {
  226. padding: 20rpx;
  227. background: #FFFFFF;
  228. border-top: 2rpx solid #F3F4F5;
  229. }
  230. .searchImg-box {
  231. position: relative;
  232. }
  233. .emptyCart-box{
  234. margin-top: 70upx;
  235. .emptyCart-img{
  236. width: 113upx;
  237. height: 98upx;
  238. }
  239. }
  240. .searchBg {
  241. width: 100%;
  242. display: flex;
  243. background-color: #F7F7F7;
  244. align-items: center;
  245. height: 78rpx;
  246. justify-content: space-between;
  247. padding: 0 20rpx;
  248. label {
  249. font-weight: 400;
  250. color: #333333;
  251. }
  252. }
  253. .searchImg{
  254. width: 50upx;
  255. height: 50upx;
  256. position: absolute;
  257. left: 0upx;
  258. }
  259. .search-box{
  260. width: 400upx;
  261. height: 66upx;
  262. }
  263. .searchboxPlace{
  264. font-size: 26upx;
  265. color: #A9A9A9;
  266. padding-right: 30upx;
  267. }
  268. .searchClose-icon{
  269. z-index: 999;
  270. width: 40upx;
  271. height: 40upx;
  272. margin-left: -50upx;
  273. }
  274. .promotion618{
  275. width: 130upx;
  276. height: 30upx;
  277. }
  278. .goodsDetails-box{
  279. background: #FFFFFF;
  280. margin-top: 20rpx;
  281. box-sizing: border-box;
  282. .goodsDetails{
  283. border-bottom: 1upx solid #EDEDED;
  284. padding-top: 30rpx;
  285. padding-bottom: 30upx;
  286. position: relative;
  287. .goodsName-box{
  288. width: 389upx;
  289. height: 85upx;
  290. .img618-cion{
  291. width:70upx;
  292. height:36upx;
  293. }
  294. }
  295. .shopName {
  296. height: 50rpx;
  297. background: #333333;
  298. opacity: 1;
  299. border-radius: 0 20rpx 20rpx 0;
  300. padding: 10rpx 15rpx;
  301. }
  302. .goodsImg{
  303. width: 260upx;
  304. height: 260upx;
  305. }
  306. .discounts-box{
  307. margin-left: -10upx;
  308. margin-top: 20upx;
  309. .discounts-text{
  310. margin-left: 10upx;
  311. color: #C5AA7B;
  312. background-color: #FFE4CC;
  313. padding: 6upx 12upx;
  314. border-radius: 4upx;
  315. }
  316. }
  317. .arrowImg{
  318. width: 20upx;
  319. height: 20upx;
  320. }
  321. }
  322. }
  323. .spikeList {
  324. .arrowImg{
  325. width: 20upx;
  326. height: 20upx;
  327. }
  328. // padding: 108upx 30upx 20upx 30upx;
  329. padding-top: 30rpx;
  330. border-bottom: 1upx solid #EDEDED;
  331. .listItem {
  332. display: flex;
  333. // padding-bottom: 10upx;
  334. border-bottom: 1upx solid #EEEEEE;
  335. margin-bottom: 30upx;
  336. .iconImg {
  337. width: 58rpx;
  338. height: 36rpx;
  339. }
  340. &:last-child {
  341. border-bottom: none;
  342. }
  343. .itemBox {
  344. width: 260upx;
  345. height: 260upx;
  346. margin-right: 30upx;
  347. img {
  348. width: 100%;
  349. height: 100%;
  350. }
  351. }
  352. .itemInfo {
  353. flex: 1;
  354. p {
  355. font-size: 26upx;
  356. color: #333333;
  357. line-height: 40upx;
  358. margin-bottom: 20upx;
  359. text-overflow: -o-ellipsis-lastline;
  360. overflow: hidden;
  361. text-overflow: ellipsis;
  362. display: -webkit-box;
  363. -webkit-line-clamp: 2;
  364. line-clamp: 2;
  365. -webkit-box-orient: vertical;
  366. }
  367. .number {
  368. color: #999999;
  369. font-size: 26upx;
  370. display: flex;
  371. align-items: center;
  372. .numText {
  373. padding: 0 10rpx;
  374. height: 40rpx;
  375. line-height: 40rpx;
  376. border: 2rpx solid #E4E5E6;
  377. color: #C5AA7B;
  378. font-size: 20rpx;
  379. margin-right: 10rpx;
  380. }
  381. }
  382. }
  383. }
  384. }
  385. .listBox {
  386. padding: 0 24rpx;
  387. box-sizing: border-box;
  388. .usersBox {
  389. margin-top: 20rpx;
  390. label {
  391. padding: 10rpx;
  392. border: 2rpx solid #E4E5E6;
  393. }
  394. }
  395. }
  396. }
  397. .shop-list-nav {
  398. display: flex;
  399. flex-direction: row;
  400. align-items: center;
  401. height: 80rpx;
  402. line-height: 76rpx;
  403. background: #fff;
  404. }
  405. .nav-item {
  406. flex: 1;
  407. font-size: 30rpx;
  408. color: #666;
  409. display: flex;
  410. flex-direction: column;
  411. align-items: center;
  412. height: 80rpx;
  413. line-height: 76rpx;
  414. }
  415. .nav-title {
  416. }
  417. .nav-item.active {
  418. color: #C5AA7B;
  419. }
  420. .nav-item .line {
  421. display: inline-block;
  422. width: 80rpx;
  423. height: 4rpx;
  424. background: #fff;
  425. border-radius: 2rpx;
  426. }
  427. .nav-item.active .line {
  428. background: #C5AA7B;
  429. }
  430. .nav-item.padd-l {
  431. padding-left: 20%;
  432. box-sizing: border-box;
  433. }
  434. .active{
  435. color: #C5AA7B;
  436. }
  437. .nav-item.padd-r {
  438. padding-right: 20%;
  439. box-sizing: border-box;
  440. }
  441. .nav-item-sort {
  442. flex: 1;
  443. font-size: 24rpx;
  444. color: #222;
  445. display: flex;
  446. flex-direction: row;
  447. align-items: center;
  448. justify-content: center;
  449. height: 80rpx;
  450. line-height: 80rpx;
  451. }
  452. .nav-item-sort .r {
  453. display: flex;
  454. flex-direction: column;
  455. align-items: center;
  456. justify-content: center;
  457. margin-left: 5rpx;
  458. .arrowDown {
  459. width: 0;
  460. height: 0;
  461. border-width: 10rpx;
  462. border-style: solid;
  463. border-color: #CCCCCC transparent transparent transparent;
  464. margin-top: 2rpx;
  465. }
  466. .arrowUp {
  467. margin-bottom: 2rpx;
  468. width: 0;
  469. height: 0;
  470. border-width: 10rpx;
  471. border-style: solid;
  472. border-color: transparent transparent #CCCCCC transparent;
  473. }
  474. .activeDown {
  475. border-color: #C5AA7B transparent transparent transparent;
  476. }
  477. .activeUp {
  478. border-color: transparent transparent #C5AA7B transparent;
  479. }
  480. }
  481. //.nav-item-sort .r .arrow-img {
  482. // width: 32rpx;
  483. // height: 32rpx;
  484. // padding: 7rpx;
  485. // box-sizing: border-box;
  486. //}
  487. //// #ifdef MP-ALIPAY
  488. //.nav-item-sort .r .arrow-img {
  489. // width: 16rpx;
  490. // height: 16rpx;
  491. // padding: 4rpx;
  492. // box-sizing: border-box;
  493. //}
  494. .search {
  495. padding-top: 20rpx;
  496. }
  497. // #endif
  498. </style>