immediatelyList.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122
  1. <template>
  2. <view
  3. class="container commodity-list-wrapper"
  4. :style="{ overflow: showSkeleton ? 'hidden' : 'auto', height: showSkeleton ? windowHeight + 'px' : 'auto' }"
  5. >
  6. <view class="good-search clearfix" v-if="searchStatus">
  7. <view class="nav-tab-bar u-f-ajc">
  8. <block v-for="(tab, index) in tabBars" :key="tab.id" :class="{ current: tabIndex === index }">
  9. <view class="tabstyle u-f-ajc" :class="{ addstyle: tabIndex == index }" @tap="changeTab(index)">
  10. {{ tab.name }}<i v-if="tabIndex == index" class="nav-tab-line iconfont icon-gou"></i>
  11. </view>
  12. </block>
  13. </view>
  14. <view class="search-from name">
  15. <text class="iconfont icon-iconfonticonfontsousuo1"></text>
  16. <input
  17. class="input"
  18. type="text"
  19. :focus="isFocus"
  20. confirm-type="search"
  21. v-model="searchInputVal"
  22. placeholder="请输入商品关键词"
  23. @input="onShowClose"
  24. @confirm="searchOpertor(tabIndex)"
  25. maxlength="20"
  26. />
  27. <text class="iconfont icon-shanchu1" v-if="isShowClose" @click="delInputText(tabIndex)"></text>
  28. </view>
  29. </view>
  30. <list-skeleton v-if="showSkeleton"></list-skeleton>
  31. <view class="empty-container" v-if="isShowEmpty">
  32. <image
  33. class="empty-container-image"
  34. src="https://img.caimei365.com/group1/M00/03/71/Cmis2F3wna6AY2ZjAABpmnBICH4247.png"
  35. ></image>
  36. <text class="error-text">{{ isShowEmptyText }}</text>
  37. </view>
  38. <!-- 单一商品 -->
  39. <view class="product-container" v-else>
  40. <view :class="tabIndex" v-if="tabIndex === 0" :style="{ paddingTop: searchStatus ? '128rpx' : '' }">
  41. <scroll-view
  42. :style="{ height: scrollHeight + 'px' }"
  43. @scrolltolower="scrolltolower(tabIndex)"
  44. scroll-y
  45. v-if="listData.length > 0"
  46. >
  47. <view
  48. v-for="(pros, index) in listData"
  49. :key="index"
  50. :id="pros.productId"
  51. class="all-type-list-content commodity-list"
  52. @click.stop="navToDetailPage(pros.productId)"
  53. >
  54. <image mode="widthFix" :src="pros.image" class="list-img" alt="list-img"></image>
  55. <view class="list-details-info">
  56. <text class="list-details-title">{{ isInterceptHtmlFn(pros.name) }}</text>
  57. <text class="list-details-specs">规格:{{ pros.unit ? pros.unit : '' }}</text>
  58. <text class="list-details-miniQuantity list-details-specs"
  59. >起订量:{{ pros.minBuyNumber }}</text
  60. >
  61. <view class="list-details-specs" v-if="pros.code != '' && pros.code != null">
  62. <view>商品编码:{{ pros.code }}</view>
  63. </view>
  64. <view class="list-details-price">
  65. <template v-if="priceLoading">
  66. <view class="list-price-loding">正在获取价格...</view>
  67. </template>
  68. <template v-else>
  69. <view class="list-shop">
  70. <view class="list-price">
  71. <text
  72. class="price-larger"
  73. :class="PromotionsFormat(pros.promotions) ? 'none' : ''"
  74. >
  75. ¥{{
  76. (PromotionsFormat(pros.promotions)
  77. ? pros.originalPrice
  78. : pros.price) | NumFormat
  79. }}
  80. </text>
  81. </view>
  82. </view>
  83. <button class="add-cart-btn" @click.stop="operationHanld(pros)">数量</button>
  84. </template>
  85. </view>
  86. <view class="list-details-price">
  87. <view class="floor-item-act" v-if="pros.actStatus == 1">
  88. <view class="coupon-tags" v-if="pros.couponsLogo">优惠券</view>
  89. <template>
  90. <view class="floor-tags" v-if="PromotionsFormat(pros.promotions)">
  91. {{ pros.promotions.name }}<text>:¥{{ pros.price | NumFormat }}</text>
  92. </view>
  93. <view class="floor-tags" v-else>{{ pros.promotions.name }}</view>
  94. </template>
  95. </view>
  96. <view class="floor-item-act" v-else>
  97. <view class="coupon-tags" v-if="pros.couponsLogo">优惠券</view>
  98. <view class="floor-tags" v-if="pros.actStatus == 0 && pros.ladderPriceFlag == 1"
  99. >阶梯价格</view
  100. >
  101. </view>
  102. </view>
  103. </view>
  104. </view>
  105. <view v-if="showLoading && listData.length > 4 && !showRegularBtn">
  106. <view class="loading-wrapper loading-wrapper-now" v-if="loadingNow"
  107. >{{ loadingText }}<text v-if="loadingText === '已至底部'">‧ ‧ ‧</text></view
  108. >
  109. <view class="loading-wrapper loading-wrapper-btm" v-else
  110. >———<text class="btm-text">已至底部</text>———</view
  111. >
  112. </view>
  113. </scroll-view>
  114. </view>
  115. <!-- 组合商品 -->
  116. <view :class="tabIndex" v-if="tabIndex === 1">
  117. <scroll-view
  118. :style="{ height: scrollHeight + 'px', paddingTop: searchStatus ? '112rpx' : '' }"
  119. @scrolltolower="scrolltolower(tabIndex)"
  120. scroll-y
  121. >
  122. <view class="all-zuhe-list" v-for="(item, index) in combinationProduct" :key="index" :id="item.id">
  123. <view class="zuhe_title" :class="index % 2 == 0 ? 'active' : ''">{{ item.name }}</view>
  124. <view
  125. v-for="(pros, proIndex) in item.combinationProductList"
  126. :class="index % 2 == 0 ? 'stylecontent' : ''"
  127. :key="proIndex"
  128. :id="pros.productId"
  129. class="zuhe-list-content commodity-list"
  130. >
  131. <view class="list-details-info">
  132. <text class="list-details-title zuhe_list_text">商品编码:{{ pros.code }}</text>
  133. <text
  134. class="list-details-specs zuhe_list_text"
  135. @click.stop="navToDetailPage(pros.productId)"
  136. >{{ pros.name }}</text
  137. >
  138. <view class="list-details-price zuhe_list_price">
  139. <view class="list-shop com">
  140. <view class="list-price zuhe_list_price">
  141. <view class="zuhe_price-larger zuhe_list_text">
  142. <view class="list-price-none" v-if="pros.repurchaseFlag == 1">
  143. <text class="price-none">价格:¥{{ pros.originalPrice }}</text>
  144. <text
  145. class="iconfont icon-wenhao"
  146. @click.stop="repurchModel"
  147. ></text>
  148. </view>
  149. <view class="price-larger">价格:¥{{ pros.price | NumFormat }}</view>
  150. </view>
  151. <view class="zuhe_price-larger zuhe_list_text">
  152. <view class="floor-item-act" v-if="pros.actStatus == 1">
  153. <view class="coupon-tags" v-if="pros.couponsLogo">优惠券</view>
  154. <template>
  155. <view
  156. class="floor-tags"
  157. v-if="PromotionsFormat(pros.promotions)"
  158. >
  159. {{ pros.promotions.name
  160. }}<text>:¥{{ pros.price | NumFormat }}</text>
  161. </view>
  162. <view class="floor-tags" v-else>{{
  163. pros.promotions.name
  164. }}</view>
  165. </template>
  166. </view>
  167. <view class="floor-item-act" v-else>
  168. <view class="coupon-tags" v-if="pros.couponsLogo">优惠券</view>
  169. <view
  170. class="floor-tags"
  171. v-if="pros.actStatus == 0 && pros.ladderPriceFlag == 1"
  172. >阶梯价格</view
  173. >
  174. </view>
  175. <view class="count">
  176. <view class="number-box">
  177. <view
  178. class="iconfont icon-jianhao"
  179. @click.stop="changeCountSub(item, pros)"
  180. ></view>
  181. <input
  182. class="btn-input"
  183. type="number"
  184. maxlength="6"
  185. v-model="pros.initProductNum"
  186. @blur="changeNnmber($event, item, pros)"
  187. />
  188. <view
  189. class="iconfont icon-jiahao"
  190. @click.stop="changeCountAdd(item, pros)"
  191. ></view>
  192. </view>
  193. </view>
  194. </view>
  195. <view class="list-price-all" :style="{ overflow: 'hidden' }">
  196. <view class="price-two zuhe_list_text"
  197. >总价:<text class="zuhe_list_zj"
  198. >¥ {{ pros.totalPrice | NumFormat }}</text
  199. ></view
  200. >
  201. </view>
  202. </view>
  203. </view>
  204. </view>
  205. </view>
  206. </view>
  207. <view class="foot_conten">
  208. <view class="zuhe_foot-box">
  209. <view class="">
  210. <text>种类:{{ item.productKind }}</text>
  211. <text>总数:{{ item.productTotalNum }}</text>
  212. </view>
  213. <text
  214. >总额:<text class="foot_text">{{
  215. item.productTotalAmount | NumFormat
  216. }}</text></text
  217. >
  218. </view>
  219. <button type="default" class="buycart" @click.stop="operationHanld(item)">
  220. 加入购物车
  221. </button>
  222. </view>
  223. </view>
  224. <view v-if="showLoading && combinationProduct.length > 4 && !showRegularBtn">
  225. <view class="loading-wrapper loading-wrapper-now" v-if="loadingNow"
  226. >{{ loadingText }}<text v-if="loadingText === '已至底部'">‧ ‧ ‧</text></view
  227. >
  228. <view class="loading-wrapper loading-wrapper-btm" v-else
  229. >———<text class="btm-text">已至底部</text>———</view
  230. >
  231. </view>
  232. </scroll-view>
  233. </view>
  234. </view>
  235. <!-- 可拖动悬浮按钮 -->
  236. <cm-drag
  237. :cartNum="cartQuantity"
  238. :isDock="true"
  239. :existTabBar="true"
  240. @btnClick="btnClick"
  241. @btnTouchstart="btnTouchstart"
  242. @btnTouchend="btnTouchend"
  243. >
  244. </cm-drag>
  245. <!-- 透明模态层 -->
  246. <modal-layer v-if="isModallayer"></modal-layer>
  247. </view>
  248. </template>
  249. <script>
  250. import listSkeleton from '@/components/cm-module/listTemplate/listSkeleton'
  251. import modalLayer from '@/components/modal-layer'
  252. import uniStars from '@/components/uni-stars/uni-stars.vue'
  253. import cmDrag from '@/components/cm-custom/cm-drag.vue'
  254. import { mapState, mapMutations } from 'vuex'
  255. export default {
  256. name: 'productList',
  257. components: {
  258. listSkeleton,
  259. modalLayer,
  260. uniStars,
  261. cmDrag
  262. },
  263. props: {
  264. searchStatus: {
  265. type: Boolean,
  266. default: false
  267. }
  268. },
  269. data() {
  270. return {
  271. isShowClose: false,
  272. searchInputVal: '',
  273. isModallayer: false,
  274. windowHeight: '',
  275. showSkeleton: false,
  276. priceLoading: true,
  277. isShowEmpty: false,
  278. isShowEmptyText: '搜索相关商品',
  279. clubUserId: '',
  280. identity: '',
  281. isFocus: false,
  282. scrollHeight: '',
  283. listData: [],
  284. combinationProduct: [],
  285. zuheProductList: [], //组合商品列表
  286. showLoading: false,
  287. loadingNow: true,
  288. loadingText: '上拉加载更多',
  289. pageSize: 20,
  290. zuhepageSize: 5,
  291. pageNum: 1,
  292. totalPage: 1,
  293. hasNextPage: false,
  294. pullFlag: true,
  295. fromRegularPurchasePage: false,
  296. cartQuantity: 0,
  297. showRegularBtn: false,
  298. isPrecedence: false,
  299. ladderPriceList: [], //是否 阶梯,
  300. tabIndex: 0,
  301. goodsList: [],
  302. tabBars: [{ name: '单一', id: 'danyi' }, { name: '组合', id: 'zuhe' }],
  303. isShow: false
  304. }
  305. },
  306. created() {
  307. this.setScrollHeight()
  308. this.$api
  309. .getComStorage('userInfo')
  310. .then(resolve => {
  311. if (resolve.userIdentity == 1) {
  312. this.identity = 1
  313. }
  314. })
  315. .catch(error => {
  316. console.log(error)
  317. })
  318. this.$api.getComStorage('orderUserInfo').then(resolve => {
  319. this.clubUserId = resolve.userID
  320. })
  321. this.getProductAgainInfo()
  322. this.isFocus = true
  323. },
  324. filters: {
  325. NumFormat: function(text) {
  326. //处理金额
  327. return Number(text).toFixed(2)
  328. }
  329. },
  330. computed: {
  331. ...mapState(['hasLogin', 'userInfo'])
  332. },
  333. methods: {
  334. scrolltolower(tabIndex) {
  335. if (tabIndex == 0) {
  336. if (this.totalPage > this.listData.length && this.pullFlag) {
  337. this.getProductAgainInfo(true)
  338. }
  339. } else if (tabIndex == 1) {
  340. if (this.hasNextPage && this.pullFlag) {
  341. this.getcombinationProduct(true)
  342. }
  343. }
  344. },
  345. setScrollHeight() {
  346. const { windowHeight, pixelRatio } = wx.getSystemInfoSync()
  347. this.windowHeight = windowHeight - 1
  348. this.scrollHeight = windowHeight - 1
  349. },
  350. getProductAgainInfo(loadMore) {
  351. this.showLoading = true
  352. this.priceLoading = true
  353. this.loadingNow = true
  354. this.loadingText = '加载中'
  355. this.isShowEmpty = false
  356. if (loadMore) {
  357. this.pageNum += 1
  358. }
  359. this.ProductService.GetProductSearchList({
  360. identity: this.identity,
  361. keyword: this.searchInputVal,
  362. pageNum: this.pageNum,
  363. pageSize: this.pageSize,
  364. sortField: '',
  365. sortType: ''
  366. })
  367. .then(response => {
  368. this.isShowWrapper = true
  369. const resData = JSON.parse(response.data)
  370. const resList = resData.items
  371. if (resList && resList.length > 0) {
  372. this.totalPage = resData.total
  373. this.showEmpty = false
  374. if (loadMore) {
  375. this.listData = [...this.listData, ...resList]
  376. this.getProductPrice()
  377. } else {
  378. this.listData = [...resList]
  379. this.getProductPrice()
  380. this.showSkeleton = false
  381. }
  382. // 防上拉暴滑
  383. this.pullFlag = false
  384. setTimeout(() => {
  385. this.pullFlag = true
  386. }, 500)
  387. // 底部提示文案
  388. if (this.totalPage > this.listData.length) {
  389. this.loadingText = '上拉加载更多'
  390. } else {
  391. this.showLoading = true
  392. this.loadingNow = false
  393. }
  394. } else {
  395. if (!loadMore) {
  396. this.isShowEmpty = true
  397. this.isShowEmptyText = '暂无相关商品'
  398. }
  399. }
  400. })
  401. .catch(error => {
  402. this.$util.msg(error.msg, 2000)
  403. })
  404. },
  405. getProductPrice() {
  406. //获取商品或者活动价格
  407. let productIdArr = []
  408. let productIds = ''
  409. this.listData.map(item => {
  410. // 0公开价格 1不公开价格 2仅对资质机构公开
  411. productIdArr.push(item.productId)
  412. })
  413. productIds = productIdArr.join(',')
  414. this.ProductService.querySearchProductPrice({
  415. userId: this.clubUserId,
  416. productIds: productIds,
  417. source: 2
  418. })
  419. .then(response => {
  420. this.listData = this.ReturnNewProducts(this.listData, response.data)
  421. this.priceLoading = false
  422. })
  423. .catch(error => {
  424. this.$util.msg(error.msg, 2000)
  425. })
  426. },
  427. ReturnNewProducts(Array, list) {
  428. //合并字段
  429. let NewArray = []
  430. Array.map(item => {
  431. for (let i = 0; i < list.length; i++) {
  432. if (item.productId == list[i].productId) {
  433. NewArray.push(Object.assign(item, list[i]))
  434. }
  435. }
  436. })
  437. return NewArray
  438. },
  439. searchOpertor(tabIndex) {
  440. //搜索商品
  441. if (tabIndex == 0) {
  442. if (this.searchInputVal == '') {
  443. this.$util.msg('请输入商品关键词', 2000)
  444. } else {
  445. this.pageNum = 1
  446. this.showSkeleton = true
  447. this.getProductAgainInfo()
  448. this.isFocus = false
  449. }
  450. } else {
  451. this.pageNum = 1
  452. this.showSkeleton = true
  453. this.getcombinationProduct()
  454. this.isFocus = false
  455. }
  456. },
  457. getcombinationProduct(loadMore) {
  458. //组合搜索商品
  459. this.showLoading = true
  460. this.loadingNow = true
  461. this.loadingText = '加载中'
  462. this.isShowEmpty = false
  463. if (loadMore) {
  464. this.pageNum += 1
  465. }
  466. this.ProductService.GetSearchCombinationProduct({
  467. clubUserId: this.clubUserId,
  468. pageNum: this.pageNum,
  469. pageSize: this.zuhepageSize,
  470. searchWord: this.searchInputVal
  471. })
  472. .then(response => {
  473. this.isShowWrapper = true
  474. const responseData = response.data
  475. console.log(responseData)
  476. if (responseData.results && responseData.results.length > 0) {
  477. this.hasNextPage = responseData.hasNextPage
  478. this.isShowEmpty = false
  479. if (loadMore) {
  480. this.combinationProduct = [...this.combinationProduct, ...responseData.results]
  481. } else {
  482. this.combinationProduct = [...responseData.results]
  483. this.showSkeleton = false
  484. }
  485. // 防上拉暴滑
  486. this.pullFlag = false
  487. setTimeout(() => {
  488. this.pullFlag = true
  489. }, 500)
  490. // 底部提示文案
  491. if (this.hasNextPage) {
  492. this.loadingText = '上拉加载更多'
  493. } else {
  494. this.showLoading = true
  495. this.loadingNow = false
  496. }
  497. } else {
  498. this.isShowEmpty = true
  499. this.isShowEmptyText = '暂无相关商品'
  500. }
  501. })
  502. .catch(error => {
  503. this.$util.msg(error.msg, 2000)
  504. })
  505. },
  506. changeCountAdd(item, pros) {
  507. //商品数量加加
  508. if (pros.initProductNum == 0) {
  509. pros.initProductNum = pros.minBuyNumber
  510. this.processActivityPrice(pros)
  511. } else if (pros.initProductNum >= pros.minBuyNumber) {
  512. pros.initProductNum++
  513. this.processActivityPrice(pros)
  514. }
  515. this.totalPeice(item)
  516. this.totalCount(item)
  517. this.totalKind(item)
  518. },
  519. changeCountSub(item, pros) {
  520. //商品数量减减
  521. if (pros.initProductNum == 0) {
  522. this.$util.msg('采购数量不能小于0', 2000)
  523. return
  524. } else if (pros.initProductNum == pros.minBuyNumber) {
  525. pros.initProductNum = 0
  526. this.processActivityPrice(pros)
  527. } else {
  528. pros.initProductNum--
  529. this.processActivityPrice(pros)
  530. }
  531. this.totalPeice(item)
  532. this.totalCount(item)
  533. this.totalKind(item)
  534. },
  535. changeNnmber(e, item, pros) {
  536. //输入商品数量更新
  537. let _value = e.detail.value
  538. if (!this.$api.isNumber(_value)) {
  539. pros.initProductNum = pros.minBuyNumber
  540. } else if (_value < pros.minBuyNumber) {
  541. this.$util.msg(`该商品最小起订量为${pros.minBuyNumber}`, 2000)
  542. pros.initProductNum = pros.minBuyNumber
  543. } else {
  544. pros.initProductNum = parseInt(e.detail.value)
  545. this.processActivityPrice(pros)
  546. }
  547. this.totalPeice(item)
  548. this.totalCount(item)
  549. this.totalKind(item)
  550. },
  551. totalPeice(item) {
  552. //计算总价格,每次调用此方法,将初始值为0,遍历价格并累加
  553. let prosPrice = 0
  554. let productsList = []
  555. productsList = item.combinationProductList
  556. productsList.forEach(pros => {
  557. prosPrice += pros.price * pros.initProductNum
  558. item.productTotalAmount = prosPrice
  559. })
  560. // console.log(prosPrice)
  561. },
  562. totalCount(item) {
  563. //计算总数量
  564. let prosAllCount = 0
  565. let productsList = []
  566. productsList = item.combinationProductList
  567. productsList.forEach(pros => {
  568. prosAllCount += parseInt(pros.initProductNum)
  569. item.productTotalNum = prosAllCount
  570. })
  571. // console.log(prosAllCount)
  572. },
  573. totalKind(item) {
  574. //计算商品种类
  575. let productsList = []
  576. let checkList = []
  577. productsList = item.combinationProductList
  578. productsList.forEach(pros => {
  579. if (pros.initProductNum > 0) {
  580. checkList.push(pros)
  581. item.productKind = checkList.length
  582. } else {
  583. item.productKind = checkList.length
  584. }
  585. })
  586. },
  587. processActivityPrice(pros) {
  588. //单独处理活动价格和阶梯价格
  589. let ladderPriceList = pros.ladderPrices
  590. if (pros.ladderPriceFlag == '0' || pros.actStatus == 1) {
  591. pros.totalPrice = pros.initProductNum * pros.price
  592. } else {
  593. ladderPriceList.forEach((item, index) => {
  594. if (pros.initProductNum >= item.buyNum) {
  595. pros.price = item.buyPrice
  596. pros.totalPrice = pros.initProductNum * item.buyPrice
  597. }
  598. })
  599. }
  600. },
  601. operationHanld(prop) {
  602. this.$emit('operationConfim', prop)
  603. },
  604. alertjieti(pros) {
  605. this.$emit('alertjietiConfim', pros)
  606. },
  607. changeTab(index) {
  608. this.tabIndex = index
  609. if (index == 0) {
  610. this.pageNum = 1
  611. this.getProductAgainInfo()
  612. } else {
  613. this.getcombinationProduct()
  614. }
  615. // this.$emit('changetab',index);
  616. },
  617. navToDetailPage(id) {
  618. this.isModallayer = true
  619. this.$api.navigateTo(`/pages/goods/product?id=${id}`)
  620. this.isModallayer = false
  621. },
  622. repurchModel() {
  623. this.$util.modal('', '此商品的价格有变化,原来的购买价已不适用', '知道了', '', false, () => {})
  624. },
  625. onShowClose() {
  626. //输入框失去焦点时触发
  627. if (this.searchInputVal != '') {
  628. this.isShowClose = true
  629. } else {
  630. this.isShowClose = false
  631. }
  632. },
  633. delInputText(tabIndex) {
  634. //清除输入框内容
  635. if (tabIndex == 0) {
  636. this.searchInputVal = ''
  637. this.listData = []
  638. this.isFocus = true
  639. this.isShowClose = false
  640. this.loadingNow = false
  641. this.isShowEmpty = true
  642. this.isShowEmptyText = '暂无相关商品'
  643. } else {
  644. this.searchInputVal = ''
  645. this.isShowClose = false
  646. this.isFocus = true
  647. this.getcombinationProduct()
  648. }
  649. },
  650. isInterceptHtmlFn(text) {
  651. let name = this.$reg.interceptHtmlFn(text)
  652. return name
  653. },
  654. PromotionsFormat(promo) {
  655. //促销活动类型数据处理
  656. if (promo != null) {
  657. if (promo.type == 1 && promo.mode == 1) {
  658. return true
  659. } else {
  660. return false
  661. }
  662. }
  663. return false
  664. },
  665. btnClick() {
  666. this.$emit('goCartPage')
  667. },
  668. btnTouchstart() {
  669. // console.log('btnTouchstart');
  670. },
  671. btnTouchend() {
  672. // console.log('btnTouchend');
  673. }
  674. }
  675. }
  676. </script>
  677. <style lang="scss">
  678. .all-zuhe-list {
  679. background: #ffffff;
  680. }
  681. .foot_conten {
  682. width: 655rpx;
  683. background: #fff;
  684. font-size: 28rpx;
  685. height: 80rpx;
  686. // line-height: 80rpx;
  687. display: inherit;
  688. padding: 10px;
  689. overflow: hidden;
  690. margin: 20rpx auto;
  691. }
  692. .zuhe_foot-box {
  693. float: left;
  694. overflow: hidden;
  695. white-space: nowrap;
  696. // text-overflow: ellipsis;
  697. width: 490rpx;
  698. }
  699. .zuhe_foot-box text {
  700. margin-right: 36rpx;
  701. }
  702. .foot_text {
  703. color: #ff2a2a;
  704. }
  705. .foot_conten .buycart {
  706. width: 162rpx;
  707. height: 64rpx;
  708. background: #efaf00 !important;
  709. color: #fff;
  710. font-size: 26rpx;
  711. border-radius: 36rpx;
  712. text-align: center;
  713. line-height: 64rpx;
  714. float: right;
  715. }
  716. .price-none {
  717. font-size: 24rpx;
  718. color: #666666;
  719. }
  720. .zuhe_title {
  721. background: #ffffff;
  722. height: 76rpx;
  723. font-size: 28rpx;
  724. color: #1675e1;
  725. border-bottom: 4rpx solid #1675e1;
  726. line-height: 76rpx;
  727. padding-left: 30rpx;
  728. &.active {
  729. color: #e15616;
  730. border-bottom: 4rpx solid #e15616;
  731. }
  732. }
  733. .tabstyle {
  734. width: 128rpx;
  735. height: 76rpx;
  736. font-size: 26rpx;
  737. display: inline-block;
  738. border-radius: 10rpx;
  739. text-align: center;
  740. line-height: 76rpx;
  741. border: 2rpx solid #eeeeee;
  742. position: relative;
  743. margin-right: 12rpx;
  744. &.addstyle {
  745. background: $btn-confirm;
  746. color: #ffffff;
  747. &::before {
  748. content: '';
  749. width: 0;
  750. height: 0;
  751. border-top: 20rpx solid transparent;
  752. border-right: 20rpx solid #ffffff;
  753. border-left: 20rpx solid transparent;
  754. border-bottom: 20rpx solid #ffffff;
  755. position: absolute;
  756. right: 0;
  757. bottom: 0;
  758. }
  759. }
  760. .icon-gou {
  761. width: 36rpx;
  762. height: 36rpx;
  763. line-height: 36rpx;
  764. text-align: center;
  765. color: #e15616;
  766. position: absolute;
  767. bottom: -5rpx;
  768. right: -5rpx;
  769. font-weight: bold;
  770. font-size: $font-size-28;
  771. }
  772. }
  773. .commodity-list-wrapper {
  774. scroll-view {
  775. height: 100%;
  776. }
  777. .show-more-btn {
  778. width: 276rpx;
  779. height: 52rpx;
  780. line-height: 52rpx;
  781. border: 2rpx solid #d8d8d8;
  782. background: #f7f7f7;
  783. font-size: 26rpx;
  784. margin: 26rpx 0;
  785. position: absolute;
  786. left: 50%;
  787. margin-left: -138rpx;
  788. }
  789. }
  790. .good-search {
  791. height: 80rpx;
  792. width: 100%;
  793. padding: 24rpx;
  794. background: #ffffff;
  795. display: flex;
  796. align-items: center;
  797. margin-bottom: 20rpx;
  798. position: fixed;
  799. top: 0;
  800. left: 0;
  801. z-index: 19;
  802. .search-from {
  803. width: 420rpx;
  804. height: 80rpx;
  805. background: #f7f7f7;
  806. border-radius: 40rpx;
  807. float: left;
  808. position: relative;
  809. .input {
  810. width: 340rpx;
  811. height: 80rpx;
  812. float: left;
  813. line-height: 80rpx;
  814. color: $text-color;
  815. font-size: $font-size-24;
  816. }
  817. .icon-iconfonticonfontsousuo1 {
  818. width: 64rpx;
  819. height: 80rpx;
  820. line-height: 80rpx;
  821. text-align: center;
  822. display: block;
  823. font-size: $font-size-38;
  824. float: left;
  825. color: #999999;
  826. }
  827. .icon-shanchu1 {
  828. font-size: $font-size-32;
  829. color: #999999;
  830. position: absolute;
  831. width: 120rpx;
  832. height: 80rpx;
  833. line-height: 80rpx;
  834. top: 0;
  835. right: 0;
  836. text-align: center;
  837. z-index: 10;
  838. }
  839. }
  840. .search-btn {
  841. // width: 120rpx;
  842. line-height: 64rpx;
  843. text-align: center;
  844. font-size: $font-size-28;
  845. color: $color-system;
  846. float: left;
  847. background: #ffffff;
  848. margin-left: 10rpx;
  849. }
  850. }
  851. .all-type-list-content {
  852. // height: 240rpx;
  853. padding: 24rpx;
  854. background: #fff;
  855. margin-bottom: 2rpx;
  856. display: flex;
  857. flex-direction: row;
  858. box-sizing: content-box;
  859. .list-img {
  860. width: 312rpx;
  861. height: 207rpx !important;
  862. margin-right: 26rpx;
  863. border-radius: 10rpx;
  864. border: 2rpx solid #f3f3f3;
  865. }
  866. }
  867. .zuhe-list-content {
  868. width: 655rpx;
  869. // height: 214rpx;
  870. background: #fff;
  871. border: 2rpx solid #def4ff;
  872. display: flex;
  873. flex-direction: row;
  874. box-sizing: content-box;
  875. margin-top: 10rpx;
  876. border-radius: 14rpx;
  877. margin: 10rpx auto;
  878. padding: 20rpx;
  879. &.stylecontent {
  880. border: 2rpx solid #fff0de;
  881. }
  882. }
  883. .list-details-info {
  884. width: 100%;
  885. flex-direction: column;
  886. font-size: 26rpx;
  887. position: relative;
  888. .list-details-title {
  889. line-height: 38rpx;
  890. text-overflow: ellipsis;
  891. overflow: hidden;
  892. display: -webkit-box;
  893. -webkit-line-clamp: 2;
  894. line-clamp: 2;
  895. -webkit-box-orient: vertical;
  896. }
  897. .list-details-specs {
  898. width: 100%;
  899. display: inline-block;
  900. margin: 5rpx 0;
  901. color: #666666;
  902. }
  903. .list-details-miniQuantity {
  904. width: 100%;
  905. display: inline-block;
  906. margin-top: 7rpx;
  907. }
  908. }
  909. .list-details-price {
  910. width: 100%;
  911. .floor-item-act {
  912. height: 54rpx;
  913. text-align: center;
  914. box-sizing: border-box;
  915. float: left;
  916. padding: 11rpx 0;
  917. .coupon-tags {
  918. height: 32rpx;
  919. box-sizing: border-box;
  920. border-radius: 8rpx;
  921. background-color: #fff1eb;
  922. line-height: 28rpx;
  923. color: #f94b4b;
  924. text-align: center;
  925. display: inline-block;
  926. padding: 0 10rpx;
  927. font-size: $font-size-20;
  928. border: 1px solid #f94b4b;
  929. float: left;
  930. margin-right: 12rpx;
  931. }
  932. .floor-tags {
  933. height: 32rpx;
  934. box-sizing: border-box;
  935. border-radius: 8rpx;
  936. background-color: #ffffff;
  937. line-height: 28rpx;
  938. color: $color-system;
  939. text-align: center;
  940. display: inline-block;
  941. padding: 0 16rpx;
  942. font-size: $font-size-20;
  943. border: 1px solid #e15616;
  944. float: left;
  945. }
  946. }
  947. .price-icon {
  948. width: 22rpx;
  949. height: 28rpx;
  950. vertical-align: middle;
  951. margin-right: 10rpx;
  952. }
  953. .price-icon + text {
  954. font-size: 25rpx;
  955. vertical-align: middle;
  956. }
  957. .list-login-now {
  958. width: 375rpx;
  959. color: #f8c499;
  960. .p-no {
  961. float: left;
  962. font-size: $font-size-24;
  963. color: $color-system;
  964. margin-right: 10rpx;
  965. }
  966. }
  967. .login-now {
  968. padding: 10rpx 10rpx 10rpx 0;
  969. }
  970. .list-none {
  971. margin-top: 15rpx;
  972. .price-small {
  973. font-size: $font-size-24;
  974. line-height: 40rpx;
  975. color: #ff2a2a;
  976. }
  977. }
  978. .list-price-loding {
  979. font-size: $font-size-24;
  980. line-height: 54rpx;
  981. color: #ff2a2a;
  982. }
  983. .list-shop {
  984. float: left;
  985. overflow: hidden;
  986. &.com {
  987. width: 100%;
  988. }
  989. .list-price {
  990. color: #ff2a2a;
  991. float: left;
  992. line-height: 54rpx;
  993. align-items: center;
  994. justify-content: center;
  995. .price-larger {
  996. font-size: $font-size-26;
  997. display: inline-block;
  998. &.none {
  999. text-decoration: line-through;
  1000. color: #999999;
  1001. }
  1002. }
  1003. .list-price-all {
  1004. width: 100%;
  1005. float: left;
  1006. }
  1007. .zuhe_price-larger {
  1008. width: 100%;
  1009. float: left;
  1010. height: 54rpx;
  1011. color: #666666;
  1012. .price-larger {
  1013. float: left;
  1014. margin-right: 20rpx;
  1015. }
  1016. }
  1017. .price-two {
  1018. color: #666666;
  1019. float: left;
  1020. }
  1021. .zuhe_list_zj {
  1022. color: #ff2a2a;
  1023. }
  1024. .price-view {
  1025. display: inline-block;
  1026. width: 40rpx;
  1027. border-radius: 10rpx;
  1028. font-size: $font-size-22;
  1029. text-align: center;
  1030. color: #ffffff;
  1031. height: 36rpx;
  1032. line-height: 36rpx;
  1033. margin-right: 8rpx;
  1034. &.ladder {
  1035. background: linear-gradient(135deg, rgba(255, 0, 0, 1) 0%, rgba(242, 143, 49, 1) 100%);
  1036. }
  1037. &.activity {
  1038. background: linear-gradient(135deg, rgba(128, 0, 255, 1) 0%, rgba(242, 49, 153, 1) 100%);
  1039. }
  1040. }
  1041. }
  1042. .zuhe_list_price .price-view {
  1043. margin-left: 20rpx;
  1044. float: left;
  1045. margin-top: 5rpx;
  1046. }
  1047. .zuhe_list_price {
  1048. width: 100%;
  1049. overflow: hidden;
  1050. margin-top: 10rpx;
  1051. }
  1052. .count {
  1053. float: right;
  1054. border: 1px solid #eeeeee;
  1055. border-radius: 10rpx;
  1056. .number-box {
  1057. display: flex;
  1058. justify-content: center;
  1059. align-items: center;
  1060. .iconfont {
  1061. font-size: $font-size-24;
  1062. padding: 0 16rpx;
  1063. color: $text-color;
  1064. text-align: center;
  1065. line-height: 48rpx;
  1066. font-weight: bold;
  1067. }
  1068. .btn-input {
  1069. width: 100rpx;
  1070. height: 48rpx;
  1071. line-height: 48rpx;
  1072. background: #f8f8f8;
  1073. border-radius: 4rpx;
  1074. text-align: center;
  1075. font-size: $font-size-24;
  1076. border-right: 1px solid #eeeeee;
  1077. border-left: 1px solid #eeeeee;
  1078. }
  1079. }
  1080. }
  1081. .list-price-none {
  1082. width: 100%;
  1083. .price-none {
  1084. text-decoration: line-through;
  1085. color: #999999;
  1086. display: inline-block;
  1087. }
  1088. .icon-wenhao {
  1089. font-size: $font-size-32;
  1090. color: #0091ff;
  1091. margin-left: 6rpx;
  1092. }
  1093. }
  1094. }
  1095. .add-cart-btn {
  1096. flex: 4;
  1097. width: 140rpx;
  1098. height: 54rpx;
  1099. line-height: 54rpx;
  1100. border-radius: 27rpx;
  1101. color: #fff;
  1102. font-size: 24rpx;
  1103. margin-right: 0;
  1104. background: #ffffff;
  1105. border: 1px solid #c9c9c9;
  1106. color: $text-color;
  1107. }
  1108. .zuhe_btn {
  1109. float: right;
  1110. }
  1111. }
  1112. .zuhe_list_price {
  1113. display: block !important;
  1114. }
  1115. .zuhe_list_text {
  1116. margin-top: 0;
  1117. }
  1118. </style>