12.05前端

This commit is contained in:
@QQNZX 2023-12-06 09:20:25 +08:00
parent 426cd1ca30
commit 1194f7db5c
6 changed files with 254 additions and 185 deletions

View File

@ -1,12 +1,7 @@
// 应用全局配置
module.exports = {
// baseUrl: 'https://vue.ruoyi.vip/prod-api',
// baseUrl: 'http://192.168.0.196:8081/',
<<<<<<< HEAD
baseUrl: 'http://192.168.1.6:8008/',
=======
baseUrl: 'http://192.168.0.196:8080/',
>>>>>>> 6a67ef9347914e251c82bfcd14c04a8964fd161f
baseUrl: 'http://192.168.0.181:8008/',
// baseUrl: 'http://192.168.1.5:8002/cdJdc',
imagesUrl: 'http://www.nuoyunr.com/lananRsc',

View File

@ -11,7 +11,6 @@
<view class="">
<view class="title" v-if="item.changeType == 1">{{item.changeReason}}</view>
<view class="title" v-else style="color: #F52D22;">积分支出</view>
<view class="times">{{item.createTime}}</view>
</view>
<view class="sr-nmb" v-if="item.changeType == 1">+{{item.pointsChange}}</view>
@ -20,7 +19,6 @@
<!-- 判断根据实际情况而改 -->
<u-empty text="积分明细" v-if="mingList.length == 0" icon="http://cdn.uviewui.com/uview/empty/list.png">
</u-empty>
<u-loadmore :status="status" v-if="show == true" />
</view>
</view>
@ -86,7 +84,6 @@
}
}).then((res) => {
if (res.code == 200) {
if (this.pageNo != 1) {
this.detailList = this.detailList.concat(res.data.records)
} else {
@ -174,4 +171,4 @@
font-weight: 500;
color: #F52D22;
}
</style>
</style>

View File

@ -14,10 +14,32 @@
<view class="gang" :class="{ 'lan' : tindex == index }"></view>
</view>
</view>
<!-- Recharge -->
<u-empty v-if="list.length == 0 " mode="coupon" text="内容为空"
<view class="ail">
<view class="box-order" v-for="(item,index) in list" :key="index">
<view class="or-box-top">
<view class="">储值卡</view>
<view class="chengg">充值成功</view>
</view>
<view class="but-box">
<view class="huis">充值金额</view>
<view class="">123</view>
</view>
<view class="but-box">
<view class="huis">优惠合计</view>
<view class="reds">999</view>
</view>
<view class="but-box">
<view class="huis">订单时间</view>
<view class="">20230304</view>
</view>
</view>
</view>
<!-- <u-empty v-if="list.length == 0 " mode="coupon" text="内容为空"
icon="http://cdn.uviewui.com/uview/empty/coupon.png">
</u-empty>
</u-empty> -->
</view>
</view>
</template>
@ -28,7 +50,7 @@
return {
title: '',
tindex: 0,
list: [],
list: ["1"],
tapList: [{
text: "全部"
},
@ -123,4 +145,64 @@
.lan {
background: #0000ff;
}
.box-order {
width: 95%;
border-radius: 8px;
background: #ffffff;
box-sizing: border-box;
padding: 10px;
margin: 10px auto;
}
.or-box-top {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 5px 0px;
border-bottom: 1px solid #e5e5e5;
}
.chengg {
color: #1678ff;
}
.but-box {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
margin: 5px 0px;
}
.reds {
color: red;
}
.huis {
color: #666666;
}
.end-box {
width: 100%;
display: flex;
align-items: center;
justify-content: flex-end;
}
.anniu {
width: 70px;
height: 25px;
background-color: #1678ff;
color: #ffffff;
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
border-radius: 15px;
}
</style>

View File

@ -10,7 +10,7 @@
<view class="top-box">
<view class="top-input">
<u-icon name="search" size="28"></u-icon>
<input type="text" placeholder="搜索我的订单" v-model="query"/>
<input type="text" placeholder="搜索我的订单" v-model="query" />
</view>
<view class="" @click="queryOrder">搜索</view>
</view>
@ -22,16 +22,17 @@
<view class="gang" :class="{'actg' : tapindex == index }"></view>
</view>
</view>
<view>
<scroll-view scroll-y="true" :scroll-top="scrollTop" id="scrollList" style="height: 80vh;" @scrolltolower="scrolltolower">
<scroll-view scroll-y="true" :scroll-top="scrollTop" id="scrollList" style="height: 80vh;"
@scrolltolower="scrolltolower">
<!-- 列表 -->
<view class="box-order" v-for="(item,index) in list">
<view class="box-order" v-for="(item,index) in list" :key="index">
<view class="or-box-top">
<view class="">{{getStoreName(storeList,item.storeId)}}</view>
<view class="chengg">{{getPayName(payList,item.orderStatus)}}</view>
</view>
<view class="but-box">
<view class="huis">订单金额</view>
<view class="">{{item.orderAmount}}</view>
@ -55,31 +56,6 @@
<u-load-more :status="status"></u-load-more>
</scroll-view>
</view>
<!-- <view class="box-order">
<view class="or-box-top">
<view class="">加油站名称</view>
<view class="chengg">支付成功</view>
</view>
<view class="but-box">
<view class="huis">订单金额</view>
<view class="">999999</view>
</view>
<view class="but-box">
<view class="huis">优惠合计</view>
<view class="reds">999999</view>
</view>
<view class="but-box">
<view class="huis">订单时间</view>
<view class="">2023.3.4</view>
</view>
<view class="end-box">
<view class="anniu">
<text>评价有礼</text>
</view>
</view>
</view> -->
</view>
</view>
@ -92,29 +68,36 @@
return {
title: '',
tapindex: 0,
tapList: [
{ text: '全部' },
{ text: '待支付' },
{ text: '已完成' },
{ text: '待评价' },
tapList: [{
text: '全部'
},
{
text: '待支付'
},
{
text: '已完成'
},
{
text: '待评价'
},
],
//
orderList:[],
list:[],
map:{
page:1,
pageSize:5,
storeId:"",
orderStatus:"",
remark:"",
orderList: [],
list: [],
map: {
page: 1,
pageSize: 5,
storeId: "",
orderStatus: "",
remark: "",
},
//
total:0,
total: 0,
//
storeList:[],
storeList: [],
//
payList:[],
query:"",
payList: [],
query: "",
status: 'more', // -
scrollTop: 0,
}
@ -129,53 +112,53 @@
},
methods: {
//
queryOrder(){
queryOrder() {
let _this = this;
_this.list = [];
if (_this.query==""){
if (_this.query == "") {
_this.list = _this.orderList
}else{
} else {
_this.storeList.forEach(item => {
_this.orderList.forEach(item1 => {
if (item.name.includes(_this.query)) {
if (item1.storeId == item.id){
_this.list.push(item1)
}
return
}
if (item.name.includes(_this.query)) {
if (item1.storeId == item.id){
_this.list.push(item1)
}
}
})
_this.orderList.forEach(item1 => {
if (item.name.includes(_this.query)) {
if (item1.storeId == item.id) {
_this.list.push(item1)
}
return
}
if (item.name.includes(_this.query)) {
if (item1.storeId == item.id) {
_this.list.push(item1)
}
}
})
})
}
},
parseTime(dateTime){
parseTime(dateTime) {
let date = new Date(dateTime);
let y = date.getFullYear() + "-";
let mon = ((date.getMonth()+1 < 10) ? ('0' + date.getMonth()) : date.getMonth())+ "-";
let mon = ((date.getMonth() + 1 < 10) ? ('0' + date.getMonth()) : date.getMonth()) + "-";
let d = ((date.getDate() < 10) ? ('0' + date.getDate()) : date.getDate()) + " ";
let h = ((date.getHours() < 10) ? ('0' + date.getHours()) : date.getHours()) + ":";
let m = ((date.getMinutes() < 10) ? ('0' + date.getMinutes()) : date.getMinutes()) + ":";
let s = ((date.getSeconds() < 10) ? ('0' + date.getSeconds()) : date.getSeconds());
return y+mon+d+h+m+s;
return y + mon + d + h + m + s;
},
getStoreName(list,id){
getStoreName(list, id) {
let name = "";
list.forEach(item => {
if (item.id == id) {
if (item.description!="" && item.description!=null) {
name = item.name + "("+item.description+")"
}else{
if (item.description != "" && item.description != null) {
name = item.name + "(" + item.description + ")"
} else {
name = item.name
}
}
})
return name;
},
getPayName(list,type){
getPayName(list, type) {
let name = "";
list.forEach(item => {
if (item.dictValue == type) {
@ -185,46 +168,46 @@
return name;
},
//
getPayList(){
getPayList() {
let _this = this;
request({
url: "system/dict/data/type/pay_status",
method: 'get',
}).then((res)=>{
}).then((res) => {
_this.payList = res.data
})
},
//
getStores(){
getStores() {
let _this = this;
request({
url: "business/storeInformation/store/stores",
method: 'get',
}).then((res)=>{
}).then((res) => {
_this.storeList = res.data
})
},
//
scrolltolower(){
if (this.orderList.length<this.total) {
scrolltolower() {
if (this.orderList.length < this.total) {
this.map.page++;
this.getMyOrder()
}else{
} else {
this.status = "no-more"
}
},
//
getMyOrder(){
getMyOrder() {
let _this = this;
request({
url: "business/oilOrder/userOrders",
method: 'get',
params: _this.map,
}).then((res)=>{
}).then((res) => {
if (_this.map.page == 1) {
_this.orderList = res.data.records
_this.list = res.data.records
}else{
} else {
_this.orderList = _this.orderList.concat(res.data.records)
_this.list = _this.list.concat(res.data.records)
}
@ -233,38 +216,38 @@
},
getTapIndex(index) {
this.tapindex = index
if (this.tapindex==0){
if (this.tapindex == 0) {
this.map = {
storeId:"",
orderStatus:"",
remark:"",
storeId: "",
orderStatus: "",
remark: "",
}
this.getMyOrder()
}else if(this.tapindex==1){
} else if (this.tapindex == 1) {
this.map = {
page:1,
pageSize:5,
storeId:"",
orderStatus:"unpaid",
remark:"",
page: 1,
pageSize: 5,
storeId: "",
orderStatus: "unpaid",
remark: "",
}
this.getMyOrder()
}else if(this.tapindex==2){
} else if (this.tapindex == 2) {
this.map = {
page:1,
pageSize:5,
storeId:"",
orderStatus:"paid",
remark:"",
page: 1,
pageSize: 5,
storeId: "",
orderStatus: "paid",
remark: "",
}
this.getMyOrder()
}else{
} else {
this.map = {
page:1,
pageSize:5,
storeId:"",
orderStatus:"",
remark:"待评价",
page: 1,
pageSize: 5,
storeId: "",
orderStatus: "",
remark: "待评价",
}
this.getMyOrder()
}

View File

@ -43,13 +43,14 @@ const request = config => {
const msg = errorCode[code] || res.data.msg || errorCode['default']
if (code === 401) {
showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => {
if (res.confirm) {
store.dispatch('LogOut').then(res => {
uni.reLaunch({
url: 'pagesLogin/login/login'
})
})
}
uni.reLaunch({
url: '/pagesLogin/login/login'
})
// if (res.confirm) {
// store.dispatch('LogOut').then(res => {
// })
// }
})
reject('无效的会话,或者会话已过期,请重新登录。')
} else if (code === 500) {
@ -78,4 +79,4 @@ const request = config => {
})
}
export default request
export default request

View File

@ -1,70 +1,81 @@
import store from '@/store'
import config from '@/config'
import { getToken } from '@/utils/auth'
import {
getToken
} from '@/utils/auth'
import errorCode from '@/utils/errorCode'
import { toast, showConfirm, tansParams } from '@/utils/common'
import {
toast,
showConfirm,
tansParams
} from '@/utils/common'
let timeout = 10000
const baseUrl = config.baseUrl
const upload = config => {
// 是否需要设置 token
const isToken = (config.headers || {}).isToken === false
config.header = config.header || {}
if (getToken() && !isToken) {
config.header['Authorization'] = 'Bearer ' + getToken()
}
// get请求映射params参数
if (config.params) {
let url = config.url + '?' + tansParams(config.params)
url = url.slice(0, -1)
config.url = url
}
return new Promise((resolve, reject) => {
uni.uploadFile({
timeout: config.timeout || timeout,
url: baseUrl + config.url,
filePath: config.filePath,
name: config.name || 'file',
header: config.header,
formData: config.formData,
success: (res) => {
let result = JSON.parse(res.data)
const code = result.code || 200
const msg = errorCode[code] || result.msg || errorCode['default']
if (code === 200) {
resolve(result)
} else if (code == 401) {
showConfirm("登录状态已过期,您可以继续留在该页面,或者重新登录?").then(res => {
if (res.confirm) {
store.dispatch('LogOut').then(res => {
uni.reLaunch({ url: '/pages/login/login' })
})
}
})
reject('无效的会话,或者会话已过期,请重新登录。')
} else if (code === 500) {
toast(msg)
reject('500')
} else if (code !== 200) {
toast(msg)
reject(code)
}
},
fail: (error) => {
let { message } = error
if (message == 'Network Error') {
message = '后端接口连接异常'
} else if (message.includes('timeout')) {
message = '系统接口请求超时'
} else if (message.includes('Request failed with status code')) {
message = '系统接口' + message.substr(message.length - 3) + '异常'
}
toast(message)
reject(error)
}
})
})
// 是否需要设置 token
const isToken = (config.headers || {}).isToken === false
config.header = config.header || {}
if (getToken() && !isToken) {
config.header['Authorization'] = 'Bearer ' + getToken()
}
// get请求映射params参数
if (config.params) {
let url = config.url + '?' + tansParams(config.params)
url = url.slice(0, -1)
config.url = url
}
return new Promise((resolve, reject) => {
uni.uploadFile({
timeout: config.timeout || timeout,
url: baseUrl + config.url,
filePath: config.filePath,
name: config.name || 'file',
header: config.header,
formData: config.formData,
success: (res) => {
let result = JSON.parse(res.data)
const code = result.code || 200
const msg = errorCode[code] || result.msg || errorCode['default']
if (code === 200) {
resolve(result)
} else if (code == 401) {
showConfirm("登录状态已过期,您可以继续留在该页面,或者重新登录?").then(res => {
if (res.confirm) {
store.dispatch('LogOut').then(res => {
uni.reLaunch({
url: '/pages/login/login'
})
})
}
})
reject('无效的会话,或者会话已过期,请重新登录。')
} else if (code === 500) {
toast(msg)
reject('500')
} else if (code !== 200) {
toast(msg)
reject(code)
}
},
fail: (error) => {
let {
message
} = error
if (message == 'Network Error') {
message = '后端接口连接异常'
} else if (message.includes('timeout')) {
message = '系统接口请求超时'
} else if (message.includes('Request failed with status code')) {
message = '系统接口' + message.substr(message.length - 3) + '异常'
}
toast(message)
reject(error)
}
})
})
}
export default upload