cart.vue 19 KB

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