Compare commits
15 Commits
f6e4562ce2
...
zmr
| Author | SHA1 | Date | |
|---|---|---|---|
| c1a3a11781 | |||
|
|
80e3a721a1 | ||
|
|
31474f482f | ||
|
|
df1bad0a31 | ||
| ec2bbcdc29 | |||
| e9f0b1ba78 | |||
|
|
61756ac875 | ||
| c5e16abbc2 | |||
|
2d7ed292c0
|
|||
|
30451e2767
|
|||
| cde4e7db87 | |||
| 59df1ed10f | |||
|
385653d391
|
|||
|
|
3e45c9350a | ||
| 2ed7b6798b |
@@ -4,12 +4,14 @@
|
||||
const install = (Vue, vm) => {
|
||||
// 此处没有使用传入的params参数
|
||||
let api = {
|
||||
// 获取标签
|
||||
getLiveSpec(){
|
||||
return vm.$u.get("Streaming/getLiveSpec")
|
||||
},
|
||||
login({member_name,member_password}){
|
||||
return vm.$u.get("/Login/expertLogin",{member_name,member_password})
|
||||
},
|
||||
// 创建标签
|
||||
createLivesp({spec_name}){
|
||||
return vm.$u.post("Streaming/createLivesp",{spec_name})
|
||||
},
|
||||
@@ -95,6 +97,44 @@ const install = (Vue, vm) => {
|
||||
canselectgood(){
|
||||
return vm.$u.post("/article/getStoreGoodsList")
|
||||
},
|
||||
// 发布图文
|
||||
publishphoto({article_title,article_content,article_pic,file_id,goods_id_arr,label_arr}){
|
||||
return vm.$u.post("/article/publishImage",{article_title,article_content,article_pic,file_id,goods_id_arr,label_arr})
|
||||
},
|
||||
// 发布视频
|
||||
publishvideo({article_title,article_content,article_pic,video_path,goods_id_arr,label_arr}){
|
||||
return vm.$u.post("/article/publishVideo",{article_title,article_content,article_pic,video_path,goods_id_arr,label_arr})
|
||||
},
|
||||
// 订单详情
|
||||
orderdetail({order_id}){
|
||||
return vm.$u.post("/Order/orderInfo",{order_id})
|
||||
},
|
||||
// 试穿订单详情
|
||||
testorderdetail({goods_try_id}){
|
||||
return vm.$u.post("/order/goodsTryOrderInfo",{goods_try_id})
|
||||
},
|
||||
// 绑定物流订单
|
||||
bindpushid({order_id,shipping_code,shipping_express_id}){
|
||||
return vm.$u.post("/order/send",{order_id,shipping_code,shipping_express_id})
|
||||
},
|
||||
// 绑定骑手
|
||||
bindcarer({order_id,takeawayer_id}){
|
||||
return vm.$u.post("/order/orderRider",{order_id,takeawayer_id})
|
||||
},
|
||||
// 发货物流公司
|
||||
pushcompany(){
|
||||
return vm.$u.post("/order/getExpress")
|
||||
},
|
||||
// 退款退货
|
||||
refund({refund_id,seller_state,seller_message}){
|
||||
return vm.$u.post("/order/editRefund",{refund_id,seller_state,seller_message})
|
||||
},
|
||||
// 试穿
|
||||
agreetest({goods_try_id,type,takeawayer_id}){
|
||||
return vm.$u.post("/order/goodsTryAgree",{goods_try_id,type,takeawayer_id})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
|
||||
vm.$u.api = api;
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
<view class="">
|
||||
编号:{{info.order_sn}}
|
||||
</view>
|
||||
<!-- 1待处理 2已发货 3已完成 4申请退款 5已退款 -->
|
||||
<!-- 1待处理 2已发货 3已完成 4申请退款 5已退款 6拒绝退款 -->
|
||||
<view class="status" v-if="info.view_type==1">待处理订单</view>
|
||||
<view class="status" v-else-if="info.view_type==2">已发货订单</view>
|
||||
<view class="status" v-else-if="info.view_type==3">已完成订单</view>
|
||||
<view class="status" v-else-if="info.view_type==4">申请退款订单</view>
|
||||
<view class="status" v-else-if="info.view_type==5">已退款订单</view>
|
||||
<view class="status" v-else-if="info.view_type==6">拒绝退款订单</view>
|
||||
</view>
|
||||
|
||||
<view class="name u-line-1">{{info.extend_order_goods[0].goods_name}}</view>
|
||||
<view class="info">
|
||||
<view class="num">共{{info.extend_order_goods[0].goods_num}}件商品</view>
|
||||
@@ -34,7 +34,7 @@ export default {
|
||||
methods: {
|
||||
toDetailsPage() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/index/details?id=' + this.info.order_id
|
||||
url: '/pages/index/details?id=' + this.info.order_id+"&type="+this.info.view_type
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
@@ -29,8 +29,19 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
toDetailsPage() {
|
||||
let type =0
|
||||
let info = this.info
|
||||
if(info.goods_try_order_status==0){
|
||||
type=1
|
||||
}else if(info.goods_try_order_status==20){
|
||||
type=2
|
||||
}else if(info.goods_try_order_status==40){
|
||||
type=3
|
||||
}else if(info.goods_try_order_status==50){
|
||||
type=4
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: '/pages/index/details?id=' + this.info.order_id
|
||||
url: '/pages/index/otherdetails?id=' + this.info.goods_try_id+"&type="+type
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
11
pages.json
11
pages.json
@@ -59,6 +59,17 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/otherdetails",
|
||||
"style": {
|
||||
"navigationBarTitleText": "试穿订单详情",
|
||||
"app-plus": {
|
||||
"titleNView": {
|
||||
"titleColor": "#333333"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/release/video",
|
||||
|
||||
@@ -1,62 +1,70 @@
|
||||
<template>
|
||||
<view class="details">
|
||||
<view class="goods-info">
|
||||
<image></image>
|
||||
<image :src="info.extend_order_goods[0].goods_image"></image>
|
||||
<view class="info-right">
|
||||
<view class="name u-line-1">心机小黑裙连衣裙赫本风夏季爆款...</view>
|
||||
<view class="name u-line-1">{{ info.extend_order_goods[0].goods_name }}</view>
|
||||
<view class="info">
|
||||
<view class="num">共一件商品</view>
|
||||
<view class="price">实付<span>¥199.9</span></view>
|
||||
<view class="num">共{{ info.extend_order_goods[0].goods_num }}件商品</view>
|
||||
<view class="price">
|
||||
实付
|
||||
<span>¥{{ info.extend_order_goods[0].goods_pay_price }}</span>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="refunds-user" v-if="status==4 || status==5">
|
||||
<view class="refunds-user" v-if="type == 2 || type == 3 || type == 4 || type == 5 || type == 6">
|
||||
<view>
|
||||
<image src="/static/image/home/2.png"></image>
|
||||
<view>李先生</view>
|
||||
<view>{{ info.extend_order_common.reciver_name }}</view>
|
||||
</view>
|
||||
<view>
|
||||
<image src="/static/image/home/3.png"></image>
|
||||
<view>123456789</view>
|
||||
<view>{{ info.extend_order_common.reciver_info.mob_phone }}</view>
|
||||
</view>
|
||||
<view>
|
||||
<image src="/static/image/home/4.png"></image>
|
||||
<view class="address u-line-1">山东省临沂市兰山区XX路XX小区XX楼xx单元</view>
|
||||
<view class="address u-line-1">{{ info.extend_order_common.reciver_info.address }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="user-info" v-if="status == 1 || status == 2">
|
||||
<view class="user-info" v-if="type == 1">
|
||||
<view class="info-title">收件人信息</view>
|
||||
<view class="info-container">
|
||||
<view>
|
||||
<view class="title">姓名</view>
|
||||
<view class="value">李先生</view>
|
||||
<view class="value">{{ info.extend_order_common.reciver_name }}</view>
|
||||
</view>
|
||||
<view>
|
||||
<view class="title">手机号</view>
|
||||
<view class="value">123456789</view>
|
||||
<view class="value">{{ info.extend_order_common.reciver_info.mob_phone }}</view>
|
||||
</view>
|
||||
<view>
|
||||
<view class="title">收货地址</view>
|
||||
<view class="value u-line-1">山东省临沂市兰山区XX路XX小区XX楼xx单元</view>
|
||||
<view class="value u-line-1">{{ info.extend_order_common.reciver_info.address }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="delivery" v-if="status == 1 || status == 2">
|
||||
<view class="delivery" v-if="type == 1">
|
||||
<view class="title">派送方式</view>
|
||||
<view class="methods" v-if="status == 1">
|
||||
<view :class="{active: cur==0}" @click="cur=0">人工送达</view>
|
||||
<view :class="{active: cur==1}" @click="cur=1;showDelivery=true">指派外部骑手</view>
|
||||
<view class="methods">
|
||||
<view :class="{ active: cur == 0 }" @click="pushstyleA">快递</view>
|
||||
<view :class="{ active: cur == 1 }" @click="pushstyleB">骑手</view>
|
||||
</view>
|
||||
<view class="methods" v-if="status == 2">
|
||||
<view :class="{active: cur==0}" @click="cur=0;showExpress=true">快递</view>
|
||||
<view :class="{active: cur==1}" @click="cur=1;showDelivery=true">骑手</view>
|
||||
<view class="btn" @click="confirmpushstyle">确认</view>
|
||||
</view>
|
||||
<view class="pushtimeline" v-if="type == 2">
|
||||
<view class="timelinetitle">物流信息</view>
|
||||
<view class="timelineid">订单单号:{{ info.order_sn }}</view>
|
||||
<view class="timelinebox" v-for="list in info.express_list">
|
||||
<view class="timelinecontent">{{list.content}}</view>
|
||||
<view class="timelinetime">{{list.kd_time}}</view>
|
||||
</view>
|
||||
<view class="btn">确认</view>
|
||||
</view>
|
||||
<view class="refunds-option" v-if="status==5">
|
||||
<view :class="{active: cur==0}" @click="cur=0;showRefunds=true">不处理</view>
|
||||
<view :class="{active: cur==1}" @click="cur=1;showRefunds=true">确定处理</view>
|
||||
<view class="refunds-option" v-if="type == 4">
|
||||
<view :class="{ active: cur == 0 }" @click="unrefuse">不处理</view>
|
||||
<view :class="{ active: cur == 1 }" @click="refuse">确定处理</view>
|
||||
</view>
|
||||
<view class="refund" v-if="type == 5 || type == 6">退款状态:{{ type == 5 ? '同意退款,请注意查收' : '拒绝退款,请等待客服联系' }}</view>
|
||||
<u-popup v-model="showDelivery" mode="center" border-radius="10" class="delivery-popup">
|
||||
<view class="title">骑手信息</view>
|
||||
<view class="input-info">
|
||||
@@ -64,21 +72,39 @@
|
||||
<input type="text" placeholder="请输入您的手机号" v-model="phone" />
|
||||
<input type="text" placeholder="请输入您的公司名称" v-model="company" />
|
||||
</view>
|
||||
<view class="btn">确认</view>
|
||||
<view class="btn" @click="showDelivery = false">确认</view>
|
||||
</u-popup>
|
||||
<u-picker mode="selector" v-model="show" :default-selector="[0]" :range="list" range-key="content" @confirm="getselect"></u-picker>
|
||||
<!-- companylist -->
|
||||
<u-picker
|
||||
mode="selector"
|
||||
v-model="showcompany"
|
||||
:default-selector="[0]"
|
||||
:range="companylist"
|
||||
range-key="express_name"
|
||||
@confirm="getselectcompany"
|
||||
title="请选择公司"
|
||||
confirm-text="下一步"
|
||||
></u-picker>
|
||||
<u-popup v-model="showExpress" mode="center" border-radius="10" class="delivery-popup">
|
||||
<view class="title">填写快递单号</view>
|
||||
<view class="input-info">
|
||||
<input type="text" placeholder="请输入快递单号" v-model="express" />
|
||||
</view>
|
||||
<view class="btn">确认</view>
|
||||
<view class="input-info"><input type="text" placeholder="请输入快递单号" v-model="pushid" /></view>
|
||||
<view class="btn" @click="showExpress = false">确认</view>
|
||||
</u-popup>
|
||||
<u-popup v-model="showRefunds" mode="center" border-radius="10" class="refunds-popup">
|
||||
<view v-if="cur==1" class="popup-tips">确定处理<br />平台将进行退款</view>
|
||||
<view v-if="cur==0" class="popup-tips">确定不处理<br />平台将进行联系</view>
|
||||
<view v-if="cur == 1" class="popup-tips">
|
||||
确定处理
|
||||
<br />
|
||||
平台将进行退款
|
||||
</view>
|
||||
<view v-if="cur == 0" class="popup-tips">
|
||||
确定不处理
|
||||
<br />
|
||||
平台将进行联系
|
||||
</view>
|
||||
<view class="popup-btn">
|
||||
<view class="cancel" @click="showRefunds=false">取消</view>
|
||||
<view class="determine">确定</view>
|
||||
<view class="cancel" @click="cancel">取消</view>
|
||||
<view class="determine" @click="confirm">确定</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
<u-toast ref="uToast" />
|
||||
@@ -88,22 +114,230 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
status: Number, // 订单状态
|
||||
status: 1, // 订单状态
|
||||
cur: Number,
|
||||
showDelivery: false, // 填写骑手信息
|
||||
showExpress: false, // 填写快递单号
|
||||
showRefunds: false, // 平台退货处理
|
||||
showcompany: false, // 平台退货处理
|
||||
companylist: [],
|
||||
show: false, // 骑手列表
|
||||
name: '',
|
||||
phone: '',
|
||||
company: '',
|
||||
express: ''
|
||||
}
|
||||
express: '',
|
||||
type: '',
|
||||
orderid: 0,
|
||||
info: {},
|
||||
list: [],
|
||||
pushid: null,
|
||||
pushstate: false, //显示物流单号
|
||||
selctcar: null, //骑手信息
|
||||
companyidA: null, //物流派送公司id
|
||||
companyidB: null //骑手派送公司id
|
||||
};
|
||||
},
|
||||
onLoad(option) {
|
||||
this.status = option.current;
|
||||
this.type = option.type;
|
||||
this.orderid = option.id;
|
||||
this.resetinfo();
|
||||
if (this.type == 1) {
|
||||
this.getcompanyinfo();
|
||||
}
|
||||
if (this.type == 2) {
|
||||
this.getcarinfo();
|
||||
}
|
||||
|
||||
// 订单状态: 0:全部 1已付款未发货 2已发货 3已完成 4申请退款/退货 5已退款/退货 6拒绝退款/退货
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
// 人工配送
|
||||
pushstyleA() {
|
||||
this.cur = 0;
|
||||
this.showcompany = true;
|
||||
},
|
||||
// 选择骑手
|
||||
pushstyleB() {
|
||||
this.cur = 1;
|
||||
this.show = true;
|
||||
},
|
||||
// 获取物流公司列表
|
||||
getcompanyinfo() {
|
||||
let that = this;
|
||||
this.$u.api.pushcompany({}).then(res => {
|
||||
if (res.errCode != 0) {
|
||||
} else {
|
||||
that.companylist = res.data;
|
||||
}
|
||||
});
|
||||
},
|
||||
// 取消退款
|
||||
cancel() {
|
||||
this.showRefunds = false;
|
||||
// cur
|
||||
},
|
||||
//
|
||||
confirm() {
|
||||
this.showRefunds = false;
|
||||
if (this.cur == 0) {
|
||||
// 确定退款
|
||||
return;
|
||||
this.$u.api.refund({
|
||||
refund_id: this.orderid,
|
||||
seller_state:2,
|
||||
seller_message:""
|
||||
}).then(res => {
|
||||
if (res.errCode != 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'success'
|
||||
});
|
||||
console.log(res);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// 不进行退款
|
||||
return;
|
||||
this.$u.api.refund({
|
||||
refund_id: this.orderid,
|
||||
seller_state:3,
|
||||
seller_message:""
|
||||
}).then(res => {
|
||||
if (res.errCode != 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'success'
|
||||
});
|
||||
console.log(res);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
// 同意退款
|
||||
refuse() {
|
||||
this.cur = 1;
|
||||
this.showRefunds = true;
|
||||
},
|
||||
// 同意退款
|
||||
unrefuse() {
|
||||
this.cur = 0;
|
||||
this.showRefunds = true;
|
||||
},
|
||||
// 获取物流信息
|
||||
getcarinfo() {
|
||||
this.$u.api.getpushinfo({
|
||||
order_id: this.orderid
|
||||
}).then(res => {
|
||||
if (res.errCode != 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'success'
|
||||
});
|
||||
console.log(res);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 选择快递公司
|
||||
getselectcompany(e) {
|
||||
let obj = this.companylist[e[0]];
|
||||
this.companyidA = obj.express_id;
|
||||
this.showExpress = true;
|
||||
},
|
||||
// 绑定配送方式
|
||||
confirmpushstyle() {
|
||||
if (this.cur == 0) {
|
||||
console.log(this.pushid);
|
||||
this.$u.api.bindpushid({
|
||||
order_id: this.orderid,
|
||||
shipping_code: this.pushid,
|
||||
shipping_express_id: this.companyidA
|
||||
}).then(res => {
|
||||
if (res.errCode != 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'success'
|
||||
});
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$u.api.bindcarer({
|
||||
order_id: this.orderid,
|
||||
takeawayer_id: this.selctcar.takeawayer_id
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
if (res.errCode != 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'success'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
// 选择骑手
|
||||
getselect(e) {
|
||||
this.selctcar = this.list[e[0]];
|
||||
},
|
||||
// 获取订单信息
|
||||
resetinfo() {
|
||||
this.$u.api.orderdetail({
|
||||
order_id: this.orderid
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
if (res.errCode != 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
this.info = res.data;
|
||||
}
|
||||
});
|
||||
this.$u.api.takeawayerlist({}).then(res => {
|
||||
console.log(res);
|
||||
if (res.errCode != 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
let arr = res.data;
|
||||
for (let index in arr) {
|
||||
arr[index].content = arr[index].company_name + '——' + arr[index].contacts + '——' + arr[index].contact_number;
|
||||
}
|
||||
this.list = arr;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@@ -111,9 +345,9 @@ export default {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: calc(100vh - var(--window-top));
|
||||
background-color: #ECECEC;
|
||||
background-color: #ececec;
|
||||
.goods-info {
|
||||
background-color: #FFFFFF;
|
||||
background-color: #ffffff;
|
||||
padding: 30rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -124,13 +358,12 @@ export default {
|
||||
border-radius: 10rpx;
|
||||
flex-shrink: 0;
|
||||
margin-right: 26rpx;
|
||||
background-color: aqua;
|
||||
}
|
||||
.info-right {
|
||||
.name {
|
||||
width: 439rpx;
|
||||
font-size: 28rpx;
|
||||
color: rgba(51,51,51,1);
|
||||
color: rgba(51, 51, 51, 1);
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
.info {
|
||||
@@ -138,19 +371,19 @@ export default {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 26rpx;
|
||||
color: rgba(102,102,102,1);
|
||||
color: rgba(102, 102, 102, 1);
|
||||
.price {
|
||||
margin-left: 10rpx;
|
||||
> span {
|
||||
color: #FF780F;
|
||||
color: #ff780f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.refunds-user {
|
||||
padding: 25rpx 30rpx;
|
||||
background-color: #FFFFFF;
|
||||
background-color: #ffffff;
|
||||
margin-bottom: 20rpx;
|
||||
> view {
|
||||
display: flex;
|
||||
@@ -177,7 +410,7 @@ export default {
|
||||
}
|
||||
> view {
|
||||
font-size: 26rpx;
|
||||
color: rgba(51,51,51,1);
|
||||
color: rgba(51, 51, 51, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -185,23 +418,23 @@ export default {
|
||||
.info-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
color: rgba(51,51,51,1);
|
||||
color: rgba(51, 51, 51, 1);
|
||||
height: 88rpx;
|
||||
background-color: #FFFFFF;
|
||||
background-color: #ffffff;
|
||||
margin-bottom: 2rpx;
|
||||
padding: 30rpx;
|
||||
}
|
||||
.info-container {
|
||||
padding: 0 30rpx;
|
||||
background-color: #FFFFFF;
|
||||
background-color: #ffffff;
|
||||
margin-bottom: 20rpx;
|
||||
> view {
|
||||
height: 88rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: rgba(51,51,51,1);
|
||||
color: rgba(51, 51, 51, 1);
|
||||
&:not(:last-child) {
|
||||
border-bottom: 2rpx solid #ECECEC;
|
||||
border-bottom: 2rpx solid #ececec;
|
||||
}
|
||||
.title {
|
||||
width: 150rpx;
|
||||
@@ -216,13 +449,13 @@ export default {
|
||||
}
|
||||
.delivery {
|
||||
flex: 1;
|
||||
background-color: #FFFFFF;
|
||||
background-color: #ffffff;
|
||||
padding: 30rpx;
|
||||
position: relative;
|
||||
.title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
color: rgba(51,51,51,1);
|
||||
color: rgba(51, 51, 51, 1);
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
.methods {
|
||||
@@ -230,11 +463,11 @@ export default {
|
||||
flex-wrap: wrap;
|
||||
> view {
|
||||
font-size: 30rpx;
|
||||
color: rgba(0,0,51,1);
|
||||
color: rgba(0, 0, 51, 1);
|
||||
width: 335rpx;
|
||||
height: 80rpx;
|
||||
border: 1rpx solid rgba(236,236,236,1);
|
||||
background: rgba(236,236,236,1);
|
||||
border: 1rpx solid rgba(236, 236, 236, 1);
|
||||
background: rgba(236, 236, 236, 1);
|
||||
border-radius: 6rpx;
|
||||
text-align: center;
|
||||
line-height: 80rpx;
|
||||
@@ -244,9 +477,9 @@ export default {
|
||||
}
|
||||
}
|
||||
.active {
|
||||
border: 1rpx solid #FF780F;
|
||||
color: #FF780F;
|
||||
background: #FFF1E6;
|
||||
border: 1rpx solid #ff780f;
|
||||
color: #ff780f;
|
||||
background: #fff1e6;
|
||||
}
|
||||
}
|
||||
.btn {
|
||||
@@ -256,35 +489,74 @@ export default {
|
||||
transform: translate(-50%, 0);
|
||||
width: 690rpx;
|
||||
height: 98rpx;
|
||||
background: rgba(255,120,15,1);
|
||||
background: rgba(255, 120, 15, 1);
|
||||
border-radius: 49rpx;
|
||||
font-size: 36rpx;
|
||||
color: rgba(255,255,255,1);
|
||||
color: rgba(255, 255, 255, 1);
|
||||
text-align: center;
|
||||
line-height: 98rpx;
|
||||
}
|
||||
}
|
||||
.pushtimeline {
|
||||
width: 100%;
|
||||
padding: 0 30rpx;
|
||||
background-color: #ffffff;
|
||||
.timelinetitle {
|
||||
margin-top: 20rpx;
|
||||
height: 40rpx;
|
||||
line-height: 40rpx;
|
||||
font-size: 30rpx;
|
||||
font-weight: 400;
|
||||
color: rgba(51, 51, 51, 1);
|
||||
}
|
||||
.timelineid {
|
||||
min-height: 40rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
color: rgba(102, 102, 102, 1);
|
||||
}
|
||||
.timelinebox {
|
||||
margin: 20rpx 0;
|
||||
}
|
||||
.timelinecontent {
|
||||
line-height: 40rpx;
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: rgba(51, 51, 51, 1);
|
||||
}
|
||||
.timelinetime {
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: rgba(153, 153, 153, 1);
|
||||
line-height: 40rpx;
|
||||
}
|
||||
}
|
||||
.refund {
|
||||
padding: 88rpx 30rpx;
|
||||
background-color: #ffffff;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
.refunds-option {
|
||||
flex: 1;
|
||||
padding: 88rpx 30rpx;
|
||||
background-color: #FFFFFF;
|
||||
background-color: #ffffff;
|
||||
display: flex;
|
||||
> view {
|
||||
width: 335rpx;
|
||||
height: 80rpx;
|
||||
border: 1rpx solid rgba(236,236,236,1);
|
||||
background: rgba(236,236,236,1);
|
||||
border: 1rpx solid rgba(236, 236, 236, 1);
|
||||
background: rgba(236, 236, 236, 1);
|
||||
border-radius: 6rpx;
|
||||
font-size: 30rpx;
|
||||
color: rgba(0,0,51,1);
|
||||
color: rgba(0, 0, 51, 1);
|
||||
line-height: 80rpx;
|
||||
text-align: center;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
.active {
|
||||
border: 1rpx solid #FF780F;
|
||||
color: #FF780F;
|
||||
background: #FFF1E6;
|
||||
border: 1rpx solid #ff780f;
|
||||
color: #ff780f;
|
||||
background: #fff1e6;
|
||||
}
|
||||
}
|
||||
.delivery-popup {
|
||||
@@ -292,27 +564,27 @@ export default {
|
||||
width: 420rpx;
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
color: rgba(51,51,51,1);
|
||||
color: rgba(51, 51, 51, 1);
|
||||
text-align: center;
|
||||
line-height: 88rpx;
|
||||
border-bottom: 2rpx solid #ECECEC;
|
||||
border-bottom: 2rpx solid #ececec;
|
||||
}
|
||||
.input-info {
|
||||
> input {
|
||||
font-size: 26rpx;
|
||||
line-height: 88rpx;
|
||||
padding: 30rpx;
|
||||
border-bottom: 2rpx solid #ECECEC;
|
||||
border-bottom: 2rpx solid #ececec;
|
||||
}
|
||||
}
|
||||
.btn {
|
||||
margin: 20rpx auto;
|
||||
width: 200rpx;
|
||||
height: 60rpx;
|
||||
background: rgba(255,120,15,1);
|
||||
background: rgba(255, 120, 15, 1);
|
||||
border-radius: 30rpx;
|
||||
font-size: 28rpx;
|
||||
color: rgba(255,255,255,1);
|
||||
color: rgba(255, 255, 255, 1);
|
||||
line-height: 60rpx;
|
||||
text-align: center;
|
||||
}
|
||||
@@ -322,27 +594,27 @@ export default {
|
||||
width: 420rpx;
|
||||
text-align: center;
|
||||
font-size: 28rpx;
|
||||
color: rgba(102,102,102,1);
|
||||
color: rgba(102, 102, 102, 1);
|
||||
line-height: 42rpx;
|
||||
padding: 30rpx 0;
|
||||
}
|
||||
.popup-btn {
|
||||
width: 420rpx;
|
||||
display: flex;
|
||||
border-top: 2rpx solid #ECECEC;
|
||||
border-top: 2rpx solid #ececec;
|
||||
> view {
|
||||
flex: 1;
|
||||
height: 98rpx;
|
||||
text-align: center;
|
||||
line-height: 98rpx;
|
||||
&:first-child {
|
||||
border-right: 2rpx solid #ECECEC;
|
||||
border-right: 2rpx solid #ececec;
|
||||
}
|
||||
}
|
||||
.determine {
|
||||
color: #FF780F;
|
||||
color: #ff780f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -132,6 +132,7 @@ export default {
|
||||
showComplaint: false,
|
||||
worker: {},
|
||||
publishstate: false,
|
||||
clickstate:false,//投诉骑手按钮点击状态
|
||||
num: 1,
|
||||
allorder: [], //所有订单
|
||||
testlist: [], //试穿列表
|
||||
@@ -147,11 +148,17 @@ export default {
|
||||
onLoad() {
|
||||
// 初始化轮播图
|
||||
this.getswiper();
|
||||
// 所有订单
|
||||
this.getallorder(0);
|
||||
// 获取可投诉列表
|
||||
this.getcarlist();
|
||||
// 订单状态: 0:全部 1已付款未发货 2已发货 3已完成 4申请退款/退货 5已退款/退货
|
||||
// 订单状态: 0:全部 1已付款未发货 2已发货 3已完成 4申请退款/退货 5已退款/退货 6拒绝退款/退货
|
||||
},
|
||||
onShow() {
|
||||
this.current=0
|
||||
// 初始化数据
|
||||
this.resetarr()
|
||||
// 所有订单
|
||||
this.getallorder(0);
|
||||
this.publishstate = false;
|
||||
},
|
||||
onReachBottom() {
|
||||
this.num++;
|
||||
@@ -200,6 +207,15 @@ export default {
|
||||
// 投诉骑手
|
||||
reportcar(type) {
|
||||
let that = this;
|
||||
if(this.clickstate==false){
|
||||
this.clickstate=true
|
||||
}else{
|
||||
this.$refs.uToast.show({
|
||||
title: "不能重复提交",
|
||||
type: 'error'
|
||||
});
|
||||
return
|
||||
}
|
||||
if (that.reportcontent == '') {
|
||||
this.$refs.uToast.show({
|
||||
title: "投诉内容不能为空",
|
||||
@@ -207,20 +223,30 @@ export default {
|
||||
});
|
||||
return;
|
||||
}
|
||||
console.log(that.reportinfo)
|
||||
|
||||
this.$u.api.reportorder({
|
||||
order_id: that.reportinfo.order_id,
|
||||
takeawayer_id: that.reportinfo.takeawayer_id,
|
||||
order_list: that.reportinfo.order_list,
|
||||
content: that.reportcontent
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
// 恢复可点击状态
|
||||
this.clickstate=false
|
||||
if (res.errCode != 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
// 提交后清空选择信息
|
||||
that.reportinfo=null
|
||||
// 清空投诉评价
|
||||
that.reportcontent = ""
|
||||
// 清空选择器返回信息
|
||||
that.worker = {}
|
||||
// 重新获取可投诉列表
|
||||
that.getcarlist();
|
||||
// 提示修改成功
|
||||
that.showComplaint = true;
|
||||
}
|
||||
});
|
||||
@@ -282,7 +308,6 @@ export default {
|
||||
type: type,
|
||||
page: that.num
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
if (res.errCode != 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
@@ -352,6 +377,7 @@ export default {
|
||||
},
|
||||
// 发布内容跳转页面
|
||||
navto(url) {
|
||||
this.publishstate = false;
|
||||
this.$u.route({
|
||||
url: `/pages/${url}`
|
||||
});
|
||||
|
||||
434
pages/index/otherdetails.vue
Normal file
434
pages/index/otherdetails.vue
Normal file
@@ -0,0 +1,434 @@
|
||||
<template>
|
||||
<view class="details">
|
||||
<view class="goods-info">
|
||||
<image :src="info.goods_image"></image>
|
||||
<view class="info-right">
|
||||
<view class="name u-line-1">{{ info.goods_name }}</view>
|
||||
<view class="info">
|
||||
<view class="num">共{{ info.goods_try_num }}件商品</view>
|
||||
<view class="price">
|
||||
实付
|
||||
<span>¥{{ info.goods_price }}</span>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="refunds-user" v-if="type == 2 || type == 3 || type == 4">
|
||||
<view>
|
||||
<image src="/static/image/home/2.png"></image>
|
||||
<view>{{ info.goods_try_member_name }}</view>
|
||||
</view>
|
||||
<view>
|
||||
<image src="/static/image/home/3.png"></image>
|
||||
<view>{{ info.goods_try_member_mobile }}</view>
|
||||
</view>
|
||||
<view>
|
||||
<image src="/static/image/home/4.png"></image>
|
||||
<view class="address u-line-1">{{ info.goods_try_area_info }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="user-info" v-if="type == 1">
|
||||
<view class="info-title">收件人信息</view>
|
||||
<view class="info-container">
|
||||
<view>
|
||||
<view class="title">姓名</view>
|
||||
<view class="value">{{ info.goods_try_member_name }}</view>
|
||||
</view>
|
||||
<view>
|
||||
<view class="title">手机号</view>
|
||||
<view class="value">{{ info.goods_try_member_mobile }}</view>
|
||||
</view>
|
||||
<view>
|
||||
<view class="title">收货地址</view>
|
||||
<view class="value u-line-1">{{ info.goods_try_area_info }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="delivery" v-if="type == 1">
|
||||
<view class="title">派送方式</view>
|
||||
<view class="methods">
|
||||
<view :class="{ active: cur == 0 }" @click="people">人工送达</view>
|
||||
<view :class="{ active: cur == 1 }" @click="carer">指派外部骑手</view>
|
||||
</view>
|
||||
|
||||
<view class="btn" @click="confirmpushstyle">确认</view>
|
||||
</view>
|
||||
<!-- <view class="refunds-option" v-if="type==4">
|
||||
<view :class="{active: cur==0}" @click="cur=0;showRefunds=true">不处理</view>
|
||||
<view :class="{active: cur==1}" @click="cur=1;showRefunds=true">确定处理</view>
|
||||
</view> -->
|
||||
<!-- <u-popup v-model="showDelivery" mode="center" border-radius="10" class="delivery-popup">
|
||||
<view class="title">骑手信息</view>
|
||||
<view class="input-info">
|
||||
<input type="text" placeholder="请输入您的姓名" v-model="name" />
|
||||
<input type="text" placeholder="请输入您的手机号" v-model="phone" />
|
||||
<input type="text" placeholder="请输入您的公司名称" v-model="company" />
|
||||
</view>
|
||||
<view class="btn">确认</view>
|
||||
</u-popup> -->
|
||||
<u-picker mode="selector" v-model="show" :default-selector="[0]" :range="list" range-key="content" @confirm="getselect"></u-picker>
|
||||
<!-- <u-popup v-model="showExpress" mode="center" border-radius="10" class="delivery-popup">
|
||||
<view class="title" @click="bindpushid">填写快递单号</view>
|
||||
<view class="input-info">
|
||||
<input type="text" placeholder="请输入快递单号" v-model="express" />
|
||||
</view>
|
||||
<view class="btn">确认</view>
|
||||
</u-popup> -->
|
||||
<!-- <u-popup v-model="showRefunds" mode="center" border-radius="10" class="refunds-popup">
|
||||
<view v-if="cur==1" class="popup-tips">确定处理<br />平台将进行退款</view>
|
||||
<view v-if="cur==0" class="popup-tips">确定不处理<br />平台将进行联系</view>
|
||||
<view class="popup-btn">
|
||||
<view class="cancel" @click="showRefunds=false">取消</view>
|
||||
<view class="determine">确定</view>
|
||||
</view>
|
||||
</u-popup> -->
|
||||
<u-toast ref="uToast" />
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
status: 1, // 订单状态
|
||||
cur: Number,
|
||||
showDelivery: false, // 填写骑手信息
|
||||
showExpress: false, // 填写快递单号
|
||||
showRefunds: false, // 平台退货处理
|
||||
show: false, // 骑手列表
|
||||
name: '',
|
||||
phone: '',
|
||||
company: '',
|
||||
express: '',
|
||||
type: '',
|
||||
orderid: 0,
|
||||
info: {},
|
||||
list: [],
|
||||
selctcar: null //选择骑手ID
|
||||
};
|
||||
},
|
||||
onLoad(option) {
|
||||
this.type = option.type;
|
||||
this.orderid = option.id;
|
||||
this.resetinfo();
|
||||
},
|
||||
methods: {
|
||||
// 人工配送
|
||||
people() {
|
||||
this.cur = 0;
|
||||
},
|
||||
carer() {
|
||||
this.cur = 1;
|
||||
this.show = true;
|
||||
},
|
||||
// 绑定配送方式
|
||||
confirmpushstyle() {
|
||||
if (this.cur == 0) {
|
||||
this.$u.api.agreetest({
|
||||
goods_try_id: this.orderid,
|
||||
type: 1,
|
||||
takeawayer_id: 0
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
if (res.errCode != 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$u.api.agreetest({
|
||||
goods_try_id: this.orderid,
|
||||
type: 1,
|
||||
takeawayer_id: this.selctcar.takeawayer_id
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
if (res.errCode != 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
// 选择骑手
|
||||
getselect(e) {
|
||||
this.selctcar = this.list[e[0]];
|
||||
},
|
||||
// 获取订单信息
|
||||
resetinfo() {
|
||||
this.$u.api.testorderdetail({
|
||||
goods_try_id: this.orderid
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
if (res.errCode != 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
this.info = res.data.info;
|
||||
}
|
||||
});
|
||||
// 获取骑手列表
|
||||
this.$u.api.takeawayerlist({}).then(res => {
|
||||
console.log(res);
|
||||
if (res.errCode != 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
let arr = res.data;
|
||||
for (let index in arr) {
|
||||
arr[index].content = arr[index].company_name + '——' + arr[index].contacts + '——' + arr[index].contact_number;
|
||||
}
|
||||
this.list = arr;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.details {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: calc(100vh - var(--window-top));
|
||||
background-color: #ececec;
|
||||
.goods-info {
|
||||
background-color: #ffffff;
|
||||
padding: 30rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 2rpx 0 20rpx;
|
||||
> image {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
border-radius: 10rpx;
|
||||
flex-shrink: 0;
|
||||
margin-right: 26rpx;
|
||||
}
|
||||
.info-right {
|
||||
.name {
|
||||
width: 439rpx;
|
||||
font-size: 28rpx;
|
||||
color: rgba(51, 51, 51, 1);
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
.info {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 26rpx;
|
||||
color: rgba(102, 102, 102, 1);
|
||||
.price {
|
||||
margin-left: 10rpx;
|
||||
> span {
|
||||
color: #ff780f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.refunds-user {
|
||||
padding: 25rpx 30rpx;
|
||||
background-color: #ffffff;
|
||||
margin-bottom: 20rpx;
|
||||
> view {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 30rpx;
|
||||
@mixin image-class($width, $right) {
|
||||
> image {
|
||||
flex-shrink: 0;
|
||||
width: $width;
|
||||
height: 40rpx;
|
||||
margin-right: $right;
|
||||
}
|
||||
}
|
||||
&:first-child {
|
||||
@include image-class($width: 40rpx, $right: 20rpx);
|
||||
}
|
||||
&:nth-child(2) {
|
||||
margin-left: 4rpx;
|
||||
@include image-class($width: 32rpx, $right: 24rpx);
|
||||
}
|
||||
&:last-child {
|
||||
margin-left: 2rpx;
|
||||
@include image-class($width: 36rpx, $right: 22rpx);
|
||||
}
|
||||
> view {
|
||||
font-size: 26rpx;
|
||||
color: rgba(51, 51, 51, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
.user-info {
|
||||
.info-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
color: rgba(51, 51, 51, 1);
|
||||
height: 88rpx;
|
||||
background-color: #ffffff;
|
||||
margin-bottom: 2rpx;
|
||||
padding: 30rpx;
|
||||
}
|
||||
.info-container {
|
||||
padding: 0 30rpx;
|
||||
background-color: #ffffff;
|
||||
margin-bottom: 20rpx;
|
||||
> view {
|
||||
height: 88rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: rgba(51, 51, 51, 1);
|
||||
&:not(:last-child) {
|
||||
border-bottom: 2rpx solid #ececec;
|
||||
}
|
||||
.title {
|
||||
width: 150rpx;
|
||||
font-size: 30rpx;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
.value {
|
||||
font-size: 26rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.delivery {
|
||||
flex: 1;
|
||||
background-color: #ffffff;
|
||||
padding: 30rpx;
|
||||
position: relative;
|
||||
.title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
color: rgba(51, 51, 51, 1);
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
.methods {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
> view {
|
||||
font-size: 30rpx;
|
||||
color: rgba(0, 0, 51, 1);
|
||||
width: 335rpx;
|
||||
height: 80rpx;
|
||||
border: 1rpx solid rgba(236, 236, 236, 1);
|
||||
background: rgba(236, 236, 236, 1);
|
||||
border-radius: 6rpx;
|
||||
text-align: center;
|
||||
line-height: 80rpx;
|
||||
margin-bottom: 20rpx;
|
||||
&:nth-child(2n-1) {
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
}
|
||||
.active {
|
||||
border: 1rpx solid #ff780f;
|
||||
color: #ff780f;
|
||||
background: #fff1e6;
|
||||
}
|
||||
}
|
||||
.btn {
|
||||
position: absolute;
|
||||
bottom: 40rpx;
|
||||
left: 50%;
|
||||
transform: translate(-50%, 0);
|
||||
width: 690rpx;
|
||||
height: 98rpx;
|
||||
background: rgba(255, 120, 15, 1);
|
||||
border-radius: 49rpx;
|
||||
font-size: 36rpx;
|
||||
color: rgba(255, 255, 255, 1);
|
||||
text-align: center;
|
||||
line-height: 98rpx;
|
||||
}
|
||||
}
|
||||
.refunds-option {
|
||||
flex: 1;
|
||||
padding: 88rpx 30rpx;
|
||||
background-color: #ffffff;
|
||||
display: flex;
|
||||
> view {
|
||||
width: 335rpx;
|
||||
height: 80rpx;
|
||||
border: 1rpx solid rgba(236, 236, 236, 1);
|
||||
background: rgba(236, 236, 236, 1);
|
||||
border-radius: 6rpx;
|
||||
font-size: 30rpx;
|
||||
color: rgba(0, 0, 51, 1);
|
||||
line-height: 80rpx;
|
||||
text-align: center;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
.active {
|
||||
border: 1rpx solid #ff780f;
|
||||
color: #ff780f;
|
||||
background: #fff1e6;
|
||||
}
|
||||
}
|
||||
.delivery-popup {
|
||||
.title {
|
||||
width: 420rpx;
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
color: rgba(51, 51, 51, 1);
|
||||
text-align: center;
|
||||
line-height: 88rpx;
|
||||
border-bottom: 2rpx solid #ececec;
|
||||
}
|
||||
.input-info {
|
||||
> input {
|
||||
font-size: 26rpx;
|
||||
line-height: 88rpx;
|
||||
padding: 30rpx;
|
||||
border-bottom: 2rpx solid #ececec;
|
||||
}
|
||||
}
|
||||
.btn {
|
||||
margin: 20rpx auto;
|
||||
width: 200rpx;
|
||||
height: 60rpx;
|
||||
background: rgba(255, 120, 15, 1);
|
||||
border-radius: 30rpx;
|
||||
font-size: 28rpx;
|
||||
color: rgba(255, 255, 255, 1);
|
||||
line-height: 60rpx;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
.refunds-popup {
|
||||
.popup-tips {
|
||||
width: 420rpx;
|
||||
text-align: center;
|
||||
font-size: 28rpx;
|
||||
color: rgba(102, 102, 102, 1);
|
||||
line-height: 42rpx;
|
||||
padding: 30rpx 0;
|
||||
}
|
||||
.popup-btn {
|
||||
width: 420rpx;
|
||||
display: flex;
|
||||
border-top: 2rpx solid #ececec;
|
||||
> view {
|
||||
flex: 1;
|
||||
height: 98rpx;
|
||||
text-align: center;
|
||||
line-height: 98rpx;
|
||||
&:first-child {
|
||||
border-right: 2rpx solid #ececec;
|
||||
}
|
||||
}
|
||||
.determine {
|
||||
color: #ff780f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -57,11 +57,12 @@ export default {
|
||||
login: '登录',
|
||||
show: false,
|
||||
zhanghao: 'seller',
|
||||
mima: '123456789',
|
||||
mima: '123456',
|
||||
zhanghaoA: '18953829598 ',
|
||||
mimaA: '123456',
|
||||
url: '',
|
||||
state:0
|
||||
state:0,
|
||||
clickstate:false
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
@@ -87,18 +88,30 @@ export default {
|
||||
},
|
||||
loading() {},
|
||||
logins() {
|
||||
// 判断是否可以点击
|
||||
if(this.clickstate==false){
|
||||
this.clickstate=true
|
||||
}else{
|
||||
this.$refs.uToast.show({
|
||||
title: "不能重复提交",
|
||||
type: 'error'
|
||||
});
|
||||
return
|
||||
}
|
||||
// 清除本地存储才可以正常登陆(具体原因没有仔细检查)
|
||||
uni.clearStorage();
|
||||
// 账号登录1达人0商家
|
||||
if(this.state==1){
|
||||
this.$u.api.login({ member_name: this.zhanghaoA, member_password: this.mimaA }).then(res => {
|
||||
console.log(res);
|
||||
if (res.errCode != 0) {
|
||||
// 恢复按钮可点击状态
|
||||
this.clickstate=false
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
|
||||
uni.setStorageSync('token', res.data.token);
|
||||
uni.setStorageSync('userinfo', res.data);
|
||||
uni.setStorageSync('rongyun', res.data.rongcloud_token);
|
||||
@@ -109,8 +122,9 @@ export default {
|
||||
});
|
||||
}else{
|
||||
this.$u.api.shoplogin({ member_name: this.zhanghao, member_password: this.mima }).then(res => {
|
||||
console.log(res);
|
||||
if (res.errCode != 0) {
|
||||
// 恢复按钮可点击状态
|
||||
this.clickstate=false
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'error'
|
||||
|
||||
@@ -2,23 +2,50 @@
|
||||
<view id="release">
|
||||
<u-form :model="form" ref="uForm">
|
||||
<u-form-item label="标题" label-position="right"><u-input v-model="form.name" placeholder="请输入标题" /></u-form-item>
|
||||
<!-- form-data -->
|
||||
<view class="titles">封面</view>
|
||||
<u-upload
|
||||
:form-data="coverformdata"
|
||||
:max-count="1"
|
||||
:header="header"
|
||||
name="article_cover"
|
||||
:action="action"
|
||||
del-color="#ececec"
|
||||
upload-text="选择图片"
|
||||
del-bg-color="#fff"
|
||||
:file-list="fileListA"
|
||||
@on-success="uploadcover"
|
||||
></u-upload>
|
||||
<view class="titles">图片</view>
|
||||
<u-upload :action="action" del-color="#ececec" upload-text="选择图片" del-bg-color="#fff" :file-list="fileList"></u-upload>
|
||||
<u-upload
|
||||
:form-data="imgformdata"
|
||||
name="article_image"
|
||||
:header="header"
|
||||
:action="action"
|
||||
@on-success="uploadphoto"
|
||||
del-color="#ececec"
|
||||
upload-text="选择图片"
|
||||
del-bg-color="#fff"
|
||||
:max-count="5"
|
||||
:file-list="fileListB"
|
||||
></u-upload>
|
||||
<!-- 标签 -->
|
||||
<view>
|
||||
<view class="titles">标签</view>
|
||||
<view class="form-view" @click="show_add()">+ 新建标签</view>
|
||||
<view class="form-view" v-for="(item, index) in fileListes" :key="index">{{ item }}</view>
|
||||
<view :class="[item.state == true ? 'active' : '', 'form-view']" v-for="(item, index) in fileListes" :key="index" @click="changeselect(index)">
|
||||
{{ item.name }}
|
||||
</view>
|
||||
</view>
|
||||
<!-- 简介 -->
|
||||
<view class="titles">简介</view>
|
||||
<view class="titles_border"><textarea placeholder="请输入内容..."></textarea></view>
|
||||
<view class="titles_border"><textarea placeholder="请输入内容..." v-model="form.intro"></textarea></view>
|
||||
<!-- 底部弹框 商品选择 -->
|
||||
<view class="show_two">
|
||||
<u-popup v-model="show_two" mode="bottom" :closeable="true">
|
||||
<view class="title"><text>选择商品</text></view>
|
||||
<!-- 商品列表 -->
|
||||
<scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll" >
|
||||
<scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll">
|
||||
<view class="listes_shoping" v-for="(item, index) in list" :key="index">
|
||||
<view>
|
||||
<u-checkbox-group>
|
||||
@@ -39,21 +66,22 @@
|
||||
<image class="images" src="../../static/image/tosign/bhottom.png"></image>
|
||||
</view>
|
||||
<!-- 选择后的列表 -->
|
||||
<view class="List_tosign" v-if="List_tosign != ''">
|
||||
<view><image src="../../static/image/tosign/tosigin(5).png" mode="scaleToFill"></image></view>
|
||||
<view>木糖少女小紫薯西装领连衣裙夏季新款女装夏收腰格子格纹裙子</view>
|
||||
<view><image src="../../static/image/tosign/delete.png" mode="widthFix"></image></view>
|
||||
<view class="List_tosign" v-for="list in shoplist">
|
||||
<view><image :src="list.goods_image" mode="scaleToFill"></image></view>
|
||||
<view>{{ list.goods_name }}</view>
|
||||
<view><image src="../../static/image/tosign/delete.png" mode="widthFix" @click="delarr(list.goods_id)"></image></view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 提交 -->
|
||||
<u-button class="custom-style" shape="circle" size="default">发表</u-button>
|
||||
<u-button class="custom-style" shape="circle" size="default" @click="publish">发表</u-button>
|
||||
</u-form>
|
||||
<!-- 添加标签的按钮 -->
|
||||
<u-popup v-model="show" mode="center" border-radius="14">
|
||||
<view class="text">创建属于你的标签吧</view>
|
||||
<view class="u-inputes"><u-input v-model="form.name" /></view>
|
||||
<u-button class="custom-style-button" shape="circle" size="default">确定</u-button>
|
||||
<view class="u-inputes"><u-input v-model="tagcontent" /></view>
|
||||
<u-button class="custom-style-button" shape="circle" size="default" @click="addLiveSpec">确定</u-button>
|
||||
</u-popup>
|
||||
<u-toast ref="uToast" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -67,41 +95,153 @@ export default {
|
||||
sex: ''
|
||||
},
|
||||
// 演示地址,请勿直接使用
|
||||
action: 'http://www.example.com/upload',
|
||||
fileList: [],
|
||||
fileListes: ['美妆', '博主穿搭', '美妆', '美妆', '美妆', '美妆', '美妆', '博主穿搭'],
|
||||
action: 'https://dmmall.sdbairui.com/storeapi/Upload/uploadFile',
|
||||
coverformdata: {
|
||||
name: 'article_cover'
|
||||
},
|
||||
imgformdata: {
|
||||
name: 'article_image'
|
||||
},
|
||||
fileListA: [],
|
||||
fileListB: [],
|
||||
imgarrA: [],
|
||||
imgarrB: [],
|
||||
header: {
|
||||
Authorization: 'Bearer' + ' ' + uni.getStorageSync('token')
|
||||
},
|
||||
fileListes: [],
|
||||
show: false,
|
||||
show_two: false,
|
||||
filesList: [],
|
||||
arres_list: [],
|
||||
shoplist: [],
|
||||
checked: false,
|
||||
list: [],
|
||||
List_tosign: [],
|
||||
scrollTop: 0
|
||||
scrollTop: 0,
|
||||
imgarr: [], //上传图片数组
|
||||
cover: '', //图文封面
|
||||
selectarr: [], //选中标签
|
||||
tagcontent: ''
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
// 定义删除数组的方法
|
||||
Array.prototype.remove = function(val) {
|
||||
var index = this.indexOf(val);
|
||||
if (index > -1) {
|
||||
this.splice(index, 1);
|
||||
}
|
||||
};
|
||||
// 缓存取选择好的数据
|
||||
this.tosign();
|
||||
this.getLiveSpec();
|
||||
},
|
||||
methods: {
|
||||
publish() {
|
||||
let arr = this.imgarrB;
|
||||
let newarr = [];
|
||||
for (let index in arr) {
|
||||
newarr.push(arr[index].file_id);
|
||||
}
|
||||
this.$u.api.publishphoto({
|
||||
article_title: this.form.name,
|
||||
article_content: this.form.intro,
|
||||
article_pic: this.imgarrA[0].file_name,
|
||||
file_id: newarr,
|
||||
goods_id_arr: this.arres_list,
|
||||
label_arr: this.selectarr
|
||||
}).then(res => {
|
||||
if (res.errCode != 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'success'
|
||||
});
|
||||
setTimeout(function(){
|
||||
uni.navigateBack({
|
||||
delta:1
|
||||
})
|
||||
},1000)
|
||||
}
|
||||
});
|
||||
},
|
||||
// 获取商品数组变化
|
||||
getshoplist() {
|
||||
let arr = this.arres_list;
|
||||
let newarr = this.list;
|
||||
this.shoplist = [];
|
||||
for (let index in arr) {
|
||||
for (let i in newarr) {
|
||||
if (arr[index] == newarr[i].goods_id) {
|
||||
this.shoplist.push(newarr[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
// 改变选中状态
|
||||
changeselect(num) {
|
||||
if (this.fileListes[num].state == true) {
|
||||
this.fileListes[num].state = false;
|
||||
let index = this.selectarr.indexOf(this.fileListes[num].id);
|
||||
this.selectarr.splice(index, 1);
|
||||
} else {
|
||||
this.fileListes[num].state = true;
|
||||
this.selectarr.push(this.fileListes[num].id);
|
||||
}
|
||||
},
|
||||
// 获取标签
|
||||
getLiveSpec() {
|
||||
let that = this;
|
||||
this.$u.api.getLiveSpec({}).then(res => {
|
||||
if (res.errCode != 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
let arr = res.data;
|
||||
for (let index in arr) {
|
||||
arr[index].state = false;
|
||||
}
|
||||
that.fileListes = arr;
|
||||
}
|
||||
});
|
||||
},
|
||||
// 创建标签
|
||||
addLiveSpec() {
|
||||
this.$u.api.createLivesp({
|
||||
spec_name: this.tagcontent
|
||||
}).then(res => {
|
||||
if (res.errCode != 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
this.tagcontent = '';
|
||||
this.show = false;
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'success'
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
// 上传封面
|
||||
uploadcover(data) {
|
||||
let obj = data.data;
|
||||
obj.url = obj.file_path;
|
||||
this.imgarrA.push(obj);
|
||||
},
|
||||
// 上传图片
|
||||
uploadphoto(data) {
|
||||
let obj = data.data;
|
||||
obj.url = obj.file_path;
|
||||
this.imgarrB.push(obj);
|
||||
},
|
||||
changes() {
|
||||
let that = this;
|
||||
that.show_two = false;
|
||||
console.log(that.arres_list);
|
||||
// 过滤数组
|
||||
that.arres_list = [...new Set(that.arres_list)];
|
||||
console.log(that.arres_list);
|
||||
},
|
||||
show_add() {
|
||||
console.log(this.show);
|
||||
this.show = !this.show;
|
||||
},
|
||||
// 选中某个复选框时,由checkbox时触发
|
||||
@@ -109,11 +249,9 @@ export default {
|
||||
let id = e.name;
|
||||
if (e.value == true) {
|
||||
this.pushes(id);
|
||||
}else{
|
||||
this.delarr(id)
|
||||
} else {
|
||||
this.delarr(id);
|
||||
}
|
||||
console.log(this.arres_list)
|
||||
|
||||
},
|
||||
// 删除直播商品
|
||||
delarr(id) {
|
||||
@@ -121,7 +259,9 @@ export default {
|
||||
if (id == '') {
|
||||
console.log('为空');
|
||||
} else {
|
||||
that.arres_list.remove(id);
|
||||
let index = that.arres_list.indexOf(id);
|
||||
that.arres_list.splice(index, 1);
|
||||
that.getshoplist();
|
||||
}
|
||||
},
|
||||
// 增加直播商品
|
||||
@@ -131,22 +271,21 @@ export default {
|
||||
console.log('为空');
|
||||
} else {
|
||||
that.arres_list.push(id);
|
||||
that.getshoplist();
|
||||
}
|
||||
},
|
||||
tosign() {
|
||||
console.log('111');
|
||||
this.$u.api.canselectgood({}).then(res => {
|
||||
console.log(res);
|
||||
if(res.data.live_stataes==0){
|
||||
if (res.data.live_stataes == 0) {
|
||||
this.$u.route({
|
||||
url: `/pages/${url}`
|
||||
});
|
||||
}else{
|
||||
let arr = res.data.list
|
||||
for(let index in arr){
|
||||
arr[index].checked=false
|
||||
} else {
|
||||
let arr = res.data.list;
|
||||
for (let index in arr) {
|
||||
arr[index].checked = false;
|
||||
}
|
||||
this.list = arr
|
||||
this.list = arr;
|
||||
}
|
||||
});
|
||||
// try {
|
||||
@@ -177,6 +316,9 @@ export default {
|
||||
margin-bottom: 28rpx;
|
||||
color: #fff;
|
||||
}
|
||||
.active {
|
||||
background: red;
|
||||
}
|
||||
.scroll {
|
||||
width: 100%;
|
||||
height: 400px;
|
||||
|
||||
@@ -1,25 +1,42 @@
|
||||
<template>
|
||||
<view id="release">
|
||||
<u-form :model="form" ref="uForm">
|
||||
<u-form-item label="标题" label-position="right">
|
||||
<u-input v-model="form.name" placeholder="请输入标题" />
|
||||
</u-form-item>
|
||||
<view class="titles">图片</view>
|
||||
<u-upload :action="action" del-color="#ececec" upload-text="选择图片" del-bg-color="#fff" :file-list="fileList" ></u-upload>
|
||||
<!-- 标签 -->
|
||||
<view>
|
||||
<view class="titles">标签</view>
|
||||
<view class="form-view" @click="show_add()">+ 新建标签</view>
|
||||
<view class="form-view" v-for="(item,index) in fileListes" :key="index">{{item}}</view>
|
||||
<u-form-item label="标题" label-position="right"><u-input v-model="form.name" placeholder="请输入标题" /></u-form-item>
|
||||
<view class="titles">封面</view>
|
||||
<u-upload
|
||||
:form-data="coverformdata"
|
||||
:max-count="1"
|
||||
:header="header"
|
||||
name="article_cover"
|
||||
:action="action"
|
||||
del-color="#ececec"
|
||||
upload-text="选择图片"
|
||||
del-bg-color="#fff"
|
||||
:file-list="fileListA"
|
||||
@on-success="uploadcover"
|
||||
></u-upload>
|
||||
<view class="titles">视频</view>
|
||||
<view class="videobox" v-if="videostate == false" @click="uploadvideo">
|
||||
<u-icon name="plus" class="u-add-btn" size="40"></u-icon>
|
||||
<view class="videotext">选择视频</view>
|
||||
</view>
|
||||
<view class="videobox" v-else @click="uploadvideo"><video :src="videopath" controls></video></view>
|
||||
<!-- 标签 -->
|
||||
<view>
|
||||
<view class="titles">标签</view>
|
||||
<view class="form-view" @click="show_add()">+ 新建标签</view>
|
||||
<view :class="[item.state == true ? 'active' : '', 'form-view']" v-for="(item, index) in fileListes" :key="index" @click="changeselect(index)">
|
||||
{{ item.name }}
|
||||
</view>
|
||||
<!-- 简介 -->
|
||||
<view class="titles">正文</view>
|
||||
<textarea placeholder="请输入内容..."></textarea>
|
||||
</view>
|
||||
<!-- 简介 -->
|
||||
<view class="titles">正文</view>
|
||||
<view class="titles_border"><textarea placeholder="请输入内容..." v-model="form.intro"></textarea></view>
|
||||
<view class="show_two">
|
||||
<u-popup v-model="show_two" mode="bottom" :closeable="true">
|
||||
<view class="title"><text>选择商品</text></view>
|
||||
<!-- 商品列表 -->
|
||||
<scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll" >
|
||||
<scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll">
|
||||
<view class="listes_shoping" v-for="(item, index) in list" :key="index">
|
||||
<view>
|
||||
<u-checkbox-group>
|
||||
@@ -40,107 +57,262 @@
|
||||
<image class="images" src="../../static/image/tosign/bhottom.png"></image>
|
||||
</view>
|
||||
<!-- 选择后的列表 -->
|
||||
<view class="List_tosign">
|
||||
<view><image src="../../static/image/tosign/tosigin(5).png" mode="scaleToFill"></image></view>
|
||||
<view>木糖少女小紫薯西装领连衣裙夏季新款女装夏收腰格子格纹裙子</view>
|
||||
<view><image src="../../static/image/tosign/delete.png" mode="widthFix"></image></view>
|
||||
<view class="List_tosign" v-for="list in shoplist">
|
||||
<view><image :src="list.goods_image" mode="scaleToFill"></image></view>
|
||||
<view>{{ list.goods_name }}</view>
|
||||
<view><image src="../../static/image/tosign/delete.png" mode="widthFix" @click="delarr(list.goods_id)"></image></view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 提交 -->
|
||||
<u-button class="custom-style" shape="circle" size="default">发表</u-button>
|
||||
</u-form>
|
||||
<!-- 添加标签的按钮 -->
|
||||
<u-popup v-model="show" mode="center" border-radius="14" :closeable="true">
|
||||
<view class="text">
|
||||
创建属于你的标签吧
|
||||
</view>
|
||||
<view class="u-inputes">
|
||||
<u-input v-model="form.name" />
|
||||
</view>
|
||||
<u-button class="custom-style-button" shape="circle" size="default">确定</u-button>
|
||||
</u-popup>
|
||||
<!-- 提交 -->
|
||||
<u-button class="custom-style" shape="circle" size="default" @click="publish">发表</u-button>
|
||||
</u-form>
|
||||
<!-- 添加标签的按钮 -->
|
||||
<u-popup v-model="show" mode="center" border-radius="14" :closeable="true">
|
||||
<view class="text">创建属于你的标签吧</view>
|
||||
<view class="u-inputes"><u-input v-model="tagcontent" /></view>
|
||||
<u-button class="custom-style-button" shape="circle" size="default" @click="addLiveSpec">确定</u-button>
|
||||
</u-popup>
|
||||
<u-toast ref="uToast" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
name: '',
|
||||
intro: '',
|
||||
sex: ''
|
||||
},
|
||||
// 演示地址,请勿直接使用
|
||||
action: 'http://www.example.com/upload',
|
||||
fileList: [],
|
||||
fileListes:["美妆","博主穿搭","美妆","美妆","美妆","美妆","美妆","博主穿搭"],
|
||||
show: false,
|
||||
show_two: false,
|
||||
arres_list: [],
|
||||
list: [],
|
||||
scrollTop: 0
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
name: '',
|
||||
intro: '',
|
||||
sex: ''
|
||||
},
|
||||
coverformdata: {
|
||||
name: 'article_cover'
|
||||
},
|
||||
header: {
|
||||
Authorization: 'Bearer' + ' ' + uni.getStorageSync('token')
|
||||
},
|
||||
// 演示地址,请勿直接使用
|
||||
action: 'https://dmmall.sdbairui.com/storeapi/Upload/uploadFile',
|
||||
fileListA: [],
|
||||
imgarrA: [],
|
||||
videopath: '', //视频链接
|
||||
fileListes: [],
|
||||
show: false,
|
||||
show_two: false,
|
||||
arres_list: [],
|
||||
shoplist: [], //选择商品列表
|
||||
list: [],
|
||||
scrollTop: 0,
|
||||
selectarr: [], //选中标签
|
||||
tagcontent: '', //新建标签名字
|
||||
selectvideo: '', //视频名字
|
||||
videostate: false //视频状态
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
this.getLiveSpec();
|
||||
this.resetgood();
|
||||
},
|
||||
methods: {
|
||||
// 获取可以推荐的商品
|
||||
resetgood() {
|
||||
this.$u.api.canselectgood({}).then(res => {
|
||||
if (res.data.live_stataes == 0) {
|
||||
this.$u.route({
|
||||
url: `/pages/${url}`
|
||||
});
|
||||
} else {
|
||||
let arr = res.data.list;
|
||||
for (let index in arr) {
|
||||
arr[index].checked = false;
|
||||
}
|
||||
this.list = arr;
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
// 定义删除数组的方法
|
||||
Array.prototype.remove = function(val) {
|
||||
var index = this.indexOf(val);
|
||||
if (index > -1) {
|
||||
this.splice(index, 1);
|
||||
}
|
||||
};
|
||||
},
|
||||
methods:{
|
||||
show_add(){
|
||||
console.log(this.show)
|
||||
this.show = !this.show
|
||||
},
|
||||
// 选择直播商品点击确定
|
||||
changes() {
|
||||
let that = this;
|
||||
that.show_two = false;
|
||||
console.log(that.arres_list);
|
||||
},
|
||||
// 选中某个复选框时,由checkbox时触发
|
||||
checkboxChange(e) {
|
||||
let id = e.name;
|
||||
if (e.value == true) {
|
||||
this.pushes(id);
|
||||
}else{
|
||||
this.delarr(id)
|
||||
});
|
||||
},
|
||||
// 发布短视频
|
||||
publish() {
|
||||
this.$u.api.publishvideo({
|
||||
article_title: this.form.name,
|
||||
article_content: this.form.intro,
|
||||
article_pic: this.imgarrA[0].file_name,
|
||||
video_path: this.videopath,
|
||||
goods_id_arr: this.arres_list,
|
||||
label_arr: this.selectarr
|
||||
}).then(res => {
|
||||
if (res.errCode != 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'success'
|
||||
});
|
||||
setTimeout(function(){
|
||||
uni.navigateBack({
|
||||
delta:1
|
||||
})
|
||||
},1000)
|
||||
}
|
||||
});
|
||||
},
|
||||
// 获取商品数组变化
|
||||
getshoplist() {
|
||||
let arr = this.arres_list;
|
||||
let newarr = this.list;
|
||||
this.shoplist = [];
|
||||
for (let index in arr) {
|
||||
for (let i in newarr) {
|
||||
if (arr[index] == newarr[i].goods_id) {
|
||||
this.shoplist.push(newarr[i]);
|
||||
}
|
||||
console.log(this.arres_list)
|
||||
|
||||
},
|
||||
// 删除直播商品
|
||||
delarr(id) {
|
||||
var that = this;
|
||||
if (id == '') {
|
||||
console.log('为空');
|
||||
} else {
|
||||
that.arres_list.remove(id);
|
||||
}
|
||||
}
|
||||
},
|
||||
// 改变选中状态
|
||||
changeselect(num) {
|
||||
if (this.fileListes[num].state == true) {
|
||||
this.fileListes[num].state = false;
|
||||
let index = this.selectarr.indexOf(this.fileListes[num].id);
|
||||
this.selectarr.splice(index, 1);
|
||||
} else {
|
||||
this.fileListes[num].state = true;
|
||||
this.selectarr.push(this.fileListes[num].id);
|
||||
}
|
||||
},
|
||||
// 创建标签
|
||||
addLiveSpec() {
|
||||
this.$u.api.createLivesp({
|
||||
spec_name: this.tagcontent
|
||||
}).then(res => {
|
||||
if (res.errCode != 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
this.tagcontent = '';
|
||||
this.show = false;
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'success'
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
// 获取标签
|
||||
getLiveSpec() {
|
||||
let that = this;
|
||||
this.$u.api.getLiveSpec({}).then(res => {
|
||||
if (res.errCode != 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
let arr = res.data;
|
||||
for (let index in arr) {
|
||||
arr[index].state = false;
|
||||
}
|
||||
},
|
||||
// 增加直播商品
|
||||
pushes(id) {
|
||||
var that = this;
|
||||
if (id == '') {
|
||||
console.log('为空');
|
||||
} else {
|
||||
that.arres_list.push(id);
|
||||
}
|
||||
},
|
||||
},
|
||||
components: {
|
||||
}
|
||||
that.fileListes = arr;
|
||||
}
|
||||
});
|
||||
},
|
||||
// 上传封面
|
||||
uploadcover(data) {
|
||||
let obj = data.data;
|
||||
obj.url = obj.file_path;
|
||||
this.imgarrA.push(obj);
|
||||
},
|
||||
// 上传视频
|
||||
uploadvideo() {
|
||||
let url = this.action;
|
||||
let that = this;
|
||||
uni.chooseVideo({
|
||||
count: 1,
|
||||
sourceType: ['camera', 'album'],
|
||||
success: function(res) {
|
||||
self.src = res.tempFilePath;
|
||||
const tempFilePaths = res.tempFilePath;
|
||||
uni.uploadFile({
|
||||
url: url, //仅为示例,非真实的接口地址
|
||||
filePath: tempFilePaths,
|
||||
name: 'article_video',
|
||||
formData: {
|
||||
name: 'article_video'
|
||||
},
|
||||
header: {
|
||||
Authorization: 'Bearer' + ' ' + uni.getStorageSync('token')
|
||||
},
|
||||
success: uploadFileRes => {
|
||||
let obj = JSON.parse(uploadFileRes.data);
|
||||
that.videopath = obj.data.url;
|
||||
that.selectvideo = obj.data.key;
|
||||
that.videostate = true;
|
||||
},
|
||||
fail: function(error) {
|
||||
console.log(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
// 新建标签
|
||||
show_add() {
|
||||
this.show = !this.show;
|
||||
},
|
||||
// 选择直播商品点击确定
|
||||
changes() {
|
||||
let that = this;
|
||||
that.show_two = false;
|
||||
},
|
||||
// 选中某个复选框时,由checkbox时触发
|
||||
checkboxChange(e) {
|
||||
let id = e.name;
|
||||
if (e.value == true) {
|
||||
this.pushes(id);
|
||||
} else {
|
||||
this.delarr(id);
|
||||
}
|
||||
},
|
||||
// 删除直播商品
|
||||
delarr(id) {
|
||||
var that = this;
|
||||
if (id == '') {
|
||||
console.log('为空');
|
||||
} else {
|
||||
let index = that.arres_list.indexOf(id);
|
||||
that.arres_list.splice(index, 1);
|
||||
that.getshoplist();
|
||||
}
|
||||
},
|
||||
// 增加直播商品
|
||||
pushes(id) {
|
||||
var that = this;
|
||||
if (id == '') {
|
||||
console.log('为空');
|
||||
} else {
|
||||
that.arres_list.push(id);
|
||||
that.getshoplist();
|
||||
}
|
||||
}
|
||||
},
|
||||
components: {}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
#release{
|
||||
#release {
|
||||
width: 690rpx;
|
||||
margin: 0 auto;
|
||||
.titles_border,
|
||||
.uni-textarea-compute {
|
||||
border: 1px #bababa solid !important;
|
||||
padding: 10rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
.show_two {
|
||||
padding: 30rpx 0 70rpx 0;
|
||||
}
|
||||
@@ -165,7 +337,7 @@
|
||||
border-bottom: solid 1px #ececec;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
|
||||
.show_two .title > text {
|
||||
font-size: 30rpx;
|
||||
padding: 30rpx;
|
||||
@@ -176,7 +348,7 @@
|
||||
font-weight: 400;
|
||||
color: rgba(51, 51, 51, 1);
|
||||
}
|
||||
|
||||
|
||||
.show_two .images {
|
||||
width: 22rpx;
|
||||
height: 12rpx;
|
||||
@@ -228,28 +400,28 @@
|
||||
height: 160rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
|
||||
.listes_shoping > view {
|
||||
float: left;
|
||||
}
|
||||
|
||||
|
||||
.listes_shoping > view:nth-child(1) {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
margin-top: 62rpx;
|
||||
margin-left: 30rpx;
|
||||
}
|
||||
|
||||
|
||||
.listes_shoping > view:nth-child(2) {
|
||||
width: 180rpx;
|
||||
height: 160rpx;
|
||||
margin: 0 31rpx 0 19rpx;
|
||||
}
|
||||
|
||||
|
||||
.listes_shoping > view:nth-child(2) image {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
.listes_shoping > view:nth-child(3) {
|
||||
width: 425rpx;
|
||||
margin-top: 43rpx;
|
||||
@@ -260,9 +432,9 @@
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
}
|
||||
.form-view{
|
||||
background:rgba(255,120,15,1);
|
||||
border-radius:6rpx;
|
||||
.form-view {
|
||||
background: rgba(255, 120, 15, 1);
|
||||
border-radius: 6rpx;
|
||||
margin-right: 20rpx;
|
||||
font-size: 24rpx;
|
||||
padding: 8rpx 20rpx;
|
||||
@@ -270,23 +442,44 @@
|
||||
margin-bottom: 28rpx;
|
||||
color: #fff;
|
||||
}
|
||||
.titles{
|
||||
font-size:30rpx;
|
||||
font-weight:400;
|
||||
color:rgba(51,51,51,1);
|
||||
.active {
|
||||
background: red;
|
||||
}
|
||||
.titles {
|
||||
font-size: 30rpx;
|
||||
font-weight: 400;
|
||||
color: rgba(51, 51, 51, 1);
|
||||
margin: 30rpx 0;
|
||||
}
|
||||
textarea{
|
||||
.videobox {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background: #f4f5f6;
|
||||
margin-left: 10rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
.videotext {
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
.videobox video {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
}
|
||||
textarea {
|
||||
font-size: 26rpx;
|
||||
}
|
||||
.custom-style{
|
||||
background:rgba(255,120,15,1)!important;
|
||||
color: #fff!important;
|
||||
.custom-style {
|
||||
background: rgba(255, 120, 15, 1) !important;
|
||||
color: #fff !important;
|
||||
font-size: 36rpx;
|
||||
}
|
||||
.custom-style-button{
|
||||
background:rgba(255,120,15,1)!important;
|
||||
color: #fff!important;
|
||||
.custom-style-button {
|
||||
background: rgba(255, 120, 15, 1) !important;
|
||||
color: #fff !important;
|
||||
font-size: 28rpx;
|
||||
width: 200rpx;
|
||||
margin-bottom: 23rpx;
|
||||
@@ -294,9 +487,9 @@
|
||||
height: 60rpx;
|
||||
}
|
||||
}
|
||||
.u-mode-center-box{
|
||||
.u-mode-center-box {
|
||||
padding: 120rpx;
|
||||
.text{
|
||||
.text {
|
||||
font-size: 30rpx;
|
||||
margin-top: 74rpx;
|
||||
text-align: center;
|
||||
@@ -304,7 +497,7 @@
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
.u-inputes{
|
||||
.u-inputes {
|
||||
margin: 30rpx 0;
|
||||
border: 1px #ececec solid;
|
||||
padding-left: 14rpx;
|
||||
|
||||
@@ -49,6 +49,10 @@
|
||||
<image class="shoptapimg" @click="xianshi" src="../../static/image/shop.png"></image>
|
||||
<text style="font-size:26rpx;color:#fff;width:512rpx;position:fixed;left:30rpx;top:793rpx">德铭阳光在线绿色直播,请遵循相关法律法规,警察叔叔24小时巡查哦。为了保障直播系统稳定,现将全局开放防主播沉迷功能。主播积累直播16小时将自动下播休息2小时后方可继续开播。请大家注意休息/避免空播。
|
||||
</text>
|
||||
<div class="danmulist">
|
||||
<text class="danmuitem" v-for="(i,j) in danmulist" :key="j">{{i.senderNickname}}:{{i.content}}</text>
|
||||
|
||||
</div>
|
||||
<div class="bottom" :style="{'height':height + 'px'}" v-if="tool" @click="tool = false">
|
||||
<view class="menu" @click="zuzhi">
|
||||
<view class="menuback"></view>
|
||||
@@ -252,9 +256,22 @@
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
}
|
||||
.danmulist{
|
||||
position: fixed;
|
||||
left: 30rpx;
|
||||
bottom: 118rpx;
|
||||
}
|
||||
.danmuitem{
|
||||
font-size: 26rpx;
|
||||
color: #fff;
|
||||
flex-direction: column-reverse;
|
||||
}
|
||||
.livePusher{
|
||||
width: 750rpx;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
const RongIMLib = require('../../static/rongyun.js');
|
||||
const ChatRoomService =require('../../static/chatservice');
|
||||
export default {
|
||||
data: {
|
||||
fil: true,
|
||||
@@ -268,7 +285,10 @@
|
||||
live_id:0,
|
||||
tool:false,
|
||||
meiyan:0,
|
||||
time:'00:00:00'
|
||||
time:'00:00:00',
|
||||
room:{},
|
||||
chatRoomService:{},
|
||||
danmulist:[]
|
||||
},
|
||||
onReady() {
|
||||
// 注意:需要在onReady中 或 onLoad 延时
|
||||
@@ -284,6 +304,7 @@
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
onLoad(a){
|
||||
this.url = a.url.replace("*","&")
|
||||
let that = this
|
||||
@@ -311,6 +332,26 @@
|
||||
success(res){
|
||||
console.log(res.data)
|
||||
that.info = res.data.data.memberInfo
|
||||
|
||||
console.log(uni.getStorageSync('userinfo'),123)
|
||||
//当前用户
|
||||
var currentUser = {
|
||||
id : res.data.data.memberInfo.member_id + "",
|
||||
nickname : res.data.data.memberInfo.member_nickname + "",
|
||||
avatar: res.data.data.memberInfo.member_avatar
|
||||
};
|
||||
|
||||
var room = {
|
||||
id : a.id + "",
|
||||
name : a.id + ""
|
||||
};
|
||||
console.log(room)
|
||||
//构造chatRoomService
|
||||
that.chatRoomService = new ChatRoomService(room, currentUser);
|
||||
that.chatRoomService.initialWhenNewMessage(that.whenNewMessage);
|
||||
that.chatRoomService.connectGoEasyIM();
|
||||
//获取当前聊天室数据
|
||||
that.room = that.chatRoomService.room;
|
||||
}
|
||||
})
|
||||
let shi = 0;
|
||||
@@ -321,7 +362,7 @@
|
||||
fen = parseInt(fen)
|
||||
miao = parseInt(miao)
|
||||
miao = miao + 1
|
||||
console.log(miao)
|
||||
// console.log(miao)
|
||||
if(miao == 60){
|
||||
miao = 0;
|
||||
fen +=1
|
||||
@@ -341,6 +382,11 @@
|
||||
}
|
||||
that.time = shi + ":" + fen + ":" + miao
|
||||
}, 1000);
|
||||
// var roomToken = JSON.parse(options.roomToken);
|
||||
|
||||
|
||||
// //获取当前聊天室数据
|
||||
// this.room = this.chatRoomService.room;
|
||||
// var config = {
|
||||
// appkey: 'mgb7ka1',
|
||||
// debug:true
|
||||
@@ -387,6 +433,19 @@
|
||||
|
||||
},
|
||||
methods: {
|
||||
whenNewMessage (message) {//新消息监听
|
||||
// if(message.type == this.room.MessageType.PROP){
|
||||
// this.propAnimation(parseInt(message.content))
|
||||
// }
|
||||
// setTimeout(() => {
|
||||
// this.contentPosition = 'message-box'+(this.room.messages.length-1);
|
||||
// }, 300)
|
||||
console.log(message)
|
||||
this.danmulist.push(message)
|
||||
if(this.danmulist.length > 7){
|
||||
this.danmulist = this.danmulist.slice(this.danmulist.length - 7)
|
||||
}
|
||||
},
|
||||
bindPickerChange(a){
|
||||
console.log(a.detail.value)
|
||||
this.meiyan = a.detail.value
|
||||
|
||||
276
static/chatservice.js
Normal file
276
static/chatservice.js
Normal file
@@ -0,0 +1,276 @@
|
||||
/*
|
||||
* @Author: jack.lu
|
||||
* @Date: 2020-4-21 10:10:20
|
||||
* @Last Modified by: jack.lu
|
||||
* @Last Modified time: 2020-4-21 15:01:41
|
||||
*/
|
||||
|
||||
|
||||
import GoEasyIM from './goeasy-im-1.0.9.js'
|
||||
|
||||
//用户
|
||||
function User(id, nickname, avatar) {
|
||||
this.id = id;
|
||||
this.nickname = nickname;
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
//消息
|
||||
function Message(senderUserId, senderNickname, content, type) {
|
||||
this.senderNickname = senderNickname;
|
||||
this.senderUserId = senderUserId;
|
||||
this.content = content;
|
||||
this.type = type
|
||||
}
|
||||
|
||||
//聊天室
|
||||
function Room(id, name, currentUser) {
|
||||
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.currentUser = currentUser;
|
||||
|
||||
this.onlineUsers = {
|
||||
count: 0,
|
||||
users: []
|
||||
};
|
||||
|
||||
this.messages = [];
|
||||
|
||||
this.MessageType = {
|
||||
CHAT: 0,//文字聊天
|
||||
PROP: 1//道具
|
||||
};
|
||||
|
||||
this.Prop = {
|
||||
HEART: 0,//桃心
|
||||
ROCKET: 1//火箭
|
||||
};
|
||||
}
|
||||
|
||||
function ChatRoomService(room, user) {
|
||||
this.room = new Room(room.id, room.name, user);
|
||||
this.whenNewMessage = function () {
|
||||
|
||||
};
|
||||
this.whenOnlineUserChange = function () {
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
//获取实例
|
||||
ChatRoomService.prototype.connectGoEasyIM = function () {
|
||||
this.im = GoEasyIM.getInstance({
|
||||
appkey: 'BC-453aa755c4ea48148abefc55a86df283',
|
||||
host: 'hangzhou.goeasy.io'
|
||||
});
|
||||
|
||||
//监听网络连接成功
|
||||
this.im.on(GoEasyIM.EVENT.CONNECTED, () => {
|
||||
console.log('GoEasyIM网络连接成功');
|
||||
//连接成功后,更新在线用户数和用户头像
|
||||
this.initialOnlineUsers(this.room.id);
|
||||
});
|
||||
|
||||
//监听网络连接断开
|
||||
this.im.on(GoEasyIM.EVENT.DISCONNECTED, () => {
|
||||
console.log('GoEasyIM网络断开')
|
||||
});
|
||||
|
||||
//监听上下线提醒
|
||||
this.listenerGroupPresence();
|
||||
|
||||
//监听新消息
|
||||
this.listenerNewMessage();
|
||||
|
||||
var currentUser = this.room.currentUser;
|
||||
//连接GoEasyIM
|
||||
this.im.connect({
|
||||
id: currentUser.id,
|
||||
data: {
|
||||
avatar: currentUser.avatar,
|
||||
nickname: currentUser.nickname
|
||||
}
|
||||
}).then(() => {
|
||||
console.log('连接成功');
|
||||
this.initialChatHistory(this.room.id);
|
||||
|
||||
//订阅用户上下线事件
|
||||
this.subscribePresence(this.room.id);
|
||||
//订阅聊天室消息
|
||||
this.subscribeRoomMessage(this.room.id);
|
||||
|
||||
|
||||
}).catch(e => {
|
||||
console.log(e);
|
||||
console.log('连接失败');
|
||||
});
|
||||
};
|
||||
|
||||
ChatRoomService.prototype.initialWhenNewMessage = function (whenNewMessage) {
|
||||
this.whenNewMessage = whenNewMessage;
|
||||
};
|
||||
|
||||
ChatRoomService.prototype.initialWhenOnlineUserChange = function (whenOnlineUserChange) {
|
||||
this.whenOnlineUserChange = whenOnlineUserChange;
|
||||
};
|
||||
|
||||
|
||||
//监听新消息
|
||||
ChatRoomService.prototype.listenerNewMessage = function () {
|
||||
|
||||
this.im.on(GoEasyIM.EVENT.GROUP_MESSAGE_RECEIVED, (message) => {
|
||||
var content = JSON.parse(message.payload.text);
|
||||
this.addNewMessage(message);
|
||||
this.whenNewMessage(content);
|
||||
})
|
||||
}
|
||||
|
||||
ChatRoomService.prototype.addNewMessage = function (message) {
|
||||
var content = JSON.parse(message.payload.text);
|
||||
let messageContent = "";
|
||||
//聊天消息
|
||||
if (content.type == this.room.MessageType.CHAT) {
|
||||
messageContent = content.content;
|
||||
}
|
||||
//道具消息
|
||||
if (content.type == this.room.MessageType.PROP) {
|
||||
if (content.content == this.room.Prop.ROCKET) {
|
||||
messageContent = "送出了一枚大火箭";
|
||||
}
|
||||
if (content.content == this.room.Prop.HEART) {
|
||||
messageContent = "送出了一个大大的比心";
|
||||
}
|
||||
}
|
||||
//添加消息
|
||||
let newMessage = new Message(message.senderId, content.senderNickname, messageContent);
|
||||
this.room.messages.push(newMessage);
|
||||
};
|
||||
|
||||
//监听用户上下线
|
||||
ChatRoomService.prototype.listenerGroupPresence = function () {
|
||||
this.im.on(GoEasyIM.EVENT.GROUP_PRESENCE, (event) => {
|
||||
//更新在线用户数
|
||||
this.room.onlineUsers.count = event.groupOnlineCount;
|
||||
|
||||
if (event.action == 'join' || event.action == 'online') {
|
||||
let userData = JSON.parse(event.userData);
|
||||
//添加新用户
|
||||
let user = new User(event.userId, userData.nickname, userData.avatar);
|
||||
|
||||
//添加在线用户,避免用户重复
|
||||
if (!this.room.onlineUsers.users.find(item => item.id == event.userId)) {
|
||||
this.room.onlineUsers.users.push(user);
|
||||
}
|
||||
|
||||
//添加进入房间的消息
|
||||
let message = new Message(event.userId, userData.nickname, " 进入房间", this.room.MessageType.CHAT);
|
||||
this.room.messages.push(message);
|
||||
} else {
|
||||
let offlineUserIndex = this.room.onlineUsers.users.findIndex(item => item.id == event.userId);
|
||||
if (offlineUserIndex > -1) {
|
||||
//将离开的用户从onlineUsers中删掉
|
||||
let offlineUser = Object.assign(this.room.onlineUsers.users[offlineUserIndex]);
|
||||
this.room.onlineUsers.users.splice(offlineUserIndex, 1);
|
||||
//添加离开消息
|
||||
let message = new Message(offlineUser.id, offlineUser.nickname, " 离开房间", this.room.MessageType.CHAT)
|
||||
this.room.messages.push(message);
|
||||
}
|
||||
}
|
||||
this.whenOnlineUserChange(this.room.onlineUsers);
|
||||
})
|
||||
};
|
||||
|
||||
//查询和初始化在线用户列表和在线用户数
|
||||
ChatRoomService.prototype.initialOnlineUsers = function (roomId) {
|
||||
let self = this;
|
||||
|
||||
//查询最新上线的用户列表
|
||||
this.im.groupHereNow(roomId)
|
||||
.then(result => {
|
||||
if (result.code == 200) {
|
||||
let users = [];
|
||||
result.content && result.content.map(function (onlineUser) {
|
||||
let userData = JSON.parse(onlineUser.userData);
|
||||
let user = new User(onlineUser.userId, userData.nickname, userData.avatar);
|
||||
users.push(user);
|
||||
});
|
||||
self.room.onlineUsers = {
|
||||
users: users
|
||||
};
|
||||
}
|
||||
}).catch(e => {
|
||||
if (e.code == 401) {
|
||||
console.log("您还没有开通用户在线状态提醒,登录goeasy->我的应用->查看详情->高级功能,自助开通.");
|
||||
} else {
|
||||
console.log(e);
|
||||
}
|
||||
});
|
||||
//获取聊天室在线用户数
|
||||
this.im.groupOnlineCount(roomId)
|
||||
.then(result => {
|
||||
this.room.onlineUsers.count = result.content.onlineCount;
|
||||
}).catch(e => {
|
||||
console.log(e)
|
||||
})
|
||||
};
|
||||
|
||||
//订阅聊天室成员上下线
|
||||
ChatRoomService.prototype.subscribePresence = function (roomId) {
|
||||
this.im.subscribeGroupPresence([roomId])
|
||||
.then(() => {
|
||||
console.log('成员上下线订阅成功')
|
||||
}).catch(e => {
|
||||
console.log(e)
|
||||
})
|
||||
}
|
||||
|
||||
//订阅聊天室消息
|
||||
ChatRoomService.prototype.subscribeRoomMessage = function (roomId) {
|
||||
this.im.subscribeGroup([roomId])
|
||||
.then(result => {
|
||||
console.log('消息订阅成功')
|
||||
}).catch(e => {
|
||||
console.log(e)
|
||||
})
|
||||
}
|
||||
|
||||
//历史消息
|
||||
ChatRoomService.prototype.initialChatHistory = function (roomId) {
|
||||
var self = this;
|
||||
this.im.history({
|
||||
groupId: roomId
|
||||
}).then(res => {
|
||||
res.content.forEach(function (message) {
|
||||
self.addNewMessage(message);
|
||||
})
|
||||
}).catch(function (error) {
|
||||
if (error.code == 401) {
|
||||
console.log("您还没有开通历史消息的权限,登录goeasy->我的应用->查看详情->高级功能,自助开通.");
|
||||
} else {
|
||||
console.log(error);
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
//发送消息
|
||||
ChatRoomService.prototype.sendMessages = function (roomId, content) {
|
||||
var contentMessage = {
|
||||
text: JSON.stringify(content)
|
||||
};
|
||||
let message = this.im.createTextMessage(contentMessage);
|
||||
this.im.sendGroupMessage(roomId, message)
|
||||
.then(() => {
|
||||
console.log('消息发送成功')
|
||||
}).catch(e => {
|
||||
console.log(e);
|
||||
})
|
||||
};
|
||||
|
||||
//退出聊天室
|
||||
ChatRoomService.prototype.quitRoom = function (roomId) {
|
||||
this.im.disconnect()
|
||||
};
|
||||
|
||||
module.exports = ChatRoomService;
|
||||
2
static/goeasy-im-1.0.9.js
Normal file
2
static/goeasy-im-1.0.9.js
Normal file
File diff suppressed because one or more lines are too long
10571
static/rongyun.js
10571
static/rongyun.js
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user