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.
 
 
 
 
 
 
zhishifufei_php/application/kefu/view/dashboard/mobile_order.php

621 lines
20 KiB

{extend name="public/container"}
{block name="title"}订单列表{/block}
{block name="head"}
<style>
.pos-order-goods {
padding: 0 0.3rem;
background-color: #fff;
}
.pos-order-goods .goods {
height: 1.85rem;
}
.pos-order-goods .goods~.goods {
border-top: 1px dashed #e5e5e5;
}
.pos-order-goods .goods .picTxt {
width: 5.15rem;
}
.pos-order-goods .goods .picTxt .pictrue {
width: 1.3rem;
height: 1.3rem;
}
.pos-order-goods .goods .picTxt .pictrue img {
width: 100%;
height: 100%;
border-radius: 0.06rem;
}
.pos-order-goods .goods .picTxt .text {
width: 3.65rem;
height: 1.3rem;
}
.pos-order-goods .goods .picTxt .text .info {
font-size: 0.28rem;
color: #282828;
}
.pos-order-goods .goods .picTxt .text .attr {
font-size: 0.2rem;
color: #999;
height: 0.8rem;
line-height: 0.8rem;
}
.pos-order-goods .goods .money {
width: 1.64rem;
text-align: right;
font-size: 0.28rem;
height: 1.3rem;
}
.pos-order-goods .goods .money .x-money {
color: #282828;
}
.pos-order-goods .goods .money .num {
color: #ff9600;
margin: 0.05rem 0;
}
.pos-order-goods .goods .money .y-money {
color: #999;
text-decoration: line-through;
}
.pos-order-list {
display: flex;
flex-direction: column;
background: #f5f5f5;
height: 100%;
}
.pos-order-list .head-box {
width: 100%;
background-color: #fff;
}
.pos-order-list .head-box .input-box {
width: 6.9rem;
margin: 0.2rem auto;
background: #f5f6f9;
border-radius: 0.39rem;
}
.pos-order-list .head-box .input-box>>>.ivu-input {
font-size: 0.28rem !important;
background: #f5f6f9;
border-radius: 0.39rem;
}
.pos-order-list .head-box .input-box>>>.ivu-input,
.pos-order-list .head-box .input-box .ivu-input:hover,
.pos-order-list .head-box .input-box .ivu-input:focus {
border: transparent;
box-shadow: none;
}
.pos-order-list .nav {
width: 100%;
height: 0.8rem;
font-size: 0.3rem;
color: #282828;
display: flex;
align-items: center;
}
.pos-order-list .nav .item {
position: relative;
line-height: 0.8rem;
}
.pos-order-list .nav .item.on {
color: #3875ea;
border-bottom: 1px solid #3875ea;
}
.pos-order-list .list {
flex: 1;
margin-top: 0.1rem;
overflow: hidden;
}
.pos-order-list .list .item {
background-color: #fff;
width: 100%;
}
.pos-order-list .list .item~.item {
margin-top: 0.24rem;
}
.pos-order-list .list .item .order-num {
height: 1.24rem;
border-bottom: 1px solid #eee;
font-size: 0.3rem;
font-weight: bold;
color: #282828;
padding: 0 0.3rem;
}
.pos-order-list .list .item .order-num .time {
font-size: 0.26rem;
font-weight: normal;
color: #999;
margin-top: -0.4rem;
}
.pos-order-list .list .item .operation {
padding: 0.2rem 0.3rem;
margin-top: 0.03rem;
}
.pos-order-list .list .item .operation .more {
position: relative;
}
.pos-order-list .list .item .operation .icon-gengduo {
font-size: 0.5rem;
color: #aaa;
}
.pos-order-list .list .item .operation .order .arrow {
width: 0;
height: 0;
border-left: 0.11rem solid transparent;
border-right: 0.11rem solid transparent;
border-top: 0.2rem solid #e5e5e5;
position: absolute;
left: 0.15rem;
bottom: -0.18rem;
}
.pos-order-list .list .item .operation .order .arrow:before {
content: '';
width: 0;
height: 0;
border-left: 0.07rem solid transparent;
border-right: 0.07rem solid transparent;
border-top: 0.2rem solid #fff;
position: absolute;
left: -0.07rem;
bottom: 0;
}
.pos-order-list .list .item .operation .order {
width: 2rem;
background-color: #fff;
border: 1px solid #eee;
border-radius: 0.1rem;
position: absolute;
top: -1rem;
z-index: 9;
}
.pos-order-list .list .item .operation .order .items {
height: 0.77rem;
line-height: 0.77rem;
text-align: center;
}
.pos-order-list .list .item .operation .order .items~.items {
border-top: 1px solid #f5f5f5;
}
.pos-order-list .list .item .operation .bnt {
font-size: 0.28rem;
color: #5c5c5c;
width: 1.7rem;
height: 0.6rem;
border-radius: 0.3rem;
border: 1px solid #bbb;
text-align: center;
line-height: 0.6rem;
}
.pos-order-list .list .item .operation .bnt~.bnt {
margin-left: 0.14rem;
}
.public-total {
font-size: 0.28rem;
color: #282828;
border-top: 1px solid #eee;
height: 0.92rem;
line-height: 0.92rem;
text-align: right;
padding: 0 0.3rem;
background-color: #fff;
}
.public-total .money {
color: #ff4c3c;
}
.acea-row,
.c_row-item {
display: flex;
}
.acea-row {
flex-wrap: wrap;
}
.acea-row.row-middle {
align-items: center;
}
.acea-row.row-between-wrapper {
justify-content: space-between;
}
.acea-row.row-between-wrapper,
.acea-row.row-center-wrapper {
align-items: center;
}
.top-box {
position: relative;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
height: 45px;
background: linear-gradient(85deg, #3875ea 0%, #1890fc 100%);
}
.top-box span {
position: absolute;
width: 45px;
height: 100%;
left: 0;
top: 0;
text-align: center;
line-height: 45px;
}
</style>
<script>
document.documentElement.style.fontSize = "calc(100vw/7.5)";
</script>
{/block}
{block name="content"}
<div class="pos-order-list" ref="container" id="app" v-cloak>
<div class="top-box">
<div class="back" @click="goBack"><span class="iconfont iconfanhui"></span></div>
<div class="title">订单列表</div>
</div>
<div class="head-box">
<div class="input-box">
<i-select v-model="where.type" @on-change="changeStatus">
<i-option :value="item.id" v-for="item of orderTypeList" :key="item.id">{{ item.title }}</i-option>
</i-select>
</div>
<div class="input-box">
<i-input placeholder="搜索订单编号" v-model="where.search" @on-enter="bindSearch"></i-input>
</div>
</div>
<div class="list">
<vue-scroll :ops="ops" @load-before-deactivate="handleWordsScroll" ref="scrollBox" style="height: 100%">
<div class="slot-load" slot="load-deactive"></div>
<div class="slot-load" slot="load-beforeDeactive"></div>
<div class="slot-load" slot="load-active">下滑加载更多</div>
<template v-if="list.length > 0">
<div class="item" v-for="(item, index) in list" :key="index">
<div class="order-num acea-row row-middle">
订单号:{{ item.order_id }}
<span class="time">下单时间:{{ item.add_time }}</span>
</div>
<div class="pos-order-goods" v-for="(val, key) in item.cartInfo" :key="key">
<div class="goods acea-row row-between-wrapper">
<div class="picTxt acea-row row-between-wrapper">
<div class="pictrue">
<img :src="val.image" />
</div>
<div class="text ">
<div class="info line2">
{{ val.title }}
</div>
</div>
</div>
<div class="money">
<div class="x-money">¥{{ val.money }}</div>
<div class="num">x{{ val.cart_num }}</div>
<div class="y-money">
</div>
</div>
</div>
</div>
<div class="public-total">
共{{ item.total_num }}件商品,应支付
<span class="money">¥{{ item.pay_price }}</span> ( 邮费 ¥{{
item.pay_postage
}}
)
</div>
<div class="operation acea-row row-between-wrapper">
<div class="more">
</div>
<div class="acea-row row-middle">
<div class="bnt" @click="bindRemark(item)" v-if=" where.type < 3">订单备注</div>
<div class="bnt" @click="orderRecord(item)" v-if="item.paid && ( where.type < 3 &&item.refund_status == 1 || where.type == 4 && item.refund_status != 2 || where.type == 5 && item.refund_status != 2 || where.type == 6 && item.refund_status != 2 || where.type == 7 && item.refund_status != 2)">
立即退款
</div>
</div>
</div>
</div>
</template>
<empty v-if="list.length == 0" status="3" msg="暂无订单信息"></empty>
</vue-scroll>
</div>
</div>
{/block}
{block name="script"}
<script>
require([
'layer',
"vue",
"kefu-assets/api/kefu",
"iview",
"dayjs",
"happy-scroll",
"vue-scroll",
"kefu-assets/components/empty/index",
], (layer, Vue, kefuApi, iView, dayjs, happyScroll, vueScroll, empty) => {
Vue.use(happyScroll.default);
Vue.use(iView);
Vue.use(vueScroll);
new Vue({
el: "#app",
name: "AdminOrderList",
props: {},
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 {
toUid: "{$userInfo.uid}",
current: "",
change: false,
orderTypeList,
orderType: orderTypeList[0].id,
where: {
uid: "{$userInfo.uid}",
page: 1,
limit: 15,
search: '',
type: orderTypeList[0].id,
},
list: [],
loaded: false,
loading: false,
orderInfo: {},
status: null,
ops: {
vuescroll: {
mode: 'slide',
enable: false,
tips: {
deactive: 'Push to Load',
active: 'Release to Load',
start: 'Loading...',
beforeDeactive: 'Load Successfully!'
},
auto: false,
autoLoadDistance: 0,
pullRefresh: {
enable: false
},
pushLoad: {
enable: true,
auto: true,
autoLoadDistance: 10
}
},
bar: {
background: '#393232',
opacity: '.5',
size: '2px'
}
},
};
},
created() {
this.current = "";
this.getIndex();
},
methods: {
goBack() {
window.history.length > 1 ? window.history.back() : (window.location.href = "{:Url('index')}");
},
orderRecord(order) {
this.$Modal.confirm({
title: "确定要退款吗?",
onOk: () => {
kefuApi.requestRefundOrder(order.id, this.where.type)
.then(res => {
this.$Message.success(res.msg);
this.init();
})
.catch(err => {
this.$Message.error(err.msg);
});
}
})
},
bindRemark(item) {
layer.prompt({
formType: 2,
value: item.mark || "",
title: '请输入备注',
}, (value, index, elem) => {
layer.close(index);
if (!value) return this.$Message.info("请输入备注内容!");
kefuApi.orderRemark({
order_id: item.order_id,
remark: value,
order_type: item.type
}).then(res => {
this.$Message.success(res.msg);
item.mark = value;
}).catch(error => {
this.$Message.error(error.msg)
})
});
},
// 搜索回车
bindSearch() {
this.init()
},
// 拒绝退款
getRefuse(id) {
orderRefuseApi(data).then(() => {
that.change = false;
that.$dialog.success("已拒绝退款");
that.init();
}).catch((error) => {
that.$dialog.error(error.message);
});
},
init() {
this.list = [];
this.where.page = 1;
this.loaded = false;
this.loading = false;
this.getIndex();
this.current = "";
},
getIndex() {
if (this.loading || this.loaded) return;
this.loading = true;
kefuApi.getorderList(this.where).then(
res => {
this.loading = false;
this.loaded = res.data.length < this.where.limit;
this.where.page = this.where.page + 1;
this.$nextTick(() => {
// if (this.list.length > 0)
// this.$refs['scrollBox'].refresh();
})
const orderType = this.where.type;
this.list = this.list.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;
}));
},
err => {
this.$dialog.error(err.msg);
}
);
},
changeStatus(val) {
this.init();
},
// 滚动到底部
handleWordsScroll(vm, refreshDom, done) {
this.getIndex()
done();
},
}
})
});
</script>
{/block}