Przeglądaj źródła

对接店内调出

chenrui 4 lat temu
rodzic
commit
a2ae5d91a1

+ 73 - 3
src/api/storeCallOut.js

@@ -1,6 +1,6 @@
 import { axios } from '@/utils/request'
 
-//  店内调出列表  分页
+//  店内调出 列表  分页
 export const storeCallOutList = (params) => {
   const url = `/storeCallOut/queryPage/${params.pageNo}/${params.pageSize}`
   delete params.pageNo
@@ -11,9 +11,55 @@ export const storeCallOutList = (params) => {
     method: 'post'
   })
 }
-//  店内调出详情列表  分页
+//  店内调出 新增
+export const storeCallOutSave = (params) => {
+  return axios({
+    url: '/storeCallOut/save',
+    data: params,
+    method: 'post'
+  })
+}
+//  店内调出 审核
+export const storeCallOutAudit = (params) => {
+  return axios({
+    url: '/storeCallOut/audit',
+    data: params,
+    method: 'post'
+  })
+}
+//  店内调出 出库
+export const storeCallOutOut = (params) => {
+  return axios({
+    url: '/storeCallOut/out',
+    data: params,
+    method: 'post'
+  })
+}
+//  店内调出 删除
+export const storeCallOutDel = (params) => {
+  return axios({
+    url: `/sparePartsPur/delete/${params.id}`,
+    method: 'get'
+  })
+}
+//  店内调出 详情
+export const storeCallOutDetail = (params) => {
+  return axios({
+    url: `/storeCallOut/findById/${params.id}`,
+    method: 'get'
+  })
+}
+//  店内调出  提交
+export const storeCallOutSubmit = (params) => {
+  return axios({
+    url: '/storeCallOut/submit',
+    data: params,
+    method: 'post'
+  })
+}
+//  店内调出详情 列表  分页
 export const storeCallOutDetailList = (params) => {
-  const url = `/storeCallOut/queryDetailPage/${params.pageNo}/${params.pageSize}`
+  const url = `/storeCallOut/detail/queryPage/${params.pageNo}/${params.pageSize}`
   delete params.pageNo
   delete params.pageSize
   return axios({
@@ -22,3 +68,27 @@ export const storeCallOutDetailList = (params) => {
     method: 'post'
   })
 }
+//  店内调出详情 合计
+export const storeCallOutDetailCount = (params) => {
+  return axios({
+    url: '/storeCallOut/detail/queryCount',
+    data: params,
+    method: 'post'
+  })
+}
+//  店内调出详情 保存
+export const storeCallOutDetailSave = (params) => {
+  return axios({
+    url: '/storeCallOut/detail/save',
+    data: params,
+    method: 'post'
+  })
+}
+//  店内调出详情 删除
+export const storeCallOutDetailDel = (params) => {
+  return axios({
+    url: '/storeCallOut/detail/delete',
+    data: params,
+    method: 'post'
+  })
+}

+ 1 - 1
src/config/router.config.js

@@ -634,7 +634,7 @@ export const asyncRouterMap = [
                 }
               },
               {
-                path: 'edit/:id',
+                path: 'edit/:id/:sn',
                 name: 'storeTransferOutEdit',
                 component: () => import(/* webpackChunkName: "shop" */ '@/views/allocationManagement/storeTransferOut/edit.vue'),
                 meta: {

+ 185 - 90
src/views/allocationManagement/storeTransferOut/basicInfoModal.vue

@@ -1,99 +1,194 @@
 <template>
-	<a-modal centered class="storeTransferOut-basicInfo-modal" :footer="null" :maskClosable="false" title="新增店内调出单" v-model="isShow" @cancle="isShow = false" width="80%">
-		<a-form-model
-			id="storeTransferOut-basicInfo-form"
-			ref="ruleForm"
-			:model="form"
-			:rules="rules"
-			:label-col="formItemLayout.labelCol"
-			:wrapper-col="formItemLayout.wrapperCol"
-		>
-			<a-form-model-item label="调往对象" prop="type">
-			  <a-radio-group v-model="form.type">
-			    <a-radio value="a">客户</a-radio>
-			    <a-radio value="b">员工</a-radio>
-			  </a-radio-group>
-			</a-form-model-item>
-			<a-form-model-item label="调往对象名称" prop="name">
-			  <a-select v-if="form.type=='a'" v-model="form.name" placeholder="请选择" allowClear :showSearch="true" option-filter-prop="children" :filter-option="filterOption">
-			  	<a-select-option v-for="item in brandData" :key="item.salesChannelNo" :value="item.salesChannelNo">{{ item.salesChannelName }}</a-select-option>
-			  </a-select>
-        <a-input v-if="form.type=='b'" v-model="form.name" placeholder="请输入调往对象名称(最多30个字符)" allowClear :maxLength="30" />
-			</a-form-model-item>
-      <a-form-model-item label="调拨类型" prop="sort">
-      	<v-select
-      		v-model="form.billStatus"
-      		ref="billStatus"
-      		id="storeTransferOut-basicInfo-billStatus"
-      		code="PAYMENT_TYPE"
-      		placeholder="请选择调拨类型"
-      		allowClear
-      	></v-select>
+  <a-modal
+    centered
+    class="storeTransferOut-basicInfo-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="新增店内调出单"
+    v-model="isShow"
+    @cancle="isShow = false"
+    width="80%">
+    <a-form-model
+      id="storeTransferOut-basicInfo-form"
+      ref="ruleForm"
+      :model="form"
+      :rules="rules"
+      :label-col="formItemLayout.labelCol"
+      :wrapper-col="formItemLayout.wrapperCol"
+    >
+      <a-form-model-item label="调往对象" prop="putPersonType">
+        <a-radio-group v-model="form.putPersonType" @change="putPersonTypeChange">
+          <a-radio v-for="(item,index) in putPersonTypeList" :key="index" :value="item.code">{{ item.dispName }}</a-radio>
+        </a-radio-group>
       </a-form-model-item>
-			<a-form-model-item label="备注" prop="remarks">
-				<a-textarea id="storeTransferOut-basicInfo-remarks" :maxLength="120" v-model="form.remarks" placeholder="请输入备注(最多120个字符)" allowClear />
-			</a-form-model-item>
-		</a-form-model>
-		<div class="btn-cont">
-			<a-button type="primary" id="storeTransferOut-basicInfo-modal-save" @click="handleSave">保存</a-button>
-			<a-button id="storeTransferOut-basicInfo-modal-back" @click="isShow = false" style="margin-left: 15px;">取消</a-button>
-		</div>
-	</a-modal>
+      <a-form-model-item label="调往对象名称" :prop="isCustomer ? 'putPersonSn' : 'putPersonName'">
+        <a-select
+          v-if="isCustomer"
+          v-model="form.putPersonSn"
+          placeholder="请选择"
+          allowClear
+          :showSearch="true"
+          option-filter-prop="children"
+          :filter-option="filterOption"
+          @change="putPersonChange">
+          <a-select-option v-for="item in custData" :key="item.customerSn" :value="item.customerSn">{{ item.customerName }}</a-select-option>
+        </a-select>
+        <a-input v-if="!isCustomer" v-model="form.putPersonName" placeholder="请输入调往对象名称(最多30个字符)" allowClear :maxLength="30" />
+      </a-form-model-item>
+      <a-form-model-item label="调拨类型" prop="callOutType">
+        <a-select v-model="form.callOutType" placeholder="请选择调拨类型" allowClear >
+          <a-select-option v-for="item in storeCallOutTypeList" :key="item.storeCallOutTypeSn" :value="item.storeCallOutTypeSn">{{ item.name }}</a-select-option>
+        </a-select>
+      </a-form-model-item>
+      <a-form-model-item label="备注" prop="remark">
+        <a-textarea id="storeTransferOut-basicInfo-remark" :maxLength="120" v-model="form.remark" placeholder="请输入备注(最多120个字符)" allowClear />
+      </a-form-model-item>
+    </a-form-model>
+    <div class="btn-cont">
+      <a-button type="primary" id="storeTransferOut-basicInfo-modal-save" @click="handleSave">保存</a-button>
+      <a-button id="storeTransferOut-basicInfo-modal-back" @click="isShow = false" style="margin-left: 15px;">取消</a-button>
+    </div>
+  </a-modal>
 </template>
 
 <script>
-import { VSelect } from '@/components';
+import { VSelect } from '@/components'
+import { storeCallOutSave } from '@/api/storeCallOut'
+import { custAllList } from '@/api/customer'
+import { getLookUpData } from '@/api/data'
+import { storeCallOutTypeAllList } from '@/api/storeCallOutType'
 export default {
-	name: 'storeTransferOutBasicInfoModal',
-	components: { VSelect },
-	props: {
-		openModal: {
-			//  弹框显示状态
-			type: Boolean,
-			default: false
-		}
-	},
-	data() {
-		return {
-			isShow: this.openModal, //  是否打开弹框
-			formItemLayout: {
-				labelCol: { span: 6 },
-				wrapperCol: { span: 16 }
-			},
-			form: {
-        type: 'a',
-				name: undefined, // 仓库名称
-				sort: '' //  排序
-			},
-			rules: {
-				name: [{ required: true, message: '请选择调出产品类型', trigger: 'change' }]
-			},
-			brandData: [] //  供应商  下拉数据
-		};
-	},
-	methods: {
-		//  保存
-		handleSave() {
-			this.isShow = false
-			this.$emit('ok')
-		},
-		filterOption(input, option) {
-			return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
-		}
-	},
-	watch: {
-		//  父页面传过来的弹框状态
-		openModal(newValue, oldValue) {
-			this.isShow = newValue
-		},
-		//  重定义的弹框状态
-		isShow(newValue, oldValue) {
-			if (!newValue) {
-				this.$emit('close')
-			}
-		}
-	}
-};
+  name: 'StoreTransferOutBasicInfoModal',
+  components: { VSelect },
+  props: {
+    openModal: {
+      //  弹框显示状态
+      type: Boolean,
+      default: false
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      formItemLayout: {
+        labelCol: { span: 6 },
+        wrapperCol: { span: 16 }
+      },
+      form: {
+        putPersonType: 'CUSTOMER',
+        putPersonSn: undefined,
+        putPersonName: '',
+        callOutType: undefined,
+        remark: ''
+      },
+      rules: {
+        putPersonType: [{ required: true, message: '请选择调往对象', trigger: 'change' }],
+        putPersonSn: [{ required: true, message: '请选择调往对象名称', trigger: 'change' }],
+        putPersonName: [{ required: true, message: '请输入调往对象名称', trigger: 'blur' }],
+        callOutType: [{ required: true, message: '请选择调拨类型', trigger: 'change' }]
+      },
+      custData: [], //  调往对象  下拉数据
+      putPersonTypeList: [], //  调往对象类型
+      storeCallOutTypeList: [] //  调拨类型
+    }
+  },
+  computed: {
+    // 当前所选调往对象是否为客户
+    isCustomer () {
+      return this.form.putPersonType == 'CUSTOMER'
+    }
+  },
+  methods: {
+    //  保存
+    handleSave () {
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          const form = JSON.parse(JSON.stringify(_this.form))
+          storeCallOutSave(form).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              setTimeout(() => {
+                _this.isShow = false
+                _this.$emit('ok', res.data)
+              }, 1000)
+            }
+          })
+        } else {
+          console.log('error submit!!')
+          return false
+        }
+      })
+    },
+    // 调往对象  change
+    putPersonTypeChange (e) {
+      this.$refs.ruleForm.resetFields()
+      this.form.putPersonSn = undefined
+      this.form.putPersonName = ''
+      this.form.putPersonType = e.target.value
+    },
+    // 调往对象名称  change
+    putPersonChange (val) {
+      const ind = this.custData.findIndex(item => item.customerSn == val)
+      this.form.putPersonName = this.custData[ind].customerName
+    },
+    // 调往对象列表
+    getCustAllList () {
+      custAllList().then(res => {
+        if (res.status == 200) {
+          this.custData = res.data
+        } else {
+          this.custData = []
+        }
+      })
+    },
+    // 调往对象类型
+    getPutPersonTypeList () {
+      const _this = this
+      getLookUpData({
+        pageNo: 1,
+        pageSize: 1000,
+        lookupCode: 'PUT_PERSON_TYPE'
+      }).then(res => {
+        if (res.status == 200) {
+          _this.putPersonTypeList = res.data.list
+        } else {
+          _this.putPersonTypeList = []
+        }
+      })
+    },
+    //  调拨类型
+    getStoreCallOutTypeAllList () {
+      storeCallOutTypeAllList().then(res => {
+        if (res.status == 200) {
+          this.storeCallOutTypeList = res.data
+        } else {
+          this.storeCallOutTypeList = []
+        }
+      })
+    },
+    filterOption (input, option) {
+      return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+        this.$refs.ruleForm.resetFields()
+      } else {
+        this.getCustAllList()
+        this.getPutPersonTypeList()
+        this.getStoreCallOutTypeAllList()
+      }
+    }
+  }
+}
 </script>
 
 <style lang="less">

+ 53 - 43
src/views/allocationManagement/storeTransferOut/detail.vue

@@ -1,9 +1,9 @@
 <template>
   <div class="storeTransferOutDetail-wrap">
-    <a-page-header :ghost="false" @back="handleBack" class="storeTransferOutDetail-back">
+    <a-page-header :ghost="false" :backIcon="false" class="storeTransferOutDetail-back" >
       <!-- 自定义的二级文字标题 -->
       <template slot="subTitle">
-        <a id="storeTransferOutDetail-back-btn" href="javascript:;" @click="handleBack">返回列表</a>
+        <a id="storeTransferOutDetail-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
       </template>
       <!-- 操作区,位于 title 行的行尾 -->
       <template slot="extra">
@@ -12,96 +12,106 @@
       </template>
     </a-page-header>
     <a-card size="small" :bordered="false" class="storeTransferOutDetail-cont">
-      <a-descriptions :column="3">
-        <a-descriptions-item label="调往对象">箭冠营销中心</a-descriptions-item>
-        <a-descriptions-item label="店内调出单号">箭冠营销中心</a-descriptions-item>
-        <a-descriptions-item label="审核状态">箭冠营销中心</a-descriptions-item>
-        <a-descriptions-item label="完结状态">箭冠营销中心</a-descriptions-item>
-        <a-descriptions-item label="调拨类型">箭冠营销中心</a-descriptions-item>
-        <a-descriptions-item label="备注">箭冠营销中心</a-descriptions-item>
-      </a-descriptions>
+      <a-collapse :activeKey="['1']">
+        <a-collapse-panel key="1" header="基础信息">
+          <a-descriptions :column="3">
+            <a-descriptions-item label="调往对象名称">{{ (basicInfoData&&basicInfoData.putPersonName) || '--' }}</a-descriptions-item>
+            <a-descriptions-item label="店内调出单号">{{ (basicInfoData&&basicInfoData.storeCallOutNo) || '--' }}</a-descriptions-item>
+            <a-descriptions-item label="业务状态">{{ (basicInfoData&&basicInfoData.stateDictValue) || '--' }}</a-descriptions-item>
+            <a-descriptions-item label="财务状态">{{ (basicInfoData&&basicInfoData.settleStateDictValue) || '--' }}</a-descriptions-item>
+            <a-descriptions-item label="调拨类型">{{ (basicInfoData&&basicInfoData.callOutTypeName) || '--' }}</a-descriptions-item>
+            <a-descriptions-item label="备注">{{ (basicInfoData&&basicInfoData.remarks) || '--' }}</a-descriptions-item>
+          </a-descriptions>
+        </a-collapse-panel>
+      </a-collapse>
     </a-card>
     <a-card size="small" :bordered="false" class="storeTransferOutDetail-cont">
       <!-- 总计 -->
       <a-alert type="info" showIcon style="margin-bottom:15px">
-        <div slot="message">总款数:<strong>1</strong>;总数量:<strong>1</strong>;总成本(¥):<strong>240</strong></div>
+        <div slot="message">总款数 <strong>{{ (productTotal&&productTotal.productTotalCategory) || 0 }}</strong> ,总数量 <strong>{{ (productTotal&&productTotal.productTotalQty) || 0 }}</strong> ,总成本¥<strong>{{ (productTotal&&productTotal.productTotalCost) || 0 }}</strong></div>
       </a-alert>
       <!-- 列表 -->
       <s-table
         class="sTable"
         ref="table"
-        size="default"
+        size="small"
         :rowKey="(record) => record.id"
         :columns="columns"
         :data="loadData"
-        :scroll="{ x: 955 }"
+        :scroll="{ x: 995 }"
         bordered>
-        <!-- 成本小计 -->
-        <template slot="totalCost" slot-scope="text, record">
-          <span>{{ (record.outCost * record.outQty) || 0 }}</span>
-        </template>
       </s-table>
     </a-card>
   </div>
 </template>
 
 <script>
-import { storeCallOutDetailList } from '@/api/storeCallOut'
 import { STable, VSelect } from '@/components'
+import { getOperationalPrecision } from '@/libs/tools.js'
+import { storeCallOutDetailList, storeCallOutDetail, storeCallOutDetailCount } from '@/api/storeCallOut'
 export default {
   components: { STable, VSelect },
   data () {
     return {
-      queryParam: {
-        storeCallOutSn: this.$route.params.sn
-      },
-      disabled: false, //  查询、重置按钮是否可操作
-      brandData: [], //  产品品牌  下拉数据
-      typeData: [], //  产品类别  下拉数据
       // 表头
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
-        { title: '产品编码', dataIndex: 'productCode', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'productCode', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品名称', dataIndex: 'productName', align: 'center', ellipsis: true },
         { title: '单位', dataIndex: 'productUnit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '成本价(¥)', dataIndex: 'outCost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '调出仓库', dataIndex: 'warehouseName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '调出数量', dataIndex: 'outQty', width: 100, align: 'center' },
-        { title: '成本小计(¥)', scopedSlots: { customRender: 'totalCost' }, width: 135, align: 'center' }
+        { title: '成本小计(¥)', dataIndex: 'costSubtotal', width: 115, align: 'center' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
-        this.disabled = true
-        this.queryParam = {}
-        return storeCallOutDetailList(Object.assign(parameter, this.queryParam)).then(res => {
+        return storeCallOutDetailList(Object.assign(parameter, { storeCallOutSn: this.$route.params.sn })).then(res => {
           const data = res.data
           const no = (data.pageNo - 1) * data.pageSize
           for (var i = 0; i < data.list.length; i++) {
             data.list[i].no = no + i + 1
+            // 成本小计  由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
+            data.list[i].costSubtotal = getOperationalPrecision(data.list[i].outCost, data.list[i].outQty)
           }
-          this.disabled = false
           return data
         })
-      }
+      },
+      basicInfoData: null, //  基本信息
+      productTotal: null //  合计
     }
   },
   methods: {
-    //  重置
-    resetSearchForm () {
-      this.queryParam.orderBundleNo = ''
-      this.queryParam.orderBundle.custMobile = ''
-      this.queryParam.bundleName = ''
-      this.queryParam.itemName = ''
-      this.oldTime = undefined
-      this.newTime = undefined
-      this.$refs.table.refresh(true)
-    },
-    //  提交
-    handleSubmit () {},
     //  返回列表
     handleBack () {
       this.$router.push({ path: '/allocationManagement/storeTransferOut/list' })
+    },
+    // 基本信息
+    getDetail () {
+      storeCallOutDetail({ id: this.$route.params.id }).then(res => {
+        if (res.status == 200) {
+          this.basicInfoData = res.data
+        } else {
+          this.basicInfoData = null
+        }
+      })
+    },
+    // 合计
+    getDetailCount () {
+      storeCallOutDetailCount({ storeCallOutSn: this.$route.params.sn }).then(res => {
+        if (res.status == 200) {
+          this.productTotal = res.data
+        } else {
+          this.productTotal = null
+        }
+      })
     }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {
+      vm.getDetail()
+      vm.getDetailCount()
+    })
   }
 }
 </script>

+ 291 - 135
src/views/allocationManagement/storeTransferOut/edit.vue

@@ -1,9 +1,9 @@
 <template>
   <div class="storeTransferOutEdit-wrap">
-    <a-page-header :ghost="false" @back="handleBack" class="storeTransferOutEdit-back">
+    <a-page-header :ghost="false" :backIcon="false" class="storeTransferOutEdit-back" >
       <!-- 自定义的二级文字标题 -->
       <template slot="subTitle">
-        <a id="storeTransferOutEdit-back-btn" href="javascript:;" @click="handleBack">返回列表</a>
+        <a id="storeTransferOutEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
       </template>
       <!-- 操作区,位于 title 行的行尾 -->
       <template slot="extra">
@@ -17,17 +17,10 @@
         <a-collapse-panel key="1">
           <template slot="header">
             基础信息
-            <a-button
-              type="primary"
-              shape="circle"
-              size="small"
-              icon="edit"
-              class="edit-circle-btn"
-              id="storeTransferOutEdit-circle-btn"
-              @click.stop="handleEditInfo" />
+            <!-- <a-button type="primary" shape="circle" size="small" icon="edit" class="edit-circle-btn" id="storeTransferOutEdit-circle-btn" @click.stop="handleEditInfo" /> -->
           </template>
           <a-descriptions :column="3">
-            <a-descriptions-item label="调往对象">箭冠营销中心</a-descriptions-item>
+            <a-descriptions-item label="调往对象名称">{{ (basicInfoData&&basicInfoData.putPersonName) || '--' }}</a-descriptions-item>
           </a-descriptions>
         </a-collapse-panel>
       </a-collapse>
@@ -41,43 +34,47 @@
             <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
               <a-row :gutter="15">
                 <a-col :md="6" :sm="24">
-                  <a-form-item label="产品编码" prop="name">
-                    <a-input id="storeTransferOutEdit-name" v-model="queryParam.name" placeholder="请输入产品编码" allowClear />
+                  <a-form-item label="产品编码" prop="productCode">
+                    <a-input id="storeTransferOutEdit-productCode" v-model="queryParam.productCode" placeholder="请输入产品编码" allowClear />
                   </a-form-item>
                 </a-col>
                 <a-col :md="6" :sm="24">
-                  <a-form-item label="产品名称" prop="name">
-                    <a-input id="storeTransferOutEdit-name" v-model="queryParam.name" placeholder="请输入产品名称" allowClear />
+                  <a-form-item label="产品名称" prop="productName">
+                    <a-input id="storeTransferOutEdit-productName" v-model="queryParam.productName" placeholder="请输入产品名称" allowClear />
                   </a-form-item>
                 </a-col>
                 <a-col :md="6" :sm="24">
                   <a-form-item label="仓库">
-                    <v-select
-                      v-model="queryParam.billStatus"
-                      ref="billStatus"
-                      id="storeTransferOutEdit-billStatus"
-                      code="PAYMENT_TYPE"
-                      placeholder="请选择仓库"
-                      allowClear></v-select>
+                    <a-select id="storeTransferOutEdit-warehouseSn" placeholder="请选择仓库" v-model="queryParam.warehouseSn" >
+                      <a-select-option v-for="item in warehouseList" :key="item.warehouseSn" :value="item.warehouseSn">{{ item.name }}</a-select-option>
+                    </a-select>
                   </a-form-item>
                 </a-col>
                 <template v-if="advanced">
                   <a-col :md="6" :sm="24">
-                    <a-form-item label="产品类别">
-                      <a-cascader :options="typeData" id="storeTransferOutEdit-state" placeholder="请选择产品类别" allowClear v-model="queryParam.brand" />
+                    <a-form-item label="产品分类">
+                      <a-cascader
+                        @change="changeProductType"
+                        change-on-select
+                        v-model="productType"
+                        :options="productTypeList"
+                        :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
+                        id="storeTransferOutEdit-productType"
+                        placeholder="请选择产品分类"
+                        allowClear />
                     </a-form-item>
                   </a-col>
                   <a-col :md="6" :sm="24">
                     <a-form-item label="产品品牌">
                       <a-select
-                        placeholder="请选择"
-                        id="storeTransferOutEdit-state"
+                        placeholder="请选择产品品牌"
+                        id="storeTransferOutEdit-brandSn"
                         allowClear
-                        v-model="queryParam.dataSourceNo"
+                        v-model="queryParam.brandSn"
                         :showSearch="true"
                         option-filter-prop="children"
                         :filter-option="filterOption">
-                        <a-select-option v-for="item in brandData" :key="item.salesChannelNo" :value="item.salesChannelNo">{{ item.salesChannelName }}</a-select-option>
+                        <a-select-option v-for="item in productBrandList" :key="item.brandSn" :value="item.brandSn">{{ item.brandName }}</a-select-option>
                       </a-select>
                     </a-form-item>
                   </a-col>
@@ -97,15 +94,15 @@
           <s-table
             class="sTable"
             ref="table"
-            size="default"
-            :rowKey="(record) => record.id"
+            size="small"
+            :rowKey="(record) => record.stockSn+record.productSn+record.warehouseSn+record.warehouseLocationSn"
             :columns="columns"
             :data="loadData"
-            :scroll="{ x: 1020 }"
+            :scroll="{ x: 1080, y: 300 }"
             bordered>
             <!-- 操作 -->
             <template slot="action" slot-scope="text, record">
-              <a-button size="small" type="link" @click="handleAdd(record)" id="storeTransferOutEdit-add-btn">添加</a-button>
+              <a-button size="small" type="primary" class="button-primary" @click="handleAdd(record)" id="storeTransferOutEdit-add-btn">添加</a-button>
             </template>
           </s-table>
         </a-collapse-panel>
@@ -117,27 +114,27 @@
         <a-collapse-panel key="1" header="已选产品">
           <!-- 总计 -->
           <a-alert type="info" showIcon style="margin-bottom:15px">
-            <div slot="message">总成本:¥<strong>6.33</strong>,总款数: <strong>6</strong> ,总数量: <strong>6</strong> </div>
+            <div slot="message">总款数 <strong>{{ (productTotal&&productTotal.productTotalCategory) || 0 }}</strong> ,总数量 <strong>{{ (productTotal&&productTotal.productTotalQty) || 0 }}</strong> ,总成本¥<strong>{{ (productTotal&&productTotal.productTotalCost) || 0 }}</strong></div>
           </a-alert>
           <!-- 筛选条件 -->
           <a-row :gutter="15" justify="space-between">
             <a-col :span="21">
               <div class="table-page-search-wrapper">
-                <a-form layout="inline" @keyup.enter.native="$refs.chooseTable.refresh(true)">
+                <a-form layout="inline" @keyup.enter.native="getChooseProductList(1)">
                   <a-row :gutter="15">
-                    <a-col :md="9" :sm="24">
-                      <a-form-item label="产品编码" prop="name">
-                        <a-input id="storeTransferOutEdit-name" v-model="queryParam.name" placeholder="请输入产品编码" allowClear />
+                    <a-col :md="6" :sm="24">
+                      <a-form-item label="产品编码" prop="productCode">
+                        <a-input id="storeTransferOutEdit-productCode" v-model="chooseQueryParam.productCode" placeholder="请输入产品编码" allowClear />
                       </a-form-item>
                     </a-col>
-                    <a-col :md="9" :sm="24">
-                      <a-form-item label="产品名称" prop="name">
-                        <a-input id="storeTransferOutEdit-name" v-model="queryParam.name" placeholder="请输入产品名称" allowClear />
+                    <a-col :md="6" :sm="24">
+                      <a-form-item label="产品名称" prop="productName">
+                        <a-input id="storeTransferOutEdit-productName" v-model="chooseQueryParam.productName" placeholder="请输入产品名称" allowClear />
                       </a-form-item>
                     </a-col>
                     <a-col :md="6" :sm="24" style="margin-bottom: 24px;">
-                      <a-button type="primary" @click="$refs.chooseTable.refresh(true)" :disabled="disabled" id="storeTransferOutList-refresh">查询</a-button>
-                      <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="storeTransferOutList-reset">重置</a-button>
+                      <a-button type="primary" @click="getChooseProductList(1)" :disabled="chooseDisabled" id="storeTransferOutList-refresh">查询</a-button>
+                      <a-button style="margin-left: 8px" @click="chooseResetSearchForm" :disabled="chooseDisabled" id="storeTransferOutList-reset">重置</a-button>
                     </a-col>
                   </a-row>
                 </a-form>
@@ -148,30 +145,33 @@
             </a-col>
           </a-row>
           <!-- 列表 -->
-          <s-table
+          <a-table
             class="sTable"
             ref="chooseTable"
-            size="default"
+            size="small"
             :rowKey="(record) => record.id"
             :columns="chooseColumns"
-            :data="chooseLoadData"
-            :scroll="{ x: 1235 }"
+            :dataSource="chooseLoadData"
+            :scroll="{ x: 1185, y: 300 }"
+            :pagination="choosePaginationProps"
             bordered>
             <!-- 调出数量 -->
-            <template slot="transferOutQuantity" slot-scope="text, record">
+            <template slot="outQty" slot-scope="text, record">
               <a-input-number
-                id="storeTransferOutEdit-storageQuantity"
-                :value="record.storageQuantity"
+                id="storeTransferOutEdit-outQty"
+                v-model="record.outQty"
                 :precision="0"
                 :min="0"
                 :max="999999"
-                placeholder="请输入" />
+                placeholder="请输入"
+                @blur="e => outQtyChange(e.target.value, record)"
+                style="width: 100%;" />
             </template>
             <!-- 操作 -->
             <template slot="action" slot-scope="text, record">
-              <a-button size="small" type="link" @click="handleDel(record)" id="storeTransferOutEdit-del-btn">删除</a-button>
+              <a-button size="small" type="primary" class="button-error" @click="handleDel(record)" id="storeTransferOutEdit-del-btn">删除</a-button>
             </template>
-          </s-table>
+          </a-table>
         </a-collapse-panel>
       </a-collapse>
     </a-card>
@@ -188,120 +188,168 @@
 <script>
 import { STable, VSelect } from '@/components'
 import basicInfoModal from './basicInfoModal.vue'
+import { getOperationalPrecision } from '@/libs/tools.js'
+import { storeCallOutDetailList, storeCallOutDetail, storeCallOutDetailCount, storeCallOutDetailSave, storeCallOutDetailDel, storeCallOutSubmit } from '@/api/storeCallOut'
+import { dealerProductBrandQuery } from '@/api/dealerProductBrand'
+import { dealerProductTypeList } from '@/api/dealerProductType'
+import { warehouseAllList } from '@/api/warehouse'
+import { productQuery } from '@/api/allocWarehouse'
 export default {
   components: { STable, VSelect, basicInfoModal },
   data () {
     return {
       queryParam: {
-
+        productCode: '',
+        productName: '',
+        warehouseSn: undefined,
+        brandSn: undefined,
+        productTypeSn1: undefined,
+        productTypeSn2: undefined,
+        productTypeSn3: undefined
+      },
+      chooseQueryParam: {
+        productCode: '',
+        productName: ''
       },
-      brandData: [], //  产品品牌  下拉数据
-      typeData: [], //  产品类别  下拉数据
       disabled: false, //  查询、重置按钮是否可操作
+      chooseDisabled: false, //  查询、重置按钮是否可操作
       advanced: false, // 高级搜索 展开/关闭
+      productBrandList: [], //  产品品牌  下拉数据
+      productTypeList: [], //  产品分类  下拉数据
+      productType: [],
+      warehouseList: [], //  仓库  下拉数据
       // 表头
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
-        { title: '产品编码', dataIndex: 'creatDate', width: 140, align: 'center' },
-        { title: '产品名称', dataIndex: 'custNahme', align: 'center', ellipsis: true },
-        { title: '单位', dataIndex: 'custsNsagme', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '仓库', dataIndex: 'custsNdame', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '仓位', dataIndex: 'custsNafme', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '库存数量', dataIndex: 'custsNagme', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '成本价(¥)', dataIndex: 'storageQuantity', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '产品编码', dataIndex: 'productCode', width: 200, align: 'center' },
+        { title: '产品名称', dataIndex: 'productName', align: 'center', ellipsis: true },
+        { title: '单位', dataIndex: 'unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '仓库', dataIndex: 'warehouseName', width: 100, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '仓位', dataIndex: 'warehouseLocationName', width: 100, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '库存数量', dataIndex: 'currentQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '成本价(¥)', dataIndex: 'putCost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
-        // return customerBundleDelayList( Object.assign(parameter, this.queryParam) ).then(res => {
-        //   const data = res.data
-        //   const no = (data.pageNo - 1) * data.pageSize
-        //   for (var i = 0; i < data.list.length; i++) {
-        //     data.list[i].no = no + i + 1
-        //   }
-        //   this.disabled = false
-        //   return data
-        // })
-        const _this = this
-        return new Promise(function (resolve, reject) {
-          const data = {
-            pageNo: 1,
-            pageSize: 10,
-            list: [
-              { id: '1', purchaseNo: 'jgqp11111111111', creatDate: '产品1', custName: 'jgqp111123545', totalP: '箭冠品牌', totalNums: '产品分类1', totalPrice: '5', payType: '122' }
-            ],
-            count: 10
-          }
+        return productQuery(Object.assign(parameter, this.queryParam)).then(res => {
+          const data = res.data
           const no = (data.pageNo - 1) * data.pageSize
           for (var i = 0; i < data.list.length; i++) {
             data.list[i].no = no + i + 1
           }
-          _this.disabled = false
-          resolve(data)
+          this.disabled = false
+          return data
         })
       },
       // 表头
       chooseColumns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
-        { title: '产品编码', dataIndex: 'creatDate', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'custNahme', align: 'center', ellipsis: true },
-        { title: '单位', dataIndex: 'custsNsagme', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '成本价(¥)', dataIndex: 'storageQuantity', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '仓库', dataIndex: 'custsNdame', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '仓位', dataIndex: 'custsNafme', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '调出数量', scopedSlots: { customRender: 'transferOutQuantity' }, width: 150, align: 'center' },
-        { title: '成本小计(¥)', dataIndex: 'custsNagme', width: 115, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: 150, align: 'center', fixed: 'right' }
+        { title: '产品编码', dataIndex: 'productCode', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', align: 'center', ellipsis: true },
+        { title: '单位', dataIndex: 'productUnit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '成本价(¥)', dataIndex: 'outCost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '仓库', dataIndex: 'warehouseName', width: 100, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '仓位', dataIndex: 'warehouseLocationName', width: 100, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '调出数量', scopedSlots: { customRender: 'outQty' }, width: 150, align: 'center' },
+        { title: '成本小计(¥)', dataIndex: 'costSubtotal', width: 115, align: 'center' },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
       ],
-      // 加载数据方法 必须为 Promise 对象
-      chooseLoadData: parameter => {
-        this.disabled = true
-        // return customerBundleDelayList( Object.assign(parameter, this.queryParam) ).then(res => {
-        //   const data = res.data
-        //   const no = (data.pageNo - 1) * data.pageSize
-        //   for (var i = 0; i < data.list.length; i++) {
-        //     data.list[i].no = no + i + 1
-        //   }
-        //   this.disabled = false
-        //   return data
-        // })
-        const _this = this
-        return new Promise(function (resolve, reject) {
-          const data = {
-            pageNo: 1,
-            pageSize: 10,
-            list: [
-              { id: '1', purchaseNo: 'jgqp11111111111', custssName: 0, creatDate: '产品1', custName: 'jgqp111123545', totalP: '箭冠品牌', totalNums: '产品分类1', totalPrice: '5', payType: '122' }
-            ],
-            count: 10
-          }
-          const no = (data.pageNo - 1) * data.pageSize
-          for (var i = 0; i < data.list.length; i++) {
-            data.list[i].no = no + i + 1
-          }
-          _this.disabled = false
-          resolve(data)
-        })
+      chooseLoadData: [],
+      choosePageNo: 1, //  分页页码
+      choosePageSize: 10, //  分页 每页多少条
+      choosePaginationProps: {
+        showSizeChanger: true, //  是否可以改变 pageSize
+        total: 0, //  分页总条数
+        current: 1,
+        onShowSizeChange: (current, pageSize) => this.changeChoosePageSize(current, pageSize),
+        onChange: (current) => this.changeChoosePage(current)
       },
-      openModal: false // 选择基本信息弹框是否显示
+      openModal: false, // 选择基本信息弹框是否显示
+      basicInfoData: null, //  基本信息
+      productTotal: null //  合计
     }
   },
   methods: {
     //  重置
     resetSearchForm () {
-      this.queryParam.orderBundleNo = ''
-      this.queryParam.orderBundle.custMobile = ''
-      this.queryParam.bundleName = ''
-      this.queryParam.itemName = ''
-      this.oldTime = undefined
-      this.newTime = undefined
+      this.queryParam.productCode = ''
+      this.queryParam.productName = ''
+      this.queryParam.warehouseSn = undefined
+      this.queryParam.brandSn = undefined
+      this.queryParam.productTypeSn1 = undefined
+      this.queryParam.productTypeSn2 = undefined
+      this.queryParam.productTypeSn3 = undefined
       this.$refs.table.refresh(true)
     },
-    //  添加
-    handleAdd (row) {},
+    // 已选产品  重置
+    chooseResetSearchForm () {
+      this.chooseQueryParam.productCode = ''
+      this.chooseQueryParam.productName = ''
+      this.getChooseProductList(1)
+    },
+    // 基本信息
+    getDetail () {
+      storeCallOutDetail({ id: this.$route.params.id }).then(res => {
+        if (res.status == 200) {
+          this.basicInfoData = res.data
+        } else {
+          this.basicInfoData = null
+        }
+      })
+    },
+    //  添加/编辑
+    handleAdd (row, isEdit) {
+      const params = {
+        id: isEdit ? row.id : undefined,
+        storeCallOutSn: this.$route.params.sn,
+        outCost: row.putCost,
+        outQty: isEdit ? row.outQty : 1, //  添加时调出数量默认为1
+        productSn: row.productSn,
+        productCode: row.productCode,
+        productOrigCode: row.productOrigCode || undefined,
+        productTypeSn1: row.productTypeSn1,
+        productTypeSn2: row.productTypeSn2,
+        productTypeSn3: row.productTypeSn3,
+        brandSn: row.brandSn,
+        warehouseSn: row.warehouseSn,
+        warehouseLocationSn: row.warehouseLocationSn
+      }
+      storeCallOutDetailSave(params).then(res => {
+        if (res.status == 200) {
+          this.$message.success(res.message)
+          this.getChooseProductList()
+        }
+      })
+    },
+    // 双击快速添加
+    handleClickRow (record) {
+      return {
+        on: {
+          dblclick: (event) => {
+            this.handleAdd(record)
+          }
+        }
+      }
+    },
     //  删除
-    handleDel (row) {},
+    handleDel (row) {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '删除后不可恢复,确定要进行删除吗?',
+        centered: true,
+        onOk () {
+          storeCallOutDetailDel({ id: row.id }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.getChooseProductList()
+            }
+          })
+        }
+      })
+    },
     //  编辑基本信息
     handleEditInfo () {
       this.openModal = true
@@ -311,7 +359,27 @@ export default {
 
     },
     //  提交
-    handleSubmit () {},
+    handleSubmit () {
+      const _this = this
+      storeCallOutSubmit({ id: this.$route.params.id }).then(res => {
+        if (res.status == 200) {
+          this.$message.success(res.message)
+          setTimeout(() => {
+            _this.handleBack()
+          }, 1000)
+        }
+      })
+    },
+    // 合计
+    getDetailCount (params) {
+      storeCallOutDetailCount(params).then(res => {
+        if (res.status == 200) {
+          this.productTotal = res.data
+        } else {
+          this.productTotal = null
+        }
+      })
+    },
     //  导入明细
     handleImport () {
       console.log(333)
@@ -320,15 +388,103 @@ export default {
     handleBack () {
       this.$router.push({ path: '/allocationManagement/storeTransferOut/list' })
     },
+    //  已选产品 分页  一页多少条change
+    changeChoosePageSize (current, pageSize) {
+      this.choosePageNo = current
+      this.choosePageSize = pageSize
+      this.getChooseProductList()
+    },
+    //  已选产品 分页 页码change
+    changeChoosePage (current) {
+      this.choosePageNo = current
+      this.getChooseProductList()
+    },
+    // 已选产品列表数据
+    getChooseProductList (pageNo) {
+      this.choosePageNo = this.choosePageNo || pageNo
+      this.chooseDisabled = true
+      const params = {
+        pageNo: this.choosePageNo,
+        pageSize: this.choosePageSize,
+        storeCallOutSn: this.$route.params.sn
+      }
+      storeCallOutDetailList(Object.assign(params, this.chooseQueryParam)).then(res => {
+        if (res.status == 200) {
+          //  合计
+          this.getDetailCount(Object.assign(params, this.chooseQueryParam))
+          const data = res.data
+          this.choosePaginationProps.total = Number(res.data.count) || 0
+          this.choosePaginationProps.current = data.pageNo
+          const no = (data.pageNo - 1) * data.pageSize
+          for (var i = 0; i < data.list.length; i++) {
+            data.list[i].no = no + i + 1
+            // 成本小计  由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
+            data.list[i].costSubtotal = getOperationalPrecision(data.list[i].outCost, data.list[i].outQty)
+          }
+          this.chooseLoadData = data.list
+          this.chooseDisabled = false
+        } else {
+          this.choosePaginationProps.total = 0
+          this.choosePaginationProps.current = 1
+          this.chooseLoadData = []
+        }
+      })
+    },
+    // 已选产品 调出数量  change
+    outQtyChange (val, record) {
+      this.handleAdd(record, 'edit')
+    },
+    //  产品分类  change
+    changeProductType (val, opt) {
+      this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
+      this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
+      this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
+    },
+    //  产品品牌  列表
+    getProductBrand () {
+      // sysFlag不传,此处应查询所有产品
+      dealerProductBrandQuery({}).then(res => {
+        if (res.status == 200) {
+          this.productBrandList = res.data
+        } else {
+          this.productBrandList = []
+        }
+      })
+    },
+    //  产品分类  列表
+    getProductType () {
+      dealerProductTypeList({}).then(res => {
+        if (res.status == 200) {
+          this.productTypeList = res.data
+        } else {
+          this.productTypeList = []
+        }
+      })
+    },
+    // 仓库下拉数据
+    getWarehouseList (type) {
+      warehouseAllList({}).then(res => {
+        if (res.status == 200) {
+          this.warehouseList = res.data
+        } else {
+          this.warehouseList = []
+        }
+      })
+    },
     filterOption (input, option) {
-      	return (
-      		option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
-      	)
+      return (
+        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
+      )
     }
   },
   beforeRouteEnter (to, from, next) {
     next(vm => {
       vm.openModal = false
+      vm.getDetail()
+      vm.getChooseProductList(1)
+      vm.getWarehouseList()
+      vm.getProductBrand()
+      vm.getProductType()
     })
   }
 }

+ 122 - 63
src/views/allocationManagement/storeTransferOut/list.vue

@@ -8,7 +8,7 @@
             <a-form-item label="创建时间">
               <a-range-picker
                 style="width:100%"
-                id="storeTransferOutList-bundleNamesss"
+                id="storeTransferOutList-createDate"
                 :disabledDate="disabledDate"
                 v-model="createDate"
                 :format="dateFormat"
@@ -17,37 +17,40 @@
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="24">
-            <a-form-item label="调往对象">
-              <v-select
-                v-model="queryParam.putPersonName"
-                ref="putPersonName"
-                id="storeTransferOutList-putPersonName"
-                code="PAYMENT_TYPE"
-                placeholder="请选择调往对象"
-                allowClear></v-select>
+            <a-form-item label="调往对象名称">
+              <a-input id="storeTransferOutList-putPersonName" v-model.trim="queryParam.putPersonName" allowClear placeholder="请输入调往对象名称"/>
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="24">
             <a-form-item label="调拨类型">
-              <v-select
-                v-model="queryParam.callOutType"
-                ref="callOutType"
-                id="storeTransferOutList-callOutType"
-                code="PAYMENT_TYPE"
-                placeholder="请选择调拨类型"
-                allowClear></v-select>
+              <a-select id="storeTransferOutList-callOutType" v-model="queryParam.callOutType" placeholder="请选择调拨类型" allowClear >
+                <a-select-option v-for="item in storeCallOutTypeList" :key="item.storeCallOutTypeSn" :value="item.storeCallOutTypeSn">{{ item.name }}</a-select-option>
+              </a-select>
             </a-form-item>
           </a-col>
           <template v-if="advanced">
             <a-col :md="6" :sm="24">
-              <a-form-item label="单据状态">
+              <a-form-item label="业务状态">
                 <v-select
                   v-model="queryParam.state"
                   ref="state"
                   id="storeTransferOutList-state"
-                  code="PAYMENT_TYPE"
-                  placeholder="请选择单据状态"
-                  allowClear></v-select>
+                  code="STORE_CALL_OUT_STATE"
+                  placeholder="请选择业务状态"
+                  allowClear
+                ></v-select>
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="财务状态">
+                <v-select
+                  v-model="queryParam.settleState"
+                  ref="settleState"
+                  id="storeTransferOutList-settleState"
+                  code="FINANCIAL_STATUS"
+                  placeholder="请选择财务状态"
+                  allowClear
+                ></v-select>
               </a-form-item>
             </a-col>
           </template>
@@ -64,7 +67,7 @@
     </div>
     <!-- 操作按钮 -->
     <div class="table-operator">
-      <a-button id="storeTransferOutList-add" type="primary" @click="handleEdit()">新增</a-button>
+      <a-button id="storeTransferOutList-add" type="primary" @click="openModal=true">新增</a-button>
     </div>
     <!-- 列表 -->
     <s-table
@@ -76,21 +79,40 @@
       :data="loadData"
       :scroll="{ x: 1500 }"
       bordered>
-      <!-- 状态 -->
-      <template slot="state" slot-scope="text, record">
-        <a-tag :color="record.state==1?'green':'red'" >{{ record.state==1? '待提交': '待审核' }}</a-tag>
+      <!-- 店内调出单号 -->
+      <template slot="storeCallOutNo" slot-scope="text, record">
+        <span style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record)">{{ record.storeCallOutNo }}</span>
       </template>
       <!-- 操作 -->
       <template slot="action" slot-scope="text, record">
-        <a-button size="small" type="link" @click="handleExamine(record)" id="storeTransferOutList-examine-btn">审核</a-button>
-        <a-divider type="vertical" style="margin: 0;" />
-        <a-button size="small" type="link" @click="handleEdit(record)" id="storeTransferOutList-edit-btn">编辑</a-button>
-        <a-divider type="vertical" style="margin: 0;" />
-        <a-button size="small" type="link" @click="handleOut(record)" id="storeTransferOutList-out-btn">出库</a-button>
-        <a-divider type="vertical" style="margin: 0;" />
-        <a-button size="small" type="link" @click="handleDetail(record)" id="storeTransferOutList-detail-btn">详情</a-button>
-        <a-divider type="vertical" style="margin: 0;" />
-        <a-button size="small" type="link" @click="handleDel(record)" id="storeTransferOutList-del-btn">删除</a-button>
+        <a-button
+          size="small"
+          type="primary"
+          v-if="record.state == 'WAIT_AUDIT'"
+          class="button-success"
+          @click="handleExamine(record)"
+          id="storeTransferOutList-examine-btn">审核</a-button>
+        <a-button
+          size="small"
+          type="primary"
+          v-if="record.state == 'WAIT_SUBMIT' || record.state == 'WAIT_AUDIT'"
+          class="button-info"
+          @click="handleEdit(record)"
+          id="storeTransferOutList-edit-btn">编辑</a-button>
+        <a-button
+          size="small"
+          type="primary"
+          v-if="record.state == 'WAIT_OUT_WAREHOUSE'"
+          class="button-warning"
+          @click="handleOut(record)"
+          id="storeTransferOutList-out-btn">出库</a-button>
+        <a-button
+          size="small"
+          type="primary"
+          v-if="record.state == 'WAIT_SUBMIT' || record.state == 'WAIT_AUDIT'"
+          class="button-error"
+          @click="handleDel(record)"
+          id="storeTransferOutList-del-btn">删除</a-button>
       </template>
     </s-table>
     <!-- 新增/编辑 -->
@@ -99,39 +121,50 @@
 </template>
 
 <script>
-import { storeCallOutList } from '@/api/storeCallOut'
+import moment from 'moment'
 import { STable, VSelect } from '@/components'
 import basicInfoModal from './basicInfoModal.vue'
+import { storeCallOutList, storeCallOutAudit, storeCallOutDel, storeCallOutOut } from '@/api/storeCallOut'
+import { storeCallOutTypeAllList } from '@/api/storeCallOutType'
 export default {
   components: { STable, VSelect, basicInfoModal },
   data () {
     return {
       advanced: false, // 高级搜索 展开/关闭
-      createDate: undefined, //  创建时间
+      createDate: [], //  创建时间
       queryParam: { //  查询条件
         putPersonName: undefined, //  调往对象
         callOutType: undefined, //  调拨类型
-        state: undefined //  单据状态
+        state: undefined, //  业务状态
+        settleState: undefined //  财务状态
       },
       disabled: false, //  查询、重置按钮是否可操作
       dateFormat: 'YYYY-MM-DD',
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
         { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
-        { title: '店内调出单号', dataIndex: 'storeCallOutNo', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '调往对象', dataIndex: 'putPersonName', width: 140, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '调拨类型', dataIndex: 'callOutType', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '店内调出单号', scopedSlots: { customRender: 'storeCallOutNo' }, width: 200, align: 'center' },
+        { title: '调往对象名称', dataIndex: 'putPersonName', width: 140, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '调拨类型', dataIndex: 'callOutTypeName', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '总款数', dataIndex: 'productTotalCategory', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '总数量', dataIndex: 'productTotalQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '总成本', dataIndex: 'productTotalCost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '审核时间', dataIndex: 'auditTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '状态', scopedSlots: { customRender: 'state' }, width: 100, align: 'center' },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: 260, align: 'center', fixed: 'right' }
+        { title: '业务状态', dataIndex: 'stateDictValue', width: 110, align: 'center' },
+        { title: '财务状态', dataIndex: 'settleStateDictValue', width: 110, align: 'center' },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: 250, align: 'center', fixed: 'right' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
-        this.queryParam = {}
+        // 创建时间
+        if (this.createDate && this.createDate.length > 0) {
+          this.queryParam.beginDate = moment(this.createDate[0]).format(this.dateFormat)
+          this.queryParam.endDate = moment(this.createDate[1]).format(this.dateFormat)
+        } else {
+          this.queryParam.beginDate = undefined
+          this.queryParam.endDate = undefined
+        }
         return storeCallOutList(Object.assign(parameter, this.queryParam)).then(res => {
           const data = res.data
           const no = (data.pageNo - 1) * data.pageSize
@@ -142,6 +175,7 @@ export default {
           return data
         })
       },
+      storeCallOutTypeList: [], //  调拨类型
       openModal: false, //  新增编辑  弹框
       itemId: '' //  当前品牌id
     }
@@ -171,37 +205,46 @@ export default {
         content: '删除后不可恢复,确定要进行删除吗?',
         centered: true,
         onOk () {
-          // delectRolePower({
-          //   id: row.id
-          // }).then(res => {
-          //   console.log(res, 'res1111')
-          //   if (res.status == 200) {
-          //     _this.$message.success(res.message)
-          //     _this.$refs.table.refresh()
-          //   }
-          // })
+          storeCallOutDel({ id: row.id }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+            }
+          })
         }
       })
     },
     //  出库
-    handleOut (row) {},
+    handleOut (row) {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '确认要进行出库操作吗?',
+        centered: true,
+        onOk () {
+          storeCallOutOut({ id: row.id }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+            }
+          })
+        }
+      })
+    },
     //  审核
-    handleExamine () {
+    handleExamine (row) {
       const _this = this
       this.$confirm({
         title: '提示',
         content: '确认要审核通过吗?',
         centered: true,
         onOk () {
-          // delectRolePower({
-          //   id: row.id
-          // }).then(res => {
-          //   console.log(res, 'res1111')
-          //   if (res.status == 200) {
-          //     _this.$message.success(res.message)
-          //     _this.$refs.table.refresh()
-          //   }
-          // })
+          storeCallOutAudit({ id: row.id }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+            }
+          })
         }
       })
     },
@@ -211,8 +254,24 @@ export default {
     },
     //  新增/编辑
     handleEdit (row) {
-      this.openModal = true
+      this.$router.push({ path: `/allocationManagement/storeTransferOut/edit/${row.id}/${row.storeCallOutSn}` })
+    },
+    //  调拨类型
+    getStoreCallOutTypeAllList () {
+      storeCallOutTypeAllList().then(res => {
+        if (res.status == 200) {
+          this.storeCallOutTypeList = res.data
+        } else {
+          this.storeCallOutTypeList = []
+        }
+      })
     }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {
+      vm.openModal = false
+      vm.getStoreCallOutTypeAllList()
+    })
   }
 }
 </script>

+ 12 - 8
src/views/salesManagement/outboundOrder/list.vue

@@ -4,7 +4,7 @@
     <div class="table-page-search-wrapper">
       <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
         <a-row :gutter="15">
-          <a-col :md="8" :sm="24">
+          <a-col :md="6" :sm="24">
             <a-form-item label="审核时间">
               <a-range-picker
                 style="width:100%"
@@ -30,7 +30,7 @@
               </a-select>
             </a-form-item>
           </a-col>
-          <a-col :md="5" :sm="24">
+          <a-col :md="6" :sm="24">
             <a-form-item label="出库类型">
               <v-select
                 v-model="queryParam.outType"
@@ -42,7 +42,7 @@
             </a-form-item>
           </a-col>
           <template v-if="advanced">
-            <a-col :md="5" :sm="24">
+            <a-col :md="6" :sm="24">
               <a-form-item label="单据状态">
                 <v-select
                   v-model="queryParam.billStatus"
@@ -54,8 +54,8 @@
               </a-form-item>
             </a-col>
           </template>
-          <a-col :md="5" :sm="24">
-            <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="outboundOrderList-refresh">查询</a-button>
+          <a-col :md="6" :sm="24">
+            <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="outboundOrderList-refresh" style="margin-bottom: 15px;">查询</a-button>
             <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="outboundOrderList-reset">重置</a-button>
             <a @click="advanced=!advanced" style="margin-left: 8px">
               {{ advanced ? '收起' : '展开' }}
@@ -89,9 +89,13 @@
       </template>
       <!-- 操作 -->
       <template slot="action" slot-scope="text, record">
-        <a-button size="small" type="link" @click="handleOutbound(record)" id="outboundOrderList-out-btn">出库</a-button>
-        <a-divider type="vertical" style="margin: 0;" />
-        <a-button size="small" type="link" @click="handleDetail(record)" style="margin-left: 10px;" id="outboundOrderList-detail-btn">详情</a-button>
+        <a-button size="small" type="primary" class="button-warning" @click="handleOutbound(record)" id="outboundOrderList-out-btn">出库</a-button>
+        <a-button
+          size="small"
+          type="primary"
+          class="button-success"
+          @click="handleDetail(record)"
+          id="outboundOrderList-detail-btn">详情</a-button>
       </template>
     </s-table>
   </a-card>