Parcourir la source

SKU测试优化

zhengjinyi il y a 2 ans
Parent
commit
4bc4c20387

+ 14 - 7
src/main/resources/static/js/supplier-center/shop/preview.js

@@ -18,23 +18,30 @@ var previewContainer = new Vue({
         trainingMethodText:'',
         trainingType:'',
         isTrainingMethod:false,
+        skuStext:''
     },
     computed: {
 
     },
     methods: {
         shopInfoData: function(){
-            var _this = this;
+            const _this = this;
             SupplierApi.SupplierViewShopInfo({userId:_this.userId},function(response){
-                if(response.code ==0 ){
+                if(response.code ===0 ){
                     _this.isRequest = true;
                     _this.shopData = response.data.shop;
                 }
             });
         },
         infoFata: function(){
-            var _this = this;
+            const _this = this;
             _this.previewThumb = _this.shopInfo.params.image;
+            let newArray = this.shopInfo.skus
+            this.skuStext = newArray.map(item =>{ return item.unit }).join(',')
+            this.shopInfo.price = newArray[0].price;
+            this.shopInfo.normalPrice = newArray[0].normalPrice;
+            this.shopInfo.minBuyNumber = newArray[0].minBuyNumber;
+            this.shopInfo.stock = newArray[0].stock;
         },
         changeTab: function(index){
             this.tabIndex = index;
@@ -49,7 +56,7 @@ var previewContainer = new Vue({
             return "title_" +index
         },
         setArray: function(arr){//回显处理字符串
-            var _ARRAY = [];
+            const _ARRAY = [];
             arr.split(',').forEach(function(item,index){
                 var _OBJ = {name:item};
                 _ARRAY.push(_OBJ)
@@ -58,7 +65,7 @@ var previewContainer = new Vue({
         },
     },
     mounted: function () {
-        var _this = this;
+        const _this = this;
         if(globalUserData){
             _this.userId = globalUserData.userId;
             _this.shopId = globalUserData.shopId;
@@ -77,7 +84,7 @@ var previewContainer = new Vue({
             }
             console.log(_this.previewTags);
         }
-        var magnifier = new mag('.preview-banner-big', '.preview-box','#CM____pic_thumb','.hover','.bigitem');
-            magnifier.init();
+        const magnifier = new mag('.preview-banner-big', '.preview-box', '#CM____pic_thumb', '.hover', '.bigitem');
+        magnifier.init();
     }
 });

+ 3 - 3
src/main/resources/static/js/supplier-center/shop/release.js

@@ -512,9 +512,9 @@ var releaseContainer = new Vue({
         addReleasePeview: function(){//预览按钮
             var _this = this;
             CAIMEI.returnedTarget();
-            _this.releaseParams.orderInfo = orderInfoEditor.getData();
-            _this.releaseParams.serviceInfo = severInfoEditor.getData();
-            _this.releaseParams = Object.assign(_this.releaseParams,{params:_this.params});
+            this.releaseParams.orderInfo = orderInfoEditor.getData();
+            this.releaseParams.serviceInfo = severInfoEditor.getData();
+            this.releaseParams = Object.assign(_this.releaseParams,{params:_this.params,skus:_this.skuParams});
             CAIMEI.Storage.setItem('adProductPeview', JSON.stringify(_this.releaseParams));
             setTimeout(function(){
                 window.open('/supplier/goods/preview.html');

+ 1 - 1
src/main/resources/templates/supplier-center/shop/preview.html

@@ -63,7 +63,7 @@
                     </div>
                     <div class="info unit">
                         <span class="label">包装规格:</span>
-                        <p>{{shopInfo.unit}}</p>
+                        <p>{{ skuStext }}</p>
                     </div>
                     <div class="info num">
                         <span class="label">商品编码:</span>