Browse Source

价格申报单价格调整提醒

黄梓星 1 year ago
parent
commit
5ac52b1b94

+ 28 - 7
src/views/purchase/apply/add/index.vue

@@ -219,14 +219,35 @@
               );
               // 深拷贝一下参数对象
               let param = JSON.parse(JSON.stringify(this.params))
-              console.log('深拷贝对象',param);
+              // console.log('深拷贝对象',param);
               param.priceApplyItems = list
-              const {msg, code} = await SAVE(param);
-              if (code === 200) {
-                this.onHide();
-                this.$emit("success");
-                this.$notify.success(msg);
-                this.delDemandItemList = []
+              param.priceApplyItems.forEach((item, index) => {
+                item.$index = index
+              });
+              let tishi = param.priceApplyItems.filter(item => {return (item.priceDiffer && item.priceDiffer !== 0)})
+              // console.log('筛选', tishi)
+              let tishiMsg = tishi.map(item => {
+                return `第${item.$index+1}行为价格调整`
+              })
+              // console.log(tishiMsg)
+              if(tishiMsg.length !== 0) {
+                this.$modal.confirm(tishiMsg+ '请核对后再次提交').then(async () =>{
+                  const {msg, code} = await SAVE(param);
+                  if (code === 200) {
+                    this.onHide();
+                    this.$emit("success");
+                    this.$notify.success(msg);
+                    this.delDemandItemList = []
+                  }
+                }).catch(() => {});
+              } else {
+                  const {msg, code} = await SAVE(param);
+                  if (code === 200) {
+                    this.onHide();
+                    this.$emit("success");
+                    this.$notify.success(msg);
+                    this.delDemandItemList = []
+                  }
               }
             } catch (err) {
               // catch

+ 28 - 7
src/views/purchase/apply/copy/index.vue

@@ -265,14 +265,35 @@
               );
               // 深拷贝一下参数对象
               let param = JSON.parse(JSON.stringify(this.params))
-              console.log('深拷贝对象',param);
+              // console.log('深拷贝对象',param);
               param.priceApplyItems = list
-              const {msg, code} = await SAVE(param);
-              if (code === 200) {
-                this.onHide();
-                this.$emit("success");
-                this.$notify.success(msg);
-                this.delDemandItemList = []
+              param.priceApplyItems.forEach((item, index) => {
+                item.$index = index
+              });
+              let tishi = param.priceApplyItems.filter(item => {return (item.priceDiffer && item.priceDiffer !== 0)})
+              console.log('筛选', tishi)
+              let tishiMsg = tishi.map(item => {
+                return `第${item.$index+1}行为价格调整`
+              })
+              console.log(tishiMsg)
+              if(tishiMsg.length !== 0) {
+                this.$modal.confirm(tishiMsg+ '请核对后再次提交').then(async () =>{
+                  const {msg, code} = await SAVE(param);
+                  if (code === 200) {
+                    this.onHide();
+                    this.$emit("success");
+                    this.$notify.success(msg);
+                    this.delDemandItemList = []
+                  }
+                }).catch(() => {});
+              } else {
+                  const {msg, code} = await SAVE(param);
+                  if (code === 200) {
+                    this.onHide();
+                    this.$emit("success");
+                    this.$notify.success(msg);
+                    this.delDemandItemList = []
+                  }
               }
             } catch (err) {
               // catch

+ 25 - 7
src/views/purchase/apply/edit/index.vue

@@ -284,14 +284,32 @@
               );
               // 深拷贝一下参数对象
               let param = JSON.parse(JSON.stringify(this.params))
-              console.log('深拷贝对象',param);
+              // console.log('深拷贝对象',param);
               param.priceApplyItems = list
-              const {msg, code} = await SAVE(param);
-              if (code === 200) {
-                this.onHide();
-                this.$emit("success");
-                this.$notify.success(msg);
-                this.delDemandItemList = []
+              let tishi = param.priceApplyItems.filter(item => {return (item.priceDiffer && item.priceDiffer !== 0)})
+              console.log('筛选', tishi)
+              let tishiMsg = tishi.map(item => {
+                return `第${item.$index+1}行为价格调整`
+              })
+              console.log(tishiMsg)
+              if(tishiMsg.length !== 0) {
+                this.$modal.confirm(tishiMsg+ '请核对后再次提交').then(async () =>{
+                  const {msg, code} = await SAVE(param);
+                  if (code === 200) {
+                    this.onHide();
+                    this.$emit("success");
+                    this.$notify.success(msg);
+                    this.delDemandItemList = []
+                  }
+                }).catch(() => {});
+              } else {
+                  const {msg, code} = await SAVE(param);
+                  if (code === 200) {
+                    this.onHide();
+                    this.$emit("success");
+                    this.$notify.success(msg);
+                    this.delDemandItemList = []
+                  }
               }
             } catch (err) {
               // catch