要搞直接登录

This commit is contained in:
xk_guohonglei
2020-09-04 09:20:45 +08:00
parent 39d433998a
commit 395ebd432d
28 changed files with 7367 additions and 44 deletions

View File

@@ -30,7 +30,7 @@
<view class="title text-black">工号</view>
<input v-model="oilSiteNo" placeholder="请输入云站编号" name="input"></input>
</view> -->
<view class="cu-form-group">
<view class="title text-black">手机号</view>
<input type="number" v-model="auth.phone" placeholder="请输入手机号" name="input"></input>
@@ -55,6 +55,9 @@
</button>
</view>
</view>
<view class="bottom-part">
<service-hotline />
</view>
</view>
</template>
@@ -94,7 +97,6 @@
console.log(code)
const data2 = {
code: code,
idCard: this.auth.idNumber,
name: this.auth.userName,
phone: this.auth.phone,
oilSiteCode: this.oilSiteNo
@@ -105,7 +107,7 @@
title: res.msg,
icon: 'none'
})
})
},
fail: err => {
@@ -133,7 +135,7 @@
title: res.msg,
icon: 'none'
})
if(res.code ===20000){
if (res.code === 20000) {
this.loginWeixin()
uni.setStorage({
key: 'Authorization',
@@ -149,10 +151,13 @@
console.log('deviceopenid', res.data.openid)
}
})
uni.setStorageSync('userMenu',res.data.loginUser.procedureAuthList)
uni.setStorageSync('loginUser',{id:res.data.loginUser.id,name:res.data.loginUser.name})
uni.setStorageSync('userMenu', res.data.loginUser.procedureAuthList)
uni.setStorageSync('loginUser', {
id: res.data.loginUser.id,
name: res.data.loginUser.name
})
uni.reLaunch({
url:'/pages/index/index',
url: '/pages/index/index',
success: (res) => {
console.log(res)
},
@@ -201,13 +206,16 @@
console.log('deviceopenid', res.data.openid)
}
})
uni.setStorageSync('userMenu',res.data.loginUser.procedureAuthList)
uni.setStorageSync('loginUser',{id:res.data.loginUser.id,name:res.data.loginUser.name})
uni.setStorageSync('userMenu', res.data.loginUser.procedureAuthList)
uni.setStorageSync('loginUser', {
id: res.data.loginUser.id,
name: res.data.loginUser.name
})
} else {
console.log('res', res.code)
}
})
},
fail: err => {
@@ -232,7 +240,7 @@
})
return false
}
if (!this.auth.captcha) {
uni.showToast({
title: '请输入短信验证码',

View File

@@ -19,7 +19,7 @@
</view>
<view class="bg-white radius margin-left margin-right to-top">
<view class=" flex ">
<view class="padding text-center flex-sub" @tap="routerTo('/pages/orderList/orderList')">
<view class="padding text-center flex-sub" @tap="routerTo('/pages/orderList/dailyOrder/dailyOrder')">
<text>今日收款笔数</text>
<view class="padding-sm">
<text class="oil-main-color">{{userAccount.totalCount}}</text>
@@ -51,7 +51,7 @@
</view>
<text>{{ cuIconList[0].name }}</text>
</view>
<view class="cu-item" v-show=" item.name !=='经营分析'" v-for="(item,index) in userMenu" :key="item.menuId" @tap="routerTo(item.path,item.name)">
<view class="cu-item" v-for="(item,index) in userMenu" :key="item.menuId" @tap="routerTo(item.path,item.name)">
<view :class="['cuIcon-' + item.cuIcon, 'text-' + cuIconList[index+1].color]" class="text-sl">
<view class="cu-tag badge" v-if="item.badge != 0">
<block v-if="item.badge != 1">{{ item.badge > 99 ? '99+' : item.badge }}</block>
@@ -253,7 +253,7 @@
};
</script>
<style>
<style scoped>
.content {
height: 100%;
}

View File

@@ -0,0 +1,237 @@
<template>
<view class="page-content my-bg">
<cu-custom class="main-topbar bg-main-oil" bgColor="bg-main-oil">
<block slot="content">星油云站</block>
</cu-custom>
<view class="bg-img margin flex padding-lg radius align-center text-center" :style="'background-image: url('+mainURL+'login-bg.png)'">
<view class="padding-lg margin text-center text-lg text-white w100">
<text class="">
油站工作人员绑定油站
</text>
</view>
</view>
<view class="pannel">
<view class="bg-white margin padding radius ">
<view class="cu-form-group radius " @tap="routerTo('/pages/login/posLogin/posLogin')">
<view class="title text-black">已有账号登录</view>
<view class="cuIcon-right">
</view>
</view>
<view class="cu-form-group padding-top" @tap="routerTo('/pages/login/login')">
<view class="title text-black">首次认证登录</view>
<view class="cuIcon-right">
</view>
</view>
</view>
<view class="margin-left padding-left-lg">
<text class="text-sm">短信验证码登录</text>
</view>
</view>
<view class="bottom-part">
<service-hotline />
</view>
</view>
</template>
<script>
import cloudSiteApi from '@/api/cloud-site.js'
import loginApi from '@/api/login.js'
export default {
data() {
return {
baseURL: this.global.baseURL,
mainURL: this.global.mainURL,
forcedLogin: true,
oilSiteNo: ''
};
},
created() {
uni.showShareMenu()
// this.loginWeixin()
},
methods: {
routerTo(url) {
uni.navigateTo({
url: url
})
},
loginWeixin() {
uni.login({
provider: 'weixin',
success: loginRes => {
const code = loginRes.code
console.log(code)
loginApi.loginWeixin(code).then(res => {
if (res.code === 20000) {
uni.reLaunch({
url: '/pages/index/index',
fail: (err) => {
console.log(err)
}
})
uni.showToast({
title: res.msg,
icon: 'success',
duration: 3000
})
uni.setStorage({
key: 'Authorization',
data: res.data.accessToken,
success: () => {
console.log('Authorization成功', res.data.accessToken)
}
})
uni.setStorage({
key: 'device',
data: res.data.openid,
success: () => {
console.log('deviceopenid', res.data.openid)
}
})
uni.setStorageSync('userMenu', res.data.loginUser.procedureAuthList)
uni.setStorageSync('loginUser', {
id: res.data.loginUser.id,
name: res.data.loginUser.name
})
} else {
console.log('res', res.code)
}
})
},
fail: err => {
console.log(err)
}
});
},
nextStep() {
if (this.oilSiteNo) {
cloudSiteApi.verifyOilSite({
oilSiteCode: this.oilSiteNo
}).then(res => {
console.log('oilSiteCode', this.oilSiteNo)
if (res.code === 20000) {
// address: "安徽省合肥市庐阳区大杨镇"
// fuelLogo: null
// linkMan: "符红敏"
// oilSiteCode: "1591260293"
// oilSiteName: "杭州首鸿金融信息服务有限公司"
// phone: "15617055136"
uni.setStorage({
key: 'oilSiteCode',
data: this.oilSiteNo,
success: () => {
console.log('缓存成功')
}
})
uni.setStorage({
key: 'oilSite',
data: res.data,
success: () => {
console.log('缓存成功')
}
})
uni.navigateTo({
url: '/pages/Auth/Auth'
})
}
})
// uni.setStorage({
// key: 'oilSiteCode',
// data: this.oilSiteNo,
// success: () => {
// console.log('缓存成功')
// }
// })
// uni.navigateTo({
// url: '/pages/Auth/Auth'
// })
} else {
uni.showToast({
title: '请输入云站号',
duration: 3000,
icon: 'none'
})
}
},
getMsg() {
uni.requestSubscribeMessage({
tmplIds: ['W5XD3NQVa6knC5jXHeWT8GS7q5CHrDUMY_sF79kLkKk'],
success: (res) => {
console.log(res)
}
})
},
getUserInfo({
detail
}) {
console.log('三方登录只演示登录api能力暂未关联云端数据');
console.log('detail', detail)
if (detail.userInfo) {
this.loginLocal(detail.userInfo.nickName);
} else {
uni.showToast({
icon: 'none',
title: '登陆失败'
});
}
},
loginLocal(nickName) {
uni.setStorageSync('login_type', 'local')
uni.setStorageSync('username', nickName)
this.toMain(nickName);
},
toMain(userName) {
// this.login(userName)
console.log(userName)
/**
* 强制登录时使用reLaunch方式跳转过来
* 返回首页也使用reLaunch方式
*/
if (this.forcedLogin) {
uni.reLaunch({
url: '/pages/index/index',
success: () => {
console.log('success')
},
fail: err => {
console.log(err)
}
});
} else {
uni.navigateBack();
}
}
}
};
</script>
<style scoped>
.page-content {
position: relative;
}
.logo {
min-width: 100%;
text-align: center;
}
.logo img {
width: 200upx;
height: 200rpx;
background-size: contain;
margin: auto;
}
.bottom-bg {
position: sticky;
bottom: 50upx;
}
</style>

View File

@@ -1,6 +1,6 @@
<template>
<view class="page-content my-bg">
<cu-custom class="main-topbar bg-main-oil" bgColor="bg-main-oil">
<cu-custom class="main-topbar bg-main-oil" bgColor="bg-main-oil" :isBack="true">
<block slot="content">绑定星油云站</block>
</cu-custom>
<view class="bg-img margin flex padding-lg radius align-center text-center" :style="'background-image: url('+mainURL+'login-bg.png)'">
@@ -28,6 +28,9 @@
下一步
</button>
</view>
<view class="bottom-part">
<service-hotline />
</view>
</view>
</template>
@@ -43,9 +46,9 @@
oilSiteNo: ''
};
},
created() {
onLoad() {
uni.showShareMenu()
this.loginWeixin()
// this.loginWeixin()
},
methods: {
loginWeixin() {

View File

@@ -0,0 +1,289 @@
<!-- pos机账号登录入口 -->
<template>
<view class="page-content my-bg">
<cu-custom class="main-topbar bg-main-oil" bgColor="bg-main-oil" :isBack="true">
<block slot="content">星油云站</block>
</cu-custom>
<view class="bg-img margin flex padding-lg radius align-center text-center" :style="'background-image: url('+mainURL+'login-bg.png)'">
<view class="padding-lg margin text-center text-lg text-white w100">
<text class="">
油站工作人员绑定油站
</text>
</view>
</view>
<view class="pannel">
<view class="bg-white margin padding radius shadow-warp">
<view class="cu-form-group">
<view class="title text-black">手机号</view>
<input type="number" v-model="auth.phone" placeholder="请输入手机号" name="input"></input>
</view>
<view class="cu-form-group padding-top-sm" v-if="showRandom">
<view class="title text-black">验证码</view>
<input type="number" :maxlength="6" v-model="auth.captcha" placeholder="六位数字验证码" name="input"></input>
<button class='cu-btn bg-main-oil shadow' @tap="sendMsg">验证码</button>
</view>
<view class="cu-form-group padding-top-sm" v-else>
<view class="title text-black">密码</view>
<input inpitype="password" v-model="auth.password" placeholder="请输入登入密码" name="input"></input>
</view>
</view>
<view class="margin-left padding-left-lg" @tap="showRandom=true" v-if="!showRandom">
<text class="text-sm">短信验证码登录</text>
</view>
<view class="margin-left padding-left-lg" @tap="showRandom=false" v-else>
<text class="text-sm">密码登录</text>
</view>
</view>
<view class="margin-lg padding-lg bottom-bg">
<button class="bg-main-oil round" v-if="showRandom" @tap="loginRandom">
登录
</button>
<button class="bg-main-oil round" v-else @tap="loginPwd">
登录
</button>
</view>
<view class="bottom-part">
<service-hotline />
</view>
</view>
</template>
<script>
import cloudSiteApi from '@/api/cloud-site.js'
import loginApi from '@/api/login.js'
export default {
data() {
return {
baseURL: this.global.baseURL,
mainURL: this.global.mainURL,
forcedLogin: true,
oilSiteNo: '',
showRandom: true,
auth: {}
}
},
created() {
uni.showShareMenu()
// this.loginWeixin()
},
methods: {
loginPwd() {
const data3 = {
username: this.auth.phone,
password: this.auth.password,
IMEI: 'IMEI',
androidMsgId: 'androidMsgId'
}
loginApi.loginApp(data3).then(res => {
console.log('res', res)
uni.showToast({
title: res.msg,
icon: 'none'
})
})
},
loginWeixin() {
uni.login({
provider: 'weixin',
success: loginRes => {
const code = loginRes.code
console.log(code)
loginApi.loginWeixin(code).then(res => {
if (res.code === 20000) {
uni.reLaunch({
url: '/pages/index/index',
fail: (err) => {
console.log(err)
}
})
uni.showToast({
title: res.msg,
icon: 'success',
duration: 3000
})
uni.setStorage({
key: 'Authorization',
data: res.data.accessToken,
success: () => {
console.log('Authorization成功', res.data.accessToken)
}
})
uni.setStorage({
key: 'device',
data: res.data.openid,
success: () => {
console.log('deviceopenid', res.data.openid)
}
})
uni.setStorageSync('userMenu', res.data.loginUser.procedureAuthList)
uni.setStorageSync('loginUser', {
id: res.data.loginUser.id,
name: res.data.loginUser.name
})
} else {
console.log('res', res.code)
}
})
},
fail: err => {
console.log(err)
}
});
},
sendMsg() {
const data2 = {
phone: this.auth.phone
}
loginApi.loginAppSendSms(data2).then(res => {
console.log('res', res)
uni.showToast({
title: res.msg,
icon: 'none'
})
})
},
loginRandom() {
uni.login({
provider: 'weixin',
success: loginRes => {
const code = loginRes.code
console.log(code)
const data2 = {
phone: this.auth.phone,
username: "mock", //类型String 必有字段 备注:手机号
verifyCode: "mock", //类型String 必有字段 备注:验证码
code: "mock" //类型String 必有字段 备注微信code
}
loginApi.loginWeiXinSMS(data2).then(res => {
console.log('res', res)
uni.showToast({
title: res.msg,
icon: 'none'
})
console.log('oilSiteCode', this.oilSiteNo)
if (res.code === 20000) {
// address: "安徽省合肥市庐阳区大杨镇"
// fuelLogo: null
// linkMan: "符红敏"
// oilSiteCode: "1591260293"
// oilSiteName: "杭州首鸿金融信息服务有限公司"
// phone: "15617055136"
uni.setStorage({
key: 'oilSiteCode',
data: this.oilSiteNo,
success: () => {
console.log('缓存成功')
}
})
uni.setStorage({
key: 'oilSite',
data: res.data,
success: () => {
console.log('缓存成功')
}
})
uni.navigateTo({
url: '/pages/Auth/Auth'
})
}
})
},
fail: err => {
console.log(err)
}
});
// uni.setStorage({
// key: 'oilSiteCode',
// data: this.oilSiteNo,
// success: () => {
// console.log('缓存成功')
// }
// })
// uni.navigateTo({
// url: '/pages/Auth/Auth'
// })
},
getMsg() {
uni.requestSubscribeMessage({
tmplIds: ['W5XD3NQVa6knC5jXHeWT8GS7q5CHrDUMY_sF79kLkKk'],
success: (res) => {
console.log(res)
}
})
},
getUserInfo({
detail
}) {
console.log('三方登录只演示登录api能力暂未关联云端数据');
console.log('detail', detail)
if (detail.userInfo) {
this.loginLocal(detail.userInfo.nickName);
} else {
uni.showToast({
icon: 'none',
title: '登陆失败'
});
}
},
loginLocal(nickName) {
uni.setStorageSync('login_type', 'local')
uni.setStorageSync('username', nickName)
this.toMain(nickName);
},
toMain(userName) {
// this.login(userName)
console.log(userName)
/**
* 强制登录时使用reLaunch方式跳转过来
* 返回首页也使用reLaunch方式
*/
if (this.forcedLogin) {
uni.reLaunch({
url: '/pages/index/index',
success: () => {
console.log('success')
},
fail: err => {
console.log(err)
}
});
} else {
uni.navigateBack();
}
}
}
};
</script>
<style scoped>
.page-content {
min-height: 100%;
position: relative;
}
.logo {
min-width: 100%;
text-align: center;
}
.logo img {
width: 200upx;
height: 200rpx;
background-size: contain;
margin: auto;
}
.bottom-bg {
position: sticky;
bottom: 50upx;
}
</style>

View File

@@ -0,0 +1,35 @@
<template>
<view class="page-content my-bg">
<cu-custom bgColor="bg-gradual-pink" :isBack="true">
<block slot="backText">返回</block>
<block slot="content">列表</block>
</cu-custom>
<view class="margin bg-white radius">
<view class="margin">
<area-time />
</view>
</view>
</view>
</template>
<script>
import areaTime from '@/components/area-time.vue'
export default {
components: {
areaTime
},
data() {
return {
}
},
methods: {
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,8 @@
<template>
</template>
<script>
</script>
<style>
</style>

View File

@@ -0,0 +1,8 @@
<template>
</template>
<script>
</script>
<style>
</style>

View File

@@ -0,0 +1,246 @@
<template>
<view class="page-content my-bg">
<cu-custom class="main-topbar bg-main-oil" bgColor="bg-main-oil" :isBack="true">
<block slot="content">经营分析</block>
<block slot="backText">返回</block>
</cu-custom>
<view class="main-money bg-main-oil">
<view class="padding-xs flex align-center">
<view class="flex-sub text-center padding-top-lg">
<view class="txet-xxs">
<text class="text-white">昨日交易金额()</text>
</view>
<view class=" text-sl padding padding-top-xs"><text class="text-white">{{userAccount.totalMoney|numberFilter}}</text></view>
</view>
</view>
</view>
<view class="bg-main-oil bg-main-color main-money">
</view>
<view class="bg-white radius margin-left margin-right to-top">
<view class=" flex ">
<view class="padding text-center flex-sub" @tap="routerTo('/pages/orderList/dailyOrder/dailyOrder')">
<text>交易笔数</text>
<view class="padding-sm">
<text class="oil-main-color">{{userAccount.totalCount}}</text>
</view>
<!-- <button class="cu-btn bg-main-oil text-white text-sm ">
查看明细
</button> -->
</view>
<view class="padding text-center flex-sub">
<text>顾客数</text>
<view class="padding-sm">
<text class="oil-main-color">{{userAccount.totalMoney|numberFilter}}</text>
</view>
<!-- <button class="cu-btn bg-main-oil text-white text-sm ">
查看明细
</button> -->
</view>
</view>
</view>
<view class="margin">
<view class="cu-list menu-avatar radius">
<view class="cu-item">
<view class="cu-avatar round lg" :style="'background-image: url('+mainURL+'default-avator.png)'">
</view>
<view class="content ">
<text>经营分析日报</text>
</view>
<view class="action">
<button class="cu-btn padding-left-xs padding-right-xs bg-white" @tap="routerTo('/pages/operation-analysis/analysis/analysis')">
<text class="cuIcon-right"></text>
</button>
</view>
</view>
<view class="cu-item">
<view class="cu-avatar round lg" :style="'background-image: url('+mainURL+'default-avator.png)'">
</view>
<view class="content">
<text> 经营分析月报</text>
</view>
<view class="action solid-left">
<button class="cu-btn padding-left-xs padding-right-xs bg-white" @tap="routerTo('path')">
<text class="cuIcon-right"></text>
</button>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import staffApi from '@/api/staff.js'
import cloudSiteApi from '@/api/cloud-site.js'
export default {
data() {
return {
mainURL: this.global.mainURL,
userAccount: {
totalCount: 0,
totalMoney: 0.00
},
scanUrl: '',
userMenu: uni.getStorageSync('userMenu'),
loginUser: uni.getStorageSync('loginUser'),
title: 'Hello',
cuIconList: []
};
},
onLoad() {
uni.showShareMenu()
uni.navigateTo({
url:''
})
},
onShow() {
},
onPullDownRefresh() {
this.getUserInfo()
},
filters: {
numberFilter(value) {
if (value) {
value = value - 1 + 1
return value.toFixed(2)
} else {
return '0.00'
}
}
},
methods: {
getSiteInfo() {
cloudSiteApi.getSiteDetail().then(res => {
if (res.code === 20000) {
this.site = res.data.site
this.oilList = res.data.oil
uni.setStorage({
key: 'oilSite',
data: res.data.site
})
}
})
},
getUserInfo() {
cloudSiteApi.getSiteBasicData().then(res => {
console.log('用户资料', res)
uni.stopPullDownRefresh();
if (res.code === 20000) {
this.userAccount = res.data
}
})
},
scanQr() {
var that = this
uni.scanCode({
onlyFromCamera: true,
success: function(res) {
console.log('条码类型:' + res.scanType);
console.log('条码内容:' + res.result);
uni.setStorageSync('qrCode', res.result)
uni.navigateTo({
url: that.scanUrl,
fail: (err) => {
console.log(err)
},
success: (res) => {
console.log('chengg', res)
}
})
}
})
},
// 方便开发
// scanQr() {
// uni.setStorageSync('qrCode', 'XM&1299257961238990848')
// uni.navigateTo({
// url: '/pages/stationDetail/stationDetail',
// fail: (err) => {
// console.log(err)
// },
// success: (res) => {
// console.log('chengg', res)
// }
// })
// },
routerTo(url, name) {
uni.navigateTo({
url: url
})
}
}
};
</script>
<style scoped>
.bottom-bar {
position: relative;
padding-top: 50px;
margin-bottom: 0;
margin-top: 0;
}
.main-topbar>>>.cu-bar {
height: 380rpx !important;
z-index: 0 !important;
}
.main-topbar>>>.cu-bar .content {
padding-bottom: 300rpx;
}
.bottom-bar-fixed {
position: fixed;
bottom: 0;
padding-top: 70rpx;
width: 100%;
}
.main-money {
position: relative;
z-index: 1;
}
.van-tag {
display: inline-block;
padding: 0.3rem 0.4rem;
position: absolute;
right: 1px;
font-size: 12px;
top: 25%;
background-color: #b9ffca;
border-radius: 10rem 0 0 10rem;
border-color: transparent;
}
.bg-main-color {
min-height: 160rpx;
}
.to-top {
position: relative;
top: -140rpx;
z-index: 1;
}
.cu-list {
position: relative;
top: -140rpx;
z-index: 1;
}
.cu-list.grid>.cu-item [class*=cuIcon] {
font-size: 75rpx;
}
</style>

View File

@@ -21,13 +21,13 @@
<view class="text-lg text-center">{{orderItem.istate|formatStr}}</view>
<view class="number text-xl text-center oil-main-color">{{orderItem.realamount|numberFormat}}</view>
</view>
<view class="margin-bottom-sm" @tap="copyId(orderItem.orderID,'加油司机编号')">
<view class="margin-bottom-sm" @tap="copyId(orderItem.driverID,'加油司机编号')">
加油司机编号
<text class="fr">{{orderItem.driverID}}<text class="flex-sub padding-left-sm text-right cuIcon-copy text-lg text-red">
</text></text>
</view>
<view class="margin-bottom-sm" @tap="copyId(orderItem.orderID,'司机车牌')">
<view class="margin-bottom-sm" @tap="copyId(orderItem.carNo,'司机车牌')">
司机车牌
<text class="fr">{{orderItem.carNo}}<text class="flex-sub padding-left-sm text-right cuIcon-copy text-lg text-red">
</text></text>

View File

@@ -0,0 +1,211 @@
<template>
<view class="content my-bg">
<cu-custom class="main-totextbar bg-main-oil" :isBack="true" bgColor="bg-main-oil">
<block slot="backText">返回</block>
<block slot="content">加油记录</block>
</cu-custom>
<scroll-view scroll-x class="bg-white nav">
<view class="flex text-center">
<view
class="cu-item flex-sub"
:class="index==TabCur?'text-orange cur':''"
v-for="(item,index) in tabList"
:key="index"
@tap="tabSelect"
:data-id="index"
>{{item}}</view>
</view>
</scroll-view>
<view class="padding  padding-bottom-0">
<view v-show="TabCur==0" class="order-list">
<view  v-for="item in allOrder" v-if="allOrder.length" :key="item.orderID">
<OrderItem class="cu-list order-item menu-avatar comment" :item="item" />
</view>
<view v-if="allOrder.length<1">
<Empty />
</view>
<view v-show="load.isLoadMore1">
<uni-load-more :status="load.loadStatus1"></uni-load-more>
</view>
</view>
<view v-show="TabCur==1" class="order-list">
<view v-for="item in payingOrder" v-if="payingOrder.length" :key="item.orderID">
<OrderItem class="cu-list order-item menu-avatar comment" :item="item" />
</view>
<view v-if="payingOrder.length<1">
<Empty />
</view>
<view v-show="load.isLoadMore2">
<uni-load-more :status="load.loadStatus2"></uni-load-more>
</view>
</view>
<view v-show="TabCur==2" class="order-list">
<view   v-for="item in finishedOrder" v-if="finishedOrder.length" :key="item.orderID">
<OrderItem class="cu-list order-item menu-avatar comment" :item="item" />
</view>
<view v-if="finishedOrder.length<1">
<Empty />
</view>
<view v-show="load.isLoadMore3">
<uni-load-more :status="loadStatus3"></uni-load-more>
</view>
</view>
</view>
</view>
</template>
<script>
import cloudSiteApi from '@/api/cloud-site.js'
import OrderItem from '@/components/order-item'
import UniLoadMore from '@/components/uni-load-more/uni-load-more.vue'
import Empty from '@/components/Empty'
export default {
components: {
OrderItem,
Empty,
UniLoadMore
},
data() {
return {
tabList: [
'全部', '待支付', '已支付'
],
TabCur: 0,
pageNumber: 1,
istate: -3,
scrollLeft: 0,
order: {
istate: 0,
vol: 3,
oilName: '0#',
orderID: '15979997825872',
oilCode: '12396989',
oilSiteName: '疯疯疯加油站',
carNo: '皖A12354',
sourceType: 3,
realamount: 4.66,
credateDatetime: '2020-10-12 12:30:10'
},
allOrder: [],
finishedOrder: [],
payingOrder: [],
loadStatus: 'loading', //加载样式more-加载前样式loading-加载中样式nomore-没有数据样式
isLoadMore: false, //是否加载中
pageNumber1: 1,
pageNumber2: 1,
pageNumber3: 1,
load: {
isLoadMore1: false,
loadStatus1: 'loading',
isLoadMore2: false,
loadStatus2: 'loading',
isLoadMore3: false,
loadStatus3: 'loading',
}
}
},
created() {
this.loadList(-3, this.pageNumber1)
this.loadList(0, this.pageNumber2)
this.loadList(1, this.pageNumber3)
},
onReachBottom() { //上拉触底函数
if (this.TabCur === 0) {
if (!this.load.isLoadMore1) { //此处判断,上锁,防止重复请求
this.load.isLoadMore1 = true
this.calcIstate(this.TabCur)
}
}
if (this.TabCur === 1) {
if (!this.load.isLoadMore2) { //此处判断,上锁,防止重复请求
this.load.isLoadMore2 = true
this.calcIstate(this.TabCur)
}
}
if (this.TabCur === 2) {
if (!this.load.isLoadMore3) { //此处判断,上锁,防止重复请求
this.load.isLoadMore3 = true
this.calcIstate(this.TabCur)
}
}
},
methods: {
tabSelect(e) {
this.TabCur = e.currentTarget.dataset.id;
this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60
},
calcIstate(id) {
switch (id) {
case 0:
this.istate = -3
this.loadList(this.istate, this.pageNumber1)
break
case 1:
this.istate = 0
this.loadList(this.istate, this.pageNumber2)
break
case 2:
this.istate = 1
this.loadList(this.istate, this.pageNumber3)
break
}
},
loadList(istate, pageNumber) {
const data2 = {
istate: istate, //类型Number 必有字段 备注:订单状态 0待支付 1支付成功 -3 查所有
pageIndex: pageNumber //类型Number 必有字段 备注:查询第几页,默认一页10条
}
cloudSiteApi.getSiteOrder(data2).then(res => {
console.log(data2.istate, data2.pageIndex)
if (res.code === 20000) {
switch (istate) {
case -3:
this.allOrder = this.allOrder.concat(res.data)
if (res.data.length < 10) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
this.load.isLoadMore1 = true
this.load.loadStatus1 = 'nomore'
} else {
this.pageNumber1++
this.load.isLoadMore1 = false
}
break
case 0:
this.payingOrder = this.payingOrder.concat(res.data)
if (res.data.length < 10) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
this.load.isLoadMore2 = true
this.load.loadStatus2 = 'nomore'
} else {
this.pageNumber2++
this.load.isLoadMore2 = false
}
break
case 1:
this.finishedOrder = this.finishedOrder.concat(res.data)
if (res.data.length < 10) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
this.load.isLoadMore3 = true
this.load.loadStatus3 = 'nomore'
} else {
this.pageNumber3++
this.load.isLoadMore3 = false
}
break
}
}
})
}
}
}
</script>
<style scoped>
.content {
min-height: 100%;
}
.order-list .order-item:last-of-type {
margin-bottom: 0;
}
</style>

View File

@@ -157,7 +157,7 @@ export default {
istate: istate, //类型Number 必有字段 备注:订单状态 0待支付 1支付成功 -3 查所有
pageIndex: pageNumber //类型Number 必有字段 备注:查询第几页,默认一页10条
}
cloudSiteApi.getSiteOrder(data2).then(res => {
cloudSiteApi.getAllSiteOrder(data2).then(res => {
console.log(data2.istate, data2.pageIndex)
if (res.code === 20000) {
switch (istate) {

View File

@@ -53,6 +53,8 @@
};
},
onShow() {
this.staffList = []
this.currentPage = 1
this.getList()
},
onPullDownRefresh() {
@@ -62,7 +64,6 @@
},
onReachBottom() {
if (!this.isLoadMore) {
this.getList()
}
},

View File

@@ -9,7 +9,7 @@
<view class="placeholder">
<view class="cu-list no-border menu-avatar ">
<view class="cu-item ">
<view class="cu-avatar round lg" style="background-image:url(https://ossweb-img.qq.com/images/lol/web201310/skin/big10001.jpg);"></view>
<view class="cu-avatar round lg" :style="'background-image: url('+mainURL+'default-avator.png)'"></view>
<view class="content">
<view class="text-white">{{userInfo.cUserName}}</view>
<view class="text-white flex" @tap="callStaff(userInfo.phone)">
@@ -25,7 +25,7 @@
<view class="user-info">
<view class="cu-list no-border menu-avatar ">
<view class="cu-item no-border">
<view class="cu-avatar round lg" style="background-image:url(https://ossweb-img.qq.com/images/lol/web201310/skin/big10001.jpg);"></view>
<view class="cu-avatar round lg" :style="'background-image: url('+mainURL+'default-avator.png)'"></view>
<view class="content">
<view class="text-white">{{userInfo.cUserName}}</view>
<view class="text-white flex" @tap="callStaff(userInfo.phone)">

View File

@@ -0,0 +1,106 @@
<!-- 启动页 -->
<template>
<view class="page-content ">
<!-- <view class="">
<text>
查看油站订单 更便捷
</text>
<text>
加油单价 清晰明了
</text>
</view> -->
<view class="text-center logo-part">
<view class="cu-avatar xl text-sl" :style="'background-image: url('+mainURL+'qr-icon.png)'"></view>
<view class="">
<text class="text-lg">
星油云站
</text>
</view>
</view>
</view>
</template>
<script>
import loginApi from '@/api/login.js'
export default {
data() {
return {
mainURL: this.global.mainURL
}
},
onLoad() {
this.loginWeixin()
},
methods: {
loginWeixin() {
uni.login({
provider: 'weixin',
success: loginRes => {
const code = loginRes.code
console.log(code)
loginApi.loginWeixin(code).then(res => {
if (res.code === 20000) {
uni.reLaunch({
url: '/pages/index/index',
fail: (err) => {
console.log(err)
}
})
uni.showToast({
title: res.msg,
icon: 'success',
duration: 3000
})
uni.setStorage({
key: 'Authorization',
data: res.data.accessToken,
success: () => {
console.log('Authorization成功', res.data.accessToken)
}
})
uni.setStorage({
key: 'device',
data: res.data.openid,
success: () => {
console.log('deviceopenid', res.data.openid)
}
})
uni.setStorageSync('userMenu', res.data.loginUser.procedureAuthList)
uni.setStorageSync('loginUser', {
id: res.data.loginUser.id,
name: res.data.loginUser.name
})
} else {
uni.reLaunch({
url: '/pages/login/boforeLogin/boforeLogin',
fail: (err) => {
console.log(err)
}
})
console.log('res', res.code)
}
})
},
fail: err => {
console.log(err)
}
});
},
}
}
</script>
<style scoped>
.logo-part {
position: absolute;
top: 30%;
min-width: 100%;
}
.cu-avatar {
background-color: #fff;
}
</style>

View File

@@ -96,6 +96,7 @@
},
onLoad() {
this.getSiteInfo()
uni.showShareMenu()
},
methods: {
getSiteInfo() {