immediatelyList.vue 30 KB

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