shish 2 년 전
부모
커밋
92e16b5761
1개의 변경된 파일78개의 추가작업 그리고 40개의 파일을 삭제
  1. 78 40
      ghs/src/views/order/add.vue

+ 78 - 40
ghs/src/views/order/add.vue

@@ -1,5 +1,5 @@
 <template>
-  <div v-if="globalCustomId == 0" style="text-align:center;">
+  <div v-if="form.customId == 0" style="text-align:center;">
     <el-select @change="searchSelectCustom" v-model="selectCustomName" filterable remote reserve-keyword placeholder="搜索客户,光标插入 Ctrl + C" clearable ref="customref"
 				:remote-method="searchCustomInfo" :loading="loading" style="width:500px;margin-left:20px;" size="big">
     				<el-option v-for="item in customInfoList" :key="item.id" :label="`${item.name}`" :value="item"></el-option>
@@ -8,7 +8,7 @@
   <div class="app-list-content" v-else>
     <div class="left_box">
       <p class="tor">
-        <span style="font-weight:bold;color:black;">客户:{{globalCustomName}}</span>
+        <span style="font-weight:bold;color:black;">客户:{{form.customName}}</span>
         <span>全屏:F11</span>
         <span>提交:F9</span>
         <span>改价:F8</span>
@@ -79,10 +79,10 @@
     </el-dialog>
 
     <el-dialog title="确认提交" v-if="showCommitPop" :visible.sync="showCommitPop" width="573px" center>
-      <div class="">
+      <div>
         <div class="accounts-list">
           客户
-          <div class="accounts-center">{{globalCustomName}}</div>
+          <div class="accounts-center">{{form.customName}}</div>
         </div>
 
         <div class="accounts-list" v-if="currentShop.pfLevel && currentShop.pfLevel == 1">
@@ -183,8 +183,15 @@
         </div>
         <p style="text-align: center;color: #999999;">按Tab切到下一个,按空格选中</p>
       </div>
+      <div style="text-align:center;margin-top:10px;font-size:16px;" v-if="!$util.isEmpty(diffList)">
+        <div style="font-size:16px;margin-bottom:10px;color:red;font-weight:bold;">
+          以下花材,开单价和系统售价不一样,确认要提交吗? <el-button type="primary" @click="diffPriceConfirm" size="mini">确认</el-button>
+        </div>
+        <div v-for="(item, index) in diffList" :key="index" style="color:blue;margin-bottom:4px;">
+            {{ item.name }} 系统售价¥{{ item.price }} 你开价<span style="color:red;font-weight:bold;">¥{{ item.kdPrice }}</span>
+        </div>
+      </div>
     </el-dialog>
-
   </div>
 </template>
 <script>
@@ -210,6 +217,7 @@ export default {
         sendTimeWant: "",
         sendCost: "",
         customId: "",
+        customName:'',
         packCost:"",
         product: "",
         remark:"",
@@ -241,14 +249,13 @@ export default {
       kdStaffVal:'www',
       freight:'',//运费
       remark:'',//备注
-      printSelectList:'',
-      orderMsg:'',
       number: 0,
       customInfoList:[],
       loading: false,
       selectCustomName:'',
       t:null,
-      currentShop:{default:0,pfLevel:0}
+      currentShop:{default:0,pfLevel:0},
+      diffList:[]
     };
   },
 	mixins: [productMins],
@@ -287,7 +294,7 @@ export default {
 
   },
   mounted() {
-    if(this.globalCustomId == 0){
+    if(this.form.customId == 0){
       this.$nextTick(() => {
         this.$refs.customref.focus()
       })
@@ -350,7 +357,6 @@ export default {
         }
       }
       if( e && e.key=='F9' ){
-        that.orderMsg = '';
         if(that.$util.isEmpty(that.selectList)){
           that.$message({message: '请选择花材',type: 'warning'});
           return;
@@ -361,11 +367,11 @@ export default {
         that.showCommitPop = true
       }
     }
-
+    //门店信息
     this.$service.common.shopInfo().then(res => {
         that.currentShop = res.shopInfo
         let currentStaff = res.staff
-
+        //获取开单人
         that.$service.shopAdmin.getAllStaff().then(res => {
           that.staffList = res.list
           if(!that.$util.isEmpty(that.staffList)){
@@ -377,9 +383,7 @@ export default {
             }
           }
         })
-
 		})
-
   },
   methods: {
     changeKdStaff(info){
@@ -396,15 +400,15 @@ export default {
       }
     },
     comeBack(){
-      this.globalCustomId = 0
-      this.globalCustomName = ''
+      this.form.customId = 0
+      this.form.customName = ''
       this.$nextTick(() => {
         this.$refs.customref.focus()
       })
     },
     searchSelectCustom(e){
-      this.globalCustomId = e.id
-      this.globalCustomName = e.name
+      this.form.customId = e.id
+      this.form.customName = e.name
       this.selectJobId = e.id
       this.getFromStorage()
 		  this.$nextTick(()=>{
@@ -441,33 +445,67 @@ export default {
       }
       return todaty
     },
+    diffPriceConfirm(){
+      this.form.dealPrice = 1
+      this.createOrder()
+    },
     createOrder(){
+      let that = this
+      if(this.form.customId == 0){
+        this.$message({message: '请选择客户',type: 'warning'})
+        return false
+      }
+
+      let formData = this.form;
       const product = this.selectList.map(ele => {
-        return { productId: ele.id, bigNum: ele.big, smallNum: ele.small };
+        return { productId: ele.id, bigNum: ele.bigCount, smallNum: 0,itemId:ele.itemId,price:ele.userPrice };
       });
-      let parameter = {
-        customId:this.globalCustomId,
-        getType:this.type=='自提'?1:2,
-        sendCost:this.freight,
-        product:JSON.stringify(product),
-        remark:this.remark,
-        clearType:this.payType=='欠款'?1:2,
-        modifyPrice: this.modifyPrice,
-      }
-      this.$service.order.orderCreate(parameter).then(res => {
-        this.orderMsg = res;
-        this.printSelectList = this.selectList;
-        this.$nextTick(()=>{
-          this.selectList = [];
-          this.showCommitPop = false;
-          this.escFun();
+      formData.product = JSON.stringify(product)
+      if(Number(this.modifyPrice) <= 0){
+        this.$message({message: '收款金额必须大于0',type: 'warning'})
+        return false
+      }
+      let book = 0
+      let params = {...formData,modifyPrice: this.modifyPrice,newVersion:1,book:book};
+
+      if(book == 1){
+        if(this.form.hasPay != 2){
+          this.$message({message: '预订单只能选择赊账',type: 'warning'})
+          return false
+        }
+        if(Number(this.form.sendCost)>0){
+          this.$message({message: '预订单不能填写运费',type: 'warning'})
+          return false
+        }
+      }
+
+      let name = '确认提交'
+      if(this.form.hasPay == 1){
+        name = '确认线下付款?'
+      }else if(this.form.hasPay == 2){
+        name = '确认赊账?'
+      }else{
+        name = '确认提交'
+      }
+      this.$confirm(name, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => {
+
+        that.$service.order.orderCreate(params).then(data => {
+          if(data.respondType && data.respondType == 'priceError'){
+            that.diffList = data.diff ? data.diff : []
+            that.$message({message: '请确认修改的价格',type: 'warning'})
+          }else{
+            that.$nextTick(()=>{
+              that.selectList = [];
+              that.diffList = []
+              that.removeFromSaveDirect()
+              that.showCommitPop = false;
+              that.escFun();
+            })
+          }
         })
-        this.printOrder();
-      });
-    },
-    printOrder() {
 
-    },
+      })
+    },    
     clearSeachVal(){
       this.searchVal = ''
       this.getItemList = []