canvasGoods.vue 14 KB

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