You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
478 lines
17 KiB
478 lines
17 KiB
10 months ago
|
define([
|
||
|
"kefu-assets/api/kefu",
|
||
|
'../remarks/index',
|
||
|
'../user-label/index',
|
||
|
'../user-group/index',
|
||
|
'kefu-assets/components/empty/index',
|
||
|
'dayjs',
|
||
|
'text!./index.html',
|
||
|
'css!./index.css'
|
||
|
], function (kefuApi, remarks, userLabel, userGroup, empty, dayjs, template) {
|
||
|
|
||
|
return {
|
||
|
template,
|
||
|
name: "rightMenu",
|
||
|
components: {
|
||
|
remarks,
|
||
|
userLabel,
|
||
|
userGroup,
|
||
|
empty,
|
||
|
},
|
||
|
props: {
|
||
|
isTourist: {
|
||
|
type: [String, Number],
|
||
|
default: 0,
|
||
|
},
|
||
|
status: {
|
||
|
type: [String, Number],
|
||
|
default: "",
|
||
|
},
|
||
|
//用户uid
|
||
|
uid: {
|
||
|
type: [String, Number],
|
||
|
default: "",
|
||
|
},
|
||
|
webType: {
|
||
|
type: [String, Number],
|
||
|
default: "",
|
||
|
},
|
||
|
},
|
||
|
filters: {
|
||
|
statusFilters: function (value) {
|
||
|
const statusMap = {
|
||
|
"-1": "申请退款",
|
||
|
"-2": "退货成功",
|
||
|
0: "待发货",
|
||
|
1: "待收货",
|
||
|
2: "已收货",
|
||
|
3: "待评价",
|
||
|
"-1": "已退款",
|
||
|
};
|
||
|
return statusMap[value];
|
||
|
},
|
||
|
getDay(val) {
|
||
|
if (val) {
|
||
|
return dayjs.unix(val).format("YYYY年M月D日");
|
||
|
}
|
||
|
},
|
||
|
typeFilters(value) {
|
||
|
const statusMap = {
|
||
|
h5: "H5",
|
||
|
wechat: "公众号",
|
||
|
routine: "小程序",
|
||
|
pc: "PC",
|
||
|
};
|
||
|
return statusMap[value];
|
||
|
},
|
||
|
},
|
||
|
data() {
|
||
|
|
||
|
const orderTypeList = [
|
||
|
{
|
||
|
id: 0,
|
||
|
title: "课程订单",
|
||
|
},
|
||
|
{
|
||
|
id: 2,
|
||
|
title: "商品订单",
|
||
|
},
|
||
|
{
|
||
|
id: 1,
|
||
|
title: "会员订单",
|
||
|
},
|
||
|
{
|
||
|
id: 4,
|
||
|
title: "报名订单",
|
||
|
},
|
||
|
{
|
||
|
id: 5,
|
||
|
title: "资料订单",
|
||
|
},
|
||
|
{
|
||
|
id: 6,
|
||
|
title: "考试订单",
|
||
|
},
|
||
|
{
|
||
|
id: 7,
|
||
|
title: "充值订单",
|
||
|
},
|
||
|
];
|
||
|
|
||
|
return {
|
||
|
userGroup: [],
|
||
|
userGroupSelect: [],
|
||
|
model1: "",
|
||
|
curMenuIndex: 0,
|
||
|
orderTypeList,
|
||
|
orderType: orderTypeList[0].id,
|
||
|
activeUserInfo: "", //用户详情
|
||
|
curStatus: this.status,
|
||
|
limit: 10,
|
||
|
orderConfig: {
|
||
|
page: 1,
|
||
|
type: orderTypeList[0].id,
|
||
|
searchTxt: "",
|
||
|
},
|
||
|
orderList: [],
|
||
|
isOrderScroll: true,
|
||
|
isOrderHidden: true,
|
||
|
isDelivery: false, // 发货弹窗
|
||
|
isRemarks: false, // 备注弹窗
|
||
|
isUserGroup: false, //分组弹窗
|
||
|
goodsTab: [
|
||
|
{
|
||
|
key: 0,
|
||
|
title: "购买",
|
||
|
},
|
||
|
{
|
||
|
key: 1,
|
||
|
title: "足迹",
|
||
|
},
|
||
|
{
|
||
|
key: 2,
|
||
|
title: "热销",
|
||
|
},
|
||
|
],
|
||
|
isGoodsScroll: true,
|
||
|
page: 1,
|
||
|
goodsConfig: {
|
||
|
type: 0,
|
||
|
buyList: [],
|
||
|
},
|
||
|
isUserLabel: false,
|
||
|
remarkId: "",
|
||
|
orderId: "",
|
||
|
storeName: "",
|
||
|
statusMap: {
|
||
|
"-1": "申请退款",
|
||
|
"-2": "退货成功",
|
||
|
"0": "待发货",
|
||
|
"1": "待收货",
|
||
|
"2": "待评价",
|
||
|
"3": "已完成"
|
||
|
},
|
||
|
remarkOrderType: "",
|
||
|
remarkOrderContent: ""
|
||
|
};
|
||
|
},
|
||
|
watch: {
|
||
|
uid(nVal, oVal) {
|
||
|
if (nVal != oVal && this.isTourist == 0 && nVal) {
|
||
|
this.orderConfig.page = 1;
|
||
|
this.isOrderScroll = true;
|
||
|
this.orderList = [];
|
||
|
this.page = 1;
|
||
|
this.isGoodsScroll = true;
|
||
|
this.goodsConfig.buyList = [];
|
||
|
Promise.all[
|
||
|
(this.getUserInfo(), this.getOrderList(), this.getUserGroup())
|
||
|
];
|
||
|
if (this.goodsConfig.type == 0) {
|
||
|
this.productCart();
|
||
|
} else if (this.goodsConfig.type == 1) {
|
||
|
this.productVisit();
|
||
|
} else {
|
||
|
this.productHot();
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
isTourist(nVal, oVal) {
|
||
|
if (nVal == 1) {
|
||
|
this.activeUserInfo = "";
|
||
|
this.orderList = [];
|
||
|
this.goodsConfig.buyList = [];
|
||
|
}
|
||
|
},
|
||
|
},
|
||
|
mounted() {
|
||
|
let self = this;
|
||
|
this.bus.$on("selectRightMenu", (arg) => {
|
||
|
this.curStatus = arg;
|
||
|
});
|
||
|
if (this.uid && this.isTourist == 0)
|
||
|
Promise.all[
|
||
|
(this.getUserInfo(),
|
||
|
this.getOrderList(),
|
||
|
// this.productCart(),
|
||
|
this.getUserGroup())
|
||
|
];
|
||
|
},
|
||
|
methods: {
|
||
|
//获取分组
|
||
|
getUserGroup() {
|
||
|
kefuApi.userGroupApi().then((res) => {
|
||
|
this.userGroup = res.data;
|
||
|
});
|
||
|
},
|
||
|
// 订单发货
|
||
|
openDelivery(item) {
|
||
|
this.orderId = item.id;
|
||
|
this.isDelivery = true;
|
||
|
},
|
||
|
// 订单发货成功
|
||
|
deliveryOk() {
|
||
|
this.orderConfig.page = 1;
|
||
|
this.isOrderScroll = true;
|
||
|
this.orderList = [];
|
||
|
this.getOrderList();
|
||
|
this.isDelivery = false;
|
||
|
},
|
||
|
// 订单备注
|
||
|
bindRemark(item) {
|
||
|
this.remarkId = item.order_id;
|
||
|
this.remarkOrderType = item.type;
|
||
|
this.remarkOrderContent = item.mark;
|
||
|
this.isRemarks = true;
|
||
|
},
|
||
|
remarkSuccess(mark) {
|
||
|
const order = this.orderList.find(i => i.order_id == this.remarkId);
|
||
|
if (order) {
|
||
|
order.mark = mark;
|
||
|
}
|
||
|
this.remarkId = "";
|
||
|
this.remarkOrderType = "";
|
||
|
this.remarkOrderContent = "";
|
||
|
this.isRemarks = false;
|
||
|
},
|
||
|
//获取左侧用户列表用户详情
|
||
|
getUserInfo() {
|
||
|
kefuApi.userInfo(this.uid)
|
||
|
.then((res) => {
|
||
|
this.activeUserInfo = res.data;
|
||
|
})
|
||
|
.catch((error) => {
|
||
|
this.activeUserInfo = "";
|
||
|
});
|
||
|
},
|
||
|
// 获取订单列表
|
||
|
getOrderList() {
|
||
|
if (!this.isOrderScroll) return;
|
||
|
const orderType = this.orderConfig.type;
|
||
|
kefuApi.getorderList({
|
||
|
uid: this.uid,
|
||
|
page: this.orderConfig.page,
|
||
|
limit: this.limit,
|
||
|
type: this.orderConfig.type,
|
||
|
search: this.orderConfig.searchTxt,
|
||
|
}).then((res) => {
|
||
|
this.orderConfig.page += 1;
|
||
|
this.isOrderScroll = res.data.length >= this.limit;
|
||
|
this.orderList = this.orderList.concat(res.data.map(order => {
|
||
|
if (orderType == 0) {
|
||
|
// 课程订单
|
||
|
order._info.cart_num = 1;
|
||
|
order.cartInfo = [
|
||
|
order._info
|
||
|
];
|
||
|
} else if (orderType == 2) {
|
||
|
// 商品订单
|
||
|
order.cartInfo = order._info.map(i => {
|
||
|
return {
|
||
|
cart_num: i.cart_info.cart_num,
|
||
|
id: i.cart_info.id,
|
||
|
image: i.cart_info.productInfo.image,
|
||
|
title: i.cart_info.productInfo.store_name,
|
||
|
money: i.cart_info.productInfo.price
|
||
|
};
|
||
|
});
|
||
|
} else if (orderType == 1) {
|
||
|
// 会员订单
|
||
|
order.cartInfo = [{
|
||
|
id: order._info.id,
|
||
|
image: order._info.img,
|
||
|
title: order._info.title,
|
||
|
money: order._info.price,
|
||
|
cart_num: 1
|
||
|
}];
|
||
|
} else if (orderType == 4) {
|
||
|
// 报名订单
|
||
|
order.pay_postage = "0.00";
|
||
|
order._info.id = 1;
|
||
|
order._info.money = order.pay_price;
|
||
|
order._info.cart_num = 1;
|
||
|
order.cartInfo = [
|
||
|
order._info
|
||
|
];
|
||
|
} else if (orderType == 5) {
|
||
|
// 资料订单
|
||
|
|
||
|
order.pay_postage = "0.00";
|
||
|
order._info.cart_num = 1;
|
||
|
order.cartInfo = [
|
||
|
order._info
|
||
|
];
|
||
|
} else if (orderType == 6) {
|
||
|
// 考试订单
|
||
|
order.pay_postage = "0.00";
|
||
|
order._info.cart_num = 1;
|
||
|
order.cartInfo = [
|
||
|
order._info
|
||
|
];
|
||
|
} else if (orderType == 7) {
|
||
|
order.pay_postage = "0.00";
|
||
|
order.pay_price = order.price;
|
||
|
order.cartInfo = [
|
||
|
{
|
||
|
id: 1,
|
||
|
image: "http://cremb-zsff.oss-cn-beijing.aliyuncs.com/61d9d202006181439471781.png",
|
||
|
title: "金币充值",
|
||
|
money: order.price,
|
||
|
cart_num: 1
|
||
|
}
|
||
|
];
|
||
|
}
|
||
|
|
||
|
|
||
|
return order;
|
||
|
}));
|
||
|
});
|
||
|
},
|
||
|
// 订单tab
|
||
|
handleOrderTypeChange(type) {
|
||
|
if (this.orderConfig.type === type) return;
|
||
|
this.orderConfig.type = type;
|
||
|
if (this.uid) {
|
||
|
this.orderConfig.page = 1;
|
||
|
this.isOrderScroll = true;
|
||
|
this.orderList = [];
|
||
|
this.getOrderList();
|
||
|
}
|
||
|
},
|
||
|
// 订单回车
|
||
|
orderSearch() {
|
||
|
this.isOrderScroll = true;
|
||
|
this.orderList = [];
|
||
|
this.orderConfig.page = 1;
|
||
|
this.getOrderList();
|
||
|
},
|
||
|
// 关闭发货模态框
|
||
|
deliveryClose() {
|
||
|
this.isUserLabel = false;
|
||
|
this.isDelivery = false;
|
||
|
this.isRemarks = false;
|
||
|
this.isUserGroup = false;
|
||
|
},
|
||
|
// 订单改价
|
||
|
orderEdit(id) {
|
||
|
this.$modalForm(orderEdit(id)).then(() => this.getOrderList());
|
||
|
},
|
||
|
// 订单退款
|
||
|
orderRecord(id) {
|
||
|
const order = this.orderList.find(i => i.id == id);
|
||
|
if (!order) return;
|
||
|
|
||
|
this.$Modal.confirm({
|
||
|
title: "确定要退款吗?",
|
||
|
onOk: () => {
|
||
|
kefuApi.requestRefundOrder(id, this.orderConfig.type)
|
||
|
.then(res => {
|
||
|
this.$Message.success(res.msg);
|
||
|
this.orderSearch();
|
||
|
})
|
||
|
.catch(err => {
|
||
|
this.$Message.error(err.msg);
|
||
|
});
|
||
|
}
|
||
|
})
|
||
|
},
|
||
|
// 订单加载更多
|
||
|
orderReachBottom() {
|
||
|
this.getOrderList();
|
||
|
},
|
||
|
// 商品加载更多
|
||
|
goodsReachBottom() {
|
||
|
if (this.goodsConfig.type == 0) {
|
||
|
this.productCart();
|
||
|
} else if (this.goodsConfig.type == 1) {
|
||
|
this.productVisit();
|
||
|
} else {
|
||
|
this.productHot();
|
||
|
}
|
||
|
},
|
||
|
// 商品信息tab
|
||
|
bindGoodsTab(item) {
|
||
|
if (this.goodsConfig.type == item.key) return;
|
||
|
this.goodsConfig.type = item.key;
|
||
|
this.page = 1;
|
||
|
this.isGoodsScroll = true;
|
||
|
this.goodsConfig.buyList = [];
|
||
|
if (item.key == 0) {
|
||
|
this.productCart();
|
||
|
} else if (item.key == 1) {
|
||
|
this.productVisit();
|
||
|
} else {
|
||
|
this.productHot();
|
||
|
}
|
||
|
},
|
||
|
// 商品购买记录
|
||
|
productCart() {
|
||
|
if (!this.isGoodsScroll) return;
|
||
|
kefuApi.productCart({
|
||
|
uid: this.uid,
|
||
|
store_name: this.storeName,
|
||
|
page: this.page,
|
||
|
limit: this.limit,
|
||
|
}).then((res) => {
|
||
|
this.page += 1;
|
||
|
this.isGoodsScroll = res.data.length >= this.limit;
|
||
|
this.goodsConfig.buyList = this.goodsConfig.buyList.concat(res.data);
|
||
|
});
|
||
|
},
|
||
|
// 商品足迹
|
||
|
productVisit() {
|
||
|
if (!this.isGoodsScroll) return;
|
||
|
productVisit(this.uid, {
|
||
|
store_name: this.storeName,
|
||
|
page: this.page,
|
||
|
limit: this.limit,
|
||
|
}).then((res) => {
|
||
|
this.page += 1;
|
||
|
this.isGoodsScroll = res.data.length >= this.limit;
|
||
|
this.goodsConfig.buyList = this.goodsConfig.buyList.concat(res.data);
|
||
|
});
|
||
|
},
|
||
|
// 热销商品
|
||
|
productHot() {
|
||
|
productHot(this.uid, {
|
||
|
store_name: this.storeName,
|
||
|
page: this.page,
|
||
|
limit: this.limit,
|
||
|
}).then((res) => {
|
||
|
this.page += 1;
|
||
|
this.isGoodsScroll = res.data.length >= this.limit;
|
||
|
this.goodsConfig.buyList = this.goodsConfig.buyList.concat(res.data);
|
||
|
});
|
||
|
},
|
||
|
// 修改用户标签
|
||
|
editLabel() {
|
||
|
this.isUserLabel = false;
|
||
|
this.getUserInfo();
|
||
|
},
|
||
|
editUserGroup(id) {
|
||
|
this.isUserGroup = false;
|
||
|
kefuApi.putGroupApi(this.uid, id).then((res) => {
|
||
|
this.$Message.success(res.msg);
|
||
|
this.getUserInfo();
|
||
|
});
|
||
|
},
|
||
|
// 商品推送
|
||
|
pushGoods(item) {
|
||
|
this.$emit("bind-push", item.id);
|
||
|
},
|
||
|
// 商品搜索
|
||
|
productSearch() {
|
||
|
this.page = 1;
|
||
|
this.isGoodsScroll = true;
|
||
|
this.goodsConfig.buyList = [];
|
||
|
if (this.goodsConfig.type == 0) {
|
||
|
this.productCart();
|
||
|
} else if (this.goodsConfig.type == 1) {
|
||
|
this.productVisit();
|
||
|
} else {
|
||
|
this.productHot();
|
||
|
}
|
||
|
},
|
||
|
},
|
||
|
};
|
||
|
|
||
|
});
|