瀏覽代碼

Merge branch 'master' of http://110.41.163.243:9980/kd-aiot/aiot-app into dengfei

695593266@qq.com 9 月之前
父節點
當前提交
98510b8eab

+ 2 - 1
enum/dict.js

@@ -10,5 +10,6 @@ export const reviewStatusEnum = [
   { value: 0, label: '未提交' },
   { value: 1, label: '审核中' },
   { value: 2, label: '已审核' },
-  { value: 3, label: '审核未通过' }
+  { value: 3, label: '审核未通过' },
+  { value: 7, label: '作废' },
 ];

+ 5 - 5
pages/saleManage/businessOpportunity/components/drawer.vue

@@ -132,10 +132,10 @@
 			uni.$on('setBusinessOpportunity', () => {
 				this.save()
 			})
-			uni.$off('delFollowList')
-			uni.$on('delFollowList', (item) => {
-				deletefollowList([item.id])
-			})
+			// uni.$off('delFollowList')
+			// uni.$on('delFollowList', (item) => {
+			// 	deletefollowList([item.id])
+			// })
 			uni.$off('savefollowList')
 			uni.$on('savefollowList', (item) => {
 				item.contactId=this.form.contactId
@@ -175,7 +175,7 @@
 		},
 		onUnload() {
 			uni.$off('setBusinessOpportunity')
-			uni.$off('delFollowList')
+			// uni.$off('delFollowList')
 			uni.$off('savefollowList')
 		},
 		methods: {

+ 7 - 1
pages/saleManage/businessOpportunity/followList.vue

@@ -18,7 +18,8 @@
 	import {
 		getfollowList,
 		savefollowList,
-		getDetail
+		getDetail,
+		deletefollowList,
 	} from '@/api/saleManage/businessOpportunity/index.js'
 	export default {
 		components: {
@@ -43,6 +44,10 @@
 			
 				savefollowList(item)
 			})
+			uni.$off('delFollowList')
+			uni.$on('delFollowList', (item) => {
+				deletefollowList([item.id])
+			})
 			getDetail(data.id).then(async res => {
 				this.form = res
 				const {
@@ -66,6 +71,7 @@
 		},
 		onUnload() {
 			uni.$off('savefollowList')
+			uni.$off('delFollowList')
 		},
 		methods: {
 

+ 4 - 1
pages/saleManage/contact/components/followList.vue

@@ -121,6 +121,7 @@
 		},
 		methods: {
 			init(data) {
+				console.log('pageName', this.pageName)
 				if (this.pageName == 'businessOpportunity') {
 					this.tableList = JSON.parse(JSON.stringify(data))
 					return
@@ -128,6 +129,7 @@
 				if (data) {
 					this.form = data
 					this.tableList = JSON.parse(JSON.stringify(data.opportunityFollowupList))
+					console.log('tableList', this.tableList)
 				}
 			},
 
@@ -151,10 +153,11 @@
 				if (type == 'edit') {
 					data['index'] = index
 				}
+				console.log('index', JSON.stringify(data))
 				uni.navigateTo({
 					url: '/pages/saleManage/contact/components/followListAdd?type=' + type + '&linkList=' + JSON
 						.stringify(this.linkList) + (type == 'edit' ?
-							'&data=' + JSON.stringify(data) : '')
+							'&data=' + encodeURIComponent(JSON.stringify(data)) : '')
 				})
 			}
 

+ 86 - 2
pages/saleManage/contact/components/followListAdd.vue

@@ -30,6 +30,14 @@
 			<u-cell title="附件" arrow-direction="down">
 				<fileMain slot="value" v-model="form.files"></fileMain>
 			</u-cell>
+			<u-cell title="现场照片" arrow-direction="down">
+				<view slot="value" style="display: flex;align-items: center;width: 100%;">
+					<u-button :plain="true" :hairline="true" style="width: 100rpx;" size='mini' text="拍照上传"  @click="chooseImage"></u-button>
+				</view>
+			</u-cell>
+			<view class="imgList">
+				<u-album :urls="imgs" :singleSize="160" :multipleSize="160" :rowCount="4"></u-album>
+			</view>
 			
 			
 			<view class="footerButton">
@@ -69,10 +77,11 @@
 					opportunityId: '',
 					stageCode: '',
 					fileId: [],
-					stageName: ''
+					stageName: '',
 				},
 				type: '',
-				linkList:[]
+				linkList:[],
+				imgs: []
 			}
 		},
 
@@ -80,6 +89,7 @@
 			this.type = data.type
 			if (data.data) {
 				this.form = JSON.parse(data.data)
+				this.imgs = this.form.imgs;
 			}
 			this.linkList=JSON.parse(data.linkList).map(item=>{
 				return {
@@ -131,12 +141,66 @@
 				if(this.form.stageCode){
 					this.form.stageName=this.business_stage_code.find(item=>item.value==this.form.stageCode)?.text
 				}
+				this.form.imgs = this.imgs;
 				uni.$emit('updateFollowList', {
 					data: this.form,
 					type: this.type
 				})
 				this.back()
 			},
+			// 上传照片
+			chooseImage() {
+				const _this = this
+				uni.chooseImage({
+					count: 9, //默认9
+					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
+					sourceType: ['camera'], //现场拍照
+					success: function(res) {
+						uni.showLoading({
+							title: '加载中'
+						})
+
+						_this.uploadFile(res.tempFilePaths).then(res => {
+							res.forEach(item => {
+								let fileNames = item.storePath.split('/')
+								let url = _this.apiUrl +
+									'/main/file/getFile?objectName=' +  item.storePath+
+									'&fullfilename=' + fileNames[fileNames.length -
+										1]
+								_this.imgs.push(url)
+							})
+							uni.hideLoading()
+
+						})
+					}
+				});
+			},
+			uploadFile(list) {
+				let PromiseAll = []
+				const apiUrl = this.apiUrl
+				const token = uni.getStorageSync("token"); //取存本地的token
+				list.forEach(item => {
+					PromiseAll.push(
+						new Promise((resolve, reject) => {
+							uni.uploadFile({
+								url: apiUrl + '/main/file/upload',
+								filePath: item,
+								name: 'multiPartFile',
+								header: {
+									authorization: token
+								},
+								success: (uploadFileRes) => {
+									let data = JSON.parse(uploadFileRes.data)
+									resolve(data.data)
+								}
+							});
+						}),
+					)
+				})
+
+				return Promise.all(PromiseAll)
+
+			},
 
 		}
 	}
@@ -152,6 +216,10 @@
 		padding-bottom: 84rpx;
 	}
 
+	.imgList {
+		padding: 20rpx;
+	}
+
 	.footerButton {
 		width: 100%;
 		height: 84rpx;
@@ -168,6 +236,16 @@
 		}
 	}
 
+	uni-button {
+		width: 100rpx;
+		// height: 50rpx;
+		margin-left: 10rpx;
+		margin-right: 0;
+		color: #fff !important;
+		border: none;
+		background: #157a2c !important;
+
+	}
 	// /deep/.u-button {
 	// 	height: 100%;
 	// }
@@ -175,4 +253,10 @@
 	/deep/.u-subsection__item__text {
 		font-size: 28rpx !important;
 	}
+	/deep/.u-album__row__wrapper {
+		uni-image {
+			width: 160rpx !important;
+			height: 160rpx !important;
+		}
+	}
 </style>

+ 93 - 13
pages/salesServiceManagement/demandList/add.vue

@@ -12,6 +12,11 @@
 					</u--input>
 				</view>
 			</u-cell>
+			<u-cell title="关联类型" arrow-direction="down">
+				<uni-data-picker :readonly="!isDisable" v-model="form.associationType" slot="value" placeholder="请选择"
+					:localdata="associationTypeList" @change="associationTypeOnchange">
+				</uni-data-picker>
+			</u-cell>
 			<u-cell title="需求名称" arrow-direction="down">
 				<view slot="value" style="display: flex;align-items: center;width: 100%;">
 					<u--input style="flex:1" :disabled="!isDisable" placeholder="请输入" border="surround"
@@ -26,7 +31,7 @@
 					</u--input>
 				</view>
 			</u-cell>
-			<u-cell title="发货单" arrow-direction="down">
+			<u-cell v-if="form.associationType" :title="orderCodeName" arrow-direction="down">
 				<view slot="value" style="display: flex;align-items: center;width: 100%;">
 					<u--input :disabled="!isDisable" style="flex:1" placeholder="请选择" border="surround"
 						@click.native="invoiceDialogOpen" v-model="form.orderCode">
@@ -90,6 +95,13 @@
 			isDisable() {
 				let flag = this.type != 'view'
 				return flag;
+			},
+			orderCodeName() {
+				let name = this.associationTypeList.find(item => item.value === this.form.associationType)?.text || ''
+				if(name === '客户') {
+					return '产品'
+				}
+				return name
 			}
 		},
 		data() {
@@ -106,6 +118,20 @@
 					contactInfoVOS: [],
 					contactCode: '',
 				},
+				associationTypeList: [
+					{
+						value: '1',
+						text: '发货单'
+					},
+					{
+						value: '2',
+						text: '销售订单'
+					},
+					{
+						value: '3',
+						text: '客户'
+					}
+				],
 				createUserName: '',
 				list: ['基本信息', '售后对象', '联系人'],
 				current: 0,
@@ -152,10 +178,39 @@
 				);
 				this.$set(this.form, 'productDetail', list);
 			})
+
+			uni.$off('setProduceList')
+			uni.$on('setProduceList', (data) => {
+				console.log('data', data)
+				let list = data.map((el) => {
+					el.categoryCode = el.code;
+					el.categoryName = el.name;
+					el.categoryModel = el.modelType;
+					return el;
+				});
+				let params = {
+					orderCode: list[0].categoryCode,
+					orderId: list[0].id,
+					tableList: list,
+				};
+				// this.tableList.push(...data)
+				this.$set(this.form, 'orderCode', params.orderCode);
+				this.$set(this.form, 'orderId', params.orderId);
+				console.log(params, 'params');
+				let listnew = JSON.parse(JSON.stringify(params.tableList));
+				console.log(listnew);
+				// 如果计量数量没有的话默认是 1
+				listnew.map(
+					(el) =>
+					(el.measureQuantity = el.measureQuantity ? el.measureQuantity : 1)
+				);
+				this.$set(this.form, 'productDetail', listnew);
+			})
 		},
 		onUnload() {
 			uni.$off('setSelectList');
 			uni.$off('goosData');
+			uni.$off('setProduceList');
 		},
 		mounted() {
 
@@ -165,15 +220,22 @@
 			async getDetails(id) {
 				this.getByCode();
 				const res = await getSalesDemandById(id);
+				console.log('res', res.orderCode)
 				let data = JSON.parse(JSON.stringify(res));
+				console.log('data111', data.orderCode)
 				this.form = data;
+				// this.$set(this.form, 'orderCode', data.orderCode);
 				this.createUserName = data.createUserName;
 				let obj = this.fault_level.find(el => el.value == res.faultLevel)
-				this.sourceCodeOnchange({
-					"detail": {
-						"value": [obj]
-					}
-				});
+				let associationTypeObj = this.associationTypeList.find(el => el.value == res.associationType)
+				this.form.associationType = associationTypeObj.value;
+				if(res.faultLevel) {
+					this.sourceCodeOnchange({
+						"detail": {
+							"value": [obj]
+						}
+					});
+				}
 			},
 
 			sectionChange(index) {
@@ -222,18 +284,35 @@
 				const value = e.detail.value;
 				this.form.faultLevel = value[0].value;
 			},
+			associationTypeOnchange(e) {
+				const value = e.detail.value;
+				this.form.associationType = value[0].value;
+				this.form.orderCode = ''
+			},
 			invoiceDialogOpen() {
-				if (!this.form.contactId) {
+				if (!this.form.contactId && this.form.associationType !== '3') {
 					this.$refs.uToast.show({
 						type: "warning",
 						message: "请先选择客户",
 					})
 					return;
 				}
-				uni.navigateTo({
-					url: '/pages/salesServiceManagement/demandList/components/Invoice?contactId=' + this.form
-						.contactId
-				})
+				console.log(this.form.associationType)
+				if(this.form.associationType === '3') {
+					// uni.navigateTo({
+					// 	url: '/pages/salesServiceManagement/demandList/components/product?contactId=' + this.form
+					// 		.contactId + '&associationType=' + this.form.associationType
+					// })
+					uni.navigateTo({
+						url: '/pages/saleManage/components/selectProduce?isAll=' + 0
+					})
+				} else {
+					uni.navigateTo({
+						url: '/pages/salesServiceManagement/demandList/components/Invoice?contactId=' + this.form
+							.contactId + '&associationType=' + this.form.associationType
+					})
+				}
+				
 			},
 			async getByCode() {
 				const codeValue = await getByCode('fault_level');
@@ -264,10 +343,11 @@
 						})
 						return
 					}
-					if (!data.orderCode) {
+					if (!data.orderCode && this.form.associationType !== '3') {
+						const message = this.form.associationType === "1" ? "请选择发货单" : "请选择销售订单"
 						this.$refs.uToast.show({
 							type: "warning",
-							message: "请选择发货单",
+							message: message,
 						})
 						return
 					}

+ 42 - 9
pages/salesServiceManagement/demandList/components/Invoice.vue

@@ -21,7 +21,7 @@
           :class="{ active: current == 0 }"
           @click="handNav(0)"
         >
-          发货单</view
+          {{associationType === '1' ? '发货单' : '销售订单'}}</view
         >
         <view
           class="nav_item"
@@ -62,7 +62,7 @@
                     {{ item.contactName }}
                   </view>
                 </view>
-                <view class="listBox-bottom">
+                <view v-if="associationType === '1'" class="listBox-bottom">
                   <view>发货单编码:{{ item.docNo }}</view>
                   <view>销售订单编码:{{ item.orderNo }}</view>
                   <view class="half"
@@ -71,6 +71,16 @@
                   <view class="half">状态:{{ orderStatus(item) }}</view>
                   <view>创建时间:{{ item.createTime }}</view>
                 </view>
+                <view v-if="associationType === '2'" class="listBox-bottom">
+                  <view>订单编码:{{ item.orderNo }}</view>
+                  <view>订单类型:{{ needProduceStatus(item) }}</view>
+                  <view>预销售订单编码:{{ item.preOrderNo }}</view>
+                  <view>产品名称:{{ item.productNames }}</view>
+                  <view>生产编号:{{ item.productionCodes }}</view>
+                  <view>批次号:{{ item.batchNos }}</view>
+                  <view>数量:{{ item.productCount }}</view>
+                  <view class="half">状态:{{ orderStatus(item) }}</view>
+                </view>
               </view>
             </view>
           </label>
@@ -107,7 +117,7 @@ import { parameterGetByCode } from "@/api/mainData/index.js";
 import screen from "./screen.vue";
 import itemSelect from "./itemSelect.vue";
 import { reviewStatusEnum } from "@/enum/dict";
-import { saleordersendrecord } from "@/api/saleManage/saleorder/index.js";
+import { saleordersendrecord, getTableList } from "@/api/saleManage/saleorder/index.js";
 let [isEnd] = [false];
 export default {
   components: {
@@ -115,9 +125,26 @@ export default {
     itemSelect,
   },
   computed: {
+    needProduceStatus() {
+      return (row) => {
+        if(this.associationType === '2') {
+          return row.needProduce == 1
+                  ? '有客户生产性订单'
+                  : row.needProduce == 2
+                  ? '无客户生产性订单'
+                  : row.needProduce == 4
+                  ? '不定向订单'
+                  : '库存式订单';
+        }
+        return ''
+      }
+    },
     orderStatus() {
       return (row) => {
-        return reviewStatusEnum[row.reviewStatus].label;
+        if(this.associationType === '1') {
+          return reviewStatusEnum[row.reviewStatus].label;
+        }
+        return reviewStatusEnum.find(item => item.value === row.orderStatus)?.label;
       };
     },
     checkListLen() {
@@ -127,6 +154,7 @@ export default {
   data() {
     return {
       contactId: "",
+      associationType: "",
       current: 0,
       page: 1,
       size: 10,
@@ -134,8 +162,9 @@ export default {
       detailsData: [],
     };
   },
-  onLoad({ contactId }) {
+  onLoad({ contactId, associationType }) {
     this.contactId = contactId;
+    this.associationType = associationType;
     this.getList();
     // this.getClassify()
   },
@@ -159,12 +188,16 @@ export default {
     async getList(data = {}) {
       let params = {
         pageNum: this.page,
-        reviewStatus: 2,
+        // reviewStatus: 2,
         ...data,
         contactId: this.contactId,
       };
+      if(this.associationType === '1') {
+        params.reviewStatus = 2;
+      }
       isEnd = false;
-      const res = await saleordersendrecord(params);
+      const requst = this.associationType === '1' ? saleordersendrecord : getTableList;
+      const res = await requst(params);
       if (params.pageNum === 1) {
         this.dataList = [];
       }
@@ -182,7 +215,7 @@ export default {
 
       // 勾选完 查询物品明细
       if (val.checked) {
-        this.$refs.itemRef.getData(this.dataList[index]);
+        this.$refs.itemRef.getData(this.dataList[index], this.associationType);
       } else {
         this.$refs.itemRef.resetTable();
       }
@@ -199,7 +232,7 @@ export default {
       }
       let obj = this.dataList.filter((item) => item.checked)[0];
       let data = {
-        orderCode: obj.docNo,
+        orderCode: this.associationType === '1' ? obj.docNo : obj.orderNo,
         orderId: obj.id,
         tableList: this.detailsData,
       };

+ 35 - 11
pages/salesServiceManagement/demandList/components/itemSelect.vue

@@ -34,7 +34,8 @@
 
 <script>
 	import {
-		saleordersendrecord
+		saleordersendrecord,
+		getSaleOrderDetail
 	} from '@/api/saleManage/saleorder/index.js'
 	import {
 		parameterGetByCode
@@ -50,23 +51,30 @@
 		data() {
 			return {
 				listData: [],
-				sectionList: []
+				sectionList: [],
 			}
 		},
-		onLoad({}) {},
+		onLoad({}) {
+		},
 		methods: {
-			async getData(row) {
+			async getData(row, associationType) {
 				this.sectionList = [];
 				this.listData = [];
-				let params = {
-					code: 'after_sales_product_list_source'
-				};
-				const res = await parameterGetByCode(params);
-				if (res.value == '1') {
-					this.getInfo(row);
+				console.log(associationType)
+				if(associationType === '1') {
+					let params = {
+						code: 'after_sales_product_list_source'
+					};
+					const res = await parameterGetByCode(params);
+					if (res.value == '1') {
+						this.getInfo(row);
+					} else {
+						this._getInfo(row.docNo);
+					}
 				} else {
-					this._getInfo(row.docNo);
+					this.getSaleInfo(row)
 				}
+				
 			},
 			resetTable() {
 				this.sectionList = [];
@@ -134,6 +142,22 @@
 				});
 				this.listData = list;
 			},
+			async getSaleInfo(row) {
+				const res = await getSaleOrderDetail(row.id);
+				let list = res.productList.map((el) => {
+					el.categoryCode = el.productCode;
+					el.categoryName = el.productName;
+					el.categoryModel = el.modelType;
+					el.measureQuantity = el.totalCount;
+					el.barcodes = el.carCode;
+					el.packingSpecification = el.specification;
+					el.shipmentDate = row.createTime || null;
+					(el.guaranteePeriodDeadline = this.getTime(row.createTime)[0]),
+					(el.warrantyStatus = this.getTime(row.createTime)[1]);
+					return el;
+				});
+				this.listData = list;
+			},
 			async selectVal(e, val, index) {
 				// 添加进选中的数组
 				if (e.detail.value.length && e.detail.value[0] === val.id) {

+ 6 - 1
pages/salesServiceManagement/workOrder/index.vue

@@ -500,7 +500,12 @@
 				})
 			},
 			// 报工
-			edit(type, id) {
+			async edit(type, id) {
+				// 判断报工是否可执行
+				if(type == 'report') {
+					const result = await this.checkId(id)
+					if(!result) return
+				}
 				uni.navigateTo({
 					url: `/pages/salesServiceManagement/workOrder/components/editPlan?type=${type}&id=${id}`
 				})