zhouhao 2 anni fa
parent
commit
b211387d5b

+ 10 - 1
src/api/basic_data/dealer.js

@@ -1,4 +1,4 @@
-import request from '@/utils/request'
+import request, { handleImport, postBlob } from '@/utils/request'
 
 //获取经销商列表
 export function getDealerList(params) {
@@ -179,3 +179,12 @@ export function getK3DepartmentList(params) {
     params
   })
 }
+
+// 客户销售单导出
+export function importCustomer(data, name) {
+  return handleImport({
+    url: '/customer/import',
+    data,
+    name
+  })
+}

+ 66 - 0
src/api/sales.js

@@ -46,6 +46,14 @@ export function addFrontOrder(params) {
   })
 }
 
+export function getFrontOrderDetail(params) {
+  return request({
+    url: '/customer/frontOrder/detail',
+    method: 'get',
+    params
+  })
+}
+
 export function getRegion(params) {
   return request({
     url: '/common/region/list',
@@ -53,3 +61,61 @@ export function getRegion(params) {
     params
   })
 }
+
+export function sbumitFrontOrder(params) {
+  return request({
+    url: '/customer/frontOrder/send',
+    method: 'post',
+    data: params
+  })
+}
+
+export function delFrontOrder(params) {
+  return request({
+    url: '/customer/frontOrder/delete',
+    method: 'post',
+    params
+  })
+}
+
+export function delDeleteRefund(params) {
+  return request({
+    url: '/customer/frontOrder/deleteRefund',
+    method: 'post',
+    params
+  })
+}
+
+// 修改客户销售单
+export function updateFrontOrder(params) {
+  return request({
+    url: '/customer/frontOrder/update',
+    method: 'post',
+    data: params
+  })
+}
+
+// 修改客户退货单
+export function updateRefund(params) {
+  return request({
+    url: '/customer/frontOrder/updateRefund',
+    method: 'post',
+    data: params
+  })
+}
+
+export function sendRefund(params) {
+  return request({
+    url: '/customer/frontOrder/sendRefund',
+    method: 'post',
+    data: params
+  })
+}
+
+export function detailRefund(params) {
+  return request({
+    url: '/customer/frontOrder/detailRefund',
+    method: 'get',
+    params
+  })
+}

+ 13 - 5
src/components/ReturnSalesHeader/ReturnSalesHeader.vue

@@ -5,12 +5,12 @@
         <el-col :span="8" class="item">
           <div class="label">销售订单号</div>
           <div class="value">
-            <el-input v-model="details.id" placeholder="引用销售单"></el-input>
+            <el-input disabled placeholder="引用销售单"></el-input>
           </div>
         </el-col>
         <el-col :span="16" class="item">
           <div class="label">退货订单号</div>
-          <div class="value">2222</div>
+          <div class="value">{{ details.id }}</div>
         </el-col>
         <el-col :span="8" class="item">
           <div class="label">商家编号</div>
@@ -42,15 +42,15 @@
         </el-col>
         <el-col :span="8" class="item">
           <div class="label">发货仓库编码</div>
-          <div class="value">2222</div>
+          <div class="value"></div>
         </el-col>
         <el-col :span="8" class="item">
           <div class="label">发货仓库名称</div>
-          <div class="value">{{ details.stockType == 1 ? '前置仓': '商家仓' }}</div>
+          <div class="value">{{ details.stockType == 1 ? '前置仓' : '商家仓' }}</div>
         </el-col>
         <el-col :span="24" class="item">
           <div class="label">退货备注</div>
-          <div class="value">{{details.notes}}</div>
+          <div class="value">{{ details.refundRemark }}</div>
         </el-col>
       </el-row>
     </div>
@@ -67,6 +67,14 @@ export default {
         return {}
       }
     }
+  },
+  data() {
+    return {}
+  },
+  methods: {
+    aa() {
+
+    }
   }
 }
 </script>

+ 28 - 18
src/components/SalesHeader/SalesHeader.vue

@@ -20,6 +20,7 @@
         <el-col :xs="24" :ms="6" :lg="6">
           <el-form-item label="配送日期" prop="pickTime">
             <el-date-picker
+              style="width: 100%"
               v-model="screenForm.pickTime"
               type="datetime"
               size="mini"
@@ -59,25 +60,25 @@
           </el-form-item>
         </el-col>
         <el-col :xs="24" :ms="18" :lg="18" style="display: flex;" class="custom">
-          <el-form-item label="省" prop="province" class="item">
-            <el-select v-model="screenForm.province" placeholder="请选择省" @change="changeProvince"
+          <el-form-item label="省" prop="provinceId" class="item">
+            <el-select v-model="screenForm.provinceId" placeholder="请选择省" @change="changeProvince"
                        style="width: 100%"
             >
               <el-option v-for="item in provinceList" :key="item.id" :label="item.name" :value="item.id"></el-option>
             </el-select>
           </el-form-item>
-          <el-form-item label="市" prop="city" label-width="50px">
-            <el-select v-model="screenForm.city" placeholder="请选择市" @change="changeCity" style="width: 100%">
+          <el-form-item label="市" prop="cityId" label-width="50px">
+            <el-select v-model="screenForm.cityId" placeholder="请选择市" @change="changeCity" style="width: 100%">
               <el-option v-for="item in cityList" :key="item.id" :label="item.name" :value="item.id"></el-option>
             </el-select>
           </el-form-item>
           <el-form-item label="区" prop="area" label-width="50px">
-            <el-select v-model="screenForm.area" placeholder="请选择区" @change="changeArea" style="width: 100%">
+            <el-select v-model="screenForm.areaId" placeholder="请选择区" @change="changeArea" style="width: 100%">
               <el-option v-for="item in areaList" :key="item.id" :label="item.name" :value="item.id"></el-option>
             </el-select>
           </el-form-item>
-          <el-form-item label="街道" prop="street" label-width="50px">
-            <el-select v-model="screenForm.street" placeholder="请选择街道" @change="changeStreet" style="width: 100%">
+          <el-form-item label="街道" prop="streetId" label-width="50px">
+            <el-select v-model="screenForm.streetId" placeholder="请选择街道" @change="changeStreet" style="width: 100%">
               <el-option v-for="item in streetList" :key="item.id" :label="item.name" :value="item.id"></el-option>
             </el-select>
 
@@ -161,37 +162,46 @@ export default {
         }
       })
     },
+    handleArea(value,type){
 
+      this.screenForm[type] =  this[type+'List'].find(k=>k.id===value).name
+
+    },
     // 切换省
     changeProvince(value) {
-      this.screenForm.city = ''
-      this.screenForm.area = ''
-      this.screenForm.street = ''
+      this.screenForm.cityId = ''
+      this.screenForm.areaId = ''
+      this.screenForm.streetId = ''
       this.cityList = []
       this.areaList = []
       this.streetList = []
       this.getRegion(1, value)
+      this.handleArea(value,'province')
     },
 
     // 切换市
     changeCity(value) {
-      this.screenForm.area = ''
-      this.screenForm.street = ''
+      this.screenForm.areaId = ''
+      this.screenForm.streetId = ''
       this.areaList = []
       this.streetList = []
       this.getRegion(2, value)
+      this.handleArea(value,'city')
+
     },
 
     // 切换区
     changeArea(value) {
-      this.screenForm.street = ''
+      this.screenForm.streetId = ''
       this.streetList = []
       this.getRegion(3, value)
+      this.handleArea(value,'area')
+
     },
 
     // 切换街道
     changeStreet(value) {
-
+      this.handleArea(value,'street')
     },
 
     // 初始化省市区街道
@@ -201,16 +211,16 @@ export default {
       getRegion({ pid: id }).then(res => {
         if (level === 0) {
           this.provinceList = res.data
-          nextId = this.screenForm.province = this.provinceList[findElem(this.provinceList, 'name', province)].id
+          nextId = this.screenForm.provinceId = this.provinceList[findElem(this.provinceList, 'name', province)].id
         } else if (level === 1) {
           this.cityList = res.data
-          nextId = this.screenForm.city = this.cityList[findElem(this.cityList, 'name', city)].id
+          nextId = this.screenForm.cityId = this.cityList[findElem(this.cityList, 'name', city)].id
         } else if (level === 2) {
           this.areaList = res.data
-          nextId = this.screenForm.area = this.areaList[findElem(this.areaList, 'name', area)].id
+          nextId = this.screenForm.areaId = this.areaList[findElem(this.areaList, 'name', area)].id
         } else if (level === 3) {
           this.streetList = res.data
-          nextId = this.screenForm.street = this.streetList[findElem(this.streetList, 'name', street)].id
+          nextId = this.screenForm.streetId = this.streetList[findElem(this.streetList, 'name', street)].id
         }
         if (level < 3) {
           level = level + 1

+ 1 - 37
src/components/SalesTable/SalesTable.vue

@@ -63,44 +63,8 @@
         </el-table-column>
       </el-table>
     </div>
+
     <slot />
-    <!--    <div>-->
-    <!--      <h5>物流信息</h5>-->
-    <!--      <div class="diy-table-1">-->
-    <!--        <el-row>-->
-    <!--          <el-col :span="6" class="item">-->
-    <!--            <div class="label">销售政策编号</div>-->
-    <!--            <div class="value">2222</div>-->
-    <!--          </el-col>-->
-    <!--          <el-col :span="6" class="item">-->
-    <!--            <div class="label">销售政策编号</div>-->
-    <!--            <div class="value">2222</div>-->
-    <!--          </el-col>-->
-    <!--          <el-col :span="6" class="item">-->
-    <!--            <div class="label">销售政策编号</div>-->
-    <!--            <div class="value">2222</div>-->
-    <!--          </el-col>-->
-    <!--          <el-col :span="6" class="item">-->
-    <!--            <div class="label">销售政策编号</div>-->
-    <!--            <div class="value">2222</div>-->
-    <!--          </el-col>-->
-    <!--          <el-col :span="6" class="item">-->
-    <!--            <div class="label">销售政策编号</div>-->
-    <!--            <div class="value">2222</div>-->
-    <!--          </el-col>-->
-    <!--        </el-row>-->
-    <!--      </div>-->
-    <!--      <el-timeline :reverse="reverse">-->
-    <!--        <el-timeline-item-->
-    <!--          v-for="(activity, index) in activities"-->
-    <!--          :key="index"-->
-    <!--          :timestamp="activity.timestamp"-->
-    <!--          :color="activity.color"-->
-    <!--        >-->
-    <!--          {{ activity.content }}-->
-    <!--        </el-timeline-item>-->
-    <!--      </el-timeline>-->
-    <!--    </div>-->
     <slot name="events">
       <div>
         <!--        <el-button type="primary" size="mini">保存</el-button>-->

+ 4 - 0
src/views/basic_data/dealer/dealer_list.vue

@@ -26,6 +26,10 @@
         <div class="fr">
           <ExportButton :exUrl="'customer/export'" :exParams="exParams" />
         </div>
+        <div class="fl">
+          <ImportButton :imUrl="'customer/import'" @importSuccess="getList" />
+        </div>
+
       </div>
 
       <div class="mymain-container">

+ 1 - 1
src/views/basic_data/stock/components/WarehouseForm.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <el-page-header @back="$parent.pageType=0" content="新增" style=" padding: 20px 20px 0 20px;"></el-page-header>
+    <el-page-header @back="$parent.pageType=0" :content="$parent.pageType=0?'新增':'编辑'" style=" padding: 20px 20px 0 20px;"></el-page-header>
     <warehousing-header ref="header" />
     <sales-table :dataList="dataList" :column="column" isOperation isSelection @handleSelection="handleSelection">
       <template #bts>

+ 109 - 26
src/views/sales/sales_management/components/customer_sales_details.vue

@@ -3,18 +3,25 @@
     <el-page-header @back="$parent.pageType=0" content="详情" style=" padding: 20px 20px 0 20px;"></el-page-header>
     <sales-header ref="header" />
     <sales-table :dataList="dataList" :column="column" isOperation isSelection @handleSelection="handleSelection">
-      <template #bts>
-        <div>
-          <el-button type="primary" size="mini" @click="dialogVisible=true">添加</el-button>
-          <el-button type="danger" size="mini" @click="delChange">删除</el-button>
+      <!--      <template #bts>-->
+      <!--        <div>-->
+      <!--          <el-button type="primary" size="mini" @click="dialogVisible=true">添加</el-button>-->
+      <!--          <el-button type="danger" size="mini" @click="delChange">删除</el-button>-->
+      <!--        </div>-->
+      <!--      </template>-->
+      <template #events>
+        <div v-if="details.status==1 || details.status==2">
+          <el-button type="primary" size="mini" @click="handelSubmit">通知发货</el-button>
+          <el-button size="mini">撤销发货</el-button>
+        </div>
+        <div v-if="details.status==3">
+          <el-button type="primary" size="mini" @click="handelSubmit">发货</el-button>
+          <el-button size="mini">撤销发货</el-button>
+        </div>
+        <div v-if="details.status==4">
+          <el-button type="primary" size="mini" @click="handelSigning">签收</el-button>
         </div>
       </template>
-<!--      <template #events>-->
-<!--        <div>-->
-<!--          <el-button type="primary" size="mini" @click="handelSubmit">提交</el-button>-->
-<!--          <el-button size="mini">重置</el-button>-->
-<!--        </div>-->
-<!--      </template>-->
       <template v-slot:custom="{item:{row,$index}}">
         <el-radio label="1" v-model="row.flag">增加</el-radio>
         <el-radio label="-1" v-model="row.flag">减少</el-radio>
@@ -28,8 +35,47 @@
           <el-button slot="reference" type="text" size="mini">删除</el-button>
         </el-popconfirm>
       </template>
+      <div>
+        <h5>物流信息</h5>
+        <div class="diy-table-1">
+          <el-row>
+            <el-col :span="6" class="item">
+              <div class="label">销售政策编号</div>
+              <div class="value">2222</div>
+            </el-col>
+            <el-col :span="6" class="item">
+              <div class="label">销售政策编号</div>
+              <div class="value">2222</div>
+            </el-col>
+            <el-col :span="6" class="item">
+              <div class="label">销售政策编号</div>
+              <div class="value">2222</div>
+            </el-col>
+            <el-col :span="6" class="item">
+              <div class="label">销售政策编号</div>
+              <div class="value">2222</div>
+            </el-col>
+            <el-col :span="24" class="item">
+              <div class="label">销售政策编号</div>
+              <div class="value">2222</div>
+            </el-col>
+          </el-row>
+        </div>
+        <el-timeline :reverse="reverse">
+          <el-timeline-item
+            v-for="(activity, index) in activities"
+            :key="index"
+            :timestamp="activity.timestamp"
+            :color="activity.color"
+          >
+            {{ activity.content }}
+          </el-timeline-item>
+        </el-timeline>
+      </div>
     </sales-table>
-    <sales-dialog :dialogVisible="dialogVisible" :customerNumber="customerNumber" :func="getDialogList" @confirm="confirm" />
+    <sales-dialog :dialogVisible="dialogVisible" :customerNumber="customerNumber" :func="getDialogList"
+                  @confirm="confirm"
+    />
   </div>
 </template>
 
@@ -37,8 +83,8 @@
 import SalesDialog from '@/components/SalesDialog/SalesDialog'
 import SalesHeader from '@/components/SalesHeader/SalesHeader'
 import SalesTable from '@/components/SalesTable/SalesTable'
-import {  addFrontOrder } from '@/api/sales'
-import {  getcustomerFrontList } from '@/api/stock'
+import { addFrontOrder, getFrontOrderDetail } from '@/api/sales'
+import { getcustomerFrontList } from '@/api/stock'
 
 export default {
   name: 'WarehouseForm',
@@ -47,13 +93,15 @@ export default {
     SalesTable,
     SalesDialog
   },
+  props: ['detailsId'],
   data() {
     return {
       dialogVisible: false,
-      customerNumber:'',
+      customerNumber: '',
       dataList: [],
+      details: {},
       selection: [],
-      flag:1,
+      flag: 1,
       column: [
         {
           prop: 'materialName',
@@ -72,30 +120,54 @@ export default {
         },
         {
           prop: 'stockLockQty',
-          label: '库存',
+          label: '库存数量',
           width: '180'
         },
         {
-          prop: 'directFlag',
-          label: '发生方向',
-          width: '180',
-          isCustom: true
-
-        },
-        {
-          prop: 'stockChangeQty',
+          prop: 'qty',
           label: '数量',
           width: '180',
           isInput: true
         },
         {
-          prop: 'remark',
+          prop: 'volume',
+          label: '体积',
+          width: '180'
+        },
+        {
+          prop: 'totalVolume',
+          label: '总体积',
+          width: '180'
+        },
+        {
+          prop: 'notes',
           label: '备注',
           width: '180',
           isInput: true
 
         }
-      ]
+      ],
+      activities: [{
+        content: '活动按期开始',
+        color: '#0bbd87',
+        timestamp: '2018-04-15'
+      }, {
+        content: '通过审核',
+        timestamp: '2018-04-13'
+      }, {
+        content: '创建成功',
+        timestamp: '2018-04-11'
+      }]
+
+    }
+  },
+  created() {
+    if (this.detailsId) {
+      getFrontOrderDetail({ id: this.detailsId }).then(res => {
+        this.dataList = res.data.orders
+        this.details = res.data
+        this.$refs.header.screenForm = res.data
+      })
     }
   },
   methods: {
@@ -142,6 +214,17 @@ export default {
         this.$forceUpdate()
       })
     },
+    handelSigning() {
+      this.$confirm('请确定,订单产品客户已完成签收,一旦签收则不能撤销', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(res => {
+
+      }).catch(err => {
+
+      })
+    }
 
   }
 }

+ 51 - 18
src/views/sales/sales_management/components/customer_sales_form.vue

@@ -10,8 +10,13 @@
         </div>
       </template>
       <template #events>
-        <div>
-          <el-button type="primary" size="mini" @click="handelSubmit">提交</el-button>
+        <div v-if="!detailsId">
+          <el-button type="primary" size="mini" @click="handelSubmit(1)">提交</el-button>
+          <el-button size="mini">重置</el-button>
+          <el-button size="mini" :disabled="dis" @click="handleInform(2)">通知发货</el-button>
+        </div>
+        <div v-else>
+          <el-button type="primary" size="mini" @click="handelSubmit(2)">保存</el-button>
           <el-button size="mini">重置</el-button>
         </div>
       </template>
@@ -29,7 +34,9 @@
         </el-popconfirm>
       </template>
     </sales-table>
-    <sales-dialog :dialogVisible="dialogVisible" :customerNumber="customerNumber" :func="getDialogList" @confirm="confirm" />
+    <sales-dialog :dialogVisible="dialogVisible" :customerNumber="customerNumber" :func="getDialogList"
+                  @confirm="confirm"
+    />
   </div>
 </template>
 
@@ -37,8 +44,8 @@
 import SalesDialog from '@/components/SalesDialog/SalesDialog'
 import SalesHeader from '@/components/SalesHeader/SalesHeader'
 import SalesTable from '@/components/SalesTable/SalesTable'
-import {  addFrontOrder } from '@/api/sales'
-import {  getcustomerFrontList } from '@/api/stock'
+import { addFrontOrder, getFrontOrderDetail, sbumitFrontOrder, updateFrontOrder } from '@/api/sales'
+import { getcustomerFrontList } from '@/api/stock'
 
 export default {
   name: 'WarehouseForm',
@@ -47,13 +54,15 @@ export default {
     SalesTable,
     SalesDialog
   },
+  props:['detailsId'],
   data() {
     return {
       dialogVisible: false,
-      customerNumber:'',
+      customerNumber: '',
       dataList: [],
       selection: [],
-      flag:1,
+      flag: 1,
+      dis:true,
       column: [
         {
           prop: 'materialName',
@@ -84,12 +93,12 @@ export default {
         {
           prop: 'volume',
           label: '体积',
-          width: '180',
+          width: '180'
         },
         {
           prop: 'totalVolume',
           label: '总体积',
-          width: '180',
+          width: '180'
         },
         {
           prop: 'notes',
@@ -101,6 +110,14 @@ export default {
       ]
     }
   },
+  created() {
+    if (this.$parent.pageType == 2 || this.detailsId) {
+      getFrontOrderDetail({id:this.detailsId}).then(res=>{
+        this.dataList = res.data.orders
+        this.$refs.header.screenForm = res.data
+      })
+    }
+  },
   methods: {
 
     getDialogList(p) {
@@ -112,7 +129,6 @@ export default {
       this.$refs.header.screenForm.customerName = this.dataList[0].customerName
       this.$refs.header.screenForm.customerNumber = this.dataList[0].customerNumber
       this.$refs.header.screenForm.stockType = this.dataList[0].stockType
-      this.$refs.header.screenForm.id = this.dataList[0].id
       this.customerNumber = this.dataList[0].customerNumber
       this.dialogVisible = false
 
@@ -133,22 +149,39 @@ export default {
     handleSelection(data) {
       this.selection = data
     },
-    handelSubmit() {
+    handleInform(status=2){
+      console.log(33)
+      sbumitFrontOrder({id:this.$refs.header.screenForm.id,status}).then(res=>{
+        console.log(res)
+      })
+},
+    handelSubmit(type,status=1) {
       this.dataList.forEach(k => {
         k.id = ''
         k.directFlag = k.flag
       })
       const params = {
         ...this.$refs.header.screenForm,
+        orders: this.dataList,
+        status:status
+      }
+      if (type==1){
+        addFrontOrder(params).then(res => {
+          this.$successMsg('新增成功')
+          this.dis = false
+          this.$parent.pageType = 0
+          this.$forceUpdate()
+        })
+
+      }else {
+        updateFrontOrder(params).then(res=>{
+          this.$successMsg('编辑成功')
+          this.$parent.pageType = 0
+          this.$forceUpdate()
+        })
 
-        orders: this.dataList
       }
-      addFrontOrder(params).then(res => {
-        this.$successMsg('新增成功')
-        this.$parent.pageType = 0
-        this.$forceUpdate()
-      })
-    },
+    }
 
   }
 }

+ 32 - 17
src/views/sales/sales_management/components/return_sales_details.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <el-page-header @back="$parent.pageType=0" content="详情" style=" padding: 20px 20px 0 20px;"></el-page-header>
-    <return-sales-header ref="header" />
+    <return-sales-header ref="header" :details="details" />
     <sales-table :dataList="dataList" :column="column" isOperation isSelection @handleSelection="handleSelection">
       <template #bts>
         <div>
@@ -29,7 +29,9 @@
         </el-popconfirm>
       </template>
     </sales-table>
-    <sales-dialog :dialogVisible="dialogVisible" :customerNumber="customerNumber" :func="getDialogList" @confirm="confirm" />
+    <sales-dialog :dialogVisible="dialogVisible" :customerNumber="customerNumber" :func="getDialogList"
+                  @confirm="confirm"
+    />
   </div>
 </template>
 
@@ -37,8 +39,8 @@
 import SalesDialog from '@/components/SalesDialog/SalesDialog'
 import ReturnSalesHeader from '@/components/ReturnSalesHeader/ReturnSalesHeader'
 import SalesTable from '@/components/SalesTable/SalesTable'
-import {  addFrontOrder } from '@/api/sales'
-import {  getcustomerFrontList } from '@/api/stock'
+import { addFrontOrder, detailRefund } from '@/api/sales'
+import { getcustomerFrontList } from '@/api/stock'
 
 export default {
   name: 'WarehouseForm',
@@ -47,13 +49,15 @@ export default {
     SalesTable,
     SalesDialog
   },
+  props: ['detailsId'],
   data() {
     return {
       dialogVisible: false,
-      customerNumber:'',
+      customerNumber: '',
       dataList: [],
       selection: [],
-      flag:1,
+      flag: 1,
+      details: {},
       column: [
         {
           prop: 'materialName',
@@ -72,24 +76,27 @@ export default {
         },
         {
           prop: 'stockLockQty',
-          label: '库存',
+          label: '库存数量',
           width: '180'
         },
         {
-          prop: 'directFlag',
-          label: '发生方向',
-          width: '180',
-          isCustom: true
-
-        },
-        {
-          prop: 'stockChangeQty',
+          prop: 'qty',
           label: '数量',
           width: '180',
           isInput: true
         },
         {
-          prop: 'remark',
+          prop: 'volume',
+          label: '体积',
+          width: '180'
+        },
+        {
+          prop: 'totalVolume',
+          label: '总体积',
+          width: '180'
+        },
+        {
+          prop: 'notes',
           label: '备注',
           width: '180',
           isInput: true
@@ -98,6 +105,14 @@ export default {
       ]
     }
   },
+  created() {
+    if (this.detailsId) {
+      detailRefund({ id: this.detailsId }).then(res => {
+        this.dataList = res.data.orders
+        this.details = res.data
+      })
+    }
+  },
   methods: {
     getDialogList(p) {
       return getcustomerFrontList(...p)
@@ -141,7 +156,7 @@ export default {
         this.$parent.pageType = 0
         this.$forceUpdate()
       })
-    },
+    }
 
   }
 }

+ 79 - 27
src/views/sales/sales_management/components/return_sales_form.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <el-page-header @back="$parent.pageType=0" content="新增" style=" padding: 20px 20px 0 20px;"></el-page-header>
-    <return-sales-header ref="header" />
+    <return-sales-header ref="header" :details="details"/>
     <sales-table :dataList="dataList" :column="column" isOperation isSelection @handleSelection="handleSelection">
       <template #bts>
         <div>
@@ -10,10 +10,16 @@
         </div>
       </template>
       <template #events>
-        <div>
-          <el-button type="primary" size="mini" @click="handelSubmit">提交</el-button>
+        <div v-if="!detailsId">
+          <el-button type="primary" size="mini" @click="handelSubmit(1)">提交</el-button>
+          <el-button size="mini">重置</el-button>
+          <el-button size="mini" :disabled="dis" @click="handleInform(2)">通知发货</el-button>
+        </div>
+        <div v-else>
+          <el-button type="primary" size="mini" @click="handelSubmit(2)">保存</el-button>
           <el-button size="mini">重置</el-button>
         </div>
+
       </template>
       <template v-slot:custom="{item:{row,$index}}">
         <el-radio label="1" v-model="row.flag">增加</el-radio>
@@ -37,8 +43,14 @@
 import SalesDialog from '@/components/SalesDialog/SalesDialog'
 import ReturnSalesHeader from '@/components/ReturnSalesHeader/ReturnSalesHeader'
 import SalesTable from '@/components/SalesTable/SalesTable'
-import {  addFrontOrder } from '@/api/sales'
-import {  getcustomerFrontList } from '@/api/stock'
+import {
+  addFrontOrder, detailRefund,
+  getFrontOrderDetail,
+  getFrontOrderList,
+  sbumitFrontOrder,
+  sendRefund,
+  updateRefund
+} from '@/api/sales'
 
 export default {
   name: 'WarehouseForm',
@@ -47,6 +59,7 @@ export default {
     SalesTable,
     SalesDialog
   },
+  props:['detailsId'],
   data() {
     return {
       dialogVisible: false,
@@ -54,6 +67,8 @@ export default {
       dataList: [],
       selection: [],
       flag:1,
+      dis:true,
+      details:{},
       column: [
         {
           prop: 'materialName',
@@ -71,25 +86,33 @@ export default {
           width: '300'
         },
         {
-          prop: 'stockLockQty',
-          label: '库存',
+          prop: 'qty',
+          label: '发货数量',
           width: '180'
         },
         {
-          prop: 'directFlag',
-          label: '发生方向',
+          prop: 'refundQty',
+          label: '退货数量',
           width: '180',
-          isCustom: true
-
+          isInput: true
         },
         {
-          prop: 'stockChangeQty',
-          label: '数量',
+          prop: 'qty',
+          label: '已退数量',
           width: '180',
-          isInput: true
         },
         {
-          prop: 'remark',
+          prop: 'volume',
+          label: '体积',
+          width: '180'
+        },
+        {
+          prop: 'totalVolume',
+          label: '总体积',
+          width: '180'
+        },
+        {
+          prop: 'notes',
           label: '备注',
           width: '180',
           isInput: true
@@ -98,16 +121,30 @@ export default {
       ]
     }
   },
+  created() {
+    if (this.$parent.pageType == 2 || this.detailsId) {
+      detailRefund({id:this.detailsId}).then(res=>{
+        this.dataList = res.data.orders
+        this.details = res.data
+      })
+    }
+  },
   methods: {
     getDialogList(p) {
-      return getcustomerFrontList(...p)
+      return getFrontOrderList(...p)
     },
     confirm(selected) {
+      console.log(selected)
       // console.log(selected)
       this.dataList = selected
-      this.$refs.header.screenForm.customerName = this.dataList[0].customerName
-      this.$refs.header.screenForm.customerNumber = this.dataList[0].customerNumber
-      this.customerNumber = this.dataList[0].customerNumber
+      console.log(this.dataList,selected,this.$refs.header)
+      this.details = this.dataList[0]
+       // this.$refs.header.details.customerName = this.dataList[0].customerName
+       // this.$refs.header.details.customerNumber = this.dataList[0].customerNumber
+       // this.$refs.header.details.customerNumber = this.dataList[0].pickTime
+       // this.$refs.header.details.customerNumber = this.dataList[0].userName
+       // this.$refs.header.details.customerNumber = this.dataList[0].phone
+       // this.$refs.header.details.customerNumber = this.dataList[0].stockType
       this.dialogVisible = false
 
     },
@@ -127,21 +164,36 @@ export default {
     handleSelection(data) {
       this.selection = data
     },
-    handelSubmit() {
+
+    handelSubmit(type,status=1) {
       this.dataList.forEach(k => {
         k.id = ''
         k.directFlag = k.flag
       })
       const params = {
-        ...this.$refs.header.screenForm,
-        orders: this.dataList
+        ...this.$refs.header.details,
+        orders: this.dataList,
+        status
+      }
+      if (type===1){
+        addFrontOrder(params).then(res => {
+          this.$successMsg('新增成功')
+          this.$parent.pageType = 0
+          this.dis =false
+          this.$forceUpdate()
+        })
+
+      }else {
+        updateRefund(params).then(res=>{
+          this.$successMsg('编辑成功')
+          this.$parent.pageType = 0
+          this.$forceUpdate()
+        })
       }
-      addFrontOrder(params).then(res => {
-        this.$successMsg('新增成功')
-        this.$parent.pageType = 0
-        this.$forceUpdate()
-      })
     },
+    handleInform(status=2){
+      sendRefund({id:this.$refs.header.details.id,status})
+    }
 
   }
 }

+ 73 - 22
src/views/sales/sales_management/customer_sales_list.vue

@@ -7,19 +7,20 @@
       ref="pageRef"
       :getList="getList"
       :exportList="exportList"
+      :operation="operation()"
       :columnParsing="columnParsing"
       :optionsEvensGroup="optionsEvensGroup"
     >
     </template-page>
-    <customer_sales_form v-else-if="pageType===1" />
-    <customer_sales_details v-else/>
+    <customer_sales_form :detailsId="detailsId" v-else-if="pageType===1 || pageType ===2" />
+    <customer_sales_details :detailsId="detailsId" v-else/>
   </div>
 </template>
 
 <script>
 import TemplatePage from '@/components/template/template-page-1.vue'
 import import_mixin from '@/components/template/import_mixin.js'
-import { exportCustomerFrontOrder, getFrontOrderList } from '@/api/sales'
+import { delFrontOrder, exportCustomerFrontOrder, getFrontOrderList } from '@/api/sales'
 import customer_sales_form from '@/views/sales/sales_management/components/customer_sales_form'
 import customer_sales_details from '@/views/sales/sales_management/components/customer_sales_details'
 export default {
@@ -27,7 +28,8 @@ export default {
   mixins: [import_mixin],
   data() {
     return {
-      pageType: 2,
+      pageType: 0,
+      detailsId:'',
       // 事件组合
       optionsEvensGroup: [
         [
@@ -40,24 +42,24 @@ export default {
             }
           ]
         ],
-        [
-          [
-            {
-              name: '编辑',
-              click: ()=>{
-                this.pageType = 1
-              }
-            }
-          ]
-        ],
-        [
-          [
-            {
-              name: '删除',
-              click: this.dels
-            }
-          ]
-        ]
+        // [
+        //   [
+        //     {
+        //       name: '编辑',
+        //       click: ()=>{
+        //         this.pageType = 2
+        //       }
+        //     }
+        //   ]
+        // ],
+        // [
+        //   [
+        //     {
+        //       name: '删除',
+        //       click: this.dels
+        //     }
+        //   ]
+        // ]
       ],
       // 表格属性
       tableAttributes: {
@@ -86,7 +88,56 @@ export default {
     // 监听勾选变化
     selectionChange(data) {
       this.recordSelected = data
+    },
+    operation() {
+      return (h, { row, index, column }) => {
+        return (
+          <div class="operation-btns">
+            <el-button
+              size="mini"
+              type="text" onClick={() => {
+              this.detailsId = row.id
+              this.pageType = 3
+
+            }}
+            >
+              查看
+            </el-button>
+            <el-button
+              size="mini"
+              type="text" onClick={() => {
+              this.detailsId = row.id
+              this.pageType = 2
+            }}
+            >
+              编辑
+            </el-button>
+            <el-popconfirm
+              onOnConfirm = {()=>{
+                delFrontOrder({ id: row.id }).then(res => {
+                  this.$successMsg('删除成功')
+                  this.$refs.pageRef.getTableData()
+                })              }}
+              title="删除吗?"
+            >
+              <el-button slot="reference" size="mini" type="text">删除</el-button>
+            </el-popconfirm>
+          </div>
+        )
+      }
+
     }
+// <el-popconfirm
+//   onOnConfirm = {()=>{
+//     deleteCustomerStockOrder({ id: row.id }).then(res => {
+//       this.$successMsg('删除成功')
+//       this.$refs.pageRef.getTableData()
+//     })              }}
+//   title="删除吗?"
+// >
+//   <el-button slot="reference" type="text">删除</el-button>
+// </el-popconfirm>
+
     // 批量删除
     // dels() {
     //   if (this.recordSelected.length) {

+ 44 - 3
src/views/sales/sales_management/return_sales_list.vue

@@ -7,19 +7,20 @@
       ref="pageRef"
       :getList="getList"
       :exportList="exportList"
+      :operation="operation()"
       :columnParsing="columnParsing"
       :optionsEvensGroup="optionsEvensGroup"
     >
     </template-page>
-    <return_sales_form v-else-if="pageType===1"/>
-    <return_sales_details v-else/>
+    <return_sales_form v-else-if="pageType===1" :details-id="detailsId"/>
+    <return_sales_details v-else :details-id="detailsId"/>
   </div>
 </template>
 
 <script>
 import TemplatePage from '@/components/template/template-page-1.vue'
 import import_mixin from '@/components/template/import_mixin.js'
-import { exportRefund, getFrontOrderListRefund } from '@/api/sales'
+import { delDeleteRefund, exportRefund, getFrontOrderListRefund } from '@/api/sales'
 import return_sales_form from '@/views/sales/sales_management/components/return_sales_form'
 import return_sales_details from '@/views/sales/sales_management/components/return_sales_details'
 export default {
@@ -27,6 +28,7 @@ export default {
   mixins: [import_mixin],
   data() {
     return {
+      detailsId:'',
       pageType:0,
       // 事件组合
       optionsEvensGroup: [
@@ -86,7 +88,46 @@ export default {
     // 监听勾选变化
     selectionChange(data) {
       this.recordSelected = data
+    },
+    operation() {
+      return (h, { row, index, column }) => {
+        return (
+          <div class="operation-btns">
+            <el-button
+              size="mini"
+              type="text" onClick={() => {
+              this.detailsId = row.id
+              this.pageType = 3
+
+            }}
+            >
+              查看
+            </el-button>
+            <el-button
+              size="mini"
+              type="text" onClick={() => {
+              this.detailsId = row.id
+              this.pageType = 2
+            }}
+            >
+              编辑
+            </el-button>
+            <el-popconfirm
+              onOnConfirm = {()=>{
+                delDeleteRefund({ id: row.id }).then(res => {
+                  this.$successMsg('删除成功')
+                  this.$refs.pageRef.getTableData()
+                })              }}
+              title="删除吗?"
+            >
+              <el-button slot="reference" size="mini" type="text">删除</el-button>
+            </el-popconfirm>
+          </div>
+        )
+      }
+
     }
+
     // 批量删除
     // dels() {
     //   if (this.recordSelected.length) {