Просмотр исходного кода

订单管理新增订单变更确认、订货业务新增订单变更申请

qymljy 1 месяц назад
Родитель
Сommit
88ec86bfa2

+ 104 - 3
src/HDrpManagement/orderManage/details/index.vue

@@ -13,6 +13,7 @@
         :statusCheck="[{key:'status',value:'审核'},{key:'status',value:'提交'},{key:'status',value:'关闭'}]"
         :tabs="['订单明细','基本信息','订单进度','居间费明细','发货单','物流单','发票记录','收支明细','核销记录','erp对接记录','变更记录']"
         @onTabClick="onTabClick"
+        @sysTag="sysTag"
         @pageChange="pageChange"
         @onEditSuccess="queryMainData($route.query.id)">
         <div slot="customOperationBef">
@@ -27,6 +28,36 @@
           <changeSaler class="inline-16" style="margin-left: -10px" ref="saler" @selectRow="salerChange" :isPlain="true">
             <el-button v-if="tool.checkAuth($route.name,'changeSaler')" type="primary" slot="input" size="mini" @click="$refs.saler.visible=true;$refs.saler.listData()">{{$t(`变更业务员`)}}</el-button>
           </changeSaler>
+          <orderChange class="inline-16" btnType="primary" btnTitle="订单变更确认" logTitle="订单变更确认" content="是否确认变更订单明细"
+                       logWidth="900px" @showDialog="showDialog" ref="orderChangeRef" v-if="tool.checkAuth($route.name,'orderChangeCheck') && tagChange">
+            <template #formRule>
+              <tableDetail :layout="tablecols" :data="list" :opwidth="200" :custom="true" fixed-name="operation" height="calc(100vh - 460px)">
+                <template v-slot:customcol="scope">
+                  <div v-if="scope.column.columnname === 'nominalpressure'">
+                    {{tool.nominalPressureSet(scope.column.data[scope.column.columnname])}}
+                  </div>
+                  <div v-else>{{scope.column.data[scope.column.columnname]||scope.column.columnname === 'operation' ? scope.column.data[scope.column.columnname] : '--'}}</div>
+                </template>
+              </tableDetail>
+              <div class="container normal-panel" style="text-align:right;margin-bottom: -10px!important;">
+                <el-pagination
+                    background
+                    @size-change="handleSizeChange"
+                    @current-change="handleCurrentChange"
+                    :current-page="currentPage"
+                    :page-sizes="[20, 50, 100, 200]"
+                    :page-size="20"
+                    layout="total,sizes, prev, pager, next, jumper"
+                    :total="total">
+                </el-pagination>
+              </div>
+            </template>
+            <template #footerBtn>
+              <el-button @click="$refs.orderChangeRef.dialogTableVisible = false" size="small" style="width: 100px">{{$t(`取消`)}}</el-button>
+              <el-button type="primary" @click="changeSubmit('驳回')" size="small" plain style="width: 100px;background: #FFFFFF">{{$t(`驳回变更`)}}</el-button>
+              <el-button type="primary" @click="changeSubmit('确认')" size="small" style="width: 100px">{{$t(`确认变更`)}}</el-button>
+            </template>
+          </orderChange>
           <el-button v-if="tool.checkAuth($route.name,'confirmDate') && mainData.status === '交期待确认'"  class="inline-16"  type="primary" size="mini" @click="confirmdate">{{$t(`确认交期`)}}</el-button>
           <el-button v-if="tool.checkAuth($route.name,'backconfirmDate') && mainData.status === '交期待确认' || mainData.status === '交期确认'"  class="inline-16"  type="primary" size="mini" @click="backconfirmdate">{{$t(`交期退回`)}}</el-button>
           <confirmDate v-if="tool.checkAuth($route.name,'replyDate')" class="inline-16" :data="mainData" @onSuccess="confirmSuccess"></confirmDate>
@@ -164,6 +195,7 @@ import importFile from './importFile.vue'
 import EditRemark from '../modules/EditRemark.vue'
 import dialogTemplate from "@/template/dialogTemplate/index";
 import setMaterial from "./tabs/setMaterial";
+import orderChange from "@/components/dialogTemplate/index3"
 export default {
   name: "detail",
   data() {
@@ -186,7 +218,23 @@ export default {
       siteid:JSON.parse(sessionStorage.getItem('active_account')).siteid,
       tabNow:'tab0',
       jsYcDay:'',
-      jsDay:''
+      jsDay:'',
+      orderParam:{
+        "id": 2026033114535102,
+        "content": {
+          "sa_orderid": 0,
+          "pageNumber": 1,
+          "pageSize": 20,
+          "where": {
+            "condition": ""
+          }
+        }
+      },
+      list:[],
+      tablecols:[],
+      total:0,
+      currentPage:0,
+      tagChange:false
     }
   },
   provide () {
@@ -213,7 +261,8 @@ export default {
     importFile,
     EditRemark,
     dialogTemplate,
-    setMaterial
+    setMaterial,
+    orderChange
   },
   methods:{
     async orderreviewtype () {
@@ -221,6 +270,16 @@ export default {
       this.options = res.data
       this.value = res.data[0].value
     },
+    sysTag(val){
+      this.tagChange = false
+      if (val.length > 0){
+        val.forEach(item => {
+          if (item == '变更中'){
+            this.tagChange = true
+          }
+        })
+      }
+    },
     async queryMainData() {
       if (this.typeNew == '提交'){
         const res = await this.$api.requested({
@@ -264,6 +323,25 @@ export default {
         })
       }
     },
+    async changeSubmit(type){
+      let param = {
+        id:'',
+        content:{
+          sa_orderid:this.$route.query.id
+        },
+      }
+      if (type == '驳回'){
+        param.id = 2026033114542702
+      }else {
+        param.id = 2026033114555002
+      }
+      const res = await this.$api.requested(param)
+      this.tool.showMessage(res,()=>{
+        this.$refs.orderChangeRef.dialogTableVisible = false
+        this.queryMainData()
+        this.$refs.details.$refs.tag.queryTag()
+      })
+    },
     changeDataStructure() {
       let that = this
       this.mainAreaData = that.siteid == 'HY' && this.tool.checkAuth(this.$route.name,'setMaterial')?[
@@ -1173,12 +1251,35 @@ export default {
     confirmSuccess(){
       this.queryMainData()
       this.$refs.prod.listData()
-    }
+    },
+    /*订单变更确认*/
+    async showDialog(){
+      this.orderParam.content.pageNumber = 1
+      this.changeListData()
+    },
+    async changeListData(){
+      this.orderParam.content.sa_orderid = this.$route.query.id
+      const res = await this.$api.requested(this.orderParam)
+      this.list = res.data
+      this.total = res.total
+      this.currentPage = res.pageNumber
+    },
+    handleSizeChange(val) {
+      // console.log(`每页 ${val} 条`);
+      this.param.content.pageSize = val
+      this.changeListData()
+    },
+    handleCurrentChange(val) {
+      // console.log(`当前页: ${val}`);
+      this.param.content.pageNumber = val
+      this.changeListData()
+    },
   },
   mounted () {
     this.queryMainData(this.$route.query.id)
   },
   created() {
+    this.tablecols = this.tool.tabelCol(this.$route.name).orderChangeTable.tablecols
   }
 }
 </script>

+ 60 - 4
src/HDrpManagement/orderManage/index.vue

@@ -96,6 +96,18 @@
             <el-option :label="$t(`未完成`)" value="未完成"></el-option>
           </el-select>
         </div>
+        <div class="mt-10">
+          <label class="search__label" >{{$t(`标签`)}}:</label>
+          <el-select v-model="where.tag" multiple clearable style="margin-right:10px" size="small" :placeholder="$t(`请选择标签`)" @change="change" @focus="queryTags">
+            <el-option
+                v-for="item in tagList"
+                :key="item.index"
+                :disabled="hasDisabledTag(item)"
+                :label="$t(item.tag)"
+                :value="item.tag">
+            </el-option>
+          </el-select>
+        </div>
         <div class="mt-10">
           <label class="search__label" >{{$t(`审核日期`)}}:</label>
           <el-date-picker
@@ -145,6 +157,21 @@
           <span v-else-if="scope.data.column.data[[scope.data.column.columnname]] == '部分完成'"  style="color: #e6a23c">{{$t(scope.data.column.data[[scope.data.column.columnname]])}}</span>
           <span v-else  style="color: #606266">{{$t(scope.data.column.data[[scope.data.column.columnname]])}}</span>
         </div>
+        <div v-else-if="scope.data.column.columnname === 'tag'">
+          <div v-if="scope.data.column.data.sys_tag.length > 0 || scope.data.column.data.tag.length > 0">
+            <div v-for="item in scope.data.column.data.sys_tag" :key="item.index"  style="float: left;margin-left: 5px;margin-bottom: 5px">
+              <el-tag  color="#3874F6" size="mini" type="primary" effect="dark">
+                <span>{{$t(item)}}</span>
+              </el-tag>
+            </div>
+            <div v-for="item in scope.data.column.data.tag" :key="item.index"  style="float: left;margin-left: 5px;margin-bottom: 5px">
+              <el-tag color="#FA8C16" size="mini" type="warning" effect="dark">
+                <span>{{$t(item)}}</span>
+              </el-tag>
+            </div>
+          </div>
+          <div v-else>--</div>
+        </div>
         <div v-else>
           {{scope.data.column.data[[scope.data.column.columnname]]?$t(scope.data.column.data[[scope.data.column.columnname]]):'--'}}
         </div>
@@ -176,10 +203,11 @@ export default {
         "saler_name":'',
         "isoverdue":'',
         "siteid":'',
-        "goodsstatus":''
+        "goodsstatus":'',
+        "tag":[]
       },
-      dateSelect:[]
-
+      dateSelect:[],
+      tagList:[],
     }
   },
   methods:{
@@ -224,7 +252,35 @@ export default {
         this.$refs.basicLayout.param.content.where.enddate = ''
       }
       this.$refs.basicLayout.listData()
-    }
+    },
+    async queryTags(){
+      const res = await this.$api.requested({
+        id:20221013104401,
+        content:{
+          isExport:0,
+          pageNumber:1,
+          pageSize:20,
+          sys_systemtagid:62,
+          where:{
+            condition:""
+          }
+        }
+      })
+      this.tagList = res.data
+    },
+    hasDisabledTag(item) {
+      let arr = [];
+      let arr2 = [];
+      arr = this.tagList.filter(item => {
+        return this.where.tag.includes(item.tag)
+      });
+      arr.forEach(e => {
+        arr2 = arr2.concat(e.mutextags)
+      });
+      arr2 = this.where.tag.length === 0 ? [] : arr2;
+      let _isSame = arr2.some(tag => item.tag === tag.tag);
+      return _isSame
+    },
   },
   created () {
     this.getTradefield()

+ 29 - 2
src/SDrpManagement/salerOrder/details/index.vue

@@ -23,6 +23,7 @@
         '收支明细',
         '核销记录',
       ]"
+      @sysTag="sysTag"
       @pageChange="pageChange"
       @onEditSuccess="queryMainData($route.query.id)"
     >
@@ -50,6 +51,7 @@
           :disabled="mainData.status !== '新建' || mainData.qty === 0"
           type="primary"
           size="mini"
+          class="inline-16"
           @click="onSubmit('提交')"
           >{{ $t("提 交") }}</el-button
         >
@@ -73,8 +75,11 @@
             (mainData.status == '提交' || mainData.status == '预提交') && tool.checkAuth($route.name, 'reback')
           "
         />
+        <changeOrderReq :tableData="tableDataSelect" class="inline-16" @onSuccess="changeOrderSuccess" :status="mainData.status"
+                        :tagChange="tagChange" v-if="tool.checkAuth($route.name, 'changeOrderReq') && !tagChange"></changeOrderReq>
         <el-button
           v-if="tool.checkAuth($route.name, 'insert')"
+          :style="{marginLeft:tagChange?'0px':'0px'}"
           type="primary"
           size="mini"
           @click="onCopy"
@@ -296,6 +301,7 @@ import revenue from "./tabs/revenueAndExp.vue";
 import importFile from "../modules/importFile.vue";
 import writeOff from "./tabs/writeoff.vue";
 import dialogTemplate from "@/template/dialogTemplate/index";
+import changeOrderReq from "../modules/changeOrderReq"
 export default {
   name: "detail",
   data() {
@@ -311,7 +317,9 @@ export default {
       typeNew:'',
       fullscreenLoading:false,
       selection:[],
-      siteid:JSON.parse(sessionStorage.getItem('active_account')).siteid
+      siteid:JSON.parse(sessionStorage.getItem('active_account')).siteid,
+      tableDataSelect:[],
+      tagChange:false
     };
   },
   provide() {
@@ -331,7 +339,8 @@ export default {
     revenue,
     importFile,
     writeOff,
-    dialogTemplate
+    dialogTemplate,
+    changeOrderReq
   },
   methods: {
     async queryMainData(id) {
@@ -373,6 +382,23 @@ export default {
         });
       }
     },
+    changeOrderSuccess(){
+      this.queryMainData()
+      this.$refs.details.$refs.tag.queryTag()
+      this.tableDataSelect = []
+      this.selection = []
+      this.$refs.prod.listData(this.$refs.prod.param.content.pageNumber = 1)
+    },
+    sysTag(val){
+      this.tagChange = false
+      if (val.length > 0){
+        val.forEach(item => {
+          if (item == '变更中'){
+            this.tagChange = true
+          }
+        })
+      }
+    },
     changeDataStructure() {
       let that = this;
       this.mainAreaData = that.siteid == 'HY'?[
@@ -933,6 +959,7 @@ export default {
     },
     select (data) {
       this.selection = data
+      this.tableDataSelect = data
     },
     async adddispatch () {
       const res = await this.$api.requested({

+ 257 - 0
src/SDrpManagement/salerOrder/modules/changeOrderReq.vue

@@ -0,0 +1,257 @@
+<template>
+  <div>
+    <el-button type="primary" size="mini" :disabled="tableData.length === 0 || status != '审核' || tagChange" @click="onShow" @close="onClose">{{$t(`订单变更申请`)}}</el-button>
+    <el-dialog :title="$t(`明细变更`)" append-to-body :visible.sync="dialogVisible" width="900px">
+      <el-table
+          class="normal-margin"
+          :data="listData"
+          style="width: 100%"
+          @close="onClose"
+          border
+          size="small">
+        <el-table-column
+            prop="itemname"
+            :label="$t('产品名称')"
+            width="180">
+        </el-table-column>
+        <el-table-column
+            prop="itemno"
+            :label="$t('产品编号')"
+            width="180">
+        </el-table-column>
+        <el-table-column
+            prop="erpitemno"
+            :label="$t(`erp编号`)"
+            width="180">
+        </el-table-column>
+        <el-table-column
+            prop="model"
+            :label="$t('型号')"
+            width="150">
+          <template slot-scope="scope">
+            <p><span>{{scope.row.model}}</span></p>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="spec"
+            :label="$t('规格')"
+            width="150">
+          <template slot-scope="scope">
+            <p><span>{{scope.row.spec}}</span></p>
+          </template>
+
+        </el-table-column>
+        <el-table-column
+            prop="qty"
+            :label="$t(`原数量`)"
+            width="180">
+          <template slot-scope="scope">
+            <span>{{scope.row.qty}}</span>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="qty"
+            :label="$t(`已出货数量`)"
+            width="180">
+          <template slot-scope="scope">
+            <span>{{scope.row.logisticsqty}}</span>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="deliedqty"
+            :label="$t(`已发数量`)"
+            width="180">
+          <template slot-scope="scope">
+            <span>{{scope.row.deliedqty}}</span>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="undeliqty"
+            :label="$t(`未发数量`)"
+            width="180">
+          <template slot-scope="scope">
+            <span>{{scope.row.undeliqty}}</span>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="newdeliverydate"
+            v-if="siteid === 'HY'"
+            :label="$t(`变更交期`)"
+            width="175"
+            fixed="right">
+          <template slot-scope="scope">
+            <el-date-picker
+                size="mini"
+                style="width: 150px"
+                v-model="scope.row.newdeliverydate"
+                @focus="DateFocus(scope.row.deliverydate)"
+                format="yyyy-MM-dd"
+                value-format="yyyy-MM-dd"
+                type="date"
+                :picker-options="pickerOptions"
+                :placeholder="$t('选择日期')">
+            </el-date-picker>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="newvalue"
+            :label="$t(`变更数量`)"
+            width="180"
+            fixed="right">
+          <template slot-scope="scope">
+            <el-input size="mini" @input="onInput(scope.row,scope.$index)" v-model="scope.row.newvalue" ></el-input>
+          </template>
+        </el-table-column>
+      </el-table>
+      <el-form ref="form" :model="form" :rules="rules" label-position="top" size="small">
+        <el-form-item :label="$t(`变更原因`)" prop="typeclass" :label-width="formLabelWidth">
+          <el-select v-model="form.typeclass" :placeholder="$t(`选择变更原因`)" style="width: 100%">
+            <el-option
+                v-for="item in changeReason"
+                :key="item.value"
+                :label="$t(item.value)"
+                :value="item.value">
+            </el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item :label="$t(`原因描述`)" prop="remarks" :label-width="formLabelWidth">
+          <el-input v-model="form.remarks" type="textarea" :autosize="{minRows:5}" :placeholder="$t(`输入原因描述`)" autocomplete="off"></el-input>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="onClose" size="small">{{$t('取 消')}}</el-button>
+        <el-button type="primary" @click="submit" size="small">{{$t('确 定')}}</el-button>
+      </div>
+    </el-dialog>
+
+  </div>
+</template>
+
+<script>
+export default {
+  name: "changeOrderReq",
+  props:['data','tableData','status','tagChange'],
+  data () {
+    let that = this
+    return {
+      pickerOptions:{
+        disabledDate(time){
+          let newDate = new Date(that.deliverydate)
+          newDate = newDate.getFullYear() + '-' + (newDate.getMonth() + 1) + '-' + newDate.getDate()
+          let newTime = time.getFullYear() + '-' + (time.getMonth() + 1) + '-' + time.getDate()
+          if (time < new Date(new Date().getTime() - 24 * 60 * 60 * 1000 ) || newTime === newDate) {
+            return true; // 禁用日期
+          }
+          return false; // 可选日期
+        }
+      },
+      formLabelWidth:'80px',
+      listData:[],
+      dialogVisible:false,
+      form:{
+        qty:'',
+        typeclass:'',
+        remarks:''
+      },
+      deliverydate:'',
+      siteid:JSON.parse(sessionStorage.getItem('active_account')).siteid,
+      rules: {
+        typeclass: [
+          { required: true, message: this.$t("选择变更原因"), trigger: "change" },
+        ],
+        remarks: [
+          { required: true, message: this.$t("输入原因描述"), trigger: "blur" },
+        ],
+      },
+      changeReason:[]
+    }
+  },
+  methods:{
+    DateFocus(val){
+      this.deliverydate = val
+    },
+    async onShow () {
+      this.listData = this.tableData
+      this.dialogVisible = true
+      const res = await this.$store.dispatch('optiontypeselect','orderchangereason')
+      this.changeReason = res.data
+    },
+    onClose(){
+      this.form.remarks = ''
+      this.form.qty = ''
+      this.form.typeclass = ''
+      this.listData = this.tableData.map(e=>{
+        e.newvalue = ''
+        e.newdeliverydate = ''
+        return e
+      })
+      this.dialogVisible = false
+    },
+    onInput(row,index) {
+      row.newvalue = row.newvalue.replace(/[^\d]/g, '');
+      this.$set(this.listData,index,row)
+    },
+    checkRowData () {
+      let valid = true
+      // let arr = this.listData.filter((row,index)=>{
+      //   if (row.newvalue > row.qty) {
+      //     this.$message({
+      //       message:row.itemname+this.$t("变更数量不能大于原数量"),
+      //       type:"error",
+      //       offset:index * 60
+      //     })
+      //     return row
+      //   } else if (row.newvalue  < row.deliedqty) {
+      //     this.$message({
+      //       message:row.itemname+this.$t("变更数量不能小于已发货数量"),
+      //       type:"error",
+      //       offset:index * 60
+      //     })
+      //     return row
+      //   }
+      // })
+      // if (arr.length > 0) {
+      //   return false
+      // } else {
+      //   return true
+      // }
+      return valid
+    },
+    submit () {
+      if (this.checkRowData()) {
+        this.$refs.form.validate(async (valid)=>{
+          if (!valid) return false
+          const res = await this.$api.requested({
+            "id": 2026033114502902,
+            "content": {
+              "sa_orderid":this.$route.query.id,//订单ID
+              "type":'数量',//调整类型,目前只支持数量
+              "typeclass":this.form.typeclass,
+              "remarks":this.form.remarks,
+              "itemifnos":this.listData.map(e=>{
+                return {
+                  sa_orderitemsid:e.sa_orderitemsid,
+                  itemid:e.itemid,
+                  newvalue:e.newvalue,
+                  newdeliverydate:e.newdeliverydate?e.newdeliverydate:''
+                }
+              })
+            }
+          })
+          this.tool.showMessage(res,()=>{
+            this.dialogVisible = false
+            this.form.qty = ''
+            this.form.typeclass = ''
+            this.form.remarks = ''
+            this.$emit('onSuccess')
+          })
+        })
+      }
+    },
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 45 - 0
src/components/dialogTemplate/index3.vue

@@ -0,0 +1,45 @@
+<template>
+  <div>
+    <el-button :type="disabled?'':btnType" size="mini" :disabled="disabled"  @click="dialogShow">{{$t(btnTitle)}}</el-button>
+    <el-dialog :title="logTitle?$t(logTitle):$t(`提示`)" :visible.sync="dialogTableVisible" append-to-body
+               :show-close="showClose" :width="logWidth?logWidth:'600px'">
+      <div style="margin-bottom: 20px"><i class="el-icon-warning" v-if="iconShow" style="color: #eda51c;margin-right: 10px"></i>{{$t(content) + '?'}}</div>
+      <slot name="formRule"></slot>
+      <div slot="footer" class="dialog-footer" style="margin-top: 0 !important;">
+        <slot name="footerBtn"></slot>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+export default {
+  name: "index1",
+  props:["btnTitle","disabled","btnType","content","logTitle","iconShow","showClose","logWidth"],
+  data(){
+    return {
+      dialogTableVisible:false,
+    }
+  },
+  methods:{
+    dialogShow(){
+      this.dialogTableVisible = true
+      this.$emit('showDialog')
+    },
+    onCancel(){
+      this.dialogTableVisible = false
+      this.$emit('onCancel')
+    },
+    onSubmit(){
+      this.$emit('onSubmit')
+    }
+  }
+
+}
+</script>
+
+<style scoped>
+  /deep/ .el-dialog__body {
+    padding: 0 20px 20px 20px !important;
+  }
+</style>