index.vue 45 KB

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