فهرست منبع

fix:修改销售价格、库存、零售价的显示上传BUG

徐志豪 5 سال پیش
والد
کامیت
4a11267547
2فایلهای تغییر یافته به همراه8 افزوده شده و 25 حذف شده
  1. BIN
      backstage.rar
  2. 8 25
      js/shop/goods.js

BIN
backstage.rar


+ 8 - 25
js/shop/goods.js

@@ -15,7 +15,7 @@ $(function () {
             // {label: '属性类别', name: 'attributeCategoryName', index: 'attribute_category', width: 80},
             {label: '零售价格', name: 'retailPrice', index: 'retail_price', width: 80},
             {label: '商品库存', name: 'goodsNumber', index: 'goods_number', width: 80},
-            {label: '销售量', name: 'sellVolume', index: 'sell_volume', width: 80},
+            {label: '销售量', name: 'sellVolume', index: 'sell_volume', width: 80,  formatoptions: { defaultValue: '0' }},
             {label: '市场价', name: 'marketPrice', index: 'market_price', width: 80},
             {
                 label: '上架', align:'center',name: 'isOnSale', index: 'is_on_sale', width: 50,
@@ -219,7 +219,6 @@ var vm = new Vue({
                         if (sub.subItems) {
                             sub.subItems.forEach(function(last){
                                 uuidLink[2] = last.uuid
-                                console.log(uuidLink, 'last.uuid')
                                 if (!last.subItems) {
                                     arr.push(Object.assign({},{
                                         uuidLink:uuidLink.join('_')
@@ -243,13 +242,9 @@ var vm = new Vue({
                 }
             })
 
-            // console.log(this.ggContent)
-            console.log(arr)
             this.inputArr = arr
         },
         showArrsds:function () {
-            // console.log(this.inputArr)
-            // console.log(this.guigeArr)
         },
         transToGuigeArr:function (arr) {
             let temp = []
@@ -273,7 +268,6 @@ var vm = new Vue({
                     })
                 }else{
                      temp.forEach(function (sub) {
-                        //  console.log(sub)
                         if (sub.name === item.specificationName) {
                             sub.val.push(
                                 {
@@ -348,8 +342,6 @@ var vm = new Vue({
             })
     
             this.ggContent = tmp[0]
-            console.log(this.ggContent)
-            // console.log(this.guigeArr)
             this.goodsSpecificationList = goodsSpecificationList
             this.getInputArr()
         },
@@ -369,7 +361,6 @@ var vm = new Vue({
 
         },
         handleItemPicUrl: function (res, file) {
-            console.log('currenIdx',vm.currenIdx)
             vm.$set(vm.guigeArr[vm.currenI]['val'][vm.currenIdx],'picUrl',file.response.url)
             this.guigeArr = vm.guigeArr
         },
@@ -527,24 +518,24 @@ var vm = new Vue({
             vm.goods.goodsImgList = vm.uploadList;
 
             vm.goods['goodsSpecificationList'] = vm.goodsSpecificationList
-            console.log(vm.inputArr)
             vm.goods['productList'] = vm.inputArr
 
             vm.goods['guigeArr'] = JSON.stringify(vm.guigeArr)
             
             vm.goods['ggContent'] = JSON.stringify(vm.ggContent)
-            // 修改市场价和零售价
-            
+            // 修改市场价和零售价,库存
+            vm.goods.goodsNumber = 0
             vm.goods['productList'].forEach((item, index) => {
+                vm.goods.goodsNumber += item.goodsNumber
                 if (index === 0) {
                     vm.goods.retailPrice = item.retailPrice
                     vm.goods.marketPrice = item.marketPrice
                 } else {
-                    if (item.retailPrice < vm.goods['productList'][index - 1].retailPrice) {
-                        vm.goods.retailPrice = item.retailPrice
+                    if (item.retailPrice < vm.goods.retailPrice) {
+                        vm.goods.retailPrice = Number(item.retailPrice)
                     }
-                    if (item.marketPrice < vm.goods['productList'][index - 1].marketPrice) {
-                        vm.goods.retailPrice = item.marketPrice
+                    if (item.marketPrice < vm.goods.marketPrice) {
+                        vm.goods.marketPrice = Number(item.marketPrice)
                     }
                 }
             })
@@ -657,7 +648,6 @@ var vm = new Vue({
                 var arr = item.split('-')
                 val += arr[1] * Math.pow(10, length - index)
             })
-            console.log(val)
             return val
         },
         getInfo: function (id) {
@@ -666,7 +656,6 @@ var vm = new Vue({
                 async: true,
                 successCallback: function (r) {
                     vm.goods = r.goods;
-                    // vm.goodsSpecificationList = r.goods.goodsSpecificationList
                     var productList = r.goods.productList.sort(function(a, b) {
                         var a_uuid_sort = vm.countProductSort(a.uuidLink)
                         var b_uuid_sort = vm.countProductSort(b.uuidLink)
@@ -677,8 +666,6 @@ var vm = new Vue({
 
                     vm.guigeArr = JSON.parse(r.goods.guigeArr) || []
                     vm.ggContent = JSON.parse(r.goods.ggContent)
-                    console.log(vm.ggContent)
-
                     vm.ggname = []
 
                     vm.guigeArr.forEach(function (item){
@@ -686,14 +673,10 @@ var vm = new Vue({
                             name:item.name
                         })
                     })
-                    // vm.showArr()
-                    // console.log(vm.guigeArr)
-                    // console.log(vm.ggContent)
 
                     $('#goodsDesc').editable('setHTML', vm.goods.goodsDesc);
                     vm.getCategory();
                     vm.getSpecification();
-                    // vm.transToGuigeArr(r.goods.goodsSpecificationList)   
                 }
             });
         },