Commit ac5f2c04 by 王志慧

4.20.0需求开发

1 parent ebb594d5
......@@ -2839,6 +2839,11 @@
"resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz",
"integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ=="
},
"bignumber.js": {
"version": "9.1.1",
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.1.tgz",
"integrity": "sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig=="
},
"binary-extensions": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
......
......@@ -9,6 +9,7 @@
"lint": "vue-cli-service lint"
},
"dependencies": {
"bignumber.js": "^9.1.1",
"core-js": "^3.4.4",
"dayjs": "^1.10.7",
"el-tree-transfer": "^2.2.6",
......
......@@ -37,5 +37,27 @@ const getGoodsList = (params) => {
sign: true
})
}
//查询服务商所有商品列表
const getfwsGoodsList = (params) => {
params.method = `scrm.api.partner.goods.list`
return http({
url: 'rop-scrm-partner/router',
method: 'POST',
data: params,
sign: true
})
}
export default { getGoodsList,getProductInfo, getProductTypeBySceneId }
// 添加自采订单
const addSelfOrder = (params) => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `dj.api.smarcarlife.purchaseOrder.selfAddOrEdit`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
export default { addSelfOrder,getGoodsList,getProductInfo, getProductTypeBySceneId ,getfwsGoodsList}
......@@ -26,6 +26,17 @@ const purchaseOrderCancelOrCheck = (params) => {
returnAll: true
})
}
const purchaseOrderDelete = (params) => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `dj.api.smarcarlife.purchaseOrder.deleteByOrderCode`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
// 查看采购订单
const purchaseOrderDetail = (params) => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
......@@ -189,7 +200,17 @@ export function getMerchantList(params) {
})
}
//编辑
export function selectByOrderCode(params) {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `dj.api.smarcarlife.purchaseOrder.selectByOrderCode`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 确认发货
// export function purchaseOrderConfirmDelivery(data) {
......@@ -198,4 +219,4 @@ export function getMerchantList(params) {
// return http(data)
// }
export default { getMerchantList,purchaseOrderPutIn, exportExcel, shoppingCarUpdateNumber, purchaseOrderAdd, shoppingCarAdd, shoppingCarRemove, updateSelectedFlag, listGroupByGoodsType, getPurchaseOrderList, purchaseOrderCancelOrCheck, purchaseOrderDetail, listWithPagePurchaseInfo, addressGet, addressSave }
\ No newline at end of file
export default { selectByOrderCode,purchaseOrderDelete, getMerchantList, purchaseOrderPutIn, exportExcel, shoppingCarUpdateNumber, purchaseOrderAdd, shoppingCarAdd, shoppingCarRemove, updateSelectedFlag, listGroupByGoodsType, getPurchaseOrderList, purchaseOrderCancelOrCheck, purchaseOrderDetail, listWithPagePurchaseInfo, addressGet, addressSave }
\ No newline at end of file
......@@ -37,327 +37,17 @@ export const defaultStatusOptions = [
label: "已入库"
}
]
export const membraneTypeList = [1, 4, 6, 12, 14]
export const tableData = [
{
"id": 87,
"orderCode": "CG202303246031",
"totalPrice": 2000,
"orderTime": 1679628260000,
"merchantId": 44211025,
"merchantName": "流程测试园区门店",
"putStatus": 2,
"putTime": 1679628300000,
"putMerchantId": 44211025,
"putMerchantName": "流程测试园区门店",
"status": 2,
"createdBy": null,
"createdDate": null,
"updatedBy": null,
"updatedDate": null,
"deletedFlag": null,
"sortType": 0,
"orderTimeStart": null,
"orderTimeEnd": null,
"orderTimeStr": null,
"deliveryStatus": 2,
"putTimeStr": null,
"putTimeStart": null,
"putTimeEnd": null,
"contactName": "宋司机",
"contactPhone": "13750523252",
"contactAddress": "111111111111111111111111111111111111111111111111",
"deliveryNumber": "23213123321",
"deliveryCompany": "顺丰",
"yqMerchantIds": null
},
{
"id": 86,
"orderCode": "CG202303245909",
"totalPrice": 200,
"orderTime": 1679627865000,
"merchantId": 44211025,
"merchantName": "流程测试园区门店",
"putStatus": 2,
"putTime": 1679627971000,
"putMerchantId": 44211025,
"putMerchantName": "流程测试园区门店",
"status": 2,
"createdBy": null,
"createdDate": null,
"updatedBy": null,
"updatedDate": null,
"deletedFlag": null,
"sortType": 0,
"orderTimeStart": null,
"orderTimeEnd": null,
"orderTimeStr": null,
"deliveryStatus": 2,
"putTimeStr": null,
"putTimeStart": null,
"putTimeEnd": null,
"contactName": "宋司机",
"contactPhone": "13750523252",
"contactAddress": "111111111111111111111111111111111111111111111111",
"deliveryNumber": "202303113333",
"deliveryCompany": "顺丰",
"yqMerchantIds": null
},
{
"id": 85,
"orderCode": "CG202303074278",
"totalPrice": 222,
"orderTime": 1678175926000,
"merchantId": 44211753,
"merchantName": "权限验证门店",
"putStatus": 1,
"putTime": null,
"putMerchantId": null,
"putMerchantName": null,
"status": 1,
"createdBy": null,
"createdDate": null,
"updatedBy": null,
"updatedDate": null,
"deletedFlag": null,
"sortType": 0,
"orderTimeStart": null,
"orderTimeEnd": null,
"orderTimeStr": null,
"deliveryStatus": 1,
"putTimeStr": null,
"putTimeStart": null,
"putTimeEnd": null,
"contactName": "test",
"contactPhone": "13156464645",
"contactAddress": "test",
"deliveryNumber": null,
"deliveryCompany": null,
"yqMerchantIds": null
},
{
"id": 84,
"orderCode": "CG202303062215",
"totalPrice": 2,
"orderTime": 1678094753000,
"merchantId": 44211025,
"merchantName": "流程测试园区门店",
"putStatus": 1,
"putTime": null,
"putMerchantId": null,
"putMerchantName": null,
"status": 1,
"createdBy": null,
"createdDate": null,
"updatedBy": null,
"updatedDate": null,
"deletedFlag": null,
"sortType": 0,
"orderTimeStart": null,
"orderTimeEnd": null,
"orderTimeStr": null,
"deliveryStatus": 1,
"putTimeStr": null,
"putTimeStart": null,
"putTimeEnd": null,
"contactName": "宋司机",
"contactPhone": "13750523252",
"contactAddress": "111111111111111111111111111111111111111111111111",
"deliveryNumber": null,
"deliveryCompany": null,
"yqMerchantIds": null
},
{
"id": 83,
"orderCode": "CG202303061686",
"totalPrice": 80,
"orderTime": 1678094729000,
"merchantId": 44211025,
"merchantName": "流程测试园区门店",
"putStatus": 1,
"putTime": null,
"putMerchantId": null,
"putMerchantName": null,
"status": 1,
"createdBy": null,
"createdDate": null,
"updatedBy": null,
"updatedDate": null,
"deletedFlag": null,
"sortType": 0,
"orderTimeStart": null,
"orderTimeEnd": null,
"orderTimeStr": null,
"deliveryStatus": 1,
"putTimeStr": null,
"putTimeStart": null,
"putTimeEnd": null,
"contactName": "宋司机",
"contactPhone": "13750523252",
"contactAddress": "111111111111111111111111111111111111111111111111",
"deliveryNumber": null,
"deliveryCompany": null,
"yqMerchantIds": null
},
//采购类型
export const purchaseTypeList=[
{
"id": 82,
"orderCode": "CG202303061255",
"totalPrice": 100,
"orderTime": 1678094705000,
"merchantId": 44211025,
"merchantName": "流程测试园区门店",
"putStatus": 1,
"putTime": null,
"putMerchantId": null,
"putMerchantName": null,
"status": 1,
"createdBy": null,
"createdDate": null,
"updatedBy": null,
"updatedDate": null,
"deletedFlag": null,
"sortType": 0,
"orderTimeStart": null,
"orderTimeEnd": null,
"orderTimeStr": null,
"deliveryStatus": 1,
"putTimeStr": null,
"putTimeStart": null,
"putTimeEnd": null,
"contactName": "宋司机",
"contactPhone": "13750523252",
"contactAddress": "111111111111111111111111111111111111111111111111",
"deliveryNumber": null,
"deliveryCompany": null,
"yqMerchantIds": null
},
{
"id": 81,
"orderCode": "CG202303068699",
"totalPrice": 200,
"orderTime": 1678094690000,
"merchantId": 44211025,
"merchantName": "流程测试园区门店",
"putStatus": 1,
"putTime": null,
"putMerchantId": null,
"putMerchantName": null,
"status": 1,
"createdBy": null,
"createdDate": null,
"updatedBy": null,
"updatedDate": null,
"deletedFlag": null,
"sortType": 0,
"orderTimeStart": null,
"orderTimeEnd": null,
"orderTimeStr": null,
"deliveryStatus": 1,
"putTimeStr": null,
"putTimeStart": null,
"putTimeEnd": null,
"contactName": "宋司机",
"contactPhone": "13750523252",
"contactAddress": "111111111111111111111111111111111111111111111111",
"deliveryNumber": null,
"deliveryCompany": null,
"yqMerchantIds": null
},
{
"id": 80,
"orderCode": "CG202303061510",
"totalPrice": 88,
"orderTime": 1678094683000,
"merchantId": 44211025,
"merchantName": "流程测试园区门店",
"putStatus": 1,
"putTime": null,
"putMerchantId": null,
"putMerchantName": null,
"status": 1,
"createdBy": null,
"createdDate": null,
"updatedBy": null,
"updatedDate": null,
"deletedFlag": null,
"sortType": 0,
"orderTimeStart": null,
"orderTimeEnd": null,
"orderTimeStr": null,
"deliveryStatus": 1,
"putTimeStr": null,
"putTimeStart": null,
"putTimeEnd": null,
"contactName": "宋司机",
"contactPhone": "13750523252",
"contactAddress": "111111111111111111111111111111111111111111111111",
"deliveryNumber": null,
"deliveryCompany": null,
"yqMerchantIds": null
id: 1,
label: "商城采购"
},
{
"id": 79,
"orderCode": "CG202303068980",
"totalPrice": 266,
"orderTime": 1678094455000,
"merchantId": 44211452,
"merchantName": "lsq园区店02",
"putStatus": 2,
"putTime": 1678938194000,
"putMerchantId": 44211452,
"putMerchantName": "lsq园区店02",
"status": 2,
"createdBy": null,
"createdDate": null,
"updatedBy": null,
"updatedDate": null,
"deletedFlag": null,
"sortType": 0,
"orderTimeStart": null,
"orderTimeEnd": null,
"orderTimeStr": null,
"deliveryStatus": 2,
"putTimeStr": null,
"putTimeStart": null,
"putTimeEnd": null,
"contactName": "刘世权",
"contactPhone": "15089782612",
"contactAddress": "广东省深圳市龙岗区坂田街道",
"deliveryNumber": "202303061722",
"deliveryCompany": "wllw",
"yqMerchantIds": null
id: 2,
label: "自采入库"
},
{
"id": 78,
"orderCode": "CG202303068011",
"totalPrice": 66,
"orderTime": 1678094339000,
"merchantId": 44211025,
"merchantName": "流程测试园区门店",
"putStatus": 1,
"putTime": null,
"putMerchantId": null,
"putMerchantName": null,
"status": 1,
"createdBy": null,
"createdDate": null,
"updatedBy": null,
"updatedDate": null,
"deletedFlag": null,
"sortType": 0,
"orderTimeStart": null,
"orderTimeEnd": null,
"orderTimeStr": null,
"deliveryStatus": 1,
"putTimeStr": null,
"putTimeStart": null,
"putTimeEnd": null,
"contactName": "宋司机",
"contactPhone": "13750523252",
"contactAddress": "111111111111111111111111111111111111111111111111",
"deliveryNumber": null,
"deliveryCompany": null,
"yqMerchantIds": null
}
]
]
export const membraneTypeList = [1, 4, 6, 12, 14]
\ No newline at end of file
......@@ -50,6 +50,11 @@
</div>
<!-- <i class="carIcon"></i> -->
</div>
<div class="table">
<h3>适用门店</h3>
<GLTable :hasNum="false" :hasPage="false" :tableParams="tableParams" :table-data="tableInfo">
</GLTable>
</div>
<h3 style="margin-top:20px;">产品详情</h3>
<div class="goodsDescList">
<div class="goodsDescItem" v-for="(item, index) in goodsInfo.goodsDescList" :key="index">
......@@ -92,7 +97,23 @@ export default {
goodsNumber: 1,
upgradeGoodsId: '',
purchasePrice: 0
}
},
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableColumns: [{
label: '商户名称',
prop: 'merchantNames'
}, {
label: '商户号',
prop: 'merchantId'
}, {
label: '商品别名',
prop: 'upgradeGoodsAlias'
}]
},
tableInfo: [],
}
},
computed: {
......@@ -128,6 +149,7 @@ export default {
getGoodsDetail() {
this.$apis.product.getProductInfo({ id: this.goodsId }).then(res => {
this.goodsInfo = res
this.tableInfo = res.upgradeGoodsList.filter(item => item.upgradeGoodsAlias)
// 调试用
// for (let index = 0; index < 12; index++) {
// this.goodsInfo.upgradeGoodsList[index] = this.goodsInfo.upgradeGoodsList[0]
......
......@@ -68,6 +68,10 @@ export default {
prop: 'upgradeGoodsName'
},
{
label: '商品编码',
prop: 'productCode'
},
{
label: '系列',
prop: 'goodsName'
},
......
......@@ -4,9 +4,12 @@
<div class="container">
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="searchForm" :formData="showFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<div class="table-header">
<GLButton type="primary" class="glbtn" size="small" @click="handleCreatePurchase" fn="创建采购">创建采购</GLButton>
<!-- <el-button type="primary" size="small" @click="handleCreatePurchase">创建采购</el-button> -->
<el-button type="primary" class="btn" size="small" @click="exportExcel">导出</el-button>
<h2>采购订单列表</h2>
<div>
<GLButton type="primary" size="small" @click="handleCreatePurchase" fn="创建采购">商城采购</GLButton>
<el-button size="small" @click="handlePutStprage">自采入库</el-button>
<el-button size="small" @click="exportExcel">导出</el-button>
</div>
</div>
<!-- 表格区域 开始 -->
......@@ -31,9 +34,10 @@
</template>
<div class="table-btns" slot="auth-button" slot-scope="scope">
<el-button type="text" @click="handleDetail(scope.scope)">查看</el-button>
<GLButton type="text" size="small" v-show="scope.scope.putStatus == 1 && scope.scope.purchaseType == 2" @click="handleDelete(scope.scope)" fn="删除">删除</GLButton>
<GLButton type="text" size="small" v-show="scope.scope.putStatus == 1" @click="handleEdit(scope.scope)" fn="编辑">编辑</GLButton>
<GLButton type="text" size="small" v-show="scope.scope.status == 1" @click="handleCancel(scope.scope)" fn="取消">取消</GLButton>
<GLButton type="text" size="small" v-show="scope.scope.putStatus == 1 && scope.scope.deliveryStatus == 2" @click="handleWarehousing(scope.scope)" fn="入库">入库</GLButton>
<!-- <el-button type="text" v-show="scope.scope.status == 1" @click="handleCancel(scope.scope)">取消</el-button> -->
<GLButton type="text" size="small" v-show="(scope.scope.putStatus == 1 && scope.scope.deliveryStatus == 2 && scope.scope.purchaseType == 1) || (scope.scope.putStatus == 1 && scope.scope.purchaseType == 2)" @click="handleWarehousing(scope.scope)" fn="入库">入库</GLButton>
</div>
</GLTable>
<!-- 表格区域 end -->
......@@ -46,7 +50,7 @@
import * as dayjs from 'dayjs'
import url from '@/assets/empty.png'
import orderDeatilDialog from './components/orderDetailDialog'
import { defaultStatusOptions, defaultDeliveryStatusOptions, defaultPutStatusOptions, tableData } from '@/utils/constants.js'
import { defaultStatusOptions, defaultDeliveryStatusOptions, defaultPutStatusOptions, purchaseTypeList } from '@/utils/constants.js'
export default {
name: 'PurchaseOrder',
components: {
......@@ -61,6 +65,7 @@ export default {
deliveryStatus: '',
putStatus: '',
merchantId: '',
purchaseType: '',
putMerchantId: '',
sortType: 1,
orderTimeStr: [],
......@@ -72,7 +77,6 @@ export default {
paramsObj: {},
// 查看门店
detailVisible: false,
tableData: tableData,
showFormData: [
{
label: '订单编号',
......@@ -107,6 +111,7 @@ export default {
optionLabel: 'label',
optionsName: 'defaultPutStatusOptions'
},
{
label: '下单时间',
name: 'placeOrderTimeStr',
......@@ -138,6 +143,24 @@ export default {
optionId: 'merchantNo',
optionLabel: 'merchantName',
optionsName: 'merchantName'
},
{
label: '使用门店',
name: 'storeUsage',
type: 'select',
optionList: [],
optionId: 'merchantNo',
optionLabel: 'merchantName',
optionsName: 'storeUsageList'
},
{
label: '采购类型',
name: 'purchaseType',
type: 'select',
optionList: [],
optionId: 'id',
optionLabel: 'label',
optionsName: 'purchaseTypeList'
}
],
// 表格
......@@ -219,6 +242,15 @@ export default {
}
},
{
label: '采购类型',
prop: 'purchaseType',
line: 1,
width: 150,
formatter: cellValue => {
return (cellValue.purchaseType && (cellValue.purchaseType == 1 ? '商城采购' : '自采入库')) || '--'
}
},
{
label: '订单状态',
prop: 'status',
addHtml: 'status',
......@@ -237,7 +269,9 @@ export default {
defaultStatusOptions: defaultStatusOptions,
defaultDeliveryStatusOptions: defaultDeliveryStatusOptions,
defaultPutStatusOptions: defaultPutStatusOptions,
merchantName: []
merchantName: [],
storeUsageList:[],
purchaseTypeList: purchaseTypeList
}
}
},
......@@ -245,6 +279,7 @@ export default {
mounted() {
this.$apis.purchaseShopping.getMerchantList({}).then(res => {
this.baseData.merchantName = res
this.baseData.storeUsageList = res
this.getOptionsList('showFormData')
})
},
......@@ -252,7 +287,6 @@ export default {
methods: {
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
console.log(this.searchForm)
if (this.searchForm.placeOrderTimeStr.length) {
params.orderTimeStr[0] = new Date(this.searchForm.placeOrderTimeStr[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.orderTimeStr[1] = new Date(this.searchForm.placeOrderTimeStr[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
......@@ -323,6 +357,19 @@ export default {
}
this.detailVisible = true
},
//自采入库-编辑
handleEdit(row) {
this.$router.push({
path: '/purchaseOrder/into',
query: {
orderCode: row.orderCode
}
})
},
//删除
handleDelete(row) {
this.secondConfirm('删除', '删除后不可恢复。是否确定删除?', 'purchaseShopping', 'purchaseOrderDelete', { orderCode: row.orderCode })
},
//取消
handleCancel(row) {
this.secondConfirm('取消', '订单取消后即自动作废该订单,且无法撤回。是否确定取消?', 'purchaseShopping', 'purchaseOrderCancelOrCheck', { orderCode: row.orderCode, operateType: 2 })
......@@ -361,6 +408,10 @@ export default {
handleCreatePurchase() {
this.$router.push('/purchaseOrder/add')
},
// 自采入库
handlePutStprage() {
this.$router.push('/purchaseOrder/into')
},
exportExcel() {
var params = this.getParams()
this.$apis.purchaseShopping.exportExcel(params).then(res => {
......@@ -378,6 +429,7 @@ export default {
putStatus: '',
merchantId: '',
putMerchantId: '',
purchaseType: '',
sortType: 1,
orderTimeStr: [],
putTimeStr: [],
......@@ -396,15 +448,16 @@ export default {
.table-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 25px;
margin-top:20px;
margin-top: 20px;
h2 {
font-weight: 600;
font-size: 16px;
color: #333;
}
.glbtn{
left: 46px;
.glbtn {
left: 46px;
position: absolute;
}
.btn {
......
<template>
<div>
<div class="container">
<div class="table-header">
<h2 class="title">采购明细</h2>
<el-button type="primary" size="small" @click="addLine">添加一行</el-button>
</div>
<el-form ref="addForm" :model="formdata" size="small" :rules="rules">
<GLTable ref="orderRef" :tableData="formdata.tableData" :noDataImg="url" :searchForm="tableSearchForm" :tableParams="tableParams" :hasPage="false">
<template slot="upgradeGoodsId" slot-scope="scope">
<el-form-item style="margin-bottom: 0px" :prop="'tableData.' + scope.index + '.upgradeGoodsId'" :rules="rules.upgradeGoodsId">
<el-select style="width: 100%" v-model="scope.scope.upgradeGoodsId" placeholder="请选择" @change="getGoodsName(scope.scope, scope.scope.upgradeGoodsId)">
<el-option v-for="item in goodsList" :key="item.upgradeGoodsId" :label="item.goodsName" :value="item.upgradeGoodsId"></el-option>
</el-select>
</el-form-item>
</template>
<template slot="goodsNumber" slot-scope="scope">
<el-form-item style="margin-bottom: 0px" :prop="'tableData.' + scope.index + '.goodsNumber'" :rules="rules.goodsNumber">
<el-input v-model="scope.scope.goodsNumber" placeholder="请输入" @blur="handleCalculate(scope.scope, 'goodsNumber')"></el-input>
</el-form-item>
</template>
<template slot="upgradePurchasePrice" slot-scope="scope">
<el-form-item style="margin-bottom: 0px" :prop="'tableData.' + scope.index + '.upgradePurchasePrice'" :rules="rules.upgradePurchasePrice">
<el-input v-model="scope.scope.upgradePurchasePrice" placeholder="请输入" @blur="handleCalculate(scope.scope, 'upgradePurchasePrice')"></el-input>
</el-form-item>
</template>
<template slot="goodsTotalPrice" slot-scope="scope">
<el-form-item style="margin-bottom: 0px" :prop="'tableData.' + scope.index + '.goodsTotalPrice'" :rules="rules.goodsTotalPrice">
<el-input v-model="scope.scope.goodsTotalPrice" placeholder="请输入" @blur="handleCalculate(scope.scope, 'goodsTotalPrice')"></el-input>
</el-form-item>
</template>
<div class="table-btns" slot="auth-button" slot-scope="scope">
<el-button type="text" @click="handleDelete(scope.index)">删除</el-button>
</div>
</GLTable>
</el-form>
</div>
<GLFooter style="margin-top: 16px">
<el-button @click="goBack" size="medium">取消</el-button>
<el-button @click="handleSave(1)" type="primary" plain size="medium">保存</el-button>
<el-button type="primary" @click="handleSave(2)" size="medium">保存并入库</el-button>
</GLFooter>
</div>
</template>
<script>
import BigNumber from 'bignumber.js'
export default {
data() {
var checkPrice = (rule, value, callback) => {
if (isNaN(+value)) {
callback(new Error('请输入数字值'))
} else {
if (value <= 0 || value > 999999) {
callback(new Error('仅支持输出0~999999纯数字'))
} else {
callback()
}
}
}
return {
orderCode: this.$route.query.orderCode || '',
rules: {
upgradeGoodsId: [{ required: true, message: '请选择商品名称', trigger: 'change' }],
goodsTotalPrice: [
{ required: true, message: '请输入采购总额', trigger: 'blur' },
{ validator: checkPrice, trigger: 'blur' }
],
goodsNumber: [
{ required: true, message: '请输入采购数量', trigger: 'blur' },
{ validator: checkPrice, trigger: 'blur' }
],
upgradePurchasePrice: [
{ required: true, message: '请输入采购单价', trigger: 'blur' },
{ validator: checkPrice, trigger: 'blur' }
]
},
formdata: {
tableData: [{ upgradeGoodsId: '', goodsCode: '', goodsName: '', goodsNumber: '', upgradePurchasePrice: '', goodsTotalPrice: '' }]
},
tableParams: {
tableOption: true,
tableColumns: [
{
label: '商品名称',
prop: 'upgradeGoodsId',
addHtml: 'upgradeGoodsId'
},
{
label: '商品编码',
prop: 'goodsCode'
},
{
label: '所属系列',
prop: 'goodsName'
},
{
label: '采购数量',
prop: 'goodsNumber',
addHtml: 'goodsNumber'
},
{
label: '采购单价',
prop: 'upgradePurchasePrice',
addHtml: 'upgradePurchasePrice'
},
{
label: '采购总额/元',
prop: 'goodsTotalPrice',
addHtml: 'goodsTotalPrice'
}
]
},
goodsList: []
}
},
created() {
this.getfwsGoodsList()
if (this.orderCode) this.getData()
},
methods: {
handleSave(saveOrWarehousing) {
this.$refs['addForm'].validate(valid => {
if (valid) {
let purchaseOrderGoodsList = []
this.formdata.tableData.forEach(item => {
purchaseOrderGoodsList.push({
upgradeGoodsId: item.upgradeGoodsId,
goodsName: item.goodsName,
goodsNumber: item.goodsNumber,
upgradePurchasePrice: item.upgradePurchasePrice,
goodsTotalPrice: item.goodsTotalPrice
})
})
let params = {
saveOrWarehousing,
purchaseOrderGoodsList
}
if (this.orderCode) params.orderCode = this.orderCode
if (saveOrWarehousing == 2) {
this.$confirm('入库后自动更新对应的库存且不可撤回,可在入库管理中查看记录。是否确定入库?', '入库提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$apis.product.addSelfOrder(params).then(res => {
this.$notify({
type: 'success',
title: '操作成功'
})
this.goBack()
})
})
} else {
this.$apis.product.addSelfOrder(params).then(res => {
this.$notify({
type: 'success',
title: '操作成功'
})
this.goBack()
})
}
}
})
},
getData() {
this.$apis.purchaseShopping.selectByOrderCode({ orderCode: this.orderCode }).then(res => {
console.log(res)
this.formdata.tableData = res
})
},
handleDelete(index) {
if (this.formdata.tableData.length == 1) return
this.formdata.tableData.splice(index, 1)
},
getfwsGoodsList() {
this.$apis.product.getfwsGoodsList({}).then(res => {
this.goodsList = res
})
},
getGoodsName(data, id) {
this.goodsList.forEach(item => {
if (item.upgradeGoodsId == id) {
data.goodsCode = item.type
data.goodsName = item.goodsCodeName
}
})
},
handleCalculate(data, key) {
if (key == 'goodsNumber') {
data.goodsTotalPrice = ''
data.upgradePurchasePrice = ''
return
}
if (!data.goodsNumber) return
data[key] = new BigNumber(data[key]).dp(2).toNumber()
let params = {
upgradePurchasePrice: data => {
data.goodsTotalPrice = new BigNumber(data.upgradePurchasePrice)
.times(data.goodsNumber)
.dp(2)
.toNumber()
},
goodsTotalPrice: data => {
data.upgradePurchasePrice = new BigNumber(data.goodsTotalPrice)
.div(data.goodsNumber)
.dp(2)
.toNumber()
}
}
params[key](data)
},
addLine() {
this.formdata.tableData.push({
upgradeGoodsId: '',
goodsCode: '',
goodsName: '',
goodsNumber: '',
upgradePurchasePrice: '',
goodsTotalPrice: ''
})
},
goBack() {
this.$router.go(-1)
}
}
}
</script>
<style lang="scss" scoped>
.container {
background: #fff;
padding: 20px;
.table-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 15px;
}
.title {
font-weight: 600;
font-size: 16px;
color: #333333;
margin-bottom: 15px;
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!