Commit 0a5a68b7 authored by chuan.liu's avatar chuan.liu

材料计划联调

parent 8962c2c3
......@@ -4,12 +4,12 @@
<view class="cell-list">
<view class="middle view planout-block-item">
<view class="item-block item-block-code">
<text class="item-block-label">单号:{{itemHead.PRODPL_ID}}</text>
<text class="item-block-label">单号:{{itemHead.PACKPL_ID}}</text>
<button class="item-block-btn" type="default"><text
class="item-block-btn__text">{{itemHead.STATUS}}</text></button>
</view>
<view class="item-block item-block-name">
<text class="item-block-label item-block__label">高端总经销材料计划</text>
<text class="item-block-label item-block__label">{{itemHead.PACKTYPE}}</text>
</view>
<view class="item-block">
<text class="item-block-label-des">{{itemHead.DATUM}}</text>
......@@ -30,12 +30,12 @@
</view>
<view class="block-detal-item block-detal-item-last">
<text class="detal-item-label">吨数</text>
<text class="detal-item-value">7</text>
<text class="detal-item-value">{{item.PLANQTY_TON}}</text>
</view>
</view>
<view class="item-block">
<text class="item-block-label-des">尽快发货</text>
<text class="item-block-label-des">{{itemHead.REMARK}}</text>
</view>
<view class="item-block item-block-date">
<text class="detal-item-label">备注</text>
......@@ -196,13 +196,10 @@
}
.item-block-btn {
width: 120rpx;
height: 48rpx;
line-height: 48rpx;
line-height: 44rpx;
background: #f61d30;
border-radius: 80rpx 200rpx 200rpx 80rpx;
font-size: 12px;
color: #fff;
text-align: center;
}
......
......@@ -57,8 +57,8 @@
} from 'vuex'
import {
apiGetProduceOrder
} from '@/servers/produceOrder.js'
apiGetProduceMaterialOrder
} from '@/servers/produceMaterial.js'
export default {
components: {
......@@ -77,15 +77,7 @@
},
data() {
return {
dataList: [{
id: "tab01",
name: '最新',
newsid: 0
}, {
id: "tab02",
name: '大公司',
newsid: 23
}],
dataList: [],
navigateFlag: false,
pulling: false,
refreshing: false,
......@@ -163,7 +155,7 @@
...this.page
}
apiGetProduceOrder(params).then((res) => {
apiGetProduceMaterialOrder(params).then((res) => {
console.log('loadData', res)
const {
DATA,
......@@ -204,6 +196,7 @@
})
},
loadMore(e) {
console.log('loadMore')
this.page.PAGE++
this.loadData();
},
......
......@@ -2,16 +2,16 @@
<view class="lists">
<view class="status_bar" :style="navHeight"></view>
<view class="middle summary">
<view class="summary-line">
<!-- <view class="summary-line"> -->
<view class="summary-block">
<text class="upload-text">预约</text>
</view>
<switch class="summary-num" color='red' :checked="isChecked" @change="switchChange" />
</view>
<view class="summary-line summary-line-last">
<!-- </view> -->
<!-- <view class="summary-line summary-line-last">
<text class="upload-text-2">材料保证金</text>
<text class="summary-num-2">0.00</text>
</view>
</view> -->
</view>
<view class="middle upload salescenter">
......@@ -44,22 +44,23 @@
<view class="planout-block">
<text class="planout-block-title">备料产品</text>
<image class="planout-block-icon" src="@/static/image/shop_more@3x.png" mode="aspectFit"></image>
<image class="planout-block-icon" src="@/static/image/shop_more@3x.png" @click="addPlanout()"
mode="aspectFit"></image>
</view>
<scroll-view class="scroll-area view" :scroll-top="scrollTop" scroll-y="true" :show-scrollbar='false'>
<uni-swipe-action class="planout-block-lists">
<uni-swipe-action-item v-for="item in 2" :key='item'>
<uni-swipe-action-item v-for="(item,index) in planinnerLists" :key='index'>
<view class="middle view planout-block-item">
<view class="text-block title-first">
<text class="middle-date title-first__text">1</text>
<text class="middle-date title-first__text">{{index+1}}</text>
</view>
<view class="text-block">
<view class="text-block" @click="selectProduct(index,'inner')">
<text class="middle-date">产品</text>
<view class="middle-date-des uni-list picker-year">
<view class="uni-list-cell">
<view class="uni-list-cell-db">
<text class="middle-date-des">请选择</text>
<text class="middle-date-des">{{item.DESCRIPTION}}</text>
</view>
</view>
<image class="icon-arrow" src="@/static/image/arrow_r@3x.png" mode="aspectFit"></image>
......@@ -67,23 +68,24 @@
</view>
<view class="text-block">
<text class="middle-date">备料件数</text>
<input class="middle-date-des" type="text" value="" placeholder="请填写" />
<input class="middle-date-des" type="text" @blur="updateNoQuotaData(index,'',item)"
v-model="item.quantity" placeholder="请填写" />
</view>
<view class="text-block">
<text class="middle-date">吨</text>
<text class="middle-date-des">2.5</text>
<text class="middle-date-des">{{item.PLANQTY_TON}}</text>
</view>
<view class="text-block">
<!-- <view class="text-block">
<text class="middle-date">保证金</text>
<text class="middle-date-des">0.00</text>
</view>
</view> -->
<view class="text-block text-block-last">
<text class="middle-date">备注</text>
<text class="middle-date-des">尽快发货</text>
<input class="middle-date-des" type="text" v-model="item.REMARK" placeholder="请填写" />
</view>
</view>
<template v-slot:right>
<view class="swipe-right-block" @click="handleDel"><text
<view class="swipe-right-block" @click="handleDel(index)"><text
class="swipe-right-block__text">删除</text>
</view>
</template>
......@@ -98,8 +100,8 @@
</view>
<view class="popup-content-content">
<text class="popup-content-content__title">提交成功</text>
<text class="popup-content-content__title2">生产备料编号:{{ orderNo }}</text>
<text class="popup-content-content__title2">生产备料单号:{{ orderNo }}</text>
<text class="popup-content-content__title2">生产备料编号:{{ orderInfo.OBJECT_ID }}</text>
<text class="popup-content-content__title2">生产备料单号:{{ orderInfo.PRODPL_ID }}</text>
</view>
<view class="popup-content-foot">
<text class="popup-content-foot__btn" @click="fnBackHome()">继续添加</text>
......@@ -118,16 +120,16 @@
} from 'vuex'
import {
apiProducePlanInit,
apiUpdateProducePlanData,
apiUpdateProduceOrder
} from '@/servers/produceOrder.js'
apiProduceMaterialPlanInit,
apiUpdateProduceMaterialPlanData,
apiUpdateProduceMaterialOrder,
apiSubmitProduceMaterialOrder
} from '@/servers/produceMaterial.js'
export default {
data() {
return {
isChecked: false,
orderNo: '',
scrollTop: 0,
selectedSalesCenterArr: [{
KEY: -1,
......@@ -154,34 +156,161 @@
'height': `${this.sysinfo.safeArea.top + 44}px`
}
},
...mapState(['sysinfo'])
...mapState(['sysinfo', 'userInfo'])
},
onNavigationBarButtonTap(e) {
this.$refs.popup.open('center')
this.initProduceMaterialPlanData()
},
created() {
this.initProduceMaterialPlanData()
},
mounted() {
console.log('监听到事件来自 onShow');
let _this = this
uni.$on('selectedProduct', function(data) {
console.log('监听到事件来自 selectedProduct ,携带参数 msg 为:', data);
const fromIndex = data.index * 1
const selectedProduct = data.selectedProduct
let product = {}
_this.planinnerLists = _this.planinnerLists.map((item, i) => {
if (i === fromIndex) {
item.product_info = {
...selectedProduct
}
product = {
...item
}
}
return item
})
_this.updateNoQuotaData(fromIndex, '', product);
})
},
onUnload() {
uni.$off('selectedProduct')
},
methods: {
change(e) {
console.log('当前模式:' + e.type + ',状态:' + e.show);
// 初始化订单数据
async initProduceMaterialPlanData() {
const params = {
'PARTNER': this.userInfo.customerCode
}
const res = await apiProduceMaterialPlanInit(params)
const {
HEAD,
YXDY,
ITEM
} = res.DATA
this.selectedSalesCenterArr = YXDY
this.planinnerLists[0] = {
...this.planinnerLists[0],
...ITEM[0]
}
this.HEADINFO = HEAD
this.productInitInfo = ITEM[0]
},
fnBackHome() {
this.$refs.popup.close()
async updateNoQuotaData(productIndex, mode = '', product) {
console.log('updateNoQuotaData---entry', productIndex, mode, product)
let item_inner = []
let productAfterInit = this.updateProductByInit(productIndex, mode, product)
console.log('productAfterInit', productAfterInit)
// 产品编号和件数 都有才请求
if (!(productAfterInit?.product_info?.PRODUCT_ID &&
productAfterInit?.PLANQTY_BOX)) {
return
}
item_inner = [productAfterInit]
const params = {
// "HEAD": this.HEADINFO,
"ITEM": item_inner,
}
const res = await apiUpdateProduceMaterialPlanData(params)
console.log('updateNoQuotaData', res)
this.planinnerLists = this.planinnerLists.map((item, i) => {
if (i === productIndex) {
item = {
...item,
...product,
...res.DATA[0]
}
}
return item
})
console.log('planinnerLists', this.planinnerLists)
},
fnCheckOrderByNo() {
this.$refs.popup.close()
uni.navigateTo({
url: `/pages/produce-material/produce-material`
// 更新选中的产品
updateProductByInit(productIndex, mode, product) {
const {
PRODUCT_ID,
SHORT_TEXT
} = product.product_info
let obj = {}
this.planinnerLists = this.planinnerLists.map((item, i) => {
if (i === productIndex) {
item.PRODUCT_ID = PRODUCT_ID
item.DESCRIPTION = SHORT_TEXT
item.PLANQTY_BOX = item.quantity
obj = item
}
return item
})
return obj
},
selectProduct(index) {
if (this.salesCenterIndex !== -1) {
uni.navigateTo({
url: `/pages/select-product-pro/select-product-pro?from=produceMaterialOrder&mode=&index=${index*1}&head=${JSON.stringify(this.HEADINFO)}`
});
} else {
uni.showToast({
title: '请先选择营销中心',
duration: 2000,
icon: 'none'
});
}
},
addPlanout() {
let product = {
checked: false,
"PRODUCT_ID": "",
"DESCRIPTION": "",
"SHORT_TEXT": "",
'product_info': {}
}
this.planinnerLists.unshift(product)
},
// 选择营销中心
bindPickerSalesCenterChange(e) {
console.log('picker发送选择改变,携带值为', e.detail.value)
this.salesCenterIndex = e.detail.value
this.selectedSalesCenter = this.selectedSalesCenterArr[this.salesCenterIndex]
this.HEADINFO.SALS_CENTER = this.selectedSalesCenter.VALUE
this.HEADINFO.ZZFLD00001H = this.selectedSalesCenter.VALUE
},
handleDel(index, ) {
this.planinnerLists.splice(index, 1)
},
fnBackHome() {
this.$refs.popup.close()
},
fnCheckOrderByNo() {
this.$refs.popup.close()
uni.navigateTo({
url: `/pages/produce-material/produce-material`
})
},
preStep() {
uni.switchTab({
url: `/pages/go-order/go-order`
......@@ -190,7 +319,41 @@
switchChange(e) {
console.log('switch1 发生 change 事件,携带值为', e.detail.value)
this.isChecked = e.detail.value
this.HEADINFO.PREORDER = e.detail.value === false ? 0 : 1
},
async submit() {
const params = {
HEAD: this.HEADINFO,
ITEM: this.planinnerLists
}
const res = await apiUpdateProduceMaterialOrder(params)
const {
DATA1: HEAD2,
DATA2: ITEM2
} = res
const params2 = {
HEAD: HEAD2,
ITEM: ITEM2
}
// this.HEADINFO = HEAD2
// this.planinnerLists = ITEM2
const res2 = await apiSubmitProduceMaterialOrder(params2)
this.orderInfo = res.DATA1
this.$refs.popup.open('center')
},
resetData() {
this.planinnerLists = []
this.salesCenterIndex = -1
this.selectedSalesCenter = {}
this.initProduceMaterialPlanData()
}
}
}
</script>
......@@ -320,9 +483,17 @@
.summary {
display: flex;
flex-direction: column;
justify-content: center;
justify-content: space-between;
padding: 32rpx 48rpx;
margin-bottom: 32rpx;
}
.salescenter {
display: flex;
align-items: center;
height: 100rpx;
padding: 0 16px 0 24px;
}
.summary-line {
......
......@@ -9,7 +9,7 @@
class="item-block-btn__text">{{itemHead.STATUS}}</text></button>
</view>
<view class="item-block item-block-name">
<text class="item-block-label item-block__label">配额生产计划</text>
<text class="item-block-label item-block__label">{{itemHead.PRODPLTYPE}}</text>
</view>
<view class="item-block">
<text class="item-block-label-des">{{itemHead.DATUM}}</text>
......
......@@ -105,7 +105,8 @@
import {
apiProducePlanInit,
apiUpdateProducePlanData,
apiUpdateProduceOrder
apiUpdateProduceOrder,
apiSubmitProduceOrder
} from '@/servers/produceOrder.js'
export default {
......@@ -113,7 +114,6 @@
return {
isChecked: false,
scrollTop: 0,
orderNo: '',
selectedSalesCenterArr: [{
KEY: -1,
VALUE: ''
......@@ -184,7 +184,7 @@
}
const res = await apiProducePlanInit(params)
const {
INFO,
HEAD,
YXDY,
ITEM
} = res.DATA
......@@ -193,7 +193,7 @@
...this.planinnerLists[0],
...ITEM[0]
}
this.HEADINFO = INFO
this.HEADINFO = HEAD
this.productInitInfo = ITEM[0]
},
async updateNoQuotaData(productIndex, mode = '', product) {
......@@ -213,7 +213,7 @@
item_inner = [productAfterInit]
const params = {
"INFO": this.HEADINFO,
"HEAD": this.HEADINFO,
"ITEM": item_inner,
}
const res = await apiUpdateProducePlanData(params)
......@@ -242,7 +242,7 @@
let obj = {}
this.planinnerLists = this.planinnerLists.map((item, i) => {
if (i === productIndex) {
item.ORDERED_PROD = PRODUCT_ID
item.PROD_ID = PRODUCT_ID
item.DESCRIPTION = SHORT_TEXT
item.PLANQTY_BOX = item.quantity
obj = item
......@@ -288,9 +288,6 @@
handleDel(index, ) {
this.planinnerLists.splice(index, 1)
},
change(e) {
console.log('当前模式:' + e.type + ',状态:' + e.show);
},
fnBackHome() {
this.resetData()
this.$refs.popup.close()
......@@ -314,11 +311,26 @@
async submit() {
const params = {
INFO: this.HEADINFO,
HEAD: this.HEADINFO,
ITEM: this.planinnerLists
}
const res = await apiUpdateProduceOrder(params)
const {
DATA1: HEAD2,
DATA2: ITEM2
} = res
const params2 = {
HEAD: HEAD2,
ITEM: ITEM2
}
// this.HEADINFO = HEAD2
// this.planinnerLists = ITEM2
const res2 = await apiSubmitProduceOrder(params2)
this.orderInfo = res.DATA1
this.$refs.popup.open('center')
......
import apiHelper from './api.helper.js'
/**
* 根据搜索条件查询材料计划信息。
* @param name 账户名
* @returns {Promise<AxiosResponse<T>>}
*/
export async function apiGetProduceMaterialOrder(params) {
const res = await apiHelper.post('/sap/bc/ztpm/to_new_crm/transdata/get_m_plan_app', params)
return res
}
/**
* 材料计划创建初始化数据。
* @param name 账户名
* @returns {Promise<AxiosResponse<T>>}
*/
export async function apiProduceMaterialPlanInit(params) {
const res = await apiHelper.post('/sap/bc/ztpm/to_new_crm/transdata/m_plan_init', params)
return res
}
/**
* 材料计划项目更新数据
* @param name 账户名
* @returns {Promise<AxiosResponse<T>>}
*/
export async function apiUpdateProduceMaterialPlanData(params) {
const res = await apiHelper.post('/sap/bc/ztpm/to_new_crm/transdata/m_plan_update', params)
return res
}
/**
* 材料计划单保存。
* @param
* @returns {Promise<AxiosResponse<T>>}
*/
export async function apiUpdateProduceMaterialOrder(params) {
const res = await apiHelper.post('/sap/bc/ztpm/to_new_crm/transdata/prodplan03', params)
return res
}
/**
* 材料计划单提交。
* @param
* @returns {Promise<AxiosResponse<T>>}
*/
export async function apiSubmitProduceMaterialOrder(params) {
const res = await apiHelper.post('/sap/bc/ztpm/to_new_crm/masterdata/materialplnsubm', params)
return res
}
/**
* 查询客户可售产品。
* @param captcha 验证码
* @returns {Promise<AxiosResponse<T>>}
*/
export async function apiProductSelect(params) {
const res = await apiHelper.post('/sap/bc/ztpm/to_new_crm/transdata/bp_pro_search', params)
return res
}
......@@ -32,11 +32,21 @@ export async function apiUpdateProducePlanData(params) {
}
/**
* 生产计划单提交
* 生产计划单保存
* @param
* @returns {Promise<AxiosResponse<T>>}
*/
export async function apiUpdateProduceOrder(params) {
const res = await apiHelper.post('/sap/bc/ztpm/to_new_crm/transdata/prodplan03', params)
return res
}
/**
* 生产计划单提交。
* @param
* @returns {Promise<AxiosResponse<T>>}
*/
export async function apiSubmitProduceOrder(params) {
const res = await apiHelper.post('/sap/bc/ztpm/to_new_crm/transdata/prodplan003', params)
return res
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment