feat(order): 添加视频预览功能并调整订单相关接口

- 订单页跳转功能,增加 name 参数
- 对接视频预览和交付视频查询页
This commit is contained in:
fhysy 2025-03-04 17:52:29 +08:00
parent a7454355f4
commit ff0855c438
4 changed files with 279 additions and 125 deletions

View File

@ -144,4 +144,15 @@ export default {
}) })
}) })
}, },
// 用户确认预览视频(调整或确认)
materialAdjust(data){
return new Promise((resolve, reject) => {
request.post('/mall/material/adjust',data)
.then((res) =>{
resolve(res);
}).catch(err =>{
reject(err);
})
})
},
} }

View File

@ -22,126 +22,4 @@ export default {
}) })
}) })
}, },
// 获取订单商品列表
getMallclientOrderProductList(data){
return new Promise((resolve, reject) => {
request.get('/mallclient/clientorderItem/list',data)
.then((res) =>{
resolve(res);
}).catch(err =>{
reject(err);
})
})
},
// 查询订单商品素材模板列表
getProductMaterialDictList(data){
return new Promise((resolve, reject) => {
request.get('/mall/materialDict/listWithProduct',data)
.then((res) =>{
resolve(res);
}).catch(err =>{
reject(err);
})
})
},
// 查询订单商品素材列表(已有)
getMallOrderProductMaterialList(data){
return new Promise((resolve, reject) => {
request.get('/mall/material/list',data)
.then((res) =>{
resolve(res);
}).catch(err =>{
reject(err);
})
})
},
// 查询订单商品素材模板素材项列表
getProductMaterialDictItemList(data){
return new Promise((resolve, reject) => {
request.get('/mall/materialTemplate/listById',data)
.then((res) =>{
resolve(res);
}).catch(err =>{
reject(err);
})
})
},
// 删除文件
delOssFile(id){
console.log("id",id)
return new Promise((resolve, reject) => {
request.delete('/resource/oss/' + id)
.then((res) =>{
resolve(res);
}).catch(err =>{
reject(err);
})
})
},
// 订单素材列表(流程)
getOrderMaterialList(data){
return new Promise((resolve, reject) => {
request.get('/mall/orderMaterial/list',data)
.then((res) =>{
resolve(res);
}).catch(err =>{
reject(err);
})
})
},
// 新增订单素材(流程)
AddOrderMaterial(data){
return new Promise((resolve, reject) => {
request.post('/mall/orderMaterial',data)
.then((res) =>{
resolve(res);
}).catch(err =>{
reject(err);
})
})
},
// 修改素材(批量)
mallMaterialUpdateBatch(data){
return new Promise((resolve, reject) => {
request.put('/mall/material/updateBatch',data)
.then((res) =>{
resolve(res);
}).catch(err =>{
reject(err);
})
})
},
// 提交商品素材列表(完成)
mallMaterialCommit(orderId,productId){
return new Promise((resolve, reject) => {
request.put('/mall/material/commit/' + orderId + '/' + productId)
.then((res) =>{
resolve(res);
}).catch(err =>{
reject(err);
})
})
},
// 启动任务(流程)
startWorkFlow(data){
return new Promise((resolve, reject) => {
request.post('/workflow/task/startWorkFlow',data)
.then((res) =>{
resolve(res);
}).catch(err =>{
reject(err);
})
})
},
// 办理流程(流程)
completeTask(data){
return new Promise((resolve, reject) => {
request.post('/workflow/task/completeTask',data)
.then((res) =>{
resolve(res);
}).catch(err =>{
reject(err);
})
})
},
} }

265
pages/fun/videoView.vue Normal file
View File

@ -0,0 +1,265 @@
<template>
<view class="video-preview">
<!-- 视频播放区域 -->
<view class="video-container">
<video
v-if="videoUrl"
:src="videoUrl"
class="video-player"
controls
></video>
<u-empty v-else text="视频为空" src="play-circle"></u-empty>
</view>
<!-- 底部按钮区域 -->
<view class="btn-box" :class="adjustCount == 0?'one':''" v-if="routeParams.name === '视频预览' && formState!= 'confirm'">
<u-button
v-if="adjustCount !== 0"
type="default"
class="adjust-btn"
@click="showAdjustModal"
>视频调整</u-button>
<u-button
class="confirm-btn"
type="primary"
@click="showConfirmModal"
>确认视频</u-button>
</view>
<!-- 调整建议弹窗 -->
<u-popup
v-model="showAdjust"
@close="closeAdjustModal"
mode="center"
border-radius="10"
>
<view class="adjust-modal">
<view class="modal-title">调整建议</view>
<view class="adjust-count">剩余调整次数{{ adjustCount }}</view>
<u-input
v-model="adjustForm.message"
placeholder="请输入调整建议"
auto-height
type="textarea"
border
></u-input>
<view class="modal-buttons">
<u-button
@click="cancelAdjustment"
>取消</u-button>
<u-button
type="primary"
@click="submitAdjustment"
:disabled="adjustCount <= 0"
>提交</u-button>
</view>
</view>
</u-popup>
<!-- 确认弹窗 -->
<u-modal
v-model="showConfirm"
title="确认提示"
content="视频确认后将生成正式交付视频,并完成订单,是否要确认?"
@confirm="submitAdjustment"
@cancel="closeConfirmModal"
show-cancel-button
></u-modal>
</view>
</template>
<script>
export default {
data() {
return {
videoUrl: '', // URL
adjustmentSuggestion: '', //
showAdjust: false, //
showConfirm: false, //
videoStatus: 'preview',
routeParams:{
productId:'',
orderId:'',
orderItemId:'',
name:'',
},
adjustForm:{
businessKey: undefined,
state: 1,
message: undefined
},
adjustCount:0,
formState:'preview'
}
},
onLoad(option) {
if(option){
this.routeParams = option;
}
this.getInfo();
},
methods: {
async getInfo(){
let res = await this.$api.orderApi.getOrderMaterialList({ orderItemId: this.routeParams.orderItemId })
console.log("res",res)
if(res.rows.length!=0){
this.adjustForm.businessKey = res.rows[0].id;
if (this.routeParams.name === '视频预览') {
this.videoUrl = res.rows[0].resultPreview;
this.formState = res.rows[0].formState;
let count = res.rows[0].adjustCount || 0;
this.adjustCount = 3 - count > 0 ? 3 - count : 0;
} else {
this.videoUrl = res.rows[0].resultOutput;
}
}else{
}
},
//
showAdjustModal() {
this.adjustForm.state = 0;
this.adjustForm.message = '';
this.showAdjust = true;
},
//
closeAdjustModal() {
this.showAdjust = false
},
//
showConfirmModal() {
this.adjustForm.state = 1;
this.adjustForm.message = '';
this.showConfirm = true;
},
//
cancelAdjustment() {
this.adjustmentSuggestion = ''
this.showAdjust = false
},
//
async submitAdjustment() {
if (this.adjustCount <= 0 && this.adjustForm.state == 0) {
this.$u.toast('已达到最大调整次数')
return
}
let res = await this.$api.orderApi.materialAdjust(this.adjustForm)
console.log("res",res)
if(res.code == 200){
this.$u.toast('提交成功')
uni.navigateBack({
delta: 1
})
}else{
this.$u.toast(res.msg)
}
},
//
confirmVideo() {
// TODO:
this.$u.toast('视频已确认')
this.showConfirm = false
},
//
closeConfirmModal() {
this.showConfirm = false
}
}
}
</script>
<style>
page{
height: 100%;
background: #f5f5f5;
}
</style>
<style lang="scss" >
.video-preview {
height: 100%;
display: flex;
flex-direction: column;
padding-bottom: 120rpx;
.video-container {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
padding: 20rpx;
.video-player {
border-radius: 20rpx;
width: 100%;
max-height: 100%;
// height: 400rpx;
}
}
.btn-box {
display: flex;
justify-content: space-around;
align-items: center;
height: 120rpx;
position: fixed;
left: 0;
right: 0;
bottom: 0;
background: #fff;
z-index: 999;
button{
width: 340rpx;
height: 85rpx;
border-radius: 10rpx;
display: flex;
justify-content: center;
align-items: center;
}
&.one{
button{
width: 680rpx;
}
}
}
.adjust-modal {
background-color: #fff;
padding: 30rpx;
width: 600rpx;
.modal-title {
font-size: 32rpx;
font-weight: bold;
text-align: center;
margin-bottom: 20rpx;
}
.adjust-count {
font-size: 28rpx;
color: #ff0000;
margin-bottom: 20rpx;
}
.modal-buttons {
display: flex;
margin-top: 30rpx;
justify-content: space-around;
align-items: center;
button{
width: 260rpx;
height: 85rpx;
border-radius: 10rpx;
display: flex;
justify-content: center;
align-items: center;
}
}
}
}
</style>

View File

@ -40,7 +40,7 @@
size="mini" size="mini"
plain plain
type="primary" type="primary"
@click="goFun(val.funPath, val.productId, item.id, val.id)" @click="goFun(val.funPath, val.productId, item.id, val.id, val.funName)"
>{{ val.funName }}</u-button> >{{ val.funName }}</u-button>
</view> </view>
<!-- <view class="product-specs"> <!-- <view class="product-specs">
@ -269,10 +269,10 @@ export default {
url: `/pages/order/detail?id=${item.id}` url: `/pages/order/detail?id=${item.id}`
}) })
}, },
goFun(path, productId, orderId, orderItemId){ goFun(path, productId, orderId, orderItemId, name){
console.log("path",path, productId, orderId) console.log("path",path, productId, orderId)
uni.navigateTo({ uni.navigateTo({
url: `/pages${path}?productId=${productId}&orderId=${orderId}&orderItemId=${orderItemId}` url: `/pages${path}?productId=${productId}&orderId=${orderId}&orderItemId=${orderItemId}&name=${name}`
}) })
} }
} }