<template>
<div v-loading="detailLoading">
<div class="breadcrumb-line breadStyle">
<xui-breadcrumb separator-class="fa fa-angle-right" style="margin-top: 10px">
<xui-breadcrumb-item>{{ $t('pmall-retail-special-breadcrumb1') }}</xui-breadcrumb-item>
<xui-breadcrumb-item>{{ $t('pmall-retail-business-to-sample') }}</xui-breadcrumb-item>
<xui-breadcrumb-item>{{ $t('pmall-retail-business-to-sample-detail') }}</xui-breadcrumb-item>
</xui-breadcrumb>
</div>
<div class="header">{{ $PIX.I18n.get('pmall-bp-label-details') }}</div>
<xui-row style="margin-right: 25px">
<xui-form label-width="160px" :model="detail" :rules="submitFormRules" ref="submitForm">
<xui-row>
<xui-col :span="8">
<!-- 申请单号 -->
<xui-form-item :label="$PIX.I18n.get('pmall-common-label-applicationNo') + ':'">
<div class="ellipsis" :title="detail.appNo">{{ detail.appNo }}</div>
</xui-form-item>
</xui-col>
<xui-col :span="8">
<!-- 申请时间 -->
<xui-form-item :label="$PIX.I18n.get('pmall-common-shortTitle-applicationTime') + ':'">
<div class="ellipsis" :title="detail.creationDate">{{ detail.creationDate }}</div>
</xui-form-item>
</xui-col>
<xui-col :span="8">
<!-- 申请人 -->
<xui-form-item :label="$PIX.I18n.get('pmall-bp-label-applicant') + ':'">
<div class="ellipsis" :title="detail.createdBy">{{ detail.createdBy }}</div>
</xui-form-item>
</xui-col>
</xui-row>
<xui-row>
<!-- 申请类型 -->
<xui-col :span="8">
<xui-form-item :label="$PIX.I18n.get('pmall-bp-label-applicationType') + ':'" prop="reportType">
<xui-select v-model="detail.reportType" clearable filterable v-if="isDraft">
<xui-option v-for="item in applicationTypeList" :key="item.value" :label="item.label" :value="item.value" />
</xui-select>
<div class="ellipsis" :title="formatterTpye(detail.reportType)" v-else>{{ formatterTpye(detail.reportType) }}</div>
</xui-form-item>
</xui-col>
<!-- 样机陈列公司 -->
<xui-col :span="8">
<xui-form-item :label-multiline="true" :label="$t('pmall-retail-business-to-sample-prototype-display-company') + ':'" prop="retailerChannel">
<xui-select
v-model="detail.retailerChannel"
clearable
v-if="isDraft"
drop-down-search
@visible-change="searchCompanyName('')"
:filter-method="searchCompanyName"
@change="searchCompanyVisible"
>
<xui-option v-for="item in companysOptions" :key="item.value" :label="item.label" :value="item" />
</xui-select>
<div class="ellipsis" :title="detail.retailerChannel.label" v-else>{{ detail.retailerChannel.label }}</div>
</xui-form-item>
</xui-col>
<!-- 样机陈列公司编码 -->
<xui-col :span="8">
<xui-form-item :label-multiline="true" :label="$t('pmall-retail-business-to-sample-prototype-display-company-code') + ':'">
<div class="ellipsis" :title="detail.retailerChannel.value">{{ detail.retailerChannel.value }}</div>
</xui-form-item>
</xui-col>
</xui-row>
<xui-row>
<!-- 样机陈列门店 -->
<xui-col :span="8">
<xui-form-item :label-multiline="true" :label="$t('pmall-retail-business-to-sample-prototype-display-store') + ':'" prop="retailerStore">
<xui-select
v-model="detail.retailerStore"
clearable
@visible-change="searchStoreName('')"
drop-down-search
:filter-method="searchStoreName"
v-if="isDraft"
>
<xui-option
:no-data-text="detail.retailerChannel.value ? $PIX.I18n.get('pmall-activity-message-nodata') : $t('pmall-retail-business-to-sample-prototype-tips3')"
v-for="item in storeOptions"
:key="item.value"
:label="item.label"
:value="item"
/>
</xui-select>
<div class="ellipsis" :title="detail.retailerStore" v-else>
{{ detail.retailerStore.label }}
</div>
</xui-form-item>
</xui-col>
<!-- 样机陈列门店编码 -->
<xui-col :span="8">
<xui-form-item :label="$t('pmall-retail-business-to-sample-prototype-display-store-code') + ':'">
<div class="ellipsis" :title="detail.retailerStore.value">{{ detail.retailerStore.value }}</div>
</xui-form-item>
</xui-col>
<!-- 样机陈列门店类型 -->
<xui-col :span="8">
<xui-form-item :label-multiline="true" :label="$t('pmall-retail-business-to-sample-prototype-display-store-type') + ':'">
<div class="ellipsis" :title="detail.retailerStore.regionalImageLevel">{{ detail.retailerStore.regionalImageLevel }}</div>
</xui-form-item>
</xui-col>
</xui-row>
<xui-col :span="24">
<!-- 申请原因 -->
<xui-form-item :label="$t('pmall-retail-special-sample-reason') + ':'" prop="reason">
<span>
<xui-input
v-model="detail.reason"
counter
:maxlength="500"
auto-complete="off"
type="textarea"
:rows="4"
:disabled="!isDraft"
:placeholder="$PIX.I18n.get('pmall-operation-info-verifiyInput')"
></xui-input>
</span>
</xui-form-item>
</xui-col>
<xui-col :span="24">
<!-- 附件 -->
<xui-form-item :label="$PIX.I18n.get('pmall-voiceDetail-Attachments') + ':'" prop="attachmentList">
<span v-if="isDraft">
<edm-v3-upload
ref="attachment"
businessType="ClSampleUnlock"
:isOverrideAccept="true"
style="width: 100%"
:limit="5"
:multiple="true"
accept=".jpg,.png.pdf,.docx,.zip"
capacity="200"
:prop-file-list="propFileList"
:change="changeUpload"
>
</edm-v3-upload>
</span>
<ul v-else class="edoc-upload-file-list" @click.stop="() => {}">
<li v-for="item in detail.attachmentList" :key="item.docId">
<img src="./paperclip.png" width="15px" style="margin-right: 10px" />
<span @click.stop="handlePreview(item)">{{ item.name }}</span>
</li>
</ul>
</xui-form-item>
</xui-col>
</xui-form>
</xui-row>
<div style="display: flex; justify-content: space-between; margin-right: 40px">
<div class="header2">{{ $PIX.I18n.get('pmall-bp-label-item') }}</div>
<div style="position: relative; top: 10px; display: flex" v-if="isDraft">
<input-text
style="width: 220px; margin-right: 10px"
:inputPlaceholder="$t('pmall-retail-special-tips1')"
:inputLen="1"
:inputText="snList2"
@inputData="inputData2('snList2')"
></input-text>
<xui-button style="height: 30px" @click="addLocalData()">{{ $t('pmall-retail-special-add') }}</xui-button>
<xui-button style="height: 30px" @click="delLocalData()">{{ $PIX.I18n.get('pmall-rep-office-contact-delete') }}</xui-button>
</div>
</div>
<div class="detail">
<xui-table
class="my-table"
ref="myTable"
row-key="id"
:data="tableData"
border
lazy
:stripe="false"
v-loading="tableLoading"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
max-height="500"
@selection-change="handleSelectionChange"
>
<xui-table-column :key="Math.random()" type="selection" align="center" width="33" fixed="left" v-if="isDraft"></xui-table-column>
<!-- 产品SN号 -->
<xui-table-column prop="sn" :label="$t('pmall-retail-demo-sn-no')" width="180" show-overflow-tooltip fixed="left">
<template slot-scope="{ row }">
<span class="table-title">{{ row.sn || '-' }}</span>
</template>
</xui-table-column>
<!-- 状态 -->
<xui-table-column prop="status" :label="$PIX.I18n.get('pmall-china-tabListHead-status')" width="150" show-overflow-tooltip>
<template slot-scope="{ row }">
<span :class="getStatusColor(row.status)">{{ filterStatus(row.status) }}</span>
</template>
</xui-table-column>
<!-- 审批意见 -->
<xui-table-column prop="approvalInfo" :label="$PIX.I18n.get('pmall-member-label-approvalResult')" width="150" show-overflow-tooltip>
<template slot-scope="{ row }">
<span class="table-title">{{ row.approvalInfo ? row.approvalInfo : '-' }}</span>
</template>
</xui-table-column>
<!-- 产品编码 -->
<xui-table-column prop="productCode" :label="$PIX.I18n.get('pmall-operation-label-goodsCode')" width="150" show-overflow-tooltip>
<template slot-scope="{ row }">
<span class="table-title">{{ row.productCode ? row.productCode : '-' }}</span>
</template>
</xui-table-column>
<!-- 产品名称 -->
<xui-table-column width="200" show-overflow-tooltip prop="productName" :label="$PIX.I18n.get('pmall-activity-title-activityproductname')">
<template slot-scope="{ row }">
<span class="table-title">{{ row.productName ? row.productName : '-' }}</span>
</template>
</xui-table-column>
<!-- 陈列门店已有样机数量 -->
<xui-table-column prop="storePrototypeNumber" :label="$t('pmall-retail-business-to-sample-number')" width="200" show-overflow-tooltip>
<template slot-scope="{ row }">
<xui-button v-if="row.storePrototypeNumber || row.storePrototypeNumber === 0" type="text" class="table-title" @click="numberClick">{{ row.storePrototypeNumber }}</xui-button>
<span v-else>-</span>
</template>
</xui-table-column>
<!-- 样机型号 -->
<xui-table-column prop="prototypeModel" :label="$t('pmall-retail-demo-prototype-model')" width="150" show-overflow-tooltip>
<template slot-scope="{ row }">
<span class="table-title">{{ row.prototypeModel ? row.prototypeModel : '-' }}</span>
</template>
</xui-table-column>
<!-- 产品传播名 -->
<xui-table-column prop="marketingName" :label="$t('pmall-retail-demo-product-propagation')" width="150" show-overflow-tooltip>
<template slot-scope="{ row }">
<span class="table-title">{{ row.marketingName || '-' }}</span>
</template>
</xui-table-column>
<!-- 产品族 -->
<xui-table-column prop="productSeries" :label="$t('pmall-retail-demo-product-family')" width="150" show-overflow-tooltip>
<template slot-scope="{ row }">
<span class="table-title">{{ row.productSeries ? row.productSeries : '-' }}</span>
</template>
</xui-table-column>
<!-- 产业 -->
<xui-table-column prop="industry" :label="$t('pmall-retail-demo-industry')" width="150" show-overflow-tooltip>
<template slot-scope="{ row }">
<span class="table-title">{{ row.industry ? row.industry : '-' }}</span>
</template>
</xui-table-column>
<!-- 商品机所在零售商渠道名称 -->
<xui-table-column width="200" show-overflow-tooltip prop="commercialChannelName" :label="$t('pmall-retail-business-to-sample-channelname')">
<template slot-scope="{ row }">
<span class="table-title">{{ row.commercialChannelName ? row.commercialChannelName : '-' }}</span>
</template>
</xui-table-column>
<!-- 商品机所在零售商渠道编码 -->
<xui-table-column prop="commercialChannelId" :label="$t('pmall-retail-business-to-sample-channelcode')" width="200" show-overflow-tooltip>
<template slot-scope="{ row }">
<span class="table-title">{{ row.commercialChannelId ? row.commercialChannelId : '-' }}</span>
</template>
</xui-table-column>
</xui-table>
</div>
<!-- 分页 -->
<div class="pagination">
<div class="dialog-footer" v-if="isDraft">
<xui-button @click="cancelSubmitForm" size="bigger">{{ $PIX.I18n.get('pmall-bp-quick-purchase-cancel') }}</xui-button>
<xui-button @click="saveApplication" size="bigger" type="secondary">{{ $PIX.I18n.get('pmall-common-button-save') }}</xui-button>
<xui-button type="primary" size="bigger" @click="submitToGam">{{ $PIX.I18n.get('pmall-voiceDetail-submit') }}</xui-button>
</div>
</div>
<search-box ref="searchBox2" :limit-num="200" :search-data="snList2" :search-title="$t('pmall-retail-demo-sn-no')" @confirm="confirmSearch2" />
<xui-dialog showcenter :title="$PIX.I18n.get('pmall-friendly-reminder')" :close-on-click-modal="false" :visible.sync="tipsVisible" width="30%">
<div :style="errorMsg.length > 10 ? 'height: 400px' : 'height: 200px'">
<xui-scrollbar style="height: 100%">
<p v-for="item in errorMsg" :key="item" style="padding: 5px">{{ item }}</p>
</xui-scrollbar>
</div>
<span slot="footer" class="dialog-footer" center>
<xui-button type="primary" size="bigger" @click="tipsVisible = false">{{ $PIX.I18n.get('pmall-bp-button-confirm') }}</xui-button>
</span>
</xui-dialog>
<xui-dialog
:title="$PIX.I18n.get('pmall-bp-address-add')"
class="layout-form"
showcenter
:visible.sync="dialogFormVisible2"
@close="closeDialog2"
width="1300px"
>
<div style="height: 600px" v-if="dialogFormVisible2">
<xui-scrollbar style="height: 100%">
<new-business-sample-operation
:list="totalTableDataList"
from="detail"
@addSNConfirmDialog="addSNConfirmDialog"
@changeIsShowList="changeIsShowList"
/>
</xui-scrollbar>
</div>
</xui-dialog>
<search-box
ref="addSNBox"
:limit-num="200"
:needKeep="false"
@getSearchData="getSearchData"
:search-data="addSNList"
:placeholder="placehoder"
:search-title="$t('pmall-retail-demo-sn-no')"
@confirm="addSNConfirm"
:loading="snLoading"
/>
</div>
</template>
<script>
import i18n from '../special-sample-unlocking/i18n/i18n.vue';
import { businessSampleV1Save, businessSampleV1Push, getCompanyList, businessSampleV1CheakSn, businessSampleV1Query,businessSampleV1SampleQuery } from './api';
import EdmV3Upload from '@components/edm-v3-upload/edm-v3-upload.vue';
import searchBox from '@components/multi-choice-search-box/search-box.vue';
import inputText from '@components/multi-choice-search-box/input-text.vue';
import NewBusinessSampleOperation from '../business-sample-conversion/new-business-sample-operation.vue';
export default {
mixins: [i18n],
components: {
EdmV3Upload,
searchBox,
inputText,
NewBusinessSampleOperation
},
data() {
return {
lang: $PIX.Context.currentLanguage.key,
tableData: [],
totalTableDataList: [], // 增加sn时查询的列表
propFileList: [],
snList2: [],
addSNList: [],
detail: {
appNo: '',
createdBy: '',
creationDate: '',
reason: '',
attachmentList: [],
retailerChannel: {},
retailerStore: {},
reportType: ''
},
spuId:'',
retailerChannelId:'',
isDraft: false,
tipsVisible: false,
dialogFormVisible2: false,
onlySelf: true,
onlyDownLoad: false,
errorMsg: [],
appNo: '',
pageInfo: {
currentPage: 1,
pageSize: 1000,
totalRowCount: 0
},
innerMulitlist: [],
selectionList: [],
tableLoading: false,
detailLoading: false,
snLoading: false,
statusList: [
{ labelCN: '地区部确认完成', labelEN: 'Confirmed by the region', value: 2, style: 'color-city' },
{ labelCN: '商转样完成', labelEN: 'Completed', value: 3, style: 'color-success' },
{ labelCN: '待地市审批', labelEN: 'To be summarized', value: 4, style: 'color-regin' },
{ labelCN: '待省终端审批', labelEN: 'To be approved', value: 5, style: 'color-regin' },
{ labelCN: '待地区部确认', labelEN: 'To be confirmed', value: 6, style: 'color-city' },
{ labelCN: '驳回', labelEN: 'Rejected', value: 7, style: 'color-reject' },
{ labelCN: '已撤回', labelEN: 'canced', value: 8, style: 'color-reject' },
{ labelCN: '草稿', labelEN: 'Draft', value: 0, style: 'color-draf' } //pmall自定义状态,gam无此状态
],
applicationTypeList: [
{ label: '新建店提报', value: '1' },
{ label: '门店翻新、升级', value: '2' },
{ label: '存量门店增补', value: '3' }
],
retailerChannelList: [],
companysOptions: [],
storeOptions: [],
allStoreList: [],
curChannelStoreList: [],
placehoder: `请输入产品SN号或者IMEI1或者IMEI2号码中的一个,如果需要一次性添加多个用换行分格,或者复制表格列粘贴,如:\n4UQ9K25409005228\n4UQ9K25409005231\n4UQ9K25409005232\n`
};
},
beforeCreate() {
const locale = $PIX.Context.currentLanguage;
this.$i18n.locale = locale.key;
},
created() {
const param = $PIX.Util.getQueryParametersFromURL() || {};
this.appNo = param.appNo||param.applicationCode;
this.applicationStatus = param.applicationStatus;
this.isDraft = param.model === 'draft';
console.log(this.isDraft,"这个这个是什么11")
this.detailLoading = true;
this.getData();
this.getCompanyList();
},
computed: {
getStatusColor() {
return status => {
if(this.isDraft) return 'color-draf'
const obj = this.statusList.find(v => v.value === status) || {};
return obj.style || 'color-draf';
};
},
submitFormRules() {
if (this.isDraft) {
return {
reason: [
{
required: true,
message: this.$t('pmall-retail-business-to-sample-prototype-tips4'),
trigger: 'blur'
},
{
min: 1,
max: 500,
message: this.$t('pmall-retail-business-to-sample-prototype-tips5'),
trigger: 'blur'
}
],
retailerChannel: [
{
required: true,
message: this.$t('pmall-retail-business-to-sample-prototype-tips6'),
trigger: 'change'
}
],
retailerStore: [
{
required: true,
message: this.$t('pmall-retail-business-to-sample-prototype-tips7'),
trigger: 'change'
}
],
reportType: [
{
required: true,
message: this.$t('pmall-retail-business-to-sample-prototype-tips8'),
trigger: 'change'
}
]
};
}
}
},
methods: {
getSearchData(val) {
this.addSNList = val.split('\n');
},
addSNConfirm(val) {
this.addSNList = val;
this.$refs.addSNBox.dialogVisible = true;
if (!val || val.length == 0) {
this.$message.warning($PIX.I18n.get('pmall-china-message-snCode'));
return;
}
if (val.length > 100) {
this.$message.warning(this.$t('pmall-retail-special-tips3'))
return;
}
this.snLoading = true;
businessSampleV1CheakSn(val).then(res => {
this.snLoading = false;
if (!res.result?.length) {
this.$message.warning(this.$t('pmall-retail-business-to-sample-prototype-tips1'));
return;
} else {
this.$refs.addSNBox.dialogVisible = false;
const snMap = this.tableData.map(v => v.sn);
this.totalTableDataList = res.result.filter(v => snMap.indexOf(v.sn) < 0);
if (!this.totalTableDataList.length) {
this.$refs.addSNBox.dialogVisible = true;
return this.$message.warning(this.$t('pmall-retail-business-to-sample-prototype-tips2'));
}
this.dialogFormVisible2 = true;
}
});
},
addSNConfirmDialog(list) {
this.tableData = [...list, ...this.tableData];
this.dialogFormVisible2 = false;
},
changeIsShowList() {
this.dialogFormVisible2 = false;
},
confirmSearch2(val) {
this.snList2 = val;
let searchList = [];
for (const item of this.tableData) {
for (const itemTwo of val) {
if (item.sn === itemTwo) {
searchList.push(item);
}
}
}
this.toggleSelection(searchList);
},
toggleSelection(rows) {
if (rows && rows.length) {
this.$refs.myTable.clearSelection();
this.tableData.forEach(row => {
for (const item of rows) {
if (row.sn === item.sn) {
this.$refs.myTable.toggleRowSelection(row);
}
}
});
}
},
clearSnList2() {
this.snList2 = [];
},
inputData2() {
this.$refs.searchBox2.dialogVisible = true;
},
addLocalData() {
this.$refs.addSNBox.dialogVisible = true;
this.addSNList = [];
},
delLocalData() {
if (!this.selectionList.length) {
this.$message.warning(this.$t('pmall-delete-select-tips'));
}
for (let i = 0; i < this.tableData.length; i++) {
for (let j = 0; j < this.selectionList.length; j++) {
if (this.tableData[i].sn === this.selectionList[j].sn) {
this.tableData.splice(i, 1);
}
}
}
this.selectionList = [];
this.clearSelection();
this.pageInfo.totalRowCount = this.tableData.length;
},
numberClick() {},
searchCompanyName(e) {
if (e.length >= 2) {
this.companysOptions = this.retailerChannelList.filter(item => {
return item.label.toLowerCase().indexOf(e.toLowerCase()) > -1;
});
} else {
this.companysOptions = this.retailerChannelList;
}
},
searchStoreName(e) {
if (!this.detail.retailerChannel.value) {
this.storeOptions = [];
return;
}
if (e.length >= 2) {
this.storeOptions = this.curChannelStoreList.filter(item => {
return item.label.toLowerCase().indexOf(e.toLowerCase()) > -1;
});
} else {
this.storeOptions = this.curChannelStoreList;
}
},
searchCompanyVisible() {
this.curChannelStoreList =
this.allStoreList instanceof Array
? this.allStoreList
.filter(item => this.detail.retailerChannel.value === item.channelId)
.map(({ storeCode, storeName, regionalImageLevel }) => ({
value: storeCode,
label: storeName,
regionalImageLevel,
}))
: [];
this.storeOptions = this.curChannelStoreList;
this.detail.retailerStore = '';
},
clearSelection() {
this.$refs.myTable.clearSelection();
},
formatterTpye(type) {
return this.applicationTypeList.find(v => v.value === type)?.label;
},
filterStatus(status) {
if (this.isDraft) return $PIX.I18n.get('pmall-china-Choose-Draft') ;
if (!status && status !== 0) return '-';
const obj = this.statusList.find(v => v.value === status) || {};
return this.lang === 'zh_CN' ? obj.labelCN : obj.labelEN;
},
handleSelectionChange(val) {
this.selectionList = val;
},
getData() {
const params = {
appNo: this.appNo,
pageSize: this.pageInfo.pageSize,
curPage: this.pageInfo.currentPage,
isDraft: this.isDraft
};
businessSampleV1Query(params)
.then(res => {
if (res.code === '0' && res.result && res.result?.result?.length) {
this.tableData = res.result.result;
console.log(this.tableData,"拿到的数据")
this.spuId = this.tableData[0].marketingCode
this.retailerChannelId = this.tableData[0].retailerChannelId
this.pageInfo.totalRowCount = res.result.pageVO.totalRows;
this.detail.creationDate = this.tableData[0].creationDate;
this.detail.createdBy = this.tableData[0].createdBy;
this.detail.appNo = this.tableData[0].appNo;
this.detail.retailerChannel = { value: this.tableData[0].retailerChannelCode, label: this.tableData[0].retailerChannelName };
this.searchCompanyVisible();
this.detail.retailerStore = { value: this.tableData[0].storeCode, label: this.tableData[0].storeName };
this.detail.reportType = this.tableData[0].reportType;
this.detail.retailerStore.regionalImageLevel = this.tableData[0].storeType;
this.detail.reason = this.tableData[0].applyReason;
let docs = this.tableData[0].docJson ? JSON.parse(this.tableData[0].docJson) : [];
this.detail.attachmentList = docs?.map(v => {
return { name: v.title, docId: v.id };
});
this.propFileList = this.detail.attachmentList;
if(this.tableData.length > 0) {
this.getPrototypeNumber()
}
} else {
this.$message.error(this.$PIX.I18n.get('pmall-activity-message-nodata'));
this.tableData = [];
this.pageInfo.totalRowCount = 0;
this.detail = {
appNo: '',
createdBy: '',
creationDate: '',
reason: '',
attachmentList: [],
retailerChannel: {},
retailerStore: {},
reportType: ''
};
}
})
.catch(() => {
this.tableData = [];
this.pageInfo.totalRowCount = 0;
this.detail = {
appNo: '',
createdBy: '',
creationDate: '',
reason: '',
attachmentList: [],
retailerChannel: {},
retailerStore: {},
reportType: ''
};
})
.finally(() => {
this.tableLoading = false;
this.detailLoading = false;
});
},
//查询详情样机数量
getPrototypeNumber() {
let params = {}
if(this.isDraft) {//全部
params = {
id: this.retailerChannelId,
pageSize: 10,
curPage: 1,
storeCode:null,
spuId:null,
};
}else {//草稿
params = {
storeCode: this.detail.retailerStore.value,
spuId: this.spuId,
pageSize: 10,
curPage: 1
};
}
businessSampleV1SampleQuery(params).then(res=>{
console.log(res,"详情拿到的样机数量")
})
},
submitToGam() {
this.$refs.submitForm?.validate(valid => {
if (valid) {
const flag = this.detail.attachmentList.some(v => !v.docId);
if (flag) return this.$message.warning(this.$t('pmall-upload-tips'));
if (!this.tableData.length) {
return this.$message.warning(this.$t('pmall-delete-select-tips'));
}
if (this.tableData?.length > 100) return this.$message.warning(this.$t('pmall-retail-special-tips3'));
const params = this.setParams();
this.detailLoading = true;
businessSampleV1Push(params)
.then(res => {
this.detailLoading = false;
if (res.code === '0') {
if (res.result.status == '1') {
this.$message.success(this.$PIX.I18n.get('pmall-incentive-prompt-success'));
setTimeout(() => {
$PIX.Util.goTo('business-sample-conversion');
}, 1000);
} else {
const errList = res.result?.snMap?.filter(v => v.status != 1) || [];
if (errList?.length) {
this.errorMsg = errList?.map(v => 'SN:' + v.sn + $PIX.I18n.get('pmall-buyer-center-Hwtransfer-operationTipsfour', { val: v.msg })) || [];
this.tipsVisible = true;
} else {
this.$message.error($PIX.I18n.get('pmall-buyer-center-batch-purchase-tip-001'));
}
}
} else if (res.code === '1') {
this.$message.error(res.result.msg || res.msg);
} else {
this.$message.error(this.$PIX.I18n.get('pmall-china-message-actionFail'));
}
})
.catch(() => {
this.detailLoading = false;
this.$message.error(this.$PIX.I18n.get('pmall-china-message-actionFail'));
})
.finally(() => {
this.detailLoading = false;
});
} else {
this.$message.error($PIX.I18n.get('pmall-error-E0312001001'));
return false;
}
});
},
saveApplication() {
this.$refs.submitForm?.validate(valid => {
if (valid) {
const flag = this.detail.attachmentList.some(v => !v.docId);
if (flag) return this.$message.warning(this.$t('pmall-upload-tips'));
if (!this.tableData.length) {
return this.$message.warning(this.$t('pmall-delete-select-tips'));
}
if (this.tableData?.length > 100) return this.$message.warning(this.$t('pmall-retail-special-tips3'));
const params = this.setParams();
this.detailLoading = true;
businessSampleV1Save(params)
.then(res => {
this.detailLoading = false;
if (res.code === '0') {
this.$message.success(this.$PIX.I18n.get('pmall-china-message-saveSuccess'));
this.pageInfo.currentPage = 1;
this.getData();
} else {
this.$message.error(this.$PIX.I18n.get('pmall-china-message-actionFail'));
}
})
.catch(() => {
this.detailLoading = false;
this.$message.error(this.$PIX.I18n.get('pmall-china-message-actionFail'));
});
} else {
this.$message.error($PIX.I18n.get('pmall-error-E0312001001'));
return false;
}
});
},
setParams() {
let submitDataList = [];
if(this.selectionList.length > 0) {
submitDataList = this.selectionList;
}else {
submitDataList = this.tableData;
}
const snDetailList = JSON.parse(JSON.stringify(submitDataList || []))
snDetailList?.forEach(v => {
v.storeCode = this.detail.retailerStore.value;
v.storeName = this.detail.retailerStore.label;
v.retailerChannelCode = this.detail.retailerChannel.value;
v.retailerChannelName = this.detail.retailerChannel.label;
v.storeType = this.detail.retailerStore.regionalImageLevel;
v.reportType = this.detail.reportType;
});
const params = {
appNo: this.detail.appNo,
docs:
this.detail.attachmentList?.map(v => {
return { id: v.docId, title: v.name };
}) || [],
reason: this.detail.reason || '',
businessType: '1',
snDetailList
};
return params;
},
getCompanyList() {
const params = {
lang: this.lang,
appId: $PIX.Context.currentPage.appId,
customerCode: '',
target: 'pmallbase'
};
getCompanyList(params).then(res => {
if (res.code === '0') {
const { channelList, storeList } = res.result || {};
this.allStoreList = storeList;
this.companysOptions =
channelList instanceof Array
? channelList.map(({ channelId, channelName }) => ({
value: channelId,
label: channelName
}))
: [];
this.retailerChannelList = this.companysOptions;
}
});
},
changeUpload(fileList) {
const resList = [];
for (let i = 0; i < fileList.length; i++) {
const obj = {
name: fileList[i]['name'],
docId: fileList[i]['docId']
};
resList.push(obj);
}
this.detail.attachmentList = [...resList];
},
cancelSubmitForm() {
setTimeout(() => {
window.close();
}, 1000);
},
handlePreview(file) {
const edocId = file.docId || '';
if (!edocId) {
this.$message.warning(
$PIX.I18n.get('pmall-edm-message-notOnlinePreview', {
filename: file.name
})
);
}
if (this.onlyDownLoad) {
// 其他文档询问是否下载预览
this.$confirm(
$PIX.I18n.get('pmall-edm-message-isAllowDownPreview', {
filename: file.name
}),
''
).then(() => {
if (this.onlySelf) {
$PIX.Edm.downloadAuthEdmFile(edocId);
} else {
$PIX.Edm.downloadEdmFile(edocId);
}
});
} else {
// eslint-disable-next-line no-debugger
if (/\.(png|jpg|gif|bmp)$/i.test(file.name)) {
// 图片预览
if (this.onlySelf) {
$PIX.Edm.onlineAuthPicView(edocId);
} else {
$PIX.Edm.onlinePicView(edocId);
}
} else if (/\.(pdf)$/i.test(file.name)) {
// PDF预览
if (this.onlySelf) {
$PIX.Edm.onlineAuthFileView(edocId);
} else {
$PIX.Edm.onlinePdfView(edocId);
}
} else {
// 其他文档询问是否下载预览
this.$confirm(
$PIX.I18n.get('pmall-edm-message-isAllowDownPreview', {
filename: file.name
}),
''
).then(() => {
if (this.onlySelf) {
$PIX.Edm.downloadAuthEdmFile(edocId);
} else {
$PIX.Edm.downloadEdmFile(edocId);
}
});
}
}
}
}
};
</script>
<style lang="scss" scoped>
.detail {
margin: 0 40px;
}
.xui-form {
margin: 0 14px;
}
.xui-table__placeholder {
display: inline-block;
width: 0px;
}
.pagination {
margin: 20px 40px 60px;
}
.cus-table {
margin-top: 20px;
}
.header {
font-size: 16px;
font-weight: 700;
margin: 30px 40px;
}
.header2 {
font-size: 14px;
font-weight: 700;
margin: 20px 40px;
}
.color-draf {
color: #3467ff;
}
.color-reject {
color: #ff3300;
}
.color-success {
color: #029903;
}
.color-regin {
color: #ff9900;
}
.color-city {
color: #ff9966;
}
.dialog-footer {
width: 100%;
margin-top: 40px;
text-align: center;
}
.edoc-upload-file-list {
li {
padding-right: 30px;
position: relative;
display: flex;
align-items: center;
line-height: 28px;
& > span {
cursor: pointer;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
text-align: left;
&:hover {
color: #c8102e;
}
}
&:first-child {
margin-top: 0;
}
i {
margin-right: 6px;
}
em {
color: #999;
cursor: pointer;
position: absolute;
right: 5px;
}
}
}
.reason-overflow {
max-height: 90%;
overflow-y: auto;
p {
max-height: 200px;
}
}
.ellipsis {
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.breadStyle {
width: 100%;
height: 40px;
padding: 5px 0;
line-height: 40px;
background: #f8f8f8;
}
.xui-select {
width: 100%;
}
</style>
为什么 if(this.tableData.length > 0) {
this.getPrototypeNumber()
}执行这里的代码时,页面数据不显示,