@@ -110,19 +110,19 @@ export default function useOrderListItem(props) { | |||
res = await request(orderList, options); | |||
const data = stringToJson(res.bizContent); | |||
console.log("ordersList.value", ordersList.value) | |||
// 订单发货后未激活 30天 以后 结束订单功能 insertTime >30 | |||
// 订单发货后未激活 30天 以后 结束订单功能 insertTime >30 算出来距离今天是负数 | |||
for (var k = 0; k < ordersList.value.length; k++) { | |||
console.log("ordersList.value1111", ordersList.value[k]['insertTime'].replace("T", " ")) | |||
console.log("ordersList.value1111", timesDiff(ordersList.value[k]['insertTime'].replace("T", " "))) | |||
if (ordersList.value[k]['insertTime']) { | |||
if (timesDiff(ordersList.value[k]['insertTime'].replace("T", " ")).days <= -30) { | |||
if (timesDiff(ordersList.value[k]['insertTime'].replace("T", " ")).days > 30) { | |||
ordersList.value[k]['finishOrder'] = true //可以结束 | |||
} else { | |||
ordersList.value[k]['finishOrder'] = false //不可以结束 | |||
} | |||
} | |||
if (ordersList.value[k]['updateTime']) { | |||
if (timesDiff(ordersList.value[k]['updateTime'].replace("T", " ")).days <= -30) { | |||
if (timesDiff(ordersList.value[k]['updateTime'].replace("T", " ")).days <= 30) { | |||
ordersList.value[k]['isUseAgain'] = true //可以再次使用 | |||
} else { | |||
ordersList.value[k]['isUseAgain'] = false //不可以再次使用 |
@@ -72,7 +72,7 @@ | |||
<script setup lang="ts"> | |||
import { reactive } from "vue"; | |||
import { checkStr, msg, navTo } from "@/utils/utils"; | |||
import { checkStr, msg, navTo, subscribeMessages } from "@/utils/utils"; | |||
import { onLoad, onUnload } from "@dcloudio/uni-app"; | |||
import { login, loginCode, loginTime, wechatAppID } from "@/utils/network/api.js"; | |||
import { request } from "@/utils/network/request.js"; | |||
@@ -169,19 +169,13 @@ | |||
subscribeMessages(); | |||
msg("登录成功!"); | |||
uni.$emit("refreshOrder"); | |||
uni.navigateBack(); | |||
// uni.navigateBack(); | |||
uni.switchTab({ | |||
url: '/pages/index/index' | |||
}) | |||
}); | |||
}); | |||
}; | |||
// 订阅消息 | |||
const subscribeMessages = () => { | |||
uni.requestSubscribeMessage({ | |||
tmplIds: ['aNr4T2JEtaLtR9dihM2w3NAznz4bFMkutVZCbaSTjxg'], | |||
success(res) { | |||
console.log("订阅消息", res) | |||
} | |||
}) | |||
} | |||
</script> | |||
<style lang="scss" scoped> |
@@ -855,11 +855,10 @@ | |||
} | |||
}, | |||
{ | |||
"path" : "account-opening-template/account-opening-template", | |||
"style" : | |||
{ | |||
"navigationBarTitleText" : "", | |||
"enablePullDownRefresh" : false | |||
"path": "account-opening-template/account-opening-template", | |||
"style": { | |||
"navigationBarTitleText": "", | |||
"enablePullDownRefresh": false | |||
} | |||
} | |||
] | |||
@@ -878,12 +877,6 @@ | |||
} | |||
} | |||
}, | |||
{ | |||
"path": "takePhoto", | |||
"style": { | |||
"navigationBarTitleText": "" | |||
} | |||
}, | |||
{ | |||
"path": "changeInformation", | |||
"style": { |
@@ -98,11 +98,11 @@ | |||
</view> | |||
<!-- 待激活 --> | |||
<view class="btns" v-else-if="item.orderStep == OrderStatus.待激活"> | |||
<view class="btns" v-else-if="item.orderStep == OrderStatus.待激活 "> | |||
<view class="btn btn-normal" @click.stop="gotoReturnOrder(item)">申请退货</view> | |||
<view class="btn btn-normal" @click.stop="gotoExchangeOrder(item)">申请换货</view> | |||
<view class="btn btn-primary" @click.stop="gotoActiveOrder(item)">去激活 | |||
</view> | |||
<view class="btn btn-primary" @click.stop="gotoActiveOrder(item)">去激活</view> | |||
<view class="btn btn-primary" @click.stop="closeOrder(item)" v-if="item.finishOrder">结束订单</view> | |||
</view> | |||
<!-- 已完成 --> | |||
@@ -121,9 +121,9 @@ | |||
</view> | |||
</view> | |||
<!-- 结束订单 --> | |||
<view class="btns" v-else-if="item.orderStep == OrderStatus.待激活 && item.finishOrder"> | |||
<!-- <view class="btns" v-else-if="item.orderStep == OrderStatus.待激活 && item.finishOrder"> | |||
<view class="btn btn-primary" @click.stop="closeOrder(item)">结束订单</view> | |||
</view> | |||
</view> --> | |||
<!-- 已结束 --> | |||
<view class="btns" v-else-if="item.orderStep == OrderStatus.已结束 && item.isUseAgain"> | |||
<!-- <view class="btn btn-primary" @click.stop="showActiveOrder = true">重新激活订单</view> --> <!-- 以前的 --> |
@@ -286,6 +286,22 @@ | |||
console.log("state.data.opId", state.data.opId) | |||
if (state.data.opId) { | |||
getUserInfo(); | |||
} else { | |||
state.userVehicleInfoSumQueryVo = { | |||
vehicleSum: 0, | |||
orderStatus0: 0 | |||
} | |||
state.monthFlowingVo = { | |||
duration: 0, | |||
mileage: 0, | |||
flowingNum: 0, | |||
num: 0, | |||
parkingLotMoney: 0, | |||
parkingLotNum: 0, | |||
money: 0, | |||
}, | |||
state.list = [], | |||
state.carNumber = 0 | |||
} | |||
}); | |||
// 查询车辆信息 | |||
@@ -323,7 +339,7 @@ | |||
openId: state.data.opId | |||
}, | |||
method: "POST", | |||
// showLoading: true, | |||
showLoading: true, | |||
}; | |||
//调用方式 | |||
request(userInfoIndex, options) |
@@ -327,6 +327,7 @@ | |||
const takePhoto = (val) => { | |||
console.log("拍照", val) | |||
state.phoneType = val; | |||
state.showImg = true; | |||
} | |||
const confirmReturn = (val) => { | |||
if (state.choiceIndex == 3) { |
@@ -264,6 +264,7 @@ | |||
const takePhoto = (val) => { | |||
console.log("拍照", val) | |||
state.phoneType = val; | |||
state.showImg = true; | |||
} | |||
const confirmReturn = (val) => { | |||
if (state.choiceIndex == 3) { |
@@ -264,6 +264,7 @@ | |||
const takePhoto = (val) => { | |||
console.log("拍照", val) | |||
state.phoneType = val; | |||
state.showImg = true; | |||
} | |||
const confirmReturn = (val) => { | |||
if (state.choiceIndex == 3) { |
@@ -257,6 +257,7 @@ | |||
const takePhoto = (val) => { | |||
console.log("拍照", val) | |||
state.phoneType = val; | |||
state.showImg = true; | |||
} | |||
const confirmReturn = (val) => { | |||
if (state.choiceIndex == 3) { |
@@ -78,7 +78,7 @@ | |||
} else if (n == '储值卡') { | |||
state.isValueCard = 1 | |||
} else { | |||
state.isValueCard = 3 | |||
state.isValueCard = 2 | |||
} | |||
uni.redirectTo({ | |||
url: `/subpackage/orders/essential-information?promoteId=${getItem("promoteId")}&userType=${state.userType}&type=${state.type}&isSign=${state.isSign}&isValueCard=${state.isValueCard}`, | |||
@@ -137,9 +137,9 @@ | |||
for (var i = 0; i < state.dataArray.length; i++) { | |||
const cardTypeArr = [] | |||
for (var j = 0; j < state.dataArray[i]['releaseProductStandards']['productStandards'].cardType.length; j++) { | |||
if (state.dataArray[i]['releaseProductStandards']['productStandards'].cardType[j] == '1') { | |||
if (state.dataArray[i]['releaseProductStandards']['productStandards'].cardType[j] == '2') { | |||
cardTypeArr.push('储值卡') | |||
} else if (state.dataArray[i]['releaseProductStandards']['productStandards'].cardType[j] == '2') { | |||
} else if (state.dataArray[i]['releaseProductStandards']['productStandards'].cardType[j] == '1') { | |||
cardTypeArr.push('记账卡') | |||
} else if (state.dataArray[i]['releaseProductStandards']['productStandards'].cardType[j] == '3') { | |||
cardTypeArr.push('预存卡') | |||
@@ -150,7 +150,7 @@ | |||
state.dataArray = state.dataArray.filter(function (e) { | |||
console.log("e", e['releaseProductStandards']['productStandards']['cardType']) | |||
for (var i = 0; i < e['releaseProductStandards']['productStandards']['cardType'].length; i++) { | |||
if (e['releaseProductStandards']['productStandards']['cardType'][i] == "2") { | |||
if (e['releaseProductStandards']['productStandards']['cardType'][i] == "1") { | |||
return e['releaseProductStandards']['productStandards']['cardType']; | |||
} | |||
} |
@@ -558,6 +558,7 @@ | |||
const takePhoto = (val) => { | |||
console.log("拍照", val) | |||
state.phoneType = val; | |||
state.showImg = true; | |||
} | |||
const confirmReturn = (val) => { | |||
if (state.choiceIndex == 3) { |
@@ -75,7 +75,7 @@ | |||
} else if (n == '储值卡') { | |||
state.isValueCard = 1 | |||
} else { | |||
state.isValueCard = 3 | |||
state.isValueCard = 2 | |||
} | |||
// uni.redirectTo({ | |||
// url: `/subpackage/orders/essential-information?promoteId=${getItem("promoteId")}&userType=${state.userType}&type=${state.type}&isSign=${state.isSign}&isValueCard=${state.isValueCard}`, | |||
@@ -113,7 +113,7 @@ | |||
} else if (val['releaseProductStandards']['productStandards']['cardTypeArr'].split(",")[0] == '储值卡') { | |||
state.isValueCard = 1 | |||
} else { | |||
state.isValueCard = 3 | |||
state.isValueCard = 2 | |||
} | |||
console.log("state.isValueCard", state.isValueCard) | |||
setItem("isValueCard", state.isValueCard); | |||
@@ -181,9 +181,9 @@ | |||
for (var i = 0; i < state.dataArray.length; i++) { | |||
const cardTypeArr = [] | |||
for (var j = 0; j < state.dataArray[i]['releaseProductStandards']['productStandards'].cardType.length; j++) { | |||
if (state.dataArray[i]['releaseProductStandards']['productStandards'].cardType[j] == '1') { | |||
if (state.dataArray[i]['releaseProductStandards']['productStandards'].cardType[j] == '2') { | |||
cardTypeArr.push('储值卡') | |||
} else if (state.dataArray[i]['releaseProductStandards']['productStandards'].cardType[j] == '2') { | |||
} else if (state.dataArray[i]['releaseProductStandards']['productStandards'].cardType[j] == '1') { | |||
cardTypeArr.push('记账卡') | |||
} else if (state.dataArray[i]['releaseProductStandards']['productStandards'].cardType[j] == '3') { | |||
cardTypeArr.push('预存卡') |
@@ -90,7 +90,7 @@ | |||
} else if (n == '储值卡') { | |||
state.isValueCard = 1 | |||
} else { | |||
state.isValueCard = 3 | |||
state.isValueCard = 2 | |||
} | |||
uni.redirectTo({ | |||
url: `/subpackage/orders/essential-information?promoteId=${getItem("promoteId")}&userType=${state.userType}&type=${state.type}&isSign=${state.isSign}&isValueCard=${state.isValueCard}`, |
@@ -1,60 +0,0 @@ | |||
<template> | |||
<view> | |||
<viewfinder :phoneType="state.phoneType" @confirmReturn="confirmReturn"></viewfinder> | |||
</view> | |||
</template> | |||
<script setup lang="ts"> | |||
import viewfinder from "../../components/viewfinder.vue" | |||
import { | |||
onLoad | |||
} from "@dcloudio/uni-app"; | |||
import { | |||
reactive | |||
} from "vue"; | |||
const state = reactive({ | |||
phoneType: 1, | |||
allParams: {} | |||
}) | |||
onLoad((option : any) => { | |||
state.phoneType = option.phoneType; | |||
state.allParams = option.allParams; | |||
}); | |||
const confirmReturn = (val) => { | |||
// uni.navigateTo({ | |||
// url: `` | |||
// }) | |||
uni.navigateBack({ | |||
delta: 1 | |||
}) | |||
console.log("val", val) | |||
} | |||
</script> | |||
<style> | |||
.content { | |||
display: flex; | |||
flex-direction: column; | |||
align-items: center; | |||
justify-content: center; | |||
} | |||
.logo { | |||
height: 200rpx; | |||
width: 200rpx; | |||
margin-top: 200rpx; | |||
margin-left: auto; | |||
margin-right: auto; | |||
margin-bottom: 50rpx; | |||
} | |||
.text-area { | |||
display: flex; | |||
justify-content: center; | |||
} | |||
.title { | |||
font-size: 36rpx; | |||
color: #8f8f94; | |||
} | |||
</style> |
@@ -23,9 +23,9 @@ | |||
<script setup lang="ts"> | |||
import { reactive } from "vue"; | |||
import { checkStr, msg, navTo } from "@/utils/utils"; | |||
import { checkStr, msg, navTo, subscribeMessages } from "@/utils/utils"; | |||
import { onLoad, onUnload } from "@dcloudio/uni-app"; | |||
import { checkCode } from "@/utils/network/api.js"; | |||
import { checkCode, loginCode, loginTime } from "@/utils/network/api.js"; | |||
import { request } from "@/utils/network/request.js"; | |||
import { stringToJson } from "@/utils/network/encryption"; | |||
import { useUserStore } from "@/stores/user"; | |||
@@ -50,19 +50,19 @@ | |||
console.log(q); | |||
state.json = getRequest(q) | |||
console.log("state.json", state.json, getItem("mobile"), getItem("mobile") == state.json.phone) | |||
setItem('scanCode', state.json) | |||
if (!getItem("mobile")) { | |||
uni.showModal({ | |||
title: '提示', | |||
content: '您还未登录小程序,请先登录小程序', | |||
showCancel: false, | |||
success: function (res) { | |||
if (res.confirm) { | |||
navTo('/login/login') | |||
} | |||
} | |||
}); | |||
} | |||
// setItem('scanCode', state.json) | |||
// if (!getItem("mobile")) { | |||
// uni.showModal({ | |||
// title: '提示', | |||
// content: '您还未登录小程序,请先登录小程序', | |||
// showCancel: false, | |||
// success: function (res) { | |||
// if (res.confirm) { | |||
// navTo('/login/login') | |||
// } | |||
// } | |||
// }); | |||
// } | |||
// 直接用传过来的手机号(不让他修改) | |||
state.mobile = state.json.phone | |||
} else { | |||
@@ -87,33 +87,43 @@ | |||
msg("请输入正确的手机号!"); | |||
return; | |||
} | |||
// 直接去登录 | |||
reqLogin(loginCode, { | |||
mobile: state.mobile, | |||
code: state.code, | |||
loginTime: loginTime, | |||
}); | |||
}; | |||
/* 执行登录 */ | |||
const reqLogin = (code : string, data : object) => { | |||
console.log(code, data); | |||
const options = { | |||
type: 2, | |||
data: { | |||
mobile: state.mobile, | |||
code: state.code | |||
}, | |||
data: data, | |||
method: "POST", | |||
showLoading: true, | |||
}; | |||
request(checkCode, options).then((res) => { | |||
console.log("过来了", res) | |||
// type 1扫码支付 2扫描协议确认 | |||
if (state.json.type == 1) { | |||
uni.navigateTo({ | |||
url: `/subpackage/orders/order_payment?orderId=${state.json.orderId}`, | |||
}); | |||
} else if (state.json.type == 2) { | |||
uni.navigateTo({ | |||
url: `/subpackage/orders/product-detail?orderId=${state.json.orderId}&url=${state.json.url}&typeScanCode=${state.json.type}`, | |||
}); | |||
} | |||
}) | |||
.catch((err) => { | |||
// msg("验证码错误"); | |||
request(code, options).then((res) => { | |||
const result = stringToJson(res.bizContent); | |||
console.log(result); | |||
console.log(typeof (result)); | |||
fetchToken(result.code).then((data : any) => { | |||
console.log("登录", data); | |||
setItem('mobile', state.mobile) | |||
subscribeMessages(); | |||
if (state.json.type == 1) { | |||
uni.navigateTo({ | |||
url: `/subpackage/orders/order_payment?orderId=${state.json.orderId}`, | |||
}); | |||
} else if (state.json.type == 2) { | |||
uni.navigateTo({ | |||
url: `/subpackage/orders/product-detail?orderId=${state.json.orderId}&url=${state.json.url}&typeScanCode=${state.json.type}`, | |||
}); | |||
} | |||
}); | |||
}); | |||
}; | |||
//解析URL获取参数 | |||
const getRequest = (urlStr) => { | |||
if (typeof urlStr == "undefined") { |
@@ -364,6 +364,7 @@ | |||
const takePhoto = (val) => { | |||
console.log("拍照", val) | |||
state.phoneType = val; | |||
state.showImg = true; | |||
} | |||
const confirmReturn = (val) => { | |||
if (state.choiceIndex == 3) { |
@@ -344,6 +344,7 @@ | |||
const takePhoto = (val) => { | |||
console.log("拍照", val) | |||
state.phoneType = val; | |||
state.showImg = true; | |||
} | |||
const confirmReturn = (val) => { | |||
state.phoneType = 0 |
@@ -307,6 +307,7 @@ | |||
const takePhoto = (val) => { | |||
console.log("拍照", val) | |||
state.phoneType = val; | |||
state.showImg = true; | |||
} | |||
const confirmReturn = (val) => { | |||
state.phoneType = 0 |
@@ -103,7 +103,9 @@ export function request(code, options = {}, start = false) { | |||
options.success = (res) => { | |||
console.log('请求成功返回参数:', code, res) | |||
// 请求返回后,隐藏loading(如果请求返回快的话,可能会没有loading) | |||
uni.hideLoading() | |||
if (options.showLoading) { | |||
uni.hideLoading() | |||
} | |||
if (res.data.statusCode !== 0) { | |||
if (res.data.statusCode == 600) { | |||
resolve(res.data) |
@@ -497,28 +497,37 @@ export const uploadFile = (tempImagePath, imageType, code) => { | |||
* @param {*} timesData '2018-05-17 16:58:00' | |||
* @returns | |||
*/ | |||
export function timesDiff(timesData:any) { | |||
var dateBegin = new Date();//获取当前时间 | |||
var dateEnd = new Date(timesData.replace(/-/g, "/"));//将-转化为/,使用new Date | |||
var dateDiff = dateEnd.getTime() - dateBegin.getTime();//时间差的毫秒数 | |||
var days = Math.floor(dateDiff / (24 * 3600 * 1000));//计算出相差天数 | |||
var leave1 = dateDiff % (24 * 3600 * 1000) //计算天数后剩余的毫秒数 | |||
var hours = Math.floor(leave1 / (3600 * 1000))//计算出小时数 | |||
var leave2 = leave1 % (3600 * 1000) //计算小时数后剩余的毫秒数 | |||
var minutes = Math.floor(leave2 / (60 * 1000))//计算相差分钟数 | |||
var diffObj = { | |||
days: 0, | |||
hours: 0, | |||
minutes: 0, | |||
}; | |||
export function timesDiff(timesData : any) { | |||
var dateBegin = new Date();//获取当前时间 | |||
var dateEnd = new Date(timesData.replace(/-/g, "/"));//将-转化为/,使用new Date | |||
var dateDiff = dateEnd.getTime() - dateBegin.getTime();//时间差的毫秒数 | |||
var days = Math.floor(dateDiff / (24 * 3600 * 1000));//计算出相差天数 | |||
var leave1 = dateDiff % (24 * 3600 * 1000) //计算天数后剩余的毫秒数 | |||
var hours = Math.floor(leave1 / (3600 * 1000))//计算出小时数 | |||
var leave2 = leave1 % (3600 * 1000) //计算小时数后剩余的毫秒数 | |||
var minutes = Math.floor(leave2 / (60 * 1000))//计算相差分钟数 | |||
var diffObj = { | |||
days: 0, | |||
hours: 0, | |||
minutes: 0, | |||
}; | |||
if (days != 0) { | |||
diffObj.days = days; | |||
} else if (days == 0 && hours != 0) { | |||
diffObj.hours = hours; | |||
} else if (days == 0 && hours == 0) { | |||
diffObj.minutes = minutes; | |||
} | |||
if (days != 0) { | |||
diffObj.days = Math.abs(days); | |||
} else if (days == 0 && hours != 0) { | |||
diffObj.hours = hours; | |||
} else if (days == 0 && hours == 0) { | |||
diffObj.minutes = minutes; | |||
} | |||
return diffObj | |||
return diffObj | |||
} | |||
// 订阅消息 | |||
export function subscribeMessages() { | |||
uni.requestSubscribeMessage({ | |||
tmplIds: ['aNr4T2JEtaLtR9dihM2w3NAznz4bFMkutVZCbaSTjxg'], | |||
success(res) { | |||
console.log("订阅消息", res) | |||
} | |||
}) | |||
} |