新增订单管理

This commit is contained in:
唐明明
2023-07-10 17:25:27 +08:00
parent e37f23be46
commit ae5827a6fd
9 changed files with 436 additions and 41 deletions

16
.hbuilderx/launch.json Normal file
View File

@@ -0,0 +1,16 @@
{ // launch.json 配置了启动调试时相关设置configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
// launchtype项可配置值为local或remote, local代表前端连本地云函数remote代表前端连云端云函数
"version": "0.0",
"configurations": [{
"app-plus" :
{
"launchtype" : "local"
},
"default" :
{
"launchtype" : "local"
},
"type" : "uniCloud"
}
]
}

View File

@@ -5,6 +5,7 @@
*/
import store from '@/store'
import { router } from '@/router/index.js'
// 基础配置
const config = {
@@ -142,12 +143,12 @@ const loginHint = () => {
uni.showModal({
title: '登录提示',
content: '您的登录信息已过期,请重新登录',
confirmColor: '#8b64fd',
confirmColor: '#da2b56',
showCancel:false,
success: res=> {
loginHintState = false
if (res.confirm) uni.reLaunch({
url: '/index/index'
if (res.confirm) router.replaceAll({
name: 'Login'
})
}
})

View File

@@ -39,21 +39,25 @@ const buy = data => {
})
}
// 核验列表
const codes = code => {
// 订单列表初始化
const orderInit = () => {
return request({
url : "empower/code",
data : { code },
method : "POST",
url : "empower/order/init",
})
}
// 确认核验
const sign = item_id => {
// 订单列表
const orderList = data => {
return request({
url : "empower/code/sign",
data : { item_id },
method : "POST",
url : "empower/order/index",
data
})
}
// 取消订单
const orderCancel = order => {
return request({
url : "empower/order/" + order + "/cancel",
})
}
@@ -62,7 +66,8 @@ export {
info,
buyInit,
buy,
codes,
sign
orderInit,
orderList,
orderCancel
}

View File

@@ -4,7 +4,7 @@
"html2canvas": "^1.4.1",
"jweixin-module": "^1.6.0",
"uni-read-pages": "^1.0.5",
"uni-simple-router": "^2.0.8-beta.4",
"uni-simple-router": "2.0.7",
"uview-ui": "^2.0.31",
"vconsole": "^3.15.0",
"vue-canvas-poster": "^1.2.1",

View File

@@ -635,15 +635,15 @@
}
}
}
}
,{
},{
"path" : "pages/empower/order",
"style" :
{
"aliasPath": "/empower/order",
"name": "EmpowerOrder",
"style" :{
"navigationBarTitleText": "赋能订单",
"enablePullDownRefresh": false
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#FFF"
}
}
],
"globalStyle": {

View File

@@ -31,7 +31,6 @@
<rich-text :nodes="content"></rich-text>
<!-- 报名信息 -->
<view class="footer">
<view>分享</view>
<view class="footer-btn" @click="onBuy">立即购买</view>
</view>
</view>
@@ -131,6 +130,6 @@
z-index: 99;
background-color: white;
box-shadow: 0 0 10rpx 10rpx rgba(0, 0, 0, .04);
.footer-btn{ background: $mian-color; color: white; line-height: 100rpx; border-radius: 50rpx; flex: 1; text-align: center; font-weight: bold; font-size: 36rpx; margin-left: 50rpx; }
.footer-btn{ background: $mian-color; color: white; line-height: 100rpx; border-radius: 50rpx; flex: 1; text-align: center; font-weight: bold; font-size: 36rpx; }
}
</style>

View File

@@ -1,19 +1,398 @@
<template>
<view>
order
<view class="content">
<!-- tabs -->
<u-sticky bgColor="#FFF" zIndex="9" >
<view class="screen-flex">
<view class="screen-picker">
<picker :range="statusArr" range-key="title" :value="statusIndex" @change="onPickerChange($event, 'statusIndex')">
<view class="screen-text nowrap">
{{ statusArr[statusIndex].title }}
<uni-icons class="screen-icon" type="bottom" size="32rpx" color="#999"></uni-icons>
</view>
</picker>
</view>
<view class="screen-picker">
<picker :range="empowerArr" range-key="title" :value="empowerIndex" @change="onPickerChange($event, 'empowerIndex')">
<view class="screen-text nowrap">
{{ empowerArr[empowerIndex].title }}
<uni-icons class="screen-icon" type="bottom" size="32rpx" color="#999"></uni-icons>
</view>
</picker>
</view>
</view>
</u-sticky>
<!-- 订单管理列表 -->
<view class="orders" v-if="orders.length > 0">
<view class="orders-item" v-for="(item, index) in orders" :key="index">
<view class="orders-flex">
<view class="no nowrap" @click="copyNo(item.order_no)">
<text class="orders-tag" v-if="!item.is_my">客户</text>
<text class="orders-tag order-tag-my" v-else>个人</text>
{{item.order_no}}
</view>
<view class="state">{{item.status_text}}</view>
</view>
<view class="orders-content">
<view class="orders-content-item">
<label>课程名称</label>
<view class="nowrap orders-content-type">{{item.empower.title}}</view>
</view>
<view class="orders-content-item orders-content-bottom" @click="item.is_show_type = !item.is_show_type">
<label>课程数量</label>
<view class="nowrap orders-content-type">
×{{item.items.count}}
</view>
<uni-icons class="orders-content-icon" :type="item.is_show_type ? 'top': 'bottom'" size="14" color="gray"></uni-icons>
</view>
<view class="orders-content-block" v-show="item.is_show_type">
<view class="item-flex" v-for="(citem, cindex) in item.items.lists" :key="cindex">
<view class="item-flex-title">{{citem.semester.subtitle}}({{citem.name}})</view>
<view class="item-flex-value">{{citem.price}}</view>
</view>
</view>
<view class="orders-content-item">
<label>支付金额</label>
<view class="nowrap">{{item.price}}</view>
</view>
<view class="orders-content-item">
<label>下单时间</label>
<view class="nowrap">{{item.paid_at}}</view>
</view>
</view>
<view class="orders-flex">
<view class="btns">
<view class="btns-item btns-border" v-if="item.status == 0" @click="onCancel(item.order_id)">取消</view>
<view class="btns-item btns-border" v-if="item.status == 0">支付</view>
<view class="btns-item" @click="onShowUsers(item.items)">报名信息</view>
</view>
</view>
</view>
<!-- 分页 -->
<u-loadmore v-if="pagesShow" :status="status" />
</view>
<!-- 订单是空的 -->
<view class="order-null" v-else>
<u-empty
mode="order"
icon="http://cdn.uviewui.com/uview/empty/order.png"
text="暂无相关订单"
>
</u-empty>
</view>
<!-- 弹出报名人信息 -->
<u-popup :show="usersShow" closeable round="30rpx" @close="usersShow = false">
<view class="users-content">
<view class="users-title">报名信息</view>
<view class="users-lists">
<view class="users-lists-item" v-for="(item, index) in users" :key="index">
<view class="users-item nowrap"><label>报名姓名</label>{{item.name}}</view>
<view class="users-item nowrap"><label>报名手机</label>{{item.mobile}}</view>
<view class="users-item nowrap"><label>课程名称</label>{{item.semester.subtitle}}</view>
<view class="users-item nowrap"><label>签到状态</label><text class="bold">{{item.status_text}}</text></view>
<view class="users-item"><label>课程地址</label>{{item.semester.address}}</view>
</view>
</view>
</view>
</u-popup>
</view>
</template>
<script>
import { orderInit, orderList, orderCancel } from '@/apis/interfaces/empower.js'
export default {
data() {
return {
statusArr : [{ title: '全部订单', id: '' }],
empowerArr : [{ title: '全部课程', id: '' }],
statusIndex : 0,
empowerIndex: 0,
// 报名信息
users : [],
usersTotal : 0,
usersShow : false,
// 订单列表
orders : [],
// 分页
page : {
current : 1,
has_more: false,
},
pagesShow : false,
status : ''
};
},
created() {
orderInit().then(res => {
let { status, empower } = res;
this.statusArr = status
this.empowerArr = [...this.empowerArr, ...empower]
// 获取列表
this.getList()
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
},
methods: {
// 报名信息
onShowUsers(obj){
let { count, lists } = obj
this.users = lists
this.usersTotal = count
this.usersShow = true
},
// 筛选类型
onPickerChange(e, key){
let { value } = e.detail
this[key] = value
this.page = { current: 1, has_more: false }
this.orders = []
this.getList()
},
// 获取列表
getList(){
uni.showLoading({
title: '加载中...',
mask : true
})
orderList({
status : this.statusArr[this.statusIndex].id,
empower : this.empowerArr[this.empowerIndex].id,
page : this.page.current ,
}).then(res => {
let { data, page } = res;
data.map(val => {
val.is_show_type = false
})
let atList = page.current == 1 ? [] : this.orders
this.orders = atList.concat(data)
this.page = page
this.pagesShow = false
uni.hideLoading()
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
},
// 复制订单号码
copyNo(no){
uni.setClipboardData({
data : no,
success : res => {
uni.showToast({
title: '订单号已复制',
icon : 'none'
})
}
})
},
// 取消订单
onCancel(id){
uni.showModal({
title : '提示',
content : '取消订单后无法找回,确认取消吗?',
success : modalRes => {
if(modalRes.confirm){
uni.showLoading({
title: '加载中...',
mask : true
})
orderCancel(id).then(res => {
uni.showToast({
title: '订单已取消',
icon : 'none'
})
this.removeListVal(id)
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
}
}
})
},
// 变更当前列表状态
removeListVal(id){
let ListArr = this.orders
let ListIndex = ListArr.findIndex(val => val.business_order_id == id)
if(ListIndex >= 0){
this.orders.splice(ListIndex, 1)
}
}
},
onReachBottom() {
this.pagesShow = true;
if(this.page.has_more){
this.status = 'loading';
this.page.current++
this.getList()
return
}
this.status = 'nomore';
}
}
</script>
<style lang="scss">
<style lang="scss" scoped>
.content{ background: #f7f8f9; min-height: calc(100vh - 44px); }
// 订单弹出层
.users-content{
.users-title{
text-align: center;
font-weight: bold;
font-size: 44rpx;
color: #333;
height: 70rpx;
line-height: 70rpx;
padding: 30rpx;
}
.users-lists{
padding: 0 30rpx 50rpx;
max-height: 70vh;
overflow-y: scroll;
.users-lists-item{
background: #f7f8f9;
padding: 30rpx;
border-radius: 20rpx;
font-size: 30rpx;
margin-bottom: 30rpx;
.users-item{
position: relative;
line-height: 45rpx;
min-height: 45rpx;
padding-left: 160rpx;
margin: 5rpx 0;
text-align: right;
label{ position: absolute; left: 0; top: 0; color: gray; }
.bold{ font-weight: bold; color: $mian-color; }
}
}
}
}
// 订单筛选
.screen-flex{
display: flex;
flex-wrap: wrap;
.screen-picker{ width: 50%; text-align: center; }
.screen-text{ line-height: 90rpx; height: 90rpx; display: inline-block; font-size: 30rpx; }
.screen-icon{ margin-left: 10rpx; }
}
// 订单为空
.order-null{
height: 80vh;
display: flex;
justify-content: center;
align-items: center;
}
// 订单列表
.orders{
padding: 30rpx 0 10rpx;
.orders-item{
margin: 0 30rpx 20rpx;
background-color: white;
border-radius: $radius;
}
.orders-content{
padding: 20rpx 30rpx;
&-item{
line-height: 70rpx;
display: flex;
justify-content: space-between;
font-size: 30rpx;
color: #111111;
label{
color: #999999;
}
&.orders-content-bottom{
padding-right: 40rpx;
position: relative;
.orders-content-icon{
position: absolute;
right: 0;
top: 0;
}
}
}
&-block{
background: rgba(68, 110, 254, .03);
padding: 20rpx;
font-size: 28rpx;
border-radius: 10rpx;
margin: 10rpx 0;
.item-flex{
display: flex;
justify-content: space-between;
line-height: 50rpx;
}
}
}
.orders-flex{
border-bottom: solid 1rpx #F6F6F6;
display: flex;
justify-content: space-between;
align-items: center;
padding: 20rpx $padding;
&:last-child{
border-top: solid 1rpx #F6F6F6;
border-bottom: none;
}
.orders-tag{
display: inline-block;
background: $mian-color;
font-size: 26rpx;
color: white;
border-radius: 10rpx;
padding: 0 10rpx;
height: 40rpx;
line-height: 40rpx;
margin-right: 10rpx;
&.order-tag-my{
background: $mian-color;
}
}
.no{
font-size: 30rpx;
color: #111;
line-height: 60rpx;
width: calc(100% - 150rpx);
}
.state{
color: $mian-color;
font-weight: bold;
font-size: 30rpx;
line-height: 60rpx;
width: 150rpx;
text-align: right;
}
.btns{
text-align: right;
width: 100%;
.btns-item{
display: inline-block;
height: 70rpx;
line-height: 70rpx;
background: $mian-color;
color: white;
border-radius: 35rpx;
padding: 0 30rpx;
font-size: 30rpx;
&.btns-border{
line-height: 68rpx;
box-sizing: border-box;
border:solid 1rpx $mian-color;
background: white;
color: $mian-color;
margin-right: 20rpx;
}
}
}
}
}
</style>

View File

@@ -71,7 +71,7 @@
</view>
<img class="userSee-icon" src="https://douhuo-storage.oss-cn-beijing.aliyuncs.com/images/2023/06/19/08e5c39f136d84e9754d4ac4d16af181.png">
</view>
<view class="userTop-label">
<view class="userTop-label" @click="$Router.push({name: 'EmpowerOrder'})">
<view class="userSee-name">
增收赋能类
</view>
@@ -115,15 +115,10 @@
其他工具
</view>
<view class="tool-item">
<view class="tool-lable">
<img class="tool-icon" src="@/static/imgs/userTool_01.png">
<view class="tool-name">我的订单券</view>
</view>
<view class="tool-lable" @click="$Router.push({name: 'indexCollect'})">
<img class="tool-icon" src="@/static/imgs/userTool_01.png">
<view class="tool-name">我的收藏</view>
</view>
<!-- style="display: none;" -->
<view class="tool-lable" @click="$Router.push({name: 'Manage'})">
<img class="tool-icon" src="@/static/imgs/userTool_03.png">
<view class="tool-name">信息管理</view>

View File

@@ -124,10 +124,10 @@ uni-read-pages@^1.0.5:
resolved "https://registry.yarnpkg.com/uni-read-pages/-/uni-read-pages-1.0.5.tgz#452c8dcaa8977bbaef600909be926c8d9704387c"
integrity sha512-GkrrZ0LX0vn9R5k6RKEi0Ez3Q3e2vUpjXQ8Z6/K/d28KudI9ajqgt8WEjQFlG5EPm1K6uTArN8LlqmZTEixDUA==
uni-simple-router@^2.0.8-beta.4:
version "2.0.8-beta.4"
resolved "https://registry.yarnpkg.com/uni-simple-router/-/uni-simple-router-2.0.8-beta.4.tgz#2f86ef17b361c251e14361ffd860a82669770cc5"
integrity sha512-ipTHhOaRvjV8qrt3HosX5pNMhwFYBnFOuKyV5joH0evfXubjrGI5tjdwpmwzfW5h3VBth3iAqScv+pW/QmIJXw==
uni-simple-router@2.0.7:
version "2.0.7"
resolved "https://registry.yarnpkg.com/uni-simple-router/-/uni-simple-router-2.0.7.tgz#04e0b5be6cd733a1ecb9d35a3dbe82f27f48204e"
integrity sha512-8FKv5dw7Eoonm0gkO8udprrxzin0fNUI0+AvIphFkFRH5ZmP5ZWJ2pvnWzb2NiiqQSECTSU5VSB7HhvOSwD5eA==
utrie@^1.0.2:
version "1.0.2"