immediatelyList.vue 28 KB

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