quanwei
13 hours ago 408c463c5b66bba2aa1c81d8dca23e04c1608e24
mobile/pages/branch/activity/product/cart.vue
@@ -1,5 +1,5 @@
<template>
   <view  :data-theme='theme()' :class="theme() || ''">
   <view :data-theme='theme()' :class="theme() || ''">
      <!-- #ifdef APP-PLUS -->
      <header-bar></header-bar>
      <!-- #endif -->
@@ -21,8 +21,7 @@
                              <checkbox color="red" value="cb" class="checkbox"
                                 :checked="supplier_item.checked" />
                           </label>
                           <view class="d-a-c"
                              @tap="gotoPage('/pages/shop/shop?shop_supplier_id='+supplier_item.supplier.shop_supplier_id)">
                           <view class="d-a-c" @tap="gotoShopPage(supplier_item.supplier.shop_supplier_id)">
                              <i class="icon iconfont icon-dianpu1"></i>
                              <text class="f32 gray3">{{supplier_item.supplier.name}}</text>
                           </view>
@@ -43,12 +42,13 @@
                                 <view class="price">
                                    ¥
                                    <text class="num">{{ item.product_price }}</text>
                                    <view v-if="item.service_name">{{ item.service_name }}:¥ {{ item.service_price }}</view>
                                    <view v-if="item.service_name">{{ item.service_name }}:¥
                                       {{ item.service_price }}</view>
                                 </view>
                                 <view class="num-wrap">
                                    <view class="" @tap.stop="reduceFunc(item)" v-if="item.total_num > 1">
                                       <image class="reduce_icon" src="/static/icon/reduce.png"
                                          mode=""></image>
                                       <image class="reduce_icon" src="/static/icon/reduce.png" mode="">
                                       </image>
                                    </view>
                                    <view class="text-wrap">{{item.total_num}}</view>
                                    <view class="" @tap.stop="addFunc(item)"
@@ -74,10 +74,10 @@
            <!--底部按钮-->
            <view class="bottom-btns f28" :class="is_auto?'is_auto':''" v-if="tableData.length > 0">
                <label class="d-c-c mr20" @tap="onCheckedAll()">
               <label class="d-c-c mr20" @tap="onCheckedAll()">
                  <!--<checkbox color="red" class="checkbox" :checked="checkedAll" value="cb" />
                  全选-->
               </label>
               </label>
               <view class="d-e-c pr20" v-if="!isEdit">
                  <view class="total d-s-c flex-1 mr20">
                     <text class="f24 gray9">合计:</text>
@@ -123,15 +123,15 @@
            totalPrice: 0,
            totalProduct: 0,
            store_open: 1,
            is_auto:0,
            activity_id:0,
            longitude:'',
            latitude:'',
            is_auto: 0,
            activity_id: 0,
            longitude: '',
            latitude: '',
         };
      },
      onLoad(e) {
         this.activity_id  = e.activity_id;
         if(!Object.hasOwn(e, 'activity_id')){
         this.activity_id = e.activity_id;
         if (!Object.hasOwn(e, 'activity_id')) {
            uni.navigateBack();
         }
         this.longitude = uni.getStorageSync('userLongitude');
@@ -141,9 +141,9 @@
         /*获取产品详情*/
         this.getData();
         // this.getTabBarLinks();
         if(uni.getStorageSync('citySupplierRes')){
            let resData=uni.getStorageSync('citySupplierRes');
            this.city_supplier_ids=resData.supplier_ids;
         if (uni.getStorageSync('citySupplierRes')) {
            let resData = uni.getStorageSync('citySupplierRes');
            this.city_supplier_ids = resData.supplier_ids;
         }
      },
      mounted() {
@@ -167,9 +167,9 @@
            let self = this;
            self.isloadding = true;
            self._get('branch.activityCart/lists', {
               longitude:self.longitude,
               latitude:self.latitude,
               activity_id:self.activity_id
               longitude: self.longitude,
               latitude: self.latitude,
               activity_id: self.activity_id
            }, function(res) {
               let auto = uni.getStorageSync('TabBar').is_auto && uni.getStorageSync('TabBar').is_auto != 0;
               self.is_auto = auto;
@@ -223,15 +223,15 @@
            //先把其他商户的去掉 by yj 2024.3.11
            let self = this;
            self.tableData.forEach(item => {
               if(item.shop_supplier_id != this.tableData[supplier_index].shop_supplier_id ){
               if (item.shop_supplier_id != this.tableData[supplier_index].shop_supplier_id) {
                  this.$set(item, 'checked', false);
                  item.productList.forEach(product => {
                     product.checked = false;
                  });
               }
            });
            e.checked = !e.checked;
            this.$set(this.tableData[supplier_index].productList, index, e);
            console.log(this.tableData)
@@ -275,7 +275,7 @@
         /* 店铺全选 */
         checkStprItem(itemp, index) {
            let self = this;
            //先把其他商户的去掉 by yj 2024.3.11
            self.tableData.forEach(item => {
               this.$set(item, 'checked', false);
@@ -283,18 +283,22 @@
                  product.checked = false;
               });
            });
            //console.log(itemp)
            itemp.checked = !itemp.checked;
            itemp.productList.forEach((item, index) => {
               item.checked = itemp.checked;
            })
            self.updateTotalPrice();
            // 更新选中记录
            self.onUpdateChecked();
            // 更新全选状态
            this.checkedAll = this.getCheckedData().length == this.totalProduct;
         },
         gotoShopPage(shop_supplier_id) {
            uni.setStorageSync('shop_supplier_id', shop_supplier_id)
            this.gotoPage('/pages/shop/shop?shop_supplier_id=' + shop_supplier_id)
         },
         /*全选*/
         onCheckedAll() {
@@ -336,7 +340,8 @@
               });
               return false;
            }
            this.gotoPage('/pages/order/confirm-order?&branch_activity_id='+self.activity_id+'&order_type=cart&cart_ids=' + arrIds);
            this.gotoPage('/pages/order/confirm-order?&branch_activity_id=' + self.activity_id +
               '&order_type=cart&cart_ids=' + arrIds);
         },
         /*添加*/
         addFunc(item) {
@@ -351,10 +356,10 @@
               'branch.activityCart/add', {
                  product_id: product_id,
                  spec_sku_id: spec_sku_id,
                  activity_id:self.activity_id,
                  activity_id: self.activity_id,
                  total_num: 1,
                  longitude:self.longitude,
                  latitude:self.latitude
                  longitude: self.longitude,
                  latitude: self.latitude
               },
               function(res) {
                  uni.hideLoading()
@@ -369,7 +374,7 @@
         /*减少*/
         reduceFunc(item) {
            let self = this;
            let product_id = item.product_id;
            let spec_sku_id = item.spec_sku_id;
            let service_index = item.service_index;
@@ -377,7 +382,7 @@
               return;
            }
            //最低起卖个数
            if(item.min_sell >= item.total_num){
            if (item.min_sell >= item.total_num) {
               return;
            }
            uni.showLoading({
@@ -385,11 +390,11 @@
            });
            self._post(
               'branch.activityCart/sub', {
                  activity_id:self.activity_id,
                  activity_id: self.activity_id,
                  product_id: product_id,
                  spec_sku_id: spec_sku_id,
                  longitude:self.longitude,
                  latitude:self.latitude
                  longitude: self.longitude,
                  latitude: self.latitude
               },
               function(res) {
                  self.loadding = false;
@@ -417,9 +422,9 @@
                     self._post(
                        'branch.activityCart/delete', {
                           cart_id: cartIds,
                           activity_id:self.activity_id,
                           longitude:self.longitude,
                           latitude:self.latitude
                           activity_id: self.activity_id,
                           longitude: self.longitude,
                           latitude: self.latitude
                        },
                        function(res) {
                           // 删除选中的商品
@@ -458,11 +463,11 @@
                  }
               });
            });
            self.$nextTick(()=>{
            self.$nextTick(() => {
               // 更新选中记录
               self.onUpdateChecked();
            })
            return true;
         },
         /**
@@ -652,6 +657,7 @@
      background: #ffffff;
      z-index: 1000;
   }
   // .bottom-btns.is_auto {
   //    bottom: calc(env(safe-area-inset-bottom) + 98rpx);
   // }
@@ -712,4 +718,4 @@
      width: 32rpx;
      height: 32rpx;
   }
</style>
</style>