|
|
@@ -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
|
|
|
}
|