immediatelyList.vue 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160
  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 ? '118rpx' : '' }">
  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','serviceProviderId'])
  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. serviceProviderId:this.serviceProviderId
  390. })
  391. .then(response => {
  392. this.isShowWrapper = true
  393. const resData = response.data ? JSON.parse(response.data) : null
  394. const resList = resData ? resData.items : []
  395. if(resData && resList.length > 0){
  396. this.totalPage = resData.total
  397. this.showEmpty = false
  398. if (loadMore) {
  399. this.listData = [...this.listData, ...resList]
  400. this.getProductPrice()
  401. } else {
  402. this.listData = [...resList]
  403. this.getProductPrice()
  404. }
  405. // 防上拉暴滑
  406. this.pullFlag = false
  407. setTimeout(() => {
  408. this.pullFlag = true
  409. }, 500)
  410. // 底部提示文案
  411. if (this.totalPage > this.listData.length) {
  412. this.loadingText = '上拉加载更多'
  413. } else {
  414. this.showLoading = true
  415. this.loadingNow = false
  416. }
  417. }else{
  418. this.isShowEmpty = true
  419. this.isShowEmptyText = `暂无${this.searchInputVal}相关商品~`
  420. }
  421. this.showSkeleton = false
  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. setTimeout(() => {
  446. this.showSkeleton = false
  447. }, 500)
  448. })
  449. .catch(error => {
  450. this.$util.msg(error.msg, 2000)
  451. })
  452. },
  453. ReturnNewProducts(Array, list) {
  454. //合并字段
  455. let NewArray = []
  456. Array.map(item => {
  457. for (let i = 0; i < list.length; i++) {
  458. if (item.productId == list[i].productId) {
  459. NewArray.push(Object.assign(item, list[i]))
  460. }
  461. }
  462. })
  463. return NewArray
  464. },
  465. searchOpertor(tabIndex) {
  466. //搜索商品
  467. if (tabIndex == 0) {
  468. if (this.searchInputVal == '') {
  469. this.$util.msg('请输入商品关键词', 2000)
  470. } else {
  471. this.pageNum = 1
  472. this.showSkeleton = true
  473. this.getProductAgainInfo()
  474. this.isFocus = false
  475. }
  476. } else {
  477. this.pageNum = 1
  478. this.showSkeleton = true
  479. this.getcombinationProduct()
  480. this.isFocus = false
  481. }
  482. },
  483. getcombinationProduct(loadMore) {
  484. //组合搜索商品
  485. this.showLoading = true
  486. this.loadingNow = true
  487. this.loadingText = '加载中'
  488. this.isShowEmpty = false
  489. if (loadMore) {
  490. this.pageNum += 1
  491. }
  492. this.ProductService.GetSearchCombinationProduct({
  493. clubUserId: this.clubUserId,
  494. pageNum: this.pageNum,
  495. pageSize: this.zuhepageSize,
  496. searchWord: this.searchInputVal
  497. })
  498. .then(response => {
  499. this.isShowWrapper = true
  500. const responseData = response.data
  501. console.log(responseData)
  502. if (responseData.results && responseData.results.length > 0) {
  503. this.hasNextPage = responseData.hasNextPage
  504. this.isShowEmpty = false
  505. if (loadMore) {
  506. this.combinationProduct = [...this.combinationProduct, ...responseData.results]
  507. } else {
  508. this.combinationProduct = [...responseData.results]
  509. this.showSkeleton = false
  510. }
  511. // 防上拉暴滑
  512. this.pullFlag = false
  513. setTimeout(() => {
  514. this.pullFlag = true
  515. }, 500)
  516. // 底部提示文案
  517. if (this.hasNextPage) {
  518. this.loadingText = '上拉加载更多'
  519. } else {
  520. this.showLoading = true
  521. this.loadingNow = false
  522. }
  523. } else {
  524. this.isShowEmpty = true
  525. this.showSkeleton = false
  526. this.isShowEmptyText = `暂无${this.searchInputVal}相关商品~`
  527. }
  528. })
  529. .catch(error => {
  530. this.$util.msg(error.msg, 2000)
  531. })
  532. },
  533. changeCountAdd(item, pros) {
  534. //商品数量加加
  535. if (pros.initProductNum == 0) {
  536. pros.initProductNum = pros.minBuyNumber
  537. this.processActivityPrice(pros)
  538. } else if (pros.initProductNum >= pros.minBuyNumber) {
  539. pros.initProductNum++
  540. this.processActivityPrice(pros)
  541. }
  542. this.totalPeice(item)
  543. this.totalCount(item)
  544. this.totalKind(item)
  545. },
  546. changeCountSub(item, pros) {
  547. //商品数量减减
  548. if (pros.initProductNum == 0) {
  549. this.$util.msg('采购数量不能小于0', 2000)
  550. return
  551. } else if (pros.initProductNum == pros.minBuyNumber) {
  552. pros.initProductNum = 0
  553. this.processActivityPrice(pros)
  554. } else {
  555. pros.initProductNum--
  556. this.processActivityPrice(pros)
  557. }
  558. this.totalPeice(item)
  559. this.totalCount(item)
  560. this.totalKind(item)
  561. },
  562. changeNnmber(e, item, pros) {
  563. //输入商品数量更新
  564. let _value = e.detail.value
  565. if (!this.$api.isNumber(_value)) {
  566. pros.initProductNum = pros.minBuyNumber
  567. } else if (_value < pros.minBuyNumber) {
  568. this.$util.msg(`该商品最小起订量为${pros.minBuyNumber}`, 2000)
  569. pros.initProductNum = pros.minBuyNumber
  570. } else {
  571. pros.initProductNum = parseInt(e.detail.value)
  572. this.processActivityPrice(pros)
  573. }
  574. this.totalPeice(item)
  575. this.totalCount(item)
  576. this.totalKind(item)
  577. },
  578. totalPeice(item) {
  579. //计算总价格,每次调用此方法,将初始值为0,遍历价格并累加
  580. let prosPrice = 0
  581. let productsList = []
  582. productsList = item.combinationProductList
  583. productsList.forEach(pros => {
  584. prosPrice += pros.price * pros.initProductNum
  585. item.productTotalAmount = prosPrice
  586. })
  587. // console.log(prosPrice)
  588. },
  589. totalCount(item) {
  590. //计算总数量
  591. let prosAllCount = 0
  592. let productsList = []
  593. productsList = item.combinationProductList
  594. productsList.forEach(pros => {
  595. prosAllCount += parseInt(pros.initProductNum)
  596. item.productTotalNum = prosAllCount
  597. })
  598. // console.log(prosAllCount)
  599. },
  600. totalKind(item) {
  601. //计算商品种类
  602. let productsList = []
  603. let checkList = []
  604. productsList = item.combinationProductList
  605. productsList.forEach(pros => {
  606. if (pros.initProductNum > 0) {
  607. checkList.push(pros)
  608. item.productKind = checkList.length
  609. } else {
  610. item.productKind = checkList.length
  611. }
  612. })
  613. },
  614. processActivityPrice(pros) {
  615. //单独处理活动价格和阶梯价格
  616. pros.totalPrice = pros.initProductNum * pros.price
  617. },
  618. operationHanld(prop) {
  619. this.$emit('operationConfim', prop)
  620. },
  621. alertjieti(pros) {
  622. this.$emit('alertjietiConfim', pros)
  623. },
  624. changeTab(index) {
  625. this.tabIndex = index
  626. if (index == 0) {
  627. this.pageNum = 1
  628. this.getProductAgainInfo()
  629. } else {
  630. this.getcombinationProduct()
  631. }
  632. // this.$emit('changetab',index);
  633. },
  634. navToDetailPage(id) {
  635. this.isModallayer = true
  636. this.$api.navigateTo(`/pages/goods/product?id=${id}`)
  637. this.isModallayer = false
  638. },
  639. repurchModel() {
  640. this.$util.modal('', '此商品的价格有变化,原来的购买价已不适用', '知道了', '', false, () => {})
  641. },
  642. onShowClose() {
  643. //输入框失去焦点时触发
  644. if (this.searchInputVal !== '') {
  645. this.isShowClose = true
  646. } else {
  647. this.isShowClose = false
  648. }
  649. },
  650. delInputText(tabIndex) {
  651. //清除输入框内容
  652. if (tabIndex == 0) {
  653. this.searchInputVal = ''
  654. this.listData = []
  655. this.isFocus = true
  656. this.isShowClose = false
  657. this.loadingNow = false
  658. this.isShowEmpty = true
  659. this.isShowEmptyText = '暂无相关商品'
  660. this.getProductAgainInfo()
  661. } else {
  662. this.searchInputVal = ''
  663. this.isShowClose = false
  664. this.isFocus = true
  665. this.getcombinationProduct()
  666. }
  667. },
  668. isInterceptHtmlFn(text) {
  669. let name = this.$reg.interceptHtmlFn(text)
  670. return name
  671. },
  672. PromotionsFormat(promo) {
  673. //促销活动类型数据处理
  674. if (promo != null) {
  675. if (promo.type == 1 && promo.mode == 1) {
  676. return true
  677. } else {
  678. return false
  679. }
  680. }
  681. return false
  682. },
  683. handleShowUnitPopup(pros, index) {
  684. // 组合商品规格弹窗
  685. this.handleProsData = pros
  686. this.popupShow = true
  687. },
  688. hanldeSupporUnitConfirm(data) {
  689. console.log('data', data)
  690. this.handleProsData.skuId = data.skuId
  691. this.handleProsData.unit = data.unit
  692. this.handleProsData.initProductNum = data.minBuyNumber
  693. },
  694. handleSkuClick(sku){//选择Sku
  695. this.handleProsData.unit = sku.unit
  696. this.handleProsData.price = sku.price
  697. this.handleProsData.originalPrice = sku.originalPrice
  698. this.handleProsData.initProductNum = sku.minBuyNumber
  699. },
  700. btnClick() {
  701. this.$emit('goCartPage')
  702. },
  703. btnTouchstart() {
  704. // console.log('btnTouchstart');
  705. },
  706. btnTouchend() {
  707. // console.log('btnTouchend');
  708. }
  709. }
  710. }
  711. </script>
  712. <style lang="scss">
  713. .all-zuhe-list {
  714. background: #ffffff;
  715. }
  716. .foot_conten {
  717. width: 655rpx;
  718. background: #fff;
  719. font-size: 28rpx;
  720. height: 80rpx;
  721. // line-height: 80rpx;
  722. display: inherit;
  723. padding: 10px;
  724. overflow: hidden;
  725. margin: 20rpx auto;
  726. }
  727. .zuhe_foot-box {
  728. float: left;
  729. overflow: hidden;
  730. white-space: nowrap;
  731. // text-overflow: ellipsis;
  732. width: 490rpx;
  733. }
  734. .zuhe_foot-box text {
  735. margin-right: 36rpx;
  736. }
  737. .foot_text {
  738. color: #ff2a2a;
  739. }
  740. .foot_conten .buycart {
  741. width: 162rpx;
  742. height: 64rpx;
  743. background: #efaf00 !important;
  744. color: #fff;
  745. font-size: 26rpx;
  746. border-radius: 36rpx;
  747. text-align: center;
  748. line-height: 64rpx;
  749. float: right;
  750. }
  751. .price-none {
  752. font-size: 24rpx;
  753. color: #666666;
  754. }
  755. .zuhe_title {
  756. background: #ffffff;
  757. height: 68rpx;
  758. font-size: 28rpx;
  759. color: #1675e1;
  760. border-bottom: 4rpx solid #1675e1;
  761. line-height: 68rpx;
  762. padding-left: 30rpx;
  763. &.active {
  764. color: #FF5B00;
  765. border-bottom: 4rpx solid #FF5B00;
  766. }
  767. }
  768. .tabstyle {
  769. width: 128rpx;
  770. height: 68rpx;
  771. font-size: 26rpx;
  772. display: inline-block;
  773. border-radius: 10rpx;
  774. text-align: center;
  775. line-height: 68rpx;
  776. border: 2rpx solid #eeeeee;
  777. position: relative;
  778. margin-right: 12rpx;
  779. &.addstyle {
  780. background: $btn-confirm;
  781. color: #ffffff;
  782. &::before {
  783. content: '';
  784. width: 0;
  785. height: 0;
  786. border-top: 20rpx solid transparent;
  787. border-right: 20rpx solid #ffffff;
  788. border-left: 20rpx solid transparent;
  789. border-bottom: 20rpx solid #ffffff;
  790. position: absolute;
  791. right: 0;
  792. bottom: 0;
  793. }
  794. }
  795. .icon-gou {
  796. width: 36rpx;
  797. height: 36rpx;
  798. line-height: 36rpx;
  799. text-align: center;
  800. color: #FF5B00;
  801. position: absolute;
  802. bottom: -5rpx;
  803. right: -5rpx;
  804. font-weight: bold;
  805. font-size: $font-size-28;
  806. }
  807. }
  808. .commodity-list-wrapper {
  809. scroll-view {
  810. height: 100%;
  811. }
  812. .show-more-btn {
  813. width: 276rpx;
  814. height: 52rpx;
  815. line-height: 52rpx;
  816. border: 2rpx solid #d8d8d8;
  817. background: #f7f7f7;
  818. font-size: 26rpx;
  819. margin: 26rpx 0;
  820. position: absolute;
  821. left: 50%;
  822. margin-left: -138rpx;
  823. }
  824. }
  825. .good-search {
  826. height: 68rpx;
  827. width: 100%;
  828. padding:20rpx 24rpx;
  829. background: #ffffff;
  830. display: flex;
  831. align-items: center;
  832. margin-bottom: 10rpx;
  833. position: fixed;
  834. top: 0;
  835. left: 0;
  836. z-index: 19;
  837. .search-from {
  838. width: 705rpx;
  839. height: 68rpx;
  840. background: #f7f7f7;
  841. border-radius: 34rpx;
  842. float: left;
  843. position: relative;
  844. .input {
  845. width: 340rpx;
  846. height: 68rpx;
  847. float: left;
  848. line-height: 68rpx;
  849. color: $text-color;
  850. font-size: $font-size-24;
  851. }
  852. .icon-iconfonticonfontsousuo1 {
  853. width: 64rpx;
  854. height: 68rpx;
  855. line-height: 68rpx;
  856. text-align: center;
  857. display: block;
  858. font-size: $font-size-38;
  859. float: left;
  860. color: #999999;
  861. }
  862. .icon-shanchu1 {
  863. font-size: $font-size-32;
  864. color: #999999;
  865. position: absolute;
  866. width: 120rpx;
  867. height: 68rpx;
  868. line-height: 68rpx;
  869. top: 0;
  870. right: 0;
  871. text-align: center;
  872. z-index: 10;
  873. }
  874. }
  875. .search-btn {
  876. // width: 120rpx;
  877. line-height: 64rpx;
  878. text-align: center;
  879. font-size: $font-size-28;
  880. color: $color-system;
  881. float: left;
  882. background: #ffffff;
  883. margin-left: 10rpx;
  884. }
  885. }
  886. .all-type-list-content {
  887. // height: 240rpx;
  888. padding: 24rpx;
  889. background: #fff;
  890. margin-bottom: 2rpx;
  891. display: flex;
  892. flex-direction: row;
  893. box-sizing: content-box;
  894. .list-details-image {
  895. width: 218rpx;
  896. height: 218rpx !important;
  897. margin-right: 26rpx;
  898. border-radius: 10rpx;
  899. border: 2rpx solid #f3f3f3;
  900. position: relative;
  901. .list-img {
  902. width: 218rpx;
  903. height: 218rpx !important;
  904. }
  905. .list-details-type {
  906. width: 64rpx;
  907. height: 64rpx;
  908. text-align: justify;
  909. box-sizing: border-box;
  910. padding: 10rpx;
  911. border-radius: 0 0 8rpx 8rpx;
  912. background-color: #33ccbf;
  913. font-size: $font-size-22;
  914. color: #ffffff;
  915. line-height: 25rpx;
  916. position: absolute;
  917. top: 0;
  918. right: 10rpx;
  919. }
  920. }
  921. }
  922. .zuhe-list-content {
  923. width: 655rpx;
  924. // height: 214rpx;
  925. background: #fff;
  926. border: 2rpx solid #def4ff;
  927. display: flex;
  928. flex-direction: row;
  929. box-sizing: content-box;
  930. margin-top: 10rpx;
  931. border-radius: 14rpx;
  932. margin: 10rpx auto;
  933. padding: 20rpx;
  934. &.stylecontent {
  935. border: 2rpx solid #fff0de;
  936. }
  937. }
  938. .list-details-info {
  939. width: 100%;
  940. flex-direction: column;
  941. font-size: 26rpx;
  942. position: relative;
  943. .list-details-title {
  944. line-height: 38rpx;
  945. text-overflow: ellipsis;
  946. overflow: hidden;
  947. display: -webkit-box;
  948. -webkit-line-clamp: 2;
  949. line-clamp: 2;
  950. -webkit-box-orient: vertical;
  951. }
  952. .list-details-specs {
  953. width: 100%;
  954. display: inline-block;
  955. margin: 5rpx 0;
  956. color: #666666;
  957. }
  958. .list-details-miniQuantity {
  959. width: 100%;
  960. display: inline-block;
  961. margin-top: 7rpx;
  962. }
  963. }
  964. .list-details-price {
  965. width: 100%;
  966. .floor-item-act {
  967. height: 54rpx;
  968. text-align: center;
  969. box-sizing: border-box;
  970. float: left;
  971. padding: 11rpx 0;
  972. }
  973. .price-icon {
  974. width: 22rpx;
  975. height: 28rpx;
  976. vertical-align: middle;
  977. margin-right: 10rpx;
  978. }
  979. .price-icon + text {
  980. font-size: 25rpx;
  981. vertical-align: middle;
  982. }
  983. .list-login-now {
  984. width: 375rpx;
  985. color: #f8c499;
  986. .p-no {
  987. float: left;
  988. font-size: $font-size-24;
  989. color: $color-system;
  990. margin-right: 10rpx;
  991. }
  992. }
  993. .login-now {
  994. padding: 10rpx 10rpx 10rpx 0;
  995. }
  996. .list-none {
  997. margin-top: 15rpx;
  998. .price-small {
  999. font-size: $font-size-24;
  1000. line-height: 40rpx;
  1001. color: #ff2a2a;
  1002. }
  1003. }
  1004. .list-price-loding {
  1005. font-size: $font-size-24;
  1006. line-height: 54rpx;
  1007. color: #ff2a2a;
  1008. }
  1009. .list-shop {
  1010. float: left;
  1011. overflow: hidden;
  1012. &.com {
  1013. width: 100%;
  1014. }
  1015. .list-price {
  1016. color: #ff2a2a;
  1017. float: left;
  1018. line-height: 54rpx;
  1019. align-items: center;
  1020. justify-content: center;
  1021. .price-larger {
  1022. font-size: $font-size-26;
  1023. display: inline-block;
  1024. &.none {
  1025. text-decoration: line-through;
  1026. color: #999999;
  1027. }
  1028. }
  1029. .list-price-all {
  1030. width: 100%;
  1031. float: left;
  1032. }
  1033. .zuhe_price-larger {
  1034. width: 100%;
  1035. float: left;
  1036. height: 54rpx;
  1037. color: #666666;
  1038. .price-larger {
  1039. float: left;
  1040. margin-right: 20rpx;
  1041. }
  1042. .price-btn {
  1043. display: inline-block;
  1044. padding: 0 16rpx;
  1045. line-height: 32rpx;
  1046. border-radius: 16rpx;
  1047. text-align: center;
  1048. box-sizing: border-box;
  1049. border: 1px solid #FF5B00;
  1050. font-size: 24rpx;
  1051. color: #FF5B00;
  1052. margin-left: 30rpx;
  1053. }
  1054. }
  1055. .price-two {
  1056. color: #666666;
  1057. float: left;
  1058. }
  1059. .zuhe_list_zj {
  1060. color: #ff2a2a;
  1061. }
  1062. .price-view {
  1063. display: inline-block;
  1064. width: 40rpx;
  1065. border-radius: 10rpx;
  1066. font-size: $font-size-22;
  1067. text-align: center;
  1068. color: #ffffff;
  1069. height: 36rpx;
  1070. line-height: 36rpx;
  1071. margin-right: 8rpx;
  1072. &.ladder {
  1073. background: linear-gradient(135deg, rgba(255, 0, 0, 1) 0%, rgba(242, 143, 49, 1) 100%);
  1074. }
  1075. &.activity {
  1076. background: linear-gradient(135deg, rgba(128, 0, 255, 1) 0%, rgba(242, 49, 153, 1) 100%);
  1077. }
  1078. }
  1079. }
  1080. .zuhe_list_price .price-view {
  1081. margin-left: 20rpx;
  1082. float: left;
  1083. margin-top: 5rpx;
  1084. }
  1085. .zuhe_list_price {
  1086. width: 100%;
  1087. overflow: hidden;
  1088. margin-top: 10rpx;
  1089. }
  1090. .count {
  1091. float: right;
  1092. border: 1px solid #eeeeee;
  1093. border-radius: 10rpx;
  1094. .number-box {
  1095. display: flex;
  1096. justify-content: center;
  1097. align-items: center;
  1098. .iconfont {
  1099. font-size: $font-size-24;
  1100. padding: 0 16rpx;
  1101. color: $text-color;
  1102. text-align: center;
  1103. line-height: 48rpx;
  1104. font-weight: bold;
  1105. }
  1106. .btn-input {
  1107. width: 100rpx;
  1108. height: 48rpx;
  1109. line-height: 48rpx;
  1110. background: #f8f8f8;
  1111. border-radius: 4rpx;
  1112. text-align: center;
  1113. font-size: $font-size-24;
  1114. border-right: 1px solid #eeeeee;
  1115. border-left: 1px solid #eeeeee;
  1116. }
  1117. }
  1118. }
  1119. .list-price-none {
  1120. width: 100%;
  1121. .price-none {
  1122. text-decoration: line-through;
  1123. color: #999999;
  1124. display: inline-block;
  1125. }
  1126. .icon-wenhao {
  1127. font-size: $font-size-32;
  1128. color: #0091ff;
  1129. margin-left: 6rpx;
  1130. }
  1131. }
  1132. }
  1133. .add-cart-btn {
  1134. flex: 4;
  1135. width: 140rpx;
  1136. height: 54rpx;
  1137. line-height: 54rpx;
  1138. border-radius: 27rpx;
  1139. color: #fff;
  1140. font-size: 24rpx;
  1141. margin-right: 0;
  1142. background: #ffffff;
  1143. border: 1px solid #c9c9c9;
  1144. color: $text-color;
  1145. }
  1146. .zuhe_btn {
  1147. float: right;
  1148. }
  1149. }
  1150. .zuhe_list_price {
  1151. display: block !important;
  1152. }
  1153. .zuhe_list_text {
  1154. margin-top: 0;
  1155. }
  1156. </style>