chenrui преди 2 години
родител
ревизия
538615467d

+ 9 - 0
src/api/product.js

@@ -76,3 +76,12 @@ export const productExport = params => {
     responseType: 'blob'
     responseType: 'blob'
   })
   })
 }
 }
+
+// 自定义报价
+export const settingPrice = params => {
+  return axios({
+    url: '/product/settingPrice',
+    data: params,
+    method: 'post'
+  })
+}

+ 25 - 14
src/views/productManagement/newProduct/detail.vue

@@ -26,39 +26,39 @@
             <a-descriptions-item label="省级经销商:" :span="2">
             <a-descriptions-item label="省级经销商:" :span="2">
               <a-row :gutter="16">
               <a-row :gutter="16">
                 <a-col class="gutter-row" :span="6">
                 <a-col class="gutter-row" :span="6">
-                  市场价:--
+                  市场价:{{ detailsData&&(detailsData.cityPrice || detailsData.cityPrice==0)?toThousands(detailsData.cityPrice):'--' }}
                 </a-col>
                 </a-col>
-                <a-col class="gutter-row" :span="6">
-                  特约价:--
+                <a-col class="gutter-row" :span="6" v-if="specialPriceObj&&specialPriceObj.isShowSpecialPrice&&specialPriceObj.isShowSpecialPrice==1">
+                  特约价:{{ specialPriceObj.specialPrice==0?toThousands(specialPriceObj.specialPrice):'--' }}
                 </a-col>
                 </a-col>
                 <a-col class="gutter-row" :span="6">
                 <a-col class="gutter-row" :span="6">
-                  终端价:--
+                  终端价:{{ detailsData&&(detailsData.terminalPrice || detailsData.terminalPrice==0)?toThousands(detailsData.terminalPrice):'--' }}
                 </a-col>
                 </a-col>
                 <a-col class="gutter-row" :span="6">
                 <a-col class="gutter-row" :span="6">
-                  车主价:--
+                  车主价:{{ detailsData&&(detailsData.carOwnersPrice || detailsData.carOwnersPrice==0)?toThousands(detailsData.carOwnersPrice):'--' }}
                 </a-col>
                 </a-col>
               </a-row>
               </a-row>
             </a-descriptions-item>
             </a-descriptions-item>
             <a-descriptions-item label="市级经销商:" :span="2">
             <a-descriptions-item label="市级经销商:" :span="2">
               <a-row :gutter="16">
               <a-row :gutter="16">
-                <a-col class="gutter-row" :span="6">
-                  特约价:--
+                <a-col class="gutter-row" :span="6" v-if="specialPriceObj&&specialPriceObj.isShowSpecialPrice&&specialPriceObj.isShowSpecialPrice==1">
+                  特约价:{{ specialPriceObj.specialPrice==0?toThousands(specialPriceObj.specialPrice):'--' }}
                 </a-col>
                 </a-col>
                 <a-col class="gutter-row" :span="6">
                 <a-col class="gutter-row" :span="6">
-                  终端价:--
+                  终端价:{{ detailsData&&(detailsData.terminalPrice || detailsData.terminalPrice==0)?toThousands(detailsData.terminalPrice):'--' }}
                 </a-col>
                 </a-col>
                 <a-col class="gutter-row" :span="6">
                 <a-col class="gutter-row" :span="6">
-                  车主价:--
+                  车主价:{{ detailsData&&(detailsData.carOwnersPrice || detailsData.carOwnersPrice==0)?toThousands(detailsData.carOwnersPrice):'--' }}
                 </a-col>
                 </a-col>
               </a-row>
               </a-row>
             </a-descriptions-item>
             </a-descriptions-item>
-            <a-descriptions-item label="特约经销商:" :span="2">
+            <a-descriptions-item label="特约经销商:" :span="2" v-if="specialPriceObj && specialPriceObj.dealerLevel == 'SPECIAL'">
               <a-row :gutter="16">
               <a-row :gutter="16">
                 <a-col class="gutter-row" :span="6">
                 <a-col class="gutter-row" :span="6">
-                  终端价:--
+                  终端价:{{ detailsData&&(detailsData.terminalPrice || detailsData.terminalPrice==0)?toThousands(detailsData.terminalPrice):'--' }}
                 </a-col>
                 </a-col>
                 <a-col class="gutter-row" :span="6">
                 <a-col class="gutter-row" :span="6">
-                  车主价:--
+                  车主价:{{ detailsData&&(detailsData.carOwnersPrice || detailsData.carOwnersPrice==0)?toThousands(detailsData.carOwnersPrice):'--' }}
                 </a-col>
                 </a-col>
               </a-row>
               </a-row>
             </a-descriptions-item>
             </a-descriptions-item>
@@ -91,7 +91,7 @@
 <script>
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { commonMixin } from '@/utils/mixin'
 import imgZoom from 'vue2.0-zoom'
 import imgZoom from 'vue2.0-zoom'
-import { productDetail } from '@/api/product.js'
+import { productDetail, getCurrentDealer } from '@/api/product.js'
 export default {
 export default {
   name: 'ProductInfoDetail',
   name: 'ProductInfoDetail',
   components: { imgZoom },
   components: { imgZoom },
@@ -116,7 +116,8 @@ export default {
         maskHeight: 80,
         maskHeight: 80,
         maskColor: 'red',
         maskColor: 'red',
         maskOpacity: 0.2
         maskOpacity: 0.2
-      }
+      },
+      specialPriceObj: null
     }
     }
   },
   },
   methods: {
   methods: {
@@ -131,6 +132,14 @@ export default {
         }
         }
       })
       })
     },
     },
+    // 获取特约价
+    getSpecialPriceInfo () {
+      getCurrentDealer().then(res => {
+        if (res.status == 200) {
+          this.specialPriceObj = res.data
+        }
+      })
+    },
     // 返回
     // 返回
     goBack () {
     goBack () {
       this.$router.push({ path: this.prevPageInfo && this.prevPageInfo.path })
       this.$router.push({ path: this.prevPageInfo && this.prevPageInfo.path })
@@ -140,11 +149,13 @@ export default {
     if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
     if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
       this.itemId = this.$route.params.sn
       this.itemId = this.$route.params.sn
       this.getDetail()
       this.getDetail()
+      this.getSpecialPriceInfo()
     }
     }
   },
   },
   activated () {
   activated () {
     this.itemId = this.$route.params.sn
     this.itemId = this.$route.params.sn
     this.getDetail()
     this.getDetail()
+    this.getSpecialPriceInfo()
   },
   },
   beforeRouteEnter (to, from, next) {
   beforeRouteEnter (to, from, next) {
     next(vm => {
     next(vm => {

+ 72 - 149
src/views/productManagement/productInfoJg/editPriceModal.vue

@@ -6,51 +6,37 @@
     :maskClosable="false"
     :maskClosable="false"
     title="自定义报价"
     title="自定义报价"
     v-model="isShow"
     v-model="isShow"
-    @cancel="isShow=false"
+    @cancel="isShow = false"
     :width="800">
     :width="800">
     <a-spin :spinning="spinning" tip="Loading...">
     <a-spin :spinning="spinning" tip="Loading...">
-      <!-- 表单 -->
-      <div v-if="!isView">
-        <a-form-model
-          id="editPrice-form"
-          ref="ruleForm"
-          :model="form"
-          :rules="rules"
-          :label-col="formItemLayout.labelCol"
-          :wrapper-col="formItemLayout.wrapperCol"
-        >
-          <a-form-model-item label="产品编码" prop="terminalPrice">
-            <div>{{ form.terminalPrice }}</div>
-          </a-form-model-item>
-          <a-form-model-item label="产品名称" prop="terminalPrice">
-            <div>{{ form.terminalPrice }}</div>
-          </a-form-model-item>
-          <a-form-model-item label="终端建议价" prop="terminalPrice">
-            <div>{{ form.terminalPrice }}</div>
-          </a-form-model-item>
-          <a-form-model-item label="自定义终端价">
-            <a-input
-              id="editPrice-idCard"
-              :maxLength="18"
-              v-model.trim="form.terminalPriceZdy"
-              placeholder="请输入自定义终端价"
-              allowClear />
-          </a-form-model-item>
-          <a-form-model-item label="车主建议价" prop="terminalPrice">
-            <div>{{ form.carOwnersPrice }}</div>
-          </a-form-model-item>
-          <a-form-model-item label="自定义车主价" prop="mobile">
-            <a-input
-              id="editPrice-mobile"
-              v-model.trim="form.mobile"
-              placeholder="请输入自定义车主价"
-              allowClear />
-          </a-form-model-item>
-        </a-form-model>
-        <div class="btn-cont">
-          <a-button type="primary" size="large" id="editPrice-btn-submit" @click="handleSubmit">保存</a-button>
-          <a-button id="editPrice-btn-back" size="large" @click="isShow = false" style="margin-left: 15px;">取消</a-button>
-        </div>
+      <a-form-model
+        id="editPrice-form"
+        ref="ruleForm"
+        :model="form"
+        :label-col="formItemLayout.labelCol"
+        :wrapper-col="formItemLayout.wrapperCol">
+        <a-form-model-item label="产品编码" prop="code">
+          <div>{{ form.code }}</div>
+        </a-form-model-item>
+        <a-form-model-item label="产品名称" prop="name">
+          <div>{{ form.name }}</div>
+        </a-form-model-item>
+        <a-form-model-item label="终端价" prop="terminalPrice">
+          <div>{{ form.terminalPrice?form.terminalPrice : '--' }}</div>
+        </a-form-model-item>
+        <a-form-model-item label="自定义终端价" prop="dealerProductPrice.terminalPrice">
+          <a-input id="editPrice-terminalPriceZdy" :maxLength="18" v-model.trim="form.dealerProductPrice.terminalPrice" placeholder="请输入自定义终端价" allowClear />
+        </a-form-model-item>
+        <a-form-model-item label="车主价" prop="carOwnersPrice">
+          <div>{{ form.carOwnersPrice?form.carOwnersPrice:'--' }}</div>
+        </a-form-model-item>
+        <a-form-model-item label="自定义车主价" prop="dealerProductPrice.carOwnersPrice">
+          <a-input id="editPrice-carOwnersPriceZdy" v-model.trim="form.dealerProductPrice.carOwnersPrice" placeholder="请输入自定义车主价" allowClear />
+        </a-form-model-item>
+      </a-form-model>
+      <div class="btn-cont">
+        <a-button type="primary" size="large" id="editPrice-btn-submit" @click="handleSubmit">保存</a-button>
+        <a-button id="editPrice-btn-back" size="large" @click="isShow = false" style="margin-left: 15px;">取消</a-button>
       </div>
       </div>
     </a-spin>
     </a-spin>
   </a-modal>
   </a-modal>
@@ -58,27 +44,19 @@
 
 
 <script>
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { commonMixin } from '@/utils/mixin'
-import { employeeSave, employeeDetail } from '@/api/salesman'
-import moment from 'moment'
+import { productDetail, settingPrice } from '@/api/product.js'
 export default {
 export default {
   name: 'EditPriceModal',
   name: 'EditPriceModal',
   mixins: [commonMixin],
   mixins: [commonMixin],
   props: {
   props: {
-    openModal: { //  弹框显示状态
+    openModal: {
+      //  弹框显示状态
       type: Boolean,
       type: Boolean,
       default: false
       default: false
     },
     },
     itemId: {
     itemId: {
       type: [Number, String],
       type: [Number, String],
       default: ''
       default: ''
-    },
-    modalTitle: {
-      type: String,
-      default: ''
-    },
-    isState: { //  是否显示状态
-      type: Boolean,
-      default: true
     }
     }
   },
   },
   data () {
   data () {
@@ -89,98 +67,57 @@ export default {
         labelCol: { span: 6 },
         labelCol: { span: 6 },
         wrapperCol: { span: 16 }
         wrapperCol: { span: 16 }
       },
       },
-      isView: false, // 是否查看详情
       form: {
       form: {
+        code: '',
+        name: '',
         terminalPrice: '', // 终端建议价
         terminalPrice: '', // 终端建议价
-        terminalPriceZdy: '', //  自定义终端价
         carOwnersPrice: '', //  车主建议价
         carOwnersPrice: '', //  车主建议价
-        carOwnersPriceZdy: '' // 自定义车主价
-      },
-      rules: {
-        name: [
-          { required: true, message: '请输入姓名', trigger: 'blur' }, { pattern: '^[^<|>]{1,30}$', message: '请输入不含<或>的字符,最多30个字符' }
-        ],
-        mobile: [
-          { required: true, message: '请输入手机号码', trigger: 'blur' }, { pattern: /^\d{11}$/, message: '请输入正确的手机号码!' }
-        ],
-        entryDate: [
-          { required: true, message: '请选择入职时间', trigger: 'change' }
-
-        ],
-        sex: [
-          { required: true, message: '请选择性别', trigger: 'change' }
-        ],
-        enableFlag: [
-          { required: true, message: '请选择状态', trigger: 'change' }
-        ]
+        dealerProductPrice: {
+          terminalPrice: '',
+          carOwnersPrice: ''
+        }
       }
       }
     }
     }
   },
   },
   methods: {
   methods: {
-    //  时间  change
-    dateChange (date) {
-      this.queryParam.beginDate = date[0]
-      this.queryParam.endDate = date[1]
-    },
-    // 不可选日期
-    disabledDate (current) {
-      return current && current > moment().endOf('day')
-    },
-    filterEmpty () {
-      let str = this.form.supplierName
-      str = str.replace(/\ +/g, '')
-      str = str.replace(/[ ]/g, '')
-      str = str.replace(/[\r\n]/g, '')
-      this.form.supplierName = str
-    },
     // 详情
     // 详情
     getDetail () {
     getDetail () {
-      employeeDetail({ id: this.itemId }).then(res => {
+      const _this = this
+      productDetail({ sn: this.itemId }).then(res => {
         if (res.status == 200) {
         if (res.status == 200) {
-          this.form = Object.assign(this.form, res.data)
-          this.form.sex = Number(this.form.sex)
-          this.form.enableFlag = Number(this.form.enableFlag)
+          const objInfo = {}
+          objInfo.code = res.data.code
+          objInfo.name = res.data.name
+          objInfo.terminalPrice = (res.data.terminalPrice || res.data.terminalPrice == 0) ? _this.toThousands(res.data.terminalPrice) : ''
+          objInfo.carOwnersPrice = (res.data.carOwnersPrice || res.data.carOwnersPrice == 0) ? _this.toThousands(res.data.carOwnersPrice) : ''
+          objInfo.dealerProductPrice = {}
+          Object.assign(objInfo.dealerProductPrice, { terminalPrice: res.data.dealerProductPrice && res.data.dealerProductPrice.terminalPrice || '', carOwnersPrice: res.data.dealerProductPrice && res.data.dealerProductPrice.carOwnersPrice || '' })
+          _this.form = objInfo
         }
         }
       })
       })
+    },
+    cancel () {
+
     },
     },
     //  保存
     //  保存
     handleSubmit (e) {
     handleSubmit (e) {
       e.preventDefault()
       e.preventDefault()
       const _this = this
       const _this = this
-      this.$refs.ruleForm.validate(valid => {
-        if (valid) {
-          const form = _this.form
-          form.entryDate = moment(form.entryDate).format('YYYY-MM-DD')
-          form.id = this.itemId ? this.itemId : null
-          _this.spinning = true
-          employeeSave(form).then(res => {
-            if (res.status == 200) {
-              _this.$message.success(res.message)
-              _this.$emit('ok')
-              _this.isShow = false
-              _this.spinning = false
-            } else {
-              _this.spinning = false
-            }
-          })
+      _this.spinning = true
+      const ajaxData = {}
+      ajaxData.productSn = this.itemId
+      ajaxData.dealerProductPrice = {}
+      Object.assign(ajaxData.dealerProductPrice, this.form.dealerProductPrice)
+      settingPrice(ajaxData).then(res => {
+        if (res.status == 200) {
+          _this.$message.success(res.message)
+          _this.$emit('ok')
+          _this.isShow = false
+          _this.spinning = false
         } else {
         } else {
-          console.log('error submit!!')
-          return false
+          _this.spinning = false
         }
         }
       })
       })
-    },
-    cancel () {
-      this.form = {
-        name: '', // 姓名
-        mobile: '', //  联系电话
-        enableFlag: 1, //  启禁用
-        sex: 1, // 性别
-        idCard: '', // 身份证号
-        entryDate: undefined // 入职时间
-      }
-      // this.$nextTick(() => {
-      //   this.$refs.ruleForm.resetFields()
-      // })
     }
     }
   },
   },
   watch: {
   watch: {
@@ -193,36 +130,22 @@ export default {
     isShow (newValue, oldValue) {
     isShow (newValue, oldValue) {
       if (!newValue) {
       if (!newValue) {
         this.$emit('close')
         this.$emit('close')
-      }
-    },
-    itemId (newValue, oldValue) {
-      if (this.isShow && newValue) {
+      } else {
         this.getDetail()
         this.getDetail()
       }
       }
-    },
-    modalTitle (newValue, oldValue) {
-      console.log(newValue)
-      if (newValue) {
-        if (newValue == '编辑' || newValue == '新增') {
-          this.isView = false
-        } else {
-          this.isView = true
-        }
-      }
     }
     }
-
   }
   }
 }
 }
 </script>
 </script>
 
 
 <style lang="less">
 <style lang="less">
-  .editPrice-modal{
-    .ant-modal-body {
-      padding: 40px 40px 24px;
-    }
-    .btn-cont {
-      text-align: center;
-      margin: 35px 0 10px;
-    }
+.editPrice-modal {
+  .ant-modal-body {
+    padding: 40px 40px 24px;
+  }
+  .btn-cont {
+    text-align: center;
+    margin: 35px 0 10px;
   }
   }
+}
 </style>
 </style>

+ 13 - 13
src/views/productManagement/productInfoJg/list.vue

@@ -63,10 +63,10 @@
         </a-col>
         </a-col>
         <a-col class="gutter-row" :span="12">
         <a-col class="gutter-row" :span="12">
           <div class="setTableList">
           <div class="setTableList">
-            <a-checkbox v-modal="isTerminalPrice" @change="changeTerminalPrice">
+            <a-checkbox v-model="isTerminalPrice" @change="changeTerminalPrice">
               自定义终端价
               自定义终端价
             </a-checkbox>
             </a-checkbox>
-            <a-checkbox v-modal="isCarOwnersPrice" @change="changeCarOwnersPrice">
+            <a-checkbox v-model="isCarOwnersPrice" @change="changeCarOwnersPrice">
               自定义车主价
               自定义车主价
             </a-checkbox>
             </a-checkbox>
           </div>
           </div>
@@ -161,7 +161,7 @@
       </template>
       </template>
     </s-table>
     </s-table>
     <!-- 自定义报价弹窗 -->
     <!-- 自定义报价弹窗 -->
-    <edit-price-modal :openModal="openEditPriceModal" ref="editPrice" @close="openEditPriceModal=false" />
+    <editPriceModal :openModal="openEditPriceModal" :itemId="itemId" @ok="searchForm" @close="openEditPriceModal=false"></editPriceModal>
   </a-card>
   </a-card>
 </template>
 </template>
 
 
@@ -175,7 +175,7 @@ import { STable, VSelect } from '@/components'
 import editPriceModal from './editPriceModal.vue'
 import editPriceModal from './editPriceModal.vue'
 export default {
 export default {
   name: 'ProductJgList',
   name: 'ProductJgList',
-  components: { STable, VSelect, ProductType, ProductBrand, editPriceModal },
+  components: { STable, VSelect, ProductType, ProductBrand,editPriceModal },
   mixins: [commonMixin],
   mixins: [commonMixin],
   data () {
   data () {
     return {
     return {
@@ -307,12 +307,12 @@ export default {
           if (res.data.isShowSpecialPrice && res.data.isShowSpecialPrice == '1') { //  是否展示特约价
           if (res.data.isShowSpecialPrice && res.data.isShowSpecialPrice == '1') { //  是否展示特约价
             this.columns.push({ title: '特约价', dataIndex: 'specialPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
             this.columns.push({ title: '特约价', dataIndex: 'specialPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
           }
           }
-          if (_this.terminalPrice) {
-            cArr.splice(1, 0, { title: '自定义终端价', dataIndex: 'price1', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+          if (_this.isTerminalPrice) {
+            cArr.splice(1, 0, { title: '自定义终端价', dataIndex: 'dealerProductPrice.terminalPrice', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
           }
           }
           if (_this.isCarOwnersPrice) {
           if (_this.isCarOwnersPrice) {
             const pos = _this.terminalPrice ? 3 : 2
             const pos = _this.terminalPrice ? 3 : 2
-            cArr.splice(pos, 0, { title: '自定义车主价', dataIndex: 'price2', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+            cArr.splice(pos, 0, { title: '自定义车主价', dataIndex: 'dealerProductPrice.carOwnersPrice', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
           }
           }
           this.columns = [...this.columns, ...cArr]
           this.columns = [...this.columns, ...cArr]
         }
         }
@@ -404,12 +404,12 @@ export default {
       this.tableHeight = window.innerHeight - tableSearchH - 235
       this.tableHeight = window.innerHeight - tableSearchH - 235
     },
     },
     // 打开自定义报价弹窗
     // 打开自定义报价弹窗
-    handleEditPrice () {
-      // const oldPrice = {
-
-      // }
-      // this.$refs.editPrice.setOldPrice(oldPrice)
-      this.openEditPriceModal = true
+    handleEditPrice (row) {
+      this.itemId = row.productSn;
+      let _this=this
+      this.$nextTick(()=>{
+         _this.openEditPriceModal = true
+      })
     }
     }
   },
   },
   watch: {
   watch: {