immediatelyList.vue 29 KB

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