</template> | </template> | ||||
<script setup lang="ts"> | <script setup lang="ts"> | ||||
import { onLoad, onPageScroll } from "@dcloudio/uni-app"; | |||||
import { onLoad, onPageScroll,onShow } from "@dcloudio/uni-app"; | |||||
import { reactive, ref } from "vue"; | import { reactive, ref } from "vue"; | ||||
import { | import { | ||||
PAYMENTORDERAPPLY, | PAYMENTORDERAPPLY, | ||||
aliPayConfigIdTwo, | aliPayConfigIdTwo, | ||||
obtainUserId, | obtainUserId, | ||||
getOpenId, payApply, payQuery | |||||
getOpenId, payApply, payQuery,orderQueryDetail | |||||
} from "@/utils/network/api.js"; | } from "@/utils/network/api.js"; | ||||
import { request, requestNew } from "@/utils/network/request.js"; | import { request, requestNew } from "@/utils/network/request.js"; | ||||
import { stringToJson } from "@/utils/network/encryption"; | import { stringToJson } from "@/utils/network/encryption"; | ||||
import navBar from "@/components/nav-bar/nav-bar2.vue"; | import navBar from "@/components/nav-bar/nav-bar2.vue"; | ||||
const imgURL = `${fileURL}image/`; | const imgURL = `${fileURL}image/`; | ||||
import { confirm, navTo } from "@/utils/utils"; | import { confirm, navTo } from "@/utils/utils"; | ||||
import { | |||||
OrderStatus | |||||
} from "@/datas/enum"; | |||||
import useOrderSkip from "@/composables/order/useOrderSkip"; | |||||
const { gotoActiveOrder } = useOrderSkip(); | |||||
import { | |||||
setItem | |||||
} from "@/utils/storage"; | |||||
const tools = require("../../static/etcUtil/tools.js"); | const tools = require("../../static/etcUtil/tools.js"); | ||||
let imageUrl = "" | let imageUrl = "" | ||||
console.log("state.dataArray", state.dataArray) | console.log("state.dataArray", state.dataArray) | ||||
}); | }); | ||||
} | } | ||||
onShow(()=>{ | |||||
if(state.continue=1){ | |||||
orderDetail(state.orderId) | |||||
} | |||||
}) | |||||
// 车辆详情 | |||||
const orderDetail = (orderNo) => { | |||||
const options = { | |||||
type: 2, | |||||
data: { | |||||
orderNo | |||||
}, | |||||
method: "POST", | |||||
showLoading: true, | |||||
}; | |||||
requestNew(orderQueryDetail, options).then((res) => { | |||||
console.log("orderQueryDetail", res) | |||||
if (res['orderStep'] == OrderStatus['待激活']) { | |||||
// 待激活 | |||||
gotoActiveOrder(res) | |||||
} | |||||
}) | |||||
} | |||||
onLoad((option : any) => { | onLoad((option : any) => { | ||||
console.log("传递过来的到支付页面", option) | console.log("传递过来的到支付页面", option) | ||||
state.orderId = option.orderId; | state.orderId = option.orderId; | ||||
extraData: {}, | extraData: {}, | ||||
envVersion:'trial', | envVersion:'trial', | ||||
success(res) { | success(res) { | ||||
state.continue=1 | |||||
console.log(res); | console.log(res); | ||||
}, | }, | ||||
complete(res) { | complete(res) { | ||||
tools.toUrl(`/subpackage/personal-center/webview?url=` + params) | tools.toUrl(`/subpackage/personal-center/webview?url=` + params) | ||||
} | } | ||||
}else{ | }else{ | ||||
uni.navigateBack() | |||||
// 签约 | |||||
navTo( | |||||
`/subpackage/orders/release-products?orderId=${state.orderId}&orderQuery=${state.orderQuery}`, | |||||
); | |||||
} | } | ||||
}else{ | }else{ | ||||
if (state.isValueCard == 1) { | if (state.isValueCard == 1) { | ||||
extraData: {}, | extraData: {}, | ||||
envVersion:'trial', | envVersion:'trial', | ||||
success(res) { | success(res) { | ||||
state.continue=1 | |||||
console.log(res); | console.log(res); | ||||
}, | }, | ||||
complete(res) { | complete(res) { | ||||
tools.toUrl(`/subpackage/personal-center/webview?url=` + params) | tools.toUrl(`/subpackage/personal-center/webview?url=` + params) | ||||
} | } | ||||
}else{ | }else{ | ||||
uni.navigateBack() | |||||
// 签约 | |||||
navTo( | |||||
`/subpackage/orders/release-products?orderId=${state.orderId}&orderQuery=${state.orderQuery}`, | |||||
); | |||||
} | } | ||||
}else{ | }else{ | ||||
if (state.isValueCard == 1) { | if (state.isValueCard == 1) { | ||||
openidData: {}, | openidData: {}, | ||||
qdSignUrl:"", | qdSignUrl:"", | ||||
qdSignAppId:"", | qdSignAppId:"", | ||||
qtSign:"" | |||||
qtSign:"", | |||||
continue:0,//继续执行,不需要点击 | |||||
}); | }); | ||||
</script> | </script> |
isDetails: false, | isDetails: false, | ||||
orderId: "", | orderId: "", | ||||
words: "", | words: "", | ||||
carAll:"" | |||||
carAll:"", | |||||
continue:0,//继续执行,不需要点击 | |||||
}); | }); | ||||
onShow(() => { | onShow(() => { | ||||
if (state.orderId) { | if (state.orderId) { | ||||
state.continue=1 | |||||
// 签约完回来 | // 签约完回来 | ||||
orderDetail(state.orderId) | orderDetail(state.orderId) | ||||
contractRequest() | contractRequest() | ||||
} else if (state.details['orderStep'] == OrderStatus['待审核']) { | } else if (state.details['orderStep'] == OrderStatus['待审核']) { | ||||
// 待激活 | // 待激活 | ||||
state.words = "待审核" | state.words = "待审核" | ||||
} else if (state.details['orderStep'] == OrderStatus['审核不通过']) { | |||||
// 待激活 | |||||
state.words = "审核不通过" | |||||
} | |||||
console.log("continue",state.continue) | |||||
if(state.continue==1){ | |||||
savaHandle() | |||||
} | } | ||||
} | } | ||||
} | } | ||||
const savaHandle = () => { | const savaHandle = () => { | ||||
if (state.checked) { | |||||
if (state.details['orderStatus'] != OrderStatus.已取消) { | |||||
// 去支付 | |||||
if (state.details['orderStep'] == OrderStatus['完成车辆信息上传/待支付'] || state.details['orderStep'] == OrderStatus['待支付2']) { | |||||
agreementConfirm().then((value) => { | |||||
console.log("协议确认", value) | |||||
let vehicleId = state.details['vehiclePlate'] + "_" + state.details['vehiclePlateColor'] | |||||
let isValueCard = 1 | |||||
// qtSign 1 去签约 | |||||
if (state.details['qtSign'] == 1) { | |||||
isValueCard = 2 | |||||
} | |||||
// orderQuery 1 订单查询 0正常订单 | |||||
navTo(`/subpackage/orders/order_payment?orderId=${state.orderId}&&qtSign=${state.details['qtSign']}&vehicleId=${vehicleId}&orderQuery=1&qdSignUrl=${state.details['qdSignUrl']}&qdSignAppId=${state.details['qdSignAppId']}`); | |||||
}) | |||||
} else if (state.details['orderStep'] == OrderStatus['已支付/待签约']) { | |||||
// 去签约 | |||||
if (state.details['qtSign'] == 0) { | |||||
if(state.details['qdSignAppId']){ | |||||
uni.navigateToMiniProgram({ | |||||
appId: state.details['qdSignAppId'], | |||||
path: state.details['qdSignUrl'], | |||||
extraData: {}, | |||||
envVersion:'trial', | |||||
success(res) { | |||||
console.log(res); | |||||
}, | |||||
complete(res) { | |||||
console.log(res); | |||||
}, | |||||
fail(res) { | |||||
console.log(res); | |||||
// 未成功跳转到车主小程序 | |||||
}, | |||||
}); | |||||
}else{ | |||||
const params = encodeURIComponent(JSON.stringify(state.details['qdSignUrl'])) | |||||
tools.toUrl(`/subpackage/personal-center/webview?url=` + params) | |||||
if(state.words == "待审核" || state.words == "审核不通过"){ | |||||
return; | |||||
}else{ | |||||
if (state.checked) { | |||||
if (state.details['orderStatus'] != OrderStatus.已取消) { | |||||
// 去支付 | |||||
if (state.details['orderStep'] == OrderStatus['完成车辆信息上传/待支付'] || state.details['orderStep'] == OrderStatus['待支付2']) { | |||||
agreementConfirm().then((value) => { | |||||
console.log("协议确认", value) | |||||
let vehicleId = state.details['vehiclePlate'] + "_" + state.details['vehiclePlateColor'] | |||||
// qtSign 1 去签约 | |||||
// orderQuery 1 订单查询 0正常订单 | |||||
navTo(`/subpackage/orders/order_payment?orderId=${state.orderId}&&qtSign=${state.details['qtSign']}&vehicleId=${vehicleId}&orderQuery=1&qdSignUrl=${state.details['qdSignUrl']}&qdSignAppId=${state.details['qdSignAppId']}`); | |||||
}) | |||||
} else if (state.details['orderStep'] == OrderStatus['已支付/待签约']) { | |||||
// 去签约 | |||||
if (state.details['qtSign'] == 0) { | |||||
if(state.details['qdSignAppId']){ | |||||
uni.navigateToMiniProgram({ | |||||
appId: state.details['qdSignAppId'], | |||||
path: state.details['qdSignUrl'], | |||||
extraData: {}, | |||||
envVersion:'trial', | |||||
success(res) { | |||||
console.log(res); | |||||
}, | |||||
complete(res) { | |||||
console.log(res); | |||||
}, | |||||
fail(res) { | |||||
console.log(res); | |||||
// 未成功跳转到车主小程序 | |||||
}, | |||||
}); | |||||
}else{ | |||||
const params = encodeURIComponent(JSON.stringify(state.details['qdSignUrl'])) | |||||
tools.toUrl(`/subpackage/personal-center/webview?url=` + params) | |||||
} | |||||
} else { | |||||
navTo(`/subpackage/orders/release-products?orderId=${state.orderId}&orderQuery=1`); | |||||
} | } | ||||
} else { | |||||
navTo(`/subpackage/orders/release-products?orderId=${state.orderId}&orderQuery=1`); | |||||
} else if (state.details['orderStep'] == OrderStatus['待激活']) { | |||||
// 待激活 | |||||
gotoActiveOrder(state.details) | |||||
} | } | ||||
} else if (state.details['orderStep'] == OrderStatus['待激活']) { | |||||
// 待激活 | |||||
gotoActiveOrder(state.details) | |||||
} | } | ||||
} else { | |||||
msg("请勾选协议"); | |||||
} | } | ||||
} else { | |||||
msg("请勾选协议"); | |||||
} | } | ||||
} | } | ||||
// 协议确认接口 | // 协议确认接口 | ||||
const agreementConfirm = () => { | const agreementConfirm = () => { |