liqianyi 3 gadi atpakaļ
vecāks
revīzija
9da1f528cf

+ 1 - 1
src/api/sale.js

@@ -46,7 +46,7 @@ export function getOrderDetail (id) {
 // 发货列表
 export function getDispatchList (params) {
   return request({
-    url: request.adornUrl(`/biz-service/deliverRecord/list`),
+    url: request.adornUrl(`/biz-service/deliver/list`),
     method: 'get',
     params: params
   })

+ 5 - 37
src/views/modules/order/dispatch-arrived.vue

@@ -1,43 +1,16 @@
 <template>
   <div>
-    <!-- <el-dialog
-      title="订单送达"
-      width="50%"
-      :close-on-click-modal="false"
-      :visible.sync="visible"> -->
       <div class="my-title">订单送达</div>
       <!-- 表单 -->
       <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
         <el-row class="my-row">
-          <el-col :span="12">
-            <el-form-item label="订单编码" prop="orderCode">
-              <el-input v-model="dataForm.orderCode" :disabled="true"></el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="送达时间" prop="arrivedTime">
-              <el-date-picker
-                v-model="dataForm.arrivedTime"
-                value-format="yyyy-MM-dd HH:mm:ss"
-                type="datetime">
-              </el-date-picker>
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row class="my-row">
-          <el-form-item label="客户反馈" prop="customerFeedback">
-            <el-input type="textarea" v-model="dataForm.customerFeedback" placeholder="客户反馈"></el-input>
-          </el-form-item>
-        </el-row>
-        <el-row class="my-row">
-          <upload-component :display="false" :title="'证明附件'" :accept="'*'" :file-obj-list="fileList" @uploadSuccess="uploadSuccess"/>
+          <upload-component :display="false" :title="'签收附件'" :accept="'*'" :file-obj-list="fileList" @uploadSuccess="uploadSuccess"/>
         </el-row>
       </el-form>
       <span slot="footer" class="dialog-footer">
           <el-button @click="onChose">取消</el-button>
           <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
         </span>
-    <!-- </el-dialog> -->
   </div>
 </template>
 
@@ -49,12 +22,9 @@
     components: { UploadComponent },
     data () {
       return {
-        visible: false,
         fileList: [],
         dataForm: {},
         dataRule: {
-          customerFeedback: [{ required: true, message: '客户反馈不能为空', trigger: 'blur' }],
-          arrivedTime: [{ required: true, message: '送达时间不能为空', trigger: 'change' }]
         }
       }
     },
@@ -62,14 +32,12 @@
       onChose () {
         this.$emit('onChose')
       },
-      async init (orderId, orderCode) {
-        if (!orderId) return
+      async init (deliverId) {
+        if (!deliverId) return
         this.fileList = []
         this.dataForm = {
-          orderId: orderId,
-          orderCode: orderCode
+          deliverId: deliverId
         }
-        this.visible = true
       },
       uploadSuccess (fileList) {
         this.fileList = fileList
@@ -96,7 +64,7 @@
               return
             }
             this.$http({
-              url: this.$http.adornUrl(`/biz-service/order/arrived`),
+              url: this.$http.adornUrl(`/biz-service/deliver/arrive`),
               method: 'post',
               data: this.$http.adornData({...this.dataForm})
             }).then(({data}) => {

+ 13 - 0
src/views/modules/order/dispatch-detail.vue

@@ -0,0 +1,13 @@
+<template>
+
+</template>
+
+<script>
+export default {
+  name: 'dispatch-detail'
+}
+</script>
+
+<style scoped>
+
+</style>

+ 93 - 0
src/views/modules/order/dispatch-notice-change-setting.vue

@@ -0,0 +1,93 @@
+<template>
+    <div>
+        <div class="my-title">发货通知人设置</div>
+        <!-- 表单 -->
+        <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
+          <el-row class="my-row">
+            <el-form-item label="通知接收人" prop="userIds">
+              <user-components v-model="dataForm.userIds" :userIds="dataForm.userIds" @change="userSelectedChanged"/>
+            </el-form-item>
+          </el-row>
+        </el-form>
+        <span slot="footer" class="dialog-footer">
+          <el-button @click="onChose">取消</el-button>
+          <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
+        </span>
+    </div>
+</template>
+
+<script>
+  import UserComponents from '../common/user-components'
+
+export default {
+    name: 'dispatch-notice-change-setting',
+    components: {
+      UserComponents
+    },
+    data () {
+      return {
+        visible: false,
+        dataForm: {
+          userIds: []
+        },
+        dataRule: {
+          userIds: [{ required: true, message: '请选择通知接收人', trigger: 'change' }]
+        }
+      }
+    },
+    methods: {
+      onChose () {
+        this.$emit('onChose')
+      },
+      async init () {
+        this.dataForm = {}
+        this.$http({
+          url: this.$http.adornUrl(`/biz-service/deliver/noteChangeConfig`),
+          method: 'get'
+        }).then(({data}) => {
+          if (data && data.code === '200') {
+            this.dataForm = {
+              userIds: data.data
+            }
+          }
+        })
+        this.visible = true
+      },
+      validateField (type) {
+        this.$refs.dataForm.validateField(type)
+      },
+      // 表单提交
+      dataFormSubmit () {
+        this.$refs['dataForm'].validate((valid) => {
+          if (valid) {
+            this.$http({
+              url: this.$http.adornUrl(`/biz-service/deliver/noteChangeConfig`),
+              method: 'post',
+              data: this.dataForm.userIds
+            }).then(({data}) => {
+              if (data && data.code === '200') {
+                this.$message({
+                  message: '操作成功',
+                  type: 'success',
+                  duration: 1500,
+                  onClose: () => {
+                    this.onChose()
+                  }
+                })
+              } else {
+                this.$message.error(data.msg)
+              }
+            })
+          }
+        })
+      },
+      userSelectedChanged (val) {
+        this.dataForm.userIds = val
+      }
+    }
+  }
+</script>
+
+<style scoped>
+
+</style>

+ 168 - 28
src/views/modules/order/dispatch.vue

@@ -1,12 +1,30 @@
+<!-- 发货管理 -->
 <template>
   <div class="order">
-    <template v-if="!previewVisible">
+    <template v-if="!noticeChangeVisible && !attachVisible && !arrivedVisible">
       <el-form :inline="true" :model="dataForm" @keyup.enter.native="queryData()">
-        <el-form-item label="订单编码">
+        <el-form-item label="名称" prop="productName">
+          <el-input v-model="dataForm.productName" placeholder="名称" clearable></el-input>
+        </el-form-item>
+        <el-form-item label="订单编码" prop="orderCode">
           <el-input v-model="dataForm.orderCode" placeholder="订单编码" clearable></el-input>
         </el-form-item>
+        <el-form-item label="生产状态" prop="state">
+          <el-select
+            v-model="dataForm.state"
+            remote
+            placeholder="请选择">
+            <el-option
+              v-for="item in optionsState"
+              :key="item.code"
+              :label="item.value"
+              :value="item.code">
+            </el-option>
+          </el-select>
+        </el-form-item>
         <el-form-item>
           <el-button @click="queryData()">查询</el-button>
+          <el-button v-if="isAuth('order:deliver:noteChangeConfig')" type="primary" @click="setNoticeChangeHandel()">发货通知人设置</el-button>
         </el-form-item>
       </el-form>
       <el-table
@@ -21,6 +39,39 @@
           width="50"
           align="center">
         </el-table-column>
+        <el-table-column
+          prop="productCode"
+          header-align="center"
+          align="center"
+          min-width="140"
+          :show-tooltip-when-overflow="true"
+          label="产品编号">
+        </el-table-column>
+        <el-table-column
+          prop="productName"
+          header-align="center"
+          align="center"
+          min-width="140"
+          :show-tooltip-when-overflow="true"
+          label="产品名称">
+        </el-table-column>
+        <el-table-column
+          prop="deliveryDate"
+          header-align="center"
+          align="center"
+          min-width="160"
+          :show-tooltip-when-overflow="true"
+          label="交期时间">
+        </el-table-column>
+        <el-table-column
+          prop="state"
+          header-align="center"
+          align="center"
+          min-width="80"
+          :formatter="stateFormat"
+          :show-tooltip-when-overflow="true"
+          label="状态">
+        </el-table-column>
         <el-table-column
           prop="orderCode"
           header-align="center"
@@ -30,15 +81,15 @@
           label="订单编码">
         </el-table-column>
         <el-table-column
-          prop="delivererName"
+          prop="customerName"
           header-align="center"
           align="center"
           min-width="120"
           :show-overflow-tooltip="true"
-          label="发货人姓名">
+          label="客户名称">
         </el-table-column>
         <el-table-column
-          prop="deliverTime"
+          prop="deliveryDate"
           header-align="center"
           align="center"
           min-width="160"
@@ -46,31 +97,30 @@
           label="发货时间">
         </el-table-column>
         <el-table-column
-          prop="arrivedTime"
+          prop="arriveDate"
           header-align="center"
           align="center"
           min-width="160"
           label="送达时间">
         </el-table-column>
         <el-table-column
-          prop="customerFeedback"
           header-align="center"
           align="center"
-          min-width="180"
-          :show-tooltip-when-overflow="true"
-          label="客户反馈">
+          label="签收附件">
+          <template slot-scope="scope">
+            <el-button :disabled="!scope.row.attachList || scope.row.attachList.length === 0" type="text" size="small" @click="attachDetails(scope.row)">查看</el-button>
+          </template>
         </el-table-column>
         <el-table-column
-          prop="attachList"
+          fixed="right"
           header-align="center"
           align="center"
-          min-width="200"
-          label="附件">
+          width="120"
+          label="操作">
           <template slot-scope="scope">
-            <div v-for="(item, index) in scope.row.attachList" style="display: inline">
-              <span v-if="index > 0">,</span>
-              <a :key="item.fileName + index" type="primary" href="#" @click="previewFile(item.fileName, item.url)">{{ item.fileName }}</a>
-            </div>
+            <el-button v-if="isAuth('order:deliver:info')" type="text" size="small" @click="detailHandle(scope.row.deliverId)">查看</el-button>
+            <el-button v-if="isAuth('order:deliver:send') && Number(scope.row.state) < 3" type="text" size="small" @click="sendHandle(scope.row.deliverId)">发货</el-button>
+            <el-button v-if="isAuth('order:deliver:arrive') && Number(scope.row.state) === 3" type="text" size="small" @click="arriveHandle(scope.row.deliverId)">送达</el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -87,35 +137,72 @@
 <!--    <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>-->
 <!--    <detail v-if="detailVisible" ref="detail"/>-->
     <!-- 文件预览 -->
-    <preview-component v-if="previewVisible" ref="preview" @onChose="onChose"/>
+    <attach-detail v-if="attachVisible" ref="attachDetail" @onChose="onChose"/>
+    <!-- 发货通知设置弹窗 -->
+    <notice-change-setting v-if="noticeChangeVisible" ref="noticeChangeSetting" @onChose="onChose"/>
+    <!--送达弹窗 -->
+    <dispatch-arrived v-if="arrivedVisible" ref="arrivedPage" @onChose="onChose" @refreshDataList="getDataList"/>
+
   </div>
 </template>
 
 <script>
 import { getDispatchList } from '@/api/sale'
 import PreviewComponent from '../common/preview-component'
+import AttachDetail from '../common/attach-detail'
+import NoticeChangeSetting from './dispatch-notice-change-setting'
+import DispatchArrived from './dispatch-arrived'
 export default {
     // 发货管理
   name: 'dispatch',
-  components: {PreviewComponent},
+  components: {
+    AttachDetail,
+    PreviewComponent,
+    NoticeChangeSetting,
+    DispatchArrived
+  },
   created () {
     this.queryData()
   },
   data () {
     return {
-      previewVisible: false,
       dataForm: {},
       dataList: [],
       pageIndex: 1,
       pageSize: 10,
       totalPage: 0,
       dataListLoading: false,
-      dataListSelections: []
+      dataListSelections: [],
+      attachVisible: false,
+      noticeChangeVisible: false,
+      arrivedVisible: false,
+      optionsState: [
+        {
+          code: null, value: '全部'
+        },
+        {
+          code: '0', value: '待排产'
+        },
+        {
+          code: '1', value: '生产中'
+        },
+        {
+          code: '2', value: '已完成'
+        },
+        {
+          code: '3', value: '发货中'
+        },
+        {
+          code: '4', value: '已送达'
+        }
+      ]
     }
   },
   methods: {
     onChose () {
-      this.previewVisible = false
+      this.attachVisible = false
+      this.noticeChangeVisible = false
+      this.arrivedVisible = false
     },
       // 查询
     queryData () {
@@ -128,7 +215,9 @@ export default {
       let params = {
         'current': this.pageIndex,
         'size': this.pageSize,
-        'orderCode': this.dataForm.orderCode ? this.dataForm.orderCode : null
+        'productName': this.dataForm.productName ? this.dataForm.productName : null,
+        'orderCode': this.dataForm.orderCode ? this.dataForm.orderCode : null,
+        'state': this.dataForm.state ? this.dataForm.state : null
       }
       getDispatchList(params).then(({data}) => {
         if (data && data.code === '200') {
@@ -152,16 +241,67 @@ export default {
       this.pageIndex = val
       this.getDataList()
     },
-      // 多选
+    // 多选
     selectionChangeHandle (val) {
       this.dataListSelections = val
     },
-    // 预览
-    previewFile (fileName, url) {
-      this.previewVisible = true
+    // 发货通知人设置
+    setNoticeChangeHandel () {
+      this.noticeChangeVisible = true
       this.$nextTick(() => {
-        this.$refs.preview.init(fileName, url)
+        this.$refs.noticeChangeSetting.init()
       })
+    },
+    // 附件
+    attachDetails (row) {
+      this.attachVisible = true
+      this.$nextTick(() => {
+        this.$refs.attachDetail.init(row.attachList)
+      })
+    },
+    // 送达
+    arriveHandle (deliverId) {
+      this.arrivedVisible = true
+      this.$nextTick(() => {
+        this.$refs.arrivedPage.init(deliverId)
+      })
+    },
+    // 发货
+    sendHandle (deliverId) {
+      this.$confirm(`确定发货`, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.$http({
+          url: this.$http.adornUrl('/biz-service/deliver/deliver'),
+          method: 'post',
+          data: this.$http.adornData({deliverId: deliverId}, false)
+        }).then(({data}) => {
+          if (data && data.code === '200') {
+            this.$message({
+              message: '操作成功',
+              type: 'success',
+              duration: 1500,
+              onClose: () => {
+                this.getDataList()
+              }
+            })
+          } else {
+            this.$message.error(data.msg)
+          }
+        })
+      }).catch(() => {})
+    },
+    // 转换属性“状态”
+    stateFormat (row) {
+      if (this.optionsState) {
+        for (let i = 0; i < this.optionsState.length; i++) {
+          if (this.optionsState[i].code === row.state) {
+            return this.optionsState[i].value
+          }
+        }
+      }
     }
   }
 }