shish 2 лет назад
Родитель
Сommit
576b5e9a15
2 измененных файлов с 178 добавлено и 50 удалено
  1. 177 49
      ghs/src/views/in/add.vue
  2. 1 1
      ghs/src/views/order/add.vue

+ 177 - 49
ghs/src/views/in/add.vue

@@ -1,7 +1,7 @@
 <template>
   <div v-if="form.ghsId == 0" style="text-align:center;margin-top:30px;">
     <span style="font-size:20px;">搜索供货商:</span>
-    <el-select @change="selectGhsFn" v-model="selectGhsName" filterable remote reserve-keyword placeholder="搜索供货商,光标插入 Ctrl + C" clearable ref="customref"
+    <el-select @change="selectGhsFn" v-model="selectGhsName" filterable remote reserve-keyword placeholder="搜索供货商,光标插入 Ctrl + C" clearable ref="ghsRef"
 				:remote-method="selectGhsInfo" :loading="loading" style="width:400px;margin-left:20px;" size="big">
     				<el-option v-for="item in customInfoList" :key="item.id" :label="`${item.name}`" :value="item"></el-option>
   				</el-select>
@@ -110,34 +110,88 @@
         </div>
         <div class="accounts-list">
           采购人
-          <el-select ref="kdStaffRef" style="width:80%" v-model="form.getStaffName" placeholder="请选择,Ctrl + /" @change="changeKdStaff">
+          <el-select ref="cgStaffRef" style="width:80%" v-model="form.cgStaffName" placeholder="请选择,Ctrl + / 选中" @change="changeCgStaff">
             <el-option v-for="item in staffList" :key="item.id" :label="item.name" :value="item"> </el-option>
           </el-select>
         </div>
         <div class="accounts-list">
           入库日期
-          <el-date-picker v-model="form.sendTimeWant" style="width: 80%" type="date" placeholder="请选择"> </el-date-picker>
+          <el-date-picker v-model="form.entryTime" style="width: 80%" type="date" placeholder="请选择"> </el-date-picker>
         </div>
-        <div class="accounts-list" v-if="type=='配送'">
-          
+        <div class="accounts-list">
+          打包
           <div class="accounts-center">
-            <el-input @input="freightInput" placeholder="请填写运费,留空免运费" v-model="freight"></el-input>
+            <el-input placeholder="请填写打包费" @input="inputFn" v-model="form.packingCharge"></el-input>
           </div>    
         </div>
         <div class="accounts-list">
-          合计金额
-          <div class="accounts-center" style="color:black;">¥{{parseFloat(finalPrice)}}</div>
+          运费支付
+          <div class="accounts-center">
+          <el-button :type="form.yfPayWay == 1?'primary':''" @keyup.enter.native="form.yfPayWay == 1" @click="changeYfPayWay(1)" size="small">寄付( Ctrl + , )</el-button>
+            <el-button :type="form.yfPayWay == 2?'primary':''" @keyup.enter.native="form.yfPayWay == 2" @click="changeYfPayWay(2)" size="small">到付( Ctrl + . )</el-button>
+          </div>
+        </div>
+        <div class="accounts-list">
+          短途运费
+          <div class="accounts-center">
+            <el-input @input="inputFn" placeholder="请填写运费,留空免运费" v-model="form.shortCharge"></el-input>
+          </div>    
         </div>
         <div class="accounts-list">
-          {{ form.hasPay == 2 ? '应收金额' : '实收金额' }}
-          <el-input style="width: 80%" v-model="modifyPrice" clearable></el-input>
+          长途运费
+          <div class="accounts-center">
+            <el-input @input="inputFn" placeholder="请填写运费,留空免运费" v-model="form.longCharge"></el-input>
+          </div>    
+        </div>
+        <div class="accounts-list">
+          提货费
+          <div class="accounts-center">
+            <el-input @input="inputFn" placeholder="请填写运费,留空免运费" v-model="form.pickCharge"></el-input>
+          </div>    
+        </div>
+        <div class="accounts-list">
+          本地运费
+          <div class="accounts-center">
+            <el-input @input="inputFn" placeholder="请填写运费,留空免运费" v-model="form.localCharge"></el-input>
+          </div>    
+        </div>
+        <div class="accounts-list">
+          总金额
+          <div class="accounts-center" style="color:black;">¥{{totalPrice}}</div>
+        </div>
+        <div class="accounts-list">
+          应付金额
+          <el-input style="width: 80%" v-model="modifyPrice" @focus="modifyPrice=''"></el-input>
+        </div>
+        <div class="accounts-list" v-if="modifyPrice > 0 && modifyPrice < finalPrice" style="font-size:25upx;margin-left:20upx;color:green;font-weight:bold;">
+          减免金额
+          <div class="accounts-center">¥{{(totalPrice - modifyPrice).toFixed(2) }}</div>
+        </div>
+        <div class="accounts-list">
+          物流费用
+          <div class="accounts-center">
+          <el-button :type="form.isCost == 1?'primary':''" @keyup.enter.native="form.isCost == 1" @click="form.isCost = 1" size="small">算成本( Ctrl + , )</el-button>
+            <el-button :type="form.isCost == 0?'primary':''" @keyup.enter.native="form.isCost == 0" @click="form.isCost = 0" size="small">不算成本( Ctrl + . )</el-button>
+          </div>
         </div>
         <div class="accounts-list">
           备注
           <div class="accounts-center">
-            <el-input type="textarea" :rows="2" placeholder="请输入内容,F8 插入光标" v-model="remark" ref="remarkRef"> </el-input>
+            <el-input type="textarea" :rows="1" placeholder="这里写备注,F8 插入光标" v-model="form.remark" ref="remarkRef"> </el-input>
           </div>
         </div>
+        <div class="accounts-list">
+          总运费
+          <div class="accounts-center" style="color:black;">¥{{totalFreight}}</div>
+        </div>
+        <div class="accounts-list">
+          总重量
+          <div class="accounts-center" style="color:black;">¥{{calcTotalWeight}}</div>
+        </div>
+        <div class="accounts-list">
+          每公斤运费
+          <div class="accounts-center" style="color:black;">¥{{perKgFreight}}</div>
+        </div>
         <div class="accounts-list">
           <span></span>
           <div class="accounts-center">
@@ -156,35 +210,31 @@ export default {
   name: 'add',
   data() {
     return {
-      form: {
-        shopId: "",
-        shopName: "",
-        receiveProvince: "",
-        receiveCity: "",
-        receiveFloor: "",
-        receiveAddress: "",
-        receiveLong: "",
-        receiveLat: "",
-        sendType: 0,
-        transType:0,
-        sendSide: "2",
-        sendDate: "",
-        sendTimeWant: "",
-        sendCost: "",
-        ghsId: "",
-        ghsName:'',
-        packCost:"",
-        product: "",
-        remark:"",
-        payWay:0,
-        needPrint:1,//订单生成时打印订单1需要2不需要
-        hasPay:0,
-        getStaffName:'',
-        getStaffId:0,
-        dealPrice:0,
-        wlName:''
-      },
       staffList:[],
+			form: {
+        ghsId:0,
+				packingCharge: "",
+				shortCharge: "",
+				longCharge: "",
+				pickCharge: "",
+				localCharge: "",
+				entryTime: "",
+				yfPayWay:1,
+				remark:"",
+				avgKgWeight:'',
+				needPrint:2,
+				fistWcPrintNum:1,
+				cgStaffId:0,
+				cgStaffName:'',
+				isCost:1
+			},
+			detailsInfo: {},
+			totalPrice:0,
+			modifyPrice:0,
+			totalFreight:0,
+			perKgFreight:0,
+			location:0,
+			wcPrintList:[],
       printAmount:1,
       checked:true,
       type:'自提',//取货方式
@@ -249,7 +299,53 @@ export default {
       let currentPrice = parseFloat(finalPrice)
       this.modifyPrice = currentPrice 
       return currentPrice
-    }
+    },
+		totalItemNum(){
+			let big = 0
+			let small = 0
+			if(!this.$util.isEmpty(this.selectList)){
+				for(const ele of this.selectList){
+					if(Number(ele.bigCount)>0){
+						big = Number(big)+Number(ele.bigCount)
+						big = big.toFixed(0)
+					}
+					if(Number(ele.smallCount)){
+						small = Number(small) + Number(ele.smallCount)
+						small = small.toFixed(0)
+					}
+				}
+			}
+			return {big:big,small:small}
+		},
+		selectAllPrice(){
+			let price = 0;
+			if (this.selectList) {
+				for (const item of this.selectList) {
+					if(Number(item.bigCount)>0){
+						price += Number(item.userPrice)*Number(item.bigCount);
+					}else{
+						price += Number(item.userPrice)*Number(item.smallCount);
+					}
+				}
+			}
+			let finalPrice = price.toFixed(2);
+			finalPrice = parseFloat(finalPrice)
+			this.modifyPrice = finalPrice
+			this.totalPrice = finalPrice
+			let newPrice = price.toFixed(2);
+			newPrice = parseFloat(newPrice)
+			return newPrice
+		},
+		calcTotalWeight(){
+			let realityWeight = 0;
+			if (this.selectList) {
+				for (const item of this.selectList) {
+					realityWeight += Number(item.weight)*Number(item.bigCount);
+				}
+			}
+			let calcWeight = realityWeight.toFixed(2);
+			return calcWeight
+		},
   },
   created() {
 
@@ -257,7 +353,7 @@ export default {
   mounted() {
     if(this.form.ghsId == 0){
       this.$nextTick(() => {
-        this.$refs.customref.focus()
+        this.$refs.ghsRef.focus()
       })
     }
     let that = this;
@@ -278,7 +374,7 @@ export default {
         }
       }
       if(e && e.key && e.key.toLowerCase() =='c' && e.ctrlKey){
-        that.$refs['customref'].focus();
+        that.$refs['ghsRef'].focus();
       }
       if(e && e.key && e.key.toLowerCase() =='b' && e.ctrlKey){
         that.comeBack()
@@ -304,7 +400,7 @@ export default {
       }
       if( e && e.key=='/' && e.ctrlKey){
         if(that.showCommitPop == true){
-          that.$refs.kdStaffRef.focus()
+          that.$refs.cgStaffRef.focus()
         }
       }
       if( e && e.key=='[' && e.ctrlKey){
@@ -369,6 +465,38 @@ export default {
 
   },
   methods: {
+		inputFn(e) {
+			let price = Number(this.selectAllPrice);
+			//打包费
+			if(Number(this.form.packingCharge) > 0){
+				price	 = Number(price) + Number(this.form.packingCharge)
+			}
+			//到付的,长途和短途运费不能算在要结账的订单金额里。寄付的则要算。
+			if(this.form.yfPayWay == 1){
+				//短途运费
+				if(Number(this.form.shortCharge) > 0){
+					price	 = Number(price) + Number(this.form.shortCharge)
+				}
+				//长途运费
+				if(Number(this.form.longCharge) > 0){
+					price	 = Number(price) + Number(this.form.longCharge)
+				}
+			}
+			this.totalPrice = price.toFixed(2);
+			this.modifyPrice = price.toFixed(2);
+
+			let packingCharge = Number(this.form.packingCharge) > 0 ? Number(this.form.packingCharge) : 0
+			let longCharge = Number(this.form.longCharge) > 0 ? Number(this.form.longCharge) : 0
+			let shortCharge = Number(this.form.shortCharge) > 0 ? Number(this.form.shortCharge) : 0
+			let localCharge = Number(this.form.localCharge) > 0 ? Number(this.form.localCharge) : 0
+			let pickCharge = Number(this.form.pickCharge) > 0 ? Number(this.form.pickCharge) : 0
+			this.totalFreight = (packingCharge+longCharge+shortCharge+localCharge+pickCharge).toFixed(2)
+			this.perKgFreight = (this.totalFreight / this.calcTotalWeight).toFixed(2)
+		},
+		changeYfPayWay(index){
+			this.form.yfPayWay = index
+			this.inputFn()
+		},
     hitPlay() {
       const hitPlay = this.$refs.hitPlay;
       hitPlay.play()
@@ -396,9 +524,9 @@ export default {
           that.$refs['itemSearchRef'].focus()
         })
     },
-    changeKdStaff(info){
-      this.form.getStaffId = info.id
-      this.form.getStaffName = info.name
+    changeCgStaff(info){
+      this.form.cgStaffId = info.id
+      this.form.cgStaffName = info.name
     },
     setTransType(type){
       this.form.transType = type
@@ -415,7 +543,7 @@ export default {
       this.customInfoList = []
       this.desk = 'searchCustom'
       this.$nextTick(() => {
-        this.$refs.customref.focus()
+        this.$refs.ghsRef.focus()
       })
     },
     selectGhsFn(e){
@@ -423,7 +551,7 @@ export default {
         let that = this
         that.TT = setTimeout(function(){
           that.desk = 'selectedList'
-        },2500)
+        },2300)
         this.form.ghsId = e.id
         this.form.ghsName = e.name
         this.selectJobId = e.id
@@ -513,7 +641,7 @@ export default {
       this.form.ghsId = 0
       this.form.ghsName = ''
       this.$nextTick(() => {
-        this.$refs.customref.focus()
+        this.$refs.ghsRef.focus()
       })
     },
     clearSeachVal(){

+ 1 - 1
ghs/src/views/order/add.vue

@@ -497,7 +497,7 @@ export default {
         let that = this
         that.TT = setTimeout(function(){
           that.desk = 'selectedList'
-        },2500)
+        },2300)
         this.form.customId = e.id
         this.form.customName = e.name
         this.selectJobId = e.id