陶杰
2024-09-11 6d54fb64df667c0c396fc7d74aeed9e096d95f95
sub_pages/customer/coupon/good-self.vue
@@ -16,6 +16,8 @@
               <view class="info flex1">
                  <view class="title">
                     {{item.name||''}}
                     <radio :checked="isIngood(item)" @click.stop="updateSelectGood(item)" v-if="source==='shopping'" class="select-coupon"></radio>
                  </view>
                  <view class="time word-e">
                     {{item.description||''}}
@@ -23,9 +25,9 @@
                  <view class="button" @click="getPointGood(item)" v-if="source!=='shopping'">
                     查看详情
                  </view>
                  <view class="button" @click="updateSelectGood(item)" v-if="source=='shopping'">
            <!--       <view class="button" @click="updateSelectGood(item)" v-if="source=='shopping'">
                     {{isIngood(item)?'移除':'添加'}}
                  </view>
                  </view> -->
               </view>
            </view>
            <!--    <view class="tip">
@@ -104,7 +106,7 @@
      methods: {
         isIngood(item) {
            for (var tmp of this.cache_goods) {
               if (tmp.id == item.id) {
               if (tmp.goodsId == item.goodsId) {
                  return true
               }
            }
@@ -114,7 +116,7 @@
         async updateSelectGood(item) {
            var has = false
            for (var tmp of this.cache_goods) {
               if (tmp.id == item.id) {
               if (tmp.goodsId == item.goodsId) {
                  has = true
                  break
               }
@@ -125,7 +127,7 @@
               //移除
               var arr = []
               for (var tmp of this.cache_goods) {
                  if (tmp.id == item.id) {} else {
                  if (tmp.goodsId == item.goodsId) {} else {
                     arr.push(tmp)
                  }
               }
@@ -136,7 +138,7 @@
               }
               arr.push(item)
            }
            await this.$store.dispatch('cache_coupon_select', arr)
            await this.$store.dispatch('cache_goods_select', arr)
            this.$forceUpdate()
         },
@@ -147,7 +149,7 @@
         },
         getPointGood(item) {
            uni.navigateTo({
               url: `/sub_pages/customer/coupon/good-detail?id=${item.id}`
               url: `/sub_pages/customer/coupon/good-detail?id=${item.goodsId}`
            })
         },
         toGoodAll() {