代码更新
This commit is contained in:
@@ -193,7 +193,7 @@
|
||||
<template v-if="order.status=='unpaid'">
|
||||
<up-loading-icon size="14" text="等待支付"></up-loading-icon>
|
||||
</template>
|
||||
<template v-if="order.status=='closed'">
|
||||
<template v-if="order.status=='done'">
|
||||
<view class="u-flex pay-success">
|
||||
<up-icon color="#5CBB6F" name="checkmark-circle-fill"></up-icon>
|
||||
<view class="u-m-l-6">支付成功</view>
|
||||
@@ -257,6 +257,10 @@
|
||||
returnProductCoupAllPrice,
|
||||
returnProductCanUseNum
|
||||
} from '../quan_util.js'
|
||||
|
||||
import { getHistoryOrder } from '@/api/order.js'
|
||||
import { getPayTypeList } from '@/api/payType.js'
|
||||
|
||||
|
||||
const modal = reactive({
|
||||
title: '提示',
|
||||
@@ -267,7 +271,80 @@
|
||||
show: false,
|
||||
data: ''
|
||||
})
|
||||
|
||||
let option = {
|
||||
isNowPay: false
|
||||
}
|
||||
|
||||
const order = reactive({
|
||||
amount: 0
|
||||
})
|
||||
onShow(() => {
|
||||
watchChooseuser()
|
||||
watchChooseQuan()
|
||||
})
|
||||
onLoad(async (opt) => {
|
||||
console.log(opt);
|
||||
option = opt
|
||||
Object.assign(order, opt)
|
||||
getPayType()
|
||||
init()
|
||||
})
|
||||
|
||||
watch(() => pays.selIndex, (newval) => {
|
||||
clearInterval(timer)
|
||||
if (newval) {
|
||||
timer = setInterval(() => {
|
||||
orderApi.tbOrderInfoDetail(order.orderId).then(res => {
|
||||
order.status = res.status
|
||||
if (res.status == 'done') {
|
||||
paySuccess()
|
||||
}
|
||||
})
|
||||
}, 2000)
|
||||
} else {
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
async function init() {
|
||||
const orderRes = await getHistoryOrder({orderId:order.orderId})
|
||||
console.log(orderRes)
|
||||
Object.assign(order, orderRes)
|
||||
$goodsPayPriceMap = returnGoodsPayPriceMap(order.detailList)
|
||||
const hasSelQuan = orderRes.couponInfoList ? JSON.parse(orderRes.couponInfoList) : {
|
||||
fullReductionCoupon: [],
|
||||
productCoupon: []
|
||||
};
|
||||
const fullReductionCoupon = hasSelQuan.fullReductionCoupon.filter(v => v.type == 1)
|
||||
const productCoupon = hasSelQuan.productCoupon.filter(v => v.type == 2)
|
||||
setQuan([...fullReductionCoupon, ...productCoupon])
|
||||
|
||||
if (orderRes.memberId) {
|
||||
calcUsablePoints()
|
||||
if (orderRes.pointsNum) {
|
||||
accountPoints.sel = true
|
||||
}
|
||||
queryAllShopUser({
|
||||
id: orderRes.memberId
|
||||
}).then(res => {
|
||||
if (res.content[0]) {
|
||||
user.value = res.content[0]
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 支付方式
|
||||
*/
|
||||
async function getPayType() {
|
||||
const payTypeList = await getPayTypeList()
|
||||
pays.payTypes.list = payTypeList.map(v => {
|
||||
return {
|
||||
...v,
|
||||
disabled: false
|
||||
}
|
||||
})
|
||||
}
|
||||
function confirmModelCancel() {
|
||||
if (modal.key == 'fullCoupon') {
|
||||
// 取消改价
|
||||
@@ -402,9 +479,7 @@
|
||||
showModel('editMoney', true)
|
||||
}
|
||||
}
|
||||
let option = {
|
||||
isNowPay: false
|
||||
}
|
||||
|
||||
let payFinish = ref(false)
|
||||
onBackPress(() => {
|
||||
uni.$emit('orderDetail:update')
|
||||
@@ -461,21 +536,7 @@
|
||||
return Api.$setUser(submitPar)
|
||||
}
|
||||
|
||||
function watchChooseuser() {
|
||||
uni.$off('choose-user')
|
||||
uni.$on('choose-user', (data) => {
|
||||
console.log(data);
|
||||
pays.quan = []
|
||||
setUser({
|
||||
vipUserId: data.id ? data.id : '',
|
||||
type: data.id ? 0 : 1 //0 设置 1 取消
|
||||
}).then(res => {
|
||||
user.value = data
|
||||
order.memberId = data.id
|
||||
init()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function setQuan(arr) {
|
||||
console.log(arr);
|
||||
@@ -525,27 +586,22 @@
|
||||
setQuan(arr)
|
||||
})
|
||||
}
|
||||
function watchChooseuser() {
|
||||
uni.$off('choose-user')
|
||||
uni.$on('choose-user', (data) => {
|
||||
console.log(data);
|
||||
pays.quan = []
|
||||
setUser({
|
||||
vipUserId: data.id ? data.id : '',
|
||||
type: data.id ? 0 : 1 //0 设置 1 取消
|
||||
}).then(res => {
|
||||
user.value = data
|
||||
order.memberId = data.id
|
||||
init()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
onShow(() => {
|
||||
watchChooseuser()
|
||||
watchChooseQuan()
|
||||
})
|
||||
|
||||
watch(() => pays.selIndex, (newval) => {
|
||||
clearInterval(timer)
|
||||
if (newval) {
|
||||
timer = setInterval(() => {
|
||||
orderApi.tbOrderInfoDetail(order.orderId).then(res => {
|
||||
order.status = res.status
|
||||
if (res.status == 'closed') {
|
||||
paySuccess()
|
||||
}
|
||||
})
|
||||
}, 2000)
|
||||
} else {
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
const models = new Map();
|
||||
|
||||
@@ -584,16 +640,8 @@
|
||||
}
|
||||
getPayUrl()
|
||||
}
|
||||
|
||||
|
||||
async function getPayType() {
|
||||
const payTypeList = await Api.$getPayType()
|
||||
pays.payTypes.list = payTypeList.map(v => {
|
||||
return {
|
||||
...v,
|
||||
disabled: false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function changePayType(i, item) {
|
||||
if (item.disabled) {
|
||||
@@ -675,9 +723,6 @@
|
||||
paySuccess()
|
||||
}
|
||||
|
||||
const order = reactive({
|
||||
amount: 0
|
||||
})
|
||||
|
||||
|
||||
|
||||
@@ -709,32 +754,7 @@
|
||||
// }
|
||||
})
|
||||
let payCodeUrl = ref('')
|
||||
async function init() {
|
||||
const orderRes = await orderApi.tbOrderInfoDetail(order.orderId)
|
||||
Object.assign(order, orderRes)
|
||||
$goodsPayPriceMap = returnGoodsPayPriceMap(order.detailList)
|
||||
const hasSelQuan = orderRes.couponInfoList ? JSON.parse(orderRes.couponInfoList) : {
|
||||
fullReductionCoupon: [],
|
||||
productCoupon: []
|
||||
};
|
||||
const fullReductionCoupon = hasSelQuan.fullReductionCoupon.filter(v => v.type == 1)
|
||||
const productCoupon = hasSelQuan.productCoupon.filter(v => v.type == 2)
|
||||
setQuan([...fullReductionCoupon, ...productCoupon])
|
||||
|
||||
if (orderRes.memberId) {
|
||||
calcUsablePoints()
|
||||
if (orderRes.pointsNum) {
|
||||
accountPoints.sel = true
|
||||
}
|
||||
queryAllShopUser({
|
||||
id: orderRes.memberId
|
||||
}).then(res => {
|
||||
if (res.content[0]) {
|
||||
user.value = res.content[0]
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function getPayUrl() {
|
||||
orderApi.$getOrderPayUrl({
|
||||
@@ -816,13 +836,7 @@
|
||||
calcUsablePoints()
|
||||
})
|
||||
|
||||
onLoad(async (opt) => {
|
||||
console.log(opt);
|
||||
option = opt
|
||||
Object.assign(order, opt)
|
||||
getPayType()
|
||||
init()
|
||||
})
|
||||
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
console.log('onBeforeUnmount');
|
||||
|
||||
Reference in New Issue
Block a user