cart.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863
  1. <template>
  2. <view class="container">
  3. <!-- 空白页 -->
  4. <view v-if="!hasLogin" class="empty">
  5. <image src="/static/error/emptyCart.png" class="emptyImg" mode="aspectFit"></image>
  6. <view class="empty-tips">
  7. 空空如也
  8. <view class="navigator" @click="navToLogin">去登陆></view>
  9. </view>
  10. </view>
  11. <view v-if="hasLogin">
  12. <!-- 列表 -->
  13. <!-- <view class="coupon flex" @click="Getcoupon" v-if="showCart == true">
  14. <view class="tip red">优惠券</view>
  15. <view class="tip">优惠券详情见活动页面</view>
  16. <view class="tip green flex">
  17. <view>更多优惠</view>
  18. <view class="iconfont iconenter"></view>
  19. </view>
  20. </view> -->
  21. <view class="emptyCart" v-if="showCart == false">
  22. <view class="empty-img"><image src="/static/error/emptyCart.png"></image></view>
  23. <view class="empty-text">
  24. 空空如也,
  25. <text @click="ToCategory">随便逛逛</text>
  26. </view>
  27. </view>
  28. <view class="cart-list">
  29. <view v-for="(item, index) in cartList" :key="index" class="cart-item" :class="{ 'b-b': index !== cartList.length - 1 }">
  30. <view class="image-wrapper">
  31. <image
  32. :src="item.productInfo.image"
  33. :class="[item.loaded]"
  34. mode="aspectFill"
  35. lazy-load
  36. @load="onImageLoad('cartList', index)"
  37. @error="onImageError('cartList', index)"
  38. ></image>
  39. <view class="iconfont iconroundcheckfill checkbox" :class="{ checked: item.checked }" @click="check('item', index)"></view>
  40. </view>
  41. <view class="item-right">
  42. <view class="flex">
  43. <text class="clamp title">{{ item.productInfo.store_name }}</text>
  44. <text class="del-btn iconfont iconclose" @click="deleteCartItem(item, 1)"></text>
  45. </view>
  46. <text class="attr">{{ item.attr_val }}</text>
  47. <view class="flex">
  48. <view class="price">¥{{ item.productInfo.price }}</view>
  49. <uni-number-box
  50. class="step"
  51. :min="1"
  52. :max="item.productInfo.stock"
  53. :value="item.cart_num > item.productInfo.stock ? item.productInfo.stock : item.cart_num"
  54. :isMax="item.cart_num >= item.productInfo.stock ? true : false"
  55. :isMin="item.cart_num === 1"
  56. :index="index"
  57. :key="item.id"
  58. :disabled="true"
  59. @eventChange="numberChange"
  60. ></uni-number-box>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. <view class="guess-name" v-if="invalList.length > 0">
  66. <view class="img"><image src="../../static/image/img13.png"></image></view>
  67. <view class="name">失效商品</view>
  68. </view>
  69. <view class="cart-list">
  70. <view v-for="(item, ind) in invalList" :key="item.id" class="cart-item" :class="{ 'b-b': ind !== invalList.length - 1 }">
  71. <view class="image-wrapper"><image :src="item.productInfo.image" mode="aspectFill"></image></view>
  72. <view class="meng">已失效</view>
  73. <view class="item-right">
  74. <view class="flex">
  75. <text class="clamp title">{{ item.productInfo.store_name }}</text>
  76. <text class="del-btn iconfont iconclose" @click="deleteCartItem(item, 2)"></text>
  77. </view>
  78. <text class="attr">{{ item.attr_val }}</text>
  79. <view class="flex">
  80. <view class="price">¥{{ item.productInfo.price }}</view>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. <!-- <view v-if="Guesslist.length > 0">
  86. <view class="guess-name">
  87. <view class="img"><image src="../../static/image/img13.png"></image></view>
  88. <view class="name">猜你喜欢</view>
  89. </view>
  90. <view id="list-box" class="list-box" :style="{ height: swiperHeight + 'px' }">
  91. <view class="guess-section">
  92. <view v-for="(item, index) in Guesslist" :key="index" class="guess-item" @click="ToDetail(item)">
  93. <view class="imagewrapper"><image :src="item.image"></image></view>
  94. <view class="guess-list">
  95. <text class="title clamp margin-c-20">{{ item.store_name }}</text>
  96. <view class="info clamp margin-c-20">{{ item.store_info }}</view>
  97. <view class="tipBox margin-c-20">
  98. <view class="tipsl" v-if="item.keyword != ''">
  99. <text v-for="lss in item.keyword">{{ lss }}</text>
  100. </view>
  101. </view>
  102. </view>
  103. <view class="price margin-c-20 flex">
  104. <view class="price_list">
  105. <view class="price-red">
  106. ¥{{ item.price }}
  107. <text>/份</text>
  108. </view>
  109. <view class="price-green">
  110. ¥{{ item.ot_price }}
  111. <text>市场价</text>
  112. </view>
  113. </view>
  114. <view class="img position-relative" @click.stop="Addcar(item)">
  115. <image src="/static/img/img21.png"></image>
  116. <view class="corner" v-if="item.cart_num > 0">
  117. <text>{{ item.cart_num }}</text>
  118. </view>
  119. </view>
  120. </view>
  121. </view>
  122. </view>
  123. </view>
  124. </view> -->
  125. <!-- 底部菜单栏 -->
  126. <view class="action-section" v-show="showCart">
  127. <view class="checkbox">
  128. <view class="iconfont iconroundcheckfill icon-checked-box" @click="check('all')" :class="{ 'icon-checked': allChecked }"></view>
  129. <view class="clear-btn" @click="allChecked ? clearCart() : ''" :class="{ show: allChecked }"><text>清空</text></view>
  130. </view>
  131. <view class="total-box">
  132. <text class="price">合计:¥{{ total }}</text>
  133. </view>
  134. <button type="primary" class="no-border confirm-btn" @click="createOrder">结算</button>
  135. </view>
  136. </view>
  137. </view>
  138. </template>
  139. <script>
  140. import { getCartList, getCartNum, cartDel } from '@/api/user.js';
  141. import { getProducts,cartAdd } from '@/api/product.js';
  142. import { mapState } from 'vuex';
  143. import { saveUrl, interceptor } from '@/utils/loginUtils.js';
  144. export default {
  145. data() {
  146. return {
  147. total: 0, //总价格
  148. allChecked: false, //全选状态 true|false
  149. showCart: false, //隐藏购物车数据
  150. empty: false, //空白页现实 true|false
  151. cartList: [], //购物车商品
  152. swiperHeight: 0,
  153. // Guesslist: '', //猜你喜欢
  154. invalList: '' //失效商品
  155. };
  156. },
  157. onShow() {
  158. // 只有登录时才加载数据
  159. if (this.hasLogin) {
  160. this.loadData();
  161. this.Guess();
  162. }
  163. },
  164. onLoad(option){
  165. if (option.spread) {
  166. uni.setStorageSync('spread', option.spread);
  167. }
  168. saveUrl();
  169. },
  170. watch: {
  171. //显示空白页
  172. cartList(e) {
  173. let empty = e.length === 0 ? true : false;
  174. if (this.empty !== empty) {
  175. this.empty = empty;
  176. }
  177. if (e.length > 0) {
  178. this.showCart = true;
  179. }
  180. if (e.length == 0) {
  181. this.showCart = false;
  182. }
  183. },
  184. // 初次加载页面高度时修改页面高度
  185. // Guesslist(newValue, oldValue) {
  186. // let obj = this;
  187. // let bHeight = Math.ceil(newValue.length / 2);
  188. // obj.$nextTick(function() {
  189. // uni.createSelectorQuery()
  190. // .select('#list-box')
  191. // .fields(
  192. // {
  193. // size: true
  194. // },
  195. // function(data) {
  196. // obj.pageProportion = data.width / 750;
  197. // obj.swiperHeight = Math.ceil(obj.pageProportion * 620 * bHeight);
  198. // }
  199. // )
  200. // .exec();
  201. // });
  202. // }
  203. },
  204. computed: {
  205. ...mapState('user', ['hasLogin'])
  206. },
  207. //下拉刷新
  208. onPullDownRefresh() {
  209. let obj = this;
  210. //监听下拉刷新动作的执行方法,每次手动下拉刷新都会执行一次
  211. setTimeout(function() {
  212. obj.loadData();
  213. uni.stopPullDownRefresh(); //停止下拉刷新动画
  214. }, 1000);
  215. },
  216. methods: {
  217. //请求数据
  218. async loadData() {
  219. let obj = this;
  220. getCartList({})
  221. .then(function(e) {
  222. obj.invalList = e.data.invalid;
  223. // 获取当前购物车物品增加数量
  224. let nub = obj.cartList.length;
  225. // 获取之前对象数组
  226. let aArray = obj.cartList.reverse();
  227. // 获取返回数据对象数组
  228. let bArray = e.data.valid.reverse();
  229. // 处理数据缓存
  230. let arr = bArray
  231. .map((item, ind) => {
  232. // 设置返回数据默认为勾选状态
  233. item.checked = true;
  234. // 获取相同数组之前对象的数据
  235. let carlist = aArray[ind];
  236. // 判断之前是否已经加载完毕
  237. if (carlist && carlist.loaded == 'loaded') {
  238. item.loaded = 'loaded';
  239. }
  240. return item;
  241. })
  242. .reverse();
  243. obj.$set(obj, 'cartList', []);
  244. obj.$nextTick(e => {
  245. obj.$set(obj, 'cartList', arr);
  246. obj.calcTotal(); //计算总价
  247. });
  248. })
  249. .catch(function(e) {
  250. console.log(e);
  251. });
  252. },
  253. // #ifdef MP
  254. onShareAppMessage: function(res) {
  255. let userInfo = uni.getStorageSync('userInfo');
  256. let GetInfo = uni.getStorageSync('GetInfo');
  257. // 来自页面内分享按钮
  258. let pages = getCurrentPages();
  259. // 获取当前页面
  260. let page = pages[pages.length - 1];
  261. let path = '/pages/index/index?';
  262. // 保存邀请人
  263. path += 'spread=' + userInfo.uid;
  264. let data = {
  265. path: path,
  266. imageUrl: GetInfo.img,
  267. title: GetInfo.title
  268. };
  269. console.log(data)
  270. return data;
  271. },
  272. // #endif
  273. // 猜你喜欢
  274. Guess() {
  275. let obj = this;
  276. getProducts({
  277. page: 1,
  278. limit: 10,
  279. type: 1,
  280. sid: 97 //分类id
  281. })
  282. .then(({ data }) => {
  283. obj.Guesslist = data;
  284. })
  285. .catch(err => {
  286. console.log(err);
  287. });
  288. },
  289. //加入购物车
  290. Addcar(item) {
  291. let obj = this;
  292. cartAdd({
  293. cartNum: '1', //商品数量
  294. uniqueId: '', //商品标签
  295. new: 0, //商品是否新增加到购物车1为不加入0为加入
  296. mer_id: '',
  297. productId: item.id //商品编号
  298. })
  299. .then(function(e) {
  300. uni.showToast({
  301. title: '成功加入购物车',
  302. type: 'top',
  303. duration: 500,
  304. icon: 'none'
  305. });
  306. obj.Guess();
  307. obj.loadData();
  308. })
  309. .catch(e => {});
  310. },
  311. // 商品详情页
  312. ToDetail(item) {
  313. if (item.stock < 1) {
  314. this.$api.msg('该商品已售罄');
  315. } else {
  316. uni.navigateTo({
  317. url: `/pages/product/product?id=` + item.id
  318. });
  319. }
  320. },
  321. ToCategory() {
  322. uni.switchTab({
  323. url: `/pages/category/category`
  324. });
  325. },
  326. //领取优惠券
  327. Getcoupon() {
  328. uni.navigateTo({
  329. url: '/pages/coupon/getcoupon'
  330. });
  331. },
  332. //监听image加载完成
  333. onImageLoad(key, index) {
  334. // 修改载入完成后图片class样式
  335. this.$set(this[key][index], 'loaded', 'loaded');
  336. },
  337. //监听image加载失败
  338. onImageError(key, index) {
  339. this[key][index].image = '/static/error/errorImage.jpg';
  340. },
  341. // 跳转到登录页
  342. navToLogin() {
  343. // 保存地址
  344. saveUrl();
  345. // 登录拦截
  346. interceptor();
  347. },
  348. //选中状态处理
  349. check(type, index) {
  350. if (type === 'item') {
  351. this.cartList[index].checked = !this.cartList[index].checked;
  352. } else {
  353. const checked = !this.allChecked;
  354. const list = this.cartList;
  355. list.forEach(item => {
  356. item.checked = checked;
  357. });
  358. this.allChecked = checked;
  359. }
  360. this.calcTotal(type);
  361. },
  362. //数量
  363. numberChange(data) {
  364. console.log(data);
  365. let arr = this.cartList[data.index];
  366. arr.cart_num = data.number;
  367. getCartNum({ id: arr.id, number: data.number })
  368. .then(e => {})
  369. .catch(function(e) {
  370. console.log(e);
  371. });
  372. this.calcTotal();
  373. this.Guess();
  374. },
  375. //删除
  376. deleteCartItem(index, type) {
  377. uni.showLoading({
  378. title: '加载中'
  379. });
  380. let id = index.id;
  381. let obj = this;
  382. // if(type == 1){
  383. // let list = this.cartList;
  384. // let row = list[index];
  385. // id = row.id;
  386. // }else{
  387. // let list = this.invalList;
  388. // let row = list[index];
  389. // id = row.id;
  390. // }
  391. // if(type == 1){
  392. // this.cartList.splice(index, 1);
  393. // this.calcTotal();
  394. // }else{
  395. // this.invalList.splice(index, 1);
  396. // }
  397. cartDel({
  398. ids: id
  399. })
  400. .then(function(e) {
  401. uni.hideLoading();
  402. obj.loadData();
  403. obj.calcTotal();
  404. obj.Guess();
  405. })
  406. .catch(e => {
  407. uni.hideLoading();
  408. console.log(e.message);
  409. });
  410. },
  411. //清空
  412. clearCart() {
  413. uni.showModal({
  414. content: '清空购物车?',
  415. success: e => {
  416. if (e.confirm) {
  417. let st = this.cartList.map(e => {
  418. return e.id;
  419. });
  420. cartDel({
  421. ids: st.join(',')
  422. }).then(e => {
  423. console.log(e);
  424. });
  425. this.cartList = [];
  426. this.Guess();
  427. }
  428. }
  429. });
  430. },
  431. //计算总价
  432. calcTotal() {
  433. let list = this.cartList;
  434. console.log(list, 7);
  435. if (list.length === 0) {
  436. this.empty = true;
  437. return;
  438. }
  439. let total = 0;
  440. let checked = true;
  441. list.forEach(item => {
  442. if (item.checked === true) {
  443. total += item.productInfo.price * item.cart_num;
  444. } else if (checked === true) {
  445. checked = false;
  446. }
  447. });
  448. this.allChecked = checked;
  449. this.total = Number(total.toFixed(2));
  450. },
  451. //创建订单
  452. createOrder() {
  453. let list = this.cartList;
  454. let goodsData = [];
  455. list.forEach(item => {
  456. if (item.checked) {
  457. goodsData.push(item.id);
  458. }
  459. });
  460. uni.navigateTo({
  461. url: '/pages/order/createOrder?id=' + goodsData.join(',')
  462. });
  463. },
  464. //随便逛逛
  465. Toindex() {
  466. uni.switchTab({
  467. url: '/pages/category/category'
  468. });
  469. }
  470. }
  471. };
  472. </script>
  473. <style lang="scss">
  474. .container {
  475. padding-bottom: 134rpx;
  476. background-color: $page-color-base;
  477. .emptyCart {
  478. position: relative;
  479. width: 100%;
  480. padding-top: 150rpx;
  481. .empty-img {
  482. width: 385rpx;
  483. height: 300rpx;
  484. margin: 0rpx auto;
  485. image {
  486. width: 100%;
  487. height: 100%;
  488. }
  489. }
  490. .empty-text {
  491. text-align: center;
  492. font-size: $font-sm + 2rpx;
  493. color: $font-color-disabled;
  494. margin-bottom: 100rpx;
  495. text {
  496. color: $uni-color-primary;
  497. }
  498. }
  499. }
  500. /* 空白页 */
  501. .empty {
  502. position: fixed;
  503. left: 0;
  504. top: 0;
  505. width: 100%;
  506. height: 100vh;
  507. padding-bottom: 100rpx;
  508. display: flex;
  509. justify-content: center;
  510. flex-direction: column;
  511. align-items: center;
  512. background: #fff;
  513. .emptyImg {
  514. width: 300rpx;
  515. height: 250rpx;
  516. margin-bottom: 30rpx;
  517. }
  518. .empty-tips {
  519. display: flex;
  520. font-size: $font-sm + 2rpx;
  521. color: $font-color-disabled;
  522. .navigator {
  523. color: $uni-color-primary;
  524. margin-left: 16rpx;
  525. }
  526. }
  527. .empty {
  528. width: 100%;
  529. height: 500rpx;
  530. }
  531. }
  532. }
  533. /* 购物车列表项 */
  534. .coupon {
  535. width: 92%;
  536. margin: 25rpx auto;
  537. border-radius: 25rpx;
  538. background: #ffffff;
  539. font-size: 20rpx !important;
  540. padding: 25rpx 15rpx;
  541. .red {
  542. background-color: #fe1212;
  543. color: #ffffff;
  544. line-height: 35rpx;
  545. padding: 0rpx 20rpx;
  546. border-radius: 25rpx;
  547. }
  548. .green {
  549. color: #2dbd59;
  550. }
  551. .tip.green {
  552. height: 30rpx;
  553. }
  554. }
  555. .cart-list {
  556. background: #ffffff;
  557. width: 92%;
  558. margin: 25rpx auto;
  559. border-radius: 25rpx;
  560. .cart-item {
  561. display: flex;
  562. position: relative;
  563. padding: 30rpx 40rpx;
  564. .image-wrapper {
  565. width: 160rpx;
  566. height: 160rpx;
  567. flex-shrink: 0;
  568. position: relative;
  569. image {
  570. border-radius: 8rpx;
  571. }
  572. }
  573. .meng {
  574. width: 160rpx;
  575. height: 160rpx;
  576. position: absolute;
  577. background-color: rgba(0, 0, 0, 0.6);
  578. color: #ffffff;
  579. font-size: 22rpx;
  580. line-height: 160rpx;
  581. text-align: center;
  582. }
  583. .checkbox {
  584. position: absolute;
  585. left: -16rpx;
  586. top: -16rpx;
  587. z-index: 8;
  588. font-size: 44rpx;
  589. line-height: 1;
  590. padding: 4rpx;
  591. color: $font-color-disabled;
  592. background: #fff;
  593. border-radius: 50px;
  594. }
  595. .item-right {
  596. display: flex;
  597. flex-direction: column;
  598. flex: 1;
  599. overflow: hidden;
  600. position: relative;
  601. padding-left: 30rpx;
  602. .title {
  603. font-size: $font-base + 2rpx;
  604. color: $font-color-dark;
  605. height: 40rpx;
  606. line-height: 40rpx;
  607. }
  608. .price {
  609. font-size: $font-base + 2rpx;
  610. color: #ff1a27;
  611. font-weight: bold;
  612. height: 40rpx;
  613. line-height: 40rpx;
  614. }
  615. .attr {
  616. font-size: $font-sm + 2rpx;
  617. color: $font-color-light;
  618. height: 50rpx;
  619. line-height: 50rpx;
  620. }
  621. .price {
  622. height: 50rpx;
  623. line-height: 50rpx;
  624. }
  625. }
  626. .del-btn {
  627. padding: 4rpx 10rpx;
  628. font-size: 34rpx;
  629. height: 50rpx;
  630. color: $font-color-light;
  631. }
  632. }
  633. }
  634. .guess-name {
  635. padding: 25rpx 25rpx;
  636. font-size: 32rpx;
  637. text-align: center;
  638. .img {
  639. width: 80%;
  640. margin: 0rpx auto;
  641. height: 4rpx;
  642. image {
  643. width: 100%;
  644. height: 100%;
  645. }
  646. }
  647. }
  648. /* 猜你喜欢 */
  649. .guess-section {
  650. display: flex;
  651. flex-wrap: wrap;
  652. padding: 0 20rpx;
  653. .guess-item {
  654. // height: 558rpx;
  655. position: relative;
  656. overflow: hidden;
  657. display: flex;
  658. flex-direction: column;
  659. border: 2rpx solid #eeeeee;
  660. width: 343rpx;
  661. margin-bottom: 4%;
  662. border-radius: $border-radius-sm;
  663. background-color: white;
  664. padding-bottom: 30rpx;
  665. &:nth-child(2n + 1) {
  666. margin-right: 24rpx;
  667. }
  668. }
  669. .imagewrapper {
  670. width: 100%;
  671. height: 330rpx;
  672. border-radius: 3px;
  673. margin-bottom: 15rpx;
  674. image {
  675. width: 100%;
  676. height: 100%;
  677. // opacity: 1;
  678. }
  679. }
  680. .guess-list {
  681. height: 130rpx;
  682. .title {
  683. font-size: 28rpx;
  684. color: $font-color-dark;
  685. }
  686. .info {
  687. color: #999999;
  688. font-size: 24rpx;
  689. }
  690. .tipBox {
  691. // padding-bottom: 8rpx;
  692. .tipsl {
  693. text {
  694. border: 2rpx solid #ff1a27;
  695. color: #ff1a27;
  696. border-radius: 5rpx;
  697. font-size: 18rpx;
  698. padding: 2rpx 5rpx;
  699. margin-right: 15rpx;
  700. }
  701. }
  702. }
  703. }
  704. .price {
  705. font-size: 28rpx;
  706. width: 303rpx;
  707. // padding-top: 25rpx;
  708. position: relative;
  709. .price_list {
  710. .price-red {
  711. font-weight: bold;
  712. font-size: 32rpx !important;
  713. color: #ff1a27;
  714. text {
  715. color: #9699a0;
  716. font-size: 24rpx !important;
  717. font-weight: normal;
  718. padding: 0rpx 10rpx;
  719. }
  720. }
  721. .price-green {
  722. color: #2dbd59;
  723. font-size: 24rpx !important;
  724. text {
  725. background: #2dbd59;
  726. color: #ffffff;
  727. padding: 0rpx 8 rpx;
  728. border-radius: 7rpx;
  729. font-size: 20rpx !important;
  730. margin-left: 8rpx;
  731. }
  732. }
  733. }
  734. .img {
  735. position: absolute;
  736. bottom: 0;
  737. right: 0;
  738. width: 50rpx;
  739. height: 50rpx;
  740. image {
  741. width: 100%;
  742. height: 100%;
  743. }
  744. }
  745. }
  746. .icon {
  747. @extend %icon;
  748. }
  749. .detail {
  750. line-height: 1;
  751. }
  752. .tip {
  753. color: white;
  754. background-color: $color-yellow;
  755. line-height: 1.5;
  756. font-size: $font-sm;
  757. padding-left: 20rpx;
  758. }
  759. }
  760. /*公用边框样式*/
  761. %icon {
  762. margin-right: 10rpx;
  763. display: inline-block;
  764. padding: 2rpx 10rpx;
  765. border: 1rpx solid $color-yellow;
  766. color: $color-yellow;
  767. line-height: 1;
  768. font-size: $font-base;
  769. border-radius: 10rpx;
  770. }
  771. /* 底部栏 */
  772. .action-section {
  773. /* #ifdef H5 */
  774. margin-bottom: 100rpx;
  775. /* #endif */
  776. position: fixed;
  777. // left: 30rpx;
  778. bottom: 0rpx;
  779. z-index: 95;
  780. display: flex;
  781. align-items: center;
  782. width: 100%;
  783. height: 120rpx;
  784. padding: 0 30rpx;
  785. background: #ffffff;
  786. // box-shadow: 0 0 20rpx 0 rgba(0, 0, 0, 0.5);
  787. .checkbox {
  788. height: 52rpx;
  789. position: relative;
  790. .icon-checked-box {
  791. border-radius: 50rpx;
  792. background-color: #ffffff;
  793. width: 52rpx;
  794. height: 100%;
  795. position: relative;
  796. z-index: 5;
  797. font-size: 53rpx;
  798. line-height: 1;
  799. color: $font-color-light;
  800. }
  801. .icon-checked {
  802. color: $base-color;
  803. }
  804. }
  805. .clear-btn {
  806. position: absolute;
  807. left: 26rpx;
  808. top: 0;
  809. z-index: 4;
  810. width: 0;
  811. height: 52rpx;
  812. line-height: 52rpx;
  813. padding-left: 38rpx;
  814. font-size: $font-base;
  815. color: #fff;
  816. background: $font-color-disabled;
  817. border-radius: 0 50px 50px 0;
  818. opacity: 0;
  819. transition: 0.2s;
  820. &.show {
  821. opacity: 1;
  822. width: 120rpx;
  823. }
  824. }
  825. .total-box {
  826. flex: 1;
  827. display: flex;
  828. flex-direction: column;
  829. text-align: right;
  830. padding-right: 40rpx;
  831. .price {
  832. font-size: $font-lg;
  833. color: #ff383e;
  834. }
  835. .coupon {
  836. font-size: $font-sm;
  837. color: $font-color-light;
  838. text {
  839. color: $font-color-dark;
  840. }
  841. }
  842. }
  843. .confirm-btn {
  844. padding: 0 45rpx;
  845. margin: 0;
  846. border-radius: 100px;
  847. height: 70rpx;
  848. line-height: 70rpx;
  849. font-size: $font-base + 2rpx;
  850. background: $bg-gradual;
  851. }
  852. }
  853. /* 复选框选中状态 */
  854. .action-section .checkbox.checked,
  855. .cart-item .checkbox.checked {
  856. color: $base-color;
  857. }
  858. </style>