This commit is contained in:
wtq
2026-01-21 16:29:04 +08:00
parent 6e0b72a1c8
commit 8405949822
8 changed files with 503 additions and 106 deletions

View File

@@ -72,15 +72,9 @@ export default {
try {
let res = await getMenu(this.userInfo.userID)
this.menu = res
let menu1 = this.menu.filter(
(item) => item.level === 1 && item.type === 0
)
let menu2 = this.menu.filter(
(item) => item.level === 2 && item.type === 0
)
let menu3 = this.menu.filter(
(item) => item.level === 3 && item.type === 0
)
let menu1 = this.menu.filter((item) => item.level === 1 && item.type === 0)
let menu2 = this.menu.filter((item) => item.level === 2 && item.type === 0)
let menu3 = this.menu.filter((item) => item.level === 3 && item.type === 0)
// let accoutShow=this.menu.filter(item => item.name === '结算权限' && item.type===1)
//this.$store.commit('SET_ACCOUNT',accoutShow.length>0) //结算是否显示
// menu2 = newMenu2
@@ -89,8 +83,7 @@ export default {
// .concat(newMenu2.slice(newMenu2.length - 1))
menu2 = newMenu2.concat(menu2)
menu3 = menu3.concat(newMenu3)
if (isGY)
menu2 = menu2.filter((item) => item.id !== 399 && item.id !== 99999) // 美团活动信息 和 版本控制
if (isGY) menu2 = menu2.filter((item) => item.id !== 399 && item.id !== 99999) // 美团活动信息 和 版本控制
// 老怪兽菜单接口模拟
menu1.forEach((item) => {
// 一级目录 6 商品管理
@@ -107,11 +100,11 @@ export default {
})
})
})
// menu1[4].children = menu1[4].children.slice(2,menu1[4].children.length-1)
// .concat(menu1[4].children.slice(0,2))
// menu1[4].children = menu1[4].children.slice(1,menu1[4].children.length-1)
// .concat(menu1[4].children.slice(0,1))
// .concat(menu1[4].children.slice(menu1[4].children.length-1))
menu1[4].children = menu1[4].children.slice(1,menu1[4].children.length-1)
.concat(menu1[4].children.slice(0,1))
menu1[4].children = menu1[4].children.slice(2,menu1[4].children.length-1)
.concat(menu1[4].children.slice(0,2))
.concat(menu1[4].children.slice(menu1[4].children.length-1))
this.NewMenu = menu1
} catch (error) {}

View File

@@ -188,21 +188,21 @@ export const newMenu2 = [
updatedAt: '2021-01-21T17:21:50+08:00',
url: '/settleStatic',
},
// {
// children: [],
// color: '',
// createdAt: '2021-01-21T17:21:47+08:00',
// deletedAt: '1970-01-01T00:00:00+08:00',
// id: 7845,
// imgURL: '',
// lastOperator: 'suyl',
// level: 2,
// name: '门店消息管理',
// parentID: 27,
// type: 0,
// updatedAt: '2021-01-21T17:21:50+08:00',
// url: '/storeMessage',
// }
{
children: [],
color: '',
createdAt: '2021-01-21T17:21:47+08:00',
deletedAt: '1970-01-01T00:00:00+08:00',
id: 7845,
imgURL: '',
lastOperator: 'suyl',
level: 2,
name: '门店聊天管理',
parentID: 27,
type: 0,
updatedAt: '2021-01-21T17:21:50+08:00',
url: '/storeMessage',
}
]

View File

@@ -54,6 +54,11 @@
<h4>
客户信息
<el-button v-if="order.vendorID === 5" size="mini" @click="openChangeOrderInfo" type="warning" >修改订单信息</el-button>
<!-- 目前仅支持美团 -->
<el-button @click="sendMessage" type="primary" size="mini" v-if="order.vendorID === 1">
<icon name="send-message" class="icon"></icon>
发消息
</el-button>
</h4>
<el-tag style="width: 166px; margin: 10px 0px" v-if="order.vendorID === 5 && order.orderType === -1" type="warning" >此订单定位上可能存在偏差</el-tag>
<div class="line2">
@@ -975,6 +980,15 @@ export default {
}
},
methods: {
// 发消息
sendMessage(){
if(this.order.vendorUserID.length === 0) return this.$toast('没有查询到用户数据')
let routeData = this.$router.resolve({
name: 'StoreMessage',
query: { storeID: this.order.jxStoreID, vendorUserID:this.order.vendorUserID,vendorID:this.order.vendorID,orderSeq:this.order.orderSeq },
})
window.open(routeData.href, '_blank')
},
// // 查看地图
// viewMap() {
// // this.riderInfo['path'] = []

View File

@@ -451,6 +451,7 @@ import syncMsg from "@/tools/syncMsg";
import { arr2excel } from "@/tools/excel2";
import { updatePriceCancelType3Promotions } from "@/apis/controls/promotion.js";
import { getMyStoreInfo } from '@/apis/store'
import { updateStoreSkus } from "@/apis/storeSku.js";
moment.locale("zh-cn");
export default {
name: "StoreGoodsCheck",
@@ -700,6 +701,21 @@ export default {
showLoad();
const auditPrice = Math.floor(value * 100);
const { storeID, nameID } = row;
// 修改可售参数
let skuName = await getStoreSku(storeID, nameID, true);
// console.log(row,'skuName,9999999999999',skuName.skus)
let skus = skuName.skus.map(sku => { return {
skuID:sku.id,
isSale:1
} })
let arr = [];
arr.push({
NameID:nameID,
skus
});
// 批转的参数
let payload = JSON.stringify([
{
storeID,
@@ -735,12 +751,30 @@ export default {
isContinueWhenError: false,
payload
});
this.$message({
message: "[改价] 成功",
type: "success",
center: true
});
this.getStoreCheckList();
updateStoreSkus(storeID, arr,(res) => {
if (res.code === "0") {
this.$message({
message: "[改价] 成功",
type: "success",
center: true
});
this.getStoreCheckList();
}else{
this.$message({
message: "[改价] 成功,可售失败",
type: "success",
center: true
});
this.getStoreCheckList();
}
})
// this.$message({
// message: "[改价] 成功",
// type: "success",
// center: true
// });
// this.getStoreCheckList();
});
hideLoad();
} else {
@@ -751,12 +785,30 @@ export default {
isContinueWhenError: false,
payload
});
this.$message({
message: "[改价] 成功",
type: "success",
center: true
});
this.getStoreCheckList();
updateStoreSkus(storeID, arr,(res) => {
if (res.code === "0") {
this.$message({
message: "[改价] 成功",
type: "success",
center: true
});
this.getStoreCheckList();
}else{
this.$message({
message: "[改价] 成功,可售失败",
type: "success",
center: true
});
this.getStoreCheckList();
}
})
// this.$message({
// message: "[改价] 成功",
// type: "success",
// center: true
// });
// this.getStoreCheckList();
}
} catch (e) {
msgWarning(e);
@@ -794,12 +846,17 @@ export default {
try {
showLoad();
const payload = [];
// const arr = []
this.selects.forEach(item => {
payload.push({
storeID: item.storeID,
nameID: item.nameID,
auditPrice: item.unitPrice
});
// arr.push({
// NameID:nameID,
// IsFocus: 1,
// })
});
const res = await storeSkuPriceAudit({
status: 2,
@@ -833,6 +890,25 @@ export default {
isContinueWhenError: true,
payload
});
// updateStoreSkus(storeID, arr,(res) => {
// if (res.code === "0") {
// this.$message({
// message: "[改价] 成功",
// type: "success",
// center: true
// });
// this.getStoreCheckList();
// }else{
// this.$message({
// message: "[改价] 成功,可售失败",
// type: "success",
// center: true
// });
// this.getStoreCheckList();
// }
// })
this.$message({
message: "操作成功",
type: "success",

View File

@@ -284,6 +284,7 @@
<el-button type="primary" size="mini" @click="submitForm('skuName')" style="width: 100px" :disabled="!searchForm.isFocus && searchForm.storeIDs.length > 1">查询</el-button>
<el-button type="primary" size="mini" @click="submitForm('sku')" style="width: 100px">按SKU查询</el-button>
<el-button type="success" size="mini" @click="exportExcel" style="width: 100px">导出excel</el-button>
<el-button type="success" size="mini" @click="dialogVisibleGoodsPrice = true" style="width: 130px">通过excel修改价格</el-button>
<!-- 检索按钮 -->
<!-- 是否修复破损图片 -->
@@ -942,6 +943,27 @@
</div>
</el-dialog>
<el-dialog title="批量修改价格" :visible.sync="dialogVisibleGoodsPrice" width="20%">
<div style="text-align: center;">
<el-button type="primary" @click="downloadTem">下载模板</el-button>
<div style="margin-top:20px">
<jx-upload-file
multiple
action=""
drag
:acceptType="'.xlsx'"
:showFileList="false"
v-model="priceTemData"
>
<div class="el-upload__text" >拖拽<em>excel</em>到此处,或点击选择文件上传</div>
</jx-upload-file>
</div>
</div>
<!-- <div slot="footer" style="margin-top: 20px;">
<el-button type="primary" @click="dialogVisibleGoodsPrice = false" >取消</el-button>
<el-button type="primary" @click="batchAddStock" >确定</el-button>
</div> -->
</el-dialog>
</div>
</template>
@@ -975,6 +997,7 @@ import $ajax from "axios";
import {APIGetJDUPC} from '@/apis/APISku.js'
import {getQiNiuToken} from '@/apis/qiniu.js'
import jxSelectPick from '@/components/cmp/selectPick'
import jxUploadFile from '@/components/cmp/uploadFile'
moment.locale("zh-cn");
/* eslint-disable */
export default {
@@ -985,6 +1008,7 @@ export default {
StoresPick,
DiaPriceFocusSale,
jxSelectPick,
jxUploadFile,
DiaSaleTime: () =>
import("@/components/storegoodsmanager/dialog/saleTime.vue"),
OperatorShow: () => import("@/components/commons/lastOperatorName.vue"),
@@ -1001,6 +1025,8 @@ export default {
},
data() {
return {
dialogVisibleGoodsPrice:false,
priceTemData:"",
storeForOperation: false,
brandID: null,
brandList: [],
@@ -1110,6 +1136,64 @@ export default {
btachRedioVendor:[]
};
},
watch:{
priceTemData:function(to) {
if(to.length === 0) return this.$toast('请上传门店商品数据')
console.log('to,,,上传的数据',to)
let storeID = +to[0]['门店ID']
let arr = []
to.forEach((item,index) => {
if(item['skuName新价格(单位:元)']){
console.log('item,999999999999',item)
arr.push({
nameID:+item['skuNameID'],
unitPrice:Math.round(Number(item['skuName新价格(单位:元)']) * 100)
})
// updateStoreSkus(
// item['门店ID'],
// arr,
// (res) => {
// if (res.code === "0") {
// // 成功
// this.$message({
// message: "修改价格成功",
// type: "success",
// center: true,
// });
// }
// // if (item.id) {
// // this.$refs[item.id] && this.$refs[item.id].doClose(); // 关闭
// // }
// this.getGoods();
// },
// { causeFlag: 16 }
// );
}
})
console.log(storeID,'item,999999999999,99999999**********',arr)
if(arr.length === 0) return this.$toast('没有修改任何商品价格')
updateStoreSkus(
storeID,
arr,
(res) => {
if (res.code === "0") {
// 成功
this.$message({
message: "批量改价格成功",
type: "success",
center: true,
});
}
this.dialogVisibleGoodsPrice = false
// if (item.id) {
// this.$refs[item.id] && this.$refs[item.id].doClose(); // 关闭
// }
this.getGoods();
},
{ causeFlag: 16 }
);
}
},
async created() {
// v2/sku/GetCategories
this.isModifyImg = false
@@ -1216,6 +1300,88 @@ export default {
},
},
methods: {
// exportExcelGetPrice
downloadTem(){
// this.dialogVisibleGoodsPrice = true
this.getGoods("all", (res) => {
let fileName = `门店商品信息-${new Date().toLocaleDateString()} ${new Date().getHours()}:${new Date().getMinutes()}:${new Date().getSeconds()}`;
// 处理数据
let excelData = [];
res.forEach((skuName) => {
// console.log('skuName',skuName)
let json = {};
json["门店名称"] = skuName.storeName;
json["门店ID"] = skuName.storeID;
// json["京西skuID"] = sku.id;
json["skuNameID"] = skuName.id;
json["商品名称"] = skuName.name;
// json["Upc"] = skuName.Upc;
json["全国中位价(单位:元)"] = (skuName.realMidUnitPrice / 100).toFixed(2) + '';
json["skuName价格(单位:元)"] =( skuName.unitPrice / 100).toFixed(2) + '';
json['skuName新价格(单位:元)'] = ""
// skuName.skus.forEach((sku) => {
// let catName = [];
// const catL2 = this.cats.find(
// (item) => item.id === skuName.categoryID
// );
// if (catL2) {
// catName.unshift(catL2.name);
// if (catL2.parentID) {
// const catL1 = this.cats.find(
// (item) => item.id === catL2.parentID
// );
// if (catL1) catName.unshift(catL1.name);
// }
// }
// let json = {};
// json["门店名称"] = skuName.storeName;
// json["门店ID"] = skuName.storeID;
// json["京西skuID"] = sku.id;
// json["skuNameID"] = sku.nameID;
// json["商品名称"] = skuName.name;
// // json["Upc"] = skuName.Upc;
// json["全国中位价(单位:元)"] = skuName.realMidUnitPrice / 100;
// json["skuName价格(单位:元)"] = skuName.unitPrice / 100;
// json['skuName新价格(单位:元)'] = ""
// // json["sku后缀名"] = sku.comment;
// // json["京西分类"] = catName.join(",");
// // json["淘宝闪购skuID"] = sku.ebaiID;
// // json["淘宝闪购同步状态"] = sku.ebaiSyncStatus;
// // json["京东skuID"] = sku.jdID;
// // json["京东同步状态"] = sku.jdSyncStatus;
// // json["美团skuID"] = sku.mtwmID;
// // json["美团同步状态"] = sku.mtwmSyncStatus;
// // // json["京狗skuID"] = sku.jdsID;
// // // json["京狗同步状态"] = sku.jdsSyncStatus;
// // json["商品规格"] = skuName.unit;
// // json["商品库存"] = sku.stock;
// // json["商品货架码"] = sku.locationCode && sku.locationCode !== 'EMPTY_VALUE' ? sku.locationCode : '';
// // json["价格(单位:分)"] = sku.price;
// // json["京西平台价(单位:分)"] = sku.jxPrice;
// // json["京东平台价(单位:分)"] = sku.jdPrice;
// // json["美团平台价(单位:分)"] = sku.mtwmPrice;
// // json["淘宝闪购平台价(单位:分)"] = sku.ebaiPrice;
// // json["抖店平台价(单位:分)"] = sku.ybPrice;
// // // json["京狗平台价(单位:分)"] = sku.jdsPrice;
// // json["规格数值"] = sku.specQuality;
// // json["规格单位"] = sku.specUnit;
// // json["门店可售状态"] = sku.storeSkuStatus ? "可售" : "不可售";
// // json["商品库可售状态"] = sku.status ? "可售" : "不可售";
// // json["最后操作时间"] = new Date(sku.updatedAt).toLocaleString();
// // json["最后操作人"] = sku.lastOperator;
// // json["京东同步标识"] = this.dealSyncStatus(sku.jdSyncStatus);
// // json["美团同步标识"] = this.dealSyncStatus(sku.mtwmSyncStatus);
// // json["淘宝闪购同步标识"] = this.dealSyncStatus(sku.ebaiSyncStatus);
// excelData.push(json);
// });
excelData.push(json);
});
json2Excel(excelData, fileName);
});
},
// 批量添加库存
async batchAddStock(){
// this.dialogVisible = true

View File

@@ -26,7 +26,7 @@
<div class="title">
<div class="title-left">{{storeID.id + '(' + storeID.name + ')'}}</div>
<div class="title-center">
<el-tooltip placement="left" effect="light">
<el-tooltip placement="left" effect="light" v-if="isCloudMt">
<div slot="content" class="mtIM">
<div class="mtIM-title">当前IM状态</div>
<div v-if="chatObj['mt'] && chatObj['mt'][0].imDetail[0].errMsg">未知状态</div>
@@ -41,8 +41,8 @@
color:chatObj['mt'][0].imDetail[0].imStatus? '':'#909399'
}">美团</div>
</el-tooltip>
<span v-if="chatObj['eb']">/</span>
<el-tooltip placement="right" effect="light" v-if="chatObj['eb']">
<span v-if="isCloudEb">/</span>
<el-tooltip placement="right" effect="light" v-if="isCloudEb">
<div slot="content" class="ebIM">
<div class="ebIM-title">当前IM状态</div>
<el-switch
@@ -56,6 +56,8 @@
color:chatObj['eb'][0].imDetail[0].imStatus? '':'#909399'
}">淘宝闪购</div>
</el-tooltip>
<span v-if="isCloudJd">/</span>
<div v-if="isCloudJd">京东</div>
<span>聊天</span>
</div>
<div class="title-right" @click="closeChat">
@@ -103,7 +105,7 @@
'margin':'20px',
'padding':'20px',
}">
<div >
<div>
<img :src="avatar(item)" mode="aspectFill" alt="" class="chatDetail-avatar" />
</div>
@@ -130,11 +132,15 @@
}">
<!-- 聊天内容 -->
<el-card
:body-style="{
padding:item.msg_type == 2 || item.msg_type == 12 ? '0': '20px'
}"
:style="{
'max-width':'500px',
'width':'fit-content',
'display':item.msg_type == 5 && item.msg_content?'':'flex',
'width':item.msg_type == 5 && item.msg_content?'400px':'',
'text-align':item.msg_type == 5 && item.msg_content ? 'left' : 'center'
}">
<!-- 文字 -->
@@ -158,6 +164,14 @@
<img slot="reference" :src="item.msg_content" alt="略缩图" style="width:100px;height:240px" />
</el-popover>
<!-- 视频 -->
<div v-else-if="item.msg_type == 6">
<video width="640" height="360" controls>
<source :src="item.msg_content" type="video/mp4">
<!-- 您的浏览器不支持视频标签 -->
</video>
</div>
<!-- 语音 -->
<div v-else-if="item.msg_type == 3 || item.msg_type == 13" class="voice" >
<audio id="myAudio" controls>
@@ -226,6 +240,7 @@ import {Decrypt,Encrypt,timeFormatDHM} from '@/tools/ase'
import {debounce,throttle} from '@/utils/underscore'
import { apiGetOrder} from '@/apis/controls/order'
import {APIGetStoresSkus} from '@/apis/APIstoreSku.js'
import api from '@/utils/api'
// import { msgInfo } from './mockData'
export default {
components:{
@@ -246,11 +261,51 @@ export default {
currentUser:{}, // 当前用户
isCloudMt:false,
isCloudEb:false,
isCloudJd:false,
userListParams:[],
userTimer:null,
detailTimer:null
detailTimer:null,
isGetDetail:false
}
},
async created(){
const query = this.$route.query
// console.log(query,'打印query信息')
if(query && JSON.stringify(query) !== '{}'){
let res = await api(`v2/store/GetStores?storeID=${query.storeID}`)
if(res && res.stores.length > 0){
// this.storeID()
this.storeID = res.stores[0]
// let venderID = +query.vendorID
this.currentUser = {
userID:query.vendorUserID,
vendorID:+query.vendorID,
}
await this.queryStoreIm() // 查询IM状态
// console.log('this.chatObj[mt]',this.chatObj)
this.isShowConnect = false
this.allUserList = [{
NewMessageNum:0,
userID:query.vendorUserID,
orderDesc:query.orderSeq ? ` #${query.orderSeq}` : '',
latestTime: timeFormatDHM(+new Date()),
vendorID: +query.vendorID,
isNewCreate:true
}]
this.userListParams = this.getUserDataInfo()
this.isloading = false
this.isGetDetail = false
// console.log(res.stores[0].StoreMaps,'this.userListParams',this.userListParams)
this.getChatUserList()
// console.log(query,'打印query信息',res.stores,'this.isShowConnect',this.isShowConnect,'this.chatObj',this.chatObj)
}
hideLoad()
}
},
computed:{
isDisabledEntry(){
let falg = this.storeID.length>=0?true:false
@@ -284,14 +339,16 @@ export default {
this.isloading = true
let mt = this.storeID.StoreMaps.filter(item => item.vendorID === 1)
let eb = this.storeID.StoreMaps.filter(item => item.vendorID === 3)
let jd = this.storeID.StoreMaps.filter(item => item.vendorID === 0)
// console.log('是否含有京东门店',jd)
// 查询该门店是否含有美团门店
if(mt.length!==0) this.isCloudMt = true
if(eb.length!==0) this.isCloudEb = true
if(jd.length!==0) this.isCloudJd = true
if(!this.isCloudMt && !this.isCloudMt) {
if(!this.isCloudMt && !this.isCloudMt && !this.isCloudJd) {
return this.$message({
message: `该门店未绑定美团/淘宝闪购`,
message: `该门店未绑定美团/淘宝闪购/京东`,
type: 'warning',
center: true,
})
@@ -314,16 +371,25 @@ export default {
async queryStoreIm(){
// 参数
let json = []
this.chatObj['mt'] = this.storeID.StoreMaps.filter(item => item.vendorID === 1)
this.chatObj['eb'] = this.storeID.StoreMaps.filter(item => item.vendorID === 3)
this.chatObj['jd'] = this.storeID.StoreMaps.filter(item => item.vendorID === 0)
if(this.chatObj['mt'] && this.chatObj['mt'].length>0) this.isCloudMt = true
if(this.chatObj['eb'] && this.chatObj['eb'].length>0) this.isCloudEb = true
if(this.chatObj['jd'] && this.chatObj['jd'].length>0) this.isCloudJd = true
console.log('饿百平台',this.chatObj['mt'],'饿呗',this.chatObj['eb'])
if(this.isCloudMt) {
this.chatObj['mt'] = this.storeID.StoreMaps.filter(item => item.vendorID === 1)
json.push({
vendorID:1,
vendorOrgCode:this.chatObj['mt'][0].vendorOrgCode + '',
vendorStoreID:this.chatObj['mt'][0].vendorStoreID + ''
})
}
if(this.isCloudEb) {
this.chatObj['eb'] = this.storeID.StoreMaps.filter(item => item.vendorID === 3)
json.push({
vendorID:3,
vendorOrgCode:this.chatObj['eb'][0].vendorOrgCode + '',
@@ -347,6 +413,7 @@ export default {
}
if(this.isCloudEb) this.chatObj['eb'][0].imDetail = imDetail.filter(item => item.vendorID===3)
// if(this.isCloudJd) this.chatObj['jd'][0].imDetail = imDetail.filter(item => item.vendorID===0)
},
// 设置门店IM单聊状态
async changeSwitch(e,platID){
@@ -365,30 +432,43 @@ export default {
await this.queryStoreIm()
this.$toast("修改成功");
},
// 获取用户列表参数信息
getUserDataInfo(){
let payLoad = []
let isQueryMt = this.isCloudMt ? this.chatObj['mt'] && this.chatObj['mt'][0].imDetail.length && !this.chatObj['mt'][0].imDetail[0].errMsg : false
let isQueryEb = this.isCloudEb ? this.chatObj['eb'] && this.chatObj['eb'][0].imDetail && this.chatObj['eb'][0].imDetail.length : false
if(isQueryMt){
payLoad.push({
vendorStoreID:"" + this.chatObj['mt'][0].vendorStoreID,
vendorID:"1",
appID:"" + this.chatObj['mt'][0].vendorOrgCode
})
}
if(isQueryEb){
payLoad.push({
vendorStoreID:"" + this.chatObj['eb'][0].vendorStoreID,
vendorID:"3",
appID:"" + this.chatObj['eb'][0].vendorOrgCode
})
}
if(this.isCloudJd){
payLoad.push({
vendorStoreID:"" + this.chatObj['jd'][0].vendorStoreID,
vendorID:"0",
appID:"" + this.chatObj['jd'][0].vendorOrgCode
})
}
return payLoad
},
// 获取聊天的用户列表
async getChatUserList(isloading){
// console.log('获取用户列表')
let payLoad = []
// let isGetDetail = false
if(this.userListParams.length === 0){
// console.log('获取聊天列表',this.chatObj)
let isQueryMt = this.chatObj['mt'] && this.chatObj['mt'][0].imDetail.length && !this.chatObj['mt'][0].imDetail[0].errMsg
let isQueryEb = this.chatObj['eb'] && this.chatObj['eb'][0].imDetail.length
if(isQueryMt){
payLoad.push({
vendorStoreID:"" + this.chatObj['mt'][0].vendorStoreID,
vendorID:"1",
appID:"" + this.chatObj['mt'][0].vendorOrgCode
})
}
if(isQueryEb){
payLoad.push({
vendorStoreID:"" + this.chatObj['eb'][0].vendorStoreID,
vendorID:"3",
appID:"" + this.chatObj['eb'][0].vendorOrgCode
})
}
this.isGetDetail = true
payLoad = this.getUserDataInfo()
if(payLoad.length === 0) return this.isloading = false
this.userListParams = payLoad
}else payLoad = this.userListParams
@@ -403,6 +483,7 @@ export default {
}
let fmtUserList = []
let febUserList = []
let fjdUserList = []
// 美团
if(this.isCloudMt){
fmtUserList = this.chatObj['mt'].length ? res[`${this.chatObj['mt'][0].vendorOrgCode}:${ this.chatObj['mt'][0].vendorStoreID}:1`] || [] : [] // 美团
@@ -414,15 +495,25 @@ export default {
febUserList = this.chatObj['eb'].length ? res[`${this.chatObj['eb'][0].vendorOrgCode}:${ this.chatObj['eb'][0].vendorStoreID}:3`] || [] : [] // 淘宝闪购
this.getEbUserList(febUserList)
}
this.isShowConnect = false
if(this.allUserList.length>0) {
if(this.isCloudJd){
fjdUserList = this.chatObj['jd'].length ? res[`${this.chatObj['jd'][0].vendorOrgCode}:${ this.chatObj['jd'][0].vendorStoreID}:0`] || [] : [] // 京东
this.getJDUserList(fjdUserList)
}
if(this.allUserList.length>0 && this.isGetDetail) {
// console.log(this.isGetDetail,'你进来几次了,获取聊天列表',this.allUserList)
this.isGetDetail = false
let findIndex = 0
if(JSON.stringify(this.currentUser) !== '{}') {
if(this.detailTimer) clearInterval(this.detailTimer)
findIndex = this.allUserList.findIndex((item) => item.userID === this.currentUser.userID)
}
this.queryDetailThrottle(this.allUserList[findIndex],isloading)
// this.queryDetailThrottle(this.allUserList[findIndex],isloading)
this.queryDetailBut(this.allUserList[findIndex])
}
// console.log('查询门店信息,,消息',this.allUserList)
this.isShowConnect = false
hideLoad()
},
// 获取淘宝闪购列表
@@ -432,25 +523,33 @@ export default {
let resData = JSON.parse(element)
let findIndex = this.allUserList.findIndex(item => item.payLoad.groupId === resData.payLoad.groupId)
if(findIndex === -1){
let latestMsgHandler = JSON.parse(resData.latestMsg).text ? JSON.parse(resData.latestMsg).text : JSON.parse(resData.latestMsg).duration ? '【语音】' : '【图片】'
// let isAddUserLiset = JSON.parse(resData.latestMsg).data && JSON.parse(JSON.parse(resData.latestMsg).data).title.includes('本次服务已经完成,会话暂停') ? false : true
if (JSON.parse(resData.latestMsg).elements && JSON.parse(resData.latestMsg).elements.length > 0) {
let findItem = JSON.parse(resData.latestMsg).elements.filter((item) => item.elementType === 1)
latestMsgHandler = findItem && findItem.length > 0 ? JSON.parse(findItem[0].elementContent).text.replace('@商家', '') : latestMsgHandler
}
//
// 淘宝闪购参考文档https://open-retail.ele.me/#/apidoc/me.ele.retail:im.message.send-3?aopApiCategory=IM_all&type=api_menu resData.userID != 0 && isAddUserLiset
let userList = {
let latestMsgHandler = resData.latestMsg
this.allUserList.push({
...resData,
latestMsg: latestMsgHandler,
latestTime: timeFormatDHM(+new Date(resData.latestTime * 1000)),
originTime:resData.latestTime,
latestTime: timeFormatDHM(+new Date(resData.latestTime )),
orderInfo: {},
orderDesc: ''
}
this.allUserList.push(userList)
if (userList.orderID) this.getOrderInfo(userList.orderID, this.allUserList.length - 1 ) // 获取订单信息
})
}
})
},
// 获取京东聊天列表
getJDUserList(reverseListJD){
reverseListJD.map((element) => {
let resData = JSON.parse(element)
let findIndex = this.allUserList.findIndex(item => item.payLoad.groupId === resData.payLoad.groupId)
if(findIndex === -1){
let latestMsgHandler = resData.latestMsg
this.allUserList.push({
...resData,
latestMsg: latestMsgHandler,
latestTime: timeFormatDHM(+new Date(resData.latestTime )),
orderInfo: {},
orderDesc: ''
})
}
})
},
@@ -460,10 +559,16 @@ export default {
this.allUserList[index].orderInfo = res.data[0]
this.allUserList[index].orderDesc = ` #${res.data[0].orderSeq}`
},
// 查询聊天详情按钮
// 查询聊天详情按钮 点击用户列表
queryDetailBut:debounce(
function name(query) {
// this.queryDetail(query)
if(this.detailTimer) clearInterval(this.detailTimer)
if(query.isNewCreate) {
this.chatDetail = []
this.currentUser = query
return
}
this.queryDetailThrottle(query)
this.detailTimer =setInterval(() => {
this.queryDetailThrottle(query,true)
@@ -479,7 +584,6 @@ export default {
),
// 查询聊天详情
async queryDetail(item,isloading = false){
// console.log('查看聊天详情,,,,99999',item)
if(!(this.currentUser.userID && this.currentUser.userID === item.userID)){
this.chatDetail = []
this.currentUser = item
@@ -596,6 +700,7 @@ export default {
this.allUserList = []
this.isCloudMt = false
this.isCloudEb = false
this.isCloudJd = false
clearInterval(this.userTimer) // 清除用户列表定时器
clearInterval(this.detailTimer) // 清除用户列表定时器
this.isShowConnect = true
@@ -629,9 +734,9 @@ export default {
let message = this.sendText.replace(/\n/g, '') // 发送的消息 除去回车字符
let data = {
sendType: this.currentUser.vendorID === 1 ? "mt" : "elm",
app_id: this.currentUser.vendorID === 1 ? this.chatObj['mt'][0].vendorOrgCode : this.chatObj['eb'][0].vendorOrgCode,
app_poi_code: this.currentUser.vendorID === 1 ? this.chatObj['mt'][0].vendorStoreID : this.chatObj['eb'][0].vendorStoreID,
sendType: this.currentUser.vendorID === 1 ? "mt" : this.currentUser.vendorID === 3 ? "elm" : 'jd',
app_id: this.currentUser.vendorID === 1 ? this.chatObj['mt'][0].vendorOrgCode : this.currentUser.vendorID === 3 ? this.chatObj['eb'][0].vendorOrgCode : this.chatObj['jd'][0].vendorOrgCode ,
app_poi_code: this.currentUser.vendorID === 1 ? this.chatObj['mt'][0].vendorStoreID : this.currentUser.vendorID === 3 ? this.chatObj['eb'][0].vendorStoreID : this.chatObj['jd'][0].vendorStoreID,
cts: Math.round(new Date().getTime() / 1000).toString(),
// msg_content: msgData.type === 1 ? analyEmoji(msgData.msg) : msgData.msg,
msg_content: message,
@@ -647,7 +752,7 @@ export default {
this.chatDetail.push({
...data
}) // 添加新消息
if(this.currentUser.isNewCreate) this.currentUser.isNewCreate = false // 更改初次创建信息,循环获取聊天详情
// 2、滚动到底部
let sendMsg = {} // 发生的消息结构体
@@ -670,7 +775,7 @@ export default {
}
})
}
} else {
} else if(this.currentUser.vendorID === 3){
let chatDataItem = this.chatDetail.filter(item => item.msg_source === 2)
sendMsg = {
platformShopId: chatDataItem[0].platformShopId,
@@ -701,11 +806,52 @@ export default {
data: { ...sendMsg }
})
}
}
}else if(this.currentUser.vendorID === 0){
// 目前只支持文本 图片未测试
let chatDataItem = this.chatDetail.filter(item => item.msg_source === 2)
sendMsg = {
vendorOrgCode: this.chatObj['jd'][0].vendorOrgCode,
sendData:JSON.stringify({
vendorID: 0,
storeId:this.chatObj['jd'][0].storeID,
data:{
id: '' + Math.round(new Date().getTime()).toString() + 184572 , // uuid //随机生成一个字符串
lang: "zh_CN",
type: "chat_message",
from: {
pin:chatDataItem[0].to.pin,
app:'im.waiter', // 固定不变
clientType:'android'
},
to: {
pin:chatDataItem.from.pin,
app:'im.customer', // 固定不变
},
body: {
type:msgData.type === 1 ? "text" : "image", // 消息类型
content:msgData.msg,
chatinfo:{
venderId:chatDataItem[0].body.chatinfo.venderId,
askAllocateType:chatDataItem[0].body.chatinfo.askAllocateType,
sid:chatDataItem[0].body.chatinfo.sid,
source:chatDataItem[0].body.chatinfo.source
},
template:{
source:'dd_msg_583984a984834b1889f853be6e449f39_e66c448b9fbe4704901925d3217081a3' // 文本固定不变 //卡片类消息必传
},
mt:60,
},
timestamp:new Date().getTime(), // 时间戳
clientTime:new Date().getTime() // 客户端时间
}
})
}
}
console.log(sendMsg,'发送消息,查看内容',message)
// sendToVendorV2(sendMsg)
sendToVendorV2(sendMsg)
// 发送成功
this.sendText = ''
},
// 美团用户列表 循环
mtUserList(userList,platformID){

View File

@@ -131,14 +131,14 @@ export default {
// value:to[0]["title"],
// children:[]
// }];
let payload = []
let mtId = '';
let brr = JSON.parse(JSON.stringify(to));
console.log('打印文件信息',to,'json序列化')
// let payload = []
// let mtId = '';
// let brr = JSON.parse(JSON.stringify(to));
// console.log('打印文件信息',to,'json序列化')
// return
to.forEach((item,index) => {
payload.push(item)
// console.log(index,'11111',item)
// payload.push(item)
console.log(index,'11111',item)
// if(item["title"]){
// mtId = item["title"]
// let findIndex = payload.findIndex(i => i.value === mtId)
@@ -179,7 +179,7 @@ export default {
// }
})
console.log('payload',payload,'json序列化',JSON.stringify(payload))
// console.log('payload',payload,'json序列化',JSON.stringify(payload))
// console.log('payload',payload,'json序列化')
return
@@ -250,8 +250,9 @@ export default {
json2Excel(json, "自定义样表");
},
mtFileChange(file, fileList) {
console.log('获取文件信息',file)
return
let excelDataNew = this.excelData.split(';')
// console.log('url',this.axiosUrl,'method',this.selectValue,'file',file,'参数列表',excelDataNew)
// return

1
src/svg/send-message.svg Normal file
View File

@@ -0,0 +1 @@
<svg t="1768805448154" class="icon" viewBox="0 0 1073 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6292" width="20" height="20"><path d="M1029.788579 276.216398C1002.471117 221.936282 963.446172 173.296778 913.824841 131.607708 812.770448 46.738783 678.716596 0 536.381569 0 394.046544 0 259.991454 46.740015 158.935818 131.608938 109.314489 173.299239 70.290784 221.937513 42.962162 276.217629 14.455474 332.817018 0 392.996264 0 455.07623 0 543.644421 29.968728 629.494482 86.659685 703.31362 138.093992 770.291883 209.069294 824.421812 292.667253 860.60199 295.972033 887.442291 287.570573 914.68268 267.564551 941.801194 255.838469 957.62125 254.147013 978.281745 263.13255 995.761242 272.097002 1013.160719 289.906861 1024 309.631386 1024 310.537877 1024 311.444365 1023.960608 312.370695 1023.921213 439.898068 1017.500123 538.071786 937.042005 567.989672 909.680976 701.883553 903.360831 826.671614 855.282681 920.554696 773.513509 1018.708573 688.033989 1072.761905 574.944773 1072.761905 455.076233 1072.761902 392.995033 1058.316349 332.817018 1029.788579 276.216398L1029.788579 276.216398ZM554.089745 849.000697 541.438569 849.340462 532.675006 858.360271C531.768517 859.279857 445.459773 946.559152 328.812759 961.119859 348.555883 928.620481 364.189423 883.320781 349.624822 830.641013L345.574761 816.011366 331.351179 810.34121C167.669617 745.032233 61.910403 605.572971 61.910403 455.074999 61.910403 237.86713 274.758185 61.15915 536.381569 61.15915 798.004955 61.15915 1010.851496 237.86713 1010.851496 455.074999 1010.851496 668.773181 810.232027 841.801591 554.089745 849.000697L554.089745 849.000697ZM803.987044 356.625274 352.644389 356.625274C335.540129 356.625274 321.679887 370.315637 321.679887 387.205466 321.679887 404.095293 335.540126 417.785656 352.644389 417.785656L803.987044 417.785656C821.070224 417.785656 834.931707 404.095293 834.931707 387.205466 834.931707 370.315637 821.071462 356.625274 803.987044 356.625274L803.987044 356.625274ZM623.715852 510.614467 352.644389 510.614467C335.540129 510.614467 321.679887 524.293749 321.679887 541.194657 321.679887 558.074639 335.540126 571.763771 352.644389 571.763771L623.715852 571.763771C640.820112 571.763771 654.681595 558.074639 654.681595 541.194657 654.681595 524.294983 640.820112 510.614467 623.715852 510.614467L623.715852 510.614467Z" fill="#ffffff" p-id="6293"></path></svg>

After

Width:  |  Height:  |  Size: 2.3 KiB