xuxy
2024-07-27 4250e140336ac40e10ab4c3b650030f82098ca92
sub_pages/customer/trade/detail.vue
@@ -3,7 +3,12 @@
      <view class="top-img-container">
         <image :src="dto.cover" class="top-img" mode="aspectFill"></image>
         <view class="icon-container">
            <image src="../../../static/common/icon-sc.png" @click="collectItem(dto)" class="icon-sc"></image>
            <image v-if="!dto.collection" src="../../../static/common/icon-sc.png" @click="collectItem(dto)"
               class="icon-sc"></image>
            <image v-if="dto.collection" src="../../../static/common/icon-sc.png" @click="collectItem(dto)"
               class="icon-sc"></image>
            <!--        <view class="num">12</view>-->
         </view>
         <view class="icon-container">
@@ -14,7 +19,7 @@
      </view>
      <view class="trade-info-container">
         <view class="title flex">
            <view class="level m-r-15">{{ dto.levelStr || '-' }}级</view>
            <view class="level m-r-15">{{ dto.levelStr || '-' }}</view>
            <view class="">
               {{ dto.name || '-' }}
            </view>
@@ -133,21 +138,27 @@
         }
      },
      methods: {
         async collectItem(dto){
            await this.$message.confirm('是否添加到收藏')
         async collectItem(dto) {
            await this.$message.confirm(`是否${dto.collection?'移除':'添加到'}收藏`)
            this.$message.showLoading()
            const {
               code,
               data
            } = await this.$http.request('post', '/api/collect/add', {
               data: {
                  flowerId: dto.id
               }
            })
            } = await this.$http.request(dto.collection ? "get" : 'post', dto.collection ? '/api/collect/delete' :
               '/api/collect/add', {
                  data: {
                     flowerId: dto.id
                  },
                  params: {
                     id: dto.id
                  }
               })
            if (code === 0) {
               this.$message.showToast('收藏成功')
               this.$message.showToast('操作成功')
               dto.collection = !dto.collection
               this.$forceUpdate()
            }
            this.$message.hideLoading()
         },
         async submitShopping(dto) {
@@ -353,10 +364,12 @@
            position: absolute;
            top: 20rpx;
            width: 80rpx;
            left: 40rpx;
            right: 140rpx;
            height: 80rpx;
            background: rgba(0, 0, 0, 0);
            background: rgba(0, 0, 0, 0.42);
            border-radius: 50%;
            display:flex;
            .icon-sc {
               width: 54rpx;
               height: 54rpx;
@@ -386,7 +399,7 @@
         }
         .icon-container:last-child {
            left: 100rpx;
            right: 20rpx;
         }
         // .icon-container:first-child {