Преглед изворни кода

fix:售后需求增加关联类型选择

liujt пре 9 месеци
родитељ
комит
ffa2f16324

+ 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: '作废' },
 ];

+ 92 - 8
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,25 @@
 			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)
+				let associationTypeObj = this.associationTypeList.find(el => el.value == res.associationType)
+				this.associationTypeOnchange({
+					"detail": {
+						"value": [associationTypeObj]
+					}
+				});
 				this.sourceCodeOnchange({
 					"detail": {
 						"value": [obj]
 					}
 				});
+				
 			},
 
 			sectionChange(index) {
@@ -219,21 +284,39 @@
 				}
 			},
 			sourceCodeOnchange(e) {
+				console.log('eee', e)
 				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 = undefined
+			},
 			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 +347,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) {