Commit 60b974b3 by zhangzhen

功能优化

parent 90ab08af
......@@ -2,7 +2,7 @@ import http from "@/common/vmeitime-http/index.js"
import config from "@/config/index.config.js"
// 注册
export const register=(data)=>{
let url=`/wechat/register/binding/phone`
let url=`/wechat/register/wx/phone`
return http.post(url,data)
}
// 登录
......
......@@ -42,3 +42,13 @@ export const getOrderByAvailable=()=>{
return http.get(url)
}
export const orderRefund=(data)=>{
let url=`/order/refund`
return http.post(url,data)
}
// 消费记录表
export const recordsList=(data,)=>{
let url=`/records/list`
return http.get(url,data)
}
\ No newline at end of file
......@@ -72,11 +72,11 @@ http.interceptor.response = (config) => {
/\/chessCards\/consumeByUser/g
]
if (urls.some(item => item.test(config.config.url)) && config.data.code == 401) {
uni.navigateTo({
url: '/pages/login/login'
})
}
// if (urls.some(item => item.test(config.config.url)) && config.data.code == 401) {
// uni.navigateTo({
// url: '/pages/login/login'
// })
// }
if (![401, 200, 500].includes(config.data.code)) {
uni.showToast({
icon: "none",
......
<template>
<uni-popup ref="popupPhone" type="bottom" :maskClick="false">
<view class="flex-col location-box">
<view class="flex-col content-box">
<view class="title">
<text class="text-black text-xl text-bold">提示</text>
</view>
<view class="content">
<text class="text-black text-lg">为了提供更精准的服务,需获取您的手机号</text>
</view>
<view class="phone-box btn-box">
<button class="cu-btn round bg-pink block" open-type="getPhoneNumber" @getphonenumber="onGetPhoneNumber">授权手机号</button>
</view>
</view>
</view>
</uni-popup>
</template>
<script>
import {
register,
} from "@/api/index.js";
export default {
name:"login",
data() {
return {
phoneCode:''
};
},
methods:{
open(){
this.$refs.popupPhone.open()
},
onGetPhoneNumber(e){
this.phoneCode = e.detail.code;
wx.login({
success: (res) => {
uni.showLoading({
title: "授权中"
})
register({
loginCode:res.code,
phoneCode: this.phoneCode,
type: "routine",
}).then(res => {
if (res.data.code == 200) {
uni.setStorageSync('tokenHeaders', "Authori-zation")
uni.setStorage({
key: uni.getStorageSync('tokenHeaders'),
data: res.data.data.token,
success: (res) => {
this.$refs.popupPhone.close()
that.$emit('success')
}
})
}
})
}
})
}
}
}
</script>
<style lang="scss" scoped>
.location-box{
display: flex;
flex-direction: column;
width: 100%;
min-height: 600upx;
.content-box{
display: flex;
flex-direction: column;
width: 90%;
background-color: #ffffff;
border: 1px solid #B70469;
border-radius: 20upx;
margin: 0 auto 40upx;
.title{
display: flex;
justify-content: center;
align-items: center;
padding: 30upx 0;
border-bottom: 1px solid #B70469;
}
.content{
display: flex;
justify-content: center;
align-items: center;
padding: 30upx;
min-height: 300upx;
}
.phone-box{
display: flex;
justify-content: center;
align-items: center;
padding: 30upx 0;
.cu-btn{
width: 70%;
}
}
}
.btn-box{
display: flex;
justify-content: space-between;
width: 84%;
margin: 0 auto;
.cu-btn{
width: 40%;
}
}
}
</style>
\ No newline at end of file
......@@ -4,13 +4,17 @@
<text class="cuIcon-peoplefill text-xxl text-gray"></text>
</view>
<view class="tip">
<text>您还未登录,点击</text>
<button class="cu-btn bg-pink radius margin-top">登录</button>
<text>您还未授权登录,点击</text>
<button class="cu-btn bg-pink radius margin-top" open-type="getPhoneNumber" @getphonenumber="onGetPhoneNumber">授权登录</button>
</view>
</view>
</template>
<script>
import {
register,
} from "@/api/index.js";
export default {
name:"noLogin",
props:{
......@@ -28,6 +32,35 @@
value(val){
this.show = val
}
},
methods:{
onGetPhoneNumber(e){
let that = this;
this.phoneCode = e.detail.code;
wx.login({
success: (res) => {
uni.showLoading({
title: "授权中"
})
register({
loginCode:res.code,
phoneCode: this.phoneCode,
type: "routine",
}).then(res => {
if (res.data.code == 200) {
uni.setStorageSync('tokenHeaders', "Authori-zation")
uni.setStorage({
key: uni.getStorageSync('tokenHeaders'),
data: res.data.data.token,
success: (res) => {
that.$emit('success')
}
})
}
})
}
})
}
}
}
</script>
......
......@@ -2,7 +2,7 @@ const CONFIG = {
// 开发环境配置
development: {
assetsPath: 'https://www.coujio.com/wechat_static', // 静态资源路径
baseUrl: 'http://192.168.1.189:8883/front-api', // 后台接口请求地址
baseUrl: 'https://www.coujio.com/front-api', // 后台接口请求地址
hostUrl: 'https://www.coujio.com/prod-api', // H5地址(前端运行地址)
// baseUrl: 'http://192.168.1.189:8883/front', // 后台接口请求地址
// hostUrl: 'http://192.168.1.189:8882', // H5地址(前端运行地址)
......
......@@ -27,7 +27,8 @@
</view>
<view v-if="storeInfo && storeInfo.distance" class="flex-1 flex-row">
<text class="cuIcon-locationfill text-red"></text>
<text>距您{{Number(storeInfo.distance).toFixed(2)}}公里</text>
<text>距您{{storeInfo.distance}}公里</text>
</view>
<view v-else class="flex-1 flex-row">
......@@ -109,11 +110,13 @@
</view>
</view>
</uni-popup>
<LoginPop ref="loginPop" >
</view>
</template>
<script>
import fNavbar from '@/components/module/f-navbar/f-navbar';
import LoginPop from "@/components/login/login"
import {
login,
dictList
......@@ -130,7 +133,8 @@
export default {
components: {
fNavbar,
ToolBox
ToolBox,
LoginPop
},
data() {
return {
......@@ -192,6 +196,7 @@
console.log(obj, 909090)
this.storeInfo = {
...obj,
distance:Number(obj.distance.substr(0,8)).toFixed(2),
roomVoList: obj.roomVoList.length ? obj.roomVoList.map(item => {
return {
...item,
......@@ -218,7 +223,9 @@
},
onLoad(option) {
this.onCheckUserLogin();
this.onGetDicts()
// this.$refs.loginPop.open()
},
methods: {
onGetDicts() {
......@@ -236,15 +243,32 @@
})
}
},
onCheckUserLogin(){
wx.login({
success: (res) => {
login(res.code).then(res => {
if (res.data.code == 200) {
if (res.data.data.type === "login") {
uni.setStorageSync('tokenHeaders', "Authori-zation")
uni.setStorage({
key: uni.getStorageSync('tokenHeaders'),
data: res.data.data.token
})
} else {
this.$refs.loginPop.open();
}
}
})
}
})
},
onLoading() {
uni.showLoading({
title: "加载中..."
})
uni.getSetting({
complete: (res) => {
console.log(res,909090)
if(res.authSetting['scope.userLocation']){
console.log("打开了定位设置")
uni.getLocation({
type: "gcj02",
success: (result) => {
......@@ -296,6 +320,7 @@
obj = res.data.data[0];
this.storeInfo = {
...obj,
distance:Number(obj.distance.substr(0,8)).toFixed(2),
roomVoList: obj.roomVoList.map(item => {
return {
...item,
......@@ -335,7 +360,7 @@
scale: 18,
name: this.storeInfo.address,
complete: (res) => {
console.log(res)
}
})
},
......@@ -343,18 +368,17 @@
uni.makePhoneCall({
phoneNumber: this.storeInfo.phone,
complete: (res) => {
console.log(res)
}
})
},
onTouchStart() {
console.log("asdasdasdas")
this.timer = null;
this.show = true;
},
onScroll(e) {
this.scrollTop = e.target.scrollTop;
console.log("2222222222")
if (!this.timer) {
this.timer = setTimeout(() => {
this.show = false;
......@@ -362,7 +386,6 @@
}
},
// onTouchMove() {
// console.log("2222222222")
// if (!this.timer) {
// this.timer = setTimeout(() => {
// this.show = false;
......@@ -384,7 +407,6 @@
uni.openSetting({
scope:"scope.userLocation",
complete: (res) => {
console.log(res,909090)
this.onClose();
this.onLoading()
}
......@@ -780,4 +802,5 @@
}
}
}
</style>
\ No newline at end of file
......@@ -36,7 +36,7 @@
<view class="cu-avatar xl round margin-bottom">
<image class="avatar-img" :src=" assetsPath+'/cart.png'" mode="scaleToFill"></image>
</view>
<button class="cu-btn round bg-white" @tap="onNavToLogin">登录/注册</button>
<button class="cu-btn round bg-white" @tap="onNavToLogin">授权登录</button>
</view>
</view>
</view>
......@@ -85,14 +85,19 @@
<text class="cuIcon-exit"></text>退出登录
</button>
</view> -->
<LoginPop ref="loginPop" @success="onCheckUserLogin">
</view>
</template>
<script>
import {getUserInfo,loginOut} from "@/api/index.js"
import config from "@/config/index.config"
import LoginPop from "@/components/login/login"
export default {
components: {
LoginPop
},
data() {
return {
loginStatus: true,
......@@ -110,7 +115,7 @@
{
label:"消费记录",
iconUrl:config.assetsPath+'/record_icon.png',
routePath:"",
routePath:"/pages/payRecord/index",
type:"",
show:true
},
......@@ -158,9 +163,7 @@
})
},
onNavToLogin() {
uni.navigateTo({
url: "/pages/login/login"
})
this.$refs.loginPop.open();
},
onNavToMyCoupon(){
uni.navigateTo({
......
......@@ -267,11 +267,12 @@
</view>
</view>
</uni-popup>
<LoginPop ref="loginPop" @success='onLoading'>
</view>
</template>
<script>
import LoginPop from "@/components/login/login"
import config from "@/config/index.config"
import moment from "@/common/moment_zh_cn.js";
import {
......@@ -288,6 +289,9 @@
} from "@/api/order"
export default {
components: {
LoginPop
},
data() {
let dateList = [];
for (let i = 0; i < 5; i++) {
......@@ -594,11 +598,13 @@
preEndDate: dateObj.endDate
}).then(res => {
if (res.statusCode == 200) {
if (res.data.code == 200) {
if (res.data && res.data.data.length) {
this.useCouponList = res.data.data.filter(item => item.isAvailable === 0).sort((a,
b) => b.subPrice - a.subPrice);
}
}else if(res.data.code == 200){
this.$refs.loginPop.open();
}
this.onComputePrice();
})
......
......@@ -98,16 +98,19 @@
</view>
</view>
<!-- <view v-if="orderInfo.status === 0" class="cancle-btn-box">
<button class="cu-btn bg-pink round block lg">立即退单</button>
</view> -->
<view v-if="orderInfo.status ===0 && orderInfo.isRefund " class="cancle-btn-box">
<button class="cu-btn bg-pink round block lg" @tap="onOrderRefund">立即退单</button>
</view>
</view>
<uni-popup ref="popup" type="dialog">
<uni-popup-dialog mode="base" content="请确认是否退单" :duration="2000" :before-close="true" @close="close" @confirm="confirm"></uni-popup-dialog>
</uni-popup>
</view>
</template>
<script>
import fNavbar from '@/components/module/f-navbar/f-navbar';
import {getOrderInfoByNo} from "@/api/order.js"
import {getOrderInfoByNo,orderRefund} from "@/api/order.js"
import moment from "@/common/moment_zh_cn.js";
import {openDoor} from "@/api/order.js"
import config from "@/config/index.config"
......@@ -177,6 +180,33 @@
uni.navigateTo({
url:`/pages/order/order?roomId=${this.orderInfo.roomId}&orderNo=${this.orderInfo.orderNo}`
})
},
onOrderRefund(){
this.$refs.popup.open();
},
close(){
this.$refs.popup.close();
},
confirm(){
orderRefund({
orderNo:this.orderInfo.orderNo,
amount:this.orderInfo.payPrice,
approvalStatus:1
}).then(res=>{
if(res.data.code == 200){
this.close()
uni.showToast({
icon:'none',
title:'退单已提交'
})
this.onLoading()
}else{
uni.showToast({
icon:'none',
title:res.data.msg
})
}
})
}
}
}
......
<template>
<view class="order-record">
<view v-if="loginStatus" class="content-box">
<view class="list-content">
<view v-for="(item,index) in list" :key="index" class="list-item" @tap="onNavToOrderInfo(item)">
<view class="flex-between part-1">
<view class="">
<text>{{item.payType==1?'微信支付':'余额支付'}}:</text>
<text class="text-black text-bold text-lg">{{item.payPrice}}</text>
</view>
<view class="flex-row">
<text>{{item.orderType==1?'房间预定':'房间续订'}}</text>
</view>
</view>
<view class="flex-row part-1">
<text>订单编号:</text>
<text>{{item.orderNo}}</text>
</view>
<view class="flex-between part-1">
<text>创建时间:</text>
<text>{{item.createTime}}</text>
</view>
</view>
</view>
</view>
<u-empty v-if="loginStatus && list.length == 0" text="未查询到相关订单" textColor='#C1C1C1'></u-empty>
<view v-if="loginStatus && list.length" style="padding: 12px 6% 0;">
<u-loadmore :status="status" :icon="true" :line='true' :loading-text="loadingText"
:loadmore-text="loadmoreText" :nomore-text="nomoreText" />
</view>
<NoLogin v-model="loginStatus" />
</view>
</template>
<script>
import {
recordsList
} from "@/api/order.js"
import NoLogin from "@/components/noLogin/noLogin"
import {
getDictItem
} from "@/utils/tools.js"
export default {
components:{
NoLogin
},
data() {
return {
status: 'nomore ',
loadingText: '努力加载中',
loadmoreText: '上划加载',
nomoreText: '到底啦',
statusIndex: 0,
list: [],
statusList: [{
label: "全部",
value: "",
},
{
label: "已预约",
value: "0",
},
{
label: "使用中",
value: "1",
},
{
label: "已完成",
value: "2",
},
{
label: "退单",
value: "3",
}
],
queryParams: {
pageNum: 1,
pageSize: 10
},
loginStatus:true,
orderStatusEnum:{}
};
},
onLoad() {
},
onReachBottom() {
if (this.status == 'loadmore') {
this.queryParams.pageNum += 1;
this.onLoading();
}
},
onShow() {
this.onGetDicts()
},
methods: {
onGetDicts() {
let dicts = []
if (uni.getStorageSync('dicts')) {
dicts = JSON.parse(uni.getStorageSync('dicts'))
this.orderStatusEnum = getDictItem(dicts, "store_order_status");
this.onLoading()
} else {
dictList().then(res => {
dicts = res.data.data;
uni.setStorageSync('dicts', JSON.stringify(res.data.data))
this.orderStatusEnum = getDictItem(dicts, "store_order_status");
this.onLoading()
})
}
},
onLoading() {
uni.showLoading({
title: '加载中'
})
this.status = 'loading'
this.queryParams.status = this.statusList[this.statusIndex].value;
recordsList(this.queryParams).then(res => {
console.log(res)
uni.hideLoading()
if (res.data.code == 200) {
if(this.queryParams.pageNum ==1){
this.list = res.data.rows
}else{
this.list = [...this.list,...res.data.rows]
}
if(this.list.length < res.data.total){
this.status = "loadmore"
}else{
this.status = 'nomore'
}
}else if(res.data.code == 401){
this.loginStatus = false
}
})
},
tabSelect(i) {
console.log(i, 99999)
this.statusIndex = i;
this.queryParams.pageNum = 1;
this.list = []
this.onLoading()
},
onNavToOrderInfo(val){
uni.navigateTo({
url:"/pages/orderResult/orderResult?orderNo="+val.orderNo
})
}
}
}
</script>
<style>
page{
background-color: #f1f1f1;
}
</style>
<style lang="scss" scoped>
.order-record {
display: flex;
flex-direction: column;
.content-box {
display: flex;
flex-direction: column;
.list-content{
display: flex;
flex-direction: column;
align-items: center;
.list-item{
width: 94%;
padding: 30upx 20upx;
border-radius: 20upx;
background-color: #ffffff;
margin-top: 30upx;
.part-1{
display: flex;
align-items: center;
padding: 10upx;
}
}
}
}
}
</style>
\ No newline at end of file
<template>
<view class="set-user-info">
<f-navbar title="个人资料" fontColor="#333333" :bgColor="PrimaryColor"
:isShowLeft="true" :isShowTransparentTitle="true">
<view class="u-flex" slot="left">
<text style="font-size: 44rpx;" class="cuIcon-back text-black"></text>
</view>
</f-navbar>
<view class="main-content">
<view class="user-avatar-box" @tap="onChangeAvatar">
<view class="avatar">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment