Ver código fonte

批量修改

shish 2 anos atrás
pai
commit
2fec30b076

+ 7 - 0
ghs/src/service/modify/index.js

@@ -10,5 +10,12 @@ export class ModifyService extends BaseService {
 		});
 		});
 	}
 	}
 
 
+	getModifyItem(data) {
+		return this.request({
+			url: '/get-modify-item',
+			params: data
+		});
+	}
+
 }
 }
 export default new ModifyService();
 export default new ModifyService();

+ 39 - 7
ghs/src/views/item/batch-modify.vue

@@ -17,6 +17,9 @@
             <el-button type="primary" size="small" @click="confirmChange()">确认修改</el-button>
             <el-button type="primary" size="small" @click="confirmChange()">确认修改</el-button>
             <el-checkbox v-model="couldLessCost" style="margin-left:8px;">售价允许低于成本</el-checkbox>
             <el-checkbox v-model="couldLessCost" style="margin-left:8px;">售价允许低于成本</el-checkbox>
         </div>
         </div>
+        <div style="padding-left:9px;margin-bottom:5px;">
+            修改记录:<span v-for="(it,idx) in modifyList" style="margin-right:15px;cursor: pointer;" @click="getChagnePrice(it)"> {{ it.name }} </span>
+        </div>
         <div style="width:100%;height:auto;text-align: left;" v-for="(sonProduct, index) in allProdct">
         <div style="width:100%;height:auto;text-align: left;" v-for="(sonProduct, index) in allProdct">
 
 
             <div style="font-weight:bold;text-align: left;width:100%;padding:6px 0 5px 8px;" v-if="sonProduct.child && !$util.isEmpty(sonProduct.child)">{{ sonProduct.className }}</div>
             <div style="font-weight:bold;text-align: left;width:100%;padding:6px 0 5px 8px;" v-if="sonProduct.child && !$util.isEmpty(sonProduct.child)">{{ sonProduct.className }}</div>
@@ -92,21 +95,36 @@
         classId:0,
         classId:0,
         searchName:'',
         searchName:'',
         modifyName:'',
         modifyName:'',
-        couldLessCost: false
+        couldLessCost: false,
+        modifyList:[],
+        historyPriceList:[]
       };
       };
     },
     },
     mounted () {
     mounted () {
+        this.historyPriceList=[]
         this.show()
         this.show()
-
         this.$service.itemClass.allClass().then((res) => {
         this.$service.itemClass.allClass().then((res) => {
 			this.itemClassList = res;
 			this.itemClassList = res;
 		})
 		})
+        this.getModifyList()
     },
     },
     methods: {
     methods: {
+        getChagnePrice(info){
+            this.$service.modify.getModifyItem({id:info.id}).then(res=>{
+                this.historyPriceList = res.list
+                this.show()
+                this.$message.success('导入成功')
+            })
+        },
+        getModifyList(){
+            this.$service.modify.list().then((res) => {
+			    this.modifyList = res.list
+		    })
+        },
         confirmChange(){
         confirmChange(){
             let that = this
             let that = this
             if (this.$util.isEmpty(this.allProdct)) {
             if (this.$util.isEmpty(this.allProdct)) {
-                this.$msg('没有修改')
+                this.$message.error('没有修改')
                 return false
                 return false
             }
             }
             let hasLessCostPrice = false
             let hasLessCostPrice = false
@@ -116,7 +134,7 @@
                     item.child.forEach((onIt,index,info)=>{
                     item.child.forEach((onIt,index,info)=>{
                         onIt.forEach((it,ii,inData)=>{
                         onIt.forEach((it,ii,inData)=>{
                             if(it.showPrice && Number(it.showPrice)>0){
                             if(it.showPrice && Number(it.showPrice)>0){
-                                data.push({id:it.id,price:it.showPrice,skPrice:it.showPrice,hjPrice:it.showPrice})
+                                data.push({id:it.id,price:it.showPrice,skPrice:it.showPrice,hjPrice:it.showPrice,name:it.name,cover:it.shortCover})
                                 if(Number(it.cost)>Number(it.showPrice)){
                                 if(Number(it.cost)>Number(it.showPrice)){
                                     hasLessCostPrice = true
                                     hasLessCostPrice = true
                                 }
                                 }
@@ -138,23 +156,29 @@
                     this.modifyName = ''
                     this.modifyName = ''
                     this.$message.success('修改成功')
                     this.$message.success('修改成功')
                     this.show()
                     this.show()
+                    this.getModifyList()
+                    this.historyPriceList=[]
 
 
                 })
                 })
             })
             })
         },
         },
         searchFocus(){
         searchFocus(){
             this.searchName = ''
             this.searchName = ''
+            this.historyPriceList=[]
             this.show()
             this.show()
         },
         },
         toSearch(){
         toSearch(){
+            this.historyPriceList=[]
             this.show()
             this.show()
         },
         },
         changeRequest(e){
         changeRequest(e){
+            this.historyPriceList=[]
             this.requestType = e
             this.requestType = e
             this.show()
             this.show()
         },
         },
 		getItemClass(e){
 		getItemClass(e){
 			this.classId = e
 			this.classId = e
+            this.historyPriceList=[]
             this.show()
             this.show()
 		},
 		},
         show(){
         show(){
@@ -165,9 +189,17 @@
                         if (item.child && !this.$util.isEmpty(item.child)) {
                         if (item.child && !this.$util.isEmpty(item.child)) {
 
 
                                 item.child.forEach((single,ix,array)=>{
                                 item.child.forEach((single,ix,array)=>{
-                                    array[ix].showPrice=''
-                                    array[ix].showSkPrice=''
-                                    array[ix].showHjPrice=''
+                                    let currentId = single.id
+                                    if(this.historyPriceList[currentId]){
+                                        let currentInfo = this.historyPriceList[currentId]
+                                        array[ix].showPrice=currentInfo.price ?parseFloat(currentInfo.price):0
+                                        array[ix].showSkPrice=currentInfo.skPrice?parseFloat(currentInfo.skPrice):0
+                                        array[ix].showHjPrice=currentInfo.hjPrice?parseFloat(currentInfo.hjPrice):0
+                                    }else{
+                                        array[ix].showPrice=''
+                                        array[ix].showSkPrice=''
+                                        array[ix].showHjPrice=''
+                                    }
                                 })
                                 })