<template>
<div>
<div class="search" v-if="from !== 'detail'">
<!-- 新建商转样申请 -->
<div class="header">{{$t('pmall-retail-business-product-apply-new')}}</div>
</div>
<div v-if="step === 1 || from === 'detail'">
<h3 class="header" style="margin-bottom:10px;">{{$PIX.I18n.get('pmall-incentive-title-product')}}</h3>
<NewSampleUpList
ref="sampleDataList"
:tableDataList="tableDataList"
:pageInfo="pageInfo"
:isDialogHeight="from === 'detail'"
@handleSelectionChange="handleSelectionChange"
@page-change="pageChange"
/>
<div style="text-align:center;margin-bottom:20px;">
<xui-button style="min-width:40px;padding-left:0;padding-right:0;" @click="toDown()"><i class="fa fa-chevron-down" style="font-size:16px;"></i></xui-button>
<xui-button style="min-width:40px;padding-left:0;padding-right:0;margin-left:50px;" @click="toUp()"><i class="fa fa-chevron-up" style="font-size:16px;"></i></xui-button>
</div>
<div style="display:flex;margin-bottom:20px;">
<div style="width:200px;line-height:30px;"><h3>{{$t('pmall-retail-business-already-add')}}</h3></div>
<div style="display:flex;width:100%;">
<div style="width:80px;line-height:30px;">{{$t('pmall-retail-business-product-sn')}}</div>
<div style="width:100%"><xui-input type="text" style="width:100%" clearable v-model="searchKey"></xui-input></div>
<div style="margin-left:20px;width:173px;">
<xui-button class="btn" type="primary" style="height:32px;" @click="getFilterData()">{{ $PIX.I18n.get('pmall-lable-role-search') }}</xui-button>
<xui-button class="btn" style="height:32px;" @click="resetData()">{{ $PIX.I18n.get('pmall-lable-role-reset') }}</xui-button>
</div>
</div>
</div>
<NewSampleDownList
ref="sampleDataList"
:tableDataList="tableDataList2"
:pageInfo="pageInfo2"
:isDialogHeight="from === 'detail'"
@handleSelectionChange="handleSelectionChange2"
@page-change="pageChange2"
/>
<div class="btnArea" style="text-align:center;">
<xui-button @click="cancelForm()" size="bigger">{{ $PIX.I18n.get('pmall-bp-quick-purchase-cancel') }}</xui-button>
<xui-button type="primary" size="bigger" @click="sureForm()">{{$PIX.I18n.get('pmall-bp-button-ok')}}</xui-button>
</div>
</div>
<div v-if="step === 2">
<xui-form type="dialog" :model="submitForm" :rules="submitFormRules" ref="submitForm" style="margin-top: 20px" label-width="120px">
<xui-row :gutter="20">
<xui-col :span="8">
<xui-form-item :label="$PIX.I18n.get('pmall-bp-label-applicationType')" prop="type">
<xui-select
:placeholder="$PIX.I18n.get('pmall-common-placeholder-select')"
v-model="submitForm.type"
style="width: 100%"
clearable
>
<xui-option v-for="item in typeList" :key="item.value" :label="item.label" :value="item.value">
</xui-option>
</xui-select>
</xui-form-item>
</xui-col>
<xui-col :span="8">
<xui-form-item :label="$t('pmall-retail-business-display-company')" prop="company">
<xui-select
:placeholder="$PIX.I18n.get('pmall-common-placeholder-select')"
v-model="submitForm.company"
style="width: 100%"
@change="searchCompanyVisible"
>
<xui-option v-for="item in channelList" :key="item.channelId" :label="item.channelName" :value="item.channelId">
</xui-option>
</xui-select>
</xui-form-item>
</xui-col>
<xui-col :span="8">
<xui-form-item :label="$t('pmall-retail-business-display-company-code')">
<span>{{companyCode}}</span>
</xui-form-item>
</xui-col>
</xui-row>
<xui-row :gutter="20">
<xui-col :span="8">
<xui-form-item :label="$t('pmall-retail-business-display-store')" prop="store">
<xui-select
:placeholder="$PIX.I18n.get('pmall-common-placeholder-select')"
v-model="submitForm.store"
style="width: 100%"
@change="handleStoreChange"
>
<xui-option v-for="item in storeList" :key="item.storeCode" :label="item.storeName" :value="item.storeCode">
</xui-option>
</xui-select>
</xui-form-item>
</xui-col>
<xui-col :span="8">
<xui-form-item :label="$t('pmall-retail-business-display-store-code')">
<span>{{storeCode}}</span>
</xui-form-item>
</xui-col>
<xui-col :span="8">
<xui-form-item :label="$t('pmall-retail-business-display-store-type')">
<span>{{storeType}}</span>
</xui-form-item>
</xui-col>
</xui-row>
<xui-form-item :label="$t('pmall-retail-special-sample-reason')" prop="reason">
<xui-input
v-model="submitForm.reason"
counter
:maxlength="500"
auto-complete="off"
type="textarea"
style="width: 96%"
:rows="4"
:placeholder="$PIX.I18n.get('pmall-operation-info-verifiyInput')"
></xui-input>
</xui-form-item>
<xui-form-item :label="$PIX.I18n.get('pmall-voiceDetail-Attachments')" prop="attachmentList">
<edm-v3-upload
ref="attachment"
businessType="ClSampleUnlock"
:isOverrideAccept="true"
style="width: 560px"
:limit="5"
:multiple="true"
accept=".jpg,.png.pdf,.docx,.zip"
capacity="200"
:prop-file-list="propFileList"
:change="changeUpload"
>
</edm-v3-upload>
</xui-form-item>
</xui-form>
<div class="addArea">
<div style="display:flex;justify-content:space-between;margin-bottom:10px;">
<div>{{$PIX.I18n.get('pmall-incentive-title-product')}}</div>
<div style="display:flex;">
<xui-button @click="addLocalData()">{{$t('pmall-retail-special-add')}}</xui-button>
<xui-button @click="delLocalData()">{{$PIX.I18n.get('pmall-rep-office-contact-delete')}}</xui-button>
</div>
</div>
<div class="tableArea">
<SampleDataModalList
ref="sampleDataModalList"
:tableDataList="tableDataList3"
:pageInfo="pageInfo3"
:innerMulitlist="innerMulitlist"
:isSave="isSave"
@handleSelectionChange="handleSelectionChange3"
@page-change="pageChange3"
@getNewSnList="getNewSnList"
@clearSnList2="clearSnList2"
@getNumDetailId="getNumDetailId"
:dialogFormVisible="dialogFormVisible"
:tableLoading="tableLoading"
/>
</div>
</div>
<div class="btnArea" style="text-align:center;">
<xui-button @click="cancelForm2()" size="bigger">{{ $PIX.I18n.get('pmall-bp-quick-purchase-cancel') }}</xui-button>
<xui-button type="primary" size="bigger" @click="saveApplication()">{{ $PIX.I18n.get('pmall-common-button-save')}}</xui-button>
<xui-button type="primary" size="bigger" @click="submitToGam()">{{$PIX.I18n.get('pmall-common-button-submit')}}</xui-button>
</div>
</div>
<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; cancelForm2(); ">{{ $PIX.I18n.get('pmall-bp-button-ok') }}</xui-button>
</span>
</xui-dialog>
<search-box ref="searchBox2" @getSearchData="getSearchData" :search-data="snList2" :placeholder="$t('pmall-retail-business-tips1')" :search-title="$t('pmall-retail-demo-sn-no')" @confirm="confirmSearch2" />
<xui-dialog
:title="$t('pmall-retail-business-has-num')"
class="layout-form"
showcenter
:visible.sync="dialogFormVisible3"
width="1100px"
>
<div class="tableArea">
<SampleDetaillList ref="SampleDetaillList" :isAdd="true" :storeCode="storeCode" :numDetailId="numDetailId" :dialogVisible="dialogFormVisible3"/>
</div>
</xui-dialog>
</div>
</template>
<script>
import { businessSampleV1SampleQuery } from './api'
import { getHWCategoryList,getCompanyList,businessSampleV1Save,businessSampleV1Push,businessSampleV1CheakSn, sampleUnlockV1Push, sampleUnlockV1Save, sampleUnlockV1Query } from './api';
import i18n from './i18n/i18n.vue';
import NewSampleUpList from './components/new-sample-up-list.vue';
import NewSampleDownList from './components/new-sample-down-list.vue';
import SampleDataModalList from './components/sample-data-modal-list.vue';
import SampleDetaillList from './components/business-sample-detail-list.vue';//引入弹框的父组件
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';
let timeout;
export default {
props:['list','from'],
mixins: [i18n],
components: {
NewSampleUpList,
NewSampleDownList,
SampleDataModalList,
SampleDetaillList,
EdmV3Upload,
searchBox,
inputText
},
data() {
return {
uploadHeaders: {
'x-csrf-token': localStorage.getItem('pmall-x-csrf-token'),
'x-pix-csrf-token': localStorage.getItem('pix-environment-csrf-token')
},
ruleForm: {
marketingName: [],
snList: [],
storeCode: '',
storeName: '',
statusList: []
},
snList2: [],
uploadUrl: $PIX.Pmall.getPmallProxy('pmallbase') + '/pmallbase/edm3/uploadByStream',
showSpuTips: false,
showFlag: true,
treeSelectAll: false,
searchTreeSelectAll: false,
hasPermission: false,
dialogFormVisible: false,
dialogFormVisible2: false,
dialogFormVisible3:false,
numDetailId:"",
tipsVisible: false,
productNameData: [],
allOfferingList: [],
allSpuList: [],
searchPreValue: [],
roleDTOList: [],
propFileList: [],
searchSelectLength: 0,
maxSize: 200,
currentTab: 'all',
selectInput: '',
tabStatus: [1, 2, 3, 4, 5, 6, 7, 8],
lang: $PIX.Context.currentLanguage.key,
defaultProps: {
children: 'children',
label: node => {
return node.spuId ? node.spuNameCn : node.nameCn;
}
},
submitForm: {
type:'',
company:'',
store:'',
reason: '',
attachmentList: []
},
companyName:'',
companyCode:'',
storeCode:'',
storeName:'',
storeType:'',
typeList:[
{label:this.$t('pmall-retail-business-product-sample-option1'),value:1},
{label:this.$t('pmall-retail-business-product-sample-option2'),value:2},
{label:this.$t('pmall-retail-business-product-sample-option3'),value:3}
],
submitFormRules: {
reason: [
{
required: true,
message: this.$t('pmall-retail-business-product-sample-tips8'),
trigger: 'blur'
},
{
min: 1,
max: 500,
message: this.$t('pmall-retail-business-product-sample-tips9'),
trigger: 'blur'
}
],
type: [
{
required: true,
message: $PIX.I18n.get('pmall-operation-info-verifiySelect'),
trigger: 'change'
}
],
company: [
{
required: true,
message: $PIX.I18n.get('pmall-operation-info-verifiySelect'),
trigger: 'change'
}
],
store: [
{
required: true,
message: $PIX.I18n.get('pmall-operation-info-verifiySelect'),
trigger: 'change'
}
]
},
tableDataList: [],
tableDataList2: [],
tableDataList3: [],
totalTableDataList:[],
totalTableDataList2:[],
totalTableDataList3:[],
savedTotaTableDataList:[],
searchTotalTableDataList:[],
searchKey:'',
errorMsg: [],
pageInfo: {
currentPage: 1,
pageSize: 10,
totalRowCount: 0
},
pageInfo2: {
currentPage: 1,
pageSize: 10,
totalRowCount: 0
},
pageInfo3: {
currentPage: 1,
pageSize: 10,
totalRowCount: 0
},
channelList:[],
totalStoreList:[],
storeList:[],
tableLoading: false,
mulitList: [],
mulitList2:[],
mulitList3:[],
submitDataList:[],
singleMulitList: [],
isMul: true,
innerMulitlist: [],
newSnList: [],
isSave: true,
step:1
};
},
computed: {
// 导入
fileImport() {
const serviceId = 'ptco.sampleProductMgt.import';
const taskType = 'pmall-operation-sample-business-management-import';
const taskTypeDisplay = '商转样导入';
const siteId = $PIX.Context.app.currentId;
const userId = $PIX.Context.currentUser.account || $PIX.Context.currentUser.ssoUid;
return `${window.location.origin + $PIX.Environment.apiGatewayPrefix}mp.asyncTask.import?serviceId=${encodeURIComponent(
serviceId
)}&siteId=${encodeURIComponent(siteId)}&taskType=${encodeURIComponent(taskType)}&taskTypeDisplay=${encodeURIComponent(
taskTypeDisplay
)}&userId=${encodeURIComponent(userId)}&edmSupport=false`;
},
fileImportPath() {
return $PIX.Pmall.getPmallProxy('pmallbase') + '/pmallbase/edm3/uploadByStream';
},
searchTreeIndeterminate() {
this.searchTreeSelectAll = false;
if (this.searchSelectLength == this.allSpuList.length + this.allOfferingList.length) {
this.searchTreeSelectAll = true;
}
return this.searchSelectLength > 0 && this.searchSelectLength < this.allSpuList.length + this.allOfferingList.length;
},
treeExpandKey() {
return [];
},
statusList() {
const list = [
{ labelCN: '草稿', labelEN: 'To be Application', value: 1 },
{ labelCN: '待地市审批', labelEN: 'To be summarized', value: 2 },
{ labelCN: '待省终端审批', labelEN: 'To be approved', value: 3 },
{ labelCN: '待地区部确认', labelEN: 'To be confirmed', value: 4 },
{ labelCN: '地区部确认完成', labelEN: 'confirmed', value: 5 },
{ labelCN: '商转样完成', labelEN: 'completed', value: 6 },
{ labelCN: '驳回', labelEN: 'Rejected', value: 7 },
{ labelCN: '已撤回', labelEN: 'canced', value: 8 }
];
if (this.currentTab === 'all') {
return list;
}
if (this.currentTab === 'draft') {
return list.filter(v => v.value == 1 || v.value == 7 || v.value == 8);
}
if (this.currentTab === 'process') {
return list.filter(v => v.value == 4 || v.value == 5 || v.value == 6);
}
if (this.currentTab === 'completed') {
return list.filter(v => v.value == 3);
}
},
isDisabledBatchApply() {
return this.mulitList.filter(item => item.status != '0' && item.status != '1' && item.status != '7' && item.status != '8').length > 0;
}
},
methods: {
getNumDetailId(info){
if(this.storeCode.length <= 0) return this.$message.warning('请先选择陈列门店');//新增时如果样机陈列门店,不能查看
this.dialogFormVisible3 = true;
this.numDetailId = info.marketingCode;//对应supId
},
getCompanyList(){
let params = {
lang: this.lang,
appId: this.appId,
customerCode: '',
target: 'pmallbase'
};
getCompanyList(params).then(res => {
if (res.code === '0') {
const { channelList, storeList } = res.result || {};
this.channelList = channelList;
this.totalStoreList = storeList;
}
});
},
searchCompanyVisible(val) {
let currentCompany = this.channelList.filter(item => item.channelId === val);
this.companyCode = currentCompany.length ? currentCompany[0].channelId:'';
this.companyName = currentCompany.length ? currentCompany[0].channelName:'';
this.storeList = this.totalStoreList.filter(item => item.channelId == val);
this.submitForm.store = '';
this.storeCode = '';
this.storeName = '';
this.storeType = '';
},
handleStoreChange(val){
let currentStore = this.storeList.filter(item => item.storeCode === val);
this.storeCode = currentStore.length ? currentStore[0].storeCode:'';
this.storeName = currentStore.length ? currentStore[0].storeName:'';
this.storeType = currentStore.length ? currentStore[0].regionalImageLevel:'';
this.getNumber()
},
//新增选门店刷新样机数量
getNumber() {
let params = {
storeCode:this.storeCode,
spuId:this.tableDataList3[0].marketingCode,
pageSize: 10,
curPage: 1,
}
businessSampleV1SampleQuery(params).then(res=>{
let newTotalTableDataList3 = this.totalTableDataList3.map(item=>{
return{
...item,
storePrototypeNumber: res.result.pageVO.totalRows
}
})
console.log(newTotalTableDataList3,"刷新数据的")
this.$set(this,'totalTableDataList3',newTotalTableDataList3)
})
},
addLocalData(){
this.snList2 = [];
this.$refs.searchBox2.dialogVisible = true;
},
delLocalData(){
console.log(this.totalTableDataList3,11111)
for(let i=0;i<this.totalTableDataList3.length;i++){
for(let itemTwo of this.mulitList3){
if(this.totalTableDataList3[i].imei === itemTwo.imei){
this.totalTableDataList3.splice(i,1);
if(i>0){
i--;
}
}
}
}
this.tableDataList3 = [];
this.tableDataList3 = this.totalTableDataList3.slice(0,this.pageInfo.pageSize);
this.pageInfo3.totalRowCount = this.totalTableDataList3.length;
this.pageInfo3.currentPage = 1;
this.savedTotaTableDataList = this.totalTableDataList3;
},
getFilterData(){
this.pageInfo2.currentPage = 1;
// this.pageInfo2.pageSize = this.pageSize;
this.searchTotalTableDataList = this.totalTableDataList2.filter(item => (item.imei.indexOf(this.searchKey) > -1));
this.tableDataList2 = this.searchTotalTableDataList.slice(0,this.pageInfo2.pageSize);
this.pageInfo2.totalRowCount = this.searchTotalTableDataList.length;
},
resetData(){
this.searchKey = '';
},
cancelForm(){
this.$confirm(this.$t('pmall-retail-business-tips2'), this.$PIX.I18n.get('pmall-china-tips-title'), {
confirmButtonText: this.$PIX.I18n.get('pmall-common-button-confirm'),
cancelButtonText: this.$PIX.I18n.get('pmall-china-tips-cancle')
}).then(() => {
this.$emit('changeIsShowList',true)
}).catch(() => {});
},
cancelForm2(){
this.$emit('changeIsShowList',true)
},
getSearchData(val){
this.snList2 = val.split('\n');
},
confirmSearch2(val){
this.snList2 = val;
localStorage.setItem('business-sample-snlist',JSON.stringify(val));
if(!val || val.length == 0){
this.$message.warning(this.$t('pmall-retail-business-product-sample-tips7'));
this.$refs.searchBox2.dialogVisible = true;
return;
}
if(val.length > 100){
this.$message.warning(this.$t('pmall-retail-special-tips2'));
this.$refs.searchBox2.dialogVisible = true;
return;
}
businessSampleV1CheakSn(this.snList2).then(res => {
this.totalTableDataList = res.result;
this.tableDataList = this.totalTableDataList.slice(0,this.pageInfo.pageSize);
this.totalTableDataList2 = [];
this.tableDataList2 = [];
this.pageInfo.totalRowCount = this.totalTableDataList.length;
this.pageInfo.currentPage = 1;
this.pageInfo2.totalRowCount = 0;
this.pageInfo2.currenPage = 1;
});
this.isShowList = false;
this.step = 1;
},
sureForm(){
if(this.from === 'detail') {
this.$emit('addSNConfirmDialog',this.totalTableDataList2)
return
}
this.totalTableDataList2.forEach(item => {
if (!this.savedTotaTableDataList.find(itemTwo => item.imei === itemTwo.imei)) {
this.totalTableDataList3.push(item);
}
});
this.savedTotaTableDataList = this.totalTableDataList3;
this.totalTableDataList2 = [];
this.tableDataList2 = [];
this.pageInfo3.totalRowCount = this.totalTableDataList3.length;
this.pageInfo3.currentPage = 1;
this.tableDataList3 = this.totalTableDataList3.slice(0,this.pageInfo3.pageSize);
this.searchKey = '';
this.getFilterData();
this.step = 2;
this.pageInfo.pageSize = 10;
},
sureForm2(){
this.$emit('changeIsShowList',true)
},
toDown(){
this.totalTableDataList2 = [...this.totalTableDataList2,...this.mulitList];
this.tableDataList2 = this.totalTableDataList2.slice(0,this.pageInfo2.pageSize);
for(let i=0; i<this.totalTableDataList.length;i++){
for(const itemTwo of this.mulitList){
if(this.totalTableDataList[i].imei === itemTwo.imei){
this.totalTableDataList.splice(i,1);
console.log(i)
console.log(this.totalTableDataList)
if(i>0){
i--;
}
}
}
}
console.log(this.totalTableDataList)
this.tableDataList = this.totalTableDataList.slice(0,this.pageInfo.pageSize);
this.pageInfo.totalRowCount = this.totalTableDataList.length;
this.pageInfo2.totalRowCount = this.totalTableDataList2.length;
this.pageInfo.currentPage = 1;
this.pageInfo2.currentPage = 1;
},
toUp(){
this.totalTableDataList = [...this.mulitList2,...this.totalTableDataList];
this.tableDataList = this.totalTableDataList.slice(0,this.pageInfo.pageSize);
for(let i=0; i<this.totalTableDataList2.length;i++){
for(const itemTwo of this.mulitList2){
if(this.totalTableDataList2[i].imei === itemTwo.imei){
this.totalTableDataList2.splice(i,1);
if(i>0){
i--;
}
}
}
}
this.tableDataList2 = this.totalTableDataList2.slice(0,this.pageInfo2.pageSize);
this.pageInfo2.totalRowCount = this.totalTableDataList2.length;
this.pageInfo.totalRowCount = this.totalTableDataList.length;
this.pageInfo.currentPage = 1;
this.pageInfo2.currentPage = 1;
},
pageChange(page) {
this.$nextTick(() => {
this.pageInfo.currentPage = page.currentPage;
this.pageInfo.pageSize = page.pageSize;
this.tableDataList = this.totalTableDataList.slice((this.pageInfo.currentPage - 1) * this.pageInfo.pageSize, this.pageInfo.currentPage * this.pageInfo.pageSize)
});
},
pageChange2(page) {
this.$nextTick(() => {
this.pageInfo2.currentPage = page.currentPage;
this.pageInfo2.pageSize = page.pageSize;
this.tableDataList2 = this.totalTableDataList2.slice((this.pageInfo2.currentPage - 1) * this.pageInfo2.pageSize, this.pageInfo2.currentPage * this.pageInfo2.pageSize)
console.log(this.pageInfo2.currentPage - 1)
console.log(this.pageInfo2.pageSize)
console.log(this.tableDataList2)
console.log(this.totalTableDataList2)
});
},
pageChange3(page) {
this.$nextTick(() => {
this.pageInfo3.currentPage = page.currentPage;
this.pageInfo3.pageSize = page.pageSize;
this.tableDataList3 = this.totalTableDataList3.slice((this.pageInfo3.currentPage - 1) * this.pageInfo3.pageSize, this.pageInfo3.currentPage * this.pageInfo3.pageSize)
console.log(this.tableDataList3,"这是表格数据")
});
},
handleSelectionChange(val) {
this.mulitList = val;
},
handleSelectionChange2(val) {
this.mulitList2 = val;
},
handleSelectionChange3(val) {
this.mulitList3 = val;
},
batchApply() {
this.$refs.searchBox2.dialogVisible = true;
},
// 导入前格式校验
beforeUsersUpload(file) {
let last = file.name.split('.');
last = last[last.length - 1].toLowerCase();
if (['xlsx'].includes(last)) {
} else {
this.$message.error(this.$t('pmall-retail-business-import-filetype-tip'));
return false;
}
if (file.size > 20 * 1024 * 1024) {
this.$message.error(this.$t('pmall-retail-business-import-fileSize-tip'));
return false;
}
},
// 导入成功
usersImportSuccess(response) {
if (+response.code === 200) {
//导入成功,查看我的导入
this.$alert($PIX.I18n.get('pmall-common-message-import-success'), $PIX.I18n.get('pmall-china-message-title'), {
confirmButtonText: $PIX.I18n.get('pmall-common-button-goahead-view'),
type: 'success',
showConfirmButton: 'false',
callback: action => {
if (action === 'confirm') {
$PIX.Util.goTo('my-imExport?tab=myImport', '_blank');
}
}
});
} else {
this.$message.error($PIX.I18n.get('pmall-common-prompt-import-fail')); // 导入失败
}
},
inputData(key) {
this.selectInput = key;
this.$refs.searchBox.dialogVisible = true;
},
inputData2(key) {
this.selectInput = key;
this.$refs.searchBox2.dialogVisible = true;
},
showProduct() {
this.dialogFormVisible2 = true;
},
resetPageData(){
this.tableDataList = [];
this.tableDataList2 = [];
this.tableDataList3 = [];
this.totalTableDataList = [];
this.totalTableDataList2 = [];
this.totalTableDataList3 = [];
this.savedTotaTableDataList = [];
this.searchTotalTableDataList = [];
this.searchKey = '';
this.pageInfo = {
currentPage: 1,
pageSize: 10,
totalRowCount: 0
};
this.pageInfo2 = {
currentPage: 1,
pageSize: 10,
totalRowCount: 0
};
this.pageInfo3 = {
currentPage: 1,
pageSize: 10,
totalRowCount: 0
};
},
submitToGam() {
this.$refs.submitForm?.validate(valid => {
if (valid) {
const flag = this.submitForm.attachmentList.some(v => !v.docId);
if (flag) return this.$message.warning(this.$t('pmall-upload-tips'));
if(this.mulitList3.length>0) {
this.submitDataList = this.mulitList3
}else {
this.submitDataList = this.totalTableDataList3
}
if (!this.submitDataList.length) {
return this.$message.warning(this.$t('pmall-delete-select-tips2'));
}
if (this.submitDataList?.length > 100) return this.$message.warning(this.$t('pmall-retail-special-tips3'));
const docs = this.submitForm.attachmentList?.map(v => {
return { id: v.docId, title: v.name };
}) || [];
const params = {
appNo: "",
docs,
reason: this.submitForm.reason || '',
businessType: 1,
snDetailList: this.submitDataList.map(v =>{
return {
sn: v.sn,
status: v.status,
productCode:v.productCode,
productName:v.productName,
storeCode:this.storeCode,
storeName:this.storeName,
storeType:this.storeType,
repOfficeCode:v.repOfficeCode || '',
repOffice:v.repOffice || '',
cityCode:v.cityCode || '',
cityName:v.cityName || '',
reportType: this.submitForm.type,
storePrototypeNumber:v.storePrototypeNumber,
prototypeModel:v.prototypeModel || v.productType || '',
marketingName: v.marketingName || '',
productFamily: v.productFamily || v.productSeries || '',
industry:v.industry || '',
commercialChannelName:v.commercialChannelName || '',
commercialChannelId:v.commercialChannelId || '',
retailerChannelName:this.companyName,
retailerChannelCode:this.companyCode
};
}) || [],
};
businessSampleV1Push(params)
.then(res => {
if (res.code === '0') {
if (res.result.status == '1') {
this.submitForm = {
reason: '',
attachmentList: [],
type:'',
company:'',
store:''
};
this.companyName = '';
this.companyCode = '';
this.storeName = '';
this.storeCode = '';
this.propFileList = [];
this.$message.success(this.$PIX.I18n.get('pmall-incentive-prompt-success'));
this.resetPageData();
this.$emit('changeIsShowList',true);
} 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(res.result.msg);
}
}
} else {
this.$message.error(this.$PIX.I18n.get('pmall-china-message-actionFail'));
}
})
.catch(() => {
this.$message.error(this.$PIX.I18n.get('pmall-china-message-actionFail'));
});
} else {
return false;
}
});
},
saveApplication() {
this.$refs.submitForm?.validate(valid => {
if (valid) {
const flag = this.submitForm.attachmentList.some(v => !v.docId);
if (flag) return this.$message.warning(this.$t('pmall-upload-tips'));
if(this.mulitList3.length>0) {
this.submitDataList = this.mulitList3
}else {
this.submitDataList = this.totalTableDataList3
}
if (!this.submitDataList.length) {
return this.$message.warning(this.$t('pmall-delete-select-tips2'));
}
if (this.submitDataList?.length > 100) return this.$message.warning(this.$t('pmall-retail-special-tips3'));
const docs = this.submitForm.attachmentList?.map(v => {
return { id: v.docId, title: v.name,status:'success' };
}) || [];
const params = {
appNo: "",
// docName: docs && docs.length > 0 ? docs[0].title:'',
// docId:docs && docs.length > 0 ? docs[0].id:'',
docs,
reason: this.submitForm.reason || '',
businessType: 1,
snDetailList: this.submitDataList.map(v =>{
return {
sn: v.sn,
status: v.status,
productCode:v.productCode,
productName:v.productName,
storeCode:this.storeCode,
storeName:this.storeName,
storeType:this.storeType,
repOfficeCode:v.repOfficeCode || '',
repOffice:v.repOffice || '',
cityCode:v.cityCode || '',
cityName:v.cityName || '',
reportType: this.submitForm.type,
storePrototypeNumber:v.storePrototypeNumber,
prototypeModel:v.prototypeModel || v.productType || '',
marketingName: v.marketingName || '',
productFamily: v.productFamily || v.productSeries || '',
industry:v.industry || '',
commercialChannelName:v.commercialChannelName || '',
commercialChannelId:v.commercialChannelId || '',
retailerChannelName:this.companyName,
retailerChannelCode:this.companyCode
};
}) || [],
};
businessSampleV1Save(params)
.then(res => {
if (res.code === '0') {
this.$message.success(this.$PIX.I18n.get('pmall-china-message-saveSuccess'));
this.submitForm = {
reason: '',
attachmentList: [],
type:'',
company:'',
store:''
};
this.propFileList = [];
this.resetPageData();
this.$emit('changeIsShowList',true);
} else {
this.$message.error(this.$PIX.I18n.get('pmall-china-message-actionFail'));
}
})
.catch(() => {
this.$message.error(this.$PIX.I18n.get('pmall-china-message-actionFail'));
});
} else {
return false;
}
});
},
//上传文件前验证
uploadBefore(file) {
const size = file.size;
const fileName = file && file.name;
const nameArr = fileName && fileName.split('.');
if (nameArr && nameArr.length >= 1) {
const suffix = nameArr[nameArr.length - 1].toLowerCase();
const suffixArr = ['jpg', 'png', 'pdf', 'docx', 'zip'];
if (!suffixArr.includes(suffix)) {
this.$message.error(this.$t('pmall-activity-xlsXlsx'));
this.fileList = [];
return false;
}
}
if (size > 200 * 1024 * 1024) {
this.$message.error($PIX.I18n.get('pmall-common-message-uploadError1m'));
this.fileList = [];
return false;
}
},
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.submitForm.attachmentList = [...resList];
}
},
watch: {
"list": {
handler(val) {
if(val){
this.totalTableDataList = val;
this.tableDataList = this.totalTableDataList.slice(0,this.pageInfo.pageSize);
this.pageInfo.totalRowCount = this.totalTableDataList.length;
}
},
deep:true,
immediate:true
},
},
created() {
this.getCompanyList();
},
mounted() {
}
};
</script>
<style lang="scss" scoped>
.retail-demo-device-container {
overflow: hidden;
box-sizing: border-box;
width: 100%;
height: 100%;
& > .line {
width: 100%;
height: 10px;
background: #f1f1f1;
}
.detail {
width: 100%;
overflow: hidden;
box-sizing: border-box;
padding: 30px 20px;
.search {
width: 100%;
overflow: hidden;
box-sizing: border-box;
padding-bottom: 10px;
& > .header {
font-size: 16px;
color: #000;
font-weight: 700;
}
}
& > .line {
width: calc(100% + 40px);
height: 1px;
background: #e6e6e6;
position: relative;
right: 20px;
}
.table {
width: 100%;
overflow: hidden;
box-sizing: border-box;
margin-top: 30px;
position: relative;
.tabs {
width: 100%;
overflow: hidden;
box-sizing: border-box;
::v-deep .xui-loading-mask {
z-index: 899;
}
}
.right {
display: flex;
justify-content: space-between;
align-items: center;
height: 32px;
position: absolute;
right: 0;
top: 0;
.terminology {
font-size: 12px;
color: #4f8fd0;
cursor: pointer;
}
}
}
}
}
.isShow {
display: none;
}
.tipsContent {
font-size: 24px;
line-height: 0;
vertical-align: middle;
cursor: pointer;
color: #ed8b44;
}
::v-deep.noSpu.xui-select .xui-input__inner {
border-color: #e99fab;
}
::v-deep.xui-tabs {
.xui-tabs__nav-wrap {
&::after {
width: 20%;
}
.xui-tabs__nav-scroll {
margin: 0 !important;
.xui-tabs__item {
background: none;
}
}
}
}
::v-deep .input-style {
height: 34px !important;
border-radius: 0 !important;
}
::v-deep .xui-select__tags .xui-select-tags-inner {
padding-right: 20px;
}
::v-deep.xui-form-item {
&.company-name {
.xui-select-mutiple-clearable,
.xui-tag__close {
display: none;
}
}
&.store {
.xui-tag__text {
max-width: 120px !important;
}
}
.xui-form-item__content {
white-space: nowrap;
}
}
::v-deep.forbidDel i.xui-tag__close.far.fa-times {
display: none;
}
::v-deep.customerSelect .xui-select-mutiple-clearable {
display: none;
}
::v-deep.customerSelect.xui-select .xui-select__tags.xui-select--prefix {
padding-left: 0;
}
.titleSpan {
max-width: 265px;
display: inline-block;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
</style>
<style lang="scss">
.xui-select-dropdown.is-multiple {
&.industry {
max-width: 257px;
}
.xui-select-dropdown__item.selected {
color: #1d1e28;
}
}
.customerSelectPopper .xui-checkbox {
float: left;
}
.customerSelectPopper .xui-scrollbar__bar.is-horizontal.scrollbar-bar_show {
display: none;
}
.customerSelectPopper .xui-scrollbar .xui-scrollbar__bar.scrollbar-bar_show {
height: calc(100% - 42px);
}
.customerSelectPopper ul.xui-scrollbar__view.xui-select-dropdown__list {
position: inherit !important;
}
.customerSelectPopper.xui-select-dropdown .xui-tree {
padding-bottom: 42px;
}
.operate-manage__custom-tree {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 12px;
padding-right: 8px;
height: 100%;
width: 90%;
&-self {
display: inline-block;
width: 99.99%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.store-repair-play {
display: flex;
justify-content: space-between;
padding-bottom: 20px;
}
.store-repair-info-content {
flex: 1;
width: 593.75px;
font-size: 12px;
color: #000000;
text-align: left;
font-weight: 400;
}
.store-repair-info-no {
width: 134px;
text-align: right;
margin-right: 5px;
}
.store-repair-info-no {
font-size: 12px;
color: #7c7c7c;
text-align: right;
font-weight: 400;
}
.product-selection.xui-select .xui-select__tags.xui-select--prefix {
padding-left: 0;
}
.xui-select .all-box {
margin-top: 4px;
margin-left: -8px;
height: 24px;
line-height: 24px;
}
.xui-select .all-box .xui-tag {
height: 24px;
z-index: 9;
}
.xui-select .all-box .xui-tag .far.fa-times {
line-height: 23px;
}
.xui-select.selectAll .xui-tag.xui-tag--small {
display: none;
}
.xui-select.selectAll .all-box .xui-tag.xui-tag--small {
display: block;
}
.spu-tree-select .xui-scrollbar__bar.is-horizontal.scrollbar-bar_show {
display: none;
}
.spu-tree-select .xui-scrollbar .xui-scrollbar__bar.scrollbar-bar_show {
height: calc(100% - 42px);
}
.spu-tree-select ul.xui-scrollbar__view.xui-select-dropdown__list {
position: inherit !important;
}
.spu-tree-select.xui-select-dropdown .xui-tree {
padding-bottom: 42px;
}
.tree-all-select {
position: absolute;
width: 100%;
height: 40px;
line-height: 40px;
bottom: 0;
background: #fff;
z-index: 9;
padding: 0 21px;
border-top: 1px solid #e8e9e8;
color: #1d1e28;
}
.edm-upload-box {
width: 83%;
white-space: normal;
}
.edoc-upload-file-list {
width: 83%;
}
</style>
totalTableDataList3原来有storePrototypeNumber 属性,但是getNumber函数触发时要更新storePrototypeNumber 属性,并且更新页面上的数据,怎么处理
最新发布