瀏覽代碼

bug 修复

lilei 4 年之前
父節點
當前提交
a1b2d99d57

+ 29 - 7
src/views/salesManagement/salesQuery/chooseCustomModal.vue

@@ -215,6 +215,7 @@ export default {
         wrapperCol: { span: 16 }
       },
       buyerSnBak: '', // 更改前客户sn备份
+      priceTypeBak: '', // 更改前客户价格类型备份
       form: {
         buyerName: '', // 客户名称
         buyerSn: undefined, // 客户sn
@@ -340,6 +341,7 @@ export default {
       if (data.shippingAddressCitySn) { this.getArea('district', data.shippingAddressCitySn) }
       this.form = Object.assign(this.form, data)
       this.buyerSnBak = this.form.buyerSn
+      this.priceTypeBak = this.form.priceType
     },
     //  获取详情
     getDetail () {
@@ -366,6 +368,8 @@ export default {
             priceType: data.priceType, //  价格类型
             settleStyleSn: data.settleStyleSn //  收款方式
           })
+          // this.buyerSnBak = this.form.buyerSn
+          // this.priceTypeBak = this.form.priceType
         } else {
           this.$message.error('获取客户信息失败')
           this.$refs.ruleForm.resetFields()
@@ -403,11 +407,29 @@ export default {
       const _this = this
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
-          // 保存客户信息
-          _this.handleSaveCust()
-          // 保存销售单
-          if (_this.form.buyerSn) {
-            _this.salesSaveFun()
+          console.log(_this.priceTypeBak, _this.form.priceType)
+          // 如果价格类型改变,提示
+          if (_this.priceTypeBak != _this.form.priceType) {
+            this.$confirm({
+              title: '提示',
+              content: '价格类型变更,确认提交吗?',
+              centered: true,
+              onOk () {
+                // 保存客户信息
+                _this.handleSaveCust()
+                // 保存销售单
+                if (_this.form.buyerSn) {
+                  _this.salesSaveFun()
+                }
+              }
+            })
+          } else {
+            // 保存客户信息
+            _this.handleSaveCust()
+            // 保存销售单
+            if (_this.form.buyerSn) {
+              _this.salesSaveFun()
+            }
           }
         } else {
           console.log('error submit!!')
@@ -425,7 +447,7 @@ export default {
           _this.$message.success(res.message)
           _this.$emit('ok', res.data)
           if (_this.form.id) {
-            _this.$emit('updateData')
+            _this.$emit('updateData', form.priceType)
           }
           _this.cancel()
         }
@@ -433,8 +455,8 @@ export default {
     },
     cancel () {
       this.opened = false
-      this.$refs.ruleForm.resetFields()
       this.$emit('cancel')
+      this.$refs.ruleForm.resetFields()
     },
     // 客户无分页列表数据
     getCustAllList () {

+ 19 - 7
src/views/salesManagement/salesQuery/edit.vue

@@ -15,7 +15,7 @@
     </a-page-header>
     <a-card size="small" :bordered="false" class="salesEdit-cont">
       <!-- 查询配件列表 -->
-      <queryPart :buyerSn="detailData&&detailData.buyerSn" :priceType="$route.params.priceType" :newLoading="isInster" @add="insterProduct"></queryPart>
+      <queryPart ref="partQuery" :buyerSn="detailData&&detailData.buyerSn" :priceType="$route.params.priceType" :newLoading="isInster" @add="insterProduct"></queryPart>
     </a-card>
     <a-card size="small" :bordered="false" class="salesEdit-cont">
       <!-- 总计 -->
@@ -136,7 +136,7 @@
       </div>
     </a-affix>
     <!-- 选择客户弹框 -->
-    <choose-custom-modal ref="custModal" :show="openModal" @updateData="getOrderDetail" @cancel="openModal=false" />
+    <choose-custom-modal ref="custModal" :show="openModal" @updateData="updateData" @cancel="openModal=false" />
   </div>
 </template>
 
@@ -238,10 +238,18 @@ export default {
         this.$refs.custModal.editCust(this.detailData)
       }, 500)
     },
+    // 更新产品列表
+    updateData (priceType) {
+      // 价格类型变更
+      if (priceType != this.$route.params.priceType) {
+        this.$router.replace({ name: 'salesEdit', params: { id: this.orderId, sn: this.salesBillSn, priceType: priceType } })
+      } else {
+        this.getOrderDetail()
+      }
+    },
     //  重置
     resetSearchForm (flag) {
       this.$refs.table.refresh(!!flag)
-      this.getOrderDetail()
     },
     // 重置列表
     resetForm () {
@@ -373,8 +381,10 @@ export default {
     //  销售单详情
     getOrderDetail () {
       salesDetail({ id: this.$route.params.id }).then(res => {
+        console.log('getOrderDetail')
         if (res.status == 200) {
           this.detailData = res.data
+          console.log(this.detailData)
         }
       })
     },
@@ -388,12 +398,14 @@ export default {
       })
     }
   },
+  mounted () {
+    this.getOrderDetail()
+    this.orderId = this.$route.params.id
+    this.salesBillSn = this.$route.params.sn
+  },
   beforeRouteEnter (to, from, next) {
     next(vm => {
-      // 获取销售单详情
-      vm.getOrderDetail()
-      vm.orderId = vm.$route.params.id
-      vm.salesBillSn = vm.$route.params.sn
+      console.log('beforeRouteEnter')
     })
   }
 }