shop.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <view class="shop">
  3. <van-cell :title="defaultAddr === '' ? '默认收货地址' : defaultAddr" is-link link-type="navigateTo"
  4. url="/pages/address/address" />
  5. <view style="height: 25rpx;"></view>
  6. <view class="card_Main">
  7. <van-checkbox-group :value="checked" bind:change="onChange">
  8. <view class="list" v-for="(item,index) in shopCartInfo" :key="index">
  9. <van-row v-for="items in item.shopCartItemDiscounts[0].shopCartItems" :key="items.basketId">
  10. <van-col span="2">
  11. <van-checkbox @click="basketClick" :name="items.basketId"></van-checkbox>
  12. </van-col>
  13. <van-col span="22">
  14. <text class="shop-name">{{ item.shopName }}</text>
  15. <van-card :num="items.prodCount" :price="items.price" :desc="items.skuName"
  16. :title="items.prodName" :thumb="items.pic">
  17. </van-card>
  18. </van-col>
  19. </van-row>
  20. <van-divider />
  21. </view>
  22. </van-checkbox-group>
  23. <van-submit-bar :price="totalMoney" button-text="提交订单" @submit="onSubmit">
  24. <van-checkbox v-model="checked" @click="allProdSelected">全选</van-checkbox>
  25. <a class="clear-cart" v-show="basketIds.length > 0" @click="clearCart">清空</a>
  26. </van-submit-bar>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import {
  32. shopCartInfo,
  33. totalPay,
  34. orderCount
  35. } from '../../api/shop.js'
  36. export default {
  37. data() {
  38. return {
  39. defaultAddr: "",
  40. basketIds: [],
  41. shopCartInfo: [],
  42. checked: false
  43. }
  44. },
  45. async onShow() {
  46. // const aaa = await totalPay(this.basketIds)
  47. // console.log(aaa, 'aaa')
  48. this.init();
  49. },
  50. methods: {
  51. init() {
  52. shopCartInfo({}).then(res => {
  53. console.log(res, '购物车')
  54. this.shopCartInfo = res;
  55. })
  56. }
  57. }
  58. }
  59. </script>
  60. <style>
  61. </style>