sf
jiangping
2025-04-30 dcdb0231034810232f2542f3865666ebf72daf11
h5/pages/index/index.vue
@@ -2,8 +2,8 @@
   <view class="box">
      <view class="box_bg" :style="{backgroundImage: 'url(' + Config.resourcePath + Config.bgImg + ')'}"></view>
      <view class="box_user">
         <text>欢迎{{User.username}}登录</text>
         <view class="box_user_btn" @click="loginOut">退出登录</view>
         <text>{{User.username}}</text>
         <image src="@/static/ic_logout@2x.png" mode="widthFix" @click="loginOut"></image>
      </view>
      <view class="box_content" :style="{maxWidth: Config.rangeSize + 'px', minWidth: Config.rangeSize + 'px'}">
         <!-- 广告图 -->
@@ -198,16 +198,19 @@
                  </view>
               </view>
               <view class="productPage_shop" v-if="status === 1 && !pkcontent">
                  <view class="productPage_shop_item" v-for="(item, index) in isSOU ? shopPageDataSou : shopPageData" :key="index" @click="clickshoppageItem(item)">
                     <view class="productPage_shop_item_img">
                        <image :src="item.imgurl ? item.prefixUrl + item.imgurl : ''" mode="widthFix"></image>
                  <noData v-if="shopPageData.length === 0 && shopPageDataSou.length === 0" />
                  <template v-else>
                     <view class="productPage_shop_item" v-for="(item, index) in isSOU ? shopPageDataSou : shopPageData" :key="index" @click="clickshoppageItem(item)">
                        <view class="productPage_shop_item_img">
                           <image :src="item.imgurl ? item.prefixUrl + item.imgurl : ''" mode="widthFix"></image>
                        </view>
                        <!-- stringOperations(item.name, 6) -->
                        <text>{{item.name}}</text>
                     </view>
                     <!-- stringOperations(item.name, 6) -->
                     <text>{{item.name}}</text>
                  </view>
                  <view class="productPage_shop_zw"></view>
                  <view class="productPage_shop_zw"></view>
                  <view class="productPage_shop_zw"></view>
                     <view class="productPage_shop_zw"></view>
                     <view class="productPage_shop_zw"></view>
                     <view class="productPage_shop_zw"></view>
                  </template>
               </view>
                <!-- v-if="status === 2" -->
               <view class="productPage_parameter" v-if="isPK && pkcontent">
@@ -227,7 +230,12 @@
                           </view>
                        </view>
                        <view class="productPage_parameter_item_content_nr">
                           <view class="item" v-for="(child, i) in item.goodsParamList" :key="i">
                           <view class="item" v-if="item.param1"  v-for="(child, i) in item.param1" :key="child.index">
                              <view class="label">{{child.name}}:</view>
                              <view class="value">{{child.val}}</view>
                           </view>
                           <view v-if="item.param2.length>0" class="paramline"></view>
                           <view class="item" v-if="item.param2" v-for="(child, j) in item.param2" :key="child.index">
                              <view class="label">{{child.name}}:</view>
                              <view class="value">{{child.val}}</view>
                           </view>
@@ -237,12 +245,6 @@
               </view>
            </view>
         </template>
         <!-- 查看大图 -->
         <bigImg
            ref="bigImg"
            :imgList="imgList"/>
         <!-- 搜索 -->
         
         <!-- 搜索组件 -->
         <search
@@ -258,10 +260,10 @@
</template>
<script>
   import bigImg from '@/components/bigImg.vue'
   import search from '@/components/search.vue'
   import noData from '@/components/noData.vue'
   import { mapState } from 'vuex'
   import { categoryList, goodsList, brandList, h5Image, goodsPage, listForH5 } from '@/apis/index.js'
   import { categoryList, goodsList, brandList, h5Image, goodsPage, listForH5, logout } from '@/apis/index.js'
   export default {
      data() {
         return {
@@ -338,7 +340,7 @@
            page: 1
         }
      },
      components: { bigImg, search },
      components: { search, noData },
      onLoad() {
         var that = this
         // 监听键盘组合键
@@ -421,6 +423,14 @@
               }
            }
         }
      },
      onUnload() {
         //清除
         document.onmouseup = function(ev){
             document.onmousemove = null;
         }
         //清除
         document.onkeydown = null
      },
      computed: {
         // 指导价总计
@@ -537,8 +547,11 @@
         },
         // 退出
         loginOut() {
            this.$store.commit('clean')
            uni.redirectTo({ url: '/pages/login/login' });
            logout({})
               .then(res => {
                  this.$store.commit('clean')
                  uni.redirectTo({ url: '/pages/login/login' });
               })
         },
         // 查询商品数据
         getShopList(type) {
@@ -694,7 +707,10 @@
                  })
               }
            })
            this.$refs.bigImg.open(0)
            if (this.imgList.length === 0) return
            this.$viewerApi({
              images: this.imgList,
            })
         },
         empty() {
            this.shopList = []
@@ -824,6 +840,7 @@
            this.shopList[index].zdPrice = ''
            this.shopList[index].price = ''
            this.shopList[index].xhData = []
            this.shopList[index].multifileList = []
            this.shopList[index].ppShow = false
            this.$forceUpdate()
         },
@@ -844,6 +861,51 @@
               this.leftShop = JSON.parse(JSON.stringify(val))
            } else if (this.$refs.search.typeName === 'right') {
               this.rightShop = JSON.parse(JSON.stringify(val))
               let leftParamList = this.leftShop.goodsParamList;
               let rightParamList = this.rightShop.goodsParamList;
               let leftList1 = new Array();
               let leftList2 =  new Array();
               let rightList1 = new Array();
               let rightList2 =  new Array();
               if(leftParamList && leftParamList.length>0){
                  leftParamList.forEach(item => {
                     let flag =0;
                     let rightTemp = null;
                     if(rightParamList && rightParamList.length>0){
                        rightParamList.forEach(item1 => {
                           if (item.name === item1.name ) {
                              flag =1;
                              rightTemp = item1;
                              return;
                           }
                        })
                     }
                     if(flag === 1){
                        leftList1.push(item);
                        rightList1.push(rightTemp);
                     }else{
                        leftList2.push(item);
                     }
                  })
               }
               if(rightParamList && rightParamList.length>0){
                  rightParamList.forEach(item=> {
                     let flag1 = 0;
                     rightList1.forEach(item1 => {
                        if (item.name === item1.name ) {
                           flag1 =1;
                           //return;
                        }
                     })
                     if(flag1 === 0){
                        rightList2.push(item);
                     }
                  })
               }
               Reflect.set(this.leftShop, "param1",leftList1);
               Reflect.set(this.leftShop, "param2",leftList2);
               Reflect.set(this.rightShop, "param1",rightList1);
               Reflect.set(this.rightShop, "param2",rightList2);
            } else {
               this.shopList.push(JSON.parse(JSON.stringify(val)))
            }
@@ -872,12 +934,15 @@
         },
         copyItem(item) {
            let obj = JSON.parse(JSON.stringify(item))
            obj.multifileList = []
            obj.xhData = []
            obj.brandId = ''
            obj.brand = ''
            obj.brandName = ''
            obj.name = ''
            obj.zdPrice = ''
            obj.price = ''
            console.log(obj)
            this.shopList.push(obj)
         },
         deleItem(i) {
@@ -1046,7 +1111,7 @@
         background-size: 100% 100%;
      }
      .box_user {
         z-index: 99;
         z-index: 9;
         position: fixed;
         top: 30px;
         right: 40px;
@@ -1058,19 +1123,11 @@
            font-weight: 500;
            color: #FFFFFF;
         }
         .box_user_btn {
            width: 80px;
            height: 34px;
            line-height: 34px;
            text-align: center;
            border-radius: 8px;
            border: 2px solid #FFFFFF;
            font-size: 16px;
            font-family: PingFangSC-Regular, PingFang SC;
            font-weight: 400;
            color: #FFFFFF;
            margin-left: 22px;
         image {
            width: 18px;
            height: 18px;
            cursor: pointer;
            margin-left: 10px;
         }
      }
      .box_content {
@@ -1078,7 +1135,7 @@
         // min-width: 750px;
         .box_content_left {
            position: fixed;
            left: 50px;
            left: 80px;
            top: 50%;
            cursor: pointer;
            transform: translate(-50%, 0);
@@ -1092,7 +1149,7 @@
         }
         .box_content_right {
            position: fixed;
            right: 50px;
            right: 0px;
            top: 50%;
            cursor: pointer;
            transform: translate(-50%, 0);
@@ -1135,7 +1192,7 @@
            margin-top: 16px;
            .commodityFrom_head {
               width: 100%;
               height: 60px;
               height: 45px;
               padding: 10px 8px;
               box-sizing: border-box;
               background: rgba(0,224,255,0.24) linear-gradient(180deg, rgba(255,255,255,0.35) 0%, rgba(0,0,0,0.21) 100%);
@@ -1182,7 +1239,7 @@
                  flex-direction: column;
                  .commodityFrom_body_content_item {
                     width: 100%;
                     height: 56px;
                     height: 45px;
                     display: flex;
                     align-items: center;
                     margin-bottom: 6px;
@@ -1203,7 +1260,7 @@
                        opacity: 0;
                        transform: translate(0%, 0%);
                        z-index: -1;
                        height: 56px;
                        height: 45px;
                        display: flex;
                        align-items: center;
                        background: rgba(0,224,255,0.3);
@@ -1276,8 +1333,11 @@
                           font-weight: 500;
                        }
                        .commodityFrom_body_content_item_num_img {
                           width: 24px;
                           height: 24px;
                           width: 28px;
                           height: 28px;
                           display: flex;
                           align-items: center;
                           justify-content: center;
                           margin-right: 4px;
                           image {
                              width: 100%;
@@ -1329,6 +1389,8 @@
                              display: flex;
                              align-items: center;
                              justify-content: center;
                              padding: 0 10px;
                              box-sizing: border-box;
                              &:hover {
                                 text {
                                    color: #FFF200;
@@ -1352,7 +1414,7 @@
               }
               .commodityFrom_body_total {
                  width: 100%;
                  height: 56px;
                  height: 45px;
                  display: flex;
                  align-items: center;
                  .commodityFrom_body_total_item {
@@ -1444,7 +1506,6 @@
               }
            }
         }
         .productPage {
            width: 100%;
            padding: 0 22px;
@@ -1452,7 +1513,7 @@
            margin-top: 16px;
            .productPage_head {
               width: 100%;
               height: 60px;
               height: 45px;
               display: flex;
               align-items: center;
               background: rgba(0,224,255,0.34) linear-gradient(180deg, rgba(255,255,255,0.35) 0%, rgba(0,0,0,0.21) 100%);
@@ -1517,6 +1578,8 @@
                        line-height: 40px;
                        text-align: center;
                        cursor: pointer;
                        padding: 0 10px;
                        box-sizing: border-box;
                        &:hover {
                           text {
                              color: #FFF200;
@@ -1792,6 +1855,10 @@
                        margin-top: 12px;
                        display: flex;
                        flex-direction: column;
                        .paramline{
                           border-bottom: #c7c9ce 2px dashed;
                           margin-bottom: 15px;
                        }
                        .item {
                           display: flex;
                           align-items: flex-start;