Răsfoiți Sursa

做到了结算模块

shish 2 ani în urmă
părinte
comite
23069aeb02
2 a modificat fișierele cu 156 adăugiri și 58 ștergeri
  1. 1 0
      ghs/src/mixins/product2.js
  2. 155 58
      ghs/src/views/order/add.vue

+ 1 - 0
ghs/src/mixins/product2.js

@@ -25,6 +25,7 @@ export default {
 			calc:'add',
 			globalRequestType:'kd',
 			globalCustomId:0,
+			globalCustomName:'',
 			globalClassData:[],
 			globalClassId:0,
 			globalFinishGetItem:0,

+ 155 - 58
ghs/src/views/order/add.vue

@@ -1,13 +1,14 @@
 <template>
-  <div v-if="customId == 0" style="text-align:center;">
+  <div v-if="globalCustomId == 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.id"></el-option>
+    				<el-option v-for="item in customInfoList" :key="item.id" :label="`${item.name}`" :value="item"></el-option>
   				</el-select>
   </div>
   <div class="app-list-content" v-else>
     <div class="left_box">
       <p class="tor">
+        <span style="font-weight:bold;color:black;">客户:{{globalCustomName}}</span>
         <span>全屏:F11</span>
         <span>提交:F9</span>
         <span>改价:F8</span>
@@ -58,6 +59,7 @@
         <div style="display: inline-block;" class="allPrice">{{allCount.kind}}种</div>
         <div style="display: inline-block;" class="allPrice">{{ allCount.bigLength }}扎</div>
         <div style="display: inline-block;" class="allPrice">¥{{ allPrice }}</div>
+        <el-button type="primary" size="medium" style="margin-left:50px;" @click="comeBack()">返回 Ctrl + B</el-button>
     </div>
 
     <el-dialog :title="getItemList[getIndex].name" v-if="showConfirmNum" :visible.sync="showConfirmNum" width="30%" center>
@@ -76,49 +78,81 @@
       </div>
     </el-dialog>
 
-    <el-dialog title="确认提交" v-if="isAccounts" :visible.sync="isAccounts" width="573px" center>
+    <el-dialog title="确认提交" v-if="showCommitPop" :visible.sync="showCommitPop" width="573px" center>
       <div class="">
         <div class="accounts-list">
           客户
-          <el-select ref="selectShopListInput" style="width: 80%" v-model="selectShopListVal" filterable placeholder="请选择" :visible-change="true">
-            <el-option
-                v-for="item in allShopList"
-                :key="item.id"
-                :label="item.name"
-                :value="item.id">
-            </el-option>
-          </el-select>
+          <div class="accounts-center">{{globalCustomName}}</div>
         </div>
-        <div class="accounts-list">
-          取货
+
+        <div class="accounts-list" v-if="currentShop.pfLevel && currentShop.pfLevel == 1">
+          配送方式
+          <div class="accounts-center">
+            <el-button :type="form.transType == 4?'primary':''" @keyup.enter.native="setTransType(4)" @click="setTransType(4)" size="small">同城</el-button>
+            <el-button :type="form.transType == 0?'primary':''" @keyup.enter.native="setTransType(0)" @click="setTransType(0)" size="small">德邦</el-button>
+            <el-button :type="form.transType == 1?'primary':''" @keyup.enter.native="setTransType(1)" @click="setTransType(1)" size="small">顺丰</el-button>
+            <el-button :type="form.transType == 2?'primary':''" @keyup.enter.native="setTransType(2)" @click="setTransType(2)" size="small">冷链</el-button>
+            <el-button :type="form.transType == 3?'primary':''" @keyup.enter.native="setTransType(3)" @click="setTransType(3)" size="small">航空</el-button>
+            <el-button :type="form.transType == 5?'primary':''" @keyup.enter.native="setTransType(5)" @click="setTransType(5)" size="small">自取</el-button>
+          </div>
+        </div>
+
+        <div class="accounts-list" v-else>
+          配送方式
           <div class="accounts-center">
-            <el-button :type="type=='自提'?'primary':''" @keyup.enter.native="type='自提'" @click="type='自提'">自提</el-button>
-            <el-button :type="type=='配送'?'primary':''" @keyup.enter.native="type='配送'" @click="type='配送'">配送</el-button>
+            <el-button :type="form.sendType == 0?'primary':''" @keyup.enter.native="setSendType(0)" @click="setSendType(0)" size="small">送货</el-button>
+            <el-button :type="form.sendType == 1?'primary':''" @keyup.enter.native="setSendType(1)" @click="setSendType(1)" size="small">自取</el-button>
+            <el-button :type="form.sendType == 2?'primary':''" @keyup.enter.native="setSendType(2)" @click="setSendType(2)" size="small">跑腿</el-button>
+            <el-button :type="form.sendType == 3?'primary':''" @keyup.enter.native="setSendType(3)" @click="setSendType(3)" size="small">物流</el-button>
           </div>
         </div>
+
         <div class="accounts-list" v-if="type=='配送'">
           运费
           <div class="accounts-center">
             <el-input @input="freightInput" placeholder="请填写运费,留空免运费" v-model="freight"></el-input>
-          </div>
+          </div>    
         </div>
         <div class="accounts-list">
-          结算方式
+          付款方式
+          <div class="accounts-center">
+            <el-button :type="form.hasPay == 2?'primary':''" @keyup.enter.native="form.hasPay = 2" @click="form.hasPay = 2" size="small">赊账</el-button>
+            <el-button :type="form.hasPay == 1?'primary':''" @keyup.enter.native="form.hasPay = 1" @click="form.hasPay = 1" size="small">线下</el-button>
+          </div>
+        </div>
+        <div class="accounts-list" v-if="form.hasPay == 1">
+          线下方式
           <div class="accounts-center">
-            <el-button :type="payType=='欠款'?'primary':''" @keyup.enter.native="payType='欠款'" @click="payType='欠款'">欠款</el-button>
-            <el-button :type="payType=='已收款'?'primary':''" @keyup.enter.native="payType='已收款'" @click="payType='已收款'">已收款</el-button>
+            <el-button :type="form.payWay == 0?'primary':''" @keyup.enter.native="form.payWay = 0" @click="form.payWay = 0" size="small">线下微信</el-button>
+            <el-button :type="form.payWay == 1?'primary':''" @keyup.enter.native="form.payWay = 1" @click="form.payWay = 1" size="small">线下支付宝</el-button>
+            <el-button :type="form.payWay == 4?'primary':''" @keyup.enter.native="form.payWay = 4" @click="form.payWay = 4" size="small">现金</el-button>
+            <el-button :type="form.payWay == 5?'primary':''" @keyup.enter.native="form.payWay = 5" @click="form.payWay = 5" size="small">银行卡</el-button>
           </div>
         </div>
         <div class="accounts-list">
-          总金额
-          <div class="accounts-center">{{totalMoney.toFixed(2)}}</div>
+          合计金额
+          <div class="accounts-center" style="color:black;">¥{{parseFloat(finalPrice)}}</div>
+        </div>
+        <div class="accounts-list">
+          {{ form.hasPay == 2 ? '应收金额' : '实收金额' }}
+          <el-input style="width: 80%" v-model="modifyPrice" @focus="modifyPrice=''" clearable></el-input>
+        </div>
+
+        <div class="accounts-list" v-if="modifyPrice > 0 && modifyPrice > finalPrice" style="font-size:25upx;margin-left:20upx;color:red;font-weight:bold;">
+          人工资材
+          <div class="accounts-center">¥{{parseFloat((modifyPrice-finalPrice).toFixed(2))}}</div>
         </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">¥{{parseFloat((finalPrice-modifyPrice).toFixed(2))}}</div>
+        </div>
+
         <div class="accounts-list">
-          实收
-          <el-input style="width: 80%" v-model="modifyPrice" clearable></el-input>
+          送货日期
+          <div class="accounts-center">{{(totalMoney - modifyPrice).toFixed(2)}}</div>
         </div>
         <div class="accounts-list">
-          优惠
+          开单人员
           <div class="accounts-center">{{(totalMoney - modifyPrice).toFixed(2)}}</div>
         </div>
         <div class="accounts-list">
@@ -131,16 +165,10 @@
             </el-input>
           </div>
         </div>
-        <div class="accounts-list">
-          {{ payType }}
-          <div class="accounts-center">
-            ¥{{ modifyPrice }}
-          </div>
-        </div>
         <div class="accounts-list">
           <span></span>
           <div class="accounts-center">
-            <el-button @click="isAccounts = false">取消(Esc)</el-button>
+            <el-button @click="showCommitPop = false">取消(Esc)</el-button>
             <el-button type="primary" @click="createOrder">确认(Ctrl+Enter)</el-button>
           </div>
         </div>
@@ -203,13 +231,39 @@ export default {
   name: 'add',
   data() {
     return {
+      form: {
+        shopId: "",
+        shopName: "",
+        receiveProvince: "",
+        receiveCity: "",
+        receiveFloor: "",
+        receiveAddress: "",
+        receiveLong: "",
+        receiveLat: "",
+        sendType: 0,
+        transType:0,
+        sendSide: "2",
+        sendDate: "",
+        sendTimeWant: "",
+        sendCost: "",
+        customId: "",
+        packCost:"",
+        product: "",
+        remark:"",
+        payWay:0,
+        needPrint:1,//订单生成时打印订单1需要2不需要
+        hasPay:0,
+        getStaffName:'',
+        dealPrice:0,
+        wlName:''
+      },
       printAmount:1,
       checked:true,
       type:'自提',//取货方式
       payType:'欠款',//结算方式
       showConfirmNum:false,//选择扎和支的弹窗
       isAmendPrice:false,//修改单价弹窗
-      isAccounts:false,//结账弹窗
+      showCommitPop:false,//结账弹窗
       priceAmend:0,//修改单价弹窗
       isSeek:false,
       totalMoney:0,//总价
@@ -219,26 +273,55 @@ export default {
       getIndex:0,
       getItemList:[],//搜索展示的列表
       selectIndex:0,
-      allShopList:[],
       selectShopListVal:'',
       freight:'',//运费
       remark:'',//备注
       printSelectList:'',
       orderMsg:'',
       number: 0,
-      customId:0,
       customInfoList:[],
       loading: false,
       selectCustomName:'',
-      t:null
+      t:null,
+      currentShop:{default:0,pfLevel:0}
     };
   },
 	mixins: [productMins],
+  computed: {
+    displayPackCost(){
+      if(this.currentShop.pfLevel && this.currentShop.pfLevel == 1){
+        return true
+      }
+      return false
+    },
+    displaySendCost(){
+      if(this.form.sendType == 2){
+        return true
+      }
+      if(this.currentShop.pfLevel && this.currentShop.pfLevel == 1){
+        return true
+      }
+      return false
+    },
+    finalPrice(){
+      let totalPrice = this.allPrice.toFixed(2)
+      let finalPrice = Number(totalPrice)
+      if(this.displaySendCost == true){
+        finalPrice = Number(finalPrice) + Number(this.form.sendCost)
+      }
+      if(this.displayPackCost == true){
+        finalPrice = Number(finalPrice) + Number(this.form.packCost)
+      }
+      let currentPrice = parseFloat(finalPrice)
+      this.modifyPrice = currentPrice 
+      return currentPrice
+    }
+  },
   created() {
 
   },
   mounted() {
-    if(this.customId == 0){
+    if(this.globalCustomId == 0){
       this.$nextTick(() => {
         this.$refs.customref.focus()
       })
@@ -247,8 +330,8 @@ export default {
     document.onkeydown=function(e) {
       console.log(e)
       if(e && e.key == 'Enter' && e.ctrlKey){
-        if(that.isAccounts){
-          that.isAccounts = false
+        if(that.showCommitPop){
+          that.showCommitPop = false
           that.createOrder();
         }
       }
@@ -257,6 +340,9 @@ export default {
       if(e && e.key && e.key.toLowerCase() =='c' && e.ctrlKey){
         that.$refs['customref'].focus();
       }
+      if(e && e.key && e.key.toLowerCase() =='b' && e.ctrlKey){
+        that.comeBack()
+      }
       if(e && e.key && e.key.toLowerCase() =='q' && e.ctrlKey){
         that.$refs['itemSearchRef'].focus();
       }
@@ -280,8 +366,8 @@ export default {
         that.removeFromSave()
       }
       if( e && e.key=='Escape'){
-        if(that.isAccounts){
-          that.isAccounts = false;
+        if(that.showCommitPop){
+          that.showCommitPop = false;
           return;
         }
         that.escFun();
@@ -303,21 +389,38 @@ export default {
           that.$message({message: '请选择花材',type: 'warning'});
           return;
         }
-        that.isAccounts = true;
-        if(that.$util.isEmpty(that.allShopList)){
-          that.getShopAll();
-        }else{
-          that.$nextTick(()=>{
-            that.$refs['selectShopListInput'].focus();
-          })
-        }
+        that.setSendType(0)
+        that.setTransType(4)
+        that.showCommitPop = true
       }
     }
+
+    this.$service.common.shopInfo().then(res => {
+        that.currentShop = res.shopInfo
+		})
+
   },
   methods: {
+    setTransType(type){
+      this.form.transType = type
+    },
+    setSendType (type) {
+      this.form.sendType = type
+      if (type !== 2) {
+        this.form.sendCost = ""
+      }
+    },
+    comeBack(){
+      this.globalCustomId = 0
+      this.globalCustomName = ''
+      this.$nextTick(() => {
+        this.$refs.customref.focus()
+      })
+    },
     searchSelectCustom(e){
-      this.customId = e
-      this.selectJobId = e
+      this.globalCustomId = e.id
+      this.globalCustomName = e.name
+      this.selectJobId = e.id
       this.getFromStorage()
 		  this.$nextTick(()=>{
 			  this.$refs['itemSearchRef'].focus()
@@ -353,12 +456,6 @@ export default {
       }
       return todaty
     },
-    getShopAll(){
-      this.$service.custom.shopListAll().then(res => {
-        this.allShopList = res.list;
-        this.$refs['selectShopListInput'].focus();
-      });
-    },
     createOrder(){
       const product = this.selectList.map(ele => {
         return { productId: ele.id, bigNum: ele.big, smallNum: ele.small };
@@ -377,7 +474,7 @@ export default {
         this.printSelectList = this.selectList;
         this.$nextTick(()=>{
           this.selectList = [];
-          this.isAccounts = false;
+          this.showCommitPop = false;
           this.escFun();
         })
         this.printOrder();
@@ -409,7 +506,7 @@ export default {
       }
       this.t = setTimeout(function(){
         that.searchItemFn()
-      },300)
+      },250)
     },
     async searchItemFn(){
       if(this.searchVal==''){