Răsfoiți Sursa

feat: 新增工序选择功能及相关组件

liujt 8 luni în urmă
părinte
comite
d1f3d5b707

+ 31 - 1
api/purchasingManage/purchaseNeedManage.js

@@ -38,4 +38,34 @@ export async function deleteInformation(data) {
         return res.data;
     }
     return Promise.reject(new Error(res.message));
-}
+}
+
+//工序分页
+export async function producetask(params) {
+  const res = await get(Vue.prototype.apiUrl + '/main/producetask/page', params);
+  if (res.code == 0) {
+    return res.data;
+  }
+}
+
+/**
+ * 更新信息
+ */
+export async function UpdateInformation(data) {
+  const res = await put(Vue.prototype.apiUrl + `/eom/purchaserequirement/update`, data);
+  if (res.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.message));
+}
+
+/**
+ * 新增信息
+ */
+export async function addPurchaseNeedManage(data) {
+  const res = await post(Vue.prototype.apiUrl + `/eom/purchaserequirement/save`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 10 - 10
api/saleManage/contact/index.js

@@ -247,16 +247,16 @@ export async function queryContactIdCount(id) {
 //   }
 //   return Promise.reject(new Error(res.data.message));
 // }
-// /**
-//  * 通过产品查供应商
-//  */
-// export async function contactQueryByCategoryIdsAPI(data) {
-//   const res = await request.post('/eom/contact/queryByCategoryIds', data);
-//   if (res.data.code == 0) {
-//     return res.data.data;
-//   }
-//   return Promise.reject(new Error(res.data.message));
-// }
+/**
+ * 通过产品查供应商
+ */
+export async function contactQueryByCategoryIdsAPI(data) {
+  const res = await request.post('/eom/contact/queryByCategoryIds', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
 
 // /**
 //  * 发布动态

+ 6 - 4
enum/dict.js

@@ -4,6 +4,8 @@ export default {
   资产类型: 'ASSECTSTYPE',
   物品类型: 'classify',
   产地: 'purchase_origin',
+  物品机型: 'product_model_key',
+  物品颜色: 'product_color_key',
 }
 
 //发货审核状态
@@ -17,10 +19,10 @@ export const reviewStatusEnum = [
 
 //商品级别
 export const levelList = [
-  { value: '1', label: '特级' },
-  { value: '2', label: '一级' },
-  { value: '3', label: '二级' },
-  { value: '4', label: '三级' }
+  { value: '1', text: '特级' },
+  { value: '2', text: '一级' },
+  { value: '3', text: '二级' },
+  { value: '4', text: '三级' }
 ];
 
 //属性类型

+ 8 - 0
pages.json

@@ -2105,6 +2105,14 @@
 				"navigationStyle": "custom",
 				"navigationBarTextStyle": "white"
 			}
+		}, 
+		{
+			"path": "pages/purchasingManage/components/selectTaskName",
+			"style": {
+				"navigationBarTitleText": "选择工序",
+				"navigationStyle": "custom",
+				"navigationBarTextStyle": "white"
+			}
 		},
 		{
 			"path": "pages/saleManage/components/selectUser",

+ 0 - 127
pages/purchasingManage/components/myButtons.vue

@@ -1,127 +0,0 @@
-<template>
-
-	<u-popup :show="show" @close="show=false">
-		<u-button :type="item.btnType" v-if="judge(item)" :text="item.name" @click="action(item)"
-			v-for="(item,index) in btnList" :key="index"></u-button>
-	</u-popup>
-
-
-
-</template>
-
-<script>
-	export default {
-		props: {
-			btnList: {
-				type: Array,
-				default: () => []
-			},
-			current: {
-				type: Object,
-				default: () => {}
-			}
-
-		},
-
-		data() {
-			return {
-				show: false,
-			}
-		},
-		computed: {
-			judge() {
-				return (item) => {
-					if (item.judge) {
-						let is = true
-						item.judge.forEach(({
-							key,
-							value
-						}) => {
-							if (!value.includes(this.current[key])) {
-								is = false
-							}
-						})
-
-						return is
-					} else {
-						return true
-					}
-				}
-
-			}
-		},
-		methods: {
-			action(item) {
-				this.show = false
-				if (item.type == 1) {
-					uni.navigateTo({
-						url: item.pageUrl + '?id=' + this.current.id
-					})
-				} else {
-					this.$emit(item.apiName)
-
-				}
-
-			},
-
-		}
-
-	}
-</script>
-
-
-<style lang="scss" scoped>
-	.card_box {
-		width: 750rpx;
-		padding: 16rpx 32rpx;
-		box-sizing: border-box;
-		border-bottom: 2rpx solid #E1E1E1;
-
-
-		.item_box {
-			margin-top: 10rpx;
-
-			.round {
-				width: 40rpx;
-				height: 40rpx;
-				line-height: 40rpx;
-				border-radius: 50%;
-				background: $theme-color;
-				color: #fff;
-				text-align: center;
-				font-size: 20rpx;
-			}
-
-			.orderId {
-				color: #000;
-				font-family: PingFang HK;
-				font-size: 28rpx;
-				font-style: normal;
-				font-weight: 600;
-
-			}
-
-			.item_one {
-				width: 100%;
-				font-size: 26rpx;
-				font-style: normal;
-				font-weight: 400;
-				line-height: 38rpx;
-				word-wrap: break-word;
-
-			}
-
-			.gylx {
-				color: $theme-color;
-			}
-
-			.perce50 {
-				width: 50%;
-			}
-
-			.perce100 {
-				width: 100% !important;
-			}
-		}
-	}
-</style>

+ 0 - 258
pages/purchasingManage/components/myCard copy.vue

@@ -1,258 +0,0 @@
-<template>
-
-	<view class="card_box">
-
-
-		<view class="item_box rx-bc" v-for="(_item,i) in columns" :key="i">
-			<view class="perce50" :class="val.className" :style="val.style" v-for="(val) in _item" :key="val.prop">
-				<view class="item_box rx-sc" v-if="val.type=='title'">
-					<view class="round" v-if='index'>{{index}}</view>
-					<view class="orderId" :style="{marginLeft: index?'16rpx':''}" v-if="val.slot">
-						<slot :name="val.slot"> </slot>
-
-					</view>
-					<view class="orderId" :style="{marginLeft: index?'16rpx':''}" v-else>
-
-						{{item[val.prop]||''}}
-					</view>
-
-				</view>
-
-				<view class="item_one rx-sc" v-else-if="val.type=='action'">
-					<view class="lable">{{val.label}}</view>
-					<view class="text">
-						<template v-for="(btn,bI) in btnList">
-							<u-button :plain="true" :hairline="true" size='mini' :type="btn.btnType" v-if="judge(btn)"
-								:text="btn.name" @click="action(btn)" :key="bI"></u-button>
-						</template>
-
-					</view>
-
-				</view>
-				<view class="item_one rx-sc kk" v-else>
-					<view class="lable">{{val.label}}</view>
-					<view class="text" v-if="val.formatter">{{val.formatter(item)||''}}</view>
-					<view class="text" v-else-if="val.slot">
-						<slot :name="val.slot"> </slot>
-					</view>
-					<view class="text" v-else>{{item[val.prop]||''}}</view>
-				</view>
-
-			</view>
-		</view>
-
-	</view>
-
-</template>
-
-<script>
-	export default {
-		props: {
-
-			btnList: {
-				type: Array,
-				default: () => []
-			},
-
-			item: {
-				type: Object,
-				default: () => ({})
-			},
-			columns: {
-				type: Array,
-				default: () => []
-			},
-			index: '',
-
-		},
-		computed: {
-			judge() {
-				return (item) => {
-					if (item.judge) {
-						let is = true
-						item.judge.forEach(({
-							key,
-							value,
-							authorities
-						}) => {
-							if (authorities) {
-								is = this.$isAuthorities(authorities)
-							}
-							if (value && !value.includes(this.item[key])) {
-								is = false
-							}
-						})
-						return is
-					} else {
-						return true
-					}
-				}
-
-			}
-		},
-		data() {
-			return {
-
-			}
-		},
-		methods: {
-			action(item) {
-				if (item.type == 1) {
-					uni.navigateTo({
-						url: item.pageUrl + '?id=' + this.item.id + (item.query || '')
-					})
-				} else {
-					this.$emit(item.apiName)
-				}
-
-			},
-		}
-
-	}
-</script>
-
-
-<style lang="scss" scoped>
-	.card_box {
-		width: 750rpx;
-		padding: 16rpx 32rpx;
-		box-sizing: border-box;
-		border-bottom: 2rpx solid #E1E1E1;
-
-		.rx-bc {
-			align-items: start;
-			flex-flow: row wrap;
-
-			>view {
-				margin-top: 8rpx;
-			}
-		}
-
-		.rx-sc {
-			align-items: start;
-		}
-
-		.item_box {
-			// margin-top: 10rpx;
-
-			.text {
-				display: flex;
-				// padding-right: 6rpx;
-				flex: 1;
-
-				uni-button:after {
-					border: none;
-				}
-
-				;
-
-				uni-button {
-					width: 100rpx;
-					// height: 50rpx;
-					margin-left: 10rpx;
-					margin-right: 0;
-					color: #fff !important;
-					border: none;
-					background: #157a2c;
-
-
-					// border: none;
-
-					// /deep/uni-text {
-					// 	font-size: 26rpx !important;
-					// }
-				}
-			}
-
-
-			.kk .text {
-				overflow: hidden;
-				text-overflow: ellipsis;
-				display: -webkit-box;
-				-webkit-box-orient: vertical;
-				-webkit-line-clamp: 2;
-				word-break: break-word;
-			}
-
-			.round {
-				width: 40rpx;
-				height: 40rpx;
-				line-height: 40rpx;
-				border-radius: 50%;
-				background: $theme-color;
-				color: #fff;
-				text-align: center;
-				font-size: 20rpx;
-			}
-
-			.orderId {
-				color: #000;
-				font-family: PingFang HK;
-				font-size: 28rpx;
-				font-style: normal;
-				font-weight: 600;
-
-			}
-
-			.item_one {
-				width: 100%;
-				font-size: 26rpx;
-				font-style: normal;
-				font-weight: 400;
-				line-height: 38rpx;
-				word-wrap: break-word;
-
-			}
-
-			.gylx {
-				color: $theme-color;
-			}
-
-			.perce50 {
-				min-width: 50%;
-			}
-
-			.perce100 {
-				width: 100% !important;
-			}
-		}
-	}
-
-	/deep/.u-input {
-		padding: 0 !important;
-		height: 44rpx !important;
-		font-size: 26rpx !important;
-	}
-
-	/deep/.u-input__content__field-wrapper__field {
-		font-size: 26rpx !important;
-	}
-
-	/deep/.uni-date-editor--x .uni-date__icon-clear {
-		border: none !important;
-	}
-
-	/deep/.uni-date__x-input,
-	/deep/.uni-date-x {
-		padding: 0 !important;
-		height: 44rpx !important;
-		font-size: 26rpx !important;
-	}
-
-	/deep/.input-value {
-		font-size: 26rpx !important;
-		height: 44rpx !important;
-
-		uni-text {
-			font-size: 26rpx !important;
-		}
-	}
-
-	/deep/.u-textarea {
-		padding: 2px !important;
-	}
-
-	/deep/.u-textarea__field {
-		font-size: 26rpx !important;
-	}
-</style>

+ 298 - 239
pages/purchasingManage/components/produceList.vue

@@ -2,9 +2,132 @@
 	<view class="mainBox">
 		<view v-for="(item, index) in tableList" :key="index" style="position: relative;">
 			<myCard :item="item" :btnList="btnList" :index="index+1" :columns="columns" @del="del(index)">
-				<u--input slot="purchaseCount" @input="changeCount(item,index)" type="number" placeholder="请输入"
-					border="surround" :disabled="!!contractId" v-model="item.purchaseCount">
-				</u--input>
+				<view class="slot-box" slot="productName">
+					<u-row>
+						<u-col span="10">
+							<u--input placeholder="请输入" border="surround" disabled v-model="item.productName"></u--input>
+						</u-col>
+						<u-col span="2">
+							<u-button type="primary" size="mini" @click="selectProduct(item, index)" text="选择"></u-button>
+						</u-col>
+					</u-row>
+				</view>
+
+				<view slot="purchaseCount">
+					<view v-if="isDrawer">
+						{{ item.purchaseCount + ' ' + (item.purchaseUnit || '') }}
+					</view>
+					<view v-else>
+						<u-row>
+							<u-col span="6">
+								<u--input placeholder="请输入" type="number" border="surround" v-model="item.purchaseCount"></u--input @input="changeCount(item, index)">
+							</u-col>
+							<u-col span="6">
+								<uni-data-picker v-model="item.purchaseUnit" placeholder="请选择" :localdata="item.packageDispositionList" @change="changeCount(item, index)"></uni-data-picker>
+							</u-col>
+						</u-row>
+					</view>
+				</view>
+
+				<view slot="goodsLevel">
+					<view v-if="isDrawer">
+						{{ item.goodsLevel }}
+					</view>
+					<view v-else>
+						<uni-data-picker v-model="item.goodsLevel" placeholder="请选择" :localdata="levelList"></uni-data-picker>
+					</view>
+				</view>
+
+				<view slot="arrivalWay">
+					<view v-if="isDrawer">{{ item.arrivalWay }}</view>
+					<view v-else>
+						<uni-data-picker v-model="item.arrivalWay" placeholder="请选择" :localdata="arrivalWayList"></uni-data-picker>
+					</view>
+				</view>
+
+				<view slot="expectReceiveDate">
+					<view v-if="isDrawer">{{ item.expectReceiveDate }}</view>
+					<view v-else>
+						<view v-if="item.arrivalWay == 1">
+							<uni-datetime-picker type="date" v-model="item.expectReceiveDate"></uni-datetime-picker>
+						</view>
+						<view v-else>
+							<span @click="settingDate(item, index)" style="color: #409eff;">设置分批时间</span>
+						</view>
+						
+					</view>
+				</view>
+
+				<view slot="taskName">
+					<view v-if="isDrawer">{{ item.taskName }}</view>
+					<view v-else>
+						<u-row>
+							<u-col span="10">
+								<u--input placeholder="" disabled border="surround" v-model="item.taskName"></u--input @input="changeCount(item, index)">
+							</u-col>
+							<u-col span="2">
+								<u-button type="primary" size="mini" @click="selectTaskName(item, index)" text="选择"></u-button>
+							</u-col>
+						</u-row>
+					</view>
+				</view>
+
+				<view slot="supplierName">
+					<view v-if="isDrawer">{{ item.supplierName }}</view>
+					<view v-else>
+						<uni-data-picker v-model="item.supplierName" placeholder="请选择" :localdata="arrivalWayList"></uni-data-picker>
+					</view>
+				</view>
+
+				<view slot="provenance">
+					<view v-if="isDrawer">{{ item.provenance }}</view>
+					<view v-else>
+						<uni-data-picker v-model="item.provenance" placeholder="请选择" :localdata="purchase_origin"></uni-data-picker>
+					</view>
+				</view>
+
+				<view slot="brand">
+					<view v-if="isDrawer">{{ item.brand }}</view>
+					<view v-else>
+						<u--input placeholder="请输入" border="surround" disabled v-model="item.productName"></u--input>
+					</view>
+				</view>
+
+				<view slot="modelKey">
+					<view v-if="isDrawer">{{ item.modelKey }}</view>
+					<view v-else>
+						<!-- <u--input placeholder="请输入" border="surround" disabled v-model="item.modelKey"></u--input> -->
+						<uni-data-select
+							multiple
+							:localdata="product_model_key"
+							v-model="item.modelKey"
+						></uni-data-select>
+					</view>
+				</view>
+
+				<view slot="colorKey">
+					<view v-if="isDrawer">{{ item.colorKey }}</view>
+					<view v-else>
+						<!-- <u--input placeholder="请输入" border="surround" disabled v-model="item.colorKey"></u--input> -->
+						<uni-data-select
+							multiple
+							:localdata="product_color_key"
+							v-model="item.colorKey"
+						></uni-data-select>
+					</view>
+				</view>
+
+				<view slot="remark">
+					<view v-if="isDrawer">{{ item.colorKey }}</view>
+					<view v-else>
+						<u--input placeholder="请输入" border="surround" v-model="item.remark"></u--input>
+					</view>
+				</view>
+
+				<fileMain slot="technicalDrawings" :type="isDrawer ? 'view' : ''" v-model="item.technicalDrawings"></fileMain>
+				<fileMain slot="files" :type="isDrawer ? 'view' : ''" v-model="item.files"></fileMain>
+
+				
 				<u--input :disabled="!!contractId" slot="singleWeight" @input="singleWeightChange(item,index)"
 					type="number" placeholder="请输入" border="surround" v-model="item.singleWeight"></u--input>
 				<u--input :disabled="!!contractId" slot="singlePrice" style="flex:none;width: 50%;"
@@ -30,59 +153,65 @@
 					v-model="item.specification">
 
 				</u--input>
-				<u--input slot="goodsLevel" placeholder="请输入" border="surround" :disabled="item.productCode"
+				<!-- <u--input slot="goodsLevel" placeholder="请输入" border="surround" :disabled="item.productCode"
 					v-model="item.goodsLevel">
-				</u--input>
+				</u--input> -->
 				<u--input slot="modelType" placeholder="请输入" border="surround" :disabled="item.productCode"
 					v-model="item.modelType">
 				</u--input>
 
-				<u--input slot="productName" placeholder="请输入" border="surround" :disabled="item.productCode"
+				<!-- <u--input slot="productName" placeholder="请输入" border="surround" :disabled="item.productCode"
 					v-model="item.productName">
-				</u--input>
-
-				<fileMain slot="files" type="view" v-model="item.files"></fileMain>
+				</u--input> -->
+				
 			</myCard>
 		</view>
 
-		<view style="height: 84rpx;" v-if="isDrawer"></view>
-		<view class="footerButton" v-if="isDrawer">
+		<view style="height: 84rpx;" v-if="!isDrawer"></view>
+		<!-- <view class="footerButton" v-if="!isDrawer">
 			<u-button type="primary" @click="save" text="保存"></u-button>
-		</view>
-		<view class="add" @click="add" v-if="isDrawer">
+		</view> -->
+		<view class="add" @click="add" v-if="!isDrawer">
 			<u-icon name="plus" color="#fff"></u-icon>
 		</view>
 		<u-action-sheet :actions="addList" :show="show" :closeOnClickOverlay="true" :closeOnClickAction="true"
 			@close="show=false" @select='select'> </u-action-sheet>
+		<timePopup ref="timePopupRef" @confirm="handleTimeConfirm"></timePopup>
 	</view>
 </template>
-
+<!-- 名称,数量,单位,到货方式,到货日期 -->
 <script>
 	import {
 		getByCode
 	} from '@/api/pda/common.js'
 	import myCard from './myCard.vue'
 	import { mapActions, mapGetters } from 'vuex'
-	import dictEnum from '@/enum/dict'
 	import { levelList, lbjtList } from '@/enum/dict'
 	import fileMain from "@/pages/doc/index.vue"
+	import { changeCount } from '@/utils/setProduct.js';
+	import timePopup from './timePopup.vue'
 		
 	export default {
 
 		data() {
 			return {
 				tableList: [],
-				addList: [{
-						name: '选择物品清单',
-
-					},
-					{
-						name: '新增临时产品',
-					}
+				addList: [
+					{ name: '选择物品清单', },
+					{ name: '新增临时产品', }
+				],
+				arrivalWayList: [
+					{ text: '一次性到货', value: 1 },
+					{ text: '分批到货', value: 2 }
 				],
 				show: false,
+				purchaseUnitShow: false,
 				current: {},
+				currentIndex: -1,
 				date_unit: [],
+				product_color_key: [],
+				product_model_key: [],
+				purchase_origin: [],
 				allPrice: '',
 				btnList: [{
 					name: '删除',
@@ -102,8 +231,8 @@
 					guaranteePeriodUnitCode: '',
 					technicalDrawings: [],
 					arrivalWay: 1
-				}
-
+				},
+				levelList
 			}
 		},
 		props: {
@@ -119,165 +248,11 @@
 				default: false
 			},
 			contractId: '',
-			// columns: {
-			// 	type: Array,
-			// 	default: () => [
-			// 		[{
-			// 			label: '名称:',
-			// 			prop: 'productName',
-			// 			slot: 'productName',
-			// 			type: 'title',
-			// 			className: 'perce100',
-			// 		}],
-			// 		[{
-			// 			label: '编码:',
-			// 			prop: 'productCode'
-			// 		}, {
-			// 			label: '分类:',
-			// 			prop: 'productCategoryName',
-			// 		}],
-			// 		[{
-			// 			label: '数量:',
-			// 			prop: 'purchaseCount',
-			// 			// slot: 'purchaseCount',
-			// 			formatter: (item) => {
-			// 				if (item.purchaseCount) {
-			// 					return item.purchaseCount + ' ' + (item.purchaseUnit || '');
-			// 				}
-			// 			}
-			// 		}, 
-			// 		{
-			// 			label: '计量数量:',
-			// 			prop: 'totalCount',
-			// 			formatter: (item) => {
-			// 				if (item.totalCount) {
-			// 					return item.totalCount + ' ' + (item.measuringUnit || '');
-			// 				}
-			// 			}
-			// 		}],
-			// 		[{
-			// 			label: '包装规格:',
-			// 			prop: 'packingSpecification',
-			// 		}, {
-			// 			label: '物品级别:',
-			// 			prop: 'goodsLevel',
-			// 			formatter: (item) => {
-			// 			return levelList.find((i) => i.value == item.goodsLevel)
-			// 				?.label;
-			// 			},
-			// 		}],
-			// 		[{
-			// 			label: '库存数量:',
-			// 			prop: 'availableCountBase',
-			// 		}],
-			// 		[{
-			// 			label: '已采数量:',
-			// 			prop: 'doneTotalCount',
-			// 			formatter: (item) => {
-			// 				if (item.doneTotalCount) {
-			// 					return item.doneTotalCount + ' ' + (item.measuringUnit || '');
-			// 				}
-			// 			}
-			// 		}, {
-			// 			label: '待采数量:',
-			// 			prop: 'waitTotalCount',
-			// 			formatter: (item) => {
-			// 				if (item.waitTotalCount) {
-			// 					return item.waitTotalCount + ' ' + (item.measuringUnit || '');
-			// 				}
-			// 			}
-			// 		}],
-			// 		[{
-			// 			label: '工序:',
-			// 			prop: 'taskName',
-			// 		}, {
-			// 			label: '批次号:',
-			// 			prop: 'batchNo',
-			// 		}],
-			// 		[{
-			// 			label: '供应商:',
-			// 			prop: 'supplierName',
-			// 		}, {
-			// 			label: '产地:',
-			// 			prop: 'provenance',
-			// 			formatter: (item) => {
-			// 				// return item.provenance
-			// 				return item.provenance && item.provenance.length
-			// 					? item.provenance
-			// 						.map((item) => this.getDictValue('产地', item))
-			// 						.join(',')
-			// 					: '';
-			// 			}
-			// 		}],
-			// 		[{
-			// 			label: '型号:',
-			// 			prop: 'modelType',
-			// 			className: 'perce100',
-			// 		}],
-			// 		[{
-			// 			label: '规格:',
-			// 			prop: 'specification',
-			// 		}, {
-			// 			label: '品牌:',
-			// 			prop: 'brand',
-			// 		}],
-			// 		[{
-			// 			label: '机型:',
-			// 			prop: 'modelKey',
-			// 		}, {
-			// 			label: '颜色:',
-			// 			prop: 'colorKey',
-			// 		}],
-			// 		[{
-			// 			label: '到货方式:',
-			// 			prop: 'arrivalWay',
-			// 			formatter: (item) => {
-			// 				return item.arrivalWay == 1 ? '一次性到货' : '分批到货';
-			// 			},
-			// 		}],
-			// 		[{
-			// 			label: '到货日期:',
-			// 			prop: 'expectReceiveDate',
-			// 			slot: 'expectReceiveDate',
-			// 		}, {
-			// 			label: '属性类型:',
-			// 			prop: 'produceType',
-			// 			formatter: (item) => {
-			// 				if (item.produceType) {
-			// 					return item.produceType
-			// 					.map((i) => {
-			// 						return lbjtList[i];
-			// 					})
-			// 					.toString();
-			// 				}
-			// 			}
-			// 		}],
-			// 		[{
-			// 			label: '图纸附件:',
-			// 			prop: 'technicalDrawings',
-			// 			slot: 'technicalDrawings',
-			// 		}, {
-			// 			label: '附件:',
-			// 			prop: 'files',
-			// 			slot: 'files',
-			// 		}],
-			// 		[{
-			// 			label: '备注:',
-			// 			prop: 'remark',
-			// 			className: 'perce100',
-			// 		}],
-			// 		[{
-			// 			label: '操作:',
-			// 			prop: 'action',
-			// 			type: 'action',
-			// 			className: 'perce100',
-			// 		}],
-
-			// 	]
-			// }
 		},
 		components: {
-			myCard
+			myCard,
+			fileMain,
+			timePopup
 		},
 		computed: {
 			...mapGetters(['dict', 'getDict', 'getDictValue']),
@@ -286,7 +261,7 @@
 					[{
 						label: '名称:',
 						prop: 'productName',
-						// slot: 'productName',
+						slot: 'productName',
 						type: 'title',
 						className: 'perce100',
 					}],
@@ -300,34 +275,39 @@
 					[{
 						label: '数量:',
 						prop: 'purchaseCount',
-						// slot: 'purchaseCount',
-						formatter: (item) => {
-							if (item.purchaseCount) {
-								return item.purchaseCount + ' ' + (item.purchaseUnit || '');
-							}
-						}
-					}, 
-					{
-						label: '计量数量:',
-						prop: 'totalCount',
-						formatter: (item) => {
-							if (item.totalCount) {
-								return item.totalCount + ' ' + (item.measuringUnit || '');
+						slot: 'purchaseCount',
+						className: 'perce100',
+						// formatter: (item) => {
+						// 	if (item.purchaseCount) {
+						// 		return item.purchaseCount + ' ' + (item.purchaseUnit || '');
+						// 	}
+						// }
+					}],
+					[
+						{
+							label: '计量数量:',
+							prop: 'totalCount',
+							formatter: (item) => {
+								if (item.totalCount) {
+									return item.totalCount + ' ' + (item.measuringUnit || '');
+								}
 							}
+						},
+						{
+							label: '包装规格:',
+							prop: 'packingSpecification',
 						}
-					}],
+					],
 					[{
-						label: '包装规格:',
-						prop: 'packingSpecification',
-					}, {
 						label: '物品级别:',
 						prop: 'goodsLevel',
-						formatter: (item) => {
-						return levelList.find((i) => i.value == item.goodsLevel)
-							?.label;
-						},
-					}],
-					[{
+						slot: 'goodsLevel',
+						// formatter: (item) => {
+						// return levelList.find((i) => i.value == item.goodsLevel)
+						// 	?.label;
+						// },
+					},
+					{
 						label: '库存数量:',
 						prop: 'availableCountBase',
 					}],
@@ -351,24 +331,29 @@
 					[{
 						label: '工序:',
 						prop: 'taskName',
-					}, {
+						slot: 'taskName',
+						className: 'perce100',
+					}], 
+					[{
 						label: '批次号:',
 						prop: 'batchNo',
 					}],
 					[{
 						label: '供应商:',
 						prop: 'supplierName',
+						slot: 'supplierName'
 					}, {
 						label: '产地:',
 						prop: 'provenance',
-						formatter: (item) => {
-							// return item.provenance
-							return item.provenance && item.provenance.length
-								? item.provenance
-									.map((item) => this.getDictValue('产地', item))
-									.join(',')
-								: '';
-						}
+						slot: 'provenance',
+						// formatter: (item) => {
+						// 	// return item.provenance
+						// 	return item.provenance && item.provenance.length
+						// 		? item.provenance
+						// 			.map((item) => this.getDictValue('产地', item))
+						// 			.join(',')
+						// 		: '';
+						// }
 					}],
 					[{
 						label: '型号:',
@@ -381,20 +366,24 @@
 					}, {
 						label: '品牌:',
 						prop: 'brand',
+						slot: 'brand'
 					}],
 					[{
 						label: '机型:',
 						prop: 'modelKey',
+						slot: 'modelKey'
 					}, {
 						label: '颜色:',
 						prop: 'colorKey',
+						slot: 'colorKey'
 					}],
 					[{
 						label: '到货方式:',
 						prop: 'arrivalWay',
-						formatter: (item) => {
-							return item.arrivalWay == 1 ? '一次性到货' : '分批到货';
-						},
+						slot: 'arrivalWay',
+						// formatter: (item) => {
+						// 	return item.arrivalWay == 1 ? '一次性到货' : '分批到货';
+						// },
 					}],
 					[{
 						label: '到货日期:',
@@ -435,12 +424,14 @@
 					}],
 
 				]
-			}
+			},
 		},
 		created() {
+			this.getByCode()
 			// this.requestDict('产地')
 			uni.$off('setProduceList')
 			uni.$on('setProduceList', (data) => {
+				console.log('setProduceList~~', data)
 				data.forEach(item => {
 					item['productId'] = item.id
 					item['categoryName'] = item.name
@@ -451,20 +442,60 @@
 					item['productName'] = item.name
 					item['approvalNumber'] = item.extField.approvalNumber
 					item['packingSpecification'] = item.extField.packingSpecification
-					item['packageDispositionList'] = item.packageDispositionList
+					item['packageDispositionList'] = item.packageDispositionList.map(i => {
+						return {
+							...i,
+							text: i.conversionUnit,
+							value: i.id
+						}
+					})
 
 					if (item.packageDispositionList?.length) {
-						item['saleUnitId'] = item.packageDispositionList[0].id
-						item['saleUnit'] = item.packageDispositionList[0].conversionUnit
+						item['purchaseUnitId'] = item.packageDispositionList[0].id
+						item['purchaseUnit'] = item.packageDispositionList[0].conversionUnit
 
 					}
+
 				})
-				this.tableList.push(...data)
+				console.log(this.currentIndex, this.current)
+				if(this.currentIndex > -1) {
+						console.log(111)
+						// 使用this.$set更新数组项
+						if (data && data.length > 0) {
+							this.$set(this.tableList, this.currentIndex, data[0]);
+						}
+						this.currentIndex = -1;
+						this.current = {};
+				} else {
+					console.log(222)
+					this.tableList.push(...data)
+				}
+				
 			})
 
-			this.getByCode()
+			uni.$off('setTaskName')
+			uni.$on('setTaskName', (data) => {
+				console.log('setTaskName~~', data)
+				
+				console.log(this.currentIndex, this.current)
+				if(this.currentIndex > -1) {
+						console.log(111)
+						// 使用this.$set更新数组项
+						if (data && data.length > 0) {
+							this.$set(this.tableList[this.currentIndex], 'taskId', data[0].id);
+							this.$set(this.tableList[this.currentIndex], 'taskName', data[0].name);
+							this.$set(
+								this.tableList[this.currentIndex],
+								'routingId',
+								data[0].produceRoutingId
+							);
+						}
+						
+						this.currentIndex = -1;
+						this.current = {};
+				}
+			})
 		},
-
 		watch: {
 			contractId(val) {
 				if (val) {
@@ -475,6 +506,15 @@
 		},
 		methods: {
 			...mapActions('dict', ['requestDict']),
+			settingDate(item, index) {
+				console.log(item, index)
+				this.current = item;
+				this.currentIndex = index;
+				this.$refs.timePopupRef.open(item, index)
+			},
+			handleTimeConfirm(data) {
+				this.$set(this.tableList[this.currentIndex], 'arrivalBatch', data)
+			},
 			add() {
 				if (this.isTemporary) {
 					this.show = true
@@ -483,8 +523,6 @@
 						url: '/pages/saleManage/components/selectProduce?isAll=' + 1
 					})
 				}
-
-
 			},
 			select({
 				name
@@ -496,9 +534,21 @@
 				} else {
 					this.handlAdd()
 				}
-
-
-
+			},
+			selectProduct(item, index) {
+				this.current = item;
+				this.currentIndex = index;
+				uni.navigateTo({
+					url: '/pages/saleManage/components/selectProduce?isAll=' + 2
+				})
+			},
+			selectTaskName(item, index) {
+				console.log(item, index)
+				this.current = item;
+				this.currentIndex = index;
+				uni.navigateTo({
+					url: '/pages/purchasingManage/components/selectTaskName?isAll=' + 2
+				})
 			},
 			// 添加
 			handlAdd() {
@@ -510,7 +560,6 @@
 				if (list) {
 					this.tableList = JSON.parse(JSON.stringify(list))
 					this.getTotalPrice(list)
-
 				}
 			},
 			getValue() {
@@ -518,12 +567,11 @@
 			},
 
 			del(index) {
-
 				this.tableList.splice(index, 1);
 
 			},
 			getByCode() {
-				const codeS = ['date_unit']
+				const codeS = ['product_model_key', 'product_color_key', 'purchase_origin']
 				codeS.forEach(async (code) => {
 					const codeValue = await getByCode(code);
 					this[code] = codeValue.map(item => {
@@ -533,16 +581,27 @@
 							text: item[key]
 						}
 					})
+					console.log(code, this[code])
 				})
-
+				console.log('1111~~~~~~~~~', this.purchase_origin)
 			},
 			save() {
 				uni.$emit('setBusinessOpportunity')
 			},
 			//改变数量
 			changeCount(row, index) {
-				this.singleWeightChange(row, index);
-				this.getTotalPrice();
+				// this.singleWeightChange(row, index);
+				// this.getTotalPrice();
+				this.$set(
+					this.tableList,
+					index,
+					changeCount(row, {
+						countKey: 'purchaseCount',
+						unitKey: 'purchaseUnit',
+						unitIdKey: 'purchaseUnitId'
+					})
+				);
+				this.$forceUpdate();
 			},
 			//计算总金额
 			getTotalPrice(row) {
@@ -592,7 +651,6 @@
 			//计算单重
 			singleWeightChange(row, index) {
 
-
 				if (row.weightUnit == row.measuringUnit) {
 					this.$set(this.tableList[index], 'totalWeight', row.totalCount);
 				} else if (row.totalCount && row.singleWeight) {
@@ -654,8 +712,6 @@
 					this.$set(this.tableList[index], 'customerMark', val)
 				})
 			},
-
-
 		}
 	}
 </script>
@@ -675,6 +731,10 @@
 		z-index: 99;
 	}
 
+	.slot-box {
+		display: flex;
+	}
+
 	.footerButton {
 		width: 100%;
 		height: 84rpx;
@@ -693,7 +753,6 @@
 		}
 	}
 
-
 	/deep/.u-swipe-action-item__right__button__wrapper {
 		background-color: #f56c6c !important;
 	}

+ 0 - 424
pages/purchasingManage/components/selectContact.vue

@@ -1,424 +0,0 @@
-<template>
-	<view class="mainBox">
-		<uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="选择" @clickLeft="backAdd">
-			<!--右菜单-->
-			<template slot="right">
-				<u-button type="success" size="small" class="u-reset-button" @click="$refs.treePicker._show()"
-					text="选择分类"></u-button>
-			</template>
-		</uni-nav-bar>
-		<view class="searchBox">
-			<input v-model="searchVal" placeholder="请输入名称" class="searchInput" />
-			<u-button type="icon-shixiangxinzeng" size="30" @click="doSearch" data-icon="Search" class="searchBtn">
-				<view class="iconfont icon-sousuo"></view>
-				<view class="text">搜索</view>
-			</u-button>
-		</view>
-		<view class="wrapper">
-			<u-list @scrolltolower="scrolltolower" class="listContent">
-				<checkbox-group v-for="(item, index) in listData" :key="index" @change="e => selectVal(e, item, index)">
-					<label>
-						<view class="listBox">
-							<view class="listBox-sel">
-								<checkbox :value="item.code" color="#fff" :disabled="item.disabled"
-									:checked="item.checked" />
-							</view>
-							<view class="listBox-con">
-								<view class="listBox-top">
-									<view class="listBox-name">
-										{{ item.name }}
-									</view>
-
-								</view>
-								<view class="listBox-bottom">
-									<!-- <view v-for="(itm, index) in tableHeader" :key="index">{{ itm.label }}:{{ item[itm.prop] }}</view> -->
-									<view>客户代号:{{ item.serialNo||'' }}</view>
-									<view>详细地址:{{(item.addressName||'')+item.address||''}}</view>
-									<view>是否指派:{{(item.assignStatus=== 1 ? '是' : '否')||''}}</view>
-									<view>销售员:{{item.salesmanName||''}}</view>
-									<view>创建人:{{item.createUsername||''}}</view>
-								</view>
-							</view>
-						</view>
-					</label>
-				</checkbox-group>
-				<u-empty class="noDate" style="margin-top: 20vh" v-if="!listData.length"></u-empty>
-			</u-list>
-		</view>
-
-		<view class="footer">
-			<view class="bottom" v-if="this.isAll==1">
-				<checkbox v-if="!seletedAll" color="#fff" :checked="seletedAll" @tap="_seletedAll">全选</checkbox>
-				<checkbox class="select-all" color="#fff" v-else :checked="seletedAll" @tap="_seletedAll">取消全选
-				</checkbox>
-			</view>
-			<u-button type="success" size="small" class="u-reset-button" :disabled="!checkListLen" @click="jumpAdd">
-				<view class="selBtn">选择( {{ checkListLen }} )</view>
-			</u-button>
-		</view>
-		<ba-tree-picker ref="treePicker" key="verify" :multiple="false" @select-change="confirm" title="选择分类"
-			:localdata="classificationList" valueKey="id" textKey="name" />
-	</view>
-</template>
-
-<script>
-	import {
-		contactPage,
-
-	} from '@/api/saleManage/contact/index.js'
-	import {
-		getTreeByPid
-	} from "@/api/classifyManage/index.js"
-	import baTreePicker from '@/components/ba-tree-picker/ba-tree-picker.vue'
-	export default {
-		components: {
-			baTreePicker
-		},
-
-		data() {
-			return {
-				page: 1,
-				size: 20,
-				isEnd: true,
-				searchVal: '',
-				pickTabIndex: 1,
-				popupShow: false, //右侧搜索窗
-				typeIndex: 1,
-				listData: [], //列表数据
-				classificationList: [], //分类数据
-				seletedAll: false, //全选状态,
-				isAll: '',
-				isDemand: ''
-			}
-		},
-		//选择的列表长度
-		computed: {
-
-			checkListLen() {
-
-				return this.listData.filter(el => el.checked).length
-			},
-
-		},
-		onLoad({
-			isAll,
-			type
-		}) {
-			this.isAll = isAll //1多选 2单选
-			// *** 新增 需求进来的话 要增加查询条件
-			if (type == '需求') {
-				this.isDemand = '1'
-			}
-			this.getClassify()
-		},
-		onShow() {},
-		methods: {
-			scrolltolower() {
-				if (this.isEnd) {
-					return
-				}
-				// 显示加载图标
-				uni.showLoading({
-					title: '数据加载中'
-				})
-				//获取更多数据
-				this.page++
-				this.getList()
-			},
-			//列表数据
-			async getList() {
-				this.isEnd = false
-				this._getClassifyList()
-			},
-			async _getClassifyList() {
-				uni.showLoading({
-					title: '数据加载中'
-				})
-				const params = {
-					pageNum: this.page,
-					size: this.size,
-					name: this.searchVal,
-					categoryId: this.categoryLevelId
-				}
-				// 需求新增参数 *** 
-				if (this.isDemand == '1') {
-					params.type = '1'
-					params.status = '1'
-				}
-				contactPage(params).then(res => {
-					uni.hideLoading()
-					if (this.page == 1) {
-						this.listData = []
-					}
-					this.listData = this.listData.concat(res.list)
-					this.isEnd = this.listData.length >= res.count
-				})
-			},
-			confirm([id]) {
-				this.categoryLevelId = id
-				this.page = 1
-
-
-				if (this.isAll === '2') {
-					this.listData.forEach(item => item.checked = false)
-				}
-
-				this.getList()
-			},
-			async getClassify() {
-				getTreeByPid(17).then(res => {
-					this.classificationList = res.data
-					this.page = 1
-					this.getList()
-				});
-			},
-			doSearch() {
-				this.page = 1
-				this.getList()
-			},
-			//勾选
-			selectVal(e, val, index) {
-
-				this.$set(this.listData[index], 'checked', !this.listData[index].checked)
-
-				if (this.isAll != 1) {
-					this.listData.forEach((item, i) => {
-						if (item.id != val.id) {
-							this.$set(this.listData[i], 'checked', false)
-						}
-					})
-				} else {
-
-					this.seletedAll = !this.listData.some(item => !item.checked)
-				}
-
-			},
-			//全选按钮
-			_seletedAll() {
-				if (!this.seletedAll) {
-					this.seletedAll = true
-					this.listData.map(item => {
-						this.$set(item, 'checked', true)
-					})
-				} else {
-					this.seletedAll = false
-					//this.checkListLen = 0;
-					this.listData.map(item => {
-						this.$set(item, 'checked', false)
-					})
-				}
-			},
-			//跳转回添加页面
-			jumpAdd() {
-				uni.$emit(
-					'setSelectList',
-					this.listData.filter(item => item.checked)
-				)
-				console.log(
-					this.listData.filter(item => item.checked),
-					'222'
-				)
-				uni.navigateBack()
-			},
-			//返回添加页
-			backAdd() {
-				uni.navigateBack()
-			}
-		}
-	}
-</script>
-
-<style lang="scss" scoped>
-	.mainBox {
-		height: 100vh;
-		display: flex;
-		flex-direction: column;
-
-		.wrapper {
-			flex: 1;
-			overflow: hidden;
-		}
-
-		.searchBox {
-			padding: 10rpx 0;
-			box-sizing: border-box;
-			background-color: #dedede;
-			height: 90rpx;
-			width: 100%;
-			line-height: 90rpx;
-			display: flex;
-			justify-content: space-around;
-			align-items: center;
-
-			input {
-				height: 78rpx;
-				width: 65%;
-				background: #f9f9f9 !important;
-				margin: 0 10rpx;
-				padding: 0 10rpx;
-				box-sizing: border-box;
-				border-radius: 5rpx;
-			}
-
-			.searchBtn {
-				height: 80rpx;
-				background: #f9f9f9 !important;
-				color: #676767;
-				font-size: 28rpx;
-				padding: 0 42rpx;
-				box-sizing: border-box;
-				outline: none;
-				border: none;
-				width: 260rpx;
-
-				.icon-sousuo {
-					font-size: 22px;
-				}
-
-				.text {
-					font-size: 16px;
-					margin-left: 10px;
-				}
-			}
-		}
-
-		.tab-title {
-			position: fixed;
-			top: 190rpx;
-			z-index: 99;
-			width: 100%;
-			display: flex;
-			justify-content: space-between;
-			align-items: center;
-			height: $tab-height;
-			line-height: $tab-height;
-			background-color: #ffffff;
-			border-bottom: 2rpx solid #f2f2f2;
-			box-sizing: border-box;
-
-			.tab-item {
-				width: 25%;
-				text-align: center;
-				font-size: 32rpx;
-				color: $uni-text-color-grey;
-			}
-
-			.tab-item.active {
-				color: $j-primary-border-green;
-				border-bottom: 1px solid $j-primary-border-green;
-				font-weight: bold;
-			}
-
-			.tab-item.filter {
-				flex: 1;
-				padding: 0px 30rpx;
-
-				.uni-icons {
-					display: flex;
-					padding-top: 5px;
-				}
-			}
-
-			.screenIcon {
-				display: flex;
-				width: 80px;
-				justify-content: center;
-
-				.screenText {
-					font-size: 32rpx;
-					color: $uni-text-color-grey;
-				}
-			}
-		}
-
-		.listContent {
-			height: 100% !important;
-
-			.listBox {
-				display: flex;
-				// height: 180rpx;
-				padding: 20rpx 0;
-				border-bottom: 2rpx solid #e5e5e5;
-
-				.listBox-sel {
-					height: 90rpx;
-					width: 80rpx;
-					// line-height: 90rpx;
-					text-align: center;
-
-					checkbox {
-						transform: scale(1.2);
-					}
-				}
-
-				.listBox-con {
-					width: 100%;
-					// display: flex;
-					// flex-wrap: wrap;
-					// justify-content: space-between;
-					align-items: center;
-					padding: 0 18rpx 0 0;
-
-					.listBox-top {
-						width: 100%;
-						display: flex;
-						justify-content: space-between;
-						padding-bottom: 10rpx;
-
-						.listBox-name,
-						.listBox-code {
-							display: inline-block;
-							font-size: $uni-font-size-sm;
-							font-weight: bold;
-						}
-					}
-
-					.listBox-bottom {
-						width: 100%;
-						display: flex;
-						justify-content: space-between;
-						font-size: $uni-font-size-sm;
-						flex-wrap: wrap;
-
-						>view {
-							width: 50%;
-							overflow: hidden;
-							white-space: nowrap;
-							text-overflow: ellipsis;
-						}
-					}
-				}
-			}
-
-			.noDate {
-				height: 100%;
-			}
-		}
-
-		//底部按钮
-		.footer {
-			height: 90rpx;
-			position: relative;
-			display: flex;
-			justify-content: space-between;
-			align-items: center;
-			bottom: 0;
-			width: 100%;
-			height: 100rpx;
-			border-top: 1rpx solid #eeecec;
-			background-color: #ffffff;
-			z-index: 999;
-
-			.bottom {
-				margin-left: 10rpx;
-			}
-
-			.u-reset-button {
-				position: absolute;
-				right: 10rpx;
-				top: 20rpx;
-				width: 150rpx;
-			}
-		}
-	}
-</style>

+ 3 - 1
pages/purchasingManage/components/selectSaleOrder.vue

@@ -124,7 +124,9 @@
 				let params = {
 					pageNum: this.page,
 					size: this.size,
-					name: this.searchVal
+					name: this.searchVal,
+					isNoSendDone: 0,
+					orderStatus: 2,
 				}
 
 				getTableList(params).then(res => {

+ 8 - 12
pages/purchasingManage/components/selectProject.vue → pages/purchasingManage/components/selectTaskName.vue

@@ -29,13 +29,8 @@
 									</view>
 								</view>
 								<view class="listBox-bottom">
-									<view>负责部门:{{ item.responsibleDeptName }}</view>
-									<view>项目经理:{{ item.responsibleUserName }}</view>
-									<view>项目团队:{{ item.teamName }}</view>
-									<view>项目周期:{{ item.cycle }}</view>
-									<view>项目预算:{{ item.budget }}</view>
-									<view>计划开始日期:{{ item.planStartDate }}</view>
-									<view>计划完成日期:{{ item.planEndDate }}</view>
+									<view>工序控制码:{{ item.controlName }}</view>
+									<view>所属工作中心:{{ item.workCenterName }}</view>
 								</view>
 							</view>
 						</view>
@@ -62,8 +57,8 @@
 
 <script>
 	import {
-		projectsPageAPI,
-	} from '@/api/saleManage/saleorder'
+		producetask,
+	} from '@/api/purchasingManage/purchaseNeedManage.js'
 	import baTreePicker from '@/components/ba-tree-picker/ba-tree-picker.vue'
 	export default {
 		components: {
@@ -127,7 +122,8 @@
 					name: this.searchVal
 				}
 
-				projectsPageAPI(params).then(res => {
+				producetask(params).then(res => {
+					console.log(res)
 					if (this.page === 1) {
 						this.listData = res.list
 					} else {
@@ -154,7 +150,7 @@
 					name: this.searchVal,
 				}
 
-				projectsPageAPI(params).then(res => {
+				producetask(params).then(res => {
 					uni.hideLoading()
 					if (this.page == 1) {
 						this.listData = []
@@ -214,7 +210,7 @@
 			//跳转回添加页面
 			jumpAdd() {
 				uni.$emit(
-					'setProject',
+					'setTaskName',
 					this.listData.filter(item => item.checked)
 				)
 

+ 0 - 399
pages/purchasingManage/components/selectUser.vue

@@ -1,399 +0,0 @@
-<template>
-	<view class="mainBox">
-		<uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="选择" @clickLeft="backAdd">
-			<!--右菜单-->
-			<template slot="right">
-				<u-button type="success" size="small" class="u-reset-button" @click="$refs.treePicker._show()"
-					text="选择部门"></u-button>
-			</template>
-		</uni-nav-bar>
-		<view class="searchBox">
-			<input v-model="searchVal" placeholder="请输入名称" class="searchInput" />
-			<u-button type="icon-shixiangxinzeng" size="30" @click="doSearch" data-icon="Search" class="searchBtn">
-				<view class="iconfont icon-sousuo"></view>
-				<view class="text">搜索</view>
-			</u-button>
-		</view>
-		<view class="wrapper">
-			<u-list @scrolltolower="scrolltolower" class="listContent">
-				<checkbox-group v-for="(item, index) in listData" :key="index" @change="e => selectVal(e, item, index)">
-					<label>
-						<view class="listBox">
-							<view class="listBox-sel">
-								<checkbox :value="item.code" color="#fff" :disabled="item.disabled"
-									:checked="item.checked" />
-							</view>
-							<view class="listBox-con">
-								<view class="listBox-top">
-									<view class="listBox-name">
-										{{ item.name }}
-									</view>
-							
-								</view>
-								<view class="listBox-bottom">
-									<view>工号:{{ item.jobNumber }}</view>
-									<view>账号:{{ item.loginName }}</view>
-					
-								</view>
-							</view>
-						</view>
-					</label>
-				</checkbox-group>
-				<u-empty class="noDate" style="margin-top: 20vh" v-if="!listData.length"></u-empty>
-			</u-list>
-		</view>
-
-		<view class="footer">
-			<view class="bottom" v-if="this.isAll==1">
-				<checkbox v-if="!seletedAll" color="#fff" :checked="seletedAll" @tap="_seletedAll">全选</checkbox>
-				<checkbox class="select-all" color="#fff" v-else :checked="seletedAll" @tap="_seletedAll">取消全选
-				</checkbox>
-			</view>
-			<u-button type="success" size="small" class="u-reset-button" :disabled="!checkListLen" @click="jumpAdd">
-				<view class="selBtn">选择( {{ checkListLen }} )</view>
-			</u-button>
-		</view>
-		<ba-tree-picker ref="treePicker" key="verify" :multiple="false" @select-change="confirm" title="选择部门"
-			:localdata="classificationList" valueKey="id" textKey="name" />
-	</view>
-</template>
-
-<script>
-import {
-		listOrganizations,
-		getUserPage
-	} from '@/api/myTicket/index.js'
-	import baTreePicker from '@/components/ba-tree-picker/ba-tree-picker.vue'
-	export default {
-		components: {
-			baTreePicker
-		},
-
-		data() {
-			return {
-				page: 1,
-				size: 20,
-				isEnd: true,
-				searchVal: '',
-				pickTabIndex: 1,
-				popupShow: false, //右侧搜索窗
-				typeIndex: 1,
-				listData: [], //列表数据
-				classificationList: [], //分类数据
-				seletedAll: false, //全选状态,
-				isAll: '' 
-
-			}
-		},
-		//选择的列表长度
-		computed: {
-
-			checkListLen() {
-
-				return this.listData.filter(el => el.checked).length
-			},
-
-		},
-		onLoad({
-			isAll
-		}) {
-			this.isAll = isAll //1多选 2单选
-			this.getClassify()
-		},
-		onShow() {},
-		methods: {
-			scrolltolower() {
-				if (this.isEnd) {
-					return
-				}
-				// 显示加载图标
-				uni.showLoading({
-					title: '数据加载中'
-				})
-				//获取更多数据
-				this.page++
-				this.getList()
-			},
-			//列表数据
-			async getList() {
-				this.isEnd = false
-				this._getClassifyList()
-			},
-			async _getClassifyList() {
-				uni.showLoading({
-					title: '数据加载中'
-				})
-				const params = {
-					pageNum: 1,
-					size:100,
-					name: this.searchVal,
-					groupId: this.categoryLevelId
-				}
-
-				getUserPage(params).then(res => {
-					uni.hideLoading()
-					if (this.page == 1) {
-						this.listData = []
-					}
-					this.listData = this.listData.concat(res.list)
-					this.isEnd = this.listData.length >= res.count
-				})
-			},
-			confirm([id]) {
-				this.categoryLevelId = id
-				this.page = 1
-				this.getList()
-			},
-			async getClassify() {
-				listOrganizations(1).then(res => {
-					this.classificationList = res
-					this.page = 1
-					this.getList()
-				});
-			},
-			doSearch() {
-				this.page = 1
-				this.getList()
-			},
-			//勾选
-			selectVal(e, val, index) {
-
-				this.$set(this.listData[index], 'checked', !this.listData[index].checked)
-
-				if (this.isAll != 1) {
-					this.listData.forEach((item, i) => {
-						if (item.id != val.id) {
-							this.$set(this.listData[i], 'checked', false)
-						}
-					})
-				} else {
-
-					this.seletedAll = !this.listData.some(item => !item.checked)
-				}
-
-			},
-			//全选按钮
-			_seletedAll() {
-				if (!this.seletedAll) {
-					this.seletedAll = true
-					this.listData.map(item => {
-						this.$set(item, 'checked', true)
-					})
-				} else {
-					this.seletedAll = false
-					this.listData.map(item => {
-						this.$set(item, 'checked', false)
-					})
-				}
-			},
-			//跳转回添加页面
-			jumpAdd() {
-				uni.$emit(
-					'setUserInfo',
-					this.listData.filter(item => item.checked)
-				)
-
-				uni.navigateBack()
-			},
-			//返回添加页
-			backAdd() {
-				uni.navigateBack()
-			}
-		}
-	}
-</script>
-
-<style lang="scss" scoped>
-	.mainBox {
-		height: 100vh;
-		display: flex;
-		flex-direction: column;
-
-		.wrapper {
-			flex: 1;
-			overflow: hidden;
-		}
-
-		.searchBox {
-			padding: 10rpx 0;
-			box-sizing: border-box;
-			background-color: #dedede;
-			height: 90rpx;
-			width: 100%;
-			line-height: 90rpx;
-			display: flex;
-			justify-content: space-around;
-			align-items: center;
-
-			input {
-				height: 78rpx;
-				width: 65%;
-				background: #f9f9f9 !important;
-				margin: 0 10rpx;
-				padding: 0 10rpx;
-				box-sizing: border-box;
-				border-radius: 5rpx;
-			}
-
-			.searchBtn {
-				height: 80rpx;
-				background: #f9f9f9 !important;
-				color: #676767;
-				font-size: 28rpx;
-				padding: 0 42rpx;
-				box-sizing: border-box;
-				outline: none;
-				border: none;
-				width: 260rpx;
-
-				.icon-sousuo {
-					font-size: 22px;
-				}
-
-				.text {
-					font-size: 16px;
-					margin-left: 10px;
-				}
-			}
-		}
-
-		.tab-title {
-			position: fixed;
-			top: 190rpx;
-			z-index: 99;
-			width: 100%;
-			display: flex;
-			justify-content: space-between;
-			align-items: center;
-			height: $tab-height;
-			line-height: $tab-height;
-			background-color: #ffffff;
-			border-bottom: 2rpx solid #f2f2f2;
-			box-sizing: border-box;
-
-			.tab-item {
-				width: 25%;
-				text-align: center;
-				font-size: 32rpx;
-				color: $uni-text-color-grey;
-			}
-
-			.tab-item.active {
-				color: $j-primary-border-green;
-				border-bottom: 1px solid $j-primary-border-green;
-				font-weight: bold;
-			}
-
-			.tab-item.filter {
-				flex: 1;
-				padding: 0px 30rpx;
-
-				.uni-icons {
-					display: flex;
-					padding-top: 5px;
-				}
-			}
-
-			.screenIcon {
-				display: flex;
-				width: 80px;
-				justify-content: center;
-
-				.screenText {
-					font-size: 32rpx;
-					color: $uni-text-color-grey;
-				}
-			}
-		}
-
-		.listContent {
-			height: 100% !important;
-
-			.listBox {
-				display: flex;
-				// height: 180rpx;
-				padding: 20rpx 0;
-				border-bottom: 2rpx solid #e5e5e5;
-
-				.listBox-sel {
-					height: 90rpx;
-					width: 80rpx;
-					// line-height: 90rpx;
-					text-align: center;
-
-					checkbox {
-						transform: scale(1.2);
-					}
-				}
-
-				.listBox-con {
-					width: 100%;
-					// display: flex;
-					// flex-wrap: wrap;
-					// justify-content: space-between;
-					align-items: center;
-					padding: 0 18rpx 0 0;
-
-					.listBox-top {
-						width: 100%;
-						display: flex;
-						justify-content: space-between;
-						padding-bottom: 10rpx;
-
-						.listBox-name,
-						.listBox-code {
-							display: inline-block;
-							font-size: $uni-font-size-sm;
-							font-weight: bold;
-						}
-					}
-
-					.listBox-bottom {
-						width: 100%;
-						display: flex;
-						justify-content: space-between;
-						font-size: $uni-font-size-sm;
-						flex-wrap: wrap;
-
-						>view {
-							width: 50%;
-							overflow: hidden;
-							white-space: nowrap;
-							text-overflow: ellipsis;
-						}
-					}
-				}
-			}
-
-			.noDate {
-				height: 100%;
-			}
-		}
-
-		//底部按钮
-		.footer {
-			height: 90rpx;
-			position: relative;
-			display: flex;
-			justify-content: space-between;
-			align-items: center;
-			bottom: 0;
-			width: 100%;
-			height: 100rpx;
-			border-top: 1rpx solid #eeecec;
-			background-color: #ffffff;
-			z-index: 999;
-
-			.bottom {
-				margin-left: 10rpx;
-			}
-
-			.u-reset-button {
-				position: absolute;
-				right: 10rpx;
-				top: 20rpx;
-				width: 150rpx;
-			}
-		}
-	}
-</style>

+ 125 - 0
pages/purchasingManage/components/timePopup.vue

@@ -0,0 +1,125 @@
+<template>
+    <uni-popup ref="popup" :showClose="true" background-color="#fff" @change="change">
+        <scroll-view class="scroll-content" scroll-y style="height: 80vh;">
+            <view class="popup-title">
+                <text>待分配数量:{{ count }}</text>
+                <u-button class="popup-title-btn" type="primary" @click="handleAddDate" text="新增" ></u-button>
+            </view>
+            <uni-table ref="table" border stripe emptyText="暂无更多数据">
+                <uni-tr>
+                    <uni-th width="100" align="center">数量</uni-th>
+                    <uni-th width="150" align="center">到货时间</uni-th>
+                    <uni-th width="80" align="center">操作</uni-th>
+                </uni-tr>
+                <uni-tr v-for="(item, index) in tableData" :key="index">
+                    <uni-td><uni-number-box v-model="item.arriveCount" :min="0" :max="getCountMax(item)" @change="changeCountValue(index)" /></uni-td>
+                    <uni-td>
+                        <uni-datetime-picker type="date" v-model="item.arriveDate"></uni-datetime-picker>
+                    </uni-td>
+                    <uni-td>
+                        <button class="uni-button" size="mini" type="warn" @click="handleDelDate(index)">删除</button>
+                    </uni-td>
+                </uni-tr>
+            </uni-table>
+            <view class="footerButton">
+                <u-button type="primary" @click="handleConfirm" text="确认"></u-button>
+                <u-button type="default" @click="handleClose" text="关闭"></u-button>
+            </view>
+        </scroll-view>
+    </uni-popup>
+</template>
+<script>
+export default {
+    data() {
+        return {
+            count: 0, //待分配数量
+            tableData: [], //表格数据
+        }
+    },
+    computed: {
+        getCountMax() {
+            return (row) => {
+                let maxCount = this.current.totalCount * 1 || 0;
+                let usedCount = this.tableData.reduce((n, item) => {
+                    n += item.arriveCount * 1;
+                    return n;
+                }, 0);
+                return maxCount - usedCount + row.arriveCount * 1;
+            };
+        }
+    },
+    methods: {
+        open(current, index) {
+            this.current = current;
+            this.currentIndex = index;
+            // this.count = this.current.totalCount * 1 || 0;
+            this.changeCountValue();
+            this.$refs.popup.open('bottom');
+            if(current.arrivalBatch) {
+                this.tableData = current.arrivalBatch
+            } else {
+                this.tableData = []
+            }
+        },
+        change(e) {
+            console.log('当前模式:' + e.type + ',状态:' + e.show);
+        },
+        // 新增
+        handleAddDate() {
+            this.tableData.push({
+                arriveCount: null,
+                arriveDate: null,
+
+            })
+        },
+        handleDelDate(index) {
+            this.count += this.tableData[index].arriveCount;
+            this.tableData.splice(index, 1);
+        },
+        changeCountValue() {
+            if (this.tableData.length) {
+                let num = this.tableData.reduce((n, item) => {
+                    n += item.arriveCount * 1;
+                    return n;
+                }, 0);
+                    this.count = this.current.totalCount * 1 - num || 0;
+            } else {
+                this.count = this.current.totalCount * 1 || 0;
+            }
+        },
+        handleConfirm() {
+            if (this.count != 0) {
+                uni.showToast({ title: '分配数量有误,请检查!'})
+                return
+            }
+
+            // 检查tableData数组中是否有空值
+            for (let i = 0; i < this.tableData.length; i++) {
+                const item = this.tableData[i];
+                if (item.arriveCount === null || item.arriveCount === undefined || !item.arriveDate) {
+                    return uni.showToast({ title: `第${i + 1}行数据不完整,请检查数量和到货时间!`});
+                }
+            }
+            
+            this.$emit('confirm', this.tableData);
+        },
+        handleClose() {
+            this.$refs.popup.close()
+        },
+    }
+}
+</script>
+<style scoped>
+    .scroll-content {
+        padding: 20rpx;
+    }
+    .popup-title {
+		display: flex;
+		align-items: center;
+		padding: 20rpx;
+	}
+	.popup-title-btn {
+		width: 100rpx;
+		margin-right: 20rpx;
+	}
+</style>

+ 102 - 87
pages/purchasingManage/purchaseNeedManage/add.vue

@@ -10,9 +10,6 @@
 					<text class="required-mark">*</text>
 					需求类型
 				</view>
-				<!-- <u--input slot="value" placeholder="请选择" border="surround" v-model="form.sourceType"
-					@click.native="selectContactShow"></u--input> -->
-				<!-- <u-picker :show="show" :columns="requirementSourceType" keyName="label"></u-picker> -->
 				<uni-data-picker v-model="form.sourceType" slot="value" placeholder="请选择"
 					:localdata="requirementSourceType" @change="sourceCodeOnchange">
 				</uni-data-picker>
@@ -31,7 +28,7 @@
 				</view>
 				<!-- <u--input slot="value" placeholder="请输入" border="surround" v-model="form.requireDeptId"></u--input> -->
 				<u--input slot="value" @click.native="classification" style="flex:1" border="surround"
-					placeholder="请选择需求部门" v-model="form.requireDeptId">
+					placeholder="请选择需求部门" v-model="form.requireDeptName">
 				</u--input>
 			</u-cell>
 			<u-cell :title="'需求人'" arrow-direction="down">
@@ -40,23 +37,23 @@
 					需求人
 				</view>
 				<!-- <u--input slot="value" placeholder="请输入" border="requireUserId" v-model="form.name"></u--input> -->
-				<u--input slot="value" style="flex:1" border="surround" v-model="form.requireUserId"
+				<u--input slot="value" style="flex:1" border="surround" v-model="form.requireUserName"
 						placeholder="请选择需求人" @click.native="openSelector">
 				</u--input>
 			</u-cell>
 			<u-cell title="销售合同" arrow-direction="down">
-				<u--input slot="value" placeholder="请选择" border="surround" v-model="form.saleOrderNo"
+				<u--input slot="value" placeholder="请选择" border="surround" v-model="form.saleContractNo"
 					@click.native="selectContractShow"></u--input>
 			</u-cell>
 			<u-cell title="销售订单" arrow-direction="down">
 				<!-- <u--input slot="value" placeholder="请输入" border="requireUserId" v-model="form.name"></u--input> -->
-				<u--input slot="value" style="flex:1" border="surround" v-model="form.requireUserId"
+				<u--input slot="value" style="flex:1" border="surround" v-model="form.saleOrderNo"
 						placeholder="请选择销售订单" @click.native="slectOrderShow">
 				</u--input>
 			</u-cell>
 			<u-cell title="是否接受拆单" arrow-direction="down">
 				<uni-data-picker v-model="form.acceptUnpack" slot="value" placeholder="请选择"
-					:localdata="[{text: '接受', value: '1'}, { text: '不接受', value: '0'}]" @change="sourceCodeOnchange">
+					:localdata="acceptUnpackList" @change="sourceCodeOnchange">
 				</uni-data-picker>
 				<!-- <u--input slot="value" :disabled="true" placeholder="请输入" border="surround"
 					v-model="form.responsibleName"></u--input> -->
@@ -102,61 +99,46 @@
 			<u-button type="primary" @click="save" text="保存"></u-button>
 		</view>
 		<produceList ref="produceListRef" v-show="current==1"  :isTemporary="true"></produceList>
-		<!-- <businessList ref="businessListRef" v-show="current==2"></businessList> -->
-		<!-- <personnelList ref="personnelListRef" :linkList="linkList" v-show="current==3"></personnelList> -->
 		 <ba-tree-picker ref="treePicker" key="verify" :multiple="false" @select-change="confirm" title="选择部门"
 			:selectedData="selectedData" :localdata="classificationList" valueKey="id" textKey="name"
 			childrenKey="children" />
-		<search-select ref="selector" v-model="form.requireUserId" :data-list="executorList" title="选择使用人" @change="onClose">
+		<search-select ref="selector" v-model="form.requireUserId" :data-list="executorList" title="选择需求人" @change="onClose">
 		</search-select>
 		<u-toast ref="uToast"></u-toast>
 	</view>
 </template>
 
 <script>
-	// file:///D:/中赢/aiot-app/pages/warehouse/enterHouse/selectEnterType.vue
-
-	import {
-		getByCode
-	} from '@/api/pda/common.js'
-	import {
-		contactDetail,
-	} from '@/api/saleManage/contact/index.js'
-	import {
-		businessopportunitySave,
-		getDetail
-	} from '@/api/saleManage/businessOpportunity/index.js'
+	import { getByCode } from '@/api/pda/common.js'
+	import { contactDetail } from '@/api/saleManage/contact/index.js'
 	import searchSelect from '@/pages/salesServiceManagement/accessory/components/searchSelect.vue';
 	import produceList from '../components/produceList.vue'
-	// import businessList from './components/businessList.vue'
-	// import personnelList from './components/personnelList.vue'
 	import fileMain from "@/pages/doc/index.vue"
 	import { requirementSourceType } from '@/enum/dict'
-	import {
-		listOrganizations
-	} from '@/api/salesServiceManagement/workOrder/index.js';
-	import {
-		toTreeData
-	} from '@/utils/utils.js';
-	import {
-		getUserPage
-	} from '@/api/common.js';
+	import { listOrganizations } from '@/api/salesServiceManagement/workOrder/index.js';
+	import { toTreeData } from '@/utils/utils.js';
+	import { getUserPage } from '@/api/common.js';
 	import { getTableList, getSaleOrderDetail } from '@/api/saleManage/saleorder/index'
+	import {
+		getDetail,
+		addPurchaseNeedManage,
+		UpdateInformation
+	} from '@/api/purchasingManage/purchaseNeedManage.js'
 	export default {
 		components: {
 			produceList,
-			// businessList,
-			// personnelList,
 			fileMain,
 			searchSelect
 		},
 		data() {
 			return {
 				list: ['基本信息', '需求清单'],
+				acceptUnpackList: [{text: '接受', value: 1}, { text: '不接受', value: 0}],
 				current: 0,
 				show: false,
 				requirementSourceType,
 				classificationList: [],
+				isUpdate: false,
 				form: {
 					id: '',
 					receiveDate: null,
@@ -215,45 +197,62 @@
 					this.getSaleOrderDetail(this.form.saleOrderId)
 				}
 			})
+
+			// uni.$off('setSelectList')
+			// uni.$on('setSelectList', async (data) => {
+			// 	if (data && data.length > 0) {
+			// 		const {
+			// 			linkList
+			// 		} = await contactDetail(data[0].id)
+			// 		this.linkList = linkList
+			// 		this.$set(this.form, 'contactId', data[0].id);
+			// 		this.$set(this.form, 'contactName', data[0].name);
+			// 	}
+
+			// })
 		},
 		onLoad(data) {
 			this.getTreeList()
-			uni.$off('setSelectList')
-			uni.$on('setSelectList', async (data) => {
-				if (data && data.length > 0) {
-					const {
-						linkList
-					} = await contactDetail(data[0].id)
-					this.linkList = linkList
-					this.$set(this.form, 'contactId', data[0].id);
-					this.$set(this.form, 'contactName', data[0].name);
-				}
-
-			})
 			if (data && data.id) {
+				this.isUpdate = true
 				getDetail(data.id).then(async res => {
 					this.form = res
-					const {
-						linkList
-					} = await contactDetail(res.contactId)
-					this.linkList = linkList
-					this.$nextTick(() => {
-
-						this.$refs.produceListRef.init(res.productList)
-						this.$refs.businessListRef.init(res.competAnalysisList)
-						this.$refs.personnelListRef.init(res.partyList)
-					})
-
+					this.form.fileId = JSON.parse(res.fileId)
+					if(this.form.requireDeptId) {
+						this.getUserList(this.form.requireDeptId);
+					}
+					// setTimeout(() => {
+						// this.current = 0
+						this.$nextTick(() => {
+							// this.$refs.infoRef.init(res)
+							const tempData = res.detailList.map(item => {
+								return {
+									...item,
+									packageDispositionList: item.packageDispositionList.map(i => {
+										return {
+											...i,
+											text: i.conversionUnit,
+											value: i.id
+										}
+									})
+								}
+							})
+							this.$refs.produceListRef.init(tempData)
+							// if (data.current) {
+							// 	this.current = +data.current
+							// }
+						})
+					// }, 300)
 				})
 			} else {
 				const userInfo = uni.getStorageSync('userInfo')
-				this.$set(this.form, 'responsibleId', userInfo.userId);
-				this.$set(this.form, 'responsibleName', userInfo.name);
+				this.$set(this.form, 'requireUserId', userInfo.userId);
+				this.$set(this.form, 'requirementName', userInfo.name);
 			}
 
 		},
 		onUnload() {
-			uni.$off('setSelectList')
+			// uni.$off('setSelectList')
 			uni.$off('setContractList')
 			uni.$off('setSaleOrder')
 			// uni.$off('updatelinkList')
@@ -295,10 +294,10 @@
 			},
 			// 使用部门选择
 			confirm(id, name) {
-				this.form.useDeptName = name;
-				this.form.useDeptId = id[0];
-				this.form.userId = '';
-				this.form.userName = '';
+				this.form.requireDeptName = name;
+				this.form.requireDeptId = id[0];
+				this.form.requireUserId = '';
+				this.form.requireUserName = '';
 				this.executorList = [];
 				this.getUserList(id[0]);
 				this.$refs.selector.clearSearchText();
@@ -329,7 +328,7 @@
 			},
 			// 使用人选择
 			onClose(item) {
-				this.form.userName = item.text;
+				this.form.requireUserName = item.text;
 			},
 			//选择合同
 			selectContractShow() {
@@ -356,11 +355,6 @@
 				})
 
 			},
-			selectContactShow() {
-				uni.navigateTo({
-					url: '/pages/saleManage/components/selectContact?isAll=' + 2
-				})
-			},
 			sourceCodeOnchange(e) {
 				const value = e.detail.value
 				this.form.sourceCode = value.map(item => item.value).toString()
@@ -380,32 +374,40 @@
 			},
 
 			async save() {
-			
 				try {
-
-					if (!this.form.contactName) {
+					if (!this.form.sourceType) {
 						this.$refs.uToast.show({
 							type: "error",
-							message: "请选择客户",
+							message: "请选择需求类型",
 						})
 						return
 					}
-					if (!this.form.name) {
+					if (!this.form.requirementName) {
 						this.$refs.uToast.show({
 							type: "error",
-							message: "请输入商机名称",
+							message: "请输入需求名称",
 						})
 						return
 					}
-					if (!this.form.sourceCode) {
+					if (!this.form.requireDeptName) {
 						this.$refs.uToast.show({
 							type: "error",
-							message: "请选择商机来源",
+							message: "请选择需求部门",
 						})
 						return
 					}
 
-					if (this.$refs.produceListRef.getValue().length == 0) {
+					if (!this.form.requireUserName) {
+						this.$refs.uToast.show({
+							type: "error",
+							message: "请选择需求人",
+						})
+						return
+					}
+
+					const detailList = this.$refs.produceListRef.getValue();
+
+					if (detailList.length == 0) {
 						this.$refs.uToast.show({
 							type: "error",
 							message: "产品清单不能为空",
@@ -413,19 +415,32 @@
 						return;
 					}
 
+					let isArrivalBatch = false;
+					detailList.forEach((v) => {
+						if (v.arrivalWay == 2 && (!v.arrivalBatch || v.arrivalBatch.length == 0) ) {
+							isArrivalBatch = true;
+						}
+					});
+					if (isArrivalBatch) {
+						uni.showToast({title: '请设置分批时间'});
+						return;
+					}
+
 					uni.showLoading({
 						title: '加载中'
 					})
 
 					const data = {
-						opportunity: this.form,
-						competAnalysisList: this.$refs.businessListRef.getValue(),
-						partyList: this.$refs.personnelListRef.getValue(),
-						productList: this.$refs.produceListRef.getValue()
+						...this.form,
+						detailList: detailList
 					};
 
-					businessopportunitySave(data)
-						.then((id) => {
+					console.log('data~~~', data)
+
+					const requestApi = this.isUpdate ? UpdateInformation : addPurchaseNeedManage
+
+					requestApi(data)
+						.then((res) => {
 							uni.hideLoading()
 							this.back()
 						})

+ 0 - 179
pages/purchasingManage/purchaseNeedManage/components/businessList.vue

@@ -1,179 +0,0 @@
-<template>
-	<view class="mainBox">
-		<view v-for="(item, index) in tableList" :key="index" style="position: relative;">
-			<myCard :item="item" :btnList="btnList" :index="index+1" :columns="columns" @del="del(index)">
-				<u--input placeholder="请输入" slot="name" v-model="item.name">
-				</u--input>
-				<u--textarea v-model="item.analysis" slot="analysis" placeholder="请输入内容" autoHeight></u--textarea>
-
-			</myCard>
-		</view>
-
-
-		<view class="add" @click="add">
-			<u-icon name="plus" color="#fff"></u-icon>
-		</view>
-		<view style="height: 84rpx;" v-if="isDrawer"></view>
-		<view class="footerButton" v-if="isDrawer">
-			<u-button type="primary" @click="save" text="保存"></u-button>
-		</view>
-	</view>
-</template>
-
-<script>
-	import myCard from '../../components/myCard.vue'
-	export default {
-		components: {
-			myCard
-		},
-		props: {
-			isDrawer: {
-				default: false
-			}
-		},
-		data() {
-			return {
-				tableList: [],
-				btnList: [{
-					name: '删除',
-					apiName: 'del',
-					btnType: 'error ',
-					type: '2',
-					pageUrl: '',
-				}],
-				columns: [
-					[{
-						label: '竞争对手名称:',
-						prop: 'name',
-						slot: 'name',
-						className: 'perce100',
-						style:{
-							marginBottom:'14rpx'
-						}
-					}],
-					[{
-						label: '竞品分析:',
-						prop: 'analysis',
-						slot: 'analysis',
-						className: 'perce100',
-						style:{
-							marginBottom:'14rpx'
-						}
-					}],
-					[{
-						label: '操作:',
-						prop: 'action',
-						type: 'action',
-						className: 'perce100',
-					}],
-				]
-
-			}
-		},
-		created() {
-
-		},
-		methods: {
-			add(status) {
-				this.tableList.push({
-					name: '',
-					analysis: ''
-				})
-			},
-			init(list) {
-				if (list) {
-					this.tableList = JSON.parse(JSON.stringify(list))
-				}
-
-			},
-			save() {
-				uni.$emit('setBusinessOpportunity')
-			},
-			del(index) {
-				this.tableList.splice(index, 1);
-			},
-			getValue() {
-				return this.tableList
-			},
-		}
-	}
-</script>
-
-<style lang="scss" scoped>
-	.add {
-		width: 96rpx;
-		height: 96rpx;
-		border-radius: 48rpx;
-		background: #3c9cff;
-		position: fixed;
-		bottom: 100rpx;
-		right: 24rpx;
-		display: flex;
-		align-items: center;
-		justify-content: center;
-		z-index: 99;
-	}
-
-	.footerButton {
-		width: 100%;
-		height: 84rpx;
-		display: flex;
-		position: fixed;
-		bottom: 0;
-		z-index: 10;
-
-		/deep/.u-button {
-			height: 100%;
-		}
-		>view {
-			flex: 1;
-
-		}
-	}
-
-	.item {
-		display: flex;
-		flex-direction: column;
-		padding: 16rpx;
-
-		>view {
-			padding-top: 14rpx;
-		}
-
-		.item_title {
-			font-size: 32rpx;
-			font-weight: 800;
-		}
-
-		.item_list {
-			display: flex;
-			align-items: center;
-
-			text {
-				font-size: 28rpx;
-			}
-
-			.lable {
-				color: #626060;
-			}
-
-			.value {
-				color: #333;
-				margin-left: 12rpx;
-				flex: 1
-			}
-		}
-	}
-
-	/deep/.u-swipe-action-item__right__button__wrapper {
-		background-color: #f56c6c !important;
-	}
-
-	/deep/.u-input {
-		padding: 0 !important;
-	}
-
-	/deep/uni-textarea {
-		padding: 0 !important;
-	}
-</style>

+ 0 - 15
pages/purchasingManage/purchaseNeedManage/components/drawer.vue

@@ -34,21 +34,8 @@
 </template>
 
 <script>
-	import businessList from "./businessList.vue"
-	import personnelList from "./personnelList.vue"
 	import produceList from "../../components/produceList.vue"
-	import followList from "@/pages/saleManage/contact/components/followList.vue"
 	import info from "./info.vue"
-	import {
-		contactDetail,
-	} from '@/api/saleManage/contact/index.js'
-	import {
-		businessopportunitySave,
-		// getDetail,
-		getfollowList,
-		deletefollowList,
-		savefollowList
-	} from '@/api/saleManage/businessOpportunity/index.js'
 	import {
 		getDetail,
 	} from '@/api/purchasingManage/purchaseNeedManage.js'
@@ -56,8 +43,6 @@
 	import myCard from '../../components/myCard.vue'
 	export default {
 		components: {
-			businessList,
-			personnelList,
 			produceList,
 			followList,
 			info,

+ 0 - 276
pages/purchasingManage/purchaseNeedManage/components/personnelList.vue

@@ -1,276 +0,0 @@
-<template>
-	<view class="mainBox">
-		<view v-for="(item, index) in tableList" :key="index" style="position: relative;">
-			<myCard :item="item" :btnList="btnList" :index="index+1" :columns="columns" @del="del(index)">
-				<uni-data-picker slot="linkId" v-model="item.linkId" placeholder="请选择" :localdata="linkList"
-					:map="{text:'linkName',value:'id'}" @change="linkChange(item)">
-				</uni-data-picker>
-				<u--input placeholder="请输入" slot="goal" v-model="item.goal">
-				</u--input>
-
-				<uni-data-picker slot="influenceCode" v-model="item.influenceCode" @change="influenceChange(item)"
-					placeholder="请选择" :localdata="influence_level_code">
-				</uni-data-picker>
-				<uni-data-picker slot="attitudeCode" v-model="item.attitudeCode" @change="attitudeChange(item)"
-					placeholder="请选择" :localdata="attittude_code">
-				</uni-data-picker>
-			</myCard>
-
-		</view>
-
-		<u-toast ref="uToast"></u-toast>
-		<view class="add" @click="add('add')">
-			<u-icon name="plus" color="#fff"></u-icon>
-		</view>
-		<view style="height: 84rpx;" v-if="isDrawer"></view>
-		<view class="footerButton" v-if="isDrawer">
-			<u-button type="primary" @click="save" text="保存"></u-button>
-		</view>
-
-	</view>
-</template>
-
-<script>
-	import {
-		getByCode
-	} from '@/api/pda/common.js'
-	import myCard from '../../components/myCard.vue'
-	export default {
-		components: {
-			myCard,
-		},
-
-		data() {
-			return {
-				tableList: [],
-				btnList: [{
-					name: '删除',
-					apiName: 'del',
-					btnType: 'error ',
-					type: '2',
-					pageUrl: '',
-
-				}],
-				columns: [
-					[{
-						label: '姓名:',
-						prop: 'linkId',
-						slot: 'linkId',
-						style: {
-							marginBottom: '10rpx'
-						}
-					}, {
-						label: '职位:',
-						prop: 'linkPost',
-						style: {
-							marginBottom: '10rpx'
-						}
-					}],
-					[{
-						label: '联系方式:',
-						prop: 'linkMobilePhone',
-						style: {
-							marginBottom: '10rpx'
-						}
-
-					}],
-					[{
-						label: '影响力:',
-						prop: 'influenceCode',
-						slot: 'influenceCode',
-						style: {
-							marginBottom: '10rpx'
-						}
-
-					}, {
-						label: '态度:',
-						prop: 'attitudeCode',
-						slot: 'attitudeCode',
-						style: {
-							marginBottom: '10rpx'
-						}
-					}],
-					[{
-						label: '项目目标/期望:',
-						prop: 'goal',
-						slot: 'goal',
-						className: 'perce100',
-						style: {
-							marginBottom: '10rpx'
-						}
-					}],
-					[{
-						label: '操作:',
-						prop: 'action',
-						type: 'action',
-						className: 'perce100',
-					}],
-				],
-				influence_level_code: [],
-				attittude_code: []
-			}
-		},
-		props: {
-
-			linkList: {
-				default: []
-			},
-			isDrawer: {
-				default: false
-			}
-		},
-		created() {
-			this.getByCode()
-		},
-		methods: {
-			init(list) {
-				if (list) {
-					this.tableList = JSON.parse(JSON.stringify(list))
-				}
-			},
-
-			del(index) {
-				this.tableList.splice(index, 1);
-			},
-			getValue() {
-				return this.tableList
-			},
-			getByCode() {
-				const codeS = ['influence_level_code', 'attittude_code']
-				codeS.forEach(async (code) => {
-					const codeValue = await getByCode(code);
-					this[code] = codeValue.map(item => {
-						const key = Object.keys(item)[0]
-						return {
-							value: key,
-							text: item[key]
-						}
-					})
-				})
-
-			},
-			linkChange(e) {
-				const data = this.linkList.find(item => item.id == e.linkId)
-				e.linkPost = data.post
-				e.linkMobilePhone = data.mobilePhone
-			},
-			attitudeChange(e) {
-				const data = this.attittude_code.find(item => item.value == e.attitudeCode)
-				e.attitudeName = data.text
-
-			},
-			influenceChange(e) {
-				const data = this.influence_level_code.find(item => item.value == e.influenceCode)
-				e.influenceName = data.text
-			},
-
-			save() {
-				uni.$emit('setBusinessOpportunity')
-			},
-			add() {
-				if (this.linkList.length == 0) {
-					this.$refs.uToast.show({
-						type: "error",
-						message: "请先选择客户",
-					})
-					return
-				}
-
-				this.tableList.push({
-					key: null,
-					linkId: '',
-					linkPost: '',
-					linkMobilePhone: '',
-					goal: '',
-					influenceCode: '',
-					influenceName: '',
-					attitudeCode: '',
-					attitudeName: ''
-				})
-			}
-
-		}
-	}
-</script>
-
-<style lang="scss" scoped>
-	.add {
-		width: 96rpx;
-		height: 96rpx;
-		border-radius: 48rpx;
-		background: #3c9cff;
-		position: fixed;
-		bottom: 100rpx;
-		right: 24rpx;
-		display: flex;
-		align-items: center;
-		justify-content: center;
-		z-index: 99;
-	}
-
-	.footerButton {
-		width: 100%;
-		height: 84rpx;
-		display: flex;
-		position: fixed;
-		bottom: 0;
-		z-index: 10;
-
-		/deep/.u-button {
-			height: 100%;
-		}
-
-		>view {
-			flex: 1;
-
-		}
-	}
-
-	.item {
-		display: flex;
-		flex-direction: column;
-		padding: 16rpx;
-
-		>view {
-			padding-top: 14rpx;
-		}
-
-		.item_title {
-			font-size: 32rpx;
-			font-weight: 800;
-			display: flex;
-			align-items: center;
-
-			.u-icon {
-				margin-left: 12rpx;
-			}
-		}
-
-		.item_list {
-			display: flex;
-			align-items: center;
-
-			text {
-				font-size: 28rpx;
-			}
-
-			.lable {
-				color: #626060;
-			}
-
-			.value {
-				color: #333;
-				margin-left: 12rpx;
-				flex: 1
-			}
-		}
-	}
-
-	/deep/.u-swipe-action-item__right__button__wrapper {
-		background-color: #f56c6c !important;
-	}
-
-	/deep/.u-input {
-		padding: 0 !important;
-	}
-</style>

+ 0 - 132
pages/purchasingManage/purchaseNeedManage/followList.vue

@@ -1,132 +0,0 @@
-<template>
-	<view class="mainBox">
-		<uni-nav-bar background-color="#157A2C" color="#fff" fixed="true" statusBar="true" left-icon="back" title="跟进记录"
-			@clickLeft="back">
-		</uni-nav-bar>
-
-		<followList ref="followListRef" :linkList="linkList" pageName="businessOpportunity">
-		</followList>
-	
-	</view>
-</template>
-
-<script>
-	import followList from "@/pages/saleManage/contact/components/followList.vue"
-	import {
-		contactDetail,
-	} from '@/api/saleManage/contact/index.js'
-	import {
-		getfollowList,
-		savefollowList,
-		getDetail,
-		deletefollowList,
-	} from '@/api/saleManage/businessOpportunity/index.js'
-	export default {
-		components: {
-			followList,
-		},
-
-		data() {
-			return {
-				linkList: []
-			}
-		},
-		computed: {
-
-		},
-
-
-		onLoad(data) {
-			uni.$off('savefollowList')
-			uni.$on('savefollowList', (item) => {
-				item.contactId=this.form.contactId
-				item.opportunityId=this.form.id
-			
-				savefollowList(item)
-			})
-			uni.$off('delFollowList')
-			uni.$on('delFollowList', (item) => {
-				deletefollowList([item.id])
-			})
-			getDetail(data.id).then(async res => {
-				this.form = res
-				const {
-					linkList
-				} = await contactDetail(res.contactId)
-				const followList = await getfollowList({
-					pageNum: 1,
-					size: 1000,
-					opportunityId: res.id,
-				})
-				this.linkList = linkList
-				this.$nextTick(() => {
-					this.$refs.followListRef.init(followList.list)
-
-				})
-
-
-
-
-			})
-		},
-		onUnload() {
-			uni.$off('savefollowList')
-			uni.$off('delFollowList')
-		},
-		methods: {
-
-		}
-	}
-</script>
-
-<style lang="scss" scoped>
-	.add {
-		width: 96rpx;
-		height: 96rpx;
-		border-radius: 48rpx;
-		background: #3c9cff;
-		position: fixed;
-		bottom: 100rpx;
-		right: 24rpx;
-		display: flex;
-		align-items: center;
-		justify-content: center;
-	}
-
-	.top-wrapper {
-		background-color: #fff;
-		display: flex;
-		width: 750rpx;
-		height: 88rpx;
-		padding: 16rpx 32rpx;
-		align-items: center;
-		gap: 16rpx;
-
-		/deep/.uni-section {
-			margin-top: 0px;
-		}
-
-		/deep/.uni-section-header {
-			padding: 0px;
-
-		}
-
-		.search_btn {
-			width: 120rpx;
-			height: 70rpx;
-			line-height: 70rpx;
-			padding: 0 24rpx;
-			background: $theme-color;
-			font-size: 32rpx;
-			color: #fff;
-			margin: 0;
-			margin-left: 26rpx;
-		}
-
-		.menu_icon {
-			width: 44rpx;
-			height: 44rpx;
-			margin-left: 14rpx;
-		}
-	}
-</style>

+ 69 - 14
pages/purchasingManage/purchaseNeedManage/index.vue

@@ -15,10 +15,6 @@
 			<image class="menu_icon" src="~@/static/pda/menu.svg"></image>
 
 		</view>
-		<!-- 		<view v-for="(item, index) in tableList" :key="index" style="position: relative;">
-			<myCard @del="del(item)" :item="item" :index="index+1" :columns="columns" :btnList="btnList"></myCard>
-
-		</view> -->
 		<view class="wrapper">
 			<u-list @scrolltolower="scrolltolower" class="listContent">
 				<view v-for="(item, index) in tableList" :key="index" style="position: relative;">
@@ -37,6 +33,27 @@
 
 		
 		<u-toast ref="uToast"></u-toast>
+		<u-modal @confirm="handleSubmit" ref="popup" type="center" :show="modalShow" @cancel="modalShow=false"
+			:showCancelButton="true" :closeOnClickOverlay="true">
+			<view class="popup-content">
+
+				<form>
+					<view class="form-item">
+						<label class="form-label">*部门</label>
+						<u--input placeholder="部门" @click.native="showPicker"
+							v-model="addForm.planExecuteGroupName"></u--input>
+					</view>
+					<view class="form-item">
+						<label class="form-label">*计划执行人</label>
+
+						<uni-data-picker v-model="addForm.planExecuteUserId" placeholder="请选择" :localdata="userList"
+							@change="industryOnchange">
+						</uni-data-picker>
+					</view>
+
+				</form>
+			</view>
+		</u-modal>
 
 	</view>
 </template>
@@ -48,6 +65,7 @@
 	} from '@/api/purchasingManage/purchaseNeedManage.js'
 	import myCard from '../components/myCard.vue'
     import { reviewStatusEnum } from "@/enum/dict";
+	import { auditSalesDemand } from '@/api/salesServiceManagement/demandList/index.js'
 	export default {
 		components: {
 			myCard,
@@ -60,7 +78,7 @@
 				page: 1,
 				size: 10,
 				isEnd: false,
-		
+				modalShow: false,
 				current: {},
 				btnList: [{
 					name: '详情',
@@ -75,7 +93,7 @@
 					apiName: '',
 					btnType: 'primary',
 					type: '1',
-					pageUrl: '/pages/saleManage/businessOpportunity/add',
+					pageUrl: '/pages/purchasingManage/purchaseNeedManage/add',
 					judge: [{
 						authorities: '',
 					}, {
@@ -84,20 +102,27 @@
 
 					}],
 				}, 
-                {
+				{
 					name: '提交',
-					apiName: '',
+					apiName: 'handleAudit',
 					btnType: 'primary',
-					type: '1',
-					pageUrl: '/pages/saleManage/businessOpportunity/followList',
+					type: '2',
+					pageUrl: '',
 					judge: [{
 						authorities: '',
 					}, {
-						key: 'status',
-						value: [0, 3],
-
+						fn: (row) => {
+							if (row?.afterSalesType == 3) {
+								return (
+									(row?.approvalResult == 0 || row?.approvalResult == 3) &&
+									row?.demandStatus != 2
+								);
+							} else {
+								return row?.demandStatus == 0;
+							}
+						},
 					}],
-				}, 
+				},
                 {
 					name: '删除',
 					apiName: 'del',
@@ -200,6 +225,36 @@
 					uni.hideLoading()
 				})
 			},
+			handleAudit(row) {
+				this.current = row
+				if(row.afterSalesType==3){
+					this.listSubmit()
+				}else{
+					this.modalShow = true
+				}
+				
+				console.log(this.modalShow, 'dsds')
+			},
+			handleSubmit() {
+				auditSalesDemand({
+						...this.addForm,
+						submitSource: 3,
+						id: this.current.id
+					})
+					.then((res) => {
+						if (res) {
+							this.modalShow = false
+							this.$refs.uToast.show({
+								type: "success",
+								message: "操作成功",
+							})
+							this.doSearch();
+						}
+					})
+					.catch((err) => {
+						this.modalShow = false
+					});
+			},
 			add() {
 				uni.navigateTo({
 					url: '/pages/purchasingManage/purchaseNeedManage/add'

+ 122 - 0
utils/setProduct.js

@@ -0,0 +1,122 @@
+import Vue from 'vue';
+
+//改变数量
+export function changeCount(row, countObj, noDiscountSingle) {
+  let total = row[countObj.countKey] || 0;
+  let data = row;
+  if (row.packageDispositionList) {
+    let endIndex = row.packageDispositionList.findIndex(
+      (ite) => row[countObj.unitIdKey] == ite.id
+    );
+    for (; 0 < endIndex; endIndex--) {
+      total = Vue.prototype.$math.format(
+        row.packageDispositionList[endIndex].packageCell * total,
+        14
+      );
+    }
+  }
+
+  data['totalCount'] = total;
+  data['discountSinglePrice'] = !noDiscountSingle
+    ? data.singlePrice
+    : data.discountSinglePrice;
+
+  setWeight(data);
+  if (row[countObj.countKey] && row.singlePrice) {
+    data['totalPrice'] = row[countObj.countKey] * row.singlePrice;
+    data['discountTotalPrice'] = !noDiscountSingle
+      ? data.totalPrice
+      : data.discountTotalPrice;
+  } else {
+    data['totalPrice'] = 0;
+    data['discountTotalPrice'] = 0;
+  }
+  // getNotaxSinglePrice(data);
+  return data;
+  // if (row) {
+  //   singleWeightChange(row, index);
+  // }
+  // return getNumTotalPrice(arr, noDiscountSingle);
+}
+function setWeight(row) {
+  if (row.weightUnit == row.measuringUnit) {
+    row['totalWeight'] = row.totalCount;
+  } else if (row.totalCount && row.singleWeight) {
+    row['totalWeight'] = row.totalCount * row.singleWeight;
+  } else {
+    row['totalWeight'] = 0;
+  }
+}
+export function getAllPrice(arr) {
+  let sum = 0;
+  arr.forEach((item) => {
+    if (item.totalPrice) {
+      sum += Number(item.totalPrice);
+    }
+  });
+  return isNaN(sum) ? 0 : sum.toFixed(2);
+}
+// //计算不含税单价
+// function getNotaxSinglePrice(row) {
+//   if (row.singlePrice && row.taxRate) {
+//     row['notaxSinglePrice'] = parseFloat(
+//       (row.singlePrice / (1 + row.taxRate / 100)).toFixed(2)
+//     );
+//   } else {
+//     row['notaxSinglePrice'] = '';
+//   }
+// }
+
+// //计算总金额
+// function getNumTotalPrice(arr, noDiscountSingle) {
+//   let sum = 0;
+//   arr.forEach((r, index) => {
+//     // if (r.singlePrice) {
+//     //   r.notaxSinglePrice=r.taxRate?r.singlePrice/(1-(r.taxRate/100)):r.singlePrice
+//     // }
+//     if (r.singlePrice && r.totalCount) {
+//       Vue.set(
+//         arr[index],
+//         'discountSinglePrice',
+//         !noDiscountSingle ? r.singlePrice : r.discountSinglePrice
+//       );
+//       Vue.set(arr[index], 'totalPrice', getAllPrice(r));
+//       Vue.set(
+//         arr[index],
+//         'discountTotalPrice',
+//         !noDiscountSingle ? r.totalPrice : r.discountTotalPrice
+//       );
+//       sum += Number(r.totalPrice);
+//     } else {
+//       Vue.set(arr[index], 'totalPrice', 0);
+//       Vue.set(arr[index], 'discountTotalPrice',0);
+
+//     }
+//   });
+//   return { allPrice: isNaN(sum) ? 0 : sum.toFixed(2), arr };
+// }
+
+// //获取合计
+// function getAllPrice(row) {
+//   let num = 0;
+//   if (row.pricingWay == 1) {
+//     //按数量计价计算总金额
+//     num = Number(row.singlePrice) * Number(row.totalCount);
+//   }
+//   if (row.pricingWay == 2) {
+//     //按重量计价计算总金额
+//     num =
+//       Number(row.singlePrice) *
+//       Number(row.totalCount) *
+//       Number(row.singleWeight);
+//   }
+//   return isNaN(num) ? '' : num.toFixed(2);
+// }
+// function singleWeightChange(row) {
+//   console.log(row, 'row');
+//   if (row && row.singleWeight && row.totalCount) {
+//     row.totalWeight = (row.singleWeight * row.totalCount).toFixed(2) || 0;
+//   } else {
+//     row.totalWeight = '';
+//   }
+// }