index.vue 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673
  1. <template>
  2. <view class="content" :animation="animationData">
  3. <global-loading />
  4. <!-- 购物车 -->
  5. <view v-if="dataList.length !== 0">
  6. <view class="cart-bg">
  7. <view class="cart-num-box">
  8. <image src="https://ceres.zkthink.com/static/images/logoTop.png"></image>
  9. <text class="btn-box"
  10. @click="btnTypeClick(1)"
  11. v-if="btnType == 0">管理
  12. </text>
  13. <text class="btn-box"
  14. @click="btnTypeClick(0)"
  15. v-if="btnType == 1">完成
  16. </text>
  17. </view>
  18. <view>
  19. <text class="num-box">共
  20. <text class="num">{{ allNum }}</text>
  21. 件宝贝
  22. </text>
  23. </view>
  24. </view>
  25. <view class="cart-list-box">
  26. <view class="itemBox"
  27. v-for="(item, index) in dataList"
  28. :key="item.shopId">
  29. <view class="item"
  30. v-if="item.skus.length !== 0">
  31. <view class="shop-box">
  32. <image mode="aspectFill"
  33. v-if="item.selected === 1"
  34. src="https://ceres.zkthink.com/static/images/selectActive.png"
  35. class="cart-select-img"
  36. @click.stop="updateShopSel(index,0)"></image>
  37. <image mode="aspectFill"
  38. v-else
  39. src="https://ceres.zkthink.com/static/images/selectEmpty.png"
  40. class="cart-select-img"
  41. @click.stop="updateShopSel(index,1)"></image>
  42. <view class="shop-name-box"
  43. @click="goStore(index)">
  44. <image src="https://ceres.zkthink.com/static/images/orderStoreIcon.png"
  45. class="shop-img"></image>
  46. <text class="shop-name">{{ item.shopName }}</text>
  47. <image src="https://ceres.zkthink.com/static/images/arrowRight.png"
  48. class="arrow-right-img"></image>
  49. </view>
  50. </view>
  51. <view class="rulesBox flex-items"
  52. v-if="item.currentRules.number">
  53. <image class="mar-right-20"
  54. src="https://ceres.zkthink.com/static/images/zuheIcon.png"></image>
  55. <view class="fs24 font-color-C83732">
  56. 已满足【{{ item.currentRules.price }}元任选{{ item.currentRules.number }}件】!
  57. </view>
  58. </view>
  59. <view v-for="(skuItem, cIndex) in dataList[index].skus"
  60. class="product-list-box">
  61. <view class="pro-item"
  62. @click="goodsDateils(item.shopId,skuItem.productId,skuItem.skuId)">
  63. <image mode="aspectFill"
  64. v-if="skuItem.selected == 1"
  65. src="https://ceres.zkthink.com/static/images/selectActive.png"
  66. @click.stop="cartItemSel(index,cIndex,0)"
  67. class="cart-select-img"></image>
  68. <image mode="aspectFill"
  69. v-else
  70. src="https://ceres.zkthink.com/static/images/selectEmpty.png"
  71. @click.stop="cartItemSel(index,cIndex,1)"
  72. class="cart-select-img"></image>
  73. <view class="pro-r">
  74. <image :src="skuItem.image"
  75. class="pro-img default-img"></image>
  76. <view class="pro-r-r">
  77. <view class="pro-name">{{ skuItem.productName }}</view>
  78. <view class="sku-box">
  79. <text v-if="skuItem.value">{{ skuItem.value }}</text>
  80. <text v-else>默认规格</text>
  81. <!-- <text></text> -->
  82. </view>
  83. <view class="pro-price-num-box">
  84. <view class="pro-price-box">
  85. <text class="fuhao">¥</text>
  86. <text>{{ skuItem.price }}</text>
  87. </view>
  88. <view class="pro-num-box">
  89. <text class="num-btn r"
  90. @click.stop="numSub(index,cIndex)">-
  91. </text>
  92. <text class="num">{{ skuItem.number }}</text>
  93. <text class="num-btn l"
  94. @click.stop="numAdd(index,cIndex)">+
  95. </text>
  96. </view>
  97. </view>
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. </view>
  103. </view>
  104. </view>
  105. <!-- 商品详情 -->
  106. <u-popup v-model="goodsDetailShowFlag"
  107. mode="bottom"
  108. border-radius="14">
  109. <view class="goosDetailshow-box">
  110. <view class="detailImg-box flex-row-plus">
  111. <image class="detailImg"
  112. :src="selectedSku.image"></image>
  113. <view class="flex-column-plus mar-left-40">
  114. <view class="font-color-C5AA7B">
  115. <label class="fs24">¥</label>
  116. <label class="fs36 mar-left-10"
  117. v-text="selectedSku.activityType === 1 && btnType === 4 ? selectedSku.originalPrice : selectedSku.price"></label>
  118. </view>
  119. <label class="fs24 font-color-999 mar-top-20">库存 {{ selectedSku.stockNumber }} 件</label>
  120. <label class="fs24 mar-top-20">已选</label>
  121. </view>
  122. </view>
  123. <view class="color-box flex-column-plus">
  124. <view v-for="(attritem,index) in productData.names"
  125. :key="index"
  126. class="skuStyle">
  127. <label class="fs24 font-color-999">{{ attritem.skuName }}</label>
  128. <view class="colorName-box">
  129. <view class="pad-bot-30"
  130. v-for="(attrRes, resIndex) in attritem.values"
  131. :key="resIndex">
  132. <view class="colorName"
  133. :class="{'colorName-on' : selectedAttr[attritem.nameCode] == attrRes.valueCode}"
  134. @click="nameCodeValueCodeClick(attritem.nameCode, attrRes.valueCode, true)">
  135. {{ attrRes.skuValue }}
  136. </view>
  137. </view>
  138. </view>
  139. </view>
  140. </view>
  141. <view class="goodsNum-box flex-row-plus flex-sp-between"
  142. :class="{'bottom-line' :supportHuabei}">
  143. <label class="font-color-999 fs24">数量</label>
  144. <view class="goodsNum">
  145. <text class="subtract"
  146. @click="updateNumSub()">-
  147. </text>
  148. <text class="goodsNumber"
  149. v-model="buyNum">{{ buyNum }}
  150. </text>
  151. <text class="add"
  152. @click.stop="updateNumAdd()">+
  153. </text>
  154. </view>
  155. </view>
  156. <view class="goosDetailbut-box flex-items-plus">
  157. <button type="default"
  158. @click="goodsDateils(shopId,productId,skuId)">查看详情
  159. </button>
  160. <button type="default"
  161. class="submitBtn"
  162. @click="submitBtn()">确认
  163. </button>
  164. </view>
  165. </view>
  166. </u-popup>
  167. <!-- #ifdef H5 -->
  168. <view class="cart-bottom-box-h5">
  169. <!-- #endif -->
  170. <!-- #ifndef H5 -->
  171. <view class="cart-bottom-box-app">
  172. <!-- #endif -->
  173. <view class="cart-bottom">
  174. <view class="left">
  175. <image mode="aspectFill"
  176. v-if="isAllCheck"
  177. src="https://ceres.zkthink.com/static/images/selectActive.png"
  178. class="cart-select-img"
  179. @click="allSel(0)"></image>
  180. <image mode="aspectFill"
  181. v-else
  182. src="https://ceres.zkthink.com/static/images/selectEmpty.png"
  183. class="cart-select-img"
  184. @click="allSel(1)"></image>
  185. <text>全选</text>
  186. </view>
  187. <view class="right"
  188. v-if="btnType == 0">
  189. <view class="price-box">
  190. <text>合计:</text>
  191. <text class="price">¥{{ checkMoney }}</text>
  192. </view>
  193. <view class="btn-confirm"
  194. @click="settlementTap">结算({{ checkNum }})
  195. </view>
  196. </view>
  197. <view class="right"
  198. v-if="btnType == 1">
  199. <view class="btn-delete"
  200. @click="cartDel">删除
  201. </view>
  202. </view>
  203. </view>
  204. </view>
  205. </view>
  206. <!-- 购物车为空 -->
  207. <view v-if="isEmpty"
  208. class="emptyCart-box flex-items-plus flex-column">
  209. <image class="emptyCart-img"
  210. src="https://ceres.zkthink.com/static/images/cartEmpty.png"></image>
  211. <label class="font-color-999 fs26 mar-top-30">你的购物车还没有宝贝哦</label>
  212. <label class="font-color-999 fs26 mar-top-10">快去首页选一个吧~</label>
  213. <view class="goToShopping"
  214. @click="goToShopping">去购物
  215. </view>
  216. </view>
  217. <!-- 热门推荐 -->
  218. <HotTemplate/>
  219. <view style="width: 100%;height: 100rpx;background-color:#efefef;"></view>
  220. <!-- 删除确认弹窗 -->
  221. <tui-modal :show="cardModal"
  222. :custom="true"
  223. :fadein="true">
  224. <view class="Put-box1">
  225. <view class="text-align fs34 fs-bold">
  226. 温馨提示
  227. </view>
  228. <view class="mar-top-40 text-align">
  229. 您确定删除选中的商品吗?
  230. </view>
  231. <view class="flex-display flex-sp-between">
  232. <view class="btn"
  233. @click="cardModal = false">
  234. 点错了
  235. </view>
  236. <view class="btn submit"
  237. @click="doDelete">
  238. 确认删除
  239. </view>
  240. </view>
  241. </view>
  242. </tui-modal>
  243. </view>
  244. </view>
  245. </template>
  246. <script>
  247. import tuiModal from "@/components/modal/modal";
  248. import HotTemplate from '@/components/hoteRecommed/index.vue'
  249. import api from "../../../components/canvasShow/config/api";
  250. const NET = require('../../../utils/request')
  251. const API = require('../../../config/api')
  252. const animation = uni.createAnimation({
  253. duration: 500,
  254. timingFunction: "ease-in-out",
  255. delay: 0
  256. })
  257. export default {
  258. components: {
  259. tuiModal,
  260. HotTemplate
  261. },
  262. data() {
  263. return {
  264. animationData:{},
  265. goodsDetailShowFlag: false,
  266. OriginalSelectedSku: {},
  267. selectedSku: {},
  268. productData: [],
  269. shopId: 0,
  270. productId: 0,
  271. skuId: 0,
  272. selectedAttr: {},
  273. supportHuabei: false,
  274. title: 'Hello',
  275. btnType: 0,
  276. dataList: [],
  277. goosDetailshowFlag: false,
  278. colorActiveId: 1,
  279. colorList: [{
  280. id: 1,
  281. color: '复古蓝色'
  282. }, {
  283. id: 2,
  284. color: '马卡龙粉色'
  285. }],
  286. modelNumActiveId: 1,
  287. modelNumList: [{
  288. id: 1,
  289. modelNum: '小号'
  290. }, {
  291. id: 2,
  292. modelNum: '中号'
  293. }, {
  294. id: 3,
  295. modelNum: '大号'
  296. }],
  297. skuItemList: [],
  298. buyNum: 1,
  299. allNum: 0,
  300. checkNum: 0,
  301. checkMoney: 0,
  302. isAllCheck: true,
  303. skuProdList: {},
  304. item: {},
  305. cardModal: false,
  306. isEmpty: false
  307. }
  308. },
  309. computed: {
  310. // 计算显示tabBar购物车数量
  311. getCartNum() {
  312. let cartNum = 0
  313. this.updateMoneyAndNum()
  314. cartNum = this.allNum
  315. if (cartNum > 0) {
  316. uni.setTabBarBadge({
  317. index: 2,
  318. text: cartNum.toString()
  319. })
  320. } else {
  321. uni.removeTabBarBadge({
  322. index: 2
  323. })
  324. }
  325. uni.setStorageSync('allCartNum', cartNum)
  326. console.log(uni.getStorageSync('allCartNum'), '1111')
  327. }
  328. },
  329. onLoad() {
  330. },
  331. onShow() {
  332. animation.opacity(1).step()
  333. this.animationData = animation.export()
  334. //判断是否登录
  335. /* let item = {}
  336. if(uni.getStorageSync('storage_key')){
  337. item = uni.getStorageSync('storage_key');
  338. }
  339. console.dir(item) */
  340. /* if(JSON.stringify(item) == '{}'){
  341. uni.navigateTo({
  342. url:'../../../pages_category_page2/userModule/login'
  343. })
  344. }else{ */
  345. this.isEmpty = false
  346. this.dataList = []
  347. this.getDataList()
  348. /* } */
  349. },
  350. onHide(){
  351. animation.opacity(0).step()
  352. this.animationData = animation.export()
  353. },
  354. methods: {
  355. // 提交更换商品规格
  356. submitBtn() {
  357. console.log(this.selectedSku.skuId, 'this.selectedSku.skuId')
  358. console.log(this.skuId, 'this.skuId')
  359. NET.request(API.UpdateSkuCart, {
  360. skuId: this.skuId,
  361. newSkuId: this.selectedSku.skuId,
  362. number: this.buyNum
  363. },
  364. "POST").then(res => {
  365. this.goodsDetailShowFlag = false
  366. this.getDataList()
  367. })
  368. },
  369. // 购物车修改属性样式时:数量减
  370. updateNumSub() {
  371. if (this.buyNum > 1) {
  372. this.buyNum = this.buyNum - 1
  373. } else {
  374. uni.showToast({
  375. title: '亲!至少一件哦!',
  376. icon: "none"
  377. })
  378. }
  379. },
  380. // 获取匹配组合定价价格
  381. getData(item) {
  382. return new Promise(((resolve, reject) => {
  383. if (item.ids) {
  384. NET.request(api.getPrices, {
  385. shopId: item.shopId,
  386. ids: item.ids,
  387. page: 1,
  388. pageSize: 10
  389. }, 'GET').then(res => {
  390. resolve(res)
  391. })
  392. } else {
  393. resolve([])
  394. }
  395. }))
  396. },
  397. // 购物车修改属性样式时:数量加
  398. updateNumAdd() {
  399. if (this.buyNum < this.selectedSku.stockNumber) {
  400. this.buyNum = this.buyNum + 1
  401. } else {
  402. uni.showToast({
  403. title: '库存不足!',
  404. icon: "none"
  405. })
  406. }
  407. },
  408. //获取商品详情
  409. queryProductDetail() {
  410. // uni.showLoading({
  411. // mask: true,
  412. // title: '加载中...'
  413. // })
  414. NET.request(API.QueryProductDetail, {
  415. shopId: this.shopId,
  416. productId: this.productId,
  417. skuId: this.skuId,
  418. terminal: 1
  419. },
  420. "GET").then(res => {
  421. uni.hideLoading()
  422. this.productData = res.data
  423. this.markTools = res.data.markTools //平台优惠券
  424. this.shopMarkTools = res.data.shopMarkTools //店铺优惠券
  425. //如果是单款式商品,需要特殊处理productData.names
  426. const mapKeys = Object.keys(this.productData.map)
  427. if (mapKeys.length === 1 && mapKeys[0] === '单款项') {
  428. this.productData.names[0].values.push({
  429. skuValue: '单款项',
  430. valueCode: '单款项'
  431. })
  432. }
  433. //如果sku的图像为空,设置为商品的图像
  434. for (var key in this.productData.map) {
  435. let skuImage = this.productData.map[key].image
  436. if (!skuImage) {
  437. this.productData.map[key].image = this.productData.images[0]
  438. }
  439. }
  440. //评价
  441. this.commentList = res.data.comments
  442. this.commentListLength = this.commentList.length
  443. this.sellDescList = res.data.text.replace(/\<img/gi,
  444. '<img style="max-width:100%;height:auto" ')
  445. this.couponListLength = res.data.couponImages.length
  446. this.showVOList = res.data.couponImages
  447. this.couponList = res.data.markTools
  448. //渲染商详之后,如果参数传了skuId,则选中该skuId,否则选中第一个规格
  449. if (this.skuId) {
  450. this.selectBySkuId(this.skuId)
  451. console.log(this.skuId, 'this.skuId2222')
  452. } else {
  453. for (var attr in this.productData.names) {
  454. this.nameCodeValueCodeClick(attr.nameCode, attr.values[0].valueCode, true)
  455. }
  456. }
  457. this.beginTimer();
  458. }).catch(res => {
  459. uni.hideLoading()
  460. })
  461. },
  462. selectBySkuId(skuId) {
  463. if (skuId) {
  464. let mapinfo = this.productData.map
  465. for (var key in mapinfo) {
  466. if (parseInt(mapinfo[key].skuId) === parseInt(skuId)) {
  467. this.selectedSku = mapinfo[key]
  468. // 选中sku对应的规格
  469. const valueCodeList = key.split(',')
  470. this.productData.names.forEach(attr => {
  471. for (var index in attr.values) {
  472. let valueCode = attr.values[index].valueCode
  473. if (valueCodeList.includes(valueCode)) {
  474. this.nameCodeValueCodeClick(attr.nameCode, valueCode, false)
  475. break
  476. }
  477. }
  478. })
  479. break
  480. }
  481. }
  482. }
  483. },
  484. nameCodeValueCodeClick(nameCode, valueCode, reSelectSku) {
  485. this.selectedAttr[nameCode] = valueCode
  486. if (reSelectSku) {
  487. let attrList = []
  488. for (var key in this.selectedAttr) {
  489. attrList.push(this.selectedAttr[key])
  490. }
  491. const attrkey = attrList.join(',')
  492. let mapinfo = this.productData.map
  493. for (var key in mapinfo) {
  494. if (attrkey === key) {
  495. this.selectedSku = mapinfo[key]
  496. }
  497. }
  498. }
  499. // 选中sku之后,做一些相应的操作
  500. // this.selectSkuPostProcessor()
  501. this.$forceUpdate(); // 重绘
  502. },
  503. selectSkuPostProcessor() {
  504. const ifEnable = this.selectedSku.ifEnable
  505. if (this.selectedSku.activityType === 1 && ifEnable === 0) {
  506. this.topThreeCollageOrders = this.selectedSku.collageOrders.slice(0, 3)
  507. }
  508. if ([1, 2, 3, 4, 5].includes(this.selectedSku.activityType) && ifEnable === 0) {
  509. this.dateformat(this.selectedSku.endTime)
  510. this.countDown();
  511. }
  512. this.timeActivetype = ifEnable === 0;
  513. this.shopDiscountId = this.selectedSku.shopDiscountId
  514. this.shopSeckillId = this.selectedSku.shopSeckillId
  515. },
  516. // 更换商品样式
  517. changeSkuItemValue(skuItem, shopId) {
  518. this.OriginalSelectedSku = skuItem
  519. this.shopId = shopId
  520. this.productId = skuItem.productId
  521. this.skuId = skuItem.skuId
  522. this.buyNum = this.OriginalSelectedSku.number
  523. this.queryProductDetail()
  524. setTimeout(() => {
  525. this.goodsDetailShowFlag = true
  526. }, 1000)
  527. },
  528. //逛店铺
  529. goStore(index) {
  530. uni.navigateTo({
  531. url: '../../../pages_category_page1/store/index?storeId=' + this.dataList[index].shopId
  532. })
  533. },
  534. //商品详情
  535. goodsDateils(shopId, productId, skuId) {
  536. uni.navigateTo({
  537. url: '../../../pages_category_page1/goodsModule/goodsDetails?shopId=' + shopId +
  538. '&productId=' + productId + '&skuId=' + skuId
  539. })
  540. },
  541. // 去首页
  542. goToShopping() {
  543. uni.switchTab({
  544. url: '../../../pages/tabbar/index/index'
  545. })
  546. },
  547. btnTypeClick(type) {
  548. this.btnType = type
  549. },
  550. getDataList() {
  551. // uni.showLoading({
  552. // mask: true,
  553. // title: '加载中...',
  554. // })
  555. NET.request(API.ShoppingCart, {}, 'GET').then(res => {
  556. uni.hideLoading()
  557. this.dataList = res.data
  558. this.allNum = this.dataList.length
  559. if (this.dataList.length === 0) {
  560. this.isEmpty = true
  561. uni.setStorageSync('allCartNum', 0)
  562. uni.removeTabBarBadge({
  563. index: 2
  564. })
  565. }
  566. let recheck = false
  567. this.dataList.forEach((item, index) => {
  568. item['currentIds'] = []
  569. item['priceNumber'] = 0
  570. item['rules'] = []
  571. item['currentRules'] = {}
  572. item['ids'] = 0
  573. for (let i = item.skus.length - 1; i >= 0; i--) {
  574. if (item.skus[i].shelveState === 0) {
  575. item.skus.splice(i, 1)
  576. if (item.skus.length === 0) {
  577. recheck = true
  578. }
  579. } else {
  580. if (item.skus[i].activityType === 6 && item.skus[i].selected === 1) {
  581. item.currentIds.push(item.skus[i].priceId)
  582. item.priceNumber += item.skus[i].number
  583. }
  584. }
  585. }
  586. for (let i = 0; i < item.skus.length; i++) {
  587. if (item.skus[i].activityType === 6) {
  588. item.ids = item.skus[i].priceId
  589. break
  590. }
  591. }
  592. this.getData(item).then(res => {
  593. let rules = []
  594. rules = res.data
  595. this.dataList[index].rules = rules ? rules[0].rules : {}
  596. for (let i = 0; i < this.dataList[index].rules.length; i++) {
  597. // console.log(this.dataList[index].rules[i].number, this.dataList[index].priceNumber, 'fsdfsdfsdfs')
  598. if (this.dataList[index].rules[i].number === this.dataList[index].priceNumber) {
  599. this.dataList[index].currentRules = this.dataList[index].rules[i]
  600. console.log(this.dataList[index].currentRules, '==', this.dataList[index].rules[i])
  601. this.$forceUpdate()
  602. break
  603. } else if (this.dataList[index].rules[this.dataList[index].rules.length - 1].number < this.dataList[index].priceNumber) {
  604. this.dataList[index].currentRules = this.dataList[index].rules[this.dataList[index].rules.length - 1]
  605. this.$forceUpdate()
  606. break
  607. }
  608. }
  609. // 重新检查是不是全为空
  610. if (recheck) {
  611. let isEmpty = true
  612. this.dataList.forEach((item, index) => {
  613. if (item.skus.length !== 0) {
  614. isEmpty = false
  615. }
  616. })
  617. this.isEmpty = isEmpty
  618. }
  619. this.updateMoneyAndNum()
  620. })
  621. })
  622. }).catch(res => {
  623. uni.hideLoading()
  624. })
  625. },
  626. // 数量减
  627. numSub(index, cIndex) {
  628. this.dataList[index].priceNumber = 0
  629. if (this.dataList[index].skus[cIndex].number > 1) {
  630. this.dataList[index].skus[cIndex].number = this.dataList[index].skus[cIndex].number - 1
  631. this.dataList[index].priceNumber = 0
  632. this.priceFn(index)
  633. this.updateCart(this.dataList[index].skus[cIndex].skuId, this.dataList[index].skus[cIndex].number)
  634. } else {
  635. uni.showToast({
  636. title: '亲!至少一件哦!',
  637. icon: "none"
  638. })
  639. }
  640. },
  641. // 数量加
  642. numAdd(index, cIndex) {
  643. this.dataList[index].priceNumber = 0
  644. if (this.dataList[index].skus[cIndex].number >= this.dataList[index].skus[cIndex].stockNumber) {
  645. this.dataList[index].skus[cIndex].number = this.dataList[index].skus[cIndex].stockNumber
  646. wx.showToast({
  647. title: '库存不足!',
  648. icon: 'none'
  649. })
  650. return;
  651. }
  652. if (this.dataList[index].skus[cIndex].number <= this.dataList[index].skus[cIndex].stockNumber) {
  653. this.dataList[index].skus[cIndex].number = this.dataList[index].skus[cIndex].number + 1
  654. this.dataList[index].priceNumber = 0
  655. this.priceFn(index)
  656. this.updateCart(this.dataList[index].skus[cIndex].skuId, this.dataList[index].skus[cIndex].number)
  657. }
  658. },
  659. updateMoneyAndNum() {
  660. this.isAllCheck = true
  661. this.allNum = 0
  662. this.checkNum = 0
  663. // this.checkMoney = 0
  664. for (let i = 0; i < this.dataList.length; i++) {
  665. /** 判断是否存在组合促销*/
  666. // 当前店铺
  667. let shopObj = this.dataList[i]
  668. // 当前店铺的组合优惠ID
  669. let groupPriceId = shopObj.currentIds
  670. // 当前店铺的组合优惠规则
  671. let groupRule = shopObj.currentRules
  672. let selectGroupSku = []
  673. for (let j = 0; j < this.dataList[i].skus.length; j++) {
  674. let item = this.dataList[i].skus[j]
  675. this.allNum += item.number
  676. if (item.selected == 1) {
  677. // 是否在组合商品中
  678. if (groupPriceId.includes(item.priceId)) {
  679. selectGroupSku.push(item)
  680. }
  681. this.checkNum = this.checkNum + item.number
  682. // this.checkMoney += parseFloat(item.price * item.number)
  683. } else {
  684. if (this.isAllCheck) {
  685. this.isAllCheck = false
  686. }
  687. }
  688. }
  689. }
  690. // 算钱
  691. this.getPriceBySelect()
  692. uni.setStorageSync('allCartNum', this.allNum)
  693. if (this.allNum > 0) {
  694. uni.setTabBarBadge({
  695. index: 2,
  696. text: (this.allNum).toString()
  697. })
  698. } else {
  699. uni.removeTabBarBadge({
  700. index: 2
  701. })
  702. }
  703. },
  704. updateShopSel(index, type) {
  705. this.dataList[index].currentRules = {}
  706. this.dataList[index].priceNumber = null
  707. console.log(index, 'index', type, 'type')
  708. let shopCarts = [{
  709. shopId: '',
  710. skus: []
  711. }]
  712. this.dataList[index].selected = type
  713. let len = this.dataList[index].skus.length
  714. for (let i = 0; i < len; i++) {
  715. this.dataList[index].skus[i].selected = type
  716. var skusobj = {};
  717. skusobj["skuId"] = this.dataList[index].skus[i].skuId;
  718. skusobj["selected"] = this.dataList[index].skus[i].selected
  719. shopCarts[0].skus.push(skusobj);
  720. }
  721. shopCarts[0].shopId = this.dataList[index].shopId
  722. this.priceFn(index)
  723. this.updateSelected(shopCarts)
  724. this.$forceUpdate()
  725. },
  726. //选中商品
  727. updateSelected(shopCarts) {
  728. this.updateMoneyAndNum()
  729. NET.request(API.SelectedCart, {
  730. shopCarts
  731. }, 'POST').then(res => {
  732. }).catch(res => {
  733. })
  734. },
  735. updateCart(skuId, number) {
  736. NET.request(API.UpdateNumberCart, {
  737. skuId: skuId,
  738. number: number
  739. }, 'POST').then(res => {
  740. this.updateMoneyAndNum()
  741. }).catch(res => {
  742. })
  743. },
  744. cartItemSel(index, cIndex, type) {
  745. console.log(this.dataList)
  746. this.dataList[index].currentRules = {}
  747. this.dataList[index].priceNumber = 0
  748. let shopCarts = [{
  749. shopId: 0,
  750. skus: []
  751. }]
  752. this.dataList[index].skus[cIndex].selected = type
  753. if (type == 1) {
  754. let len = this.dataList[index].skus.length
  755. let shopType = 1
  756. for (let i = 0; i < len; i++) {
  757. if (this.dataList[index].skus[i].selected == 0) {
  758. shopType = 0
  759. break
  760. }
  761. }
  762. this.dataList[index].selected = shopType
  763. } else {
  764. this.dataList[index].selected = type
  765. }
  766. this.priceFn(index)
  767. shopCarts[0].shopId = this.dataList[index].shopId
  768. var skusobj = {};
  769. skusobj["skuId"] = this.dataList[index].skus[cIndex].skuId;
  770. skusobj["selected"] = this.dataList[index].skus[cIndex].selected;
  771. shopCarts[0].skus.push(skusobj);
  772. this.updateSelected(shopCarts)
  773. },
  774. // 组合定价
  775. priceFn(shopIndex) {
  776. this.dataList[shopIndex].currentRules = {}
  777. this.dataList[shopIndex].skus.forEach((item) => {
  778. if (item.activityType === 6 && item.selected === 1) {
  779. this.dataList[shopIndex].priceNumber += item.number
  780. }
  781. })
  782. for (let i = 0; i < this.dataList[shopIndex].rules.length; i++) {
  783. if (this.dataList[shopIndex].rules[i].number === this.dataList[shopIndex].priceNumber) {
  784. this.dataList[shopIndex].currentRules = this.dataList[shopIndex].rules[i]
  785. console.log(this.dataList[shopIndex].currentRules, '==', this.dataList[shopIndex].rules[i])
  786. this.$forceUpdate()
  787. break
  788. } else if (this.dataList[shopIndex].rules[this.dataList[shopIndex].rules.length - 1].number < this.dataList[shopIndex].priceNumber) {
  789. this.dataList[shopIndex].currentRules = this.dataList[shopIndex].rules[this.dataList[shopIndex].rules.length - 1]
  790. this.$forceUpdate()
  791. break
  792. }
  793. }
  794. },
  795. //全选
  796. allSel(type) {
  797. this.updateAllSel(type)
  798. },
  799. updateAllSel(type) {
  800. console.log(type, 'type')
  801. let len = this.dataList.length
  802. for (let i = 0; i < len; i++) {
  803. let len2 = this.dataList[i].skus.length
  804. this.dataList[i].selected = type
  805. let priceNum = 0
  806. for (let j = 0; j < len2; j++) {
  807. this.dataList[i].skus[j].selected = type
  808. if (this.dataList[i].skus[j].selected === 1 && this.dataList[i].skus[j].activityType === 6) {
  809. priceNum += this.dataList[i].skus[j].number
  810. }
  811. }
  812. this.dataList[i].priceNumber = priceNum
  813. if (JSON.stringify(this.dataList[i].rules) !== "{}" && this.dataList[i].rules.length > 0) {
  814. this.dataList[i].rules.forEach((item => {
  815. if (item.number <= this.dataList[i].priceNumber) {
  816. this.dataList[i].currentRules = item
  817. }
  818. }))
  819. }
  820. }
  821. if (type === 0) {
  822. this.dataList.forEach((item) => {
  823. item.currentRules = {}
  824. })
  825. }
  826. let shopCarts = []
  827. this.updateSelected(shopCarts)
  828. },
  829. //点击删除
  830. cartDel() {
  831. if (!this.checkNum) {
  832. uni.showToast({
  833. title: '请先选择对应商品',
  834. icon: 'none'
  835. })
  836. return;
  837. }
  838. this.cardModal = true
  839. },
  840. //删除购物车
  841. doDelete() {
  842. this.cardModal = false
  843. let cartList = []
  844. let n = 0
  845. let skus = []
  846. let len = this.dataList.length
  847. for (let i = 0; i < len; i++) {
  848. let item = {}
  849. let len2 = this.dataList[i].skus.length
  850. for (let j = 0; j < len2; j++) {
  851. let itemGoods = this.dataList[i].skus[j]
  852. if (itemGoods.selected == 1) {
  853. skus[n] = itemGoods.skuId
  854. n = n + 1
  855. }
  856. }
  857. }
  858. NET.request(API.DeleteCart, {
  859. ids: skus
  860. }, 'POST').then(res => {
  861. this.getDataList()
  862. }).catch(res => {
  863. })
  864. },
  865. /**
  866. * 获取结算数组(计算价格)
  867. * @param needReturn 是否需要返回数组
  868. * @returns {*[]}
  869. */
  870. getPriceBySelect(needReturn=false){
  871. // uni.showLoading({
  872. // title:"计算中..."
  873. // })
  874. let addCart = []
  875. let len = this.dataList.length
  876. for (let i = 0; i < len; i++) {
  877. let shopObj = {}
  878. shopObj["shopId"] = this.dataList[i].shopId
  879. shopObj["skus"] = []
  880. let len2 = this.dataList[i].skus.length
  881. for (let j = 0; j < len2; j++) {
  882. let skusObj = {}
  883. skusObj["ifLogistics"] = this.dataList[i].skus[j].ifLogistics
  884. skusObj["number"] = this.dataList[i].skus[j].number
  885. skusObj["selected"] = this.dataList[i].skus[j].selected
  886. skusObj["skuId"] = this.dataList[i].skus[j].skuId
  887. shopObj.skus.push(skusObj)
  888. }
  889. addCart.push(shopObj)
  890. }
  891. let newArray = []
  892. addCart.forEach((item, index) => {
  893. newArray[index] = item
  894. newArray[index].skus = item.skus.filter((item) => {
  895. return item.selected == 1
  896. })
  897. if (item.skus.length == 0) {
  898. newArray.splice(index, 1);
  899. }
  900. })
  901. newArray = newArray.filter(d => d)
  902. let postData = {
  903. type: 2,
  904. shops: newArray
  905. }
  906. if(!needReturn){
  907. NET.request(API.Settlement, postData, 'POST').then(res => {
  908. let money = 0;
  909. res.data.shops.forEach(item=>{
  910. money+=item.total
  911. })
  912. this.checkMoney = money.toFixed(2)
  913. uni.hideLoading()
  914. })
  915. }else{
  916. return newArray
  917. }
  918. },
  919. //结算购物车
  920. settlementTap() {
  921. let newArray = this.getPriceBySelect(true)
  922. uni.setStorageSync('skuItemDTOList', newArray)
  923. uni.navigateTo({
  924. url: '../../../pages_category_page1/orderModule/orderConfirm?type=2'
  925. })
  926. },
  927. //商品尺寸弹窗
  928. goosDetailshowClick(storeId, skuItemId) {
  929. this.goosDetailshowFlag = true
  930. this.colorActiveClick(storeId, skuItemId)
  931. },
  932. //颜色选中事件
  933. colorActiveClick(storeId, attrItemId) {
  934. this.colorActiveId = attrItemId
  935. NET.request(API.QueryProductSku, {
  936. productId: storeId,
  937. skuValueIdList: [attrItemId]
  938. }, 'POST').then(res => {
  939. if (res.code === 0) {
  940. this.skuProdList = res.data
  941. this.skuProdId = res.data.id
  942. this.skuImg = res.data.skuImg
  943. this.skuNameStr = res.data.skuNameStr
  944. this.skuPrice = res.data.skuPrice
  945. }
  946. }).catch(res => {
  947. })
  948. },
  949. }
  950. }
  951. </script>
  952. <style lang="scss"
  953. scoped>
  954. page {
  955. // background: #f7f7f7;
  956. }
  957. .content {
  958. overflow: hidden;
  959. opacity: 0;
  960. .goosDetailshow-box {
  961. .detailImg-box {
  962. margin-top: 30upx;
  963. margin-left: 30upx;
  964. border-radius: 10upx;
  965. border-bottom: 1upx solid #EDEDED;
  966. padding-bottom: 20upx;
  967. width: 690upx;
  968. .detailImg {
  969. width: 180upx;
  970. height: 180upx;
  971. }
  972. }
  973. .color-box {
  974. padding: 30upx 30upx;
  975. border-bottom: 1upx solid #EDEDED;
  976. width: 690upx;
  977. .colorName-box {
  978. display: flex;
  979. flex-wrap: wrap;
  980. flex-direction: row;
  981. justify-content: flex-start;
  982. align-items: center;
  983. margin-top: 30upx;
  984. margin-left: -30upx;
  985. .colorName {
  986. background-color: #FFFFFF;
  987. margin-left: 30upx;
  988. padding: 10upx 32upx;
  989. font-size: 26upx;
  990. border: 2rpx solid #E4E5E6;
  991. z-index: 2;
  992. color: #333333;
  993. }
  994. .colorName-on {
  995. box-shadow: 0 0 20rpx rgba(0, 0, 0, 0.1);
  996. color: #C5AA7B;
  997. margin-left: 30upx;
  998. padding: 10upx 32upx;
  999. font-size: 26upx;
  1000. text-align: center;
  1001. z-index: 1;
  1002. border: none;
  1003. }
  1004. }
  1005. }
  1006. .modelNum-box {
  1007. padding: 30upx 30upx;
  1008. border-bottom: 1upx solid #EDEDED;
  1009. width: 690upx;
  1010. .modelNumName-box {
  1011. display: flex;
  1012. flex-wrap: wrap;
  1013. flex-direction: row;
  1014. justify-content: flex-start;
  1015. align-items: center;
  1016. margin-top: 30upx;
  1017. margin-left: -30upx;
  1018. .modelNumName-on {
  1019. background-color: #FFE4D0;
  1020. color: #FF7800;
  1021. margin-left: 30upx;
  1022. padding: 10upx 32upx;
  1023. border-radius: 28upx;
  1024. border: 1upx solid #FF7800;
  1025. font-size: 26upx;
  1026. text-align: center;
  1027. }
  1028. .modelNumName {
  1029. background-color: #F5F5F5;
  1030. margin-left: 30upx;
  1031. padding: 10upx 32upx;
  1032. border-radius: 28upx;
  1033. font-size: 26upx;
  1034. }
  1035. }
  1036. }
  1037. .goodsNum-box {
  1038. padding: 30upx 30upx;
  1039. width: 100%;
  1040. padding-bottom: 140upx;
  1041. .goodsNum {
  1042. height: 50upx;
  1043. text {
  1044. display: inline-block;
  1045. width: 50upx;
  1046. height: 50upx;
  1047. border: 1upx solid #999999;
  1048. text-align: center;
  1049. // line-height: 50upx;
  1050. }
  1051. .subtract {
  1052. border-right: 0upx;
  1053. }
  1054. .add {
  1055. border-left: 0upx;
  1056. }
  1057. }
  1058. }
  1059. .bottom-line {
  1060. border-bottom: 1upx solid #EDEDED;
  1061. }
  1062. .huabei-box {
  1063. padding: 30upx 30upx;
  1064. width: 690upx;
  1065. .fenqi-box {
  1066. margin-top: 15upx;
  1067. width: 120%;
  1068. .huabei-item {
  1069. display: inline-block;
  1070. background: #f3f3f3;
  1071. padding: 16upx 24upx;
  1072. margin: 5upx 10upx;
  1073. border-radius: 15upx;
  1074. text-align: center;
  1075. font-size: 7upx;
  1076. .huabei-period {
  1077. display: block;
  1078. }
  1079. }
  1080. .fenqi-on {
  1081. border: 1px solid #EF7F93;
  1082. color: #EF7F93;
  1083. }
  1084. .disabled {
  1085. color: #cacaca;
  1086. }
  1087. }
  1088. }
  1089. .goosDetailbut-box {
  1090. justify-content: center;
  1091. margin-bottom: 48rpx;
  1092. button {
  1093. width: 342rpx;
  1094. height: 100rpx;
  1095. line-height: 100rpx;
  1096. font-size: 28rpx;
  1097. border: 1px solid;
  1098. border-radius: 0;
  1099. }
  1100. .submitBtn {
  1101. color: #FFEBC4;
  1102. background: #333333;
  1103. }
  1104. }
  1105. }
  1106. .Put-box1 {
  1107. .btn {
  1108. text-align: center;
  1109. margin-top: 40rpx;
  1110. border: 1px solid #333333;
  1111. height: 80upx;
  1112. line-height: 80upx;
  1113. width: 240upx;
  1114. color: #333333;
  1115. }
  1116. .submit {
  1117. background-color: #333333;
  1118. color: #FFEBC4;
  1119. }
  1120. }
  1121. .cart-bg {
  1122. width: 100%;
  1123. height: 180rpx;
  1124. .cart-num-box {
  1125. display: flex;
  1126. flex-direction: row;
  1127. align-items: center;
  1128. justify-content: space-between;
  1129. image {
  1130. width: 286rpx;
  1131. height: 72rpx;
  1132. }
  1133. .btn-box {
  1134. font-size: 30rpx;
  1135. color: #333333;
  1136. padding: 30rpx;
  1137. box-sizing: border-box;
  1138. display: inline-block;
  1139. }
  1140. }
  1141. .num-box {
  1142. padding: 30rpx 0 30rpx 30rpx;
  1143. box-sizing: border-box;
  1144. font-size: 30rpx;
  1145. color: #C5CACF;
  1146. }
  1147. }
  1148. .cart-list-box {
  1149. box-sizing: border-box;
  1150. .itemBox {
  1151. .item {
  1152. background: #fff;
  1153. border-bottom: 16rpx solid #F8F9FA;
  1154. .shop-box {
  1155. display: flex;
  1156. flex-direction: row;
  1157. align-items: center;
  1158. border-bottom: 1px solid #eee;
  1159. position: relative;
  1160. .cart-select-img {
  1161. width: 40rpx;
  1162. height: 40rpx;
  1163. margin: 30rpx;
  1164. box-sizing: border-box;
  1165. }
  1166. .shop-name-box {
  1167. display: flex;
  1168. flex-direction: row;
  1169. align-items: center;
  1170. .shop-img {
  1171. width: 36rpx;
  1172. height: 36rpx;
  1173. margin-right: 10rpx;
  1174. }
  1175. .shop-name {
  1176. font-size: 30rpx;
  1177. color: #333;
  1178. font-weight: bold;
  1179. display: inline-block;
  1180. margin-left: 10rpx;
  1181. }
  1182. .arrow-right-img {
  1183. width: 30rpx;
  1184. height: 30rpx;
  1185. box-sizing: border-box;
  1186. margin-left: 30rpx;
  1187. position: absolute;
  1188. right: 30rpx;
  1189. }
  1190. }
  1191. }
  1192. .rulesBox {
  1193. height: 86rpx;
  1194. background: #F9F6F1;
  1195. padding: 0 20rpx;
  1196. image {
  1197. width: 126rpx;
  1198. height: 46rpx;
  1199. }
  1200. }
  1201. .product-list-box {
  1202. .pro-item {
  1203. display: flex;
  1204. flex-direction: row;
  1205. align-items: center;
  1206. .cart-select-img {
  1207. width: 40rpx;
  1208. height: 40rpx;
  1209. margin: 30rpx;
  1210. box-sizing: border-box;
  1211. }
  1212. .pro-r {
  1213. flex: 1;
  1214. border-bottom: 1px solid #eee;
  1215. display: flex;
  1216. flex-direction: row;
  1217. padding: 30rpx 30rpx 30rpx 0;
  1218. box-sizing: border-box;
  1219. overflow: hidden;
  1220. .pro-img {
  1221. width: 180rpx;
  1222. height: 180rpx;
  1223. border-radius: 10rpx;
  1224. margin-right: 30rpx;
  1225. }
  1226. .pro-r-r {
  1227. flex: 1;
  1228. font-size: 26rpx;
  1229. color: #333;
  1230. overflow: hidden;
  1231. display: flex;
  1232. flex-direction: column;
  1233. justify-content: space-between;
  1234. .pro-name {
  1235. height: 66rpx;
  1236. line-height: 33rpx;
  1237. display: -webkit-box;
  1238. overflow: hidden;
  1239. text-overflow: ellipsis;
  1240. word-break: break-all;
  1241. -webkit-box-orient: vertical;
  1242. -webkit-line-clamp: 2;
  1243. }
  1244. .sku-box {
  1245. width: auto;
  1246. display: inline;
  1247. height: 40rpx;
  1248. border-radius: 4rpx;
  1249. padding: 0 0 0 10rpx;
  1250. box-sizing: border-box;
  1251. font-size: 24rpx;
  1252. color: #999;
  1253. text {
  1254. border: 2rpx solid #E4E5E6;
  1255. padding: 2rpx 10rpx;
  1256. }
  1257. }
  1258. .pro-price-num-box {
  1259. display: flex;
  1260. flex-direction: row;
  1261. align-items: center;
  1262. justify-content: space-between;
  1263. .pro-price-box {
  1264. font-size: 36rpx;
  1265. color: #333333;
  1266. font-weight: 400;
  1267. .fuhao {
  1268. font-size: 24rpx;
  1269. }
  1270. }
  1271. .pro-num-box {
  1272. width: 140rpx;
  1273. height: 40rpx;
  1274. border: 1px solid #ddd;
  1275. border-radius: 4rpx;
  1276. display: flex;
  1277. flex-direction: row;
  1278. justify-content: space-between;
  1279. overflow: hidden;
  1280. .num-btn {
  1281. font-size: 34rpx;
  1282. color: #999999;
  1283. display: inline-block;
  1284. width: 40rpx;
  1285. text-align: center;
  1286. line-height: 32rpx;
  1287. height: 40rpx;
  1288. }
  1289. .num-btn.r {
  1290. border-right: 1px solid #ddd;
  1291. }
  1292. .num-btn.l {
  1293. border-left: 1px solid #ddd;
  1294. }
  1295. .num {
  1296. font-size: 26rpx;
  1297. color: #333;
  1298. }
  1299. }
  1300. }
  1301. }
  1302. }
  1303. }
  1304. .pro-item:last-of-type .pro-r {
  1305. border-bottom: none;
  1306. }
  1307. }
  1308. }
  1309. }
  1310. .itemBox:first-child {
  1311. .shop-box {
  1312. border-top: 2rpx solid #eee;
  1313. }
  1314. }
  1315. .itemBox:last-child {
  1316. .item {
  1317. border-bottom: none;
  1318. }
  1319. }
  1320. }
  1321. .emptyCart-box {
  1322. margin: 100rpx 0;
  1323. .emptyCart-img {
  1324. width: 216rpx;
  1325. height: 156rpx;
  1326. }
  1327. .goToShopping {
  1328. width: 282rpx;
  1329. height: 84rpx;
  1330. line-height: 84rpx;
  1331. text-align: center;
  1332. background: #333333;
  1333. margin-top: 40rpx;
  1334. color: #FFEBC4;
  1335. font-size: 28rpx;
  1336. }
  1337. }
  1338. .cart-bottom-box-h5 {
  1339. position: fixed;
  1340. bottom: 74rpx;
  1341. width: 100%;
  1342. z-index: 99;
  1343. }
  1344. .cart-bottom-box-app {
  1345. position: fixed;
  1346. bottom: 0rpx;
  1347. width: 100%;
  1348. z-index: 99;
  1349. }
  1350. .cart-bottom {
  1351. height: 120rpx;
  1352. background: #fff;
  1353. display: flex;
  1354. flex-direction: row;
  1355. align-items: center;
  1356. justify-content: space-between;
  1357. border-top: 1rpx solid #eee;
  1358. }
  1359. .left {
  1360. display: flex;
  1361. flex-direction: row;
  1362. align-items: center;
  1363. font-size: 28rpx;
  1364. color: #666;
  1365. .cart-select-img {
  1366. width: 40rpx;
  1367. height: 40rpx;
  1368. margin: 30rpx;
  1369. box-sizing: border-box;
  1370. }
  1371. }
  1372. .right {
  1373. display: flex;
  1374. flex-direction: row;
  1375. align-items: center;
  1376. box-sizing: border-box;
  1377. .price-box {
  1378. font-size: 30rpx;
  1379. color: #333;
  1380. .price {
  1381. font-size: 40rpx;
  1382. color: #C83732;
  1383. font-weight: bold;
  1384. }
  1385. }
  1386. .btn-confirm {
  1387. width: 232rpx;
  1388. height: 120rpx;
  1389. background: #333333;
  1390. margin-left: 18rpx;
  1391. text-align: center;
  1392. line-height: 120rpx;
  1393. font-size: 28rpx;
  1394. color: #FFEBC4;
  1395. }
  1396. .btn-delete {
  1397. width: 232rpx;
  1398. height: 120rpx;
  1399. line-height: 120rpx;
  1400. text-align: center;
  1401. font-size: 28rpx;
  1402. color: #FFFFFF;
  1403. background: #C83732;
  1404. }
  1405. }
  1406. .goosDetailshow-box {
  1407. .detailImg-box {
  1408. margin-top: 30rpx;
  1409. margin-left: 30rpx;
  1410. border-radius: 10rpx;
  1411. border-bottom: 1rpx solid #EDEDED;
  1412. padding-bottom: 20rpx;
  1413. width: 690rpx;
  1414. .detailImg {
  1415. width: 180rpx;
  1416. height: 180rpx;
  1417. }
  1418. }
  1419. .color-box {
  1420. padding: 30rpx 30rpx;
  1421. border-bottom: 1rpx solid #EDEDED;
  1422. width: 690rpx;
  1423. .skuStyle {
  1424. padding: 20rpx 0;
  1425. }
  1426. .skuStyle:nth-child(2) {
  1427. border-top: 1px solid #F3F4F5;
  1428. }
  1429. .colorName-box {
  1430. display: flex;
  1431. flex-wrap: wrap;
  1432. flex-direction: row;
  1433. justify-content: flex-start;
  1434. align-items: center;
  1435. margin-top: 30rpx;
  1436. margin-left: -30rpx;
  1437. .colorName-on {
  1438. background-color: #FFE5D0;
  1439. color: #C5AA7B;
  1440. margin-left: 30rpx;
  1441. padding: 10rpx 32rpx;
  1442. border-radius: 28rpx;
  1443. border: 1rpx solid #C5AA7B;
  1444. font-size: 26rpx;
  1445. text-align: center;
  1446. z-index: 1;
  1447. }
  1448. .colorName {
  1449. background-color: #F5F5F5;
  1450. margin-left: 30rpx;
  1451. padding: 10rpx 32rpx;
  1452. border-radius: 28rpx;
  1453. font-size: 26rpx;
  1454. z-index: 2;
  1455. }
  1456. }
  1457. }
  1458. .modelNum-box {
  1459. padding: 30rpx 30rpx;
  1460. border-bottom: 1rpx solid #EDEDED;
  1461. width: 690rpx;
  1462. .modelNumName-box {
  1463. display: flex;
  1464. flex-wrap: wrap;
  1465. flex-direction: row;
  1466. justify-content: flex-start;
  1467. align-items: center;
  1468. margin-top: 30rpx;
  1469. margin-left: -30rpx;
  1470. .modelNumName-on {
  1471. background-color: #FFE4D0;
  1472. color: #C5AA7B;
  1473. margin-left: 30rpx;
  1474. padding: 10rpx 32rpx;
  1475. border-radius: 28rpx;
  1476. border: 1rpx solid #C5AA7B;
  1477. font-size: 26rpx;
  1478. text-align: center;
  1479. }
  1480. .modelNumName {
  1481. background-color: #F5F5F5;
  1482. margin-left: 30rpx;
  1483. padding: 10rpx 32rpx;
  1484. border-radius: 28rpx;
  1485. font-size: 26rpx;
  1486. }
  1487. }
  1488. }
  1489. .goodsNum-box {
  1490. padding: 30rpx 30rpx;
  1491. width: 690rpx;
  1492. padding-bottom: 140rpx;
  1493. .goodsNumber {
  1494. text-align: center;
  1495. border: 1rpx solid #999999;
  1496. padding: 3rpx 20rpx;
  1497. }
  1498. .subtract {
  1499. border: 1rpx solid #999999;
  1500. padding: 3rpx 20rpx;
  1501. margin-right: -1rpx;
  1502. }
  1503. .add {
  1504. border: 1rpx solid #999999;
  1505. padding: 3rpx 20rpx;
  1506. margin-left: -1rpx;
  1507. }
  1508. }
  1509. .goosDetailbut-box {
  1510. .joinShopCartBut {
  1511. width: 343rpx;
  1512. height: 80rpx;
  1513. background-color: #FFC300;
  1514. color: #FFFEFE;
  1515. font-size: 28rpx;
  1516. line-height: 80rpx;
  1517. text-align: center;
  1518. margin-left: 30rpx;
  1519. }
  1520. .buyNowBut {
  1521. width: 343rpx;
  1522. height: 80rpx;
  1523. border-radius: 0 40rpx 40rpx 0;
  1524. background-color: #FF6F00;
  1525. color: #FFFEFE;
  1526. font-size: 28rpx;
  1527. line-height: 80rpx;
  1528. text-align: center;
  1529. }
  1530. }
  1531. }
  1532. }
  1533. </style>