💥 feat(compiler):
- 调整api,和请求封装,登录地址 - 登录页适配域名和请求参数自动选择(小程序未适配) - 调整对接订单、消息页 - 添加素材录入页面、订单和消息详情页
This commit is contained in:
parent
45d08abd36
commit
e6ee77f170
24
App.vue
24
App.vue
|
@ -53,4 +53,28 @@
|
|||
min-height: 100%;
|
||||
}
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
<style lang="scss">
|
||||
.dict-item{
|
||||
&.info{
|
||||
color: #909399 !important;
|
||||
}
|
||||
&.primary{
|
||||
color: #409eff !important;
|
||||
}
|
||||
&.success{
|
||||
color: #67c23a !important;
|
||||
}
|
||||
&.danger{
|
||||
color: #f56c6c !important;
|
||||
}
|
||||
&.warning{
|
||||
color: #e6a23c !important;
|
||||
}
|
||||
&.default{
|
||||
color: #409eff !important;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -1,6 +1,8 @@
|
|||
// import request from './request.js'
|
||||
import {request} from './request.js'
|
||||
|
||||
export default{
|
||||
// 订单,模块
|
||||
orderApi:require("./orderApi.js").default,
|
||||
/*
|
||||
* 登录相关
|
||||
*/
|
||||
|
@ -14,5 +16,55 @@ export default{
|
|||
})
|
||||
})
|
||||
},
|
||||
|
||||
// 消息相关
|
||||
getNewList(data) {// 获取消息列表
|
||||
return new Promise((resolve, reject) => {
|
||||
request.get('/system/notice/personal',data)
|
||||
.then((res) =>{
|
||||
resolve(res);
|
||||
}).catch(err =>{
|
||||
reject(err);
|
||||
})
|
||||
})
|
||||
},
|
||||
getNewDetetail(id) {// 获取消息详情
|
||||
return new Promise((resolve, reject) => {
|
||||
request.get('/system/notice/' + id)
|
||||
.then((res) =>{
|
||||
resolve(res);
|
||||
}).catch(err =>{
|
||||
reject(err);
|
||||
})
|
||||
})
|
||||
},
|
||||
readNew(data) {// 阅读消息
|
||||
return new Promise((resolve, reject) => {
|
||||
request.put('/system/notice/read',data)
|
||||
.then((res) =>{
|
||||
resolve(res);
|
||||
}).catch(err =>{
|
||||
reject(err);
|
||||
})
|
||||
})
|
||||
},
|
||||
getDictList(type) {// 获取消息详情
|
||||
return new Promise((resolve, reject) => {
|
||||
request.get('/system/dict/data/type/' + type)
|
||||
.then((res) =>{
|
||||
resolve(res);
|
||||
}).catch(err =>{
|
||||
reject(err);
|
||||
})
|
||||
})
|
||||
},
|
||||
getOssDetail(id) {// 获取oss文件详情
|
||||
return new Promise((resolve, reject) => {
|
||||
request.get('/resource/oss/listByIds/' + id)
|
||||
.then((res) =>{
|
||||
resolve(res);
|
||||
}).catch(err =>{
|
||||
reject(err);
|
||||
})
|
||||
})
|
||||
},
|
||||
}
|
|
@ -0,0 +1,147 @@
|
|||
import {request} from './request'
|
||||
export default {
|
||||
// 获取订单列表
|
||||
getOrderList(data){
|
||||
return new Promise((resolve, reject) => {
|
||||
request.get('/mallClient/order/list',data)
|
||||
.then((res) =>{
|
||||
resolve(res);
|
||||
}).catch(err =>{
|
||||
reject(err);
|
||||
})
|
||||
})
|
||||
},
|
||||
// 获取订单详情
|
||||
getOrderDetail(id){
|
||||
return new Promise((resolve, reject) => {
|
||||
request.get('/mallClient/order/'+id)
|
||||
.then((res) =>{
|
||||
resolve(res);
|
||||
}).catch(err =>{
|
||||
reject(err);
|
||||
})
|
||||
})
|
||||
},
|
||||
// 获取订单商品列表
|
||||
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);
|
||||
})
|
||||
})
|
||||
},
|
||||
}
|
|
@ -62,7 +62,7 @@ request.interceptors.response.use(function(response) { //不要使用箭头函
|
|||
try{
|
||||
store.commit('logout');
|
||||
uni.reLaunch({
|
||||
url: '/pages/auth/login'
|
||||
url: '/pages/auth/passwordLogin'
|
||||
})
|
||||
} catch(err) {
|
||||
console.log(err);
|
||||
|
@ -106,7 +106,7 @@ request.interceptors.response.use(function(response) { //不要使用箭头函
|
|||
* @param data
|
||||
* @returns {Promise}
|
||||
*/
|
||||
export function post(url, params) {
|
||||
function post(url, params) {
|
||||
return new Promise((resolve, reject) => {
|
||||
request.post(url, params)
|
||||
.then(response => {
|
||||
|
@ -121,7 +121,7 @@ export function post(url, params) {
|
|||
}
|
||||
|
||||
|
||||
export function get(url, params) {
|
||||
function get(url, params) {
|
||||
return new Promise((resolve, reject) => {
|
||||
request.get(url, params)
|
||||
.then(response => {
|
||||
|
@ -135,7 +135,7 @@ export function get(url, params) {
|
|||
})
|
||||
}
|
||||
|
||||
export function DELETE(url, params) {
|
||||
function DELETE(url, params) {
|
||||
return new Promise((resolve, reject) => {
|
||||
request.delete(url, params)
|
||||
.then(response => {
|
||||
|
@ -149,7 +149,7 @@ export function DELETE(url, params) {
|
|||
})
|
||||
}
|
||||
|
||||
export function put(url, params) {
|
||||
function put(url, params) {
|
||||
return new Promise((resolve, reject) => {
|
||||
request.put(url, params)
|
||||
.then(response => {
|
||||
|
@ -162,4 +162,10 @@ export function put(url, params) {
|
|||
})
|
||||
})
|
||||
}
|
||||
// export default request
|
||||
export {
|
||||
request,
|
||||
post,
|
||||
get,
|
||||
DELETE,
|
||||
put
|
||||
}
|
4
main.js
4
main.js
|
@ -1,6 +1,6 @@
|
|||
import Vue from 'vue'
|
||||
import App from './App'
|
||||
// import api from '@/common/api/api.js'
|
||||
import api from '@/common/api/api.js'
|
||||
import {post,get,DELETE,put} from "@/common/api/request.js"
|
||||
import config from "@/common/api/config.js"
|
||||
import store from "@/store/index"
|
||||
|
@ -27,7 +27,7 @@ const tui = {
|
|||
}
|
||||
}
|
||||
import { throttle } from './utils/publicMethods';
|
||||
// Vue.prototype.$api = api;
|
||||
Vue.prototype.$api = api;
|
||||
Vue.prototype.$post = post;
|
||||
Vue.prototype.$get = get;
|
||||
Vue.prototype.$DELETE = DELETE;
|
||||
|
|
|
@ -122,11 +122,17 @@
|
|||
"h5" : {
|
||||
"devServer" : {
|
||||
"https" : false,
|
||||
"port" : 8055
|
||||
"port" : 8055,
|
||||
// "disableHostCheck" : true // 禁用 Host 检查 打包时改成false
|
||||
},
|
||||
"router" : {
|
||||
"mode" : "hash",
|
||||
"base" : ""
|
||||
},
|
||||
"optimization" : {
|
||||
"treeShaking" : {
|
||||
"enable" : false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
40
pages.json
40
pages.json
|
@ -20,24 +20,21 @@
|
|||
{
|
||||
"path": "pages/tabBar/new",
|
||||
"style": {
|
||||
"navigationBarTitleText": "消息",
|
||||
"enablePullDownRefresh": true
|
||||
"navigationBarTitleText": "消息"
|
||||
// "navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/tabBar/order",
|
||||
"style": {
|
||||
"navigationBarTitleText": "订单",
|
||||
"enablePullDownRefresh": true
|
||||
"navigationBarTitleText": "订单"
|
||||
// "navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/tabBar/home",
|
||||
"style": {
|
||||
"navigationBarTitleText": "首页",
|
||||
"enablePullDownRefresh": true
|
||||
"navigationBarTitleText": "首页"
|
||||
// "navigationStyle": "custom"
|
||||
}
|
||||
}, {
|
||||
|
@ -446,7 +443,6 @@
|
|||
"path": "space/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "空间管理",
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarBackgroundColor": "#fff"
|
||||
}
|
||||
}, {
|
||||
|
@ -611,6 +607,36 @@
|
|||
"navigationBarTitleText": "修改密码"
|
||||
}
|
||||
}]
|
||||
},
|
||||
{
|
||||
"root": "pages/new/",
|
||||
"pages": [{
|
||||
"path": "detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "消息详情",
|
||||
"navigationBarBackgroundColor": "#fff"
|
||||
}
|
||||
}]
|
||||
},
|
||||
{
|
||||
"root": "pages/order/",
|
||||
"pages": [{
|
||||
"path": "detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "订单详情",
|
||||
"navigationBarBackgroundColor": "#fff"
|
||||
}
|
||||
}]
|
||||
},
|
||||
{
|
||||
"root": "pages/fun/",
|
||||
"pages": [{
|
||||
"path": "materialEdit",
|
||||
"style": {
|
||||
"navigationBarTitleText": "素材上传",
|
||||
"navigationBarBackgroundColor": "#fff"
|
||||
}
|
||||
}]
|
||||
}
|
||||
],
|
||||
"tabBar": {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
.login-ctn {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding-top: 500rpx;
|
||||
padding-top: 500rpx;
|
||||
background: #fff;
|
||||
:not(not) {
|
||||
box-sizing: border-box;
|
||||
|
@ -151,7 +151,7 @@ padding-top: 500rpx;
|
|||
<view class="login-form-ctn">
|
||||
<view class="login-form">
|
||||
<u-form :model="form" :rules="rules" ref="uForm">
|
||||
<u-form-item label=" " label-width="60" prop="tenantId" left-icon="account"
|
||||
<u-form-item v-if="tenantEnabled && isTenant" label=" " label-width="60" prop="tenantId" left-icon="account"
|
||||
:left-icon-style="{ color: '#ccc', fontSize: '30rpx' }">
|
||||
<view style="width: 100%;display: flex;align-items: center;justify-content: space-between;" @click="tenantShow=true">
|
||||
<text>{{activeTenantObj.companyName}}</text>
|
||||
|
@ -181,7 +181,7 @@ padding-top: 500rpx;
|
|||
@click="submit" type="primary">立即登录</u-button>
|
||||
</view>
|
||||
<view class="protocol-box">
|
||||
<u-checkbox v-model="protocolStatus">阅读并同意以下协议<text @click.stop="goPolicy">《用户协议》</text></u-checkbox>
|
||||
<!-- <u-checkbox v-model="protocolStatus">阅读并同意以下协议<text @click.stop="goPolicy">《用户协议》</text></u-checkbox> -->
|
||||
</view>
|
||||
<!-- <view class="other-login-box">
|
||||
<view class="other-login-item" @click="goWxLogin">
|
||||
|
@ -194,10 +194,10 @@ padding-top: 500rpx;
|
|||
</view>
|
||||
|
||||
</view>
|
||||
<view class="login-version-info">
|
||||
<!-- <view class="login-version-info">
|
||||
<view>Copyright 2022-2024 {{appConfig.companyName}} Powered By DSservice</view>
|
||||
<view>{{appConfig.contractRecordNumber || ''}}</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<u-select v-model="tenantShow" :list="tenantList" label-name="companyName" value-name="tenantId" @confirm="changeTenant"></u-select>
|
||||
<u-toast ref="uToast" />
|
||||
</view>
|
||||
|
@ -209,7 +209,7 @@ padding-top: 500rpx;
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
protocolStatus: false,
|
||||
protocolStatus: true,
|
||||
usetTypeValue: '企业用户',
|
||||
list: [{
|
||||
name: '普通用户',
|
||||
|
@ -255,7 +255,11 @@ padding-top: 500rpx;
|
|||
domain: "",
|
||||
logo: null,
|
||||
registerEnable: false
|
||||
}
|
||||
},
|
||||
// 租户是否已启用
|
||||
tenantEnabled:true,
|
||||
query:{},
|
||||
isTenant: true,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -264,6 +268,12 @@ padding-top: 500rpx;
|
|||
},
|
||||
},
|
||||
onLoad(e) {
|
||||
if(e){
|
||||
this.query = e;
|
||||
}
|
||||
if(e.tenantId){
|
||||
this.form.tenantId = e.tenantId;
|
||||
}
|
||||
// 普通二维码参数转小程序参数
|
||||
if (e.q && e.q != "undefined") { //扫码进入
|
||||
const qrUrl = decodeURIComponent(e.q) // 获取到二维码原始链接内容
|
||||
|
@ -329,19 +339,56 @@ padding-top: 500rpx;
|
|||
success: (res) => {
|
||||
console.log("res11",res);
|
||||
if(res.data.code == 200){
|
||||
|
||||
this.tenantList = res.data.data.voList || [];
|
||||
|
||||
if(res.data.data.voList!=[]){
|
||||
this.activeTenantObj = res.data.data.voList[0];
|
||||
this.form.tenantId = res.data.data.voList[0].tenantId;
|
||||
let data = res.data.data;
|
||||
this.tenantEnabled = data.tenantEnabled === undefined ? true : data.tenantEnabled;
|
||||
if(this.tenantEnabled){
|
||||
this.tenantList = data.voList || [];
|
||||
let logo = '';
|
||||
let title = '';
|
||||
// #ifdef H5
|
||||
if(this.query.tenantId){
|
||||
this.form.tenantId = this.query.tenantId;
|
||||
data.voList.forEach((item) => {
|
||||
if (item.tenantId === this.query.tenantId) {
|
||||
logo = item.logo;
|
||||
title = item.companyName;
|
||||
}
|
||||
});
|
||||
this.isTenant = false;
|
||||
} else if (data.voList != null && data.voList.length === 1 && data.voList[0].domain === window.location.host) {
|
||||
this.form.tenantId = data.voList[0].tenantId;
|
||||
logo = data.voList[0].logo;
|
||||
title = data.voList[0].companyName;
|
||||
this.isTenant = false;
|
||||
} else if (data.voList != null && data.voList.length !== 0) {
|
||||
this.form.tenantId = data.voList[0].tenantId;
|
||||
this.activeTenantObj = data.voList[0] ;
|
||||
logo = data.voList[0].logo;
|
||||
title = data.voList[0].companyName;
|
||||
}
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN
|
||||
if (data.voList != null && data.voList.length !== 0) {
|
||||
this.form.tenantId = data.voList[0].tenantId;
|
||||
this.activeTenantObj = data.voList[0] ;
|
||||
logo = data.voList[0].logo;
|
||||
title = data.voList[0].companyName;
|
||||
}
|
||||
// #endif
|
||||
if(title){
|
||||
this.appConfig.logo = logo;
|
||||
this.appConfig.name = title;
|
||||
}else{
|
||||
this.appConfig.logo = '';
|
||||
this.appConfig.name = this.$store.state.app.appConfig;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
changeTenant(e){
|
||||
console.log("e",e)
|
||||
console.log("e",e[0].value)
|
||||
this.tenantList.forEach((item) => {
|
||||
if (item.tenantId == e[0].value) {
|
||||
this.activeTenantObj = item;
|
||||
|
|
|
@ -0,0 +1,620 @@
|
|||
<template>
|
||||
<view class="container">
|
||||
|
||||
<view class="select-box" v-if="commitState === 'add'">
|
||||
<view class="form-label">素材模板</view>
|
||||
<view class="form-value" @click="openMaterialShow">
|
||||
<view class="form-select">{{materialfrom.dictId?materialfrom.dictName:'请选择素材模板'}}</view>
|
||||
<u-icon name="arrow-down-fill" color="#999" size="28"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view v-for="(item,index) in materialTemplateList" :key="index" class="form-item">
|
||||
<text class="form-label">{{ item.attrTitle }} <text class="form-hint">{{ item.attrHint ? '(' +item.attrHint + ')' : '' }}</text> </text>
|
||||
<!-- 文本输入 -->
|
||||
<template v-if="item.attrType === 0">
|
||||
<u-input :disabled="getDisabledStatus()" class="bg-gray" v-model="item.attrValue" :placeholder="`请输入${item.attrTitle}`" />
|
||||
</template>
|
||||
|
||||
<!-- 图片上传 -->
|
||||
<template v-if="item.attrType === 1">
|
||||
<view class="upload-area">
|
||||
<view v-if="item.attrValue" class="preview-wrapper">
|
||||
<image :src="item.fileUrl" mode="scaleToFill" class="preview-image" @click="previewImage(item.fileUrl)">
|
||||
</image>
|
||||
<u-icon name="close" class="delete-icon" @click="deleteFile(item.attrValue,index)"></u-icon>
|
||||
</view>
|
||||
<u-button @click="chooseImage(item,index)" type="primary" :disabled="getDisabledStatus()"
|
||||
:loading="item.uploading">{{ item.attrValue ? '重新上传' : '上传图片' }}</u-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<!-- 音频上传 -->
|
||||
<template v-if="item.attrType === 2">
|
||||
<view class="upload-area">
|
||||
<view v-if="item.attrValue" class="audio-preview">
|
||||
<text class="audio-name">{{ shortenFileName(item.fileName,20) || '已上传音频文件' }}</text>
|
||||
<u-icon name="close" class="delete-icon" @click="deleteFile(item.attrValue,index)"></u-icon>
|
||||
</view>
|
||||
<u-button @click="chooseAudio(item,index)" type="primary" :disabled="getDisabledStatus()"
|
||||
:loading="item.uploading">{{ item.attrValue ? '重新上传' : '上传音频' }}</u-button>
|
||||
<!-- <text v-if="item.fileUrl" class="audio-name">已上传音频文件</text> -->
|
||||
<text class="upload-tip">{{'最大' + audioSize + 'MB'}}</text>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<!-- 视频上传 -->
|
||||
<template v-if="item.attrType === 3">
|
||||
<view class="upload-area">
|
||||
<view v-if="item.attrValue" class="audio-preview">
|
||||
<!-- <video :src="item.fileUrl" class="preview-video"></video> -->
|
||||
<text class="audio-name">{{ shortenFileName(item.fileName,20) || '已上传音频文件' }}</text>
|
||||
<u-icon name="close" class="delete-icon" @click="deleteFile(item.attrValue,index)"></u-icon>
|
||||
</view>
|
||||
<u-button @click="chooseVideo(item,index)" type="primary" :disabled="getDisabledStatus()"
|
||||
:loading="item.uploading">{{ item.attrValue ? '重新上传' : '上传视频' }}</u-button>
|
||||
<text class="upload-tip">{{'最大' + videoSize + 'MB'}}</text>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<!-- 用户说明 -->
|
||||
<u-input v-if="item.attrType !== 0" :disabled="getDisabledStatus()" type="textarea" class="bg-gray" v-model="item.userExplain" placeholder="请输入素材说明" />
|
||||
<!-- 星级评分 -->
|
||||
重要级别:<u-rate v-model="item.starLevel" :disabled="getDisabledStatus()" active-color="#f7ba2a" :count="5" />
|
||||
</view>
|
||||
<u-select v-model="materialShow" mode="single-column" :list="materialDictList" value-name="id" label-name="dictName" @confirm="changeTemplate"></u-select>
|
||||
<!-- 提交按钮 -->
|
||||
<view class="btn-box" v-if="commitState === 'add' || commitState === 'draft' || commitState === 'back'">
|
||||
<u-button type="default" :loading="buttonLoading" class="bg-grey" @click="submitForm('draft')">暂存</u-button>
|
||||
<u-button type="primary" :loading="buttonLoading" @click="submitForm('submit')">提交</u-button>
|
||||
</view>
|
||||
<u-toast ref="uToast" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import config from '../../common/api/config';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
token: '',
|
||||
orderId: "",
|
||||
productId: "",
|
||||
orderItemId: "",
|
||||
// 素材提交状态
|
||||
commitState:'add',
|
||||
materialfrom:{
|
||||
id: undefined,
|
||||
dictId: undefined,
|
||||
dictName: undefined,
|
||||
productId: undefined,
|
||||
productSn: undefined,
|
||||
flowId: undefined,
|
||||
},
|
||||
// 素材模板列表
|
||||
materialDictList:[],
|
||||
materialTemplateList:[],
|
||||
// 模板选择弹窗
|
||||
materialShow:false,
|
||||
audioSize: 10,
|
||||
videoSize: 50,
|
||||
audioType: ['.wav', '.mp3', '.aac', '.flac', '.ogg'],
|
||||
audioH5Type: ['wav', 'mp3', 'aac', 'flac', 'ogg'],
|
||||
buttonLoading:false,
|
||||
// videoType: ['.avi', '.mp4', '.mkv', '.flv', '.mov', '.wmv', '.mpeg', '.3gp'],
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
console.log("获取参数为",option)
|
||||
this.orderId = option.orderId;
|
||||
this.productId = option.productId;
|
||||
this.orderItemId = option.orderItemId;
|
||||
this.token = uni.getStorageSync('userToken');
|
||||
this.getProductDetail();
|
||||
},
|
||||
methods: {
|
||||
getDisabledStatus(){
|
||||
if(this.commitState !== 'add' && this.commitState !== 'draft' && this.commitState !== 'back'){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
},
|
||||
openMaterialShow(){
|
||||
this.materialShow = true;
|
||||
},
|
||||
async changeTemplate(e){
|
||||
console.log("当前选择",e)
|
||||
this.materialfrom.dictId = e[0].value;
|
||||
this.materialfrom.dictName = e[0].label;
|
||||
let res = await this.$api.orderApi.getProductMaterialDictItemList({ pageNum: 1, pageSize: 100, dictId: e[0].value, orderByColumn: 'orderNum', isAsc: 'asc' })
|
||||
this.materialTemplateList = res.rows.map((item) => {
|
||||
item.starLevel = 0;
|
||||
item.userExplain = '';
|
||||
item.attrValue = '';
|
||||
item.orderId = this.orderId;
|
||||
item.productId = this.productId;
|
||||
item.orderItemId = this.orderItemId;
|
||||
item.dictId = this.materialfrom.dictId;
|
||||
item.id = null;
|
||||
return item;
|
||||
});
|
||||
},
|
||||
async getProductDetail(){
|
||||
// let res = await this.$api.orderApi.getMallclientOrderProductList({ orderId: this.orderId, productId: this.productId })
|
||||
let res = await this.$api.orderApi.getOrderMaterialList({ orderItemId: this.orderItemId })
|
||||
console.log("res",res)
|
||||
// this.materialfrom.productSn = res.rows[0].productSn;
|
||||
// this.commitState = res.rows[0].commitState;
|
||||
// if (this.commitState === 0) {
|
||||
// this.getMaterialDictList();
|
||||
// } else {
|
||||
// this.getMaterialList();
|
||||
// }
|
||||
if(res.rows.length!=0){
|
||||
this.materialfrom.flowId = res.rows[0].id;
|
||||
this.commitState = res.rows[0].status;
|
||||
this.materialTemplateList = res.rows[0].materialItems || [];
|
||||
res.rows[0].materialItems.forEach(async (item,index)=>{
|
||||
if(item.attrType !== 0 && item.attrValue !== ''){
|
||||
let {fileUrl,fileName} = await this.getFileDetail(item.attrValue);
|
||||
console.log("fileUrl,fileName",fileUrl,fileName)
|
||||
// this.materialTemplateList[index].fileUrl = fileUrl;
|
||||
// this.materialTemplateList[index].fileName = fileName;
|
||||
this.$nextTick(()=>{
|
||||
this.$set(this.materialTemplateList[index],'fileUrl',fileUrl)
|
||||
this.$set(this.materialTemplateList[index],'fileName',fileName)
|
||||
})
|
||||
}
|
||||
})
|
||||
}else{
|
||||
this.getMaterialDictList();
|
||||
}
|
||||
},
|
||||
async getFileDetail(ossId){
|
||||
let res = await this.$api.getOssDetail(ossId)
|
||||
if(res.code == 200){
|
||||
return {
|
||||
fileUrl: res.data[0].url || '',
|
||||
fileName:res.data[0].originalName || '',
|
||||
}
|
||||
}else{
|
||||
return {
|
||||
fileUrl:'',
|
||||
fileName:'',
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
async getMaterialDictList(){
|
||||
let res = await this.$api.orderApi.getProductMaterialDictList({ pageNum: 1, pageSize: 100, productId: this.productId })
|
||||
this.materialDictList = res.rows || [];
|
||||
},
|
||||
async getMaterialList(){
|
||||
let res = await this.$api.orderApi.getMallOrderProductMaterialList({ orderId: this.orderId, productId: this.productId, orderByColumn: 'orderNum', isAsc: 'asc' })
|
||||
this.materialTemplateList = res.rows || [];
|
||||
},
|
||||
shortenFileName(fileName, maxLength = 10) {
|
||||
if(fileName==undefined){
|
||||
return '';
|
||||
}
|
||||
// 检查文件名是否已经足够短
|
||||
if (fileName.length <= maxLength) {
|
||||
return fileName;
|
||||
}
|
||||
// 获取文件后缀
|
||||
const lastDotIndex = fileName.lastIndexOf('.');
|
||||
const extension = fileName.slice(lastDotIndex); // 包括点号
|
||||
// 获取文件名(不包括后缀)
|
||||
const nameWithoutExtension = fileName.slice(0, lastDotIndex);
|
||||
// 缩短文件名
|
||||
const shortenedName = nameWithoutExtension.slice(0, maxLength);
|
||||
// 返回缩短后的文件名,加上后缀
|
||||
return `${shortenedName}...${extension}`;
|
||||
},
|
||||
chooseImage(item, index) {
|
||||
this.materialTemplateList[index].uploading = true;
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
success: (res) => {
|
||||
const tempFilePath = res.tempFilePaths[0];
|
||||
this.uploadFile(tempFilePath, 'image', item, index);
|
||||
},
|
||||
complete: () => {
|
||||
this.materialTemplateList[index].uploading = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
chooseVideo(item,index) {
|
||||
this.materialTemplateList[index].uploading = true;
|
||||
uni.chooseVideo({
|
||||
count: 1,
|
||||
maxDuration: 60,
|
||||
success: (res) => {
|
||||
const tempFilePath = res.tempFilePath;
|
||||
const fileSize = res.size;
|
||||
if (fileSize > this.videoSize * 1024 * 1024) {
|
||||
uni.showToast({
|
||||
title: '视频大小不能超过' + this.videoSize + 'MB',
|
||||
icon: 'none'
|
||||
});
|
||||
this.materialTemplateList[index].uploading = false;
|
||||
return;
|
||||
}
|
||||
this.uploadFile(tempFilePath, 'video', item, index);
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('选择视频失败', err);
|
||||
uni.showToast({
|
||||
title: '选择视频失败',
|
||||
icon: 'none'
|
||||
});
|
||||
},
|
||||
complete: () => {
|
||||
this.materialTemplateList[index].uploading = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
chooseAudio(item,index) {
|
||||
this.materialTemplateList[index].uploading = true;
|
||||
// 注意:H5不支持chooseFile,需要单独处理
|
||||
// #ifdef H5
|
||||
uni.chooseFile({
|
||||
count: 1,
|
||||
type: 'all',
|
||||
extension: this.audioType,
|
||||
success: (res) => {
|
||||
const tempFilePath = res.tempFiles[0].path;
|
||||
const fileSize = res.tempFiles[0].size;
|
||||
const fileName = res.tempFiles[0].name;
|
||||
if (fileSize > this.audioSize * 1024 * 1024) {
|
||||
uni.showToast({
|
||||
title: '音频大小不能超过' + this.audioSize + 'MB',
|
||||
icon: 'none'
|
||||
});
|
||||
this.materialTemplateList[index].uploading = false;
|
||||
return;
|
||||
}
|
||||
this.uploadFile(tempFilePath, 'audio', item, index, fileName);
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('选择音频失败', err);
|
||||
uni.showToast({
|
||||
title: '选择音频失败',
|
||||
icon: 'none'
|
||||
});
|
||||
},
|
||||
complete: () => {
|
||||
this.materialTemplateList[index].uploading = false;
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
|
||||
// #ifndef H5
|
||||
uni.chooseMessageFile({
|
||||
count: 1,
|
||||
type: 'file',
|
||||
extension: this.audioH5Type,
|
||||
success: (res) => {
|
||||
const tempFilePath = res.tempFiles[0].path;
|
||||
const fileSize = res.tempFiles[0].size;
|
||||
const fileName = res.tempFiles[0].name;
|
||||
if (fileSize > this.audioSize * 1024 * 1024) {
|
||||
uni.showToast({
|
||||
title: '音频大小不能超过' + this.audioSize + 'MB',
|
||||
icon: 'none'
|
||||
});
|
||||
this.materialTemplateList[index].uploading = false;
|
||||
return;
|
||||
}
|
||||
this.uploadFile(tempFilePath, 'audio', item, index, fileName);
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('选择音频失败', err);
|
||||
uni.showToast({
|
||||
title: '选择音频失败',
|
||||
icon: 'none'
|
||||
});
|
||||
},
|
||||
complete: () => {
|
||||
this.materialTemplateList[index].uploading = false;
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
},
|
||||
uploadFile(filePath, fileType, item, index, fileName = '') {
|
||||
// 这里应该是您的实际上传接口
|
||||
const uploadUrl = config.baseUrl + '/resource/oss/upload';
|
||||
|
||||
uni.uploadFile({
|
||||
url: uploadUrl,
|
||||
filePath: filePath,
|
||||
name: 'file',
|
||||
header: {
|
||||
'Clientid': config.clientId,
|
||||
'Authorization': 'Bearer ' + this.token
|
||||
},
|
||||
success: (uploadRes) => {
|
||||
const data = JSON.parse(uploadRes.data);
|
||||
console.log("data", data)
|
||||
// 假设服务器返回的是文件的URL
|
||||
// this.materialTemplateList[index].fileUrl = data.url
|
||||
this.materialTemplateList[index].attrValue = data.data.ossId;
|
||||
this.materialTemplateList[index].fileUrl = data.data.url;
|
||||
this.materialTemplateList[index].fileName = data.data.fileName;
|
||||
uni.showToast({
|
||||
title: '上传成功',
|
||||
icon: 'success'
|
||||
});
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('上传失败', err);
|
||||
uni.showToast({
|
||||
title: '上传失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
deleteFile(item,index) {
|
||||
uni.showModal({
|
||||
title: '确认删除',
|
||||
content: '是否确认删除该文件?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.$api.orderApi.delOssFile(this.materialTemplateList[index].attrValue)
|
||||
|
||||
this.materialTemplateList[index].attrValue = '';
|
||||
this.materialTemplateList[index].fileUrl = '';
|
||||
this.materialTemplateList[index].fileName = '';
|
||||
uni.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'success'
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
previewImage(url) {
|
||||
uni.previewImage({
|
||||
urls: [url],
|
||||
current: 0
|
||||
});
|
||||
},
|
||||
async submitForm(status) {
|
||||
console.log('提交的表单数据:', this.materialTemplateList);
|
||||
if(!this.materialfrom.dictId && this.commitState === 'add'){
|
||||
this.$refs.uToast.show({
|
||||
title: '请选择素材模板',
|
||||
type: 'error',
|
||||
})
|
||||
return;
|
||||
}
|
||||
|
||||
if(this.materialTemplateList.length==0){
|
||||
this.$refs.uToast.show({
|
||||
title: '请选择有素材项的模板',
|
||||
type: 'error',
|
||||
})
|
||||
return;
|
||||
}
|
||||
try {
|
||||
this.buttonLoading = true;
|
||||
// 这里添加实际的提交逻辑
|
||||
let res = null;
|
||||
if(this.commitState === 'add'){
|
||||
res = await this.$api.orderApi.AddOrderMaterial({
|
||||
orderId: this.orderId,
|
||||
productId: this.productId,
|
||||
orderItemId: this.orderItemId,
|
||||
materialItems: this.materialTemplateList
|
||||
});
|
||||
this.buttonLoading = false;
|
||||
this.materialfrom.flowId = res.data.id;
|
||||
}else{
|
||||
res = await this.$api.orderApi.mallMaterialUpdateBatch(this.materialTemplateList);
|
||||
this.buttonLoading = false;
|
||||
}
|
||||
|
||||
if (status === 'draft') {
|
||||
if (res.code === 200) {
|
||||
this.$refs.uToast.show({
|
||||
title: '暂存成功',
|
||||
type: 'success',
|
||||
})
|
||||
}
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
})
|
||||
} else {
|
||||
// 提交,调用完成接口
|
||||
let res1 = await this.$api.orderApi.mallMaterialCommit(this.orderId, this.productId);
|
||||
if (res1.code === 200) {
|
||||
this.$refs.uToast.show({
|
||||
title: '提交成功',
|
||||
type: 'success',
|
||||
})
|
||||
}
|
||||
|
||||
let res2 = await this.$api.orderApi.startWorkFlow({
|
||||
businessKey: this.materialfrom.flowId,
|
||||
tableName: 'biz_order_material',
|
||||
variables: {
|
||||
entity: {
|
||||
id: this.materialfrom.flowId,
|
||||
status: 'waiting',
|
||||
orderId: this.orderId,
|
||||
productId: this.productId,
|
||||
orderItemId: this.orderItemId
|
||||
}
|
||||
}
|
||||
});
|
||||
if (res2.code === 200) {
|
||||
this.$refs.uToast.show({
|
||||
title: '提交成功',
|
||||
type: 'success',
|
||||
})
|
||||
let res3 = await this.$api.orderApi.completeTask({
|
||||
messageType: ['1'],
|
||||
taskId: res2.data.taskId,
|
||||
taskVariables: {
|
||||
entity: {
|
||||
id: this.materialfrom.flowId,
|
||||
status: 'waiting',
|
||||
orderId: this.orderId,
|
||||
productId: this.productId,
|
||||
orderItemId: this.orderItemId
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
})
|
||||
}
|
||||
|
||||
} finally {
|
||||
this.buttonLoading = false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page{
|
||||
background: #f5f5f5;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss">
|
||||
.container {
|
||||
padding: 20rpx;
|
||||
padding-bottom: 120rpx;
|
||||
}
|
||||
.bg-gray{
|
||||
background: #f8f8f8;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
.select-box{
|
||||
padding: 20rpx;
|
||||
background: #fff;
|
||||
border-radius: 20rpx;
|
||||
margin-bottom: 20rpx;
|
||||
.form-value{
|
||||
padding: 10rpx;
|
||||
border: 1px solid #c6c6c6;
|
||||
border-radius: 10rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
.form-item {
|
||||
margin-bottom: 20rpx;
|
||||
padding: 20rpx;
|
||||
background: #fff;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
|
||||
.form-label {
|
||||
display: block;
|
||||
margin-bottom: 10rpx;
|
||||
font-weight: bold;
|
||||
.form-hint{
|
||||
font-size: 22rpx;
|
||||
color: #666;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.upload-area {
|
||||
// display: flex;
|
||||
// flex-direction: column;
|
||||
// align-items: flex-start;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.preview-wrapper {
|
||||
margin: 0 auto;
|
||||
position: relative;
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
background-color: #eeeeee;
|
||||
margin-bottom: 10rpx;
|
||||
.preview-image{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.delete-icon {
|
||||
position: absolute;
|
||||
top: -10rpx;
|
||||
right: -10rpx;
|
||||
background-color: #fa3534;
|
||||
color: #fff;
|
||||
font-size: 20rpx;
|
||||
border-radius: 50%;
|
||||
padding: 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.preview-video {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
.audio-preview {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 10rpx;
|
||||
position: relative;
|
||||
border: 1px solid #999;
|
||||
border-radius: 10rpx;
|
||||
padding: 5rpx 10rpx;
|
||||
.audio-name {
|
||||
margin-right: 10rpx;
|
||||
font-size: 24rpx;
|
||||
color: #888;
|
||||
}
|
||||
.delete-icon {
|
||||
color: #888;
|
||||
font-size: 28rpx;
|
||||
padding: 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
.upload-tip {
|
||||
margin-top: 5rpx;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
.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;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,90 @@
|
|||
<template>
|
||||
<view class="new-detail">
|
||||
<view class="title">
|
||||
{{title}}
|
||||
</view>
|
||||
<view class="info-box">
|
||||
<text>{{time}}</text>
|
||||
</view>
|
||||
<view class="content">
|
||||
<!-- {{content}} -->
|
||||
<u-parse :html="content"></u-parse>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
title:'',
|
||||
time:'',
|
||||
content:'',
|
||||
type:'',
|
||||
hasRead:false,
|
||||
}
|
||||
},
|
||||
onLoad(option){
|
||||
if (option?.obj) {
|
||||
let data = JSON.parse(decodeURIComponent(option.obj));
|
||||
// this.type = data.type;
|
||||
this.id = data.id;
|
||||
this.time = data.createTime;
|
||||
this.title = data.noticeTitle;
|
||||
this.hasRead = data.hasRead;
|
||||
// this.content = data.message;
|
||||
this.getDetail(data.noticeId);
|
||||
// this.readNew(data.noticeId);
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
getDetail(id){
|
||||
this.$api.getNewDetetail(id).then((res)=>{
|
||||
console.log("获取消息详情",res)
|
||||
if(res.code == 200){
|
||||
this.content = res.data.noticeContent;
|
||||
if(!this.hasRead){
|
||||
this.readNew(this.id);
|
||||
}
|
||||
}
|
||||
}).catch(()=>{
|
||||
})
|
||||
},
|
||||
readNew(id){
|
||||
console.log("触发读消息")
|
||||
this.$api.readNew({id:id}).then((res)=>{
|
||||
console.log("阅读消息",res)
|
||||
}).catch(()=>{
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.new-detail{
|
||||
padding: 20rpx;
|
||||
.title{
|
||||
font-weight: bold;
|
||||
font-size: 42rpx;
|
||||
text-align: center;
|
||||
}
|
||||
.info-box{
|
||||
margin: 20rpx 0;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
text{
|
||||
color: #999;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
.content{
|
||||
text-indent: 56rpx;
|
||||
font-size: 30rpx;
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
|
@ -0,0 +1,306 @@
|
|||
<template>
|
||||
<view class="container">
|
||||
<!-- 订单信息 -->
|
||||
<view class="info-card">
|
||||
<view class="info-item">
|
||||
<text class="label">订单编号</text>
|
||||
<text class="value">{{ orderInfo.orderSn }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">创建时间</text>
|
||||
<text class="value">{{ orderInfo.createTime }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">客户姓名</text>
|
||||
<text class="value">{{ orderInfo.memberName }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">客户手机</text>
|
||||
<text class="value">{{ orderInfo.memberPhone }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 商品信息 -->
|
||||
<view class="info-card">
|
||||
<view class="card-title">商品信息</view>
|
||||
<view class="">
|
||||
<view v-for="(item, index) in orderInfo.orderItems" :key="index" class="product-item">
|
||||
<image :src="item.productPic" mode="aspectFill" class="product-image" @click="lookPic(item.productPic)"></image>
|
||||
<view class="product-info">
|
||||
<text class="product-name">{{ item.productName }}</text>
|
||||
<view class="product-bottom">
|
||||
<text class="product-quantity">x{{ item.productQuantity }}</text>
|
||||
<text class="product-price">¥{{ (item.productPrice / 100).toFixed(2) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 订单金额信息 -->
|
||||
<view class="amount-info">
|
||||
<view class="amount-item">
|
||||
<text>总金额</text>
|
||||
<text class="price">¥{{ (orderInfo.totalAmount / 100).toFixed(2) }}</text>
|
||||
</view>
|
||||
<view class="amount-item">
|
||||
<text>已付额</text>
|
||||
<text class="price paid">¥{{ orderInfo.payAmount ? (orderInfo.payAmount / 100).toFixed(2) : '0.00' }}</text>
|
||||
</view>
|
||||
<view class="amount-item">
|
||||
<text>支付方式</text>
|
||||
<view class="payment-method">
|
||||
<!-- <u-icon name="weixin-fill" color="#07c160" size="28"></u-icon> -->
|
||||
<text>{{getDictName('mall_pay_type',orderInfo.payType,'dictLabel')}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 订单其他信息 -->
|
||||
<view class="info-card">
|
||||
<view class="info-item">
|
||||
<text class="label">订单来源</text>
|
||||
<view class="value source">
|
||||
<u-icon name="shopping-mall" size="24"></u-icon>
|
||||
<text>{{getDictName('mall_source_type',orderInfo.sourceType,'dictLabel')}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">订单状态</text>
|
||||
<text class="value status" :class="['dict-item',getDictName('mall_order_status',orderInfo.orderStatus,'listClass')]">{{getDictName('mall_order_status',orderInfo.orderStatus,'dictLabel')}}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">订单备注</text>
|
||||
<text class="value">{{ orderInfo.orderNote || '无' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
orderId:'',
|
||||
orderInfo:{
|
||||
"billContent": null,
|
||||
"billHeader": null,
|
||||
"billReceiverEmail": null,
|
||||
"billReceiverPhone": null,
|
||||
"billType": 0,
|
||||
"confirmStatus": 0,
|
||||
"createBy": "",
|
||||
"createTime": "",
|
||||
"deliveryTime": null,
|
||||
"finishTime": null,
|
||||
"freightAmount": null,
|
||||
"id": "",
|
||||
"memberName": "",
|
||||
"memberPhone": "",
|
||||
"memberUsername": "",
|
||||
"orderItems": [],
|
||||
"orderNote": null,
|
||||
"orderSn": "",
|
||||
"orderStatus": 0,
|
||||
"orderType": 0,
|
||||
"payAmount": null,
|
||||
"payTime": null,
|
||||
"payType": 0,
|
||||
"receiverCity": null,
|
||||
"receiverDetailAddress": null,
|
||||
"receiverName": null,
|
||||
"receiverPhone": null,
|
||||
"receiverPostCode": null,
|
||||
"receiverProvince": null,
|
||||
"receiverRegion": null,
|
||||
"sourceType": 0,
|
||||
"totalAmount": 0,
|
||||
"updateBy": "",
|
||||
"updateTime": ""
|
||||
},
|
||||
mall_order_status:[],
|
||||
mall_source_type:[],
|
||||
mall_pay_type:[],
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.getDictDataList('mall_order_status');
|
||||
this.getDictDataList('mall_source_type');
|
||||
this.getDictDataList('mall_pay_type');
|
||||
console.log("option",option)
|
||||
this.orderId = option.id;
|
||||
this.getOrderDetail(option.id);
|
||||
},
|
||||
methods:{
|
||||
// 获取订单详情
|
||||
getOrderDetail(id){
|
||||
this.$api.orderApi.getOrderDetail(id).then((res)=>{
|
||||
console.log("获取订单详情",res)
|
||||
if(res.code == 200){
|
||||
this.orderInfo = res.data;
|
||||
}
|
||||
}).catch(()=>{
|
||||
})
|
||||
},
|
||||
getDictDataList(type){
|
||||
this.$api.getDictList(type).then((res)=>{
|
||||
if(res.code===200){
|
||||
this[type] = res.data || [];
|
||||
}
|
||||
})
|
||||
},
|
||||
getDictName(list,value,key){
|
||||
let name = ''
|
||||
if(this[list]){
|
||||
this[list].forEach((item)=>{
|
||||
if(item.dictValue == value){
|
||||
name = item[key];
|
||||
}
|
||||
})
|
||||
return name;
|
||||
}
|
||||
},
|
||||
lookPic(url){
|
||||
uni.previewImage({
|
||||
current: '', // 当前显示图片的 http 链接
|
||||
urls: [url] // 需要预览的图片 http 链接列表
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.container {
|
||||
min-height: 100vh;
|
||||
background-color: #f5f5f5;
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.info-card {
|
||||
background-color: #fff;
|
||||
border-radius: 12rpx;
|
||||
padding: 30rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
|
||||
.label {
|
||||
color: #666;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.value {
|
||||
color: #333;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.card-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
.product-item {
|
||||
display: flex;
|
||||
padding: 20rpx 0;
|
||||
border-bottom: 1rpx solid #eee;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.product-image {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
border-radius: 8rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.product-info {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.product-name {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.product-bottom {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.product-quantity {
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.product-price {
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.amount-info {
|
||||
margin-top: 30rpx;
|
||||
padding-top: 30rpx;
|
||||
border-top: 1rpx solid #eee;
|
||||
}
|
||||
|
||||
.amount-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 20rpx;
|
||||
font-size: 28rpx;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.price {
|
||||
font-weight: 500;
|
||||
|
||||
&.paid {
|
||||
color: #19be6b;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.payment-method {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.source {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10rpx;
|
||||
}
|
||||
|
||||
.status {
|
||||
color: #19be6b;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -3,21 +3,21 @@
|
|||
<mescroll-body class="new-mescroll u-skeleton" ref="mescrollRef" top="0" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption" >
|
||||
<view class="new-list" v-if="newsList && newsList.length > 0">
|
||||
<view class="new-list-item " v-for="(item,index) in newsList" :key="index" @tap="goDetail(index)">
|
||||
<view class="item-icon-box u-skeleton-circle" :class="item.readType=='yes'?'':'unread'">
|
||||
<view v-if="item.type=='urgent'" class="item-icon bg-error">
|
||||
<view class="item-icon-box u-skeleton-circle" :class="item.hasRead?'':'unread'">
|
||||
<view v-if="item.noticeType=='1'" class="item-icon bg-warning">
|
||||
<u-icon name="bell" color="#fff" size="54"></u-icon>
|
||||
</view>
|
||||
<view v-else-if="item.type=='warning'" class="item-icon bg-warning">
|
||||
<!-- <view v-else-if="item.noticeType=='warning'" class="item-icon bg-warning">
|
||||
<u-icon name="error" color="#fff" size="54"></u-icon>
|
||||
</view>
|
||||
</view> -->
|
||||
<view v-else class="item-icon bg-info">
|
||||
<u-icon name="chat" color="#fff" size="54"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item-content">
|
||||
<view class="item-content-top">
|
||||
<text class="item-title u-line-1 u-skeleton-fillet">{{item.title}}</text>
|
||||
<text class="item-time u-skeleton-fillet">{{item.createdAt}}</text>
|
||||
<text class="item-title u-line-1 u-skeleton-fillet">{{item.noticeTitle}}</text>
|
||||
<text class="item-time u-skeleton-fillet">{{item.createTime}}</text>
|
||||
</view>
|
||||
<view class="item-content-txt u-line-1 u-skeleton-fillet">{{item.message}}</view>
|
||||
</view>
|
||||
|
@ -30,58 +30,11 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
let list = [
|
||||
{
|
||||
id:0,
|
||||
type:'warning',
|
||||
title:'机柜告警机柜告警机柜告警机柜告警机柜告警机柜告警机柜告警机柜告警机柜告警机柜告警机柜告警机柜告警机柜告警',
|
||||
message:'电池长时间没充电',
|
||||
params:'id=xxxx',
|
||||
createdAt:'2020-10-26 10:50:49',
|
||||
status:false
|
||||
},
|
||||
{
|
||||
id:1,
|
||||
type:'warning',
|
||||
title:'电池告警',
|
||||
message:'短路保护',
|
||||
params:'id=xxxx',
|
||||
createdAt:'2020-10-26 10:40:49',
|
||||
status:false
|
||||
},
|
||||
{
|
||||
id:2,
|
||||
type:'approval',
|
||||
title:'租金审批',
|
||||
message:'XXX有一笔租金需要审批',
|
||||
params:'id=xxxx',
|
||||
createdAt:'2020-10-26 10:30:49',
|
||||
status:false
|
||||
},
|
||||
{
|
||||
id:3,
|
||||
type:'approval',
|
||||
title:'改装维修审批',
|
||||
message:'XXX有一笔改装维修需要审批',
|
||||
params:'id=xxxx',
|
||||
createdAt:'2020-10-26 10:20:49',
|
||||
status:true
|
||||
},
|
||||
{
|
||||
id:4,
|
||||
type:'new',
|
||||
title:'通知消息',
|
||||
message:'XXX下午开会,XXX下午开会,XXX下午开会,XXX下午开会,XXX下午开会',
|
||||
params:'id=xxxx',
|
||||
createdAt:'2020-10-26 10:20:49',
|
||||
status:true
|
||||
}
|
||||
]
|
||||
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
newsList:list,
|
||||
newsList:[],
|
||||
unreadNewIdList:[],
|
||||
loading: true, // 是否显示骨架屏组件
|
||||
upOption:{
|
||||
|
@ -113,13 +66,18 @@
|
|||
},
|
||||
mixins:[MescrollMixin],
|
||||
onShow() {
|
||||
console.log("消息页show")
|
||||
this.isToken = uni.getStorageSync('token');
|
||||
this.mescroll.resetUpScroll(false);
|
||||
if(this.isToken){
|
||||
this.getUnreadNewNum();
|
||||
}
|
||||
// this.getUnreadNewNum();
|
||||
this.isToken = uni.getStorageSync('userToken');
|
||||
// if(this.isToken){
|
||||
// this.getUnreadNewNum();
|
||||
// }
|
||||
this.getUnreadNewNum();
|
||||
this.$nextTick(() => {
|
||||
if (this.mescroll) {
|
||||
this.mescroll.resetUpScroll();
|
||||
} else {
|
||||
console.warn('mescroll is not initialized yet');
|
||||
}
|
||||
});
|
||||
},
|
||||
methods:{
|
||||
tabChange(index) {
|
||||
|
@ -132,27 +90,26 @@
|
|||
let pageNum = page.num; // 页码, 默认从1开始
|
||||
let pageSize = page.size; // 页长, 默认每页10条
|
||||
let obj = {
|
||||
page:pageNum,
|
||||
limit:pageSize,
|
||||
msgType:this.tabIndex==0?'private':'public'
|
||||
pageNum:pageNum,
|
||||
pageSize:pageSize,
|
||||
}
|
||||
if (this.isToken) {
|
||||
this.$api.getNewList(obj).then((res)=>{
|
||||
console.log("当前获取到消息",res)
|
||||
if (res.data.rows && res.data.rows.length>0) {
|
||||
if (res.rows && res.rows.length>0) {
|
||||
// 接口返回的当前页数据列表 (数组)
|
||||
let curPageData = res.data.rows;
|
||||
let curPageData = res.rows;
|
||||
// 接口返回的当前页数据长度 (如列表有26个数据,当前页返回8个,则curPageLen=8)
|
||||
let curPageLen = curPageData && curPageData.length;
|
||||
//设置列表数据
|
||||
console.log(curPageLen,res.data.total);
|
||||
console.log(curPageLen,res.total);
|
||||
if(pageNum == 1){
|
||||
this.newsList = []; //如果是第一页需手动置空列表
|
||||
// this.getUnreadNewIdList(); //
|
||||
this.getUnreadNewNum();
|
||||
// this.getUnreadNewNum();
|
||||
}
|
||||
this.newsList = this.newsList.concat(curPageData); //追加新数据
|
||||
this.mescroll.endBySize(curPageLen, res.data.total); // 推荐
|
||||
this.mescroll.endBySize(curPageLen, res.total); // 推荐
|
||||
this.loading = false;
|
||||
console.log("newsList",this.newsList)
|
||||
} else{
|
||||
|
@ -176,7 +133,6 @@
|
|||
this.mescroll.showEmpty();
|
||||
this.loading = false;
|
||||
}
|
||||
|
||||
},
|
||||
// 跳转消息详情
|
||||
goDetail(index){
|
||||
|
@ -187,42 +143,29 @@
|
|||
})
|
||||
},
|
||||
getUnreadNewNum(){
|
||||
this.$api.getUnreadNewNum({}).then((res)=>{
|
||||
let obj = {
|
||||
pageNum:1,
|
||||
pageSize:10,
|
||||
hasRead: false
|
||||
}
|
||||
this.$api.getNewList(obj).then((res)=>{
|
||||
console.log("当前获取未读消息数量",res)
|
||||
if(res.code == 1){
|
||||
if(res.data.count){
|
||||
if(res.code == 200){
|
||||
if(res.total){
|
||||
uni.showTabBarRedDot({
|
||||
index: 2
|
||||
index: 0
|
||||
})
|
||||
}else{
|
||||
uni.hideTabBarRedDot({
|
||||
index: 2
|
||||
index: 0
|
||||
})
|
||||
}
|
||||
this.tabList[0].count = res.data.privateCount;
|
||||
this.tabList[1].count = res.data.publicCount;
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon:"none",
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
}).catch(()=>{
|
||||
this.$u.toast('服务器开小差了呢,请您稍后再试')
|
||||
})
|
||||
},
|
||||
// getUnreadNewIdList(){
|
||||
// this.$api.getUnreadNewIdList({}).then((res)=>{
|
||||
// console.log("当前获取未读消息id列表",res)
|
||||
// if (res.data.ids && res.data.ids.length>0) {
|
||||
// this.unreadNewIdList = res.data.ids;
|
||||
// } else{
|
||||
// this.unreadNewIdList = [];
|
||||
// }
|
||||
// }).catch(()=>{
|
||||
// })
|
||||
// }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -1,56 +1,79 @@
|
|||
<template>
|
||||
<view class="order-page">
|
||||
<view class="search-box">
|
||||
<u-search
|
||||
v-model="searchText"
|
||||
placeholder="搜索订单编号/商品名称"
|
||||
:show-action="false"
|
||||
></u-search>
|
||||
</view>
|
||||
|
||||
<u-tabs :list="tabList" :current="current" @change="tabChange"></u-tabs>
|
||||
<view class="header-box">
|
||||
<view class="search-box">
|
||||
<u-search
|
||||
v-model="orderSn"
|
||||
placeholder="搜索订单号"
|
||||
:show-action="false"
|
||||
@custom="onSearchFn"
|
||||
@search="onSearchFn"
|
||||
></u-search>
|
||||
</view>
|
||||
<u-tabs :list="tabList" :current="tabCurrent" name="dictLabel" @change="tabChange"></u-tabs>
|
||||
</view>
|
||||
|
||||
<mescroll-body
|
||||
ref="mescrollRef"
|
||||
top="192rpx"
|
||||
@init="mescrollInit"
|
||||
@down="downCallback"
|
||||
@up="upCallback"
|
||||
:up="upOption"
|
||||
>
|
||||
<view class="order-list">
|
||||
<view class="order-item" v-for="(item, index) in orderList" :key="index">
|
||||
<view class="order-header">
|
||||
<text class="order-no">订单号:{{item.orderNo}}</text>
|
||||
<text class="order-status">{{item.status}}</text>
|
||||
<text class="order-no">订单号:{{item.orderSn}}</text>
|
||||
<text class="order-status" :class="['dict-item',getDictName('mall_order_status',item.orderStatus,'listClass')]">{{getDictName('mall_order_status',item.orderStatus,'dictLabel')}}</text>
|
||||
</view>
|
||||
|
||||
<view class="product-info">
|
||||
<image :src="item.productImage" mode="aspectFill" class="product-image"></image>
|
||||
<view class="product-info" v-for="val in item.orderItems">
|
||||
<image :src="val.productPic" mode="aspectFill" class="product-image" @click="lookPic(val.productPic)"></image>
|
||||
<view class="product-detail">
|
||||
<view class="product-name">{{item.productName}}</view>
|
||||
<view class="product-specs">
|
||||
<view class="product-name">{{val.productName}}</view>
|
||||
<view class="product-count">x{{val.productQuantity}}</view>
|
||||
<view class="product-price">¥{{ val.productPrice ? (val.productPrice / 100).toFixed(2) : '0.00' }}</view>
|
||||
<view class="product-funlist">
|
||||
<u-button
|
||||
v-if="val.funPath"
|
||||
size="mini"
|
||||
plain
|
||||
type="primary"
|
||||
@click="goFun(val.funPath, val.productId, item.id, val.id)"
|
||||
>{{ val.funName }}</u-button>
|
||||
</view>
|
||||
<!-- <view class="product-specs">
|
||||
颜色:{{item.color}};尺码:{{item.size}}
|
||||
</view>
|
||||
<view class="product-count">x{{item.count}}</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<view class="product-price">¥{{item.price}}</view>
|
||||
|
||||
</view>
|
||||
<view class="total-info">
|
||||
共{{item.orderItems.length}}件商品 总金额:
|
||||
<text class="price">¥{{ item.totalAmount ? (item.totalAmount / 100).toFixed(2) : '0.00' }}</text>
|
||||
</view>
|
||||
|
||||
<view class="order-footer">
|
||||
<view class="total-info">
|
||||
共{{item.count}}件商品 实付款:
|
||||
<text class="price">¥{{item.totalPrice}}</text>
|
||||
</view>
|
||||
<view class="button-group">
|
||||
<u-button
|
||||
<!-- <u-button
|
||||
v-if="item.showCancel"
|
||||
size="mini"
|
||||
plain
|
||||
@click="cancelOrder(item)"
|
||||
>取消订单</u-button>
|
||||
>取消订单</u-button> -->
|
||||
<u-button
|
||||
v-if="item.orderStatus === 0"
|
||||
size="mini"
|
||||
shape="circle"
|
||||
type="primary"
|
||||
@click="viewDetail(item)"
|
||||
>去付款</u-button>
|
||||
<u-button
|
||||
size="mini"
|
||||
type="primary"
|
||||
@click="viewDetail(item)"
|
||||
shape="circle"
|
||||
plain
|
||||
@click="goDetail(item)"
|
||||
>查看详情</u-button>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -61,36 +84,138 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
searchText: '',
|
||||
current: 0,
|
||||
orderSn: '',
|
||||
tabCurrent: 0,
|
||||
tabList: [
|
||||
{ name: '全部' },
|
||||
{ name: '待付款' },
|
||||
{ name: '待发货' },
|
||||
{ name: '待收货' },
|
||||
{ name: '已完成' }
|
||||
{ dictLabel: '全部',dictValue: null },
|
||||
// { name: '待付款' },
|
||||
// { name: '待发货' },
|
||||
// { name: '待收货' },
|
||||
// { name: '已完成' }
|
||||
],
|
||||
upOption:{
|
||||
page:{
|
||||
num : 0 ,
|
||||
size : 12 ,
|
||||
time : null
|
||||
},
|
||||
noMoreSize: 4,
|
||||
empty:{
|
||||
icon:'https://fast.gk-hd.com/resource/app-sec/new.png',
|
||||
use : true ,
|
||||
tip: '~ 消息列表为空 ~',
|
||||
fixed: true,
|
||||
top: "200rpx",
|
||||
},
|
||||
bgColor:"#f5f5f5"
|
||||
},
|
||||
orderList: [],
|
||||
mescroll: null,
|
||||
pageNum: 1,
|
||||
pageSize: 10
|
||||
pageSize: 10,
|
||||
mall_order_status:[],
|
||||
orderStatus:'',
|
||||
}
|
||||
},
|
||||
mixins:[MescrollMixin],
|
||||
onLoad() {
|
||||
this.getDictDataList('mall_order_status');
|
||||
},
|
||||
onShow() {
|
||||
this.$nextTick(() => {
|
||||
if (this.mescroll) {
|
||||
this.mescroll.resetUpScroll();
|
||||
} else {
|
||||
console.warn('mescroll is not initialized yet');
|
||||
}
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
getDictDataList(type){
|
||||
this.$api.getDictList(type).then((res)=>{
|
||||
if(res.code===200){
|
||||
this[type] = res.data || [];
|
||||
if(type == 'mall_order_status'){
|
||||
this.tabList = [{ dictLabel: '全部',dictValue: '' },...res.data]
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
getDictName(list,value,key){
|
||||
let name = ''
|
||||
if(this[list]){
|
||||
this[list].forEach((item)=>{
|
||||
if(item.dictValue == value){
|
||||
name = item[key];
|
||||
}
|
||||
})
|
||||
return name;
|
||||
}
|
||||
},
|
||||
mescrollInit(mescroll) {
|
||||
this.mescroll = mescroll
|
||||
},
|
||||
// 下拉刷新
|
||||
downCallback(mescroll) {
|
||||
this.pageNum = 1
|
||||
this.getOrderList(mescroll)
|
||||
},
|
||||
// // 下拉刷新
|
||||
// downCallback(mescroll) {
|
||||
// this.pageNum = 1
|
||||
// this.getOrderList(mescroll)
|
||||
// },
|
||||
// 上拉加载
|
||||
upCallback(mescroll) {
|
||||
this.getOrderList(mescroll)
|
||||
onSearchFn(){
|
||||
this.mescroll.resetUpScroll();
|
||||
},
|
||||
lookPic(url){
|
||||
uni.previewImage({
|
||||
current: '', // 当前显示图片的 http 链接
|
||||
urls: [url] // 需要预览的图片 http 链接列表
|
||||
});
|
||||
},
|
||||
upCallback(page) {
|
||||
let pageNum = page.num; // 页码, 默认从1开始
|
||||
let pageSize = page.size; // 页长, 默认每页10条
|
||||
let obj = {
|
||||
pageNum:pageNum,
|
||||
pageSize:pageSize,
|
||||
orderSn:this.orderSn,
|
||||
orderStatus:this.orderStatus,
|
||||
}
|
||||
this.$api.orderApi.getOrderList(obj).then((res)=>{
|
||||
console.log("当前订单列表",res)
|
||||
if (res.rows && res.rows.length>0) {
|
||||
// 接口返回的当前页数据列表 (数组)
|
||||
let curPageData = res.rows;
|
||||
// 接口返回的当前页数据长度 (如列表有26个数据,当前页返回8个,则curPageLen=8)
|
||||
let curPageLen = curPageData && curPageData.length;
|
||||
//设置列表数据
|
||||
console.log(curPageLen,res.total);
|
||||
if(pageNum == 1){
|
||||
this.orderList = []; //如果是第一页需手动置空列表
|
||||
// this.getUnreadNewIdList(); //
|
||||
// this.getUnreadNewNum();
|
||||
}
|
||||
this.orderList = this.orderList.concat(curPageData); //追加新数据
|
||||
this.mescroll.endBySize(curPageLen, res.total); // 推荐
|
||||
this.loading = false;
|
||||
} else{
|
||||
this.orderList = [];
|
||||
this.mescroll.endErr();
|
||||
this.mescroll.showEmpty();
|
||||
this.loading = false;
|
||||
// this.mescroll.endUpScroll(true)
|
||||
}
|
||||
}).catch(()=>{
|
||||
this.$u.toast('服务器开小差了呢,请您稍后再试')
|
||||
this.orderList = [];
|
||||
//联网失败, 结束加载
|
||||
this.mescroll.endErr();
|
||||
this.mescroll.showEmpty();
|
||||
this.loading = false;
|
||||
})
|
||||
// this.getOrderList(page)
|
||||
},
|
||||
// 获取订单列表
|
||||
getOrderList(mescroll) {
|
||||
|
@ -121,7 +246,9 @@ export default {
|
|||
},
|
||||
// 切换标签
|
||||
tabChange(index) {
|
||||
this.current = index
|
||||
console.log("index",index)
|
||||
this.orderStatus = this.tabList[index].dictValue;
|
||||
this.tabCurrent = index
|
||||
this.mescroll.resetUpScroll()
|
||||
},
|
||||
// 取消订单
|
||||
|
@ -137,20 +264,34 @@ export default {
|
|||
})
|
||||
},
|
||||
// 查看详情
|
||||
viewDetail(item) {
|
||||
goDetail(item) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/order/detail?orderNo=${item.orderNo}`
|
||||
url: `/pages/order/detail?id=${item.id}`
|
||||
})
|
||||
}
|
||||
},
|
||||
goFun(path, productId, orderId, orderItemId){
|
||||
console.log("path",path, productId, orderId)
|
||||
uni.navigateTo({
|
||||
url: `/pages${path}?productId=${productId}&orderId=${orderId}&orderItemId=${orderItemId}`
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.order-page {
|
||||
min-height: 100vh;
|
||||
// min-height: 100vh;
|
||||
background-color: #f5f5f5;
|
||||
|
||||
// position: relative;
|
||||
.header-box{
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: var(--window-top);
|
||||
width: 100%;
|
||||
z-index: 999;
|
||||
background-color: #fff;
|
||||
}
|
||||
.search-box {
|
||||
padding: 20rpx;
|
||||
background-color: #fff;
|
||||
|
@ -172,7 +313,7 @@ export default {
|
|||
border-bottom: 1px solid #eee;
|
||||
|
||||
.order-status {
|
||||
color: #2979ff;
|
||||
// color: #2979ff;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,6 +333,7 @@ export default {
|
|||
|
||||
.product-name {
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
|
@ -204,31 +346,39 @@ export default {
|
|||
.product-count {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
margin-top: 10rpx;
|
||||
margin-top: 5rpx;
|
||||
}
|
||||
|
||||
.product-price {
|
||||
color: #ff0000;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.product-funlist{
|
||||
padding: 5rpx 0;
|
||||
}
|
||||
}
|
||||
|
||||
.product-price {
|
||||
|
||||
}
|
||||
.total-info {
|
||||
text-align: right;
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
margin-bottom: 10rpx;
|
||||
.price {
|
||||
color: #ff0000;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.order-footer {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
// justify-content: space-between;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
padding-top: 20rpx;
|
||||
border-top: 1px solid #eee;
|
||||
|
||||
.total-info {
|
||||
font-size: 26rpx;
|
||||
|
||||
.price {
|
||||
color: #ff0000;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.button-group {
|
||||
display: flex;
|
||||
|
|
Loading…
Reference in New Issue